Back to All

Primary Keys and Foreign Keys

Good morning,

I have a question around PK and FK identification to help with automation of PK and FK checks.

Is there a way of using a Jinja to customise a node such that I can access the columns that make up the PK in the snowflake table.

For example I have 700 tables with different PK's. I want to perform some kind of check or create a view (using a View Node) over each table using the PK columns of each table to generate a lead or lag column.

I don't want to have to manually define each business key (same as the PK in this case) for each view node.

Ideally I would use Jinja to pull through the PK columns for each source table and build by lead or lag function column that way.

I hope that makes sense?

Appreciate your feedback.

Cheers, Chris