Class: QgsDatabaseQueryLog¶
Handles logging of database queries.
QgsDatabaseQueryLog is not usually directly created, but
rather accessed through QgsApplication.databaseQueryLog().
Generally, clients should only access the static log() method
to register their queries.
Example¶
# Log a database query
QgsDatabaseQueryLog.log('SELECT * FROM my_table')
Added in version 3.24.
Class Hierarchy¶
Base classes¶
Static Methods
Returns |
|
Records that the database query has finished. |
|
Logs a database query as starting. |
- class qgis.core.QgsDatabaseQueryLog[source]¶
Bases:
QObject- __init__(parent: QObject | None = None)
Creates a new query log.
QgsDatabaseQueryLog is not usually directly created, but rather accessed through
QgsApplication.databaseQueryLog().- Parameters:
parent (Optional[QObject] = None)
- static enabled() bool[source]¶
Returns
Trueif logging is enabled.See also
setEnabled()- Return type:
bool
- static finished(query: QgsDatabaseQueryLogEntry)[source]¶
Records that the database
queryhas finished.This method can be safely called from any thread.
- Parameters:
query (QgsDatabaseQueryLogEntry)
- static log(query: QgsDatabaseQueryLogEntry)[source]¶
Logs a database
queryas starting.This method can be safely called from any thread.
- Parameters:
query (QgsDatabaseQueryLogEntry)