[Qgis-developer] pyqgis add postgres table

Alexandre Busquets abusquets at gmail.com
Mon Feb 23 07:18:32 PST 2015


Hi,

I can't add non geometry tables from postgres with pyqgis, this is my code

    uri = QgsDataSourceURI()
    uri.setConnection(bd_host, bd_port, bd_db, bd_user, bd_pass)
    uri.setDataSource('public', 'persones', '', '', 'id')
    taula = QgsVectorLayer(uri.uri(), 'persones', 'postgres')
    print taula.isValid()


What is the problem?


Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20150223/13030be9/attachment.html>


More information about the Qgis-developer mailing list