-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider allowing one to many relationships? #678
Comments
Do you really need an extension for a simple join based on a primary key / foreign key pair? The Related Tables Extension is useful because it defines the many-to-many relationship. While there is nothing keeping you from using it for a one-to-many relationship, it is not clear to me why one would be compelled to do so. Just define an attributes table (see https://opengeospatial.github.io/e-learning/geopackage/text/attributes_extensions.html#id1 or https://www.geopackage.org/spec140/#attributes) and make a foreign key. |
That's the approach I was thinking of going for in gdal (it's what gdal uses for defining relationships in sqlite data sources too). But it feels messy to me, because then for gpkg we have two competing ways to define relationships. An application would then need to check both for foreign key constraints AND for the related tables extension in order to fully understand the relationships in a gpkg (and then take care not to incorrectly think that constraints involved in tables which follow the extension aren't relationships in themselves). It's a lot of complex and fragile logic which could be avoided if non -many to many relationships were instead officially supported and described in the specifications. |
When reading relationships, always read relationships defined using foreign key constraints regardless of whether or not the related tables extension is in use. The related table extension only permits definition of many-to-many relationships, so there's a strong case for supporting one-to-many relationships defined outside of this extension. In fact it's what's recommended upstream: opengeospatial/geopackage#678 (comment)
When reading relationships, always read relationships defined using foreign key constraints regardless of whether or not the related tables extension is in use. The related table extension only permits definition of many-to-many relationships, so there's a strong case for supporting one-to-many relationships defined outside of this extension. In fact it's what's recommended upstream: opengeospatial/geopackage#678 (comment)
Would you consider adding official support for one to many relationship types to the related tables extension? The requirement that all relationships must be many to many considerably complicates the specification for simple use cases, and makes working with relationships in geopackages in clients much trickier then it often needs to be.
The text was updated successfully, but these errors were encountered: