<div dir="auto"><div>Hi</div><div dir="auto"><br></div><div dir="auto">Thanks.</div><div dir="auto">Your code snippet is what I was looking for. I want to re-use the database connection settings from my plugin.</div><div dir="auto"><br></div><div dir="auto">Regards.</div><div dir="auto">Florian.<br><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">Le ven. 23 juil. 2021 à 08:32, Etienne Trimaille <<a href="mailto:etienne.trimaille@gmail.com">etienne.trimaille@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Can you clarify what you need from DBManager?<br></div><div>Widgets ? Features ?</div><div><div>Or do you mean to be able to list DB connections and launch SQL queries ?</div></div><div><br></div><div>You should avoid importing code from the DbManager plugin as it is removed step by step.</div><div>Use the database API : <br><div><a href="https://qgis.org/api/classQgsAbstractDatabaseProviderConnection.html" target="_blank" rel="noreferrer">https://qgis.org/api/classQgsAbstractDatabaseProviderConnection.html</a></div></div><div><br></div><div>metadata = QgsProviderRegistry.instance().providerMetadata('postgres')<br>connection = metadata.findConnection("name_of_connection)</div><div>connection.executeSql("SELECT ....")</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le jeu. 22 juil. 2021 à 22:09, Florian El Ahdab <<a href="mailto:felahdab@gmail.com" target="_blank" rel="noreferrer">felahdab@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Hi.<div dir="auto"><br></div><div dir="auto">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.</div><div dir="auto"><br></div><div dir="auto">I can't find any relevant reference to do that.</div><div dir="auto"><br></div><div dir="auto">Has anyone achieved anything like that ?</div><div dir="auto"><br></div><div dir="auto">Regards.</div><div dir="auto">Florian.</div></div>
_______________________________________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank" rel="noreferrer">QGIS-Developer@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</blockquote></div>
</blockquote></div></div></div>