Dear devs,

When I try to load a layer from a PostGIS data source where the connection has 
timed out, is there a way in pyqgis (2.18) to refresh the connection 
programmatically like in DBmanager before loading the layer?

psycopg2 connections are no problem...

The following however:

# Add new layer
uri = QgsDataSourceURI()
uri.setConnection(host, port, db_name, user, password)
uri.setDataSource('', query, 'geom','', 'ID')
lyr = QgsVectorLayer(uri.uri(), layer_name, 'postgres')

gives me "No result buffer" error in PostGIS...

Thanks for any hint in advance.

Kind regards,
Stefan
_______________________________________________
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