-
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(ingestion): adds platform instance capability to glue connector #4130
Merged
shirshanka
merged 15 commits into
datahub-project:master
from
sgomezvillamor:glue-platform-instance
Mar 31, 2022
Merged
Changes from 9 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
cdeee98
feat(ingestion): adds platform instance capability to glue connector
sgomezvillamor 0ecf83d
refactor(ingestion): fixing some typings from PR review
sgomezvillamor d4f4e38
Merge commit '585aad1aac09516c9e23ab96bf1a751c0c35cdb8' into glue-pla…
sgomezvillamor 6db9022
fix(ingestion): container custom property instance now points to the …
sgomezvillamor 31da10f
fix(ingestion): container custom properties filters null values
sgomezvillamor 26ef3ba
fix(ingestion): container produces dataPlatformInstance mcp only if i…
sgomezvillamor 59050d4
fix(ingestion): fixes instances = platform_instance for DatabaseKey a…
sgomezvillamor 98d9956
fix(ingestion): integration tests
sgomezvillamor adb94df
Merge commit '49a8ece02a4f7df092d7354b8e31ff9937691902' into glue-pla…
sgomezvillamor 75476b5
Merge branch 'master' into glue-platform-instance
sgomezvillamor a641b37
fixing tests
sgomezvillamor 3179aed
revert unnecessary changes on some mce files
sgomezvillamor e9c05d5
keep backward compatibility when no platform instance also for glue c…
sgomezvillamor 37aaaea
fixing dataplatform aspect for glue datasets when platform instance i…
sgomezvillamor 9a032b4
minor update
sgomezvillamor 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,10 @@ | |
import json | ||
from typing import Any, Iterable, List, Optional, TypeVar, Union | ||
|
||
from datahub.emitter.mce_builder import make_container_urn, make_data_platform_urn | ||
from datahub.emitter.mce_builder import ( | ||
make_container_urn, | ||
make_dataplatform_instance_urn, | ||
) | ||
from datahub.emitter.mcp import MetadataChangeProposalWrapper | ||
from datahub.ingestion.api.workunit import MetadataWorkUnit | ||
from datahub.metadata.com.linkedin.pegasus2avro.common import DataPlatformInstance | ||
|
@@ -90,26 +93,31 @@ def gen_containers( | |
# entityKeyAspect=ContainerKeyClass(guid=schema_container_key.guid()), | ||
aspectName="containerProperties", | ||
aspect=ContainerProperties( | ||
name=name, customProperties=dataclasses.asdict(container_key) | ||
name=name, | ||
customProperties=dataclasses.asdict( | ||
container_key, | ||
dict_factory=lambda x: {k: v for (k, v) in x if v is not None}, | ||
), | ||
), | ||
) | ||
wu = MetadataWorkUnit(id=f"container-info-{name}-{container_urn}", mcp=mcp) | ||
yield wu | ||
|
||
mcp = MetadataChangeProposalWrapper( | ||
entityType="container", | ||
changeType=ChangeTypeClass.UPSERT, | ||
entityUrn=f"{container_urn}", | ||
# entityKeyAspect=ContainerKeyClass(guid=schema_container_key.guid()), | ||
aspectName="dataPlatformInstance", | ||
aspect=DataPlatformInstance( | ||
platform=f"{make_data_platform_urn(container_key.platform)}" | ||
), | ||
) | ||
wu = MetadataWorkUnit( | ||
id=f"container-platforminstance-{name}-{container_urn}", mcp=mcp | ||
) | ||
yield wu | ||
if container_key.instance: | ||
mcp = MetadataChangeProposalWrapper( | ||
entityType="container", | ||
changeType=ChangeTypeClass.UPSERT, | ||
entityUrn=f"{container_urn}", | ||
# entityKeyAspect=ContainerKeyClass(guid=schema_container_key.guid()), | ||
aspectName="dataPlatformInstance", | ||
aspect=DataPlatformInstance( | ||
platform=f"{make_dataplatform_instance_urn(container_key.platform, container_key.instance)}" | ||
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. this should be changed to: aspect=DataPlatformInstance(
platform=f"{make_data_platform_urn(...)}", # as before
instance=f"{make_data_platform_instance_urn(container_key..."
... |
||
), | ||
) | ||
wu = MetadataWorkUnit( | ||
id=f"container-platforminstance-{name}-{container_urn}", mcp=mcp | ||
) | ||
yield wu | ||
|
||
# Set subtype | ||
subtype_mcp = MetadataChangeProposalWrapper( | ||
|
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
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.
delete?