-
Notifications
You must be signed in to change notification settings - Fork 3k
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/powerbi): powerbi dataset profiling #9355
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
1914028
feat(ingest/powerbi): add dax based dataset profiling
looppi 6c82b50
docs(ingest/powerbi): add some documentation about profiling
looppi 7f6d96f
fix: move profiling data to a separate dataclass
looppi 4fadf1f
refactor: powerbi profiling to existing resolver
looppi 3edbf3b
fix: add profiling capability decorator
looppi d7190fb
Merge branch 'master' into powerbi-profiling
looppi 71ae650
docs: update docs about required permissions for profiling
looppi d4bb88f
fix: import order
looppi 5aefa51
fix: flake8 error
looppi 9f6d82d
style: code style improvements
looppi 4f39a14
Merge branch 'master' into powerbi-profiling
looppi bac8c55
docs: explain reasoning behind includeNulls
looppi 8c0b7f1
fix: mypy errors
looppi fddb3a4
docs: update docs and parameter definitions
looppi db07420
style: fix formatting
looppi 74062c5
Merge branch 'master' into powerbi-profiling
looppi bfdb963
docs: dataset profiling is unavailable through admin api
looppi 81c7a31
lint: fix linting
looppi 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,7 +67,9 @@ | |
CorpUserKeyClass, | ||
DashboardInfoClass, | ||
DashboardKeyClass, | ||
DatasetFieldProfileClass, | ||
DatasetLineageTypeClass, | ||
DatasetProfileClass, | ||
DatasetPropertiesClass, | ||
GlobalTagsClass, | ||
OtherSchemaClass, | ||
|
@@ -483,9 +485,64 @@ def to_datahub_dataset( | |
Constant.DATASET, | ||
dataset.tags, | ||
) | ||
self.extract_profile(dataset_mcps, workspace, dataset, table, ds_urn) | ||
|
||
return dataset_mcps | ||
|
||
def extract_profile( | ||
self, | ||
dataset_mcps: List[MetadataChangeProposalWrapper], | ||
workspace: powerbi_data_classes.Workspace, | ||
dataset: powerbi_data_classes.PowerBIDataset, | ||
table: powerbi_data_classes.Table, | ||
ds_urn: str, | ||
) -> None: | ||
if not self.__config.profiling.enabled: | ||
# Profiling not enabled | ||
return | ||
|
||
if not self.__config.profile_pattern.allowed( | ||
f"{workspace.name}.{dataset.name}.{table.name}" | ||
): | ||
logger.info( | ||
f"Table {table.name} in {dataset.name}, not allowed for profiling" | ||
) | ||
return | ||
logger.debug(f"Profiling table: {table.name}") | ||
|
||
profile = DatasetProfileClass(timestampMillis=builder.get_sys_time()) | ||
profile.rowCount = table.row_count | ||
profile.fieldProfiles = [] | ||
|
||
columns: List[ | ||
Union[powerbi_data_classes.Column, powerbi_data_classes.Measure] | ||
] = [*(table.columns or []), *(table.measures or [])] | ||
for column in columns: | ||
allowed_column = self.__config.profile_pattern.allowed( | ||
f"{workspace.name}.{dataset.name}.{table.name}.{column.name}" | ||
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. Could you please give example value of |
||
) | ||
if column.isHidden or not allowed_column: | ||
logger.info(f"Column {column.name} not allowed for profiling") | ||
continue | ||
measure_profile = column.measure_profile | ||
if measure_profile: | ||
field_profile = DatasetFieldProfileClass(column.name or "") | ||
field_profile.sampleValues = measure_profile.sample_values | ||
field_profile.min = measure_profile.min | ||
field_profile.max = measure_profile.max | ||
field_profile.uniqueCount = measure_profile.unique_count | ||
profile.fieldProfiles.append(field_profile) | ||
|
||
profile.columnCount = table.column_count | ||
|
||
mcp = MetadataChangeProposalWrapper( | ||
entityType="dataset", | ||
entityUrn=ds_urn, | ||
aspectName="datasetProfile", | ||
aspect=profile, | ||
) | ||
dataset_mcps.append(mcp) | ||
|
||
@staticmethod | ||
def transform_tags(tags: List[str]) -> GlobalTagsClass: | ||
return GlobalTagsClass( | ||
|
@@ -1180,6 +1237,10 @@ def report_to_datahub_work_units( | |
SourceCapability.LINEAGE_FINE, | ||
"Disabled by default, configured using `extract_column_level_lineage`. ", | ||
) | ||
@capability( | ||
SourceCapability.DATA_PROFILING, | ||
"Optionally enabled via configuration profiling.enabled", | ||
) | ||
class PowerBiDashboardSource(StatefulIngestionSourceBase, TestableSource): | ||
""" | ||
This plugin extracts the following: | ||
|
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
Oops, something went wrong.
Oops, something went wrong.
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.
Could you please update the
Caveats of setting admin_apis_only to true:
and add a bullet point fordataset profiling
is not availableThere 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.
Sorry for the delay, I added mention that the dataset profiling is not available through the Admin API