Skip to content

Conversation

@ericj-db
Copy link
Collaborator

Resolves #

Description

Fix to ensure that default (i.e. auto) query tag values are not invalid

  • Escape special characters (FWIW, model names are more restrictive than query tag values but doesn't hurt to have extra layer of defense)
  • Truncate values greater than 128 characters

Tested using a model with name accepted_values_backhaulcontractschedule_site_category_3__Non_Served_Sites__New_Sites__Served_Sites__Non_HS_Sites__Served_Site__CHARACTERS_BEYOND_128

Screenshot 2025-11-25 at 3 11 37 PM

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.

escaped_value = QueryTagsUtils.escape_tag_value(key, value, "Default tags")

if len(escaped_value) > 128:
logger.warning(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we want to emit a warning, because this is not something the user can really take action on. Maybe just debug?

benc-db
benc-db previously approved these changes Nov 25, 2025
Copy link
Collaborator

@benc-db benc-db left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve with minor comment.

@github-actions
Copy link

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  dbt/adapters/databricks
  utils.py
Project Total  

This report was generated by python-coverage-comment-action

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.

3 participants