Skip to content

Instantly share code, notes, and snippets.

@OatmealLick
Created July 17, 2023 10:10
Show Gist options
  • Save OatmealLick/677dbef6ecb5bc6de7b829ce1c20e70e to your computer and use it in GitHub Desktop.
Save OatmealLick/677dbef6ecb5bc6de7b829ce1c20e70e to your computer and use it in GitHub Desktop.
Build data contract (Great) Expectation Suites
def _build_data_contract_suites(self, mappings):
data_contract_expectation_suites = []
for data_product, tables in mappings.items():
for table in tables:
suite = ExpectationSuite(
expectation_suite_name=f"{data_product}.data_contract_schema.{table}",
meta={
"great_expectations_version": "0.16.11",
"critical": True
},
expectations=[
ExpectationConfiguration(
expectation_type="expect_table_schema_to_match_data_contract_schema",
kwargs={
"table_name": table,
"data_product": data_product,
"env": self.env,
"result_format": "COMPLETE"
}
)
]
)
data_contract_expectation_suites.append(suite)
return data_contract_expectation_suites
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment