Reputation: 1231
I am following the ELT framework for modeling data in a Snowflake warehouse. I am working with a raw table that contains unprocessed data coming from logs.
In this table, there is a UUID field that has been polluted with very long JSON strings. I am working on filtering these JSON strings out. However, I keep running into the error String... is too long and would be truncated
.
What I've tried:
LEN(id_field) < 100
and
TRY_CAST(id_field as VARCHAR(100))
The TRY_CAST method would be perfect if I could specify that the field should be null upon failure but it doesn't seem to behave that way? Parsing the field into a dict doesn't work either as the id values fail due to not having a key.
Upvotes: 3
Views: 15935
Reputation: 2645
You can just do something like LEFT(COLUMN::varchar,100)
that will truncate any value over 100
Upvotes: 3