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

Inheritance diagram of qgis.gui.QgsStoredQueryManager

Base classes

QObject

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
definition: str
name: str
allQueries(self) List[QgsStoredQueryManager.QueryDetails]

Returns details of all queries stored in the manager.

Queries will be sorted by name.

Return type:

List[QgsStoredQueryManager.QueryDetails]

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 specified backend.

Parameters:
  • name (Optional[str])

  • backend (Qgis.QueryStorageBackend = Qgis.QueryStorageBackend.LocalProfile)

Return type:

str

signal queryAdded[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

signal queryChanged[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

signal queryRemoved[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

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

queryRemoved()

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

queryAdded()

See also

queryChanged()