Compare two models' schemas

Hi All,
working on dbt test cases, is there any way we can do schema check? like compare schema between existing model and new source model schema?

Thanks

alex

1 Like

@xzheng
Unfortunately I have not seen this before in the ecosystem but it might be possible to create by doing something with the dbt-expectations packages’ helper functions.
Something in the structure of expect_table_row_count_to_equal_other_table where you compare the _get_column_list.sql from each side?

Just an idea. Good luck.

It sounds like you might want something like our audit helper package: dbt - Package hub

It lets you compare two Relations (e.g. tables and views) to check that a refactored model still works the same way. Check out How to not lose your mind when auditing data for a deeper dive on how it works!