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

[Feature] include foreign key IDs in end models #67

Open
2 of 4 tasks
fivetran-jamie opened this issue Apr 7, 2023 · 0 comments
Open
2 of 4 tasks

[Feature] include foreign key IDs in end models #67

fivetran-jamie opened this issue Apr 7, 2023 · 0 comments

Comments

@fivetran-jamie
Copy link
Contributor

Is there an existing feature request for this?

  • I have searched the existing issues

Describe the Feature

In our end models, we do not currently include foreign key IDs in the final CTE.

Currently, we use these FKs to join in information about their entities (i.e. subsidiaries, locations, vendors, departments, entity), which we bring into the end model's final CTE. This leaves information without an easy way to join back to the source entity from which the info came. Moreover, we don't bring in ALL the information available in these joins. Having the ID in there lets people grab more info than we are (but maybe we should bring in more fields by default as well?)

Describe alternatives you've considered

To get around this, I created passthrough columns that basically copy the foreign key ID fields and alias them so as to not cause duplicate column errors. Then, in a model in my own dbt project, I rename the the aliased FK field to its original name (since the FK has been excluded from our end models)

the dbt_project.yml looks like

vars:
  transaction_lines_pass_through_columns:
    - name: "department_id" 
      alias: "department_id_copy"
    - name: "subsidiary_id"
      alias: "subsidiary_id_copy"
    - name: "location_id"
      alias: "location_id_copy"

this is a messy and a lil annoying to do (but functional)

Are you interested in contributing this feature?

  • Yes.
  • Yes, but I will need assistance and will schedule time during your office hours for guidance.
  • No.

Anything else?

No response

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

No branches or pull requests

1 participant