-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[CT-3329] [Bug] Unit testing errors with long CTE name given reasonable test name length #9015
Comments
We have some prior art for this. Postgres in particular has the 63-character limit; other DWHs have higher limits. dbt-core/plugins/postgres/dbt/include/postgres/macros/adapters.sql Lines 141 to 178 in bb35b3e
|
I ran into the same issue when testing this out, is there any way to make this CTE name shorter without requiring folks to have a shorter name for their unit test? |
@dave-connors-3 ran into this too. |
Is this a new bug in dbt-core?
Current Behavior
Long unit test names (in combination with long model name + input names) can lead to a "Relation name '{}' is longer than 63 characters" if the sum of lengths is > 63 (on postgres) characters.
Expected Behavior
No error
Steps To Reproduce
Changing the
test_my_model_incremental_yml
fixture from intest_unit_testing.py
:to:
Results in:
Relevant log output
No response
Environment
Which database adapter are you using with dbt?
No response
Additional Context
This is happening because the ephemeral fixture nodes are named based on the concatenation of: the model being tested, the name of the unit test, and the name of the input itself. This ensures they have globally unique names in the unit test manifest but is overkill for the purpose of naming the CTEs, which are local to a unit test case.
Options:
Shorten the name of the ModelNode for input fixtures to only include the name of the original input node -- assuming that node names don't need to be unique within a DAG. - These aren't used in a DAG, so this shouldn't be a concern.
Consider hashing to add extra layer of caution to avoid name duplication.
These are ephemeral names only they are not executable.
Testing Considerations:
The text was updated successfully, but these errors were encountered: