Skip to main content

Library for data checks and data quality monitoring based on duckdb.

Project description

Koality Logo

Data Quality Monitoring powered by DuckDB

Build Status Pages Deployment PyPI version Python versions PyPI downloads License


Koality is a Python library for data quality monitoring (DQM) using DuckDB. It provides configurable checks that validate data in tables and can persist results to database tables for monitoring and alerting.

We would like to thank Norbert Maager who is the original inventor of Koality.

Warning

This library is a work in progress!

Breaking changes should be expected until a 1.0 release, so version pinning is recommended.

Documentation

For comprehensive documentation, visit the Koality Documentation.

Core Features

  • Configurable Checks: Define data quality checks via simple YAML configuration files
  • DuckDB-Powered: Fast, in-process analytics with support for external databases (BigQuery, Postgres, etc.)
  • Multiple Check Types: Null ratios, regex matching, value sets, duplicates, counts, match rates, outlier detection, and more
  • Flexible Filtering: Dynamic filtering system with column/value pairs for targeted checks
  • Result Persistence: Store check results in database tables for historical tracking
  • CLI Tool: Easy-to-use command-line interface for running checks
  • Threshold Validation: Compare check results against configurable lower/upper bounds

Available Checks

Check Type Description
NullRatioCheck Share of NULL values in a column
RegexMatchCheck Share of values matching a regex pattern
ValuesInSetCheck Share of values matching a predefined set
RollingValuesInSetCheck Values in set over a rolling time window
DuplicateCheck Number of duplicate values in a column
CountCheck Row count or distinct value count
MatchRateCheck Match rate between two tables after joining
RelCountChangeCheck Relative count change vs. historical average
IqrOutlierCheck Detect outliers using interquartile range
OccurrenceCheck Check value occurrence frequency

Installation

pip install koality

Or add to your pyproject.toml:

[project]
dependencies = [
    "koality>=0.1.0",
]

Quick Start

1. Create a configuration file

# koality_config.yaml
name: My Data Quality Checks

defaults:
  date_filter_column: date
  date: yesterday
  result_table: my_project.dqm.results
  persist_results: true
  log_path: dqm_failures.txt

check_bundles:
  - name: null_ratio_checks
    defaults:
      check_type: NullRatioCheck
      table: my_project.dataset.orders
      lower_threshold: 0
      upper_threshold: 0.05
    checks:
      - check_column: customer_id
      - check_column: order_date
      - check_column: total_amount

2. Run checks via CLI

koality --config_path koality_config.yaml

3. Review results

Results are persisted to your configured result table and failures are logged to the specified log path.

Configuration Hierarchy

Koality uses a hierarchical configuration system where more specific settings override general ones:

  1. defaults: Base settings for all checks (result table, persistence, filters)
  2. check_bundles.defaults: Bundle-level defaults (check type, table, thresholds)
  3. checks: Individual check configurations (specific columns, custom thresholds)

Filter System

Apply dynamic filters to check specific data subsets:

defaults:
  date_filter_column: created_at
  date: yesterday
  shop_id_filter_column: shop_id
  shop_id: SHOP01

Time Magic

Koality supports relative date expressions:

  • today, yesterday, tomorrow
  • today-2, today+3 (offset by days)

Contributing

Contributions are welcome! Please feel free to submit issues and pull requests on GitHub.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

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

koality-0.1.0.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

koality-0.1.0-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

File details

Details for the file koality-0.1.0.tar.gz.

File metadata

  • Download URL: koality-0.1.0.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for koality-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1b1edbfd5b0e476a56a2ad81b67567ed1aa7e638bb3c3e61f133ab05b6beff4d
MD5 57c409a0413b9233152c2056b9947ee4
BLAKE2b-256 9e97532251675cb04ed2e6b9e17db7d6201645e4b834c10eaaff511fdf069dc0

See more details on using hashes here.

File details

Details for the file koality-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: koality-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 21.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for koality-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f557c8c85778c0af018f744058e967ded8122b610658047643ee56b84b45677e
MD5 6dd689e68bad010525080b1e1d3cb85a
BLAKE2b-256 72e28aefb0a09d8db7a789a4e56e87568a19e204863e8c15b6d864f8c3c62c49

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page