Re: [QGIS-Developer] Problems with QgsProviderRegistry providerMetadata method
Thanks Alessandro - that did the trick... This works: metadata = QgsProviderRegistry.instance().providerMetadata('postgres') conn = metadata.connections(*False*) for c in conn.keys(): print(c) As I suspected: The bug was placed 50 cm from the computer screen, i.e an "error-50" Med venlig hilsen / Kind regards Bo Victor Thomsen Den 25-10-2021 kl. 11:54 skrev Alessandro Pasotti: connections(boolcached=true) ___ 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
Re: [QGIS-Developer] Problems with QgsProviderRegistry providerMetadata method
Hi Bo, Is that with or without `cached` ? QMap connections( bool cached = true ) On Mon, Oct 25, 2021 at 11:46 AM Bo Victor Thomsen < bo.victor.thom...@gmail.com> wrote: > 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 > > ___ > 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 > -- Alessandro Pasotti QCooperative: www.qcooperative.net ItOpen: www.itopen.it ___ 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] Problems with QgsProviderRegistry providerMetadata method
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 ___ 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