Skip to content
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

Support relationships based on built-in functions (i.e. st_within) #10686

Open
olmohake opened this issue Feb 14, 2025 · 1 comment
Open

Support relationships based on built-in functions (i.e. st_within) #10686

olmohake opened this issue Feb 14, 2025 · 1 comment
Labels
c/v3-engine V3 Metadata and Engine c/v3-ndc-postgres Data connector for PostgreSQL k/enhancement New feature or improve an existing feature

Comments

@olmohake
Copy link

Component

v/3-engine
v/3-ndc-postgres

Is your proposal related to a problem?

We manage a large number of tables with entries related through geometry columns instead of foreign keys. For instance, a table of buildings with geometries and tables like districts or housing zones with corresponding geometries. Given the frequent changes in zoning and the high number of relationships, calculating and storing foreign keys is impractical.

Describe the solution you'd like

It would be useful to define relationships via built-in functions like ST_Within instead of just foreign key mapping.

kind: Relationship
version: v1
definition:
  name: buildings
  sourceType: District
  target:
    model:
      name: Buildings
      relationshipType: Array
  mapping:
    - function:
         functionName: st_within
         arguments:
             - target:
                 fieldPath:
                    - fieldName: geometry
             - source:
                 fieldPath:
                    - fieldName: geometry

Describe alternatives you've considered

Creating native operations and mapping them to commands, but this approach is impractical due to the large number of operations required just to enable data joins.

@olmohake olmohake added the k/enhancement New feature or improve an existing feature label Feb 14, 2025
@olmohake olmohake changed the title Support relationships using joins based on built-in functions (i.e. st_within) Support relationships based on built-in functions (i.e. st_within) Feb 14, 2025
@robertjdominguez robertjdominguez added c/v3-engine V3 Metadata and Engine c/v3-ndc-postgres Data connector for PostgreSQL labels Feb 14, 2025
@robertjdominguez
Copy link
Contributor

Thanks for this addition, @olmohake 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/v3-engine V3 Metadata and Engine c/v3-ndc-postgres Data connector for PostgreSQL k/enhancement New feature or improve an existing feature
Projects
None yet
Development

No branches or pull requests

2 participants