0

I have a large table on a (non-spatial) PostgreSQL database which I had created using QGIS to upload the (geometryless) attribute data from a point layer. The database is merely used for data analysis and statistics with Excel and python/matplotlib. (Upgrading the PostgreSQL system to PostGIS is no option)

Later I added a new field (=column) to that layer with further data which I now need to update the table on the database with. I don't want to remove the old database and upload the whole new one as they are really huge and uploading takes a whole day.

Any ideas how to add just the new column data to that table?

3
  • 1
    How large is the table
    – Bera
    Commented Jul 30, 2022 at 7:19
  • 1
    So do you have a local layer with one column more that the same layer uploaded to the database? Why not work from the beginning with the db layer? Do you need a QGIS only solution or other tools can be used? Commented Jul 30, 2022 at 8:35
  • 1
    The table is about 22 GB. I cannot work from the beginning with the db layer because the DB is a pure PostgreSQL and no PostGIS. I cannot use the db because QGIS cannot write the geocoordinate data. I need the db only to access and analyze the data creating views and later displaying it with Excel. No idea if there would be a possibility to access the layer locally via a db interface, creating views and outputting them.. Other tools could be used as well but I'd prefer no further installations so something from OSGEO4W would be great
    – Tobias
    Commented Jul 31, 2022 at 22:12

1 Answer 1

1

Maybe saving only the new field/column to a separate layer in QGIS, uploading it to a separate second table and then trying to include/copy that column into the destination table by first adding a new column and then updating the table with a where condition. Not sure this is the most elegant way and how exactly it is going to work.

3
  • You need to save not only the new column in a new layer but also de primary key. Commented Jul 30, 2022 at 8:35
  • That's right of course. Thanks for mentioning!
    – Tobias
    Commented Jul 31, 2022 at 22:17
  • I would try what you are suggesting. Then join and update
    – Bera
    Commented Aug 1, 2022 at 7:01

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