Connection Object

Note

Any outstanding changes will be rolled back when the connection object is destroyed or closed.

Connection.__enter__()

The entry point for the connection as a context manager.

Note

This method is an extension to the DB API definition.

Connection.__exit__()

The exit point for the connection as a context manager. In the event of an exception, the transaction is rolled back; otherwise, the transaction is committed.

Note

This method is an extension to the DB API definition.

Connection.autocommit

This read-write attribute returns the setting of the autocommit flag for the connection. When set, any statements executed are automatically committed if successful; otherwise, a commit() or rollback() must be issued for the changes to be committed to (or rolled back from) the database.

Note

This attribute is an extension to the DB API definition.

Connection.close()

Close the connection now, rather than whenever __del__ is called. The connection will be unusable from this point forward; an Error exception will be raised if any operation is attempted with the connection. The same applies to any cursor objects trying to use the connection.

Connection.columnprivileges(catalog=None, schema=None, table=None, column=None)

Return a cursor containing the privileges for columns in the catalog filtered by the parameters catalog, schema, table and column as desired. See the ODBC API reference for SQLColumnPrivileges() for more information.

Note

This method is an extension to the DB API definition.

Connection.columns(catalog=None, schema=None, table=None, column=None)

Return a cursor containing the columns in the catalog filtered by the parameters catalog, schema, table and column as desired. See the ODBC API reference for SQLColumns() for more information.

Note

This method is an extension to the DB API definition.

Connection.commit()

Commit any pending transactions to the database.

Connection.cursor()

Return a new Cursor object (Cursor Object) using the connection.

Connection.dsn

This read-only attribute returns the DSN of the database to which a connection has been established.

Note

This attribute is an extension to the DB API definition.

Connection.inputtypehandler

This read-write attribute specifies a method called for each value that is bound to a statement executed on any cursor associated with this connection, unless a different handler is specified for that cursor. The method signature is handler(cursor, value, arraysize) and the return value is expected to be a variable object or None in which case a default variable object will be created. If this attribute is None, the default behavior will take place for all values bound to statements.

Note

This attribute is an extension to the DB API definition.

Connection.foreignkeys(pkcatalog=None, pkschema=None, pktable=None, fkcatalog=None, fkschema=None, fktable=None)

Return a cursor containing the foreign keys in the catalog filtered by the parameters catalog, schema and table for both the primary and foreign key table as desired. See the ODBC API reference for SQLForeignKeys() for more information.

Note

This method is an extension to the DB API definition.

Connection.outputtypehandler

This read-write attribute specifies a method called for each value that is to be fetched from any cursor associated with this connection, unless a different handler is specified for that cursor. The method signature is handler(cursor, name, defaultType, length, scale) and the return value is expected to be a variable object or None in which case a default variable object will be created. If this attribute is None, the default behavior will take place for all values fetched from cursors.

Note

This attribute is an extension to the DB API definition.

Connection.primarykeys(catalog=None, schema=None, table=None)

Return a cursor containing the primary key columns in the catalog filtered by the parameters catalog, schema and table as desired. See the ODBC API reference for SQLPrimaryKeys() for more information.

Note

This method is an extension to the DB API definition.

Connection.procedurecolumns(catalog=None, schema=None, proc=None, column=None)

Return a cursor containing the columns for procedures in the catalog filtered by the parameters catalog, schema, proc and column as desired. See the ODBC API reference for SQLProcedureColumns() for more information.

Note

This method is an extension to the DB API definition.

Connection.procedures(catalog=None, schema=None, proc=None)

Return a cursor containing the procedures in the catalog filtered by the parameters catalog, schema and proc as desired. See the ODBC API reference for SQLProcedures() for more information.

Note

This method is an extension to the DB API definition.

Connection.rollback()

Rollback any pending transactions.

Connection.tableprivileges(catalog=None, schema=None, table=None)

Return a cursor containing the privileges for tables in the catalog filtered by the parameters catalog, schema and table as desired. See the ODBC API reference for SQLTablePrivileges() for more information.

Note

This method is an extension to the DB API definition.

Connection.tables(catalog=None, schema=None, table=None)

Return a cursor containing the tables in the catalog filtered by the parameters catalog, schema and table as desired. See the ODBC API reference for SQLTables() for more information.

Note

This method is an extension to the DB API definition.