Avoid Sort on Dbt Core Model - Snowflake

26 Views Asked by At

How can I avoid sorting in my DBT core model when loading data into Snowflake? I have a Snowflake cluster defined on two columns. When I run the job, I notice that DBT automatically adds an ORDER BY clause, which reduces Snowflake's performance. I want to prevent DBT from automatically adding the ORDER BY clause. I have tried the below options, but they are not working.

I have tried the below code in my DBT core model

{{ config( materialized='table', cluster_by=['period_name','version'], sort= none ) }}

select * from table

{% if execute.materialized %} {{ query_without_order_by }} ORDER BY {{ sort }} {% else %} {{ query_without_order_by }} {% endif %}

0

There are 0 best solutions below