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

feat(ingest): switch dbt to use auto_stale_entity_removal #7160

Merged
merged 3 commits into from
Jan 31, 2023

Conversation

hsheth2
Copy link
Collaborator

@hsheth2 hsheth2 commented Jan 28, 2023

Follow up on #7158.

  • This also resolves a long-standing bug where we would add non-dbt entities to the dbt state object
  • Adds status aspects for assertions

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 28, 2023
"dataset", node_datahub_urn
)
if not is_primary_source:
# We previously, erroneously added non-dbt nodes to the state object.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice - thank you for doing this....

if not wu.is_primary_source:
# If this is a non-primary source, we pretend like we've seen the status
# aspect so that we don't try to emit a removal for it.
status_urns.add(urn)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ooo this is weird. Might want to rename the "status_urns" variable to be something more like.... excluded_urns or something

if entity_type is not None:
stale_entity_removal_handler.add_entity_to_state(entity_type, urn)
else:
stale_entity_removal_handler.add_urn_to_skip(urn)
Copy link
Collaborator

Choose a reason for hiding this comment

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

qq - why do we also need to call this manually in the DBT source? it seems like just passing a workunit with primary false would exclude this thing?

# We previously, erroneously added non-dbt nodes to the state object.
# This call ensures that we don't try to soft-delete them after an
# upgrade of acryl-datahub.
self.stale_entity_removal_handler.add_urn_to_skip(node_datahub_urn)
Copy link
Collaborator

Choose a reason for hiding this comment

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

qq - wouldn't this case already be covered by putting the is_primary_source into the workunit itself?

confused as to why we need both

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we were previously calling the add_entity_to_state for some snowflake nodes that we weren't even emitting. because of that, using the is_primary piece isn't sufficient to avoid soft-deleting stuff that accidentally

Copy link
Collaborator

Choose a reason for hiding this comment

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

oh mannnn

"aspect": {
"value": "{\"timestampMillis\": 1655565136719, \"partitionSpec\": {\"type\": \"FULL_TABLE\", \"partition\": \"FULL_TABLE_SNAPSHOT\"}, \"runId\": \"c7a6b778-0e0f-4789-b567-ca7e124a6840\", \"assertionUrn\": \"urn:li:assertion:fac27f352406b941125292413afa8096\", \"asserteeUrn\": \"urn:li:dataset:(urn:li:dataPlatform:postgres,calm-pagoda-323403.jaffle_shop.stg_payments,PROD)\", \"status\": \"COMPLETE\", \"result\": {\"type\": \"SUCCESS\", \"nativeResults\": {}}}",
"contentType": "application/json"
"json": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice!

@hsheth2
Copy link
Collaborator Author

hsheth2 commented Jan 31, 2023

Merging through the failures, which are related to glue and fixed by #7185

@hsheth2 hsheth2 merged commit 670342a into datahub-project:master Jan 31, 2023
@hsheth2 hsheth2 deleted the dbt-primary-source branch January 31, 2023 03:59
danielcmessias pushed a commit to danielcmessias/datahub that referenced this pull request Feb 1, 2023
ericyomi pushed a commit to ericyomi/datahub that referenced this pull request Feb 8, 2023
oleg-ruban pushed a commit to RChygir/datahub that referenced this pull request Feb 28, 2023
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants