[Qgis-developer] Getting schema name of a PostGIS layer from python

Sandro Santilli strk at keybit.net
Fri Sep 28 13:56:02 PDT 2012


On Fri, Sep 28, 2012 at 10:46:45PM +0200, Giuseppe Sucameli wrote:

> depends if the schema was passed when creating the
> uri string used to load the layer:
> 
> QgsDataSourceURI( vl.source() ).schema()
> 
> where vl is the vector layer.
> 
> If the passed schema was empty you will get an empty string.

Uhm. So if you're using the "default schema" you won't know in
this way, right ? Well, I'll need to connect to the database
anyway so might as well query current_schema() if that's the
case. 

What's the recommended way to perform the connection ?
Anything reusable in qgis itself ?

--strk;

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html


More information about the Qgis-developer mailing list