Module Interface

ceODBC.Binary(string)

Construct an object holding a binary (long) string value. This is merely a wrapper over the bytes class and that should be used instead.

ceODBC.Connection(dsn, autocommit=False)
ceODBC.connect(dsn, autocommit=False)

Constructor for creating a connection. The only required argument is the DSN in the format that ODBC expects. The autocommit flag can be set in the constructor or it can be manipulated after the connection has been established. If you are using a driver that does not handle transactions, ensure that this value is set to True or you may get a “driver not capable” exception.

ceODBC.Cursor(connection)

Constructor for creating a cursor using the connection.

Note

This method is an extension to the DB API definition.

ceODBC.data_sources(exclude_user_dsn=False, exclude_system_dsn=False)

Return a list of 2-tuples identifying the configured data sources. By default all data sources are returned but system or user data sources can be excluded, if desired.

Note

This method is an extension to the DB API definition.

ceODBC.Date(year, month, day)

Construct an object holding a date value. This is merely a wrapper over the datetime.date class and that should be used instead.

ceODBC.DateFromTicks(ticks)

Construct an object holding a date value from the given ticks value (number of seconds since the epoch; see the documentation of the standard Python time module for details). This is equivalent to using datetime.date.fromtimestamp() and that should be used instead.

ceODBC.drivers()

Return a list of the names of the configured drivers.

Note

This method is an extension to the DB API definition.

ceODBC.Time(hour, minute, second)

Construct an object holding a time value. This is merely a wrapper over the datetime.time class and that should be used instead.

ceODBC.TimeFromTicks(ticks)

Construct an object holding a time value from the given ticks value (number of seconds since the epoch; see the documentation of the standard Python time module for details). This is equivalent to using datetime.datetime.fromtimestamp().time() and that should be used instead.

ceODBC.Timestamp(year, month, day, hour, minute, second)

Construct an object holding a time stamp value. This is merely a wrapper over the datetime.datetime class and that should be used instead.

ceODBC.TimestampFromTicks(ticks)

Construct an object holding a time stamp value from the given ticks value (number of seconds since the epoch; see the documentation of the standard Python time module for details). This is equivalent to using datetime.datetime.fromtimestamp() and that should be used instead.

Constants

ceODBC.apilevel

String constant stating the supported DB API level. Currently ‘2.0’.

ceODBC.BINARY

This type object is used to describe columns in a database that are binary.

ceODBC.DATETIME

This type object is used to describe columns in a database that are dates.

ceODBC.NUMBER

This type object is used to describe columns in a database that are numbers.

ceODBC.paramstyle

String constant stating the type of parameter marker formatting expected by the interface. Currently ‘qmark’ as in ‘where name = ?’.

ceODBC.ROWID

This type object is used to describe the pseudo column “rowid”.

ceODBC.STRING

This type object is used to describe columns in a database that are strings.

ceODBC.threadsafety

Integer constant stating the level of thread safety that the interface supports. Currently 2, which means that threads may share the module and connections, but not cursors. Sharing means that a thread may use a resource without wrapping it using a mutex semaphore to implement resource locking.

ceODBC.__version__

String constant stating the version of the module. Currently ‘3.1.0’.

Note

This attribute is an extension to the DB API definition.

Exceptions

exception ceODBC.Warning

Exception raised for important warnings and defined by the DB API but not actually used by ceODBC.

exception ceODBC.Error

Exception that is the base class of all other exceptions defined by ceODBC and is a subclass of the Python StandardError exception (defined in the module exceptions).

exception ceODBC.InterfaceError

Exception raised for errors that are related to the database interface rather than the database itself. It is a subclass of Error.

exception ceODBC.DatabaseError

Exception raised for errors that are related to the database. It is a subclass of Error.

exception ceODBC.DataError

Exception raised for errors that are due to problems with the processed data. It is a subclass of DatabaseError.

exception ceODBC.OperationalError

Exception raised for errors that are related to the operation of the database but are not necessarily under the control of the progammer. It is a subclass of DatabaseError.

exception ceODBC.IntegrityError

Exception raised when the relational integrity of the database is affected. It is a subclass of DatabaseError.

exception ceODBC.InternalError

Exception raised when the database encounters an internal error. It is a subclass of DatabaseError.

exception ceODBC.ProgrammingError

Exception raised for programming errors. It is a subclass of DatabaseError.

exception ceODBC.NotSupportedError

Exception raised when a method or database API was used which is not supported by the database. It is a subclass of DatabaseError.

Database Types

Note

The DB API definition does not define these objects.

These types are more granular than the types mandated by the DB API and can be used when creating variables via Cursor.var() or Cursor.setinputsizes().

ceODBC.DB_TYPE_BIGINT

Variable used to bind and/or fetch big integers. Values are returned as Python integers and accept the same.

ceODBC.DB_TYPE_BINARY

Variable used to bind and/or fetch binary data. Values are returned as Python bytes objects and accept the same.

ceODBC.DB_TYPE_BIT

Variable used to bind and/or fetch bits. Values are returned as Python booleans and accept the same.

ceODBC.DB_TYPE_DATE

Variable used to bind and/or fetch dates. Values are returned as Python datetime.date objects and accept Python datetime.date or datetime.datetime objects.

ceODBC.DB_TYPE_DECIMAL

Variable used to bind and/or fetch decimal numbers. Values are returned as Python decimal.Decimal objects and accept the same.

ceODBC.DB_TYPE_DOUBLE

Variable used to bind and/or fetch floating point numbers. Values are returned as Python floats and accept Python integers or floats.

ceODBC.DB_TYPE_INT

Variable used to bind and/or fetch integers. Values are returned as Python integers and accept the same.

ceODBC.DB_TYPE_LONG_BINARY

Variable used to bind and/or fetch long binary data. Values are returned as Python bytes objects and accept the same.

ceODBC.DB_TYPE_LONG_STRING

Variable used to bind and/or fetch long string data. Values are returned as Python strings and accept the same.

ceODBC.DB_TYPE_STRING

Variable used to bind and/or fetch string data. Values are returned as Python strings and accept the same.

ceODBC.DB_TYPE_TIME

Variable used to bind and/or fetch time data. Values are returned as Python datetime.time objects and accept Python datetime.time or datetime.datetime objects.

ceODBC.DB_TYPE_TIMESTAMP

Variable used to bind and/or fetch timestamps. Values are returned as Python datetime.datetime objects and accept Python datetime.date or datetime.datetime objects.