GithubHelp home page GithubHelp logo

Comments (3)

sfc-gh-dflippo avatar sfc-gh-dflippo commented on September 18, 2024

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.

sfc-gh-dflippo avatar sfc-gh-dflippo commented on September 18, 2024

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.

skwaugh avatar skwaugh commented on September 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.