Can I validate whether my SQL query should merge data from my source table to destination?


I have a SQL query that merges data from a staging table to a destination table and I have a handful of test cases that I would like to use to validate if the merge query should insert those records from the staging table or not.
e.g. one test case would be, given a staging table with 1 record, a final table, and the merge statement, should the data from the staging table be inserted into the destination table.

Is there an expectation that exists for this sort of validation?

Hey @jimmy3142! Thanks for reaching out.

There isn’t an extant expectation for this use-case; however, this seems like a great case for a Custom Query Expectation! See our docs here, and some examples that begin with expect_queried_... in this directory.

1 Like