Repository navigation
What's Changed
- Constraints now use a test's own
quote_columnssetting. Before, the package quoted columns in the test SQL but created the constraint with the hook's global setting, so theALTER TABLEfailed on a column that needs quotes, such as"OrderKey". Aquote_columns: "false"string no longer counts as true. Credit goes to @kokorin for the fix. dbt_constraints_enabled: falsenow turns a test's constraint off wherever you set it. A test can set the flag underconfig:or underconfig: meta:. Before, afalsein one place was ignored if the other place still had its default of true. Usemeta: dbt Fusion rejects an unknown key directly under a test'sconfig:, and dbt-core 1.5 drops it. Fixes #137.- New opt-in var
dbt_constraints_skip_tests_if_enforced. When it is true, aprimary_key,unique_keyorforeign_keytest is skipped if the database already enforces a validated constraint that proves it. The test still compiles to its full SQL, wrapped inwhere 1 = 0, and the package logs the constraint it relied on. This helps large incremental models on PostgreSQL, Oracle and Vertica. A constraint that isNOT VALID,ENABLE NOVALIDATE,DISABLED, RELY-only, or that allows repeated NULLs does not count. Snowflake, Redshift and BigQuery enforce only NOT NULL, so their key tests never skip. See the README section "Skipping tests that the database already enforces". Fixes #114. - Vertica fixes.
- A foreign key is now created only when the parent table has a primary key on the referenced columns. Vertica rejects a foreign key that references a unique key (error 4550), so before, such a constraint failed. Now the package skips it with a log message.
- The privilege check now reads
v_catalog.tablesandv_catalog.grants. The previous query usedinformation_schema.table_privileges, which Vertica does not have.
- The integration tests now include a Vertica 25.4 cell, so the Vertica macros are tested against a real database for the first time.
Full Changelog: 1.0.11...1.0.12