-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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(ingestion): profiling - Fixing partitioned table profiling in BQ #5283
Merged
treff7es
merged 5 commits into
datahub-project:master
from
treff7es:profiler_table_name_fix
Jun 29, 2022
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
187d9f4
Fixing partitioned table profiling in BQ
treff7es 75e3d5c
Merge branch 'master' into profiler_table_name_fix
treff7es 779c8aa
Adding some additional comment
treff7es 2044df2
Merge branch 'profiler_table_name_fix' of github.com:treff7es/datahub…
treff7es 3a56c64
Fixing invalid escape character
treff7es File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
|
||
from great_expectations import __version__ as ge_version | ||
|
||
from datahub.configuration.common import ConfigurationError | ||
from datahub.telemetry import stats, telemetry | ||
|
||
# Fun compatibility hack! GE version 0.13.44 broke compatibility with SQLAlchemy 1.3.24. | ||
|
@@ -872,7 +873,15 @@ def _generate_single_profile( | |
ge_config["schema"] = temp_table_db | ||
|
||
if self.config.bigquery_temp_table_schema: | ||
bigquery_temp_table = f"{temp_table_db}.{self.config.bigquery_temp_table_schema}.ge-temp-{uuid.uuid4()}" | ||
num_parts = self.config.bigquery_temp_table_schema.split(".") | ||
if len(num_parts) == 1: | ||
bigquery_temp_table = f"{temp_table_db}.{self.config.bigquery_temp_table_schema}.ge-temp-{uuid.uuid4()}" | ||
elif len(num_parts) == 2: | ||
bigquery_temp_table = f"{self.config.bigquery_temp_table_schema}.ge-temp-{uuid.uuid4()}" | ||
else: | ||
raise ConfigurationError( | ||
f"bigquery_temp_table_schema should be either project.dataset or dataset format but it was: {self.config.bigquery_temp_table_schema}" | ||
) | ||
else: | ||
assert table | ||
table_parts = table.split(".") | ||
|
@@ -970,12 +979,13 @@ def _get_ge_dataset( | |
if platform is not None and platform == "bigquery": | ||
# This is done as GE makes the name as DATASET.TABLE | ||
# but we want it to be PROJECT.DATASET.TABLE instead for multi-project setups | ||
logger.debug(f"Setting table name to be {pretty_name}") | ||
batch._table = sa.text(pretty_name) | ||
name_parts = pretty_name.split(".") | ||
if len(name_parts) != 3: | ||
logger.error( | ||
f"Unexpected {pretty_name} while profiling. Should have 3 parts but has {len(name_parts)} parts." | ||
) | ||
if len(str(batch._table).split(".")) == 2: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add comments on the PR for the special cases added? It is not clear why we have this special case |
||
batch._table = sa.text(f"{name_parts[0]}.{str(batch._table)}") | ||
logger.debug(f"Setting table name to be {batch._table}") | ||
|
||
return batch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add comments on the PR for the special cases added? It is not clear why we have these special cases