[Qgis-developer] dataSourceUri() and dictionary

Martin Dobias wonder.sk at gmail.com
Sat Mar 15 12:33:40 EDT 2008


On Wed, Mar 12, 2008 at 4:28 PM, Luca Casagrande
<luca.casagrande at gmail.com> wrote:
> Hello everybody.
>
>  This is my first python plugin, so sorry for newbie question :D
>
>  I need to alter the table of a postgis layer so the idea is to get all
>  the information from provider.dataSourceUri():
>
>  dbname=test host=localhost port=5432 user=postgres password='postgres'
>  table="test" (the_geom) sql=
>
>  Anyone got a way for converting that in a dictionary, without writing a
>  dozen of lines?

Hi Luca,
you can use QgsDataSourceURI class from core library for this job:
uri = QgsDataSourceURI("dbname=... ...")
print uri.table()
print uri.geometryColumn()

and more...

Martin


More information about the Qgis-developer mailing list