[QGIS-Developer] Problems with QgsProviderRegistry providerMetadata method

Bo Victor Thomsen bo.victor.thomsen at gmail.com
Mon Oct 25 02:46:02 PDT 2021


Hi list members -

I stumbled on something weird (for me at least):

If I run the following code in the Python console:

metadata = QgsProviderRegistry.instance().providerMetadata('postgres')
conn = metadata.connections()
for c in conn.keys(): print(c)

It shows me (as I would expect): A list of names of postgres connections 
in QGIS.

However, if I 1) Make a /new/ postgres connection and 2) Rerun the same 
lines in the console, the new connection is /not/ shown in the list.

But if I restart QGIS and run the same code, the new connection will be 
shown together with the older connections.

What gives ? Is there some kind of "refresh" method I've overlooked??

Version: QGIS 3.20.3 on Windows 10.


-- 
Med venlig hilsen / Kind regards

Bo Victor Thomsen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20211025/fa96f753/attachment-0001.html>


More information about the QGIS-Developer mailing list