The problem I’m having
I have to change the collation of a dbt Model so that when it would execute it will have the required collation.
The context of why I’m trying to do this
This I need to do because of some requirements of the column values.
What I’ve already tried
I have tried to change the collation after model execution but I need some help to change the collation in dbt Model.
1 Like
The easiest way I know to apply a collation to a column in a dbt model is to use the COLLATE function like this:
select
1 as id,
COLLATE('text1', 'en-ci-ps-trim') as collated_col
Note: this will only apply the collation to the collated_col column. So if you have 100 columns that you want to apply this collation to, you’d need to apply the COLLATE function 100 times.
Outside of dbt, Snowflake also provides other ways to set the default collation.