Skip to content
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

Merged
merged 2 commits into from
Apr 2, 2025
Merged

Conversation

tombaeyens
Copy link
Contributor

Adds contract attributes mapping to SodaCL for all checks except the schema check.

@tombaeyens tombaeyens requested a review from m1n0 March 26, 2025 11:29
@@ -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):
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no. should we?

Copy link
Contributor

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(
Copy link
Contributor

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

Copy link
Contributor Author

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?

Copy link
Contributor

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

@tombaeyens tombaeyens merged commit dbaa54d into main Apr 2, 2025
15 checks passed
@tombaeyens tombaeyens deleted the contract-attributes branch April 2, 2025 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants