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] Show model-level constraints (PK, FK) in dbt docs #536

Closed
2 tasks done
thmswt opened this issue Jan 8, 2025 · 1 comment
Closed
2 tasks done

[Feature] Show model-level constraints (PK, FK) in dbt docs #536

thmswt opened this issue Jan 8, 2025 · 1 comment
Labels
dbt-docs duplicate This issue or pull request already exists enhancement New feature or request triage

Comments

@thmswt
Copy link

thmswt commented Jan 8, 2025

Is this a new bug in dbt-core?

  • I believe this is a new bug in dbt-core
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

When defining constraints on model-level in the schema.yml file and then executing dbt docs generate && dbt docs serve, the columns constraint is not set.

Expected Behavior

The CONSTRAINT value should be set to PK for this example.
More generally, the expected behavior should be that there is no difference between setting the constraints at the column level or at the model level for the presentation of the value within the dbt documentation.

Steps To Reproduce

Initiate and configure a dbt project with:
dbt init

Add the model-level constraint to the my_first_dbt_model model:

constraints:
      - type: primary_key
        columns: [id]

Run dbt docs generate && dbt docs serve

The CONSTRAINT value is empty for the column id:
image

Relevant log output

No response

Environment

- OS: macOS Sequoia 15.2
- Python: 3.11.11
- dbt: 
Core:
  - installed: 1.9.1
  - latest:    1.9.1 - Up to date!

Plugins:
  - bigquery: 1.9.0 - Up to date!

Which database adapter are you using with dbt?

bigquery

Additional Context

No response

@thmswt thmswt added bug Something isn't working triage labels Jan 8, 2025
@dbeatty10 dbeatty10 transferred this issue from dbt-labs/dbt-core Jan 10, 2025
@dbeatty10 dbeatty10 added enhancement New feature or request and removed bug Something isn't working labels Jan 10, 2025
@dbeatty10 dbeatty10 changed the title [Bug] model-level constraints not set in dbt docs [Feature] Show model-level constraints (PK, FK) in dbt docs Jan 10, 2025
@dbeatty10
Copy link
Contributor

Thanks for reaching out about this @thmswt !

What you are saying makes sense 💡 This is a feature request for the dbt-docs repo, so I've transferred this from https://github.com/dbt-labs/dbt-core/issues/11198 to #536 and updated labels accordingly. This is also covered in #507 (which had been closed as "stale"), so I'm going to re-open the original one and close this one as a duplicate.

@dbeatty10 dbeatty10 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 10, 2025
@dbeatty10 dbeatty10 added duplicate This issue or pull request already exists and removed triage labels Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dbt-docs duplicate This issue or pull request already exists enhancement New feature or request triage
Projects
None yet
Development

No branches or pull requests

2 participants