Skip to content

Commit

Permalink
Merge pull request #20 from Amsterdam/comment
Browse files Browse the repository at this point in the history
Update input_helpers.py
  • Loading branch information
aysegulcayir authored Jul 31, 2024
2 parents 070d106 + af359a3 commit 5bc5911
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "dq-suite-amsterdam"
version = "0.5.2"
version = "0.5.3"
authors = [
{ name="Arthur Kordes", email="a.kordes@amsterdam.nl" },
{ name="Aysegul Cayir Aydar", email="a.cayiraydar@amsterdam.nl" }
Expand Down
20 changes: 20 additions & 0 deletions src/dq_suite/input_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,15 @@ def export_schema(dataset: str, spark: SparkSession):


def fetch_schema_from_github(dq_rules):
"""
Function fetches a schema from the Github Amsterdam schema using the dq_rules.
:param dq_rules: A dictionary with all DQ configuration.
:type dq_rules: dict
:return: schemas: A dictionary with the schema of the required tables.
:rtype: dict
"""

schemas = {}
for table in dq_rules['tables']:
if 'validate_table_schema_url' in table:
Expand All @@ -108,6 +117,17 @@ def fetch_schema_from_github(dq_rules):


def generate_dq_rules_from_schema(dq_rules: dict, schemas: dict) -> dict:
"""
Function adds expect_column_values_to_be_of_type rule for each column of tables having schema_id and schema_url in dq_rules.
:param dq_rules: A dictionary with all DQ configuration.
:type dq_rules: dict
:param schemas: A dictionary with the schemas of the required tables.
: type: dict
:return: dq_rules: A dictionary with all DQ configuration.
:rtype: dict
"""

for table in dq_rules['tables']:
if 'validate_table_schema' in table:
schema_id = table['validate_table_schema']
Expand Down

0 comments on commit 5bc5911

Please sign in to comment.