We are using dbt 0.21.0, which we just updated to. We have a basic 3-column table,
gs__cte_player_draftboard, that looks like this:
There are no missing values or any oddities in this table, no arrays or structs. We are testing for duplicates via the following test:
- name: gs__cte_player_draftboard tests: - unique: column_name: "concat(playerId, '-', draftCompetitionId)" - not_null: column_name: "playerId" - not_null: column_name: "draftCompetitionId"
th unique test is compiling into
select count(*) as failures, count(*) != 0 as should_warn, count(*) != 0 as should_error from ( select concat(playerId, '-', draftCompetitionId) as unique_field, count(*) as n_records from `ourproject`.`ourdataset`.`gs__cte_player_draftboard` where concat(playerId, '-', draftCompetitionId) is not null group by concat(playerId, '-', draftCompetitionId) having count(*) > 1 ) dbt_internal_test
we are getting the following error:
Database Error in test unique_gs__cte_player_draftboard_concat_playerId_draftCompetitionId_ (models/ctes/schema.yml) SELECT list expression references column playerId which is neither grouped nor aggregated at [12:12] compiled SQL at ...
This seems like a dbt 0.21 problem, because this test was not failing when we were using dbt 0.16. This is such a strange error because it is such a basic test on such a basic table… any thoughts on how we can resolve, other than changing dbt versions?