[Qgis-developer] python function to upgrade qgs datasources?

Andreas Neumann a.neumann at carto.net
Tue Jul 1 07:13:15 PDT 2014

Hi Régis,

I can't help you with the Python script to process your files, but I
have a suggestion:

Use a PostgreSQL service instead of hard-coded IP addresses, names or

In such a scenario you can easily change between a production and test
server and more easily migrate to a new machine. Also, on a laptop you
can point the service to localhost (for mobile laptops) and within your
organizations LAN you can point to the production server. All without
touching the .qgs project file.

We in Uster are using PostgreSQL service names for several years now and
I like them. Unfortunately the concept of PostgreSQL services is not
very well-known among the PostgreSQL users.

See http://www.postgresql.org/docs/current/static/libpq-pgservice.html


Am 01.07.2014 14:01, schrieb Régis Haubourg:
> Hi All, 
> We are preparing a great postgres migration here, and to make it
> transparent, we have given virtual aliases to our server. 
> User's QGS file refer today to hard coded IP or aliases ( or
> vslin147). 
> We have been migrating most qgs using bash script with grep and sed, but we
> seem to touch the limits of such approaches (error handling, disconnected
> disks.. editions pending ., some are zipped )
> My question, do you think it is possible to have a python function (plugin
> or user function), that will catch qgs before loading it, and that will
> substitute the host with the new value, before qgis loads the datasource ? 
> Any idea?
> Cheers
> Régis
> --
> View this message in context: http://osgeo-org.1560.x6.nabble.com/python-function-to-upgrade-qgs-datasources-tp5149022.html
> Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer

More information about the Qgis-developer mailing list