ccao-data / data-architecture

Codebase for CCAO data infrastructure construction and management
https://ccao-data.github.io/data-architecture/
6 stars 4 forks source link

Fix `select_data_test_iasworld` selector by using set intersection #650

Closed jeancochrane closed 1 week ago

jeancochrane commented 1 week ago

This PR fixes a bug in our select_data_test_iasworld selector that I introduced in https://github.com/ccao-data/data-architecture/pull/638. The resource_type:test filter should be joined to the tag:data_test_iasworld filter using an intersection rather than a union. If we use a union instead, the selector will return all data tests instead of only data tests tagged with data_test_iasworld. I noticed this while debugging a failing workflow that was running the wrong number of tests. I mixed this up because union has a special meaning the case of the existing exclude filter, since that filter always returns a set difference.

I double-checked this change by inspecting the output of this query and confirming that the list of tests looked correct:

dbt list -q --selector select_data_test_iasworld

I also compared this to the non-YAML version of the selector to confirm they produce identical results:

dbt list -q --select tag:data_test_iasworld,resource_type:test --exclude tag:data_test_iasworld_exclude_from_workbook