firebird.driver.types

Exceptions

Next exceptions are required by Python DB API 2.0

Error is imported from firebird.base.types.

exception firebird.driver.types.Error(*args, **kwargs)[source]

Bases: Exception

Exception that is intended to be used as a base class of all application-related errors. The important difference from Exception class is that Error accepts keyword arguments, that are stored into instance attributes with the same name.

Important

Attribute lookup on this class never fails, as all attributes that are not actually set, have None value.

Example:

try:
    if condition:
        raise Error("Error message", err_code=1)
    else:
        raise Error("Unknown error")
except Error as e:
    if e.err_code is None:
        ...
    elif e.err_code == 1:
        ...

Note

Warnings are not considered errors and thus should not use this class as base.

exception firebird.driver.types.InterfaceError(*args, **kwargs)[source]

Bases: Error

Exception raised for errors that are reported by the driver rather than the Firebird itself.

exception firebird.driver.types.DatabaseError(*args, **kwargs)[source]

Bases: Error

Exception raised for all errors reported by Firebird.

gds_codes: Tuple[int] = ()

Tuple with all returned GDS error codes

sqlcode: int = None

Returned SQLCODE or None

sqlstate: str = None

Returned SQLSTATE or None

exception firebird.driver.types.DataError(*args, **kwargs)[source]

Bases: DatabaseError

Exception raised for errors that are due to problems with the processed data like division by zero, numeric value out of range, etc.

Important

This exceptions is never directly thrown by Firebird driver.

exception firebird.driver.types.OperationalError(*args, **kwargs)[source]

Bases: 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.

Important

This exceptions is never directly thrown by Firebird driver.

exception firebird.driver.types.IntegrityError(*args, **kwargs)[source]

Bases: DatabaseError

Exception raised when the relational integrity of the database is affected, e.g. a foreign key check fails.

Important

This exceptions is never directly thrown by Firebird driver.

exception firebird.driver.types.InternalError(*args, **kwargs)[source]

Bases: 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.

Important

This exceptions is never directly thrown by Firebird driver.

exception firebird.driver.types.ProgrammingError(*args, **kwargs)[source]

Bases: 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.

Important

This exceptions is never directly thrown by Firebird driver.

exception firebird.driver.types.NotSupportedError(*args, **kwargs)[source]

Bases: DatabaseError

Exception raised in case a method or database API was used which is not supported by the database.

exception firebird.driver.types.FirebirdWarning(*args, **kwargs)[source]

Bases: UserWarning

Warning from Firebird engine.

The important difference from Warning class is that FirebirdWarning accepts keyword arguments, that are stored into instance attributes with the same name.

Important

Attribute lookup on this class never fails, as all attributes that are not actually set, have None value.

Example:

try:
    if condition:
        raise FirebirdWarning("Error message", err_code=1)
    else:
        raise FirebirdWarning("Unknown error")
except FirebirdWarning as e:
    if e.err_code is None:
        ...
    elif e.err_code == 1:
        ...

This is the exception inheritance layout:

StandardError
|__UserWarning
    |__FirebirdWarning
|__Error
    |__InterfaceError
    |__DatabaseError
        |__DataError
        |__OperationalError
        |__IntegrityError
        |__InternalError
        |__ProgrammingError
        |__NotSupportedError

Other constants and types required by Python DB API 2.0 specification

Globals

firebird.driver.types.apilevel: str

String constant stating the supported DB API level.

firebird.driver.types.threadsafety: int

Integer constant stating the level of thread safety the interface supports. Curretly 1 = Threads may share the module, but not connections.

firebird.driver.types.paramstyle: str

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

  • DESCRIPTION_NAME

  • DESCRIPTION_TYPE_CODE

  • DESCRIPTION_DISPLAY_SIZE

  • DESCRIPTION_INTERNAL_SIZE

  • DESCRIPTION_PRECISION

  • DESCRIPTION_SCALE

  • DESCRIPTION_NULL_OK

Types

firebird.driver.types.STRING

This type object is used to describe columns in a database that are string-based (e.g. CHAR).

firebird.driver.types.BINARY

This type object is used to describe (long) binary columns in a database (e.g. LONG, RAW, BLOBs).

firebird.driver.types.NUMBER

This type object is used to describe numeric columns in a database.

firebird.driver.types.DATETIME

This type object is used to describe date/time columns in a database.

firebird.driver.types.ROWID

This type object is used to describe the “Row ID” column in a database.

Constructors for data types

firebird.driver.types.Date = <class 'datetime.date'>

This callable constructs an object holding a date value.

firebird.driver.types.Time = <class 'datetime.time'>

This callable constructs an object holding a time value.

firebird.driver.types.Timestamp = <class 'datetime.datetime'>

This callable constructs an object holding a time stamp value.

firebird.driver.types.DateFromTicks(ticks: float) date[source]

Constructs an object holding a date value from the given ticks value (number of seconds since the epoch).

Parameters:

ticks (float) –

Return type:

date

