Class: QgsDatabaseQueryLog

class qgis.core.QgsDatabaseQueryLog

Bases: PyQt5.QtCore.QObject

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')

New in version 3.24.

QgsDatabaseQueryLog(parent: QObject = None) Creates a new query log.

QgsDatabaseQueryLog is not usually directly created, but rather accessed through QgsApplication.databaseQueryLog().

Methods

childEvent

connectNotify

customEvent

disconnectNotify

enabled

Returns True if logging is enabled.

finished

Records that the database query has finished.

isSignalConnected

log

Logs a database query as starting.

receivers

sender

senderSignalIndex

timerEvent

childEvent(self, QChildEvent)
connectNotify(self, QMetaMethod)
customEvent(self, QEvent)
disconnectNotify(self, QMetaMethod)
enabled() bool

Returns True if logging is enabled.

See also

setEnabled()

Return type

bool

finished(query: QgsDatabaseQueryLogEntry)

Records that the database query has finished.

This method can be safely called from any thread.

Parameters

query (QgsDatabaseQueryLogEntry) –

isSignalConnected(self, QMetaMethod) bool
log(query: QgsDatabaseQueryLogEntry)

Logs a database query as starting.

This method can be safely called from any thread.

Parameters

query (QgsDatabaseQueryLogEntry) –

receivers(self, PYQT_SIGNAL) int
sender(self) QObject
senderSignalIndex(self) int
timerEvent(self, QTimerEvent)