-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ingest): add entity type inference to mcpw
- Loading branch information
Showing
5 changed files
with
66 additions
and
22 deletions.
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
|
||
from datahub.configuration.common import AllowDenyPattern | ||
from datahub.configuration.time_window_config import BucketDuration, get_time_bucket | ||
from datahub.emitter.mce_builder import make_dataset_urn_with_platform_instance | ||
from datahub.emitter.mcp import MetadataChangeProposalWrapper | ||
from datahub.ingestion.api.workunit import MetadataWorkUnit | ||
from datahub.ingestion.source.usage.usage_common import ( | ||
|
@@ -18,6 +19,15 @@ | |
_TestAggregatedDataset = GenericAggregatedDataset[_TestTableRef] | ||
|
||
|
||
def _simple_urn_builder(resource): | ||
return make_dataset_urn_with_platform_instance( | ||
"snowflake", | ||
resource.lower(), | ||
"snowflake-dev", | ||
"DEV", | ||
) | ||
|
||
|
||
def test_add_one_query_without_columns(): | ||
test_email = "[email protected]" | ||
test_query = "select * from test" | ||
|
@@ -149,7 +159,7 @@ def test_make_usage_workunit(): | |
) | ||
wu: MetadataWorkUnit = ta.make_usage_workunit( | ||
bucket_duration=BucketDuration.DAY, | ||
urn_builder=lambda x: x, | ||
urn_builder=_simple_urn_builder, | ||
top_n_queries=10, | ||
format_sql_queries=False, | ||
include_top_n_queries=True, | ||
|
@@ -181,7 +191,7 @@ def test_query_formatting(): | |
) | ||
wu: MetadataWorkUnit = ta.make_usage_workunit( | ||
bucket_duration=BucketDuration.DAY, | ||
urn_builder=lambda x: x, | ||
urn_builder=_simple_urn_builder, | ||
top_n_queries=10, | ||
format_sql_queries=True, | ||
include_top_n_queries=True, | ||
|
@@ -212,7 +222,7 @@ def test_query_trimming(): | |
) | ||
wu: MetadataWorkUnit = ta.make_usage_workunit( | ||
bucket_duration=BucketDuration.DAY, | ||
urn_builder=lambda x: x, | ||
urn_builder=_simple_urn_builder, | ||
top_n_queries=top_n_queries, | ||
format_sql_queries=False, | ||
include_top_n_queries=True, | ||
|
@@ -248,7 +258,7 @@ def test_make_usage_workunit_include_top_n_queries(): | |
) | ||
wu: MetadataWorkUnit = ta.make_usage_workunit( | ||
bucket_duration=BucketDuration.DAY, | ||
urn_builder=lambda x: x, | ||
urn_builder=_simple_urn_builder, | ||
top_n_queries=10, | ||
format_sql_queries=False, | ||
include_top_n_queries=False, | ||
|