Skip to main content

Python library which makes it possible to use validation rules in pydeequ based on json structures.

Project description

pydeequ-dynamic-parser

Python library which makes it possible to use validation rules in pydeequ based on json/dict structures.

Installing

pip install PydeequDynamicParser

Usage

# User Dynamic Checks
all_checks = [{"name": "isUnique", "parameters": {"column": "COLUMN_NAME", "hint": "Hint here"}},
              {"name": "satisfies", "parameters": {"columnCondition": "(LENGTH(COLUMN_NAME) = 11 OR LENGTH(COLUMN_NAME) = 14) ", "constraintName": "COLUMN_NAME length validate", "assertion": "lambda x: x == 1.0", "hint": None}},
              {"name": "containsEmail", "parameters": {"column": "COLUMN_NAME", "assertion": None, "hint": None}},
              {"name": "isComplete", "parameters": {"column": "COLUMN_NAME", "hint": None}}]

# PyDeequ constraint dynamic constraint based on "all_checks"
from pydeequ.checks import Check
from pydeequ.checks import CheckLevel
from pydeequ.verification import VerificationSuite
from pydeequ.verification import VerificationResult
import PydeequDynamicParser

check = Check(spark, CheckLevel.Error, "Check Name")
check_instance_parsed = PydeequDynamicParser.Parser(check, all_checks).parse()
checkResult = VerificationSuite(spark).onData(df).addCheck(check_instance_parsed).run()
checkResult_df = VerificationResult.checkResultsAsDataFrame(spark, checkResult)

checkResult_df.toPandas()

As we can see the line responsible for executing the parse will translate de user json/dict to PyDeequ Check instance.

import PydeequDynamicParser
check_instance_parsed = PydeequDynamicParser.Parser(check, all_checks).parse()

Currently supported validations

  • Constraints
    • isUnique
    • satisfies
    • containsEmail
    • isComplete

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

PydeequDynamicParser-0.2.tar.gz (6.3 kB view details)

Uploaded Source

File details

Details for the file PydeequDynamicParser-0.2.tar.gz.

File metadata

  • Download URL: PydeequDynamicParser-0.2.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.5.0 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.6.9

File hashes

Hashes for PydeequDynamicParser-0.2.tar.gz
Algorithm Hash digest
SHA256 b7b332c05b7ea24efd9379a34f1f613862028ef28bde598c36e91207aa25bdcb
MD5 04c1c65a3a486a52aa85f58940d29306
BLAKE2b-256 678b81383c02cf0451c278eec67105d1b65f0dea95cdb36640aaacfabc7cd1a5

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