[Qgis-user] Change postgis layer datasource

Giuseppe Sucameli sucameli at faunalia.it
Wed Feb 16 16:22:14 PST 2011


Hi Pablo,

On Wed, Feb 16, 2011 at 7:01 PM, Pablo Carreira
<pablotcarreira at hotmail.com>wrote:

>  I'm trying to change the datasource of a postgis layer created with RT
> SQL, I mean, I want to make changes in the query after the layer is
> created.
>
the provider stores internally the datasource URI value when created and
opens a connection to the database, so changing that value after doesn't
affect the existent connection.

BTW, why would you change that value after the layer is created?
If you have a valid reason or you think this should be the right behavior,
file a ticket on trac.

Cheers.


> I tried this:
>
> l=qgis.utils.iface.activeLayer()
> d=l.dataProvider()
>  d.setDataSourceUri(u'dbname=\'postgis\' host.......')
> l.reload()
>
> It's ok, but nothing happens.
> Am I in the right path? What am I missing?
>
>
> Pablo Torres Carreira
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
>
>


-- 
Giuseppe Sucameli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20110217/7c94f3d1/attachment.html>


More information about the Qgis-user mailing list