Skip to main content

A PySpark package to check missing dates in tables

Project description

Date Validator PySpark

A PySpark utility for validating date completeness in tables.

Installation

pip install pyspark-date-validator

Example Usage

Validating Multiple Tables with MultipleTablesValidator

Run checks across multiple tables and raise an error if any have missing dates.

from date_validator import MultipleTablesValidator

# Define table configurations
table_configs = [
    {
        "table_name": "table1"
        , "start_date": "2023-01-01"
        , "end_date": "2023-01-05"
        , "frequency": "daily"
        , "custom_filter": "field_A = 10" # Optional
        , "exclude_date": ['2021-02-01','2021-02-02','2021-02-03'] # Optional
    },
    {
        "table_name": "table2"
        , "start_date": "2023-01-01"
        , "end_date": "2023-03-31"
        , "frequency": "monthly"
        , "custom_filter": "field_A = 10" # Optional
        , "exclude_date": ['2021-02-01','2021-02-02','2021-02-03'] # Optional
    }
]

# Run validation
validator = MultipleTablesValidator(table_configs)
validator.run_checks()
# Output:
# Missing dates in table 'table1' (daily):
# +----------+
# |  as_at_dt|
# +----------+
# |2023-01-02|
# |2023-01-04|
# |2023-01-05|
# +----------+
# Missing dates in table 'table2' (monthly):
# +----------+
# |  as_at_dt|
# +----------+
# |2023-02-28|
# +----------+
# ValueError: Missing dates detected in one or more tables.

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

pyspark_date_validator-0.2.4.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

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

pyspark_date_validator-0.2.4-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file pyspark_date_validator-0.2.4.tar.gz.

File metadata

  • Download URL: pyspark_date_validator-0.2.4.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for pyspark_date_validator-0.2.4.tar.gz
Algorithm Hash digest
SHA256 9d670eacb60b50e7ce3dd354a36bd40bd7367bdbec8941cdf26dbb37f2f1cd01
MD5 da89ad1184526a59c7b4d330bce03aa4
BLAKE2b-256 ef5d801f647c869fe35e751f8d3cf8a36e985be4cd97541caa065aeedc9f3745

See more details on using hashes here.

File details

Details for the file pyspark_date_validator-0.2.4-py3-none-any.whl.

File metadata

File hashes

Hashes for pyspark_date_validator-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a97550df05fc8bab8aa7fb78a8c959835fb96fdd563e5e12e454849d7264f76e
MD5 bd7fbb206c33c601bf2701fd76f171ef
BLAKE2b-256 e1d220570039b31e228dfa56779ece9613bb59ca37d410a9dbccc4b5cce3ea6c

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