Change dynamically datasource of postgis layer in qgis

Viewed 80

I have many layers in a qgis project from the same postgis database. This project is saved in the same postgis database. OK, it works fine... I copy this qgis project in anothers databases with exactly the same schema. When I open it in the others databases, the layers are still connected to the first database but I wloud like to connect them to the same database as the project... like an relative path with files (and not a absolute)... How can I do it ? Or is-it possible to create a pyqgis function called when I open the project to dynamically change the dbanme of all postgis's layers to the same database as the project ? I'm sure it can be possible.... thank's

0 Answers
Related