firebird.lib.trace¶
Enums¶
- class firebird.lib.trace.Status(value)[source]¶
Bases:
Enum
Trace event status codes.
- FAILED = 'F'¶
- OK = ' '¶
- UNAUTHORIZED = 'U'¶
- UNKNOWN = '?'¶
- class firebird.lib.trace.Event(value)[source]¶
Bases:
IntEnum
Trace event codes.
- ATTACH_DATABASE = 7¶
- ATTACH_SERVICE = 26¶
- CLOSE_CURSOR = 18¶
- COMMIT_RETAINING = 12¶
- COMMIT_TRANSACTION = 10¶
- COMPILE_BLR = 36¶
- CREATE_DATABASE = 5¶
- DETACH_DATABASE = 8¶
- DETACH_SERVICE = 27¶
- DROP_DATABASE = 6¶
- ERROR = 30¶
- EXECUTE_BLR = 37¶
- EXECUTE_DYN = 38¶
- EXECUTE_FUNCTION_FINISH = 22¶
- EXECUTE_FUNCTION_START = 21¶
- EXECUTE_PROCEDURE_FINISH = 24¶
- EXECUTE_PROCEDURE_START = 23¶
- EXECUTE_STATEMENT_FINISH = 16¶
- EXECUTE_STATEMENT_START = 15¶
- EXECUTE_TRIGGER_FINISH = 20¶
- EXECUTE_TRIGGER_START = 19¶
- FREE_STATEMENT = 17¶
- PREPARE_STATEMENT = 14¶
- QUERY_SERVICE = 28¶
- ROLLBACK_RETAINING = 13¶
- ROLLBACK_TRANSACTION = 11¶
- SET_CONTEXT = 29¶
- START_SERVICE = 25¶
- START_TRANSACTION = 9¶
- SWEEP_FAILED = 35¶
- SWEEP_FINISH = 34¶
- SWEEP_PROGRESS = 33¶
- SWEEP_START = 32¶
- TRACE_FINI = 4¶
- TRACE_INIT = 2¶
- TRACE_SUSPENDED = 3¶
- UNKNOWN = 1¶
- WARNING = 31¶
Dataclasses¶
- class firebird.lib.trace.AttachmentInfo(attachment_id: int, database: str, charset: str, protocol: str, address: str, user: str, role: str, remote_process: str, remote_pid: int)[source]¶
Bases:
TraceInfo
Information about database attachment.
- Parameters:
- class firebird.lib.trace.TransactionInfo(attachment_id: int, transaction_id: int, initial_id: int, options: List[str])[source]¶
Bases:
TraceInfo
Information about transaction.
- class firebird.lib.trace.ServiceInfo(service_id: int, user: str, protocol: str, address: str, remote_process: str, remote_pid: int)[source]¶
Bases:
TraceInfo
Information about service attachment.
- Parameters:
- class firebird.lib.trace.SQLInfo(sql_id: int, sql: str, plan: str)[source]¶
Bases:
TraceInfo
Information about SQL statement.
- class firebird.lib.trace.ParamSet(par_id: int, params: List[Tuple[str, Any]])[source]¶
Bases:
TraceInfo
Information about set of parameters.
- class firebird.lib.trace.AccessStats(table: str, natural: int, index: int, update: int, insert: int, delete: int, backout: int, purge: int, expunge: int)[source]¶
Bases:
TraceInfo
Table access statistics.
- Parameters:
- backout: int¶
Number of rows where a new primary record version or a change to an existing primary record version is backed out due to rollback or savepoint undo
- expunge: int¶
Number of rows where record version chain is being deleted due to deletions by transactions older than OAT
- class firebird.lib.trace.EventTraceInit(event_id: int, timestamp: datetime, session_name: str)[source]¶
Bases:
TraceEvent
Trace session initialized trace event
- class firebird.lib.trace.EventTraceSuspend(event_id: int, timestamp: datetime, session_name: str)[source]¶
Bases:
TraceEvent
Trace session suspended trace event
- class firebird.lib.trace.EventTraceFinish(event_id: int, timestamp: datetime, session_name: str)[source]¶
Bases:
TraceEvent
Trace session finished trace event
- class firebird.lib.trace.EventCreate(event_id: int, timestamp: datetime, status: Status, attachment_id: int, database: str, charset: str, protocol: str, address: str, user: str, role: str, remote_process: str, remote_pid: int)[source]¶
Bases:
TraceEvent
Create database trace event
- Parameters:
- class firebird.lib.trace.EventDrop(event_id: int, timestamp: datetime, status: Status, attachment_id: int, database: str, charset: str, protocol: str, address: str, user: str, role: str, remote_process: str, remote_pid: int)[source]¶
Bases:
TraceEvent
Drop database trace event
- Parameters:
- class firebird.lib.trace.EventAttach(event_id: int, timestamp: datetime, status: Status, attachment_id: int, database: str, charset: str, protocol: str, address: str, user: str, role: str, remote_process: str, remote_pid: int)[source]¶
Bases:
TraceEvent
Database attach trace event
- Parameters:
- class firebird.lib.trace.EventDetach(event_id: int, timestamp: datetime, status: Status, attachment_id: int, database: str, charset: str, protocol: str, address: str, user: str, role: str, remote_process: str, remote_pid: int)[source]¶
Bases:
TraceEvent
Database detach trace event
- Parameters:
- class firebird.lib.trace.EventTransactionStart(event_id: int, timestamp: datetime, status: Status, attachment_id: int, transaction_id: int, options: List[str])[source]¶
Bases:
TraceEvent
Transaction start trace event
- Parameters:
- class firebird.lib.trace.EventCommit(event_id: int, timestamp: datetime, status: Status, attachment_id: int, transaction_id: int, options: List[str], run_time: int, reads: int, writes: int, fetches: int, marks: int)[source]¶
Bases:
TraceEvent
Commit trace event
- Parameters:
- class firebird.lib.trace.EventRollback(event_id: int, timestamp: datetime, status: Status, attachment_id: int, transaction_id: int, options: List[str], run_time: int, reads: int, writes: int, fetches: int, marks: int)[source]¶
Bases:
TraceEvent
Rollback trace event
- Parameters:
- class firebird.lib.trace.EventCommitRetaining(event_id: int, timestamp: datetime, status: Status, attachment_id: int, transaction_id: int, options: List[str], new_transaction_id: int, run_time: int, reads: int, writes: int, fetches: int, marks: int)[source]¶
Bases:
TraceEvent
Commit retaining trace event
- Parameters:
- class firebird.lib.trace.EventRollbackRetaining(event_id: int, timestamp: datetime, status: Status, attachment_id: int, transaction_id: int, options: List[str], new_transaction_id: int, run_time: int, reads: int, writes: int, fetches: int, marks: int)[source]¶
Bases:
TraceEvent
Rollback retaining trace event
- Parameters:
- class firebird.lib.trace.EventPrepareStatement(event_id: int, timestamp: datetime, status: Status, attachment_id: int, transaction_id: int, statement_id: int, sql_id: int, prepare_time: int)[source]¶
Bases:
TraceEvent
Prepare statement trace event
- Parameters:
- class firebird.lib.trace.EventStatementStart(event_id: int, timestamp: datetime, status: Status, attachment_id: int, transaction_id: int, statement_id: int, sql_id: int, param_id: int)[source]¶
Bases:
TraceEvent
Statement start trace event
- Parameters:
- class firebird.lib.trace.EventStatementFinish(event_id: int, timestamp: datetime, status: Status, attachment_id: int, transaction_id: int, statement_id: int, sql_id: int, param_id: int, records: int, run_time: int, reads: int, writes: int, fetches: int, marks: int, access: List[AccessStats])[source]¶
Bases:
TraceEvent
Statement finish trace event
- Parameters:
- access: List[AccessStats]¶
List with table access statistics
- class firebird.lib.trace.EventFreeStatement(event_id: int, timestamp: datetime, attachment_id: int, statement_id: int, sql_id: int)[source]¶
Bases:
TraceEvent
Free statement trace event
- Parameters:
- class firebird.lib.trace.EventCloseCursor(event_id: int, timestamp: datetime, attachment_id: int, statement_id: int, sql_id: int)[source]¶
Bases:
TraceEvent
Close cursor trace event
- Parameters:
- class firebird.lib.trace.EventTriggerStart(event_id: int, timestamp: datetime, status: Status, attachment_id: int, transaction_id: int, trigger: str, table: str, event: str)[source]¶
Bases:
TraceEvent
Trigger start trace event
- Parameters:
- class firebird.lib.trace.EventTriggerFinish(event_id: int, timestamp: datetime, status: Status, attachment_id: int, transaction_id: int, trigger: str, table: str, event: str, run_time: int, reads: int, writes: int, fetches: int, marks: int, access: List[AccessStats])[source]¶
Bases:
TraceEvent
Trigger finish trace event
- Parameters:
- access: List[AccessStats]¶
List with table access statistics
- class firebird.lib.trace.EventProcedureStart(event_id: int, timestamp: datetime, status: Status, attachment_id: int, transaction_id: int, procedure: str, param_id: int)[source]¶
Bases:
TraceEvent
Procedure start trace event
- Parameters:
- class firebird.lib.trace.EventProcedureFinish(event_id: int, timestamp: datetime, status: Status, attachment_id: int, transaction_id: int, procedure: str, param_id: int, records: int, run_time: int, reads: int, writes: int, fetches: int, marks: int, access: List[AccessStats])[source]¶
Bases:
TraceEvent
Procedure finish trace event
- Parameters:
- access: List[AccessStats]¶
List with table access statistics
- class firebird.lib.trace.EventFunctionStart(event_id: int, timestamp: datetime, status: Status, attachment_id: int, transaction_id: int, function: str, param_id: int)[source]¶
Bases:
TraceEvent
Function start trace event
- Parameters:
- class firebird.lib.trace.EventFunctionFinish(event_id: int, timestamp: datetime, status: Status, attachment_id: int, transaction_id: int, function: str, param_id: int, returns: Tuple[str, Any], run_time: int, reads: int, writes: int, fetches: int, marks: int, access: List[AccessStats])[source]¶
Bases:
TraceEvent
Function finish trace event
- Parameters:
- access: List[AccessStats]¶
List with table access statistics
- class firebird.lib.trace.EventServiceAttach(event_id: int, timestamp: datetime, status: Status, service_id: int)[source]¶
Bases:
TraceEvent
Service attach trace event
- class firebird.lib.trace.EventServiceDetach(event_id: int, timestamp: datetime, status: Status, service_id: int)[source]¶
Bases:
TraceEvent
Service detach trace event
- class firebird.lib.trace.EventServiceStart(event_id: int, timestamp: datetime, status: Status, service_id: int, action: str, parameters: List[str])[source]¶
Bases:
TraceEvent
Service start trace event
- Parameters:
- class firebird.lib.trace.EventServiceQuery(event_id: int, timestamp: datetime, status: Status, service_id: int, action: str, sent: List[str], received: List[str])[source]¶
Bases:
TraceEvent
Service query trace event
- Parameters:
- class firebird.lib.trace.EventSetContext(event_id: int, timestamp: datetime, attachment_id: int, transaction_id: int, context: str, key: str, value: str)[source]¶
Bases:
TraceEvent
Set context variable trace event
- Parameters:
- class firebird.lib.trace.EventError(event_id: int, timestamp: datetime, attachment_id: int, place: str, details: List[str])[source]¶
Bases:
TraceEvent
Error trace event
- Parameters:
- class firebird.lib.trace.EventWarning(event_id: int, timestamp: datetime, attachment_id: int, place: str, details: List[str])[source]¶
Bases:
TraceEvent
Warning trace event
- Parameters:
- class firebird.lib.trace.EventServiceError(event_id: int, timestamp: datetime, service_id: int, place: str, details: List[str])[source]¶
Bases:
TraceEvent
Service error trace event
- Parameters:
- class firebird.lib.trace.EventServiceWarning(event_id: int, timestamp: datetime, service_id: int, place: str, details: List[str])[source]¶
Bases:
TraceEvent
Service warning trace event
- Parameters:
- class firebird.lib.trace.EventSweepStart(event_id: int, timestamp: datetime, attachment_id: int, oit: int, oat: int, ost: int, next: int)[source]¶
Bases:
TraceEvent
Sweep start trace event
- Parameters:
- class firebird.lib.trace.EventSweepProgress(event_id: int, timestamp: datetime, attachment_id: int, run_time: int, reads: int, writes: int, fetches: int, marks: int, access: List[AccessStats])[source]¶
Bases:
TraceEvent
Sweep progress trace event
- Parameters:
- access: List[AccessStats]¶
List with table access statistics
- class firebird.lib.trace.EventSweepFinish(event_id: int, timestamp: datetime, attachment_id: int, oit: int, oat: int, ost: int, next: int, run_time: int, reads: int, writes: int, fetches: int, marks: int, access: List[AccessStats])[source]¶
Bases:
TraceEvent
Sweep finished trace event
- Parameters:
- access: List[AccessStats]¶
List with table access statistics
- class firebird.lib.trace.EventSweepFailed(event_id: int, timestamp: datetime, attachment_id: int)[source]¶
Bases:
TraceEvent
Sweep failed trace event
- class firebird.lib.trace.EventBLRCompile(event_id: int, timestamp: datetime, status: Status, attachment_id: int, statement_id: int, content: str, prepare_time: int)[source]¶
Bases:
TraceEvent
BLR compile trace event
- Parameters:
- class firebird.lib.trace.EventBLRExecute(event_id: int, timestamp: datetime, status: Status, attachment_id: int, transaction_id: int, statement_id: int, content: str, run_time: int, reads: int, writes: int, fetches: int, marks: int, access: List[AccessStats])[source]¶
Bases:
TraceEvent
BLR execution trace event
- Parameters:
- access: List[AccessStats]¶
List with table access statistics
- class firebird.lib.trace.EventDYNExecute(event_id: int, timestamp: datetime, status: Status, attachment_id: int, transaction_id: int, content: str, run_time: int)[source]¶
Bases:
TraceEvent
DYN execution trace event
- Parameters:
Classes¶
- class firebird.lib.trace.TraceParser[source]¶
Bases:
object
Parser for standard textual trace log. Produces dataclasses describing individual trace log entries/events.
- parse(lines: Iterable)[source]¶
Parse output from Firebird trace session.
- Parameters:
lines (Iterable) – Iterable that return lines produced by Firebird trace session.
- Yields:
TraceEvent
andTraceInfo
dataclasses describing individual trace log entries/events.- Raises:
firebird.base.types.Error – When any problem is found in input stream.
- parse_event(trace_block: List[str]) TraceEvent [source]¶
Parse single trace event.
- push(line: str | Sentinel) List[TraceEvent | TraceInfo] | None [source]¶
Push parser.
- Parameters:
line (str | Sentinel) – Single trace output line, or
STOP
sentinel.- Returns:
None, or list with parsed elements (single event preceded by any info blocks related to it).
- Raises:
Error – When pushed line is not recognized as part of trace event.
- Return type:
List[TraceEvent | TraceInfo] | None
- retrieve_info() List[TraceInfo] [source]¶
Returns list of
TraceInfo
instances produced by lastparse_event()
call.The list could be empty.
Important
The internal buffer for info instances is cleared after call to this method, so all produced info instances are returned only once.
- has_statement_free: bool¶
Parsing option indicating that parsed trace contains
FREE_STATEMENT
events. This has impact on cleanup ofSQLInfo
ID cache. When True, the SQLInfo is discarded when its FREE_STATEMENT event is processed. When False, the SQLInfo is discarded when its EXECUTE_STATEMENT_FINISH is processed.
- next_param_id: int¶
Sequence id that would be assigned to next parsed unique parameter (starts with 1)
- next_sql_id: int¶
Sequence id that would be assigned to next parsed unique SQL command (starts with 1)
- param_map¶
Dictionary that maps parameters (statement or procedure) keys to internal ids