[QGIS-Developer] Fwd: Plugin Development for accessing PostgresSQL Database in a QtableWidget in QT Designer

Richard Duivenvoorde rdmailings at duif.net
Mon Sep 7 01:45:00 PDT 2020


On 9/6/20 8:08 PM, SOHINI GOSWAMI wrote:
> Dear Developers,
> I would request to kindly help me with building a plugin using Qtablewidget in QT designer. The table would retrieve a postgresql using a query [Depending on the date of the date] . I have created the UI file in QT designer but unable to fetch the data from the buttons click triggers in my main python plugin file. It would be great if I could get a complete guide of writing methods on onclick -buttons and retrive the data from Postgres database.

Hi SOHINI GOSWAMI,

I think you really have to dive a little into PyQt coding.

It is hard to help without seeing what you already did. Do you maybe have your code on github/gitlab somewhere?

Maybe try to download some plugins and have a look into their code to get an idea what is needed to get a working QGIS Python plugin.

If you want to retrieve 'data' from a postgis plugin, you have to decide if you do that via QGIS (Features, if you can make that query into a filter) or directly from Postgres (you need to fetch table data yourself then using the psycopg2 module.

Regards,

Richard Duivenvoorde



More information about the QGIS-Developer mailing list