Current driver version, string.
String constant stating the supported DB API level (2.0).
Integer constant stating the level of thread safety the interface supports.
Curretly 1 = Threads may share the module, but not connections.
String constant stating the type of parameter marker formatting expected by the interface.
‘qmark’ = Question mark style, e.g. ‘...WHERE name=?’
Helper constants for work with Cursor.description content.
TPB for R/W WAIT READ COMMITTED NO RECORD VERSION transaction.
TPB for R/W WAIT READ COMMITTED RECORD VERSION transaction.
TPB’s for R/W WAIT SNAPSHOT transaction.
TPB’s for R/W WAIT SNAPSHOT TABLE STABILITY transaction.
TPB for R/O WAIT READ COMMITTED RECORD VERSION transaction.
Python dictionary that maps Firebird character set names (key) to Python character sets (value).
ODS version numbers introduced by Firebird engine version.
Bases: exceptions.Exception
Exception raised for important warnings like data truncations while inserting, etc.
Bases: exceptions.Exception
Exception that is the base class of all other error exceptions. You can use this to catch all errors with one single ‘except’ statement. Warnings are not considered errors and thus should not use this class as base.
Bases: fdb.fbcore.Error
Exception raised for errors that are related to the database interface rather than the database itself.
Bases: fdb.fbcore.Error
Exception raised for errors that are related to the database.
Bases: fdb.fbcore.DatabaseError
Exception raised for errors that are due to problems with the processed data like division by zero, numeric value out of range, etc.
Bases: fdb.fbcore.DatabaseError
Exception raised for errors that are related to the database’s operation and not necessarily under the control of the programmer, e.g. an unexpected disconnect occurs, the data source name is not found, a transaction could not be processed, a memory allocation error occurred during processing, etc.
Bases: fdb.fbcore.DatabaseError
Exception raised when the relational integrity of the database is affected, e.g. a foreign key check fails.
Bases: fdb.fbcore.DatabaseError
Exception raised when the database encounters an internal error, e.g. the cursor is not valid anymore, the transaction is out of sync, etc.
Bases: fdb.fbcore.DatabaseError
Exception raised for programming errors, e.g. table not found or already exists, syntax error in the SQL statement, wrong number of parameters specified, etc.
Bases: fdb.fbcore.DatabaseError
Exception raised in case a method or database API was used which is not supported by the database
Bases: fdb.fbcore.DatabaseError
This is the exception inheritance layout:
StandardError
|__Warning
|__Error
|__InterfaceError
|__DatabaseError
|__DataError
|__OperationalError
|__IntegrityError
|__InternalError
|__ProgrammingError
|__NotSupportedError
Establish a connection to database.
Parameters: |
|
---|---|
Returns: | Connection to database. |
Return type: | Connection instance. |
Raises: |
|
Important
You may specify the database using either dns or database (with optional host), but not both.
Examples:
con = fdb.connect(dsn='host:/path/database.fdb', user='sysdba', password='pass', charset='UTF8')
con = fdb.connect(host='myhost', database='/path/database.fdb', user='sysdba', password='pass', charset='UTF8')
Creates a new database. Parameters could be specified either by supplied “CREATE DATABASE” statement, or set of database parameters.
Parameters: |
|
---|---|
Returns: | Connection to the newly created database. |
Return type: | Connection instance. |
Raises: |
|
Example:
con = fdb.create_database("create database '/temp/db.fdb' user 'sysdba' password 'pass'")
con = fdb.create_database(dsn='/temp/db.fdb',user='sysdba',password='pass',page_size=8192)
Initializes bindings to Firebird Client Library unless they are already initialized. Called automatically by fdb.connect() and fdb.create_database().
Parameters: | fb_library_name (string) – (optional) Path to Firebird Client Library. When it’s not specified, FDB does its best to locate appropriate client library. |
---|---|
Returns: | fdb.ibase.fbclient_API instance. |
Represents a connection between the database client (the Python process) and the database server.
Important
DO NOT create instances of this class directly! Use only connect() or create_database() to get Connection instances.
Parameters: |
|
---|
Exception raised for errors that are due to problems with the processed data like division by zero, numeric value out of range, etc.
Exception raised for errors that are related to the database.
Exception that is the base class of all other error exceptions. You can use this to catch all errors with one single ‘except’ statement. Warnings are not considered errors and thus should not use this class as base.
Exception raised when the relational integrity of the database is affected, e.g. a foreign key check fails.
Exception raised for errors that are related to the database interface rather than the database itself.
Exception raised when the database encounters an internal error, e.g. the cursor is not valid anymore, the transaction is out of sync, etc.
Exception raised in case a method or database API was used which is not supported by the database
Exception raised for errors that are related to the database’s operation and not necessarily under the control of the programmer, e.g. an unexpected disconnect occurs, the data source name is not found, a transaction could not be processed, a memory allocation error occurred during processing, etc.
Exception raised for programming errors, e.g. table not found or already exists, syntax error in the SQL statement, wrong number of parameters specified, etc.
Exception raised for important warnings like data truncations while inserting, etc.
Starts a transaction explicitly. Operates on main_transaction. See Transaction.begin() for details.
Parameters: | tpb (TPB instance, list/tuple of isc_tpb_* constants or bytestring) – (Optional) Transaction Parameter Buffer for newly started transaction. If not specified, default_tpb is used. |
---|
Close the connection now (rather than whenever __del__ is called). The connection will be unusable from this point forward; an Error (or subclass) exception will be raised if any operation is attempted with the connection. The same applies to all cursor and transaction objects trying to use the connection.
Also closes all EventConduit, Cursor and Transaction instances associated with this connection.
Raises ProgrammingError: | |
---|---|
When connection is a member of a ConnectionGroup. |
Commit pending transaction to the database. Operates on main_transaction. See Transaction.commit() for details.
Parameters: | retaining (boolean) – (Optional) Indicates whether the transactional context of the transaction being resolved should be recycled. |
---|---|
Raises ProgrammingError: | |
If Connection is closed. |
Return a new Cursor instance using the connection associated with main_transaction. See Transaction.cursor() for details.
Raises ProgrammingError: | |
---|---|
If Connection is closed. |
Wraps the Firebird C API function isc_database_info.
For documentation, see the IB 6 API Guide section entitled “Requesting information about an attachment” (p. 51).
Note that this method is a VERY THIN wrapper around the FB C API function isc_database_info. This method does NOT attempt to interpret its results except with regard to whether they are a string or an integer.
For example, requesting isc_info_user_names will return a string containing a raw succession of length-name pairs. A thicker wrapper might interpret those raw results and return a Python tuple, but it would need to handle a multitude of special cases in order to cover all possible isc_info_* items.
Parameters: |
|
---|---|
Raises: |
|
See also
Extracting data with the database_info function is rather clumsy. See db_info() for higher-level means of accessing the same information.
Note
Some of the information available through this method would be more easily retrieved with the Services API (see submodule fdb.services).
Higher-level convenience wrapper around the database_info() method that parses the output of database_info into Python-friendly objects instead of returning raw binary buffers in the case of complex result types.
Parameters: | request – Single fdb.isc_info_* info request code or a sequence of such codes. |
---|---|
Returns: | Mapping of (info request code -> result). |
Raises: |
|
Drops the database to which this connection is attached.
Unlike plain file deletion, this method behaves responsibly, in that it removes shadow files and other ancillary files for this database.
Raises: |
|
---|
Creates a conduit through which database event notifications will flow into the Python program.
Parameters: | event_names – A sequence of string event names. |
---|---|
Returns: | An EventConduit instance. |
Executes a statement in context of main_transaction without caching its prepared form.
Automatically starts transaction if it’s not already started.
Parameters: | sql (string) – SQL statement to execute. |
---|
Important
The statement must not be of a type that returns a result set. In most cases (especially cases in which the same statement – perhaps a parameterized statement – is executed repeatedly), it is better to create a cursor using the connection’s cursor method, then execute the statement using one of the cursor’s execute methods.
Parameters: | sql (string) – SQL statement to execute. |
---|---|
Raises: |
|
Return count of currently active transactions.
Return list of transaction IDs for all currently active transactions.
Return content of specified database page as binary string.
Parameters: | page_number (int) – Page sequence number. |
---|
Return current stats for access to tables.
Returns: | List of fbcore._TableAccessStats instances. |
---|
Returns True if database is read-only.
Causes the the database to roll back to the start of pending transaction. Operates on main_transaction. See Transaction.rollback() for details.
Parameters: |
|
---|---|
Raises ProgrammingError: | |
If Connection is closed. |
Establishes a named SAVEPOINT for current transaction. Operates on main_transaction. See Transaction.savepoint() for details.
Parameters: | name (string) – Name for savepoint. |
---|---|
Raises ProgrammingError: | |
If Connection is closed. |
Example:
con.savepoint('BEGINNING_OF_SOME_SUBTASK')
...
con.rollback(savepoint='BEGINNING_OF_SOME_SUBTASK')
Creates a new Transaction that operates within the context of this connection. Cursors can be created within that Transaction via its cursor() method.
Parameters: | default_tpb (TPB instance, list/tuple of isc_tpb_* constants or bytestring) – (optional) Transaction Parameter Block for newly created Transaction. If not specified, default_tpb is used. |
---|---|
Raises ProgrammingError: | |
If Connection is closed. |
Pythonic wrapper around transaction_info() call. Operates on main_transaction. See Transaction.trans_info() for details.
Parameters: | request – One or more information request codes (see transaction_info() for details). Multiple codes must be passed as tuple. |
---|---|
Returns: | Decoded response(s) for specified request code(s). When multiple requests are passed, returns a dictionary where key is the request code and value is the response from server. |
Raises: |
|
Returns information about active transaction. Thin wrapper around Firebird API isc_transaction_info call. Operates on main_transaction. See Transaction.transaction_info() for details.
Parameters: |
|
---|---|
Returns: | Decoded response(s) for specified request code(s). When multiple requests are passed, returns a dictionary where key is the request code and value is the response from server. |
Raises: |
|
(Read Only) (int) Internal ID (server-side) for connection.
(Read Only) (string) Connection Character set name.
(Read Only) (bool) True if connection is closed.
(Read Only) (datetime.datetime) Database creation date & time.
(Read Only) (int) Amount of server memory (in bytes) currently in use.
(Read Only) (string) Database name (filename or alias).
(Read Only) (int) SQL dialect of attached database.
(Read Only) (int) Database class ID
(Read/Write) Deafult Transaction Parameter Block used for all newly started transactions.
(Read Only) (float) Firebird version number of connected server. Only major.minor version.
(Read Only) (string) Version string returned by server for this connection. This version string contains Firebird engine version number, i.e. version that DOES NOT takes into account inherited IB version number. For example it’s ‘LI-V2.5.2.26540 Firebird 2.5’ for Firebird 2.5.2
(Read Only) (bool) Mode in which database writes are performed: True=sync, False=async.
(Read Only) ConnectionGroup this Connection belongs to, or None.
(Read Only) (int) Server implementation ID
(Read Only) Dictionary with I/O stats (reads,writes,fetches,marks) Keys are isc_info_reads, isc_info_writes, isc_info_fetches and isc_info_marks constants.
(Read Only) Main Transaction instance for this connection Connection methods begin(), savepoint(), commit() and rollback() are delegated to this transaction object.
(Read Only) (int) Maximum amount of memory (in bytes) used at one time since the first process attached to the database.
(Read Only) (int) ID of Next Transaction.
(Read Only) (int) ID of Oldest Active Transaction.
(Read Only) (float) On-Disk Structure (ODS).
(Read Only) (int) On-Disk Structure (ODS) minor version number.
(Read Only) (int) On-Disk Structure (ODS) major version number.
(Read Only) (int) ID of Oldest Interesting Transaction.
(Read Only) (int) ID of Oldest Snapshot Transaction.
(Read Only) (int) Size of page cache in pages.
(Read Only) (int) Database page size in bytes.
(Read Only) (int) Number of database pages allocated.
(Read Only) (int) Server provider ID
(Read Only) Special “query” Transaction instance for this connection. This is ReadOnly ReadCommitted transaction that could be active indefinitely without blocking garbage collection. It’s used internally to query metadata, but it’s generally useful.
(Read Only) (string) Version string returned by server for this connection. This version string contains InterBase-friendly engine version number, i.e. version that takes into account inherited IB version number. For example it’s ‘LI-V6.3.2.26540 Firebird 2.5’ for Firebird 2.5.2
(Read Only) (string) Database site name.
(Read Only) (bool) When True 20% page space is reserved for holding backup versions of modified records.
(Read Only) (int) SQL dialect for this connection.
(Read Only) (int) Sweep interval.
(Read Only) (tuple) Transaction instances associated with this connection.
(Read Only) (string) Firebird version number string of connected server. Uses Firebird version numbers in form: major.minor.subrelease.build
Connection descendant that exposes all attributes of encapsulated Schema instance directly as connection attributes, except close() and bind(), and those attributes that are already defined by Connection class.
Note
Use connection_class parametr of connect() or create_database() to create connections with direct schema interface.
List of all nbackup hisotry records. Items are BackupHistory objects.
List of all character sets in database. Items are CharacterSet objects.
List of all collations in database. Items are Collation objects.
List of all constraints in database. Items are Constraint objects.
Default CharacterSet for database
List of all dependencies in database. Items are Dependency objects.
Database description or None if it doesn’t have a description.
List of all user domains in database. Items are Domain objects.
str(object=’‘) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str(object=’‘) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str(object=’‘) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str(object=’‘) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str(object=’‘) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str(object=’‘) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str(object=’‘) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str(object=’‘) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str(object=’‘) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str(object=’‘) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str(object=’‘) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str(object=’‘) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str(object=’‘) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str(object=’‘) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str(object=’‘) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str(object=’‘) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str(object=’‘) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str(object=’‘) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str(object=’‘) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str(object=’‘) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str(object=’‘) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str(object=’‘) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str(object=’‘) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
List of all exceptions in database. Items are DatabaseException objects.
List of all extension files defined for database. Items are DatabaseFile objects.
List of all user-defined BLOB filters. Items are Filter objects.
List of all user functions defined in database. Items are Function objects.
List of all user generators in database. Items are Sequence objects.
List of all user indices in database. Items are Index objects.
Database linger value.
str(object=’‘) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str(object=’‘) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
Database owner name.
List of all packages defined for database. Items are Package objects.
List of all privileges defined for database. Items are Privilege objects.
List of all user procedures in database. Items are Procedure objects.
List of all roles in database. Items are Role objects.
Can refer to the security class applied as databasewide access control limits.
List of all user generators in database. Items are Sequence objects.
List of all shadows defined for database. Items are Shadow objects.
List of all system domains in database. Items are Domain objects.
List of all system functions defined in database. Items are Function objects.
List of all system generators in database. Items are Sequence objects.
List of all system indices in database. Items are Index objects.
List of all system procedures in database. Items are Procedure objects.
List of all system generators in database. Items are Sequence objects.
List of all system tables in database. Items are Table objects.
List of all system triggers in database. Items are Trigger objects.
List of all system views in database. Items are View objects.
List of all user tables in database. Items are Table objects.
List of all user triggers in database. Items are Trigger objects.
List of all user views in database. Items are View objects.
Note
For list of methods see fdb.schema.Schema.
Represents a database cursor, which is used to execute SQL statement and manage the context of a fetch operation.
Important
DO NOT create instances of this class directly! Use only Connection.cursor(), Transaction.cursor() and ConnectionGroup.cursor() to get Cursor instances that operate in desired context.
Note
Cursor is actually a high-level wrapper around PreparedStatement instance(s) that handle the actual SQL statement execution and result management.
Tip
Cursor supports the iterator protocol, yielding tuples of values like fetchone().
Important
The association between a Cursor and its Transaction and Connection is set when the Cursor is created, and cannot be changed during the lifetime of that Cursor.
Parameters: |
|
---|
Call a stored database procedure with the given name.
The result of the call is available through the standard fetchXXX() methods.
Parameters: |
|
---|---|
Returns: | parameters, as required by Python DB API 2.0 Spec. |
Raises: |
|
Close the cursor now (rather than whenever __del__ is called).
Closes any currently open PreparedStatement. However, the cursor is still bound to Connection and Transaction, so it could be still used to execute SQL statements. Also the cache with prepared statements is left intact.
Warning
FDB’s implementation of Cursor somewhat violates the Python DB API 2.0, which requires that cursor will be unusable after call to close; and an Error (or subclass) exception should be raised if any operation is attempted with the cursor.
If you’ll take advantage of this anomaly, your code would be less portable to other Python DB API 2.0 compliant drivers.
Prepare and execute a database operation (query or command).
Note
Execution is handled by PreparedStatement that is either supplied as operation parameter, or created internally when operation is a string. Internally created PreparedStatements are stored in cache for later reuse, when the same operation string is used again.
Returns: | self, so call to execute could be used as iterator. |
---|---|
Parameters: |
|
Raises: |
|
Prepare a database operation (query or command) and then execute it against all parameter sequences or mappings found in the sequence seq_of_parameters.
Note
This function simply calls execute() in a loop, feeding it with parameters from seq_of_parameters. Because execute caches PreparedStatements, calling executemany is equally efective as direct use of prepared statement and calling execute in a loop directly in application.
Returns: | self, so call to executemany could be used as iterator. |
---|---|
Parameters: |
|
Raises: |
|
Fetch all (remaining) rows of a query result.
Returns: | List of tuples, where each tuple is one row of returned values. |
---|---|
Raises: |
|
Fetch all (remaining) rows of a query result like fetchall(), except that it returns a list of mappings of field name to field value, rather than a list of tuples.
Returns: | List of fbcore._RowMapping instances, one such instance for each row. |
---|---|
Raises: |
|
Fetch the next set of rows of a query result, returning a sequence of sequences (e.g. a list of tuples). An empty sequence is returned when no more rows are available. The number of rows to fetch per call is specified by the parameter. If it is not given, the cursor’s arraysize determines the number of rows to be fetched. The method does try to fetch as many rows as indicated by the size parameter. If this is not possible due to the specified number of rows not being available, fewer rows may be returned.
Parameters: | size (integer) – Max. number of rows to fetch. |
---|---|
Returns: | List of tuples, where each tuple is one row of returned values. |
Raises: |
|
Fetch the next set of rows of a query result, like fetchmany(), except that it returns a list of mappings of field name to field value, rather than a list of tuples.
Parameters: | size (integer) – Max. number of rows to fetch. |
---|---|
Returns: | List of fbcore._RowMapping instances, one such instance for each row. |
Raises: |
|
Fetch the next row of a query result set.
Returns: | tuple of returned values, or None when no more data is available. |
---|---|
Raises: |
|
Fetch the next row of a query result set like fetchone(), except that it returns a mapping of field name to field value, rather than a tuple.
Returns: | fbcore._RowMapping of returned values, or None when no more data is available. |
---|---|
Raises: |
|
Equivalent to the fetchall(), except that it returns iterator rather than materialized list.
Returns: | Iterator that yields tuple of values like fetchone(). |
---|
Equivalent to the fetchallmap(), except that it returns iterator rather than materialized list.
Returns: | Iterator that yields fbcore._RowMapping instance like fetchonemap(). |
---|
Return the next item from the container. Part of iterator protocol.
Raises StopIteration: | |
---|---|
If there are no further items. |
Create prepared statement for repeated execution.
Note
Returned PreparedStatement instance is bound to its Cursor instance via strong reference, and is not stored in Cursor’s internal cache of prepared statements.
Parameters: | operation (string) – SQL command |
---|---|
Returns: | PreparedStatement instance. |
Raises: |
|
Specify a BLOB column(s) to work in stream mode instead classic, materialized mode for already executed statement.
Parameters: | blob_name (string or sequence) – Single name or sequence of column names. Name must be in format as it’s stored in database (refer to description for real value). |
---|
Important
BLOB name is permanently added to the list of BLOBs handled as stream BLOBs by current PreparedStatement instance. If instance is stored in internal cache of prepared statements, the same command executed repeatedly will retain this setting.
Parameters: | blob_name (string) – Name of BLOB column. |
---|---|
Raises ProgrammingError: | |
Required by Python DB API 2.0, but pointless for Firebird, so it does nothing.
Required by Python DB API 2.0, but pointless for Firebird, so it does nothing.
(Read/Write) As required by the Python DB API 2.0 spec, the value of this attribute is observed with respect to the fetchmany() method. However, changing the value of this attribute does not make any difference in fetch efficiency because the database engine only supports fetching a single row at a time.
(Read Only) (Connection) PEP 249 Extension. Reference to the Connection object on which the cursor was created.
(Read Only) Sequence of 7-item sequences. Each of these sequences contains information describing one result column: (name, type_code, display_size,internal_size, precision, scale, null_ok)
If cursor doesn’t have a prepared statement, the value is None.
(Read/Write) (string) Name for the SQL cursor. This property can be ignored entirely if you don’t need to use it.
(Read Only) (string) A string representation of the execution plan for last executed statement generated by the database engine’s optimizer. None if no statement was executed.
(Read Only) (integer) Specifies the number of rows that the last executeXXX() produced (for DQL statements like select) or affected (for DML statements like update or insert ).
The attribute is -1 in case no executeXXX() has been performed on the cursor or the rowcount of the last operation is not determinable by the interface.
Note
The database engine’s own support for the determination of “rows affected”/”rows selected” is quirky. The database engine only supports the determination of rowcount for INSERT, UPDATE, DELETE, and SELECT statements. When stored procedures become involved, row count figures are usually not available to the client. Determining rowcount for SELECT statements is problematic: the rowcount is reported as zero until at least one row has been fetched from the result set, and the rowcount is misreported if the result set is larger than 1302 rows. The server apparently marshals result sets internally in batches of 1302, and will misreport the rowcount for result sets larger than 1302 rows until the 1303rd row is fetched, result sets larger than 2604 rows until the 2605th row is fetched, and so on, in increments of 1302.
(Read Only) (Transaction) Reference to the Transaction object on which the cursor was created.
Represents a transaction context, which is used to execute SQL statement.
Important
DO NOT create instances of this class directly! Connection and ConnectionGroup manage Transaction internally, surfacing all important methods directly in their interfaces. If you want additional transactions independent from Connection.main_transaction, use Connection.trans() method to obtain such Transaction instance.
Parameters: |
|
---|---|
Raises ProgrammingError: | |
When zero or more than 16 connections are given. |
Starts a transaction explicitly.
Parameters: | tpb (TPB instance, list/tuple of isc_tpb_* constants or bytestring) – (optional) Transaction Parameter Block for newly created Transaction. If not specified, default_tpb is used. |
---|
Note
Calling this method directly is never required; a transaction will be started implicitly if necessary.
Important
If the physical transaction is unresolved when this method is called, a commit() or rollback() will be performed first, accordingly to default_action value.
Raises: |
|
---|
Permanently closes the Transaction object and severs its associations with other objects (Cursor and Connection instances).
Important
If the physical transaction is unresolved when this method is called, a commit() or rollback() will be performed first, accordingly to default_action value.
Commit any pending transaction to the database.
Note
If transaction is not active, this method does nothing, because the consensus among Python DB API experts is that transactions should always be started implicitly, even if that means allowing a commit() or rollback() without an actual transaction.
Parameters: | retaining (boolean) – Indicates whether the transactional context of the transaction being resolved should be recycled. |
---|---|
Raises DatabaseError: | |
When error is returned by server as response to commit. |
Creates a new Cursor that will operate in the context of this Transaction.
Parameters: | connection (Connection instance) – Required only when Transaction is bound to multiple Connections, to specify to which Connection the returned Cursor should be bound. |
---|---|
Raises ProgrammingError: | |
When transaction operates on multiple Connections and: connection parameter is not specified, or specified connection is not among Connections this Transaction is bound to. |
Automatically starts transaction if it’s not already started.
Parameters: | sql (string) – SQL statement to execute. |
---|
Important
The statement must not be of a type that returns a result set. In most cases (especially cases in which the same statement – perhaps a parameterized statement – is executed repeatedly), it is better to create a cursor using the connection’s cursor method, then execute the statement using one of the cursor’s execute methods.
Parameters: | sql (string) – SQL statement to execute. |
---|---|
Raises DatabaseError: | |
When error is returned from server. |
Returns True if transaction is Read Only.
Manually triggers the first phase of a two-phase commit (2PC).
Note
Direct use of this method is optional; if preparation is not triggered manually, it will be performed implicitly by commit() in a 2PC.
Rollback any pending transaction to the database.
Note
If transaction is not active, this method does nothing, because the consensus among Python DB API experts is that transactions should always be started implicitly, even if that means allowing a commit() or rollback() without an actual transaction.
Parameters: |
|
---|---|
Raises: |
|
Establishes a savepoint with the specified name.
Note
If transaction is bound to multiple connections, savepoint is created on all of them.
Important
Because savepoint is created not through Firebird API (there is no such API call), but by executing SAVEPOINT <name> SQL statement, calling this method starts the transaction if it was not yet started.
Parameters: | name (string) – Savepoint name. |
---|
Pythonic wrapper around transaction_info() call.
Parameters: | request – One or more information request codes (see transaction_info() for details). Multiple codes must be passed as tuple. |
---|---|
Returns: | Decoded response(s) for specified request code(s). When multiple requests are passed, returns a dictionary where key is the request code and value is the response from server. |
Return information about active transaction.
This is very thin wrapper around Firebird API isc_transaction_info call.
Parameters: |
|
---|---|
Raises: |
|
(Read Only) True if transaction is active.
(Read Only) True if transaction is closed.
(Read/Write) (string) ‘commit’ or ‘rollback’, action to be taken when physical transaction has to be ended automatically. Default is ‘commit’.
(Read/Write) Transaction Parameter Block.
(Read Only) (int) or (tuple) Isolation level code [isc_info_tra_consistency,
(Read Only) (int) Lock timeout (seconds or -1 for unlimited).
(Read Only) (int) ID of Oldest Active Transaction when this transaction started.
(Read Only) (int) ID of Oldest Interesting Transaction when this transaction started.
(Read Only) (int) ID of Oldest Snapshot Transaction when this transaction started.
(Read Only) (int) Internal ID (server-side) for transaction.
Represents a prepared statement, an “inner” database cursor, which is used to manage the SQL statement execution and context of a fetch operation.
Important
DO NOT create instances of this class directly! Use only Cursor.prep() to get PreparedStatement instances.
Note
PreparedStatements are bound to Cursor instance that created them, and using them with other Cursor would report an error.
Drops the resources associated with executed prepared statement, but keeps it prepared for another execution.
Specify a BLOB column(s) to work in stream mode instead classic, materialized mode.
Parameters: | blob_name (string or sequence) – Single name or sequence of column names. Name must be in format as it’s stored in database (refer to description for real value). |
---|
Important
BLOB name is permanently added to the list of BLOBs handled as stream BLOBs by this instance.
Parameters: | blob_name (string) – Name of BLOB column. |
---|
Constant for internal use by this class. Do not change!
Constant for internal use by this class. Do not change!
(Read Only) (boolean) True if closed. Note that closed means that PS statement handle was closed for further fetching, releasing server resources, but wasn’t dropped, and couldbe still used for another execution.
(Read Only) Sequence of 7-item sequences. Each of these sequences contains information describing one result column: (name, type_code, display_size,internal_size, precision, scale, null_ok)
The number of input parameters the statement requires. Do not change!
The number of output fields the statement produces. Do not change!
(Read/Write) (string) Name for the SQL cursor. This property can be ignored entirely if you don’t need to use it.
(Read Only) (string) A string representation of the execution plan generated for this statement by the database engine’s optimizer.
(Read Only) (integer) Specifies the number of rows that the last execution produced (for DQL statements like select) or affected (for DML statements like update or insert ).
The attribute is -1 in case the statement was not yet executed or the rowcount of the operation is not determinable by the interface.
(Read Only) (string) SQL command this PreparedStatement executes.
(integer) An integer code that can be matched against the statement type constants in the isc_info_sql_stmt_* series. Do not change!
Manager for distributed transactions, i.e. transactions that span multiple databases.
Tip
ConnectionGroup supports in operator to check membership of connections.
Parameters: | connections (iterable) – Sequence of Connection instances. |
---|
See also
See add() for list of exceptions the constructor may throw.
Adds active connection to the group.
Parameters: | con – A Connection instance to add to this group. |
---|---|
Raises: |
|
Starts distributed transaction over member connections.
Parameters: | tpb (TPB instance, list/tuple of isc_tpb_* constants or bytestring) – (Optional) Transaction Parameter Buffer for newly started transaction. If not specified, default_tpb is used. |
---|---|
Raises ProgrammingError: | |
When group is empty or has active transaction. |
Removes all connections from group.
Raises ProgrammingError: | |
---|---|
When transaction is active. |
Commits distributed transaction over member connections using 2PC.
Note
If transaction is not active, this method does nothing, because the consensus among Python DB API experts is that transactions should always be started implicitly, even if that means allowing a commit() or rollback() without an actual transaction.
Parameters: | retaining (boolean) – Indicates whether the transactional context of the transaction being resolved should be recycled. |
---|---|
Raises ProgrammingError: | |
When group is empty. |
Returns True if specified connection belong to this group.
Parameters: | con – Connection instance. |
---|
Returns number of Connection objects that belong to this group.
Creates a new Cursor that will operate in the context of distributed transaction and specific Connection that belongs to this group.
Note
Automatically starts transaction if it’s not already started.
Parameters: | connection – Connection instance. |
---|---|
Raises ProgrammingError: | |
When group is empty or specified connection doesn’t belong to this group. |
Forcefully deletes all connections from connection group.
Note
If transaction is active, it’s canceled (rollback).
Note
Any error during transaction finalization doesn’t stop the disband process, however the exception catched is eventually reported.
Executes a statement on all member connections without caching its prepared form.
Automatically starts transaction if it’s not already started.
Parameters: | sql (string) – SQL statement to execute. |
---|
Important
The statement must not be of a type that returns a result set. In most cases (especially cases in which the same statement – perhaps a parameterized statement – is executed repeatedly), it is better to create a cursor using the connection’s cursor method, then execute the statement using one of the cursor’s execute methods.
Parameters: | sql (string) – SQL statement to execute. |
---|---|
Raises DatabaseError: | |
When error is returned from server. |
Returns list of connection objects that belong to this group.
Manually triggers the first phase of a two-phase commit (2PC). Use of this method is optional; if preparation is not triggered manually, it will be performed implicitly by commit() in a 2PC.
Removes specified connection from group.
Parameters: | con – A Connection instance to remove. |
---|---|
Raises ProgrammingError: | |
When con doesn’t belong to this group or transaction is active. |
Rollbacks distributed transaction over member connections.
Note
If transaction is not active, this method does nothing, because the consensus among Python DB API experts is that transactions should always be started implicitly, even if that means allowing a commit() or rollback() without an actual transaction.
Parameters: | retaining (boolean) – Indicates whether the transactional context of the transaction being resolved should be recycled. |
---|---|
Raises ProgrammingError: | |
When group is empty. |
Establishes a named SAVEPOINT on all member connections. See Transaction.savepoint() for details.
Parameters: | name (string) – Name for savepoint. |
---|---|
Raises ProgrammingError: | |
When group is empty. |
(Read/Write) Deafult Transaction Parameter Block used for transactions.
Context Manager that manages transaction for object passed to constructor.
Performs rollback if exception is thrown inside code block, otherwise performs commit at the end of block.
Example:
with TransactionContext(my_transaction):
cursor.execute('insert into tableA (x,y) values (?,?)',(x,y))
cursor.execute('insert into tableB (x,y) values (?,?)',(x,y))
Parameters: | transaction – Any object that supports begin(), commit() and rollback(). |
---|
Transaction-like object this instance manages.
Represents a conduit through which database event notifications will flow into the Python program.
Important
DO NOT create instances of this class directly! Use only Connection.event_conduit() to get EventConduit instances.
Notifications of any events are not accumulated until begin() method is called.
From the moment the begin() method is called, notifications of any events that occur will accumulate asynchronously within the conduit’s internal queue until the conduit is closed either explicitly (via the close() method) or implicitly (via garbage collection).
EventConduit implements context manager protocol to call method begin() and close() automatically.
Example:
with connection.event_conduit( ('event_a', 'event_b') ) as conduit:
events = conduit.wait()
process_events(events)
Parameters: |
|
---|
Starts listening for events.
Must be called directly or through context manager interface.
Cancels the standing request for this conduit to be notified of events.
After this method has been called, this EventConduit object is useless, and should be discarded.
Clear any event notifications that have accumulated in the conduit’s internal queue.
Wait for events.
Blocks the calling thread until at least one of the events occurs, or the specified timeout (if any) expires.
Parameters: | timeout (integer or float) – Number of seconds (use a float to indicate fractions of seconds). If not even one of the relevant events has occurred after timeout seconds, this method will unblock and return None. The default timeout is infinite. |
---|---|
Returns: | None if the wait timed out, otherwise a dictionary that maps event_name -> event_occurrence_count. |
Example:
>>>conduit = connection.event_conduit( ('event_a', 'event_b') )
>>>conduit.begin()
>>>conduit.wait()
{
'event_a': 1,
'event_b': 0
}
In the example above event_a occurred once and event_b did not occur at all.
(Read Only) (boolean) True if conduit is closed.
BlobReader is a “file-like” class, so it acts much like a file instance opened in rb mode.
Important
DO NOT create instances of this class directly! BlobReader instances are returned automatically in place of output BLOB values when stream BLOB access is requested via PreparedStatement.set_stream_blob().
Tip
BlobReader supports iterator protocol, yielding lines like readline().
Closes the Reader. Like file.close().
Raises DatabaseError: | |
---|---|
When error is returned by server. |
Flush the internal buffer. Like file.flush(). Does nothing as it’s pointless for reader.
Return the next line from the BLOB. Part of iterator protocol.
Raises StopIteration: | |
---|---|
If there are no further lines. |
Read at most size bytes from the file (less if the read hits EOF before obtaining size bytes). If the size argument is negative or omitted, read all data until EOF is reached. The bytes are returned as a string object. An empty string is returned when EOF is encountered immediately. Like file.read().
Raises ProgrammingError: | |
---|---|
When reader is closed. |
Note
Performs automatic conversion to unicode for TEXT BLOBs, if used Python is v3 or connection charset is defined.
Read one entire line from the file. A trailing newline character is kept in the string (but may be absent when a file ends with an incomplete line). An empty string is returned when EOF is encountered immediately. Like file.readline().
Raises ProgrammingError: | |
---|---|
When reader is closed. |
Note
Performs automatic conversion to unicode for TEXT BLOBs, if used Python is v3 or connection charset is defined.
Read until EOF using readline() and return a list containing the lines thus read. The optional sizehint argument (if present) is ignored. Like file.readlines().
Note
Performs automatic conversion to unicode for TEXT BLOBs, if used Python is v3 or connection charset is defined.
Set the file’s current position, like stdio‘s fseek(). See file.seek() details.
Parameters: |
|
---|---|
Raises ProgrammingError: | |
When reader is closed. |
Warning
If BLOB was NOT CREATED as stream BLOB, this method raises DatabaseError exception. This constraint is set by Firebird.
Return current position in BLOB, like stdio‘s ftell() and file.tell().
(Read Only) (boolean) True is BlobReader is closed.
(Read Only) (string) File mode - always “rb”
Helper class for convenient and safe construction of custom Transaction Parameter Blocks.
Returns a copy of self.
Create valid transaction parameter block according to current values of member attributes.
Returns: | (string) TPB block. |
---|
(integer) Required access mode (isc_tpb_read or isc_tpb_write). Default: isc_tpb_write
(integer or tuple) Required Transaction Isolation Level. Single integer value equivalent to isc_tpb_concurrency or isc_tpb_consistency, or tuple of exactly two integer values, where the first one is isc_tpb_read_committed and second either isc_tpb_rec_version or isc_tpb_no_rec_version.
When value isc_tpb_read_committed is assigned without suboption, the isc_tpb_rec_version is assigned as default suboption.
Default: isc_tpb_concurrency
(integer) Required lock resolution method. Either isc_tpb_wait or isc_tpb_nowait.
Default: isc_tpb_wait
(integer) Required lock timeout or None.
Default: None
(TableReservation) Table reservation specification.
Default: None.
Instead of changing the value of the TableReservation object itself, you must change its elements by manipulating it as though it were a dictionary that mapped “TABLE_NAME”: (sharingMode, accessMode) For example:
tpb.table_reservation["MY_TABLE"] = (fdb.isc_tpb_protected, fdb.isc_tpb_lock_write)
A dictionary-like helper class that maps “TABLE_NAME”: (sharingMode, accessMode). It performs validation of values assigned to keys.
Create valid table access parameter block according to current key/value pairs.
Returns: | (string) Table access definition block. |
---|
An internal dictionary-like class that wraps a row of results in order to map field name to field value.
Warning
We make ABSOLUTELY NO GUARANTEES about the return value of the fetch(one|many|all) methods except that it is a sequence indexed by field position, and no guarantees about the return value of the fetch(one|many|all)map methods except that it is a mapping of field name to field value.
Therefore, client programmers should NOT rely on the return value being an instance of a particular class or type.
Represents Firebird API structure for block of events.
Close this block canceling managed events.
Count event occurences and reregister interest in futrther notifications.
length of internal event buffer
(ReadOnly) True if block is closed for business
Event buffer
Event ID
List of registered event names
Result buffer
An internal class that wraps results from get_table_access_stats()
These constants are to be passed as the shutdown_mode parameter to Connection.shutdown() and Connection.bring_online().
These constants are to be passed as the shutdown_method parameter to Connection.shutdown()
These constants are to be passed as the mode parameter to Connection.setWriteMode()
These constants are to be passed as the mode parameter to Connection.setAccessMode()
These constants are return values of Connection.get_server_capabilities()
These constants are options for Connection.backup()/Connection.restore() ‘stats’ parameter.
Establishes a connection to the Services Manager.
Parameters: |
|
---|
Note
By definition, a Services Manager connection is bound to a particular host. Therefore, the database specified as a parameter to methods such as getStatistics MUST NOT include the host name of the database server.
Represents a sevice connection between the database client (the Python process) and the database server.
Important
DO NOT create instances of this class directly! Use only connect() to get Connection instances.
Tip
Connection supports the iterator protocol, yielding lines of result like readline().
Activate Database Shadow(s).
Parameters: | database (string) – Database filename or alias. |
---|
Add new user.
Parameters: | user (User) – Instance of User with at least its name and password attributes specified as non-empty values. All other attributes are optional. |
---|
Request logical (GBAK) database backup. (ASYNC service)
Parameters: |
|
---|
If callback is not specified, backup log could be retrieved through readline(), readlines(), iteration over Connection or ignored via call to wait().
Note
Until backup report is not fully fetched from service (or ignored via wait()), any attempt to start another asynchronous service will fail with exception.
Bring previously shut down database back online.
Parameters: |
|
---|
See also
See also shutdown() method.
Close the connection now (rather than whenever __del__ is called). The connection will be unusable from this point forward; an Error (or subclass) exception will be raised if any operation is attempted with the connection.
Resolve limbo transaction with commit.
Parameters: |
|
---|
Get Firebird Server architecture.
Returns string: | Architecture (example: ‘Firebird/linux AMD64’). |
---|
Get list of attached databases.
Returns list: | Filenames of attached databases. |
---|
Get number of attachments to server.
Returns integer: | |
---|---|
Directory path. |
Get Firebird Home (installation) Directory.
Returns string: | Directory path. |
---|
Get list of transactions in limbo.
Parameters: | database (string) – Database filename or alias. |
---|---|
Returns list: | Transaction IDs. |
Raises InternalError: | |
When can’t process the result buffer. |
Get directory location for Firebird lock files.
Returns string: | Directory path. |
---|
Request content of Firebird Server log. (ASYNC service)
Parameters: | callback (function) – Function to call back with each output line. Function must accept only one parameter: line of output. |
---|
If callback is not specified, log content could be retrieved through readline(), readlines(), iteration over Connection or ignored via call to wait().
Note
Until log content is not fully fetched from service (or ignored via wait()), any attempt to start another asynchronous service will fail with exception.
Get directory with Firebird message file.
Returns string: | Directory path. |
---|
Get full path to Firebird security database.
Returns string: | Path (path+filename) to security database. |
---|
Get list of Firebird capabilities.
Returns tuple: | Capability info codes for each capability reported by server. |
---|
Next fdb.services constants define possible info codes returned:
CAPABILITY_MULTI_CLIENT
CAPABILITY_REMOTE_HOP
CAPABILITY_SERVER_CONFIG
CAPABILITY_QUOTED_FILENAME
CAPABILITY_NO_SERVER_SHUTDOWN
Example:
>>>fdb.services.CAPABILITY_REMOTE_HOP in svc.get_server_capabilities()
True
Get Firebird version.
Returns string: | Firebird version (example: ‘LI-V2.5.2.26536 Firebird 2.5’). |
---|
Get Firebird Service Manager version number.
Returns integer: | |
---|---|
Version number. |
Request database statisctics. (ASYNC service)
Parameters: |
|
---|
If callback is not specified, statistical report could be retrieved through readline(), readlines(), iteration over Connection or ignored via call to wait().
Note
Until report is not fully fetched from service (or ignored via wait()), any attempt to start another asynchronous service will fail with exception.
Get information about user(s).
Parameters: | user_name (string) – (Optional) When specified, returns information only about user with specified user name. |
---|---|
Returns list: | User instances. |
Returns True if service is running.
Modify user information.
Parameters: | user (User) – Instance of User with at least its name attribute specified as non-empty value. |
---|
Note
This method sets first_name, middle_name and last_name to their actual values, and ignores the user_id and group_id attributes regardless of their values. password is set only when it has value.
Perform physical (NBACKUP) database backup.
Parameters: |
|
---|
Note
Method call will not return until action is finished.
Return the next result line from service manager. Part of iterator protocol.
Raises StopIteration: | |
---|---|
If there are no further lines. |
Set one-off override for database linger.
Parameters: | database (string) – Database filename or alias. |
---|
Perform restore from physical (NBACKUP) database backup.
Parameters: |
|
---|
Note
Method call will not return until action is finished.
Get next line of textual output from last service query.
Returns string: | Output line. |
---|
Get list of remaining output lines from last service query.
Returns list: | Service output. |
---|---|
Raises ProgrammingError: | |
When service is not in fetching mode. |
Remove user.
Parameters: | user (string or User) – User name or Instance of User with at least its name attribute specified as non-empty value. |
---|
Database Validation and Repair.
Parameters: |
|
---|
Note
Method call will not return until action is finished.
Request database restore from logical (GBAK) backup. (ASYNC service)
Parameters: |
|
---|
If callback is not specified, restore log could be retrieved through readline(), readlines(), iteration over Connection or ignored via call to wait().
Note
Until restore report is not fully fetched from service (or ignored via wait()), any attempt to start another asynchronous service will fail with exception.
Resolve limbo transaction with rollback.
Parameters: |
|
---|
Set Database Access mode: Read Only or Read/Write
Parameters: |
|
---|
Set individual page cache size for Database.
Parameters: |
|
---|
Set data page space reservation policy.
Parameters: |
|
---|
Set SQL Dialect for Database.
Parameters: |
|
---|
Set treshold for automatic sweep.
Parameters: |
|
---|
Set Disk Write Mode: Sync (forced writes) or Async (buffered).
Parameters: |
|
---|
Database shutdown.
Parameters: |
|
---|
See also
See also bring_online() method.
Perform Database Sweep.
Note
Method call will not return until sweep is finished.
Parameters: | database (string) – Database filename or alias. |
---|
Get information about existing trace sessions.
Returns dictionary: | |||||||||
---|---|---|---|---|---|---|---|---|---|
Mapping SESSION_ID -> SESSION_PARAMS Session parameters is another dictionary with next keys:
|
|||||||||
Raises OperationalError: | |||||||||
When server can’t perform requested operation. |
Resume trace session.
Parameters: | trace_id (integer) – Trace session ID. |
---|---|
Returns string: | Text with confirmation that session was resumed. |
Raises: |
|
Start new trace session. (ASYNC service)
Parameters: | |
---|---|
Returns integer: | |
Trace session ID. |
|
Raises DatabaseError: | |
When session ID is not returned on start. |
Trace session output could be retrieved through readline(), readlines(), iteration over Connection or ignored via call to wait().
Note
Until session output is not fully fetched from service (or ignored via wait()), any attempt to start another asynchronous service including call to any trace_ method will fail with exception.
Stop trace session.
Parameters: | trace_id (integer) – Trace session ID. |
---|---|
Returns string: | Text with confirmation that session was stopped. |
Raises: |
|
Suspend trace session.
Parameters: | trace_id (integer) – Trace session ID. |
---|---|
Returns string: | Text with confirmation that session was paused. |
Raises: |
|
Check for user’s existence.
Parameters: | user (string or User) – User name or Instance of User with at least its name attribute specified as non-empty value. |
---|---|
Returns boolean: | |
True when the specified user exists. |
On-line database validation.
Parameters: |
|
---|
Note
Patterns are regular expressions, processed by the same rules as SIMILAR TO expressions. All patterns are case-sensitive, regardless of database dialect. If the pattern for tables is omitted then all user tables will be validated. If the pattern for indexes is omitted then all indexes of the appointed tables will be validated. System tables are not validated.
If callback is not specified, validation log could be retrieved through readline(), readlines(), iteration over Connection or ignored via call to wait().
Note
Until validate report is not fully fetched from service (or ignored via wait()), any attempt to start another asynchronous service will fail with exception.
Wait until running service completes.
(Read Only) True if connection is closed.
(Read Only) (float) Firebird version number of connected server. Only major.minor version.
(Read Only) True if connection is fetching result.
(Read Only) (string) Firebird version number string of connected server. Uses Firebird version numbers in form: major.minor.subrelease.build
Load information about user from server.
Parameters: | svc (Connection) – Open service connection. |
---|---|
Returns: | True if information was successfuly retrieved, False otherwise. |
Raises ProgrammingError: | |
If user name is not defined. |
First name.
User group ID
Last name
Middle name
User login name (username).
Password. Not returned by user output methods, but must be specified to add a user.
User ID
Section codes for Schema.get_metadata_ddl():
Get list of minimal set of SQL GRANT statamenets necessary to grant specified privileges.
Parameters: |
---|
Returns True if ident is Firebird keyword.
This class represents database schema.
Visitor Pattern support. Calls visitSchema(self) on parameter object.
Parameters: | visitor – Visitor object of Vistior Pattern. |
---|
Bind this instance to specified Connection.
Parameters: | connection – Connection instance. |
---|---|
Raises ProgrammingError: | |
If Schema object was set as internal (via _set_as_internal()). |
Drop all cached metadata objects.
Sever link to Connection.
Raises ProgrammingError: | |
---|---|
If Schema object was set as internal (via _set_as_internal()). |
Get CharacterSet by name.
Parameters: | name (string) – Character set name. |
---|---|
Returns: | CharacterSet with specified name or None. |
Get CharacterSet by ID.
Parameters: | name (integer) – CharacterSet ID. |
---|---|
Returns: | CharacterSet with specified ID or None. |
Get Collation by name.
Parameters: | name (string) – Collation name. |
---|---|
Returns: | Collation with specified name or None. |
Get Collation by ID.
Parameters: |
|
---|---|
Returns: | Collation with specified ID or None. |
Get Constraint by name.
Parameters: | name (string) – Constraint name. |
---|---|
Returns: | Constraint with specified name or None. |
Get Domain by name.
Parameters: | name (string) – Domain name. |
---|---|
Returns: | Domain with specified name or None. |
Get DatabaseException by name.
Parameters: | name (string) – Exception name. |
---|---|
Returns: | DatabaseException with specified name or None. |
Get Function by name.
Parameters: | name (string) – Function name. |
---|---|
Returns: | Function with specified name or None. |
Get Sequence by name.
Parameters: | name (string) – Sequence name. |
---|---|
Returns: | Sequence with specified name or None. |
Get Index by name.
Parameters: | name (string) – Index name. |
---|---|
Returns: | Index with specified name or None. |
Returns list of DDL SQL commands for creation of specified categories of database objects.
param list sections: List of section identifiers. returns: List with SQL commands. Sections identifiers are represented by SCRIPT_* contants defined in schema module.
Sections are created in the order of occerence in list. Uses SCRIPT_DEFAULT_ORDER list when sections are not specified.
Get Package by name.
Parameters: | name (string) – Package name. |
---|---|
Returns: | Package with specified name or None. |
Get list of all privileges granted to user/database object.
Parameters: | |
---|---|
Returns: | List of Privilege objects. |
Raises ProgrammingError: | |
For unknown user_type code. |
Get Procedure by name.
Parameters: | name (string) – Procedure name. |
---|---|
Returns: | Procedure with specified name or None. |
Get Role by name.
Parameters: | name (string) – Role name. |
---|---|
Returns: | Role with specified name or None. |
Get Sequence by name.
Parameters: | name (string) – Sequence name. |
---|---|
Returns: | Sequence with specified name or None. |
Get Table by name.
Parameters: | name (string) – Table name. |
---|---|
Returns: | Table with specified name or None. |
Get Trigger by name.
Parameters: | name (string) – Trigger name. |
---|---|
Returns: | Trigger with specified name or None. |
Get View by name.
Parameters: | name (string) – View name. |
---|---|
Returns: | View with specified name or None. |
Returns true if database has multiple files.
Drop all or specified category of cached metadata objects, so they’re reloaded from database on next reference.
Parameters: | data (string) – None or name of metadata category. |
---|
Recognized (case insensitive) names of metadata categories:
Raises ProgrammingError: | |
---|---|
For undefined metadata category. |
Note
Also commits query transaction.
List of all nbackup hisotry records. Items are BackupHistory objects.
List of all character sets in database. Items are CharacterSet objects.
True if link to Connection is closed.
List of all constraints in database. Items are Constraint objects.
Default CharacterSet for database
List of all dependencies in database. Items are Dependency objects.
Database description or None if it doesn’t have a description.
Character set names: key = numID, value = charset_name
Determinism flags: numID, value = flag_name
Field sub types: key = numID, value = type_name
Field types: key = numID, value = type_name
Function types: key = numID, value = type_name
Grant option: key = numID, value = option_name
Index activity status: key = numID, value = flag_name
Index uniqueness: key = numID, value = flag_name
Legacy flags: numID, value = flag_name
Mechanism Types: key = numID, value = type_name
Object type codes: key = type_name, value = numID
Object types: key = numID, value = type_name
Page type: key = numID, value = type_name
Datatype declaration methods for procedure parameters: key = numID, value = name
Parameter Mechanism Types: key = numID, value = type_name
Parameter Types: key = numID, value = type_name
Privacy flags: numID, value = flag_name
Procedure Types: key = numID, value = type_name
Relation Types: key = numID, value = type_name
System Flag Types: key = numID, value = type_name
Transaction State Types: key = numID, value = type_name
Trigger activity status: key = numID, value = flag_name_name
Trigger Types: key = numID, value = type_name
List of all exceptions in database. Items are DatabaseException objects.
List of all extension files defined for database. Items are DatabaseFile objects.
Database linger value.
option switch: Always quote db object names on output
option switch: Keyword for generator/sequence
Database owner name.
Can refer to the security class applied as databasewide access control limits.
Base class for all database schema objects.
Visitor Pattern support. Calls visitMetadatItem(self) on parameter object.
Parameters: | visitor – Visitor object of Vistior Pattern. |
---|
Returns list of database objects that this object depend on.
Returns list of all database objects that depend on this one.
Returns quoted (if necessary) name.
Returns SQL command for specified action on metadata object.
Supported actions are defined by actions list.
Raises ProgrammingError: | |
---|---|
For unsupported action or wrong parameters passed. |
Returns True if this database object is system object.
List of supported SQL operations on metadata object instance.
Database object description or None if object doesn’t have a description.
Database object name or None if object doesn’t have a name.
Represents collation.
Supported SQL actions:
Visitor Pattern support. Calls visitCollation(self) on parameter object.
Parameters: | visitor – Visitor object of Vistior Pattern. |
---|
Returns list of database objects that this object depend on.
Returns list of all database objects that depend on this one.
Returns quoted (if necessary) name.
Returns SQL command for specified action on metadata object.
Supported actions are defined by actions list.
Raises ProgrammingError: | |
---|---|
For unsupported action or wrong parameters passed. |
Returns True if collation has ACCENT INSENSITIVE attribute.
Returns True if collation is based on external collation definition.
Returns True if collation has CASE INSENSITIVE attribute.
Returns True if collation has PAD SPACE attribute.
Returns True if this database object is system object.
List of supported SQL operations on metadata object instance.
Collation attributes.
Base Collation object that’s extended by this one or None.
Character set object associated with collation.
Database object description or None if object doesn’t have a description.
Not currently used.
Collation ID.
Database object name or None if object doesn’t have a name.
Creator user name.
Security class name or None.
Collation specific attributes.
Represents character set.
Supported SQL actions: alter(collation=Collation instance or collation name), comment
Visitor Pattern support. Calls visitCharacterSet(self) on parameter object.
Parameters: | visitor – Visitor object of Vistior Pattern. |
---|
Return Collation object with specified name that belongs to this character set.
Return Collation object with specified id that belongs to this character set.
Returns list of database objects that this object depend on.
Returns list of all database objects that depend on this one.
Returns quoted (if necessary) name.
Returns SQL command for specified action on metadata object.
Supported actions are defined by actions list.
Raises ProgrammingError: | |
---|---|
For unsupported action or wrong parameters passed. |
Returns True if this database object is system object.
List of supported SQL operations on metadata object instance.
Size of characters in bytes.
List of Collations associated with character set.
Collate object of default collate.
Database object description or None if object doesn’t have a description.
Character set ID.
Database object name or None if object doesn’t have a name.
Creator user name.
Security class name or None.
Represents database exception.
Supported SQL actions:
Visitor Pattern support. Calls visitException(self) on parameter object.
Parameters: | visitor – Visitor object of Vistior Pattern. |
---|
Returns list of database objects that this object depend on.
Returns list of all database objects that depend on this one.
Returns quoted (if necessary) name.
Returns SQL command for specified action on metadata object.
Supported actions are defined by actions list.
Raises ProgrammingError: | |
---|---|
For unsupported action or wrong parameters passed. |
Returns True if this database object is system object.
List of supported SQL operations on metadata object instance.
Database object description or None if object doesn’t have a description.
System-assigned unique exception number.
Custom message text.
Database object name or None if object doesn’t have a name.
Creator user name.
Security class name or None.
Represents database generator/sequence.
Supported SQL actions:
Visitor Pattern support. Calls visitGenerator(self) on parameter object.
Parameters: | visitor – Visitor object of Vistior Pattern. |
---|
Returns list of database objects that this object depend on.
Returns list of all database objects that depend on this one.
Returns quoted (if necessary) name.
Returns SQL command for specified action on metadata object.
Supported actions are defined by actions list.
Raises ProgrammingError: | |
---|---|
For unsupported action or wrong parameters passed. |
Returns True for system generators created for IDENTITY columns.
Returns True if this database object is system object.
List of supported SQL operations on metadata object instance.
Database object description or None if object doesn’t have a description.
Internal ID number of the sequence.
Sequence increment.
Initial sequence value.
Database object name or None if object doesn’t have a name.
Creator user name.
Security class name or None.
Current sequence value.
Represents database index.
Supported SQL actions:
Visitor Pattern support. Calls visitIndex(self) on parameter object.
Parameters: | visitor – Visitor object of Vistior Pattern. |
---|
Returns list of database objects that this object depend on.
Returns list of all database objects that depend on this one.
Returns quoted (if necessary) name.
Returns SQL command for specified action on metadata object.
Supported actions are defined by actions list.
Raises ProgrammingError: | |
---|---|
For unsupported action or wrong parameters passed. |
Returns True if index is used to enforce a constraint.
Returns True if index is expression index.
Returns True if index is INACTIVE.
Returns True if this database object is system object.
Returns True if index is UNIQUE.
List of supported SQL operations on metadata object instance.
Constraint instance that uses this index or None.
Database object description or None if object doesn’t have a description.
Source of an expression or None.
Internal number ID of the index.
ASCENDING or DESCENDING.
Database object name or None if object doesn’t have a name.
List of index segment names.
List of index segment statistics (for ODS 11.1 and higher).
List of index segments as TableColumn instances.
Latest selectivity of the index.
Represents table column.
Supported SQL actions:
expression=computed_by_expr,restart=None_or_init_value), drop, comment
System column: comment
Visitor Pattern support. Calls visitTableColumn(self) on parameter object.
Parameters: | visitor – Visitor object of Vistior Pattern. |
---|
Returns (string) extression for column computation or None.
Return list of database objects that this object depend on.
Return list of all database objects that depend on this one.
Returns quoted (if necessary) name.
Returns SQL command for specified action on metadata object.
Supported actions are defined by actions list.
Raises ProgrammingError: | |
---|---|
For unsupported action or wrong parameters passed. |
Returns True if column has default value.
Returns True if column is computed.
Returns True if column is based on user domain.
Returns True for identity type column.
Returns True if column can accept NULL values.
Returns True if this database object is system object.
Returns True if column is writable (i.e. it’s not computed etc.).
List of supported SQL operations on metadata object instance.
Collation object or None.
Comlete SQL datatype definition.
Default value for column or None.
Database object description or None if object doesn’t have a description.
Domain object this column is based on.
Internal flags.
Internal flags.
Database object name or None if object doesn’t have a name.
Column’s sequence number in row.
Security class name or None.
The Table object this column belongs to.
Represents view column.
Supported SQL actions: comment
Visitor Pattern support. Calls visitViewColumn(self) on parameter object.
Parameters: | visitor – Visitor object of Vistior Pattern. |
---|
Return list of database objects that this object depend on.
Return list of all database objects that depend on this one.
Returns quoted (if necessary) name.
Returns SQL command for specified action on metadata object.
Supported actions are defined by actions list.
Raises ProgrammingError: | |
---|---|
For unsupported action or wrong parameters passed. |
Returns True if column is NULLABLE.
Returns True if this database object is system object.
Returns True if column is writable.
List of supported SQL operations on metadata object instance.
The source column from the base relation. Result could be either TableColumn, ViewColumn or ProcedureParameter instance or None.
Collation object or None.
Comlete SQL datatype definition.
Database object description or None if object doesn’t have a description.
Domain object this column is based on.
Database object name or None if object doesn’t have a name.
Column’s sequence number in row.
Security class name or None.
View object this column belongs to.
Represents SQl Domain.
Supported SQL actions:
Visitor Pattern support. Calls visitDomain(self) on parameter object.
Parameters: | visitor – Visitor object of Vistior Pattern. |
---|
Returns list of database objects that this object depend on.
Returns list of all database objects that depend on this one.
Returns quoted (if necessary) name.
Returns SQL command for specified action on metadata object.
Supported actions are defined by actions list.
Raises ProgrammingError: | |
---|---|
For unsupported action or wrong parameters passed. |
Returns True if domain has default value.
Returns True if domain defines an array.
Returns True if domain is computed.
Returns True if domain is not defined with NOT NULL.
Return True if this database object is system object.
Returns True if domain has validation constraint.
List of supported SQL operations on metadata object instance.
Length of CHAR and VARCHAR column, in characters (not bytes).
CharacterSet object for a character or text BLOB column, or None.
Collation object for a character column or None.
Comlete SQL datatype definition.
Expression that defines the default value or None.
Database object description or None if object doesn’t have a description.
List of dimension definition pairs if column is an array type. Always empty for non-array columns.
Expression that defines the COMPUTED BY column or None.
Length of field as it is in an external table. Always 0 for regular tables.
Scale factor of an integer field as it is in an external table.
Data type of the field as it is in an external table.
Number code of the data type defined for the column.
Length of the column in bytes.
Database object name or None if object doesn’t have a name.
Creator user name.
Indicates the number of digits of precision available to the data type of the column.
Negative number representing the scale of NUMBER and DECIMAL column.
Security class name or None.
For BLOB columns, a suggested length for BLOB buffers.
BLOB subtype.
CHECK constraint for the domain or None.
Maps dependency between database objects.
Supported SQL actions: none
Visitor Pattern support. Calls visitDependency(self) on parameter object.
Parameters: | visitor – Visitor object of Vistior Pattern. |
---|
Returns empty list because Dependency object never has dependencies.
Returns empty list because Dependency object never has dependents.
Returns quoted (if necessary) name.
Returns SQL command for specified action on metadata object.
Supported actions are defined by actions list.
Raises ProgrammingError: | |
---|---|
For unsupported action or wrong parameters passed. |
Returns True if dependency is defined in package.
Returns True as dependency entries are considered as system objects.
List of supported SQL operations on metadata object instance.
Database object on which dependent depends.
Name of db object on which dependent depends.
Type of db object on which dependent depends.
Dependent database object.
Dependent database object name.
Dependent database object type.
Database object description or None if object doesn’t have a description.
Name of one column in depended on object.
Database object name or None if object doesn’t have a name.
Represents table or column constraint.
Supported SQL actions:
Visitor Pattern support. Calls visitConstraint(self) on parameter object.
Parameters: | visitor – Visitor object of Vistior Pattern. |
---|
Returns list of database objects that this object depend on.
Returns list of all database objects that depend on this one.
Returns quoted (if necessary) name.
Returns SQL command for specified action on metadata object.
Supported actions are defined by actions list.
Raises ProgrammingError: | |
---|---|
For unsupported action or wrong parameters passed. |
Returns True if it’s CHECK constraint.
Returns True if it’s DEFERRABLE constraint.
Returns True if it’s INITIALLY DEFERRED constraint.
Returns True if it’s FOREIGN KEY constraint.
Returns True if it’s NOT NULL constraint.
Returns True if it’s PRIMARY KEY constraint.
Returns True if this database object is system object.
Returns True if it’s UNIQUE constraint.
List of supported SQL operations on metadata object instance.
For a NOT NULL constraint, this is the name of the column to which the constraint applies.
primary key/unique/foreign key/check/not null.
For a FOREIGN KEY constraint, this is the action applicable to when primary key is deleted.
Database object description or None if object doesn’t have a description.
Index instance that enforces the constraint. None if constraint is not primary key/unique or foreign key.
For a FOREIGN KEY constraint only. Current value is FULL in all cases.
Database object name or None if object doesn’t have a name.
For a FOREIGN KEY constraint, this is the unique or primary key Constraint referred.
For a CHECK constraint contains trigger names that enforce the constraint.
For a FOREIGN KEY constraint, this is the action applicable to when primary key is updated.
Represents Table in database.
Supported SQL actions:
recreate (no_pk=bool,no_unique=bool), drop, comment
System table: comment
Visitor Pattern support. Calls visitTable(self) on parameter object.
Parameters: | visitor – Visitor object of Vistior Pattern. |
---|
Return TableColumn object with specified name.
Returns list of database objects that this object depend on.
Returns list of all database objects that depend on this one.
Returns quoted (if necessary) name.
Returns SQL command for specified action on metadata object.
Supported actions are defined by actions list.
Raises ProgrammingError: | |
---|---|
For unsupported action or wrong parameters passed. |
Returns True if table has any FOREIGN KEY constraint.
Returns True if table has PRIMARY KEY defined.
Returns True if table is external table.
Returns True if table is GLOBAL TEMPORARY table.
Returns True if table is persistent one.
Returns True if this database object is system object.
List of supported SQL operations on metadata object instance.
Returns list of columns defined for table. Items are TableColumn objects.
Returns list of constraints defined for table. Items are Constraint objects.
Length of the RDB$DB_KEY column in bytes.
Default security class.
Database object description or None if object doesn’t have a description.
Full path to the external data file, if any.
Internal flags.
List of FOREIGN KEY Constraint instances for this table.
Internal format ID for the table.
Internam number ID for the table.
Database object name or None if object doesn’t have a name.
User name of table’s creator.
PRIMARY KEY Constraint for this table or None.
Security class that define access limits to the table.
Table type.
Represents database View.
Supported SQL actions:
Visitor Pattern support. Calls visitView(self) on parameter object.
Parameters: | visitor – Visitor object of Vistior Pattern. |
---|
Return TableColumn object with specified name.
Returns list of database objects that this object depend on.
Returns list of all database objects that depend on this one.
Returns quoted (if necessary) name.
Returns SQL command for specified action on metadata object.
Supported actions are defined by actions list.
Raises ProgrammingError: | |
---|---|
For unsupported action or wrong parameters passed. |
Returns True if View has WITH CHECK OPTION defined.
Returns True if this database object is system object.
List of supported SQL operations on metadata object instance.
Returns list of columns defined for view. Items are ViewColumn objects.
Length of the RDB$DB_KEY column in bytes.
Default security class.
Database object description or None if object doesn’t have a description.
Internal flags.
Internal format ID for the view.
Internal number ID for the view.
Database object name or None if object doesn’t have a name.
User name of view’s creator.
Security class that define access limits to the view.
The query specification.
Represents trigger.
Supported SQL actions:
Visitor Pattern support. Calls visitTrigger(self) on parameter object.
Parameters: | visitor – Visitor object of Vistior Pattern. |
---|
Returns list of database objects that this object depend on.
Returns list of all database objects that depend on this one.
Returns quoted (if necessary) name.
Returns SQL command for specified action on metadata object.
Supported actions are defined by actions list.
Raises ProgrammingError: | |
---|---|
For unsupported action or wrong parameters passed. |
Return string with action and operation specification.
Returns True if this trigger is active.
Returns True if this trigger is set for AFTER action.
Returns True if this trigger is set for BEFORE action.
Returns True if this trigger is database trigger.
Returns True if this trigger is DDL trigger.
Returns True if this trigger is set for DELETE operation.
Returns True if this trigger is set for INSERT operation.
Returns True if this database object is system object.
Returns True if this trigger is set for UPDATE operation.
List of supported SQL operations on metadata object instance.
Database object description or None if object doesn’t have a description.
Engine name.
Entrypoint.
Internal flags.
Database object name or None if object doesn’t have a name.
Sequence (position) of trigger. Zero usually means no sequence defined.
PSQL source code.
Numeric code for trigger type that define what event and when are covered by trigger.
Trigger BLR invalidation flag. Coul be True/False or None.
Represents procedure parameter.
Supported SQL actions: comment
Visitor Pattern support. Calls visitProcedureParameter(self) on parameter object.
Parameters: | visitor – Visitor object of Vistior Pattern. |
---|
Returns list of database objects that this object depend on.
Returns list of all database objects that depend on this one.
Returns quoted (if necessary) name.
Returns SQL definition for parameter.
Returns SQL command for specified action on metadata object.
Supported actions are defined by actions list.
Raises ProgrammingError: | |
---|---|
For unsupported action or wrong parameters passed. |
Returns True if parameter has default value.
Returns True if parameter is INPUT parameter.
Returns True if parameter allows NULL.
Returns True if procedure parameter is defined in package.
Returns True if this database object is system object.
List of supported SQL operations on metadata object instance.
TableColumn for this parameter.
Comlete SQL datatype definition.
Default value.
Database object description or None if object doesn’t have a description.
Parameter mechanism code.
Database object name or None if object doesn’t have a name.
Name of the stored procedure.
Sequence (position) of parameter.
Numeric code. See Schema.enum_param_type_from.`
Represents stored procedure.
Supported SQL actions:
Visitor Pattern support. Calls visitProcedure(self) on parameter object.
Parameters: | visitor – Visitor object of Vistior Pattern. |
---|
Returns list of database objects that this object depend on.
Returns list of all database objects that depend on this one.
Returns ProcedureParameter with specified name or None
Returns quoted (if necessary) name.
Returns SQL command for specified action on metadata object.
Supported actions are defined by actions list.
Raises ProgrammingError: | |
---|---|
For unsupported action or wrong parameters passed. |
Returns True if procedure has any input parameters.
Returns True if procedure has any output parameters.
Returns True if procedure is defined in package.
Returns True if this database object is system object.
List of supported SQL operations on metadata object instance.
Database object description or None if object doesn’t have a description.
Engine name.
Entrypoint.
Internal unique ID number.
List of input parameters. Instances are ProcedureParameter instances.
Database object name or None if object doesn’t have a name.
List of output parameters. Instances are ProcedureParameter instances.
User name of procedure’s creator.
Privacy flag.
Procedure type code. See fdb.Connection.enum_procedure_types.
Security class that define access limits to the procedure.
PSQL source code.
Procedure BLR invalidation flag. Coul be True/False or None.
Represents user role.
Supported SQL actions:
Visitor Pattern support. Calls visitRole(self) on parameter object.
Parameters: | visitor – Visitor object of Vistior Pattern. |
---|
Returns list of database objects that this object depend on.
Returns list of all database objects that depend on this one.
Returns quoted (if necessary) name.
Returns SQL command for specified action on metadata object.
Supported actions are defined by actions list.
Raises ProgrammingError: | |
---|---|
For unsupported action or wrong parameters passed. |
Returns True if this database object is system object.
List of supported SQL operations on metadata object instance.
Database object description or None if object doesn’t have a description.
Database object name or None if object doesn’t have a name.
User name of role owner.
Security class name or None.
Represets UDF argument.
Supported SQL actions: none.
Visitor Pattern support. Calls visitFunctionArgument(self) on parameter object.
Parameters: | visitor – Visitor object of Vistior Pattern. |
---|
Returns list of database objects that this object depend on.
Returns list of all database objects that depend on this one.
Returns quoted (if necessary) name.
Returns SQL definition for parameter.
Returns SQL command for specified action on metadata object.
Supported actions are defined by actions list.
Raises ProgrammingError: | |
---|---|
For unsupported action or wrong parameters passed. |
Returns True if parameter has default value.
Returns True if argument is passed by descriptor.
Parameters: | any (bool) – If True, method returns True if any kind of descriptor is used (including BLOB and ARRAY descriptors). |
---|
Returns True if argument is passed by reference.
Returns True if argument is passed by value.
Returns True if (return) argument is declared as FREE_IT.
Returns True if parameter allows NULL.
Returns True if function argument is defined in package.
Returns True if argument represents return value for function.
Returns True if this database object is system object.
Returns True if argument is passed by reference with NULL support.
List of supported SQL operations on metadata object instance.
Argiment mechanism.
Argument name.
Length of CHAR and VARCHAR column, in characters (not bytes).
CharacterSet for a character/text BLOB argument, or None.
TableColumn for this parameter.
Comlete SQL datatype definition.
Default value.
Database object description or None if object doesn’t have a description.
Number code of the data type defined for the argument.
Length of the argument in bytes.
How argument is passed.
Database object name or None if object doesn’t have a name.
Argument position.
Indicates the number of digits of precision available to the data type of the argument.
Negative number representing the scale of NUMBER and DECIMAL argument.
BLOB subtype.
Numeric code. See Schema.enum_param_type_from.`
Represents user defined function.
Supported SQL actions:
External UDF: declare, drop, comment
recreate(no_code=bool), create_or_alter(no_code=bool), drop, alter(arguments=string_or_list,returns=string,declare=string_or_list, code=string_or_list)
System UDF: none
Visitor Pattern support. Calls visitFunction(self) on parameter object.
Parameters: | visitor – Visitor object of Vistior Pattern. |
---|
Returns list of database objects that this object depend on.
Returns list of all database objects that depend on this one.
Returns quoted (if necessary) name.
Returns SQL command for specified action on metadata object.
Supported actions are defined by actions list.
Raises ProgrammingError: | |
---|---|
For unsupported action or wrong parameters passed. |
Returns True if function has input arguments.
Returns True if function returns a value.
Returns True if function returns a value in input argument.
Returns True if function is external UDF, False for PSQL functions.
Returns True if function is defined in package.
Returns True if this database object is system object.
List of supported SQL operations on metadata object instance.
List of function arguments. Items are FunctionArgument instances.
Database object description or None if object doesn’t have a description.
Deterministic flag.
Engine name.
Entrypoint in module.
Function ID.
Legacy flag.
Module name.
Database object name or None if object doesn’t have a name.
Owner name.
Private flag.
Returning FunctionArgument or None.
Security class.
Function source.
BLR validity flag.
Represents database extension file.
Supported SQL actions: create
Visitor Pattern support. Calls visitDatabaseFile(self) on parameter object.
Parameters: | visitor – Visitor object of Vistior Pattern. |
---|
Returns list of database objects that this object depend on.
Returns list of all database objects that depend on this one.
Returns quoted (if necessary) name.
Returns SQL command for specified action on metadata object.
Supported actions are defined by actions list.
Raises ProgrammingError: | |
---|---|
For unsupported action or wrong parameters passed. |
Returns True.
List of supported SQL operations on metadata object instance.
Database object description or None if object doesn’t have a description.
File name.
File length in pages.
Database object name or None if object doesn’t have a name.
File sequence number.
File start page number.
Represents database shadow.
Supported SQL actions: create, drop(preserve=bool)
Visitor Pattern support. Calls visitShadow(self) on parameter object.
Parameters: | visitor – Visitor object of Vistior Pattern. |
---|
Returns list of database objects that this object depend on.
Returns list of all database objects that depend on this one.
Returns quoted (if necessary) name.
Returns SQL command for specified action on metadata object.
Supported actions are defined by actions list.
Raises ProgrammingError: | |
---|---|
For unsupported action or wrong parameters passed. |
Returns True if it’s CONDITIONAL shadow.
Returns True if it’s INACTIVE shadow.
Returns True if it’s MANUAL shadow.
Returns False.
List of supported SQL operations on metadata object instance.
Database object description or None if object doesn’t have a description.
List of shadow files. Items are DatabaseFile instances.
Shadow flags.
Shadow ID number.
Database object name or None if object doesn’t have a name.
Represents priviledge to database object.
Supported SQL actions: grant(grantors),revoke(grantors,grant_option)
Visitor Pattern support. Calls visitPrivilege(self) on parameter object.
Parameters: | visitor – Visitor object of Vistior Pattern. |
---|
Returns list of database objects that this object depend on.
Returns list of all database objects that depend on this one.
Returns quoted (if necessary) name.
Returns SQL command for specified action on metadata object.
Supported actions are defined by actions list.
Raises ProgrammingError: | |
---|---|
For unsupported action or wrong parameters passed. |
Returns True if privilege comes with GRANT OPTION.
Returns True if this is DELETE privilege.
Returns True if this is EXECUTE privilege.
Returns True if this is INSERT privilege.
Returns True if this is ROLE membership privilege.
Returns True if this is REFERENCE privilege.
Returns True if this is SELECT privilege.
Returns True.
Returns True if this is UPDATE privilege.
List of supported SQL operations on metadata object instance.
Database object description or None if object doesn’t have a description.
Field name.
Grantor name.
Database object name or None if object doesn’t have a name.
Privilege code.
Subject name.
Subject type.
User name.
User type.
Represents PSQL package.
Visitor Pattern support. Calls visitProcedure(self) on parameter object.
Parameters: | visitor – Visitor object of Vistior Pattern. |
---|
Returns list of database objects that this object depend on.
Returns list of all database objects that depend on this one.
Returns quoted (if necessary) name.
Returns SQL command for specified action on metadata object.
Supported actions are defined by actions list.
Raises ProgrammingError: | |
---|---|
For unsupported action or wrong parameters passed. |
Returns True if this database object is system object.
List of supported SQL operations on metadata object instance.
Package body source.
Database object description or None if object doesn’t have a description.
Package header source.
Database object name or None if object doesn’t have a name.
User name of package creator.
Security class name or None.
Represents entry of history for backups performed using the nBackup utility.
Supported SQL actions: None
Visitor Pattern support. Calls visitBackupHistory(self) on parameter object.
Parameters: | visitor – Visitor object of Vistior Pattern. |
---|
Returns list of database objects that this object depend on.
Returns list of all database objects that depend on this one.
Returns quoted (if necessary) name.
Returns SQL command for specified action on metadata object.
Supported actions are defined by actions list.
Raises ProgrammingError: | |
---|---|
For unsupported action or wrong parameters passed. |
Returns True.
List of supported SQL operations on metadata object instance.
The identifier assigned by the engine.
Backup date and time.
Database object description or None if object doesn’t have a description.
Full path and file name of backup file.
Unique identifier.
Backup level.
Database object name or None if object doesn’t have a name.
System (scan) number.
Represents userdefined BLOB filter.
Supported SQL actions:
Visitor Pattern support. Calls visitFilter(self) on parameter object.
Parameters: | visitor – Visitor object of Vistior Pattern. |
---|
Returns list of database objects that this object depend on.
Returns list of all database objects that depend on this one.
Returns quoted (if necessary) name.
Returns SQL command for specified action on metadata object.
Supported actions are defined by actions list.
Raises ProgrammingError: | |
---|---|
For unsupported action or wrong parameters passed. |
Returns True if this database object is system object.
List of supported SQL operations on metadata object instance.
Database object description or None if object doesn’t have a description.
The exported name of the BLOB filter in the filter library.
The BLOB subtype of the data to be converted by the function.
The name of the dynamic library or shared object where the code of the BLOB filter is located.
Database object name or None if object doesn’t have a name.
The BLOB subtype of the converted data.
Helper class for implementation of schema Visitor.
Implements all visit* methods supported by schema classes as calls to default_action().
Does nothing.
Shutdown modes for DatabaseInfo.shutdown_mode.
Backup states for DatabaseInfo.backup_state.
States for AttachmentInfo.state, TransactionInfo.state. and StatementInfo.state.
Isolation modes for TransactionInfo.isolation_mode.
Special timeout values for TransactionInfo.lock_timeout.
Group codes for IOStatsInfo.group.
Class for access to Firebird monitoring tables.
Bind this instance to specified Connection.
Parameters: | connection – Connection instance. |
---|---|
Raises ProgrammingError: | |
If Monitor object was set as internal (via _set_as_internal()) or database has ODS lower than 11.1. |
Drop all cached information objects. Force reload of fresh monitoring information on next reference.
Sever link to Connection.
Raises ProgrammingError: | |
---|---|
If Monitor object was set as internal (via _set_as_internal()). |
Get AttachmentInfo by ID.
Parameters: | id (int) – Attachment ID. |
---|---|
Returns: | AttachmentInfo with specified ID or None. |
Get CallStackInfo by ID.
Parameters: | id (int) – Callstack ID. |
---|---|
Returns: | CallStackInfo with specified ID or None. |
Get StatementInfo by ID.
Parameters: | id (int) – Statement ID. |
---|---|
Returns: | StatementInfo with specified ID or None. |
Get TransactionInfo by ID.
Parameters: | id (int) – Transaction ID. |
---|---|
Returns: | TransactionInfo with specified ID or None. |
Reloads fresh monitoring information.
List of all attachments. Items are AttachmentInfo objects.
List with complete call stack. Items are CallStackInfo objects.
True if link to Connection is closed.
DatabaseInfo object for attached database.
List of all I/O statistics. Items are IOStatsInfo objects.
List of all statements. Items are StatementInfo objects.
List of all table record I/O statistics. Items are TableStatsInfo objects.
AttachmentInfo object for current connection.
List of all transactions. Items are TransactionInfo objects.
List of all context variables. Items are ContextVariableInfo objects.
Information about attached database.
Current state of database with respect to nbackup physical backup.
Number of pages allocated in the page cache.
Creation date and time, i.e., when the database was created or last restored.
Number of page being encrypted.
True if database uses synchronous writes.
IOStatsInfo for this object.
Database pathname or alias.
Transaction ID of the next transaction that will be started.
Transaction ID of the oldest active transaction.
On-Disk Structure (ODS) version number.
Transaction ID of the oldest [interesting] transaction.
Transaction ID of the Oldest Snapshot, i.e., the number of the OAT when the last garbage collection was done.
User name of database owner.
Size of database page in bytes.
Number of pages allocated on disk.
True if database is Read Only.
True if database reserves space on data pages.
TYpe of security database (Default, Self or Other).
Current shutdown mode.
SQL dialect of the database.
Internal ID.
The sweep interval configured in the database header. Value 0 indicates that sweeping is disabled.
Dictionary of TableStatsInfo instances for this object.
Information about attachment (connection) to database.
Returns True if attachment is active.
Returns True if Garbage Collection is enabled for this attachment.
Returns True if attachment is idle.
Returns True if attachment is internal system attachment.
Terminates client session associated with this attachment.
Raises ProgrammingError: | |
---|---|
If database has ODS lower than 11.2 or this attachement is current session. |
Authentication method.
CharacterSet for this attachment.
Client library version.
Attachment ID.
IOStatsInfo for this object.
Database pathname or alias.
Remote address.
Name of remote host.
OS user name of client process.
Remote client process ID.
Remote client process pathname.
Remote protocol name.
Remote protocol version.
Role name.
Server process ID.
Internal ID.
Attachment state (idle/active).
List of statements associated with attachment. Items are StatementInfo objects.
Dictionary of TableStatsInfo instances for this object.
Attachment date/time.
List of transactions associated with attachment. Items are TransactionInfo objects.
User name.
List of variables associated with attachment. Items are ContextVariableInfo objects.
Information about transaction.
Returns True if transaction is active.
Returns True for autocommited transaction.
Returns True for transaction with automatic undo.
Returns True if transaction is idle.
Returns True if transaction is Read Only.
AttachmentInfo instance to which this transaction belongs.
Transaction ID.
IOStatsInfo for this object.
Transaction isolation mode code.
Lock timeout.
Oldest transaction (local OIT).
Oldest active transaction (local OAT).
Internal ID.
Transaction state (idle/active).
List of statements associated with transaction. Items are StatementInfo objects.
Dictionary of TableStatsInfo instances for this object.
Transaction start date/time.
Top transaction.
List of variables associated with transaction. Items are ContextVariableInfo objects.
Information about executed SQL statement.
Returns True if statement is active.
Returns True if statement is idle.
Terminates execution of statement.
Raises ProgrammingError: | |
---|---|
If this attachement is current session. |
AttachmentInfo instance to which this statement belongs.
List with call stack for statement. Items are CallStackInfo objects.
Statement ID.
IOStatsInfo for this object.
Explained execution plan.
Statement text, if appropriate.
Internal ID.
Statement state (idle/active).
Dictionary of TableStatsInfo instances for this object.
Statement start date/time.
TransactionInfo instance to which this statement belongs or None.
Information about PSQL call (stack frame).
Call stack entry (CallStackInfo) of the caller.
SQL source column number.
Call ID.
IOStatsInfo for this object.
SQL source line number.
Package name.
Internal ID.
Top-level StatementInfo instance to which this call stack entry belongs.
Request start date/time.
Information about page and row level I/O operations, and about memory consumption.
Number of records where a new primary record version or a change to an existing primary record version is backed out due to rollback or savepoint undo.
Number of record backversion reads.
Number of record conflits.
Number of deleted records.
Number of records where record version chain is being deleted due to deletions by transactions older than OAT.
Number of page fetches.
Number of record fragment reads.
Object group code.
Number of records read via an index.
Number of inserted records.
Number of record locks.
Number of pages with changes pending.
Maximum number of bytes allocated from the operating system by this object.
Maximum number of bytes used by this object.
Number of bytes currently allocated at the OS level.
Number of bytes currently in use.
Object that owns this IOStats instance. Could be either DatabaseInfo, AttachmentInfo, TransactionInfo, StatementInfo or CallStackInfo instance.
Number of records where record version chain is being purged of versions no longer needed by OAT or younger transactions.
Number of page reads.
Number of repeated record reads.
Number of records read sequentially.
Internal ID.
Number of updated records.
Number of record waits.
Number of page writes.
Information about context variable.
Returns True if variable is associated to attachment context.
Returns True if variable is associated to transaction context.
AttachmentInfo instance to which this context variable belongs or None.
Context variable name.
Internal ID.
TransactionInfo instance to which this context variable belongs or None.
Value of context variable.
Helper function for LateBindingProperty class.
Iterator that yields name, property pairs for all properties in class.
Parameters: | cls (class) – Class object. |
---|
Iterator that yields names of all non-callable attributes in class.
Parameters: | cls (class) – Class object. |
---|
Class decorator that injects properties and non-callable attributes from another class instance embedded in class instances.
param class from_class: Class that should extend decorated class. param string attr: Attribute name that holds instance of embedded class within decorated class instance.
Peroperty class that binds to getter/setter/deleter methods when instance of class that define the property is created. This allows you to override these methods in descendant classes (if they are not private) without necessity to redeclare the property itself in descendant class.
Recipe from Tim Delaney, 2005/03/31 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/408713
class C(object):
def getx(self):
print 'C.getx'
return self._x
def setx(self, x):
print 'C.setx'
self._x = x
def delx(self):
print 'C.delx'
del self._x
x = LateBindingProperty(getx, setx, delx)
class D(C):
def setx(self, x):
print 'D.setx'
super(D, self).setx(x)
def delx(self):
print 'D.delx'
super(D, self).delx()
c = C()
c.x = 1
c.x
c.x
del c.x
print
d = D()
d.x = 1
d.x
d.x
del d.x
This has the advantages that:
Property class that forwards calls to getter/setter/deleter methods to respective property methods of another object. This class allows you to “inject” properties from embedded object into class definition of parent object.
Parameters: |
---|