1

I am developing QGIS Python plugin. I have a QGIS project and layers stored in a PostGIS database. I don't want to store the password into the project and I want to avoid that user need to type credentials, and also I want to avoid storing the credentials permanently.

When I open the project, I'm immediately prompted for credentials before any layers from the db are rendered.

Is there any way to enter db credentials(password and username) or set datasource programmatically before dialog is shown?

I want avoid this dialog to be shown:

enter image description here

  • add sample code,when you create a connection object,a load a sample layer – Fran Raga Apr 26 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.