0

I am migrating a plugin to (K)Ubuntu 18.04 and QGIS 3.2 but oddly enough I can't seem to connect to a postgres database.

As far as I can see the QPSQL driver is not loaded. I ran the following code:

>>> qgis.PyQt.QtSql.QSqlDatabase.drivers()
['QSQLITE', 'QMYSQL', 'QMYSQL3', 'QSPATIALITE', 'SKGSQLCIPHER']

As you can see the QPSQL driver is not loaded. Is there something I am missing?

Extra information - I am also running a local Postgresql9.6 (so there should be plenty of libs available) - Latest versions of libpq-dev and libpq5 installed. - I can load postgis layers from qgis just fine

2
  • Maybe Qt is not used for database access in QGis? Aug 1, 2018 at 18:38
  • Thing is, in windows it does show up. I've done a complete reinstall, but still same thing. Aug 2, 2018 at 6:54

1 Answer 1

4

Solved by installing the library libqt5sql5-psql

sudo apt install libqt5sql5-psql
1
  • 1
    It took way too much googling to find how to install QPSQL on Ubuntu, thanks!
    – Avamander
    Oct 12, 2018 at 22:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.