Class: QgsDatabaseSchemaModel¶
A model containing schemas from a database connection.
This class does not automatically subscribe to database updates. Schemas
are queried from the database initially upon model construction. In
order to update the listed schemas,
QgsDatabaseSchemaModel.refresh()
must be manually called.
Added in version 3.14.
Class Hierarchy¶
Base classes¶
Enums
Custom model roles. |
|
alias of |
Methods
Returns |
|
Refreshes the schema list by querying the underlying connection. |
|
Sets whether an optional empty schema ("not set") option is present in the model. |
- class qgis.core.QgsDatabaseSchemaModel[source]¶
Bases:
QAbstractItemModel
- __init__(provider: str | None, connection: str | None, parent: QObject | None = None)
Constructor for QgsDatabaseSchemaModel, for the specified
provider
andconnection
name.Warning
The
provider
must support the connection API methods in itsQgsProviderMetadata
implementation in order for the model to work correctly.- Parameters:
provider (Optional[str])
connection (Optional[str])
parent (Optional[QObject] = None)
- __init__(connection: QgsAbstractDatabaseProviderConnection | None, parent: QObject | None = None)
Constructor for QgsDatabaseSchemaModel, for the specified
connection
.Ownership of
connection
is transferred to the model.- Parameters:
connection (Optional[QgsAbstractDatabaseProviderConnection])
parent (Optional[QObject] = None)
- class CustomRole(*values)¶
Bases:
IntEnum
Custom model roles.
Note
Prior to QGIS 3.36 this was available as QgsDatabaseSchemaModel.Role
Added in version 3.36.
Empty
: Entry is an empty entryAvailable as
QgsDatabaseSchemaModel.RoleEmpty
in older QGIS releases.
- Role¶
alias of
CustomRole
- allowEmptySchema(self) bool [source]¶
Returns
True
if the model allows the empty schema (“not set”) choice.See also
- Return type:
bool