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

dbt-osmosis v1: Extra Fields Added to constraints in YAML File #212

Open
syou6162 opened this issue Feb 4, 2025 · 0 comments
Open

dbt-osmosis v1: Extra Fields Added to constraints in YAML File #212

syou6162 opened this issue Feb 4, 2025 · 0 comments

Comments

@syou6162
Copy link
Contributor

syou6162 commented Feb 4, 2025

Thanks to #204, I was able to update to dbt-osmosis v1. Thank you 👍 .

When I upgraded to v1, I noticed that extra elements were being added to the yaml file in cases where I was using constraints.

I'm assuming that the yaml file before running osmosis is as follows.

version: 2
models:
  - name: my_model
    config:
      contract:
        enforced: true
    columns:
      - name: item_id
        data_type: STRING
        constraints:
          - type: not_null

When running osmosis with the v1 series, extra elements are added to constraints as follows.

version: 2
models:
  - name: my_model
    config:
      contract:
        enforced: true
    columns:
      - name: item_id
        description: my description
        data_type: STRING
        constraints:
          - type: not_null
            name:
            expression:
            warn_unenforced: true
            warn_unsupported: true
            to:
            to_columns: []

It may seem harmless to add extra elements to yaml, but for example, to_columns is an option for foreign_key, so it shouldn't appear in the above not_null. I think that extra elements should not be added because it can cause confusion among developers in the team.

I think that constraints is included in ColumnInfo and that extra fields are added when from_dict is executed.

I don't know if it's easy to fix, but if it seems like it could be fixed, I was thinking of sending a pull request.

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