Data quality inspection tool. Identify issues before your CTO detects them!
Project description
data-watchtower
A data verification tool. Detect issues before your CTO does.
Installation
Install via pip:
pip install data-watchtower
Data Loader
Loads data into memory for validation by checkers.
Validators
Validate whether the loaded data meets expectations.
Built-in Validators
- ExpectColumnValuesToNotBeNull
- ExpectColumnRecentlyUpdated
- ExpectColumnStdToBeBetween
- ExpectColumnMeanToBeBetween
- ExpectColumnNullRatioToBeBetween
- ExpectRowCountToBeBetween
- ExpectColumnDistinctValuesToContainSet
- ExpectColumnDistinctValuesToEqualSet
- More...
Custom Loaders
Support for tailor-made loaders to handle specific data sources.
Macros
Custom macros enable referencing variables like dates or config files within monitoring tasks.
Scope of Effect
Applies to Watchtower names, checker parameters, and loader configurations.
Custom Macros
Leverage personalized macros for dynamic content insertion.
Supported Databases
- MySQL
- PostgreSQL
- SQLite
- And more...
TODO
- web frontend
Example
import datetime
from data_watchtower import DbServices, Watchtower, DatabaseLoader, ExpectRowCountToBeBetween,
ExpectColumnValuesToNotBeNull
# Database URLs
dw_test_data_db_url = "sqlite:///test.db"
dw_backend_db_url = "sqlite:///data.db"
# Custom Macro Definitions
custom_macro_map = {
'today': {'impl': lambda: datetime.datetime.today().strftime("%Y-%m-%d")},
'start_date': '2024-04-01',
'column': 'name',
}
# Configure Data Loader
query = "SELECT * FROM score WHERE date='${today}'"
data_loader = DatabaseLoader(query=query, connection=dw_test_data_db_url)
data_loader.load()
# Instantiate Watchtower
wt = Watchtower(name='Score Data of ${today}', data_loader=data_loader, custom_macro_map=custom_macro_map)
# Add Validators
row_count_params = ExpectRowCountToBeBetween.Params(min_value=20)
wt.add_validator(ExpectRowCountToBeBetween(row_count_params))
null_check_params = ExpectColumnValuesToNotBeNull.Params(column='${column}')
wt.add_validator(ExpectColumnValuesToNotBeNull(null_check_params))
# Execute Validation
validation_result = wt.run()
print(validation_result['success'])
# Persist Monitoring Setup and Results
db_service = DbServices(dw_backend_db_url)
db_service.create_tables()
db_service.add_watchtower(wt)
db_service.save_result(wt, validation_result)
db_service.update_watchtower_success_status(wt)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file data_watchtower-0.0.7.tar.gz.
File metadata
- Download URL: data_watchtower-0.0.7.tar.gz
- Upload date:
- Size: 62.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb6220b4765880bd9d6759ee75b81e7786909f3f5029acfe879c5d556ae29a53
|
|
| MD5 |
4bcf348b210abc966580f08ccef091dc
|
|
| BLAKE2b-256 |
9a00ee67f2caa80bcc5b71e9b42e5400dee7c5046be6d0a12be486c4b76e9281
|
File details
Details for the file data_watchtower-0.0.7-py3-none-any.whl.
File metadata
- Download URL: data_watchtower-0.0.7-py3-none-any.whl
- Upload date:
- Size: 41.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c44a928b6a9fefe73a8de96d401527bcde556078546bb539197db69b21f29d4
|
|
| MD5 |
ef57e46f9c2d8e8d4720e33276a2bbc4
|
|
| BLAKE2b-256 |
8ceda53d44a0cb2eb7d61a7293318ae5afb119f5160afc296f1c45099644452a
|