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

fix(ingest/snowflake): Create all structured propery templates before assignation #12469

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

treff7es
Copy link
Contributor

Checklist

  • The PR conforms to DataHub's Contributing Guideline (particularly Commit Message Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable)
  • Docs related to the changes have been added/updated (if applicable). If a new feature has been added a Usage Guide has been added for the same.
  • For any breaking change/potential downtime/deprecation/big changes an entry has been made in Updating DataHub

@github-actions github-actions bot added the ingestion PR or Issue related to the ingestion of metadata label Jan 27, 2025
Copy link

codecov bot commented Jan 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Files with missing lines Coverage Δ
...hub/ingestion/source/snowflake/snowflake_config.py 98.00% <100.00%> (+0.01%) ⬆️
...ahub/ingestion/source/snowflake/snowflake_query.py 93.85% <100.00%> (+0.10%) ⬆️
...hub/ingestion/source/snowflake/snowflake_report.py 99.06% <100.00%> (+<0.01%) ⬆️
...hub/ingestion/source/snowflake/snowflake_schema.py 87.95% <100.00%> (+0.17%) ⬆️
...ingestion/source/snowflake/snowflake_schema_gen.py 85.35% <100.00%> (ø)
...atahub/ingestion/source/snowflake/snowflake_tag.py 75.75% <100.00%> (+5.75%) ⬆️

... and 5 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a4f8d17...3abcf0c. Read the comment docs.

@datahub-cyborg datahub-cyborg bot added the needs-review Label for PRs that need review from a maintainer. label Jan 27, 2025
Copy link
Collaborator

@asikowitz asikowitz left a comment

Choose a reason for hiding this comment

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

Couple requests but looks good to me otherwise!

@@ -249,6 +249,11 @@ class SnowflakeV2Config(
description="If enabled along with `extract_tags`, extracts snowflake's key-value tags as DataHub structured properties instead of DataHub tags.",
)

structured_properties_template_cache_invalidation_interval: int = Field(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe hide this one from docs, feels more like an implementation detail

for tag in self.data_dictionary.get_all_tags():
if not self.config.tag_pattern.allowed(tag.tag_identifier()):
continue
# Do we need to filter based on database and schema or is it enough if we filter based on tag pattern?
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would say no, because you can apply tags from other databases / schemas

Comment on lines 293 to 302
tags = []
for tag in cur:
snowflake_tag = SnowflakeTag(
database=tag["TAG_DATABASE"],
schema=tag["TAG_SCHEMA"],
name=tag["TAG_NAME"],
value="",
)
tags.append(snowflake_tag)
return tags
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could be a list comprehension a bit more succinctly

Comment on lines 93 to 94
for workunit in self.gen_tag_as_structured_property_workunits(tag):
yield workunit
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
for workunit in self.gen_tag_as_structured_property_workunits(tag):
yield workunit
yield from self.gen_tag_as_structured_property_workunits(tag)

@@ -219,6 +219,7 @@ def test_snowflake_tags_as_structured_properties(
include_column_lineage=False,
include_usage_stats=False,
include_operational_stats=False,
structured_properties_template_cache_invalidation_interval=1,
Copy link
Collaborator

Choose a reason for hiding this comment

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

For test I'd prob put this at 0 unless it's needed just to avoid unnecessary sleeps

@@ -59,6 +78,46 @@ def _get_tags_on_object_without_propagation(
raise ValueError(f"Unknown domain {domain}")
return tags

def create_structured_property_templates(self) -> Iterable[MetadataWorkUnit]:
for tag in self.data_dictionary.get_all_tags():
if not self.config.tag_pattern.allowed(tag.tag_identifier()):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually, I think structured_property_pattern makes more sense here, right? Our tag_pattern expects a key value pair, not just a key

@datahub-cyborg datahub-cyborg bot added pending-submitter-response Issue/request has been reviewed but requires a response from the submitter and removed needs-review Label for PRs that need review from a maintainer. labels Jan 28, 2025
@datahub-cyborg datahub-cyborg bot added needs-review Label for PRs that need review from a maintainer. and removed pending-submitter-response Issue/request has been reviewed but requires a response from the submitter labels Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ingestion PR or Issue related to the ingestion of metadata needs-review Label for PRs that need review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants