-
Notifications
You must be signed in to change notification settings - Fork 19
Description
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.
dbt-teradata/dbt/include/teradata/macros/materializations/snapshot/strategies.sql
Lines 2 to 10 in 6921ff1
| {% 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.