Closed edbizarro closed 3 years ago
@edbizarro I see you switched on query-comment.job-label
, which is new in v0.20.0. The way that feature works:
The latter is what's happening here. Unfortunately, the error BigQuery is giving back is a bit misleading:
Label value "__database____REDACTED____schema____dev_edbizarro____identifier____stg_facebookads__ads__" has invalid characters.
The real issue here is that labels are limited to 63 characters in length (docs), and this string is 89 characters in length. If I shorten the string to 63 characters, everything works just fine.
In the original PR for this feature, we discussed potential approaches for handling too-long labels: https://github.com/dbt-labs/dbt/pull/3145#discussion_r598050639. The options are:
We picked the third option. Given the lack of clarity BigQuery's error message, and the ensuing confusion indicated by this issue, I think there's good reason to prefer the second: I think we should raise a compilation error any time query-comment.job-label
is switched on and a label value would be >63 characters.
That should be a straightforward change. Is it something you'd be interested in contributing @edbizarro?
In any event, you'll need to work around this error by:
query_comment
macro to return a dictionaryquery_comment
macro to return a shorter string (post-sanitization)query-comment.job-label
@jtcohen6 I'm happy to take this issue on if @edbizarro doesn't want to!
@sungchun12 I'd love that!
@jtcohen6 This is officially in my personal backlog that I'll spend the next week or so focusing on!
I'll be diving into #3145. And I'm assuming the solution to this problem will be extending the validations and raising specific error messages in functions like: this and/or create another function dedicated to verifying string length after sanitization.
@sungchun12 Sure! I really want to take this challenge but unfortunately I'm little short in time this next weeks so i would love that someone taking on this, thanks!
@sungchun12 Yes! I think _sanitize_label
raising a ValidationException
if passed a string longer than 63 characters will get the job done.
Describe the bug
After migrating to v0.20.0 my jobs keep failing with the following error:
Steps To Reproduce
Config labels in dbt_project.yml
Run any model
Expected behavior
Screenshots and log output
If applicable, add screenshots or log output to help explain your problem.
System information
Which database are you using dbt with?
The output of
dbt --version
:The operating system you're using: Arch Linux
The output of
python --version
:Running through official docker image
Additional context
Add any other context about the problem here.