Constraints look very cool <https://docs.getdbt.co...
# plugins-dbt
t
a
And also:
Snowflake suppports four types of constraints:
unique
,
not null
,
primary key
and
foreign key
.
It is important to note that only the
not null
(and the
not null
property of
primary key
) are actually checked today. There rest of the constraints are purely metadata, not verified when inserting data.
Currently, Snowflake doesn't support the
check
syntax and dbt will skip the
check
config and raise a warning message if it is set on some models in the dbt project.
🙂
Redshift currently only enforces
not null
constraints; all other constraints are metadata only. Additionally, Redshift does not allow column checks at the time of table creation. See more in the Redshift documentation here.
BigQuery allows defining
not null
constraints. However, it does not support or enforce the definition of unenforced constraints, such as
primary key
.
Ties into a conversation I was recently having with @Will Da Silva (Arch). Many big data platforms have dropped (real) support for uniqueness and foreign key constraints, due to the scaling limitations when applied to a platform that stores all table data in separate logical files/shards.
the "not null" constraints are only evaluated one row at a time, so won't present any scaling limitations. All the others do require some type of sort operation and/or cross-node communication.