sqlite3.Connection.set_progress_handler()

set_progress_handler(handler, n) This routine registers a callback. The callback is invoked for every n instructions of the SQLite virtual machine. This is useful if you want to get called from SQLite during long-running operations, for example to update a GUI. If you want to clear any previously installed progress handler, call the method with None for handler.

sqlite3.Connection.set_authorizer()

set_authorizer(authorizer_callback) This routine registers a callback. The callback is invoked for each attempt to access a column of a table in the database. The callback should return SQLITE_OK if access is allowed, SQLITE_DENY if the entire SQL statement should be aborted with an error and SQLITE_IGNORE if the column should be treated as a NULL value. These constants are available in the sqlite3 module. The first argument to the callback signifies what kind of operation is to be authorize

sqlite3.Connection.row_factory

row_factory You can change this attribute to a callable that accepts the cursor and the original row as a tuple and will return the real result row. This way, you can implement more advanced ways of returning results, such as returning an object that can also access columns by name. Example: import sqlite3 def dict_factory(cursor, row): d = {} for idx, col in enumerate(cursor.description): d[col[0]] = row[idx] return d con = sqlite3.connect(":memory:") con.row_factory =

sqlite3.Connection.rollback()

rollback() This method rolls back any changes to the database since the last call to commit().

sqlite3.Connection.load_extension()

load_extension(path) This routine loads a SQLite extension from a shared library. You have to enable extension loading with enable_load_extension() before you can use this routine. Loadable extensions are disabled by default. See [1]. New in version 3.2.

sqlite3.Connection.iterdump()

iterdump() Returns an iterator to dump the database in an SQL text format. Useful when saving an in-memory database for later restoration. This function provides the same capabilities as the .dump command in the sqlite3 shell. Example: # Convert file existing_db.db to SQL dump file dump.sql import sqlite3 con = sqlite3.connect('existing_db.db') with open('dump.sql', 'w') as f: for line in con.iterdump(): f.write('%s\n' % line)

sqlite3.Connection.isolation_level

isolation_level Get or set the current isolation level. None for autocommit mode or one of “DEFERRED”, “IMMEDIATE” or “EXCLUSIVE”. See section Controlling Transactions for a more detailed explanation.

sqlite3.Connection.in_transaction

in_transaction True if a transaction is active (there are uncommitted changes), False otherwise. Read-only attribute. New in version 3.2.

sqlite3.Connection.interrupt()

interrupt() You can call this method from a different thread to abort any queries that might be executing on the connection. The query will then abort and the caller will get an exception.

sqlite3.Connection.executescript()

executescript(sql_script) This is a nonstandard shortcut that creates a cursor object by calling the cursor() method, calls the cursor’s executescript() method with the given sql_script, and returns the cursor.