[QGIS-Developer] PyQGIS read project from postgresql database
Germán Carrillo
carrillo.german at gmail.com
Fri May 12 19:23:03 PDT 2023
Hi,
what do you get if you run the following line on your QGIS Python console
in a QGIS session where your project (the one stored in PG) is loaded?
QgsProject.instance().fileName()
Regards,
Germán
El vie, 12 may 2023 a las 19:22, Alexandre Neto via QGIS-Developer (<
qgis-developer at lists.osgeo.org>) escribió:
> Hi,
>
> I am trying to read a project that is stored in a postgreSQL/PostGIS
> database, but I am struggling with getting it correctly. I am using the
> following code
>
> project = QgsProject.instance()
> uri = 'postgresql://my_user:my_pass@localhost
> :5432?sslmode=disable&dbname=my_database&schema=my_schema&project=my_project_name'
> project.read(uri)
>
> The last command always return false, and no project is loaded
>
> The documentation of QgsProject.read() only mentions filenames, not uri,
> but this answer seems to propose this uri format that would work:
>
> https://gis.stackexchange.com/a/354615/6191
>
> Any suggestions on how to solve or debug this? I get no error messages
> from the read method.
>
> Thanks,
>
> Aleandre Neto
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
--
-----------
|\__
(:>__)(
|/
Soluciones Geoinformáticas Libres
http://geotux.tuxfamily.org/
https://twitter.com/GeoTux2 <http://twitter.com/GeoTux2>
<http://gis.stackexchange.com/users/4972/germ%c3%a1n-carrillo>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20230512/55774d87/attachment.htm>
More information about the QGIS-Developer
mailing list