Testing changes to models
To run unit tests for your models, run the
sqlmesh test command as follows:
For more information about tests, refer to testing.
Test changes to a specific model
To run a specific model test, pass in the suite file name followed by
:: and the name of the test; for example:
sqlmesh test tests/test_suite.yaml::test_example_full_model.
Run a subset of tests
To run a test that matches a pattern or substring, use the following syntax:
sqlmesh test tests/test_example*.
Running the above command will run our
test_example_full_model test that we ran earlier using
As another example, running the
sqlmesh test tests/test_order* command would run the following tests:
Auditing changes to models
To audit your models, run the
sqlmesh audit command as follows:
By default, SQLMesh will halt the pipeline when an audit fails in order to prevent potentially invalid data from propagating further downstream. This behavior can be changed for individual audits by defining them as non-blocking.
For more information about audits, refer to auditing.