Custom data quality checks

Hello!

We have been using liquibase for a while. We would now like to introduce checks on the data populated in the target tables from within Liquibase and raise alerts (with serverity levels such as fail, warn etc if possible ). The checks themselves would be sql select statements which would return a value of 0,1 or 2 based on data in the db tables.The process should stop if a 1 is returned by the check, as an example.

Is it possible to implement this in Liquibase? I looked into the “checks” functionality but couldn’t find an option to excute a custom check with an SQL statement as an input

We are faimiliar with preconditions in changesets and have included some checks in preconditions but that would need us to execute a dummy sql in the changeset itself, which we would like to avoid

Any suggestions would be much appreciated!

Thank you

Sounds like a perfect usage for preconditions. You can run a custom query and then take action depending on the result.

Thank you!

I guess that is the way to go. We were hoping there was another mechanism by which it would be possible to avoid specifying an SQL statement in the changeset itself

Regards

ok. I provided my answer based upon what you mentioned in your original question:

“The checks themselves would be sql select statements which would return a value of 0,1 or 2 based on data in the db tables”