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
andconfiguration
. The connection is not automatically stored in the settings.See also
QgsAbstractProviderConnection(
QgsAbstractProviderConnection
)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.
Methods
Returns the connection configuration parameters
Returns an icon representing the connection.
Deletes the connection from the settings.
Sets the connection
configuration
Sets the connection data source URI to
uri
Stores the connection in the settings.
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