Class: QgsAuthConfigurationStorageDb

QSqlDatabase based implementation of QgsAuthConfigurationStorage.

Added in version 3.40.

Note

This is an abstract class, with methods which must be implemented by a subclass.

The following methods must be implemented: QgsAuthConfigurationStorage.SIP_THROW()

Class Hierarchy

Inheritance diagram of qgis.core.QgsAuthConfigurationStorageDb

Base classes

QgsAuthConfigurationStorage

Abstract class that defines the interface for all authentication configuration storage implementations.

QObject

Methods

authDatabaseConnection

Returns the database connection used by this storage.

authDbOpen

Opens the connction to the database.

authDbQuery

Runs the specified query on the database.

authDbTransactionQuery

Executes the specified query on the database using a transaction.

createCertTables

Creates the certificate tables in the database.

createConfigTables

Creates the configuration tables in the database.

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsAuthConfigurationStorageDb. See the FAQ for more details.

authSettingsTableName

Returns the name of the table used to store the auth settings.

certAuthorityTableName

Returns the name of the table used to store the certificate authorities.

certIdentityTableName

Returns the name of the table used to store the certificate identities.

certTrustPolicyTableName

Returns the name of the table used to store the certificate trust policies.

checkCapabilities

Checks the capabilities of the storage.

masterPasswordTableName

Returns the name of the table used to store the master passwords.

methodConfigTableName

Returns the name of the table used to store the method configurations.

quotedQualifiedIdentifier

Returns the quoted identifier, prefixed with the schema (if not null), ready for the insertion into a SQL query.

sslCertCustomConfigTableName

Returns the name of the table used to store the SSL custom configurations.

tableExists

Returns True if the specified table exists in the database, False otherwise.

class qgis.core.QgsAuthConfigurationStorageDb[source]

Bases: QgsAuthConfigurationStorage

__init__(settings: Dict[str | None, Any])

Creates a new QgsAuthConfigurationStorageDb instance from the specified settings. Settings can contain the following keys:

Mandatory settings:

Optional settings:

Note

Even if this generic storage also works with a pre-existing SQLite DB, a convenience subclass QgsAuthConfigurationStorageSqlite is provided for SQLite DBs.

Parameters:

settings (Dict[Optional[str], Any])

__init__(uri: str | None)

Creates a new QgsAuthConfigurationStorageDb instance from the specified uri. The URI should be in the format: verbatim<DRIVER>://<USER>:<PASSWORD>@<HOST>:<PORT>/<DATABASE>[?OPTIONS]endverbatim

Note

It is not possible to set the schema in the URI, pass SCHEMA=verbatim<SCHEMA>endverbatim in the options instead.

Parameters:

uri (Optional[str])

authDatabaseConnection(self) QSqlDatabase[source]

Returns the database connection used by this storage.

Return type:

QSqlDatabase

authDbOpen(self) bool[source]

Opens the connction to the database.

Return type:

bool

Returns:

True if the connection was opened successfully, False otherwise.

authDbQuery(self, query: QSqlQuery | None, sql: str | None = '') bool[source]

Runs the specified query on the database. Optional sql can be provided.

Return type:

bool

Returns:

True if the query was executed successfully, False otherwise.

Parameters:
  • query (Optional[QSqlQuery])

  • sql (Optional[str] = '')

authDbTransactionQuery(self, query: QSqlQuery | None) bool[source]

Executes the specified query on the database using a transaction. Optional sql can be provided.

Return type:

bool

Returns:

True if the query was executed successfully, False otherwise.

Parameters:

query (Optional[QSqlQuery])

virtual authSettingsTableName(self) str[source]

Returns the name of the table used to store the auth settings.

Return type:

str

virtual certAuthorityTableName(self) str[source]

Returns the name of the table used to store the certificate authorities.

Return type:

str

virtual certIdentityTableName(self) str[source]

Returns the name of the table used to store the certificate identities.

Return type:

str

virtual certTrustPolicyTableName(self) str[source]

Returns the name of the table used to store the certificate trust policies.

Return type:

str

virtual checkCapabilities(self)[source]

Checks the capabilities of the storage.

createCertTables(self) bool[source]

Creates the certificate tables in the database.

Return type:

bool

Returns:

True if the tables were created successfully, False otherwise.

createConfigTables(self) bool[source]

Creates the configuration tables in the database.

Return type:

bool

Returns:

True if the tables were created successfully, False otherwise.

virtual masterPasswordTableName(self) str[source]

Returns the name of the table used to store the master passwords.

Return type:

str

virtual methodConfigTableName(self) str[source]

Returns the name of the table used to store the method configurations.

Return type:

str

virtual quotedQualifiedIdentifier(self, identifier: str | None, isIndex: bool = False) str[source]

Returns the quoted identifier, prefixed with the schema (if not null), ready for the insertion into a SQL query.

Parameters:
  • identifier (Optional[str]) – the identifier to quote.

  • isIndex (bool = False) – if True, the identifier is treated as an index name.

Return type:

str

virtual sslCertCustomConfigTableName(self) str[source]

Returns the name of the table used to store the SSL custom configurations.

Return type:

str

virtual tableExists(self, table: str | None) bool[source]

Returns True if the specified table exists in the database, False otherwise.

Note

The schema is automatically prepended to the table name.

Parameters:

table (Optional[str])

Return type:

bool