Class: QgsStoredQueryManager¶
A manager for stored SQL queries.
QgsStoredQueryManager
is not usually directly created,
instead use the instance accessible through
QgsGui.storedQueryManager()
.
Added in version 3.44.
Class Hierarchy¶
Base classes¶
Methods
Returns details of all queries stored in the manager. |
|
Returns a list of the names of all stored queries for the specified backend. |
|
Returns the query definition with matching name, from the specified backend. |
|
Removes the stored query with matching name. |
|
Saves a query to the manager. |
Signals
Emitted when a query is added to the manager. |
|
Emitted when an existing query is changed in the manager. |
|
Emitted when a query is removed from the manager. |
- class qgis.gui.QgsStoredQueryManager[source]¶
Bases:
QObject
- __init__(parent: QObject | None = None)
Constructor for QgsStoredQueryManager, with the specified
parent
object.- Parameters:
parent (Optional[QObject] = None)
- class QueryDetails[source]¶
Bases:
object
Contains details about a stored query.
Added in version 3.44.
- backend: Qgis.QueryStorageBackend¶
Storage backend.
- definition: str¶
Query definition.
- name: str¶
Name of the query.
- allQueries(self) List[QgsStoredQueryManager.QueryDetails] ¶
Returns details of all queries stored in the manager.
Queries will be sorted by name.
- Return type:
- allQueryNames(self, backend: Qgis.QueryStorageBackend = Qgis.QueryStorageBackend.LocalProfile) List[str] [source]¶
Returns a list of the names of all stored queries for the specified
backend
.- Parameters:
backend (Qgis.QueryStorageBackend = Qgis.QueryStorageBackend.LocalProfile)
- Return type:
List[str]
- query(self, name: str | None, backend: Qgis.QueryStorageBackend = Qgis.QueryStorageBackend.LocalProfile) str [source]¶
Returns the query definition with matching
name
, from the specifiedbackend
.- Parameters:
name (Optional[str])
backend (Qgis.QueryStorageBackend = Qgis.QueryStorageBackend.LocalProfile)
- Return type:
str
- signal queryAdded(name: str, backend: Qgis.QueryStorageBackend)[source]¶
Emitted when a query is added to the manager.
- Parameters:
name (str)
backend (Qgis.QueryStorageBackend)
- signal queryChanged(name: str, backend: Qgis.QueryStorageBackend)[source]¶
Emitted when an existing query is changed in the manager.
- Parameters:
name (str)
backend (Qgis.QueryStorageBackend)
- signal queryRemoved(name: str, backend: Qgis.QueryStorageBackend)[source]¶
Emitted when a query is removed from the manager.
- Parameters:
name (str)
backend (Qgis.QueryStorageBackend)
- removeQuery(self, name: str | None, backend: Qgis.QueryStorageBackend = Qgis.QueryStorageBackend.LocalProfile)[source]¶
Removes the stored query with matching
name
.- Parameters:
name (Optional[str]) – name of query to remove
backend (Qgis.QueryStorageBackend = Qgis.QueryStorageBackend.LocalProfile) – storage backend for query
See also
- storeQuery(self, name: str | None, query: str | None, backend: Qgis.QueryStorageBackend = Qgis.QueryStorageBackend.LocalProfile)[source]¶
Saves a query to the manager.
If a query with the same
name
already exists it will be overwritten with the new definition.- Parameters:
name (Optional[str]) – user-set, unique name for the query.
query (Optional[str]) – query definition to store
backend (Qgis.QueryStorageBackend = Qgis.QueryStorageBackend.LocalProfile) – storage backend for query
See also
See also