Skip to main content

A data quality check module for Spark

Project description

dq_check

Overview

dq_check is a Python package that provides a data quality check function encapsulated in the DQCheck class. It allows you to perform data quality checks on tables using SQL queries and save the results into a Delta table for auditing purposes.

Features

  • Perform data quality checks on specified tables using SQL queries.
  • Save audit logs of data quality checks into a Delta table.
  • Handle aggregation checks and basic data quality metrics.
  • Supports PySpark and Pandas integration.

Installation

You can install dq_check from PyPI using pip:

bash

pip install dq_check

Usage

Here's an example of how to use the DQCheck class from the dq_check package:

from pyspark.sql import SparkSession

from dq_check import DQCheck

Initialize Spark session

spark = SparkSession.builder.appName("DQCheckExample").getOrCreate()

Create an instance of DQCheck

dq_checker = DQCheck(spark,audit_table) #audit table name should have catalog and schema.

Define the data quality check parameters

table_type = "delta" # Type of the table ('delta' or 'asql')

table_name = "your_table_name" # Name of the table, should have catalog/schema for delta and schema for asql.

primary_keys = ["your_primary_key"] # List of primary key columns

sql_query = "SELECT * FROM your_table WHERE condition" # Data quality check query # should have table name with catalog and schema.

Perform the data quality check

dq_checker.perform_dq_check(

table_type,

table_name,

primary_keys,

sql_query,

secret= None, # Optional, required for asql only

data_batch_identifier_name=None,  # Optional batch identifier name

data_batch_identifier_value=None,  # Optional batch identifier value

quality_threshold_percentage=5,  # Quality threshold percentage

)

Configuration

Adjust the parameters passed to the perform_dq_check method based on your requirements.

Dependencies

PySpark Pandas

Contributing

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

License

None.

Contact

For any questions or feedback, open a github issue

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

dq_check-0.2.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

dq_check-0.2.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file dq_check-0.2.0.tar.gz.

File metadata

  • Download URL: dq_check-0.2.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.12

File hashes

Hashes for dq_check-0.2.0.tar.gz
Algorithm Hash digest
SHA256 86bb3172e85380949fd6c573935c50919e77ef0a59d487e732fee0c80bfc5514
MD5 41c44d3a9fb7969fced20b6c09263b9a
BLAKE2b-256 ce627c31bbf4ed7c59bf41012ce2503a66d2d1eeaef32f45746b9b2a0d805c3e

See more details on using hashes here.

File details

Details for the file dq_check-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: dq_check-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.12

File hashes

Hashes for dq_check-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8961398358f2c6c68ffe07d87181368d737c4241b19c68b6a4d89702101566e3
MD5 2c853f93ac554b5091fa331bf5598152
BLAKE2b-256 0f98002fc4716e56adb95c4b55351be8213afa86cb1617cc91ed956704d39c6c

See more details on using hashes here.

Supported by

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