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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1bb4bf89d83446979fd34a45a7731ea7300d26499c8d4e3733b6f027339bd57 |
|
MD5 | e1bdc59a1bd2ba9c142cb5a167b52212 |
|
BLAKE2b-256 | e138485704ae35df7760206cb84aab27751ebf60e13f3578017e985017282b79 |