-
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
Relation name '*__dbt_tmp' is longer than 63 characters #2869
Comments
Thanks for opening, @moltar! I agree, this is peskier than it could be. Following the discussion about this over in #2850, the real max character length of a model name on Postgres is currently 51, because of the appended suffix I think we could do as you recommend, and truncate the model name (if >51 characters) to accommodate the suffix. I view that as a reasonable next step on top of the work in #2850, which handles the truncation of uniquely suffixed identifiers in the incremental materialization. |
Thank you. I see this tagged as I'd like to note that Redshift names seem to allow names of 127 bytes long. https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_TABLE_NEW.html |
With snapshots the suffix is even longer, e.g. dbt_tmp20201206072656412865. If you add _snapshot to the relation name, not much characters are left to use for the relation name. |
Regarding the proposal of truncating the model name, I see a potential overlapping issue: you could have 2 models running in parallel, with a long common prefix in the name. If we truncate the model name, the tmp tables created by dbt could end up having exactly the same name. |
@danielefrigo A hash of the model name makes a lot of sense to me! I'd still like to keep the conventional suffixes ( |
I'm interested in tackling this as a first issue. After digging into the code some, it looks like it could potentially be handled in a couple of places:
Do either of these seem like an appropriate approach? |
@epapineau I'd be excited to have you contribute this one! I think having the truncation/hashing logic live inside the Postgres adapter makes the most sense. Of the two approaches you've recommended, I'd hesitate to add it to the My instinct would be to follow the same approach we took with
So I think the move is:
|
Describe the bug
My view name is pretty long, but it is less than 63 characters.
When dbt adds the
__dbt_tmp
suffix, it goes over the limit of 63 chars.The following error is thrown by PostgreSQL:
Steps To Reproduce
dbt run
Expected behavior
To work anyways.
Screenshots and log output
See above.
System information
Which database are you using dbt with?
The output of
dbt --version
:Using Docker image
fishtownanalytics/dbt:0.18.1
.The operating system you're using:
Using Docker image
fishtownanalytics/dbt:0.18.1
.The output of
python --version
:Using Docker image
fishtownanalytics/dbt:0.18.1
.Additional context
Perhaps the temporary name can be truncated by the length of the suffix to make sure it fits within the limits?
The text was updated successfully, but these errors were encountered: