[QGIS-Developer] Work on QgsAbstractDatabaseProviderConnection for MS SQL Server
Bo Victor Thomsen
bo.victor.thomsen at gmail.com
Fri Sep 2 03:08:31 PDT 2022
Hi List -
I am working on a plugin that's is using for connections
(QgsAbstractDatabaseProviderConnection) to several types of databases,
including Postgres, GeoPackage and MS SQLServer.
I was hoping to use the method "createSqlVectorLayer
<https://api.qgis.org/api/classQgsAbstractDatabaseProviderConnection.html#a2c6e55db0df105012f0936c84df0b14d>"
for converting some fairly complex SQL queries into QGIS vector layers.
This works super nice for Postgres and GeoPackage. However the current
version (QGIS 3.26) doesn't support this method for MS SQLServer. As
illustrated in this piece of code:
conns =
QgsProviderRegistry.instance().providerMetadata('mssql').connections(False)
conn = conns['geodata @ localhost'] # SQL server connection
capabilities = conn.capabilities()
print(bool(capabilities & QgsAbstractDatabaseProviderConnection.SqlLayers))
The last statement shows "False" for MS SqlServer connections,
indicating the missing functionality. (QGIS ver. 3.26 or older)
My first question is: Has there been done any work on this for MS SQL
Server connections in QGIS master (next version) ?
The second question: Is it possible for someone in the group of Core
developers to provide me with a ballpark figure for implementing the
missing functionality for the mssql driver ??
To be specific: get method "createSqlVectorLayer
<https://api.qgis.org/api/classQgsAbstractDatabaseProviderConnection.html#a2c6e55db0df105012f0936c84df0b14d>"
to work for MS SQL Server connections.
If somebody steps up to the challenge I will send the information to my
customers so they can consider making QGIS better instead of paying me
for an ugly workaround.
Med venlig hilsen / Kind regards
Bo Victor Thomsen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20220902/ac866e39/attachment.htm>
More information about the QGIS-Developer
mailing list