3

I have postgresql/postgis database setup with one to many relationship. I can successfully set it up in QGIS but i would like to keep related tables hidden from Layers Panel to keep the project "clean" since later on i might be adding more complex databases, value map tables etc..

For example, i have locations layer where each point can relate to several events in events layer. I would like to edit data in form like this so each location can be updated with new events only that events table would not be visible in Layers Panel:

enter image description here

I found solution that works in QGIS 2 but i need to set it up in QGIS 3.

Is there some way to achieve this without going into PyQGIS?

I am just starting with PyQGIS.

  • not 100% sure what you mean but I'm almost certain PostgreSQL Views (or Materialized Views) are what you want if you are working with in-DB joins only. – ThingumaBob Feb 11 at 13:01
  • Thanks for response, I Updated the question to make it clear what i want to achieve. Views, if i understand right, allow me to create joined tables and would multipy "locations" to match number of unique "events"/"location" combinations from my example and not allow me to use emebeded attribute tables in forms? – Mat Feb 11 at 18:43
  • Why not create an updatable view in PostgreSQL ? More informations in the PG documentation : postgresql.org/docs/current/sql-createview.html, Updatable Views section. – J. Monticolo Feb 21 at 8:09
  • Natively I don't see any way of hiding a layer in the TOC without some pyqgis. In the past I have all the lists stored away in a TOC group. A Virtual Layer can embed a table so it is not visibly in the TOC, but you can not use them in a value map relation. – Jakob Feb 21 at 8:35

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.