Four practical checks for discovering database relationships before building your next dbt model.
You inherit a database with hundreds of tables.
Foreign keys are missing. Documentation is outdated. The person who designed the schema left two years ago.
Your task sounds simple: build a new data model.
But before writing the SQL, you need to figure out how everything connects.
If you've ever worked with a legacy database, you probably know this feeling.
Here are four checks that can make the process a little less painful.
1. Stop Relying on Column Names
Consider these three columns:
orders . buyer_ref customers . customer_id accounts . account_id
Enter fullscreen mode
Exit fullscreen mode
Which one should you join to orders.buyer_ref ?
Similar column names don't necessarily indicate a relationship. Different column names don't necessarily rule one out.
Start by examining data types, value formats, and existing model definitions.
Treat column names as clues, not evidence.
2.…