The problem I’m having
I’d like to ask a another way of apply primary key in aws redshift
The context of why I’m trying to do this
how to set primary key in dbt for redshift
What I’ve already tried
I used ‘post_hook’ and COPY and ADD
Some example code or error messages
{{
config(
materialized='table',
...
post_hook=[
"ALTER TABLE {{ this }} ADD COLUMN Temp bigint not null DEFAULT 0",
"UPDATE {{ this }} SET Temp = transaction_id",
"ALTER TABLE {{ this }} DROP COLUMN transaction_id",
"ALTER TABLE {{ this }} RENAME COLUMN Temp TO transaction_id",
"ALTER TABLE {{ this }} ADD PRIMARY KEY (transaction_id)"
]
)
}}