dbt-labs / dbt-labs-experimental-features

dbt support for database features which are not yet supported natively in dbt-core
Apache License 2.0
147 stars 43 forks source link

Relation name 'xyz__dbt_incremental_period0_tmp' is longer than 63 characters #35

Open moltar opened 2 years ago

moltar commented 2 years ago

Describe the bug

We have a model with a long name.

When we use materialized: insert_by_period and the suffix is appended by dbt-utils, the resulting model name is too long.

Steps to reproduce

Use a model name that is 62 characters.

Expected results

Not result in an error and have the ability to override the name.

Actual results

An error is thrown:

20:41:47    Relation name 'xyz__dbt_incremental_period0_tmp' is longer than 63 characters

Screenshots and log output

N/A

System information

The contents of your packages.yml file:

Which database are you using dbt with?

The output of dbt --version:

Core:
  - installed: 1.2.0
  - latest:    1.2.0 - Up to date!

Plugins:
  - postgres: 1.2.0 - Up to date!

Additional context

The fix for PostgreSQL was implemented here: https://github.com/dbt-labs/dbt-core/pull/4921

I think changing the code to:

{%- set tmp_identifier = make_temp_relation(model['name'], '__dbt_incremental_period' ~ i ~ '_tmp') -%}

Should solve the problem.

Are you interested in contributing the fix?

joellabes commented 2 years ago

Hi @moltar! We're in the process of extracting the insert_by_period materialization from this project and moving it to the experiments repo, to better reflect its level of maturity.

Once that move is complete, we'd welcome a PR to incorporate this fix!