Class: QgsAbstractProviderConnection¶
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.
Added in version 3.10.
Note
This is an abstract class, with methods which must be implemented by a subclass.
The following methods must be implemented: remove()
, store()
Class Hierarchy¶
Subclasses¶
Provides common functionality for database based connections. |
|
Represents connections to STAC catalogs. |
Abstract Methods
Deletes the connection from the settings. |
|
Stores the connection in the settings. |
Methods
Returns the connection configuration parameters |
|
Sets the connection configuration |
|
Sets the connection data source URI to uri |
|
Returns the connection data source URI string representation |
Virtual Methods
In PyQGIS, only methods marked as virtual
can be safely overridden in a Python subclass of QgsAbstractProviderConnection. See the FAQ for more details.
Returns an icon representing the connection. |
- class qgis.core.QgsAbstractProviderConnection[source]¶
Bases:
object
- __init__(name: str | None)
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.- Parameters:
name (Optional[str])
- __init__(uri: str | None, configuration: Dict[str, Any])
Creates a new connection from the given
uri
andconfiguration
. The connection is not automatically stored in the settings.See also
- Parameters:
uri (Optional[str])
configuration (Dict[str, Any])
- __init__(a0: QgsAbstractProviderConnection)
- Parameters:
- configuration(self) Dict[str, Any] [source]¶
Returns the connection configuration parameters
- Return type:
Dict[str, Any]
- abstract remove(self, name: str | None)[source]¶
Deletes the connection from the settings.
- Parameters:
name (Optional[str])
- setConfiguration(self, configuration: Dict[str, Any])[source]¶
Sets the connection
configuration
- Parameters:
configuration (Dict[str, Any])
- setUri(self, uri: str | None)[source]¶
Sets the connection data source URI to
uri
- Parameters:
uri (Optional[str])