BioSQL.DBUtils module

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

class BioSQL.DBUtils.Generic_dbutils

Bases: object

Default database utilities.

__init__()

Create a Generic_dbutils object.

tname(table)

Return the name of the table.

last_id(cursor, table)

Return the last used id for a table.

execute(cursor, sql, args=None)

Just execute an sql command.

executemany(cursor, sql, seq)

Execute many sql commands.

autocommit(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(cursor, sql, args=None)

Execute SQL command.

Replaces %s with ? for variable substitution in sqlite3.

executemany(cursor, sql, seq)

Execute many sql statements.

class BioSQL.DBUtils.Mysql_dbutils

Bases: BioSQL.DBUtils.Generic_dbutils

Custom database utilities for MySQL.

last_id(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(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(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.