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 - Fixing querying non-date partition columns in profiling #6554

Merged
merged 2 commits into from Nov 26, 2022

Conversation

treff7es
Copy link
Contributor

Adding to the source report the number of non-eligible tables for profiling

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

Adding to the source report the number of non-eligible tables for profiling
@github-actions github-actions bot added the ingestion PR or Issue related to the ingestion of metadata label Nov 26, 2022
@github-actions
Copy link

github-actions bot commented Nov 26, 2022

Unit Test Results (metadata ingestion)

       8 files  ±0         8 suites  ±0   57m 52s ⏱️ - 5m 51s
   764 tests ±0     761 ✔️ +1  2 💤 ±0  1  - 1 
1 530 runs  ±0  1 524 ✔️ +1  5 💤 ±0  1  - 1 

For more details on these failures, see this check.

Results for commit fa1b51a. ± Comparison against base commit d424edd.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Nov 26, 2022

Unit Test Results (build & test)

621 tests  ±0   617 ✔️ ±0   15m 48s ⏱️ -7s
157 suites ±0       4 💤 ±0 
157 files   ±0       0 ±0 

Results for commit fa1b51a. ± Comparison against base commit d424edd.

♻️ This comment has been updated with latest results.

if table.time_partitioning.type_ in ("DAY", "MONTH", "YEAR"):
partition_where_clause = "{column_name} BETWEEN DATE('{partition_id}') AND DATE('{upper_bound_partition_id}')".format(
partition_where_clause = "{column_name} BETWEEN {partition_column_type}('{partition_id}') AND {partition_column_type}('{upper_bound_partition_id}')".format(
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: you could use f-strings here and avoid .format

else:
skip_profiling = True
profile_table_level_only = True
self.report.num_tables_not_eligible_profiling[dataset] = (
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: make num_tables_not_eligible_profiling a Counter and no need to do this tricks.
just: self.report.num_tables_not_eligible_profiling[dataset]++
https://docs.python.org/3/library/collections.html

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we try to use in report structs that can't grow indefinitely and there this way I think won't work :(

@@ -66,7 +66,7 @@ class OperationalDataMeta:
def bigquery_audit_metadata_query_template(
dataset: str,
use_date_sharded_tables: bool,
table_allow_filter: str = None,
table_allow_filter: Optional[str] = None,
Copy link
Contributor

Choose a reason for hiding this comment

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

was this change necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This field should be Optional and mypy (linter) was complaining about it.

@treff7es treff7es merged commit 278c38c into datahub-project:master Nov 26, 2022
cccs-Dustin pushed a commit to CybercentreCanada/datahub that referenced this pull request Feb 1, 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