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/bigquery): Prefer parsed lineage for view over lineage from audit logs #7408

Merged

Conversation

mayurinehate
Copy link
Collaborator

For scenarios such as

Table->View1->View2

  1. Lineage generated for View2 by parsing audit logs : Table, View1 -> View2
  2. Lineage generated for View2 by parsing View DDL : View -> View2
    Second is more accurate over first one. Hence in this PR we use SQL parsing lineage over lineage from audit logs, if SQL parsing lineage is available.

Another approach to fix this would be to fix point 1 above to not include tables that are not directly accessed in View DDL. However currently that happens only if config lineage_use_sql_parser is enabled

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 Feb 22, 2023
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.

Nice catch, looks good to me.

Comment on lines +720 to 727
if parsed_view_upstreams:
# Override upstreams obtained by parsing audit logs
# as they may contain indirectly referenced tables
lineage_metadata[key] = set()
for table_id in parsed_view_upstreams:
lineage_metadata[key].add(
str(BigQueryTableRef(table_id).get_sanitized_table_ref())
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

We could replace this with a list (set) comprehension but either way is fine

@asikowitz asikowitz merged commit 5db1336 into datahub-project:master Feb 22, 2023
oleg-ruban pushed a commit to RChygir/datahub that referenced this pull request Feb 28, 2023
yoonhyejin pushed a commit that referenced this pull request Mar 3, 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.

None yet

2 participants