Open misteliy opened 4 years ago
Are there plans for this feature? It would be nice to have other constraints such as primary key and foreign key as well.
Are there plans for this feature? It would be nice to have other constraints such as primary key and foreign key as well.
No
Hmm, I think these topics should be discussed in the bigger context of data contracts, otherwise the contract features won’t be really useful. I think there might also be options to rethink as contracts and dbt tests somewhat are doing overlapping activities. I would prefer to define contracts and tests in a unified way…
Describe the feature
not null constraints are enforced by redshift. Hence it would be good to have a mechanism to enable them within the dbt framework
Describe alternatives you've considered
we created a post-hook macro that looks something like this: ALTER TABLE {{ this }} ADD COLUMN Temp varchar(32) not null default ''; UPDATE {{ this }} SET Temp = {{ column }}; ALTER TABLE {{ this }} DROP COLUMN {{ column }}; ALTER TABLE {{ this }} RENAME COLUMN Temp TO {{ column }};
Therefore creating a temp column, then copy, then drop the original and then rename. This is a very ugly hack and has also the problem that you need to specify a default value in the alter table command :/
Who will this benefit?
for all the redshift users it would be nice to leverage the constraint capabilities if enforced and hence this could be a nice add on.