Class: QgsAbstractProviderConnection

class qgis.core.QgsAbstractProviderConnection

Bases: sip.wrapper

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.

QgsAbstractProviderConnection(name: str) 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

store()

QgsAbstractProviderConnection(QgsAbstractProviderConnection)

Methods

configuration

Returns the connection configuration parameters

icon

Returns an icon representing the connection.

remove

Deletes the connection from the settings.

setConfiguration

Sets the connection configuration

setUri

Sets the connection data source URI to uri

store

Stores the connection in the settings.

uri

Returns the connection data source URI string representation

configuration(self) Dict[str, Any]

Returns the connection configuration parameters

Return type

Dict[str, Any]

icon(self) QIcon

Returns an icon representing the connection.

Return type

QIcon

remove(self, name: str)

Deletes the connection from the settings.

Parameters

name (str) –

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

Sets the connection configuration

Parameters

configuration (Dict[str) –

setUri(self, uri: str)

Sets the connection data source URI to uri

Parameters

uri (str) –

store(self, name: str)

Stores the connection in the settings.

Parameters

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

uri(self) str

Returns the connection data source URI string representation

Return type

str