Hi,

DB connection details are stored in QSettings.
For instance
s = QSettings()
s.beginGroup('PostgreSQL/connections')

you can then list connections by s.childGroups()

Does it help ?

On 09/10/2015 14:33, Spencer Gardner wrote:
> In an answer yesterday I learned that I can use DB Manager via Python to
> work with my PostGIS database. 
> 
> Within the Processing framework, I need to get a reference to a database
> based on an input layer. In the past, I could accomplish this by parsing
> the layer's URI. However, it appears that DB Manager refers to databases
> using the DB's connection name as given in QGIS. How can I refer to my
> database from one of its tables that exists as a layer in QGIS?
> 
> Here's an example:
> 
> Table name: foo
> Database name in PostgreSQL: bar
> Connection name in QGIS: baz
> 
> I need to get "baz" based on a QGIS layer that points to "foo".
> 
> Thanks for any help!
> 
> 
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
> 

_______________________________________________
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to