Skip to content

quote columns for foreign key and primary key constraints, if quote: true in column config #966

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

Conversation

samuelberntzen
Copy link
Contributor

Quotes/backticks are not applied for foreign key and primary key constraints in 1.10.0a1, even if the column's config specifies quote: true. By retrieving the (optional) quote argument from the column config in parse_column_constraints we can apply backticks to the constraint definition.

Resolves #965

Description

Modifies the parse_column_constraints to dynamically apply backticks on columns with foreign key and primary key constraints, if specified in the model's configuration:

    columns:
      - name: speciål_char_pk
        data_type: string
        quote: true
        constraints:
          - type: not_null
          - type: primary_key

Checklist

  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • [] I have updated the CHANGELOG.md and added information about my change to the "dbt-databricks next" section.

@benc-db
Copy link
Collaborator

benc-db commented Mar 19, 2025

Thanks for opening. Will run tests today.

@benc-db benc-db merged commit 0041c7f into databricks:1.10.latest Mar 19, 2025
6 checks passed
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