Class: QgsDatabaseQueryLogEntry

Encapsulates a logged database query.

Added in version 3.24.

Attributes

canceled

Canceled flag for user canceled queries.

error

Error reported by the provider, normally blank

fetchedRows

Number of fetched/affected rows.

finishedTime

Time when the query finished (in milliseconds since epoch), if available.

initiatorClass

The QGIS class which initiated the query.

origin

Code file location for the query origin.

provider

Provider key

query

The logged database query (e.g. the SQL query).

queryId

Unique query ID.

startedTime

Time when the query started (in milliseconds since epoch).

uri

Database URI

class qgis.core.QgsDatabaseQueryLogEntry[source]

Bases: object

__init__(query: str | None = '')

Constructor for QgsDatabaseQueryLogEntry.

Parameters:

query (Optional[str] = '')

__init__(a0: QgsDatabaseQueryLogEntry)
Parameters:

a0 (QgsDatabaseQueryLogEntry)

canceled: bool

Canceled flag for user canceled queries.

error: str

Error reported by the provider, normally blank

fetchedRows: int

Number of fetched/affected rows.

Warning

Not all providers support this information.

finishedTime: int

Time when the query finished (in milliseconds since epoch), if available.

initiatorClass: str

The QGIS class which initiated the query.

c++ code can automatically populate this through the QgsSetQueryLogClass macro.

origin: str

Code file location for the query origin.

c++ code can automatically populate this through the QgsSetQueryLogClass macro.

provider: str

Provider key

query: str

The logged database query (e.g. the SQL query)

queryId: int

Unique query ID.

This ID will automatically be set on creation of a new QgsDatabaseQueryLogEntry object.

startedTime: int

Time when the query started (in milliseconds since epoch).

This will be automatically recorded on creation of a new QgsDatabaseQueryLogEntry object.

uri: str

Database URI