Class: QgsDataSourceUri¶
-
class
qgis.core.
QgsDataSourceUri
¶ Bases:
sip.wrapper
default constructor
QgsDataSourceUri(uri: str) constructor which parses input URI
QgsDataSourceUri(
QgsDataSourceUri
)Methods
Any associated authentication configuration ID
Clears the schema
Returns connection part of URI
Returns the database
Decodes SSL mode string into enum value.
Sets to true to disable selection by id
- rtype
str
Encodes SSL mode enum value into a string.
Returns complete encoded uri (generic mode)
Returns the name of the geometry column
Test if param exists (generic mode)
Returns the host
Returns the name of the (primary) key column
Gets generic param (generic mode)
Gets multiple generic param (generic mode)
Returns the password
Returns the port
quoted table name
Remove generic param (generic mode)
Removes password element from uris
Returns the schema
Returns whether the selection by id is disabled
Returns the service name
Sets authentication configuration ID
Sets all connection related members at once
Sets all data source related members at once
Sets database
- param driver
Sets complete encoded uri (generic mode)
Sets the name of the (primary) key column
Set generic param (generic mode)
Sets password
- param schema
Sets the SQL query
Sets the srid
Sets use Estimated Metadata
Sets username
Sets the wkb type
Returns the SQL query
Returns the srid
Returns the SSL mode
Returns the table
Returns complete uri
Returns true if estimated metadata are used
Returns the username
The wkb type.
Attributes
-
SslAllow
= 2¶
-
SslDisable
= 1¶
-
class
SslMode
¶ Bases:
int
-
baseClass
¶ alias of
QgsDataSourceUri
-
-
SslPrefer
= 0¶
-
SslRequire
= 3¶
-
SslVerifyCa
= 4¶
-
SslVerifyFull
= 5¶
-
authConfigId
(self) → str¶ Any associated authentication configuration ID
- Return type
str
-
clearSchema
(self)¶ Clears the schema
-
connectionInfo
(self, expandAuthConfig: bool = True) → str¶ Returns connection part of URI
- Parameters
expandAuthConfig (bool = True) –
- Return type
str
-
database
(self) → str¶ Returns the database
- Return type
str
-
decodeSslMode
(sslMode: str) → QgsDataSourceUri.SslMode¶ Decodes SSL mode string into enum value. If the string is not recognized, SslPrefer is returned.
New in version 3.2.
- Parameters
sslMode (str) –
- Return type
-
disableSelectAtId
(self, flag: bool)¶ Sets to true to disable selection by id
- Parameters
flag (bool) –
-
driver
(self) → str¶ - Return type
str
-
encodeSslMode
(sslMode: QgsDataSourceUri.SslMode) → str¶ Encodes SSL mode enum value into a string.
New in version 3.2.
- Parameters
sslMode (QgsDataSourceUri.SslMode) –
- Return type
str
-
encodedUri
(self) → QByteArray¶ Returns complete encoded uri (generic mode)
- Return type
QByteArray
-
geometryColumn
(self) → str¶ Returns the name of the geometry column
- Return type
str
-
hasParam
(self, key: str) → bool¶ Test if param exists (generic mode)
- Parameters
key (str) –
- Return type
bool
-
host
(self) → str¶ Returns the host
- Return type
str
-
keyColumn
(self) → str¶ Returns the name of the (primary) key column
- Return type
str
-
param
(self, key: str) → str¶ Gets generic param (generic mode)
- Parameters
key (str) –
- Return type
str
-
params
(self, key: str) → List[str]¶ Gets multiple generic param (generic mode)
- Parameters
key (str) –
- Return type
List[str]
-
password
(self) → str¶ Returns the password
- Return type
str
-
port
(self) → str¶ Returns the port
- Return type
str
-
quotedTablename
(self) → str¶ quoted table name
- Return type
str
-
removeParam
(self, key: str) → int¶ Remove generic param (generic mode)
Note
remove all occurrences of key, returns number of params removed
- Parameters
key (str) –
- Return type
int
-
removePassword
(aUri: str) → str¶ Removes password element from uris
- Parameters
aUri (str) –
- Return type
str
-
schema
(self) → str¶ Returns the schema
- Return type
str
-
selectAtIdDisabled
(self) → bool¶ Returns whether the selection by id is disabled
- Return type
bool
-
service
(self) → str¶ Returns the service name
- Return type
str
-
setAuthConfigId
(self, authcfg: str)¶ Sets authentication configuration ID
- Parameters
authcfg (str) –
-
setConnection
(self, aHost: str, aPort: str, aDatabase: str, aUsername: str, aPassword: str, sslmode: QgsDataSourceUri.SslMode = QgsDataSourceUri.SslPrefer, authConfigId: str = '')¶ Sets all connection related members at once
setConnection(self, aService: str, aDatabase: str, aUsername: str, aPassword: str, sslmode: QgsDataSourceUri.SslMode = QgsDataSourceUri.SslPrefer, authConfigId: str = ‘’) Sets all connection related members at once (for the service case)
- Parameters
aHost (str) –
aPort (str) –
aDatabase (str) –
aUsername (str) –
aPassword (str) –
sslmode (QgsDataSourceUri.SslMode = QgsDataSourceUri.SslPrefer) –
authConfigId (str = '') –
-
setDataSource
(self, aSchema: str, aTable: str, aGeometryColumn: str, aSql: str = '', aKeyColumn: str = '')¶ Sets all data source related members at once
- Parameters
aSchema (str) –
aTable (str) –
aGeometryColumn (str) –
aSql (str = '') –
aKeyColumn (str = '') –
-
setDatabase
(self, database: str)¶ Sets database
- Parameters
database (str) –
-
setDriver
(self, driver: str)¶ - Parameters
driver (str) –
-
setEncodedUri
(self, uri: str)¶ Sets complete encoded uri (generic mode)
- Parameters
uri (str) –
-
setKeyColumn
(self, column: str)¶ Sets the name of the (primary) key column
- Parameters
column (str) –
-
setParam
(self, key: str, value: str)¶ Set generic param (generic mode)
Note
if key exists, another is inserted
- Parameters
key (str) –
value (str) –
-
setParamList
(self, key: str, value: Iterable[str])¶ Note
available in Python as setParamList
- Parameters
key (str) –
value (Iterable[str]) –
-
setPassword
(self, password: str)¶ Sets password
- Parameters
password (str) –
-
setSchema
(self, schema: str)¶ - Parameters
schema (str) –
-
setSql
(self, sql: str)¶ Sets the SQL query
- Parameters
sql (str) –
-
setSrid
(self, srid: str)¶ Sets the srid
- Parameters
srid (str) –
-
setUseEstimatedMetadata
(self, flag: bool)¶ Sets use Estimated Metadata
- Parameters
flag (bool) –
-
setUsername
(self, username: str)¶ Sets username
- Parameters
username (str) –
-
setWkbType
(self, type: QgsWkbTypes.Type)¶ Sets the wkb type
- Parameters
type (QgsWkbTypes.Type) –
-
sql
(self) → str¶ Returns the SQL query
- Return type
str
-
srid
(self) → str¶ Returns the srid
- Return type
str
-
sslMode
(self) → QgsDataSourceUri.SslMode¶ Returns the SSL mode
- Return type
-
staticMetaObject
= <PyQt5.QtCore.QMetaObject object>¶
-
table
(self) → str¶ Returns the table
- Return type
str
-
uri
(self, expandAuthConfig: bool = True) → str¶ Returns complete uri
- Parameters
expandAuthConfig (bool = True) –
- Return type
str
-
useEstimatedMetadata
(self) → bool¶ Returns true if estimated metadata are used
- Return type
bool
-
username
(self) → str¶ Returns the username
- Return type
str
-
wkbType
(self) → QgsWkbTypes.Type¶ The wkb type.
- Return type