firebird.driver.types.TimeFromTicks(ticks: float) time[source]

Constructs an object holding a time value from the given ticks value (number of seconds since the epoch).

Parameters:

ticks (float) –

Return type:

time

firebird.driver.types.TimestampFromTicks(ticks: float) datetime[source]

Constructs an object holding a time stamp value from the given ticks value (number of seconds since the epoch).

Parameters:

ticks (float) –

Return type:

datetime

firebird.driver.types.Binary = <class 'memoryview'>

This callable constructs an object capable of holding a binary (long) string value.

Types for type hints

firebird.driver.types.DESCRIPTION

DB API 2.0 Cursor DESCRIPTION

alias of Tuple[str, type, int, int, int, int, bool]

firebird.driver.types.CB_OUTPUT_LINE

Callback that accepts line of text output

alias of Callable[[str], None]

class firebird.driver.types.Transactional(*args, **kwargs)[source]

Bases: Protocol

Protocol type for object that supports transactional processing.

begin(tpb: bytes = None) None[source]

Begin transaction.

Parameters:

tpb (bytes) –

Return type:

None

commit(*, retaining: bool = False) None[source]

Commit transaction.

Parameters:

retaining (bool) –

Return type:

None

is_active() bool[source]

Returns True if transaction is active.

Return type:

bool

rollback(*, retaining: bool = False, savepoint: str = None) None[source]

Rollback transaction.

Parameters:
  • retaining (bool) –

  • savepoint (str) –

Return type:

None

Enums

class firebird.driver.types.NetProtocol(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Network protocol options available for connection.

INET = 2
INET4 = 3
WNET = 4
XNET = 1
class firebird.driver.types.DirectoryCode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

IConfigManager directory codes.

DIR_BIN = 0
DIR_CONF = 2
DIR_DOC = 5
DIR_GUARD = 15
DIR_HELP = 9
DIR_INC = 4
DIR_INTL = 10
DIR_LIB = 3
DIR_LOG = 14
DIR_MISC = 11
DIR_MSG = 13
DIR_PLUGINS = 16
DIR_SAMPLE = 7
DIR_SAMPLEDB = 8
DIR_SBIN = 1
DIR_SECDB = 12
DIR_TZDATA = 17
DIR_UDF = 6
class firebird.driver.types.XpbKind(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Xpb builder kinds.

BATCH = 5
BPB = 6
DPB = 1
SPB_ATTACH = 2
SPB_RECEIVE = 8
SPB_RESPONSE = 9
SPB_SEND = 7
SPB_START = 3
TPB = 4
class firebird.driver.types.StateResult(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

IState result codes.

ERROR = -1
NO_DATA = 1
OK = 0
SEGMENT = 2
class firebird.driver.types.PageSize(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Supported database page sizes.

PAGE_16K = 16384
PAGE_32K = 32768
PAGE_4K = 4096
PAGE_8K = 8192
class firebird.driver.types.DBKeyScope(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Scope of DBKey context.

ATTACHMENT = 1
TRANSACTION = 0
class firebird.driver.types.InfoItemType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Data type of information item.

BIGINT = 3
BYTE = 1
BYTES = 4
INTEGER = 2
RAW_BYTES = 5
STRING = 6
class firebird.driver.types.SrvInfoCode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Service information (isc_info_svc_*) codes.

AUTH_BLOCK = 69
CAPABILITIES = 57
GET_CONFIG = 53
GET_ENV = 59
GET_ENV_LOCK = 60
GET_ENV_MSG = 61
GET_USERS = 68
IMPLEMENTATION = 56
LIMBO_TRANS = 66
LINE = 62
RUNNING = 67
SERVER_VERSION = 55
SRV_DB_INFO = 50
STDIN = 78
TIMEOUT = 64
TO_EOF = 63
USER_DBPATH = 58
VERSION = 54
class firebird.driver.types.BlobInfoCode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

BLOB information (isc_info_blob_*) codes.

MAX_SEGMENT = 5
NUM_SEGMENTS = 4
TOTAL_LENGTH = 6
TYPE = 7
class firebird.driver.types.DbInfoCode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Database information (isc_info_*) codes.

ACTIVE_TRANSACTIONS = 109
ACTIVE_TRAN_COUNT = 110
ALLOCATION = 21
ATTACHMENT_ID = 22
ATT_CHARSET = 101
BACKOUT_COUNT = 28
BASE_LEVEL = 13
BPAGE_ERRORS = 56
BPAGE_WARNS = 117
CONN_FLAGS = 132
CREATION_DATE = 111
CREATION_TIMESTAMP_TZ = 139
CRYPT_KEY = 133
CRYPT_PLUGIN = 138
CRYPT_STATE = 134
CURRENT_MEMORY = 17
DB_CLASS = 102
DB_FILE_ID = 145
DB_FILE_SIZE = 112
DB_GUID = 144
DB_ID = 4
DB_PROVIDER = 108
DB_READ_ONLY = 63
DB_SIZE_IN_PAGES = 64
DB_SQL_DIALECT = 62
DELETE_COUNT = 27
DPAGE_ERRORS = 57
DPAGE_WARNS = 118
EXPUNGE_COUNT = 30
FEATURES = 141
FETCHES = 7
FIREBIRD_VERSION = 103
FORCED_WRITES = 52
IMPLEMENTATION = 114
IMPLEMENTATION_OLD = 11
INSERT_COUNT = 25
IPAGE_ERRORS = 58
IPAGE_WARNS = 119
LIMBO = 16
MARKS = 8
MAX_MEMORY = 18
NEXT_ATTACHMENT = 142
NEXT_STATEMENT = 143
NEXT_TRANSACTION = 107
NO_RESERVE = 34
NUM_BUFFERS = 15
ODS_MINOR_VERSION = 33
ODS_VERSION = 32
OLDEST_ACTIVE = 105
OLDEST_SNAPSHOT = 106
OLDEST_TRANSACTION = 104
PAGES_FREE = 125
PAGES_USED = 124
PAGE_CONTENTS = 113
PAGE_ERRORS = 54
PAGE_SIZE = 14
PAGE_WARNS = 115
PIP_ERRORS = 122
PIP_WARNS = 123
PPAGE_ERRORS = 59
PPAGE_WARNS = 120
PROTOCOL_VERSION = 137
PURGE_COUNT = 29
READS = 5
READ_IDX_COUNT = 24
READ_SEQ_COUNT = 23
RECORD_ERRORS = 55
RECORD_WARNS = 116
REPLICA_MODE = 146
SES_IDLE_TIMEOUT_ATT = 130
SES_IDLE_TIMEOUT_DB = 129
SES_IDLE_TIMEOUT_RUN = 131
SET_PAGE_BUFFERS = 61
SQL_ROLE = 148
STMT_TIMEOUT_ATT = 136
STMT_TIMEOUT_DB = 135
SWEEP_INTERVAL = 31
TPAGE_ERRORS = 60
TPAGE_WARNS = 121
UPDATE_COUNT = 26
USER_NAME = 147
USER_NAMES = 53
VERSION = 12
WIRE_CRYPT = 140
WRITES = 6
class firebird.driver.types.ResultSetInfoCode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Result set information codes.

RECORD_COUNT = 10
class firebird.driver.types.Features(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Firebird features (Response to DbInfoCode.FEATURES).

MULTI_STATEMENTS = 1
MULTI_TRANSACTIONS = 2
NAMED_PARAMETERS = 3
READ_CONSISTENCY = 5
SESSION_RESET = 4
STATEMENT_LONG_LIFE = 7
STATEMENT_TIMEOUT = 6
class firebird.driver.types.ReplicaMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Replica modes. Response to DbInfoCode.REPLICA_MODE or as value for DPBItem.SET_DB_REPLICA.

NONE = 0
READ_ONLY = 1
READ_WRITE = 2
class firebird.driver.types.StmtInfoCode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Statement information (isc_info_sql_*) codes.

ALIAS = 19
BATCH_FETCH = 24
BIND = 5
BLOB_ALIGN = 30
DESCRIBE_END = 8
DESCRIBE_VARS = 7
EXEC_PATH_BLR_BYTES = 31
EXEC_PATH_BLR_TEXT = 32
EXPLAIN_PLAN = 26
FIELD = 16
FLAGS = 27
GET_PLAN = 22
LENGTH = 14
MESSAGE_SEQ = 10
NULL_IND = 15
NUM_VARIABLES = 6
OWNER = 18
RECORDS = 23
RELATION = 17
RELATION_ALIAS = 25
SCALE = 13
SELECT = 4
SQLDA_SEQ = 9
SQLDA_START = 20
STMT_TYPE = 21
SUB_TYPE = 12
TIMEOUT_RUN = 29
TIMEOUT_USER = 28
TYPE = 11
class firebird.driver.types.TraInfoCode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Transaction information (isc_info_tra_*) codes.

ACCESS = 9
DBPATH = 11
ID = 4
ISOLATION = 8
LOCK_TIMEOUT = 10
OLDEST_ACTIVE = 7
OLDEST_INTERESTING = 5
OLDEST_SNAPSHOT = 6
SNAPSHOT_NUMBER = 12
class firebird.driver.types.TraInfoIsolation(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Transaction isolation response.

CONCURRENCY = 2
CONSISTENCY = 1
READ_COMMITTED = 3
class firebird.driver.types.TraInfoReadCommitted(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Transaction isolation Read Committed response.

NO_RECORD_VERSION = 0
READ_CONSISTENCY = 2
RECORD_VERSION = 1
class firebird.driver.types.TraInfoAccess(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Transaction isolation access mode response.

READ_ONLY = 0
READ_WRITE = 1
class firebird.driver.types.TraAccessMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Transaction Access Mode TPB parameters.

READ = 8
WRITE = 9
class firebird.driver.types.TraIsolation(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Transaction Isolation TPB paremeters.

CONCURRENCY = 2
CONSISTENCY = 1
READ_COMMITTED = 15
class firebird.driver.types.TraReadCommitted(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Read Committed Isolation TPB paremeters.

NO_RECORD_VERSION = 18
RECORD_VERSION = 17
class firebird.driver.types.Isolation(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Transaction Isolation TPB parameters.

CONCURRENCY = 2
CONSISTENCY = 1
READ_COMMITTED = -1
READ_COMMITTED_NO_RECORD_VERSION = 3
READ_COMMITTED_READ_CONSISTENCY = 5
READ_COMMITTED_RECORD_VERSION = 4
REPEATABLE_READ = 2
SERIALIZABLE = 1
SNAPSHOT = 2
class firebird.driver.types.TraLockResolution(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Transaction Lock resolution TPB parameters.

NO_WAIT = 7
WAIT = 6
class firebird.driver.types.TableShareMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Transaction table share mode TPB parameters.

EXCLUSIVE = 5
PROTECTED = 4
SHARED = 3
class firebird.driver.types.TableAccessMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Transaction Access Mode TPB parameters.

LOCK_READ = 10
LOCK_WRITE = 11
class firebird.driver.types.DefaultAction(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Default action when transaction is ended automatically.

COMMIT = 1
ROLLBACK = 2
class firebird.driver.types.StatementType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Statement type.

COMMIT = 10
DDL = 5
DELETE = 4
EXEC_PROCEDURE = 8
GET_SEGMENT = 6
INSERT = 2
PUT_SEGMENT = 7
ROLLBACK = 11
SAVEPOINT = 14
SELECT = 1
SELECT_FOR_UPD = 12
SET_GENERATOR = 13
START_TRANS = 9
UPDATE = 3
class firebird.driver.types.SQLDataType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

SQL data type.

ARRAY = 540
BLOB = 520
BOOLEAN = 32764
DATE = 570
DEC16 = 32760
DEC34 = 32762
DOUBLE = 480
D_FLOAT = 530
FLOAT = 482
INT128 = 32752
INT64 = 580
LONG = 496
NULL = 32766
QUAD = 550
SHORT = 500
TEXT = 452
TIME = 560
TIMESTAMP = 510
TIMESTAMP_TZ = 32754
TIMESTAMP_TZ_EX = 32748
TIME_TZ = 32756
TIME_TZ_EX = 32750
VARYING = 448
class firebird.driver.types.DPBItem(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

isc_dpb_* items (VERSION2).

ADDRESS_PATH = 70
AUTH_BLOCK = 79
AUTH_PLUGIN_LIST = 85
AUTH_PLUGIN_NAME = 86
CLEAR_MAP = 96
CLIENT_VERSION = 80
CONFIG = 87
CONNECT_TIMEOUT = 57
DBKEY_SCOPE = 13
DECFLOAT_ROUND = 94
DECFLOAT_TRAPS = 95
DUMMY_PACKET_INTERVAL = 58
EXT_CALL_DEPTH = 78
FORCE_WRITE = 24
HOST_NAME = 82
LC_CTYPE = 48
MAP_ATTACH = 90
NOLINGER = 88
NO_DB_TRIGGERS = 72
NO_GARBAGE_COLLECT = 16
NO_RESERVE = 27
NUM_BUFFERS = 5
ORG_FILENAME = 76
OS_USER = 83
OVERWRITE = 54
PAGE_SIZE = 4
PARALLEL_WORKERS = 100
PASSWORD = 29
PROCESS_ID = 71
PROCESS_NAME = 74
REMOTE_PROTOCOL = 81
RESERVED = 53
RESET_ICU = 89
SESSION_TIME_ZONE = 91
SET_BIND = 93
SET_DB_CHARSET = 68
SET_DB_READONLY = 64
SET_DB_REPLICA = 92
SET_DB_SQL_DIALECT = 65
SET_PAGE_BUFFERS = 61
SPECIFIC_AUTH_DATA = 84
SQL_DIALECT = 63
SQL_ROLE_NAME = 60
SWEEP_INTERVAL = 22
TRUSTED_AUTH = 73
TRUSTED_ROLE = 75
UPGRADE_DB = 97
USER_NAME = 28
UTF8_FILENAME = 77
WORKER_ATTACH = 101
WORKING_DIRECTORY = 62
class firebird.driver.types.TPBItem(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

isc_tpb_* items.

AT_SNAPSHOT_NUMBER = 23
AUTOCOMMIT = 16
IGNORE_LIMBO = 14
LOCK_TIMEOUT = 21
NO_AUTO_UNDO = 20
READ_CONSISTENCY = 22
VERSION3 = 3
class firebird.driver.types.SPBItem(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

isc_spb_* items.

AUTH_BLOCK = 115
AUTH_PLUGIN_LIST = 117
AUTH_PLUGIN_NAME = 116
COMMAND_LINE = 105
CONFIG = 123
CONNECT_TIMEOUT = 57
DBNAME = 106
DUMMY_PACKET_INTERVAL = 58
EXPECTED_DB = 124
OPTIONS = 108
PASSWORD = 29
SQL_ROLE_NAME = 60
TRUSTED_AUTH = 111
TRUSTED_ROLE = 113
USER_NAME = 28
UTF8_FILENAME = 118
VERBINT = 114
VERBOSE = 107
class firebird.driver.types.BPBItem(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

isc_bpb_* items.

FILTER_PARAMETER = 6
SOURCE_INTERP = 4
SOURCE_TYPE = 1
STORAGE = 7
TARGET_INTERP = 5
TARGET_TYPE = 2
TYPE = 3
class firebird.driver.types.BlobType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Blob type.

SEGMENTED = 0
STREAM = 1
class firebird.driver.types.BlobStorage(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Blob storage.

MAIN = 0
TEMP = 2
class firebird.driver.types.ServerAction(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

isc_action_svc_* items.

ADD_USER = 4
BACKUP = 1
DB_STATS = 11
DELETE_USER = 5
DISPLAY_USER = 7
DISPLAY_USER_ADM = 29
DROP_MAPPING = 28
GET_FB_LOG = 12
MODIFY_USER = 6
NBAK = 20
NFIX = 31
NREST = 21
PROPERTIES = 8
REPAIR = 3
RESTORE = 2
SET_MAPPING = 27
TRACE_LIST = 26
TRACE_RESUME = 25
TRACE_START = 22
TRACE_STOP = 23
TRACE_SUSPEND = 24
VALIDATE = 30
class firebird.driver.types.SrvDbInfoOption(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Parameters for SvcInfoCode.SRV_DB_INFO.

ATT = 5
DB = 6
class firebird.driver.types.SrvRepairOption(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Parameters for ServerAction.REPAIR.

COMMIT_TRANS = 15
COMMIT_TRANS_64 = 49
MULTI_TRA_ID = 20
MULTI_TRA_ID_64 = 48
PARALLEL_WORKERS = 52
RECOVER_TWO_PHASE = 17
RECOVER_TWO_PHASE_64 = 51
ROLLBACK_TRANS = 34
ROLLBACK_TRANS_64 = 50
SINGLE_TRA_ID = 19
SINGLE_TRA_ID_64 = 47
TRA_ADVISE = 29
TRA_ADVISE_COMMIT = 30
TRA_ADVISE_ROLLBACK = 31
TRA_ADVISE_UNKNOWN = 33
TRA_DB_PATH = 28
TRA_HOST_SITE = 26
TRA_ID = 18
TRA_ID_64 = 46
TRA_REMOTE_SITE = 27
TRA_STATE = 21
TRA_STATE_COMMIT = 23
TRA_STATE_LIMBO = 22
TRA_STATE_ROLLBACK = 24
TRA_STATE_UNKNOWN = 25
class firebird.driver.types.SrvBackupOption(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Parameters for ServerAction.BACKUP.

CRYPT = 18
FACTOR = 6
FILE = 5
INCLUDE_DATA = 19
KEYHOLDER = 16
KEYNAME = 17
LENGTH = 7
PARALLEL_WORKERS = 21
SKIP_DATA = 8
STAT = 15
class firebird.driver.types.SrvRestoreOption(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Parameters for ServerAction.RESTORE.

ACCESS_MODE = 12
BUFFERS = 9
CRYPT = 18
FILE = 5
FIX_FSS_DATA = 13
FIX_FSS_METADATA = 14
INCLUDE_DATA = 19
KEYHOLDER = 16
KEYNAME = 17
LENGTH = 11
PAGE_SIZE = 10
PARALLEL_WORKERS = 21
REPLICA_MODE = 20
SKIP_DATA = 8
STAT = 15
class firebird.driver.types.SrvNBackupOption(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Parameters for ServerAction.NBAK.

CLEAN_HISTORY = 9
DIRECT = 7
FILE = 6
GUID = 8
KEEP_DAYS = 10
KEEP_ROWS = 11
LEVEL = 5
class firebird.driver.types.SrvTraceOption(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Parameters for ServerAction.TRACE_*.

CONFIG = 3
ID = 1
NAME = 2
class firebird.driver.types.SrvPropertiesOption(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Parameters for ServerAction.PROPERTIES.

ACCESS_MODE = 13
ATTACHMENTS_SHUTDOWN = 42
DENY_NEW_ATTACHMENTS = 9
DENY_NEW_TRANSACTIONS = 10
FORCE_SHUTDOWN = 41
ONLINE_MODE = 45
PAGE_BUFFERS = 5
REPLICA_MODE = 46
RESERVE_SPACE = 11
SET_SQL_DIALECT = 14
SHUTDOWN_DB = 7
SHUTDOWN_MODE = 44
SWEEP_INTERVAL = 6
TRANSACTIONS_SHUTDOWN = 43
WRITE_MODE = 12
class firebird.driver.types.SrvValidateOption(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Parameters for ServerAction.VALIDATE.

EXCLUDE_INDEX = 4
EXCLUDE_TABLE = 2
INCLUDE_INDEX = 3
INCLUDE_TABLE = 1
LOCK_TIMEOUT = 5
class firebird.driver.types.SrvUserOption(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Parameters for ServerAction.ADD_USER|DELETE_USER|MODIFY_USER|DISPLAY_USER.

ADMIN = 13
FIRST_NAME = 10
GROUP_ID = 6
GROUP_NAME = 9
LAST_NAME = 12
MIDDLE_NAME = 11
PASSWORD = 8
USER_ID = 5
USER_NAME = 7
class firebird.driver.types.DbAccessMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Values for isc_spb_prp_access_mode.

READ_ONLY = 39
READ_WRITE = 40
class firebird.driver.types.DbSpaceReservation(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Values for isc_spb_prp_reserve_space.

RESERVE = 36
USE_FULL = 35
class firebird.driver.types.DbWriteMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Values for isc_spb_prp_write_mode.

ASYNC = 37
SYNC = 38
class firebird.driver.types.ShutdownMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Values for isc_spb_prp_shutdown_mode.

FULL = 3
MULTI = 1
NORMAL = 0
SINGLE = 2
class firebird.driver.types.OnlineMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Values for isc_spb_prp_online_mode.

MULTI = 1
NORMAL = 0
SINGLE = 2
class firebird.driver.types.ShutdownMethod(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Database shutdown method options.

DENY_ATTACHMENTS = 42
DENY_TRANSACTIONS = 43
FORCED = 41
class firebird.driver.types.TransactionState(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Transaction state.

COMMIT = 1
LIMBO = 3
ROLLBACK = 2
UNKNOWN = 0
class firebird.driver.types.DbProvider(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Database Providers.

FIREBIRD = 4
INTERBASE = 3
RDB_ELN = 1
RDB_VMS = 2
class firebird.driver.types.DbClass(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Database Classes.

ACCESS = 1
CACHE = 12
CLASSIC_ACCESS = 13
GATEWAY = 11
PIPE_INT = 7
PIPE_SRVR = 8
REM_INT = 3
REM_SRVR = 4
SAM_INT = 9
SAM_SRVR = 10
SERVER_ACCESS = 14
UNKNOWN = 0
Y_VALVE = 2
class firebird.driver.types.Implementation(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Implementation - Legacy format.

ALPHA_OSF = 52
ALPHA_VMS = 53
DARWIN_PPC = 63
DARWIN_PPC64 = 77
DARWIN_X64 = 73
DARWIN_X86 = 70
DG_X86 = 58
FREEBSD = 61
FREEBSD_AMD64 = 67
FREEBSD_PPC = 92
FREEBSD_PPC64 = 91
FREEBSD_PPC64EL = 89
I386 = 60
ISC_APL_68K = 25
ISC_CRAY = 43
ISC_DELTA = 45
ISC_DG = 38
ISC_DOS = 47
ISC_EPSON = 51
ISC_HP_MPEXL = 39
ISC_HP_UX = 31
ISC_HP_UX68K = 40
ISC_IMP = 44
ISC_MAC_AUX = 34
ISC_MIPS_ULT = 36
ISC_NEXT = 46
ISC_OS2 = 29
ISC_RT_AIX = 35
ISC_SCO_UNIX = 42
ISC_SGI = 41
ISC_SUN4 = 30
ISC_SUN_386I = 32
ISC_SUN_68K = 28
ISC_VAX_ULTR = 26
ISC_VMS = 27
ISC_VMS_ORCL = 33
ISC_WINNT_X86 = 50
ISC_XENIX = 37
JRI = 6
JSV = 7
LINUX_ALPHA = 83
LINUX_AMD64 = 66
LINUX_ARM = 75
LINUX_ARM64 = 84
LINUX_HPPA = 82
LINUX_IA64 = 76
LINUX_M68K = 87
LINUX_MIPS = 72
LINUX_MIPS64EL = 90
LINUX_MIPSEL = 71
LINUX_PPC = 69
LINUX_PPC64 = 86
LINUX_PPC64EL = 85
LINUX_RISCV64 = 88
LINUX_S390 = 79
LINUX_S390X = 78
LINUX_SH = 80
LINUX_SHEB = 81
LINUX_SPARC = 65
M88K = 48
NCR_3000 = 56
NETBSD = 62
NETWARE_386 = 54
RDB_ELN = 2
RDB_ELN_DEV = 3
RDB_ELN_Y = 5
RDB_VMS = 1
RDB_VMS_Y = 4
SCO_EV = 59
SINIXZ = 64
SUN_AMD64 = 74
UNIXWARE = 49
WINNT_AMD64 = 68
WINNT_PPC = 57
WIN_ONLY = 55
class firebird.driver.types.ImpCPU(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Implementation - CPU.

ALPHA = 14
AMD_INTEL_X64 = 1
ARM = 7
ARM64 = 15
HPPA = 13
IA64 = 8
INTEL386 = 0
M68K = 17
MIPS = 6
MIPSEL = 5
POWER_PC = 3
POWER_PC64 = 4
POWER_PC64EL = 16
S390 = 9
S390X = 10
SH = 11
SHEB = 12
ULTRA_SPARC = 2
class firebird.driver.types.ImpOS(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Implementation - CPU.

AIX = 5
DARWIN = 2
FREE_BSD = 7
HPUX = 4
LINUX = 1
MMS = 6
NET_BSD = 8
SOLARIS = 3
WINDOWS = 0
class firebird.driver.types.ImpCompiler(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Implementation - Compiler.

ACC = 3
GCC = 1
ICC = 5
MSVC = 0
SUN_STUDIO = 4
XLC = 2
class firebird.driver.types.CancelType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Cancel types for Connection.cancel_operation()

ABORT = 4
DISABLE = 1
ENABLE = 2
RAISE = 3
class firebird.driver.types.DecfloatRound(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

DECFLOAT ROUND options.

CEILING = 'CEILING'
DOWN = 'DOWN'
FLOOR = 'FLOOR'
HALF_DOWN = 'HALF_DOWN'
HALF_EVEN = 'HALF_EVEN'
HALF_UP = 'HALF_UP'
REROUND = 'REROUND'
UP = 'UP'
class firebird.driver.types.DecfloatTraps(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

DECFLOAT TRAPS options.

DIVISION_BY_ZERO = 'Division_by_zero'
INEXACT = 'Inexact'
INVALID_OPERATION = 'Invalid_operation'
OVERFLOW = 'Overflow'
UNDERFLOW = 'Underflow'

Flags

class firebird.driver.types.StateFlag(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntFlag

IState flags.

ERRORS = 2
NONE = 0
WARNINGS = 1
class firebird.driver.types.PreparePrefetchFlag(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntFlag

Flags for Statement Prefetch.

AFFECTED_RECORDS = 32
ALL = 127
DETAILED_PLAN = 16
FLAGS = 64
INPUT_PARAMETERS = 2
LEGACY_PLAN = 8
METADATA = 71
NONE = 0
OUTPUT_PARAMETERS = 4
TYPE = 1
class firebird.driver.types.StatementFlag(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntFlag

Statement flags.

HAS_CURSOR = 1
NONE = 0
REPEAT_EXECUTE = 2
class firebird.driver.types.CursorFlag(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntFlag

Cursor flags.

NONE = 0
SCROLLABLE = 1
class firebird.driver.types.ConnectionFlag(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntFlag

Flags returned for DbInfoCode.CONN_FLAGS.

COMPRESSED = 1
ENCRYPTED = 2
NONE = 0
class firebird.driver.types.EncryptionFlag(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntFlag

Crypto status (Response to DbInfoCode.CRYPT_STATE).

ENCRYPTED = 1
PROCESS = 2
class firebird.driver.types.ServerCapability(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntFlag

Server capabilities (returned by isc_info_svc_capabilities).

LOCAL_ENGINE = 32
MULTI_CLIENT = 2
NONE = 0
NO_DB_STATS = 16
NO_FORCED_WRITE = 64
NO_SERVER_SHUTDOWN = 256
NO_SHUTDOWN = 128
NO_SRV_STATS = 8
QUOTED_FILENAME = 1024
REMOTE_HOP = 4
SERVER_CONFIG = 512
WAL = 1
class firebird.driver.types.SrvRepairFlag(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntFlag

isc_spb_rpr_* flags for ServerAction.REPAIR.

CHECK_DB = 16
CORRUPTION_CHECK = 177
FULL = 128
ICU = 2048
IGNORE_CHECKSUM = 32
KILL_SHADOWS = 64
LIST_LIMBO_TRANS = 8
MEND_DB = 4
REPAIR = 164
SWEEP_DB = 2
UPGRADE_DB = 4096
VALIDATE_DB = 1
class firebird.driver.types.SrvStatFlag(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntFlag

isc_spb_sts_* flags for ServerAction.DB_STATS.

DATA_PAGES = 1
DB_LOG = 2
DEFAULT = 9
ENCRYPTION = 256
HDR_PAGES = 4
IDX_PAGES = 8
NOCREATION = 128
NONE = 0
RECORD_VERSIONS = 32
SYS_RELATIONS = 16
class firebird.driver.types.SrvBackupFlag(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntFlag

isc_spb_bkp_* flags for ServerAction.BACKUP.

CONVERT = 64
DIRECT_IO = 131072
EXPAND = 128
IGNORE_CHECKSUMS = 1
IGNORE_LIMBO = 2
METADATA_ONLY = 4
NONE = 0
NON_TRANSPORTABLE = 32
NO_GARBAGE_COLLECT = 8
NO_TRIGGERS = 32768
OLD_DESCRIPTIONS = 16
ZIP = 65536
class firebird.driver.types.SrvRestoreFlag(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntFlag

isc_spb_res_* flags for ServerAction.RESTORE.

CREATE = 8192
DEACTIVATE_IDX = 256
DIRECT_IO = 131072
METADATA_ONLY = 4
NO_SHADOW = 512
NO_TRIGGERS = 32768
NO_VALIDITY = 1024
ONE_AT_A_TIME = 2048
REPLACE = 4096
USE_ALL_SPACE = 16384
class firebird.driver.types.SrvNBackupFlag(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntFlag

isc_spb_nbk_* flags for ServerAction.NBAK.

IN_PLACE = 2
NONE = 0
NO_TRIGGERS = 1
SEQUENCE = 4
class firebird.driver.types.SrvPropertiesFlag(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntFlag

isc_spb_prp_* flags for ServerAction.PROPERTIES.

ACTIVATE = 256
DB_ONLINE = 512
NOLINGER = 1024
class firebird.driver.types.ImpFlags(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntFlag

Implementation - Endianness.

BIG_ENDIAN = 1
LITTLE_ENDIAN = 0

Dataclasses

class firebird.driver.types.ItemMetadata(field: str, relation: str, owner: str, alias: str, datatype: SQLDataType, nullable: bool, subtype: int, length: int, scale: int, charset: int, offset: int, null_offset: int)[source]

Bases: object

Information for single item from iMessageMetadata.

This dataclass is used internally, and it’s not intended for general use.

Parameters:
field

Field name

Type:

str

relation

Relation name

Type:

str

owner

Owner name

Type:

str

alias

Field alias

Type:

str

datatype

Data type

Type:

SQLDataType

nullable

Whether NULLs are allowed

Type:

bool

subtype

Data sub-type

Type:

int

length

Size of raw field data in message buffer

Type:

int

scale

Field scale

Type:

int

charset

Character set

Type:

int

offset

Offset of raw field data in message buffer

Type:

int

null_offset

Offset of null flag in message buffer

Type:

int

class firebird.driver.types.TableAccessStats(table_id: int, sequential: int = None, indexed: int = None, inserts: int = None, updates: int = None, deletes: int = None, backouts: int = None, purges: int = None, expunges: int = None)[source]

Bases: object

Table access statistics.

Data structure returned by Connection.get_table_access_stats().

Parameters:
  • table_id (int) –

  • sequential (int) –

  • indexed (int) –

  • inserts (int) –

  • updates (int) –

  • deletes (int) –

  • backouts (int) –

  • purges (int) –

  • expunges (int) –

table_id

Relation ID

Type:

int

sequential

Number of sequential table scans (row reads)

Type:

int

indexed

Number of reads done via an index

Type:

int

inserts

Number of inserts

Type:

int

updates

Number of updates

Type:

int

deletes

Number of deleted

Type:

int

backouts

Number of removals of a version of a record

Type:

int

purges

Number of removals of old versions of fully mature records (records that are committed, so that older ancestor versions are no longer needed)

Type:

int

expunges

Number of removals of a record and all of its ancestors, for records whose deletions have been committed

Type:

int

class firebird.driver.types.UserInfo(user_name: str, password: str = None, first_name: str = None, middle_name: str = None, last_name: str = None, user_id: int = None, group_id: int = None, group_name: str = None, admin: bool = None)[source]

Bases: object

Information about Firebird user.

Data structure returned by Service.get_user() and Service.get_users().

Parameters:
  • user_name (str) –

  • password (str) –

  • first_name (str) –

  • middle_name (str) –

  • last_name (str) –

  • user_id (int) –

  • group_id (int) –

  • group_name (str) –

  • admin (bool) –

user_name

User (login) name

Type:

str

password

User password

Type:

str

first_name

First name

Type:

str

middle_name

Middle name

Type:

str

last_name

Last name

Type:

str

user_id

User ID

Type:

int

group_id

User Group ID

Type:

int

group_name

Group name

Type:

str

admin

True is user has admin priviledges

Type:

bool

class firebird.driver.types.BCD(sign: int, number: bytes, exp: int)[source]

Bases: object

BCD number.

Parameters:
sign

Sign

Type:

int

number

Number

Type:

bytes

exp

Exponent

Type:

int

class firebird.driver.types.TraceSession(id: int, user: str, timestamp: ~datetime.datetime, name: str = '', flags: ~typing.List = <factory>)[source]

Bases: object

Information about active trace session.

Parameters:
id

Session ID number

Type:

int

user

User name

Type:

str

timestamp

Session start timestamp

Type:

datetime.datetime

name

Session name (if defined)

Type:

str

flags

List with session flag names

Type:

list

Helper functions

firebird.driver.types.get_timezone(timezone: str = None) tzinfo[source]

Returns datetime.tzinfo for specified time zone.

This is preferred method to obtain timezone information for construction of timezone-aware datetime.datetime and datetime.time objects. Current implementation uses dateutil.tz for timezone tzinfo objects, but adds metadata neccessary to store timezone regions into database instead zoned time, and to handle offset-based timezones in format required by Firebird.

Parameters:

timezone (str) – Timezone region specification or UTC offset.

Return type:

tzinfo