Get Snowflake Projects Live Faster. Reliably.

Register for webinar
Back to Product Updates

sql_header and set_sql_header

SQL headers allow you to manipulate the current session settings, such as roles and timezones, or create functions, directly within your asset's run session.

{{ config(
sql_header="alter session set timezone = 'Europe/London';"
) }}
{% call set_sql_header(config) %}
create or replace ssn_mask(ssn STRING)
returns STRING
language SQL
AS '
    REGEXP_REPLACE(ssn, ''[0-9]'', ''X'') /* 123-45-6789 -> XXX-XX-XXXX */
';
{%- endcall %}

select ssn_mask(ssn) from {{ ref('model_name') }}

Dive deeper →