Hi

Thanks.
Your code snippet is what I was looking for. I want to re-use the database
connection settings from my plugin.

Regards.
Florian.

Le ven. 23 juil. 2021 à 08:32, Etienne Trimaille <
etienne.trimai...@gmail.com> a écrit :

> Can you clarify what you need from DBManager?
> Widgets ? Features ?
> Or do you mean to be able to list DB connections and launch SQL queries ?
>
> You should avoid importing code from the DbManager plugin as it is removed
> step by step.
> Use the database API :
> https://qgis.org/api/classQgsAbstractDatabaseProviderConnection.html
>
> metadata = QgsProviderRegistry.instance().providerMetadata('postgres')
> connection = metadata.findConnection("name_of_connection)
> connection.executeSql("SELECT ....")
>
>
>
> Le jeu. 22 juil. 2021 à 22:09, Florian El Ahdab <felah...@gmail.com> a
> écrit :
>
>> Hi.
>>
>> I would like to take advantage of the db manager from a python plugin.
>> That would allow me to avoid handling the database configuration myself and
>> would make the overall ui more consistent for the user.
>>
>> I can't find any relevant reference to do that.
>>
>> Has anyone achieved anything like that ?
>>
>> Regards.
>> Florian.
>> _______________________________________________
>> QGIS-Developer mailing list
>> QGIS-Developer@lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>>
>
_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to