Skip to main content

Data Checks

License Python

Create, schedule, and deploy data quality checks.

Overview

Exisiting data observability solutions are painfully static. data_checks provides a dynamic data observability framework that allows you to reuse existing Python code and/or write new Python code to define data quality checks that can then be easily scheduled and monitored. Inspired by Python's unittest, data_checks allows you to write data quality checks as easily and seamlessly as you would write unittests on your code.

Quickstart

1) Installation

Install the latest version of data_checks using pip:

pip install pydata-checks

2) Start a Data Check project

Initialize a new data_checks project by using the init command from your project directory (/Users/USERNAME/Desktop/PROJECT_NAME):

python -m data_checks.init

This will start a series of prompts that will guide you through the process of initializing a new data_checks project. For example:

$ python -m data_checks.init
Enter the relative file path of the directory where suites will be stored: my_first_data_checks_project/suites
Directory '/Users/USERNAME/Desktop/PROJECT_NAME/my_first_data_checks_project/suites' does not exist.
Would you like to create it? [y/n]: y
Enter the relative file path of the directory where checks will be stored: my_first_data_checks_project/checks
Directory '/Users/USERNAME/Desktop/PROJECT_NAME/my_first_data_checks_project/checks' does not exist.
Would you like to create it? [y/n]: y
Enter the default CRON schedule: * * * * *
Enter the database URL: database_url
Enter the alerting endpoint URL:
check_settings.py generated.
my_first_data_check.py generated.

This will create a new directory with the following structure:

PROJECT_NAME
├── my_first_data_checks_project
│   ├── __init__.py
│   ├── checks
│   │   ├── __init__.py
│   │   └── my_first_data_check.py
│   ├── suites
│   │   ├── __init__.py
├── check_settings.py

3) Set the CHECK_SETTINGS_MODULE to point to the check_settings.py file

export CHECK_SETTINGS_MODULE=check_settings

4) Run the autogenerated data check

python -m data_checks.do.run_check MyFirstDataCheck

Output:

[1/1 checks] MyFirstDataCheck
	[1/2 Rules] rule_my_first_failed_rule
This rule failed
DataCheckException(severity=1.0, exception=This rule failed, metadata={'rule': 'rule_my_first_failed_rule', 'params': {'args': (), 'kwargs': {}}})
	[2/2 Rules] rule_my_first_successful_rule
		rule_my_first_successful_rule took 0.0 seconds

5) Modify the autogenerated data check

Open up the my_first_data_checks_project/checks.my_first_data_check.py file and customize the data check to your liking. For instance, you can modify the rule_my_first_failed_rule to always pass by removing the exception:

from data_checks.classes.data_check import DataCheck


class MyFirstDataCheck(DataCheck):
    ...

    def rule_my_first_failed_rule(self):
        # This rule will now succeed
        assert True, "This rule now succeeds"

    ...

Rerun the data check:

python -m data_checks.do.run_check MyFirstDataCheck

Output:

[1/1 checks] MyFirstDataCheck
	[1/2 Rules] rule_my_first_successful_rule
		rule_my_first_successful_rule took 9.5367431640625e-07 seconds
	[2/2 Rules] rule_my_first_failed_rule
		rule_my_first_failed_rule took 9.5367431640625e-07 seconds

:tada: Congrats! :tada: You've created and executed your first data check! See the documentation for more information on how writing more advanced checks, suites, and other features like scheduling and alerting.

Release files for pydata-checks 0.0.83

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydata-checks 0.0.83
File Size Uploaded
pydata_checks-0.0.83.tar.gz 28.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pydata-checks 0.0.83
File Interpreter ABI Platform
pydata_checks-0.0.83-py3-none-any.whl Python 3 none any Details

Total release size: 76.1 kB

Release files / pydata_checks-0.0.83.tar.gz

Download URL pydata_checks-0.0.83.tar.gz
Size 28.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4eb66e68af2f1a9344032ec4591deb72957c5421f7e4458d8c2b7d1d75cf0d6c
BLAKE2b-256 checksum
How to use checksums
94e6878e9d31787c626dd06c801488192b98616d42afe59fd39b0640b11b218e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.11

Release files / pydata_checks-0.0.83-py3-none-any.whl

Download URL pydata_checks-0.0.83-py3-none-any.whl
Size 47.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cd03422d3e292f58650d745f4982935ef61038f877928f496eb57bbac5d0535c
BLAKE2b-256 checksum
How to use checksums
dc9803f213d09e16ad56a6470a12af990d9deed8006f770e37d0998b5ab506b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.11

Release history Release notifications | RSS feed

This release

0.0.83 This release

2 release files

0.0.82

2 release files

0.0.81

2 release files

0.0.80

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page