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.3.tar.gz (6.3 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: PydeequDynamicParser-0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 b1bb4bf89d83446979fd34a45a7731ea7300d26499c8d4e3733b6f027339bd57
MD5 e1bdc59a1bd2ba9c142cb5a167b52212
BLAKE2b-256 e138485704ae35df7760206cb84aab27751ebf60e13f3578017e985017282b79

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