Skip to content

Right truncation of string data for UDF/XSP/UDM udf_md5 during snapshot execution #229

@rafaelkrysciak

Description

@rafaelkrysciak

Describe the bug

While running snapshot,s the following error might occur:

[Error 7500] Right truncation of string data for UDF/XSP/UDM udf_md5.

The root cause is in the teradata__snapshot_hash_arguments macro. The to-be-hashed attributes are cast to varchar(50). If the original value exceeds 50 characters, the mentioned error is displayed.

{% macro teradata__snapshot_hash_arguments(args) -%}
{% set hashing_function = config.get('snapshot_hash_udf', 'HASHROW') %}
{{ hashing_function }}({%- for arg in args -%}
coalesce(cast({{ arg }} as varchar(50)), '')
{% if not loop.last %} || '|' || {% endif %}
{%- endfor -%})
{%- endmacro %}

I would suggest increasing the length to 500 or even 5000 characters.

Steps To Reproduce

Call a hashing function, such as surrogate_key, on a column that exceeds 50 characters in length and contains values exceeding 50 characters.

Expected behavior

generating a hash without error

Screenshots and log output

If applicable, add screenshots or log output to help explain your problem.

The output of dbt --version:

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

Plugins:
  - teradata: 1.10.0 - Up to date!

The operating system you're using:
Windows 11
The output of python --version:
Python 3.12.2

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions