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

Ensure 'name' is the first column when exporting in dbt format, considering column attributes #541

Conversation

syou6162
Copy link
Contributor

@syou6162 syou6162 commented Dec 10, 2024

Currently, exporting in dbt format will output the following yaml(datacontract export --format dbt-sources --output datacontract.yml input.yml).

version: 2
sources:
- name: my-data-contract-id
  tables:
  - name: my_product
    description: product table
    columns:
    - data_type: STRING
      description: product id
      tests:
        - not_null
        - unique
      meta:
        ...
      name: product_id

This yaml is valid as dbt yaml, but the column name is the last of the column attributes. Since the column name is the first attribute we want to see, this pull request modifies the column name so that it is the first of the column attributes.

  • Tests pass
  • ruff format
  • README.md updated (if relevant)
  •  CHANGELOG.md entry added

@syou6162 syou6162 force-pushed the take_care_column_fields_order_dbt_sources branch from e5a3ad8 to 8b76d74 Compare December 10, 2024 12:01
@syou6162 syou6162 marked this pull request as ready for review December 10, 2024 12:13
@simonharrer
Copy link
Contributor

Good idea! Thanks for your contribution. :-)

@simonharrer simonharrer merged commit 7d34626 into datacontract:main Dec 10, 2024
5 checks passed
@syou6162 syou6162 deleted the take_care_column_fields_order_dbt_sources branch December 10, 2024 13:01
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

Successfully merging this pull request may close these issues.

2 participants