BioSQL.DBUtils module

Helper code for Biopython’s BioSQL code (for internal use).

class BioSQL.DBUtils.Generic_dbutils

Bases: object

Default database utilities.

__init__(self)

Create a Generic_dbutils object.

tname(self, table)

Return the name of the table.

last_id(self, cursor, table)

Return the last used id for a table.

execute(self, cursor, sql, args=None)

Just execute an sql command.

executemany(self, cursor, sql, seq)

Execute many sql commands.

autocommit(self, conn, y=1)

Set autocommit on the database connection.

class BioSQL.DBUtils.Sqlite_dbutils

Bases: BioSQL.DBUtils.Generic_dbutils

Custom database utilities for SQLite.

execute(self, cursor, sql, args=None)

Execute SQL command.

Replaces %s with ? for variable substitution in sqlite3.

executemany(self, cursor, sql, seq)

Execute many sql statements.

class BioSQL.DBUtils.Mysql_dbutils

Bases: BioSQL.DBUtils.Generic_dbutils

Custom database utilities for MySQL.

last_id(self, cursor, table)

Return the last used id for a table.

class BioSQL.DBUtils.Psycopg2_dbutils

Bases: BioSQL.DBUtils._PostgreSQL_dbutils

Custom database utilities for Psycopg2 (PostgreSQL).

autocommit(self, conn, y=True)

Set autocommit on the database connection.

class BioSQL.DBUtils.Pgdb_dbutils

Bases: BioSQL.DBUtils._PostgreSQL_dbutils

Custom database utilities for Pgdb (aka PyGreSQL, for PostgreSQL).

autocommit(self, conn, y=True)

Set autocommit on the database connection. Currently not implemented.

BioSQL.DBUtils.get_dbutils(module_name)

Return the correct dbutils object for the database driver.