-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added attributes mapping to contracts POC #2224
Conversation
for more information, see https://pre-commit.ci
|
@@ -334,10 +334,15 @@ def _create_sodacl_check_configs(self, check_specific_configs: dict | None = Non | |||
check_configs["identity_was"] = identity_was | |||
if self.filter_sql: | |||
check_configs["filter"] = self.filter_sql | |||
if isinstance(self.check_yaml, dict) and "attributes" in self.check_yaml: | |||
attributes = self.check_yaml.get("attributes") | |||
if isinstance(attributes, dict): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a plan to do more than just checking for a dict?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no. should we?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v3 checks the attributes with Cloud, it fetches the ones defined for the given organization and validates that the keys present in sodacl are defined as attributes in Cloud and also does some basic data type checking since Cloud Attributes have a data type
|
||
|
||
def test_contract_attributes(data_source_test_helper: ContractDataSourceTestHelper): | ||
contract_result: ContractResult = data_source_test_helper.assert_contract_pass( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the test could actually test more than whether the attributes are accepted - it could verify with at least the python api whether the attributes are present where expected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes indeed. but the current framework doesn't allow for that. so would have to start mocking soda cloud. wasn't worth the effort imo. i reviewed manually in the generated sql. it's a dirty hack/shortcut i know.
but this code is end of life given the new v4 so don't think it's worth building out that test assertion. wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah yes indeed I didn't realize this was the poc one that still translates into sodacl
Adds contract attributes mapping to SodaCL for all checks except the schema check.