Comments (3)
I should first point out that you can use the relationship test to create all your fk constraints unless you need to create a compound constraint with multiple columns. That is the main advantage over the out of the box test. I am traveling home from a vacation but I will review the links you provided on the outer join this weekend. Snowflake is ok with that SQL to test a fk constraint in an outer join.
from dbt_constraints.
I am about to merge my fix into main. Based on your information, I looked into the very latest SQL for the default relationship
test and exactly as you say, it uses a left join. I happen to know that Snowflake's query optimizer rewrites most IN
/ EXISTS
conditions to perform a LEFT JOIN
operation and I believe it makes sense for this to be the default SQL for foreign_key
since it is the default for the relationship
test.
In the process of my testing these changes on PostgreSQL I also identified an edge case involving constraints on seeds. During incremental runs dbt truncates such tables and this truncate will fail on PostgreSQL if there are any FK or PK/UK referenced by FK. I have added logic to drop constraints on tables before truncating.
from dbt_constraints.
Thank you Dan! Good to know re: single- and multi-column FK constraints. This package has seriously improved my quality of life
from dbt_constraints.
Related Issues (20)
- Feature request: add constraints to seeds HOT 2
- Disable constraint creation, after tests are run. HOT 1
- not_null failure where error tolerance HOT 1
- FK not created in Snowflake when you only have OWNERSHIP on a parent table
- Allow specification of custom materialization types for pk/fk/uk constraints HOT 3
- Decouple constraints from tests HOT 1
- Create constraint only on table recreation HOT 1
- Latest version 0.6.0 working on dbt-snowflake 1.4.1 (core version 1.4.5 HOT 2
- Add for BigQuery, since they now support FK & PK HOT 6
- Enhancement: Conditional foreign key test to support data vault HOT 1
- FK relationship to table already in the database HOT 1
- Is this package still needed if `dbt >= 1.5.0` ? HOT 3
- question regarding MATCH option on creating Snowflake constraints HOT 6
- Foreign Key constriants are not created in Snowflake database HOT 2
- Exclusion of a data catalog, database, or directory from a dbt_constraint build
- Foreign key constraints tested more than once HOT 2
- always_create_constraint is not working properly HOT 3
- Using constraints in models without name and column parameters HOT 2
- not_null constraint causing error on severity: warn with warn_if > 0 HOT 1
- Failed to create PK constraint if a table already has PK constraint on another column or columns HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dbt_constraints.