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(name: str, uri: str) Creates a new connection with name and initializes the connection from the uri. The connection is not automatically stored in the settings.

See also

store()

QgsAbstractProviderConnection(QgsAbstractProviderConnection)

The QgsAbstractProviderConnection provides an interface for data provider connections.

Connections objects can be created by passing the connection name and in this case they are automatically loaded from the settings, or by passing a data source URI in the constructor.

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

New in version 3.10: Enums

Methods

name

Returns the connection name

remove

Deletes the connection from the settings.

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

Signals

Attributes

name(self) → str

Returns the connection name

remove(self)

Deletes the connection from the settings.

setUri(self, uri: str)

Sets the connection data source URI to uri

store(self, configuration: Dict[str, Any] = {})

Stores the connection in the settings.

Parameters

configuration – stores additional connection settings that are used by the source select dialog and are not part of the data source URI

uri(self) → str

Returns the connection data source URI string representation