You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactored methods for loading and saving checks (#487)
## Changes
<!-- Summary of your changes that are easy to understand. Add
screenshots when necessary -->
* Moved all load and save checks methods from `DQEngine` to a separate
module. The previous approach of continuously expanding DQEngine was not
scalable or maintainable. This change will make it easier to add more
ways of saving and loading checks.
* Refactored code in various places to improve modularity and adhere to
the separation of concerns. The original `DQEngine` had grown beyond its
intended scope, so responsibilities were redistributed. The change
should provide a good basis for extensions without overloading the
engine.
* All conversion methods for checks (serialization and deserialization)
from/to dict and `DQRule` has been centralized in `checks_serializer`
module. It is now possible to convert checks defined in dict to `DQRule`
and vice versa. Detailed documentation is available
[here](https://databrickslabs.github.io/dqx/docs/reference/quality_rules/).
* Added support for saving checks to json file/workspace file
* Added validation of location when saving and loading checks
* Added validation of columns passed to `compare_datasets` check to make
sure only simple expressions are allowed
* Added parameter to `validate-checks` cli command to enable/disable
validating custom check functions (`validate-custom-check-functions`)
BREAKING CHANGES!
If you are loading or saving checks from a storage (file, workspace
file, table, installation), you are affected. We are deprecating the the
below methods. We are keeping the methods in the `DQEngine` but you
should update your code as these methods will be removed in future
versions.
* Loading checks to storage has been unified under `load_checks` method.
The following methods have been removed from the `DQEngine`:
`load_checks_from_local_file`, `load_checks_from_workspace_file`,
`load_checks_from_installation`, `load_checks_from_table`.
* Saving checks in storage has been unified under `load_checks` method.
The following methods have been removed from the `DQEngine`:
`save_checks_in_local_file`, `save_checks_in_workspace_file`,
`save_checks_in_installation`, `save_checks_in_table`.
The `save_checks` and `load_checks` take `config` as a parameter, which
determines the storage types used. The following storage configs are
currently supported:
* `FileChecksStorageConfig`: file in the local filesystem (YAML or JSON)
* `WorkspaceFileChecksStorageConfig`: file in the workspace (YAML or
JSON)
* `TableChecksStorageConfig`: a table
* `InstallationChecksStorageConfig`: storage defined in the installation
context, using either the `checks_table` or `checks_file` field from the
run configuration.
* The `load_run_config` method has been moved to
`config_loader.RunConfigLoader`, as it is not intended for direct use
and falls outside the `DQEngine` core responsibilities.
### Tests
<!-- How is this tested? Please see the checklist below and also
describe any other relevant tests -->
- [x] manually tested
- [x] added unit tests
- [x] added integration tests
0 commit comments