NOT NULL redshift constraint
- Dominant language
- PLpgSQL
- Stars
- 105
- Forks
- 39
- PR merge metrics
- No merged PRs in 30d
Description
### 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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.