I have a dbt model thats being materialised as a table.
-- models/my_model.sql
with my_model as (
select
column1,
column2,
column3
from
source_table
)
select
column1,
column2,
column3
from
my_model
I want it to use a "NOT ENFORCED" qualifier when a table is created. Something with this equivalent:
ALTER TABLE my_model
ADD primary key(colmn1) NOT ENFORCED
The not enforced qualifier will help identify the primary key and will optimise queries when run.
How can I do that in DBT?
Im new to DBT and couldn't find any resources that talks about the PK creation.
the post-hook to add the primary key constraint resolved the issue