Macro to check if two schemas contain the same relations
dbeatty10 opened this issue · comments
Describe the feature
compare_schemas
: given two schemas, determine their relative complements (AKA, set differences) similar to compare_relations
.
🚧 Further refinement would be necessary to determine which type(s) of atomic units should be compared.
The most simple approach would be to only compare relation names (and not compare the relation types, column names, row values, etc).
in_a | in_b | count | percent_of_total |
---|---|---|---|
True | True | 7 | 0.30 |
True | False | 10 | 0.43 |
False | True | 6 | 0.26 |
Setting a summarize
argument to false
could let you check which relations do not match between schemas:
relation_name | in_a | in_b |
---|---|---|
raw_orders | True | False |
raw_customers | False | True |
stg_orders | True | False |
stg_customers | False | True |
Describe alternatives you've considered
A legit option is to close this as wontfix
!
If we do choose to implement it, there are many different ways that two schemas could be compared, depending how deeply one wants to go. Anything beyond simple comparison of relation names within the schema could be deferred to more granular macros like compare_relations
(or completely different packages, like dbt-expectations
).
Additional context
The initial commit for this repo had the following to-dos:
- Macro to check if two models have the same structure
- Macro to check if two schemas contain the same relations
- Extend
check_equality
macro to handle edge cases
There is now only one remaining.
The main motivation for creating this issue is so that I can feel better about cleaning up the README by removing this from the bottom 😎
Who will this benefit?
🤷
Are you interested in contributing this feature?
No answer.
This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days.
Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest. Just add a comment to notify the maintainers.