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

Add add_column_relationship method to single table metadata #1699

Closed
amontanez24 opened this issue Nov 29, 2023 · 0 comments · Fixed by #1716
Closed

Add add_column_relationship method to single table metadata #1699

amontanez24 opened this issue Nov 29, 2023 · 0 comments · Fixed by #1716
Assignees
Labels
feature request Request for a new feature
Milestone

Comments

@amontanez24
Copy link
Contributor

amontanez24 commented Nov 29, 2023

Problem Description

As a user, I'd like to be able to specify when certain columns are related (eg. address columns) so that the SDV can handle them appropriately.

Expected behavior

Add a new method to the metadata classes called add_column_relationship.

  • Single table
    • add_column_relationship(type: str, column_names: list)
      • type: A string with the type of relationship. Only possibility for now is "address"
      • column_names: A list of column names
metadata.add_column_relationship(
  type="address",
  column_names=["vendor_city", "vendor_state", "vendor_zipcode", ...]
)

Calling this method should add the relationship to the metadata so tat inspecting the metadata yields

{
  "columns": {
    "user_lat": { "sdtype": "latitude" },
    "user_lon": { "sdtype": "longitude" },
  },
  "column_relationships": [{
    "type": "gps_coordinate",
    "column_names": ["user_lat", "user_lon" ],
  }]
}
  • Multi table
    • add_column_relationship(type: str, table_name: str, column_names: list)
      • type: A string with the type of relationship. Only possibility for now is "address"
      • table_name: Name of the table that the relationship is in.
      • column_names: A list of column names

Calling this method should add the relationship to the metadata so tat inspecting the metadata yields

{
  "tables": {
    "users": {
      "columns": {
         "user_lat": { "sdtype": "latitude" },
         "user_lon": { "sdtype": "longitude" },
      },
      "column_relationships": [{
         "type": "gps_coordinate",
         "column_names": ["user_lat", "user_lon" ],
      }]
    }
  },
  "relationships": [{
    ...
  }]
}

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Request for a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants