Class: QgsAbstractProviderConnection

class qgis.core.QgsAbstractProviderConnection(name: str)

Bases: sip.wrapper

Creates a new connection with name by reading its configuration from the settings. If a connection with this name cannot be found, an empty connection will be returned.

QgsAbstractProviderConnection(uri: str, configuration: Dict[str, Any]) Creates a new connection from the given uri and configuration. The connection is not automatically stored in the settings.

See also



The QgsAbstractProviderConnection provides an interface for data provider connections.

Connections objects can be constructed loading them from the connections stored in the settings by passing the connection name. A new connection object can also be created by passing a data source URI in the constructor.

Provider metadata keep a cache of the existing connections, to manage stored connections it is recommendend to call metadata methods instead of loading and storing the connections directly.

Concrete classes must implement methods to retrieve, save and remove connections from the settings.

New in version 3.10.



configuration(self) → Dict[str, Any]

Returns the connection configuration parameters

Return type

Dict[str, Any]

remove(self, name: str)

Deletes the connection from the settings.


name (str) –

setConfiguration(self, configuration: Dict[str, Any])

Sets the connection configuration


configuration (Dict[str) –

setUri(self, uri: str)

Sets the connection data source URI to uri


uri (str) –

store(self, name: str)

Stores the connection in the settings.


name (str) – the name under which the connection will be stored

uri(self) → str

Returns the connection data source URI string representation

Return type