-
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
feat(cli): Add run-id option to put sub-command #11023
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ea0295b
feat(cli): Add run-id option to put sub-command
pedro93 aa141f6
fix lint
pedro93 3d3459a
Merge branch 'master' into feature/cus-2323
pedro93 1eedb5a
Merge branch 'master' into feature/cus-2323
pedro93 f5aecd6
fix parameter
pedro93 18c2cb7
Merge branch 'master' into feature/cus-2323
pedro93 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
|
||
from datahub.cli.cli_utils import post_entity | ||
from datahub.configuration.config_loader import load_config_file | ||
from datahub.emitter.mcp import MetadataChangeProposalWrapper | ||
from datahub.emitter.mcp import MetadataChangeProposalWrapper, SystemMetadataClass | ||
from datahub.ingestion.graph.client import get_default_graph | ||
from datahub.metadata.schema_classes import ( | ||
DataPlatformInfoClass as DataPlatformInfo, | ||
|
@@ -36,9 +36,10 @@ def put() -> None: | |
@click.option("--urn", required=True, type=str) | ||
@click.option("-a", "--aspect", required=True, type=str) | ||
@click.option("-d", "--aspect-data", required=True, type=str) | ||
@click.option("--run-id", type=str, help="Run ID into which we should log the aspect.") | ||
@upgrade.check_upgrade | ||
@telemetry.with_telemetry() | ||
def aspect(urn: str, aspect: str, aspect_data: str) -> None: | ||
def aspect(urn: str, aspect: str, aspect_data: str, run_id: str) -> None: | ||
"""Update a single aspect of an entity""" | ||
|
||
entity_type = guess_entity_type(urn) | ||
|
@@ -56,6 +57,7 @@ def aspect(urn: str, aspect: str, aspect_data: str) -> None: | |
aspect_name=aspect, | ||
entity_type=entity_type, | ||
aspect_value=aspect_obj, | ||
system_metadata=SystemMetadataClass(runId=run_id), | ||
) | ||
click.secho(f"Update succeeded with status {status}", fg="green") | ||
|
||
|
@@ -82,8 +84,11 @@ def aspect(urn: str, aspect: str, aspect_data: str) -> None: | |
help="Logo URL that must be reachable from the DataHub UI.", | ||
required=True, | ||
) | ||
@click.option( | ||
"--run-id", type=str, help="Run ID into which we should log the platform." | ||
) | ||
def platform( | ||
ctx: click.Context, name: str, display_name: Optional[str], logo: str | ||
ctx: click.Context, name: str, display_name: Optional[str], logo: str, run_id: str | ||
Comment on lines
+96
to
+100
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. Reminder: Add tests. The function Do you want me to generate the unit testing code or open a GitHub issue to track this task? |
||
) -> None: | ||
""" | ||
Create or update a dataplatform entity in DataHub | ||
|
@@ -104,11 +109,12 @@ def platform( | |
logoUrl=logo, | ||
) | ||
datahub_graph = get_default_graph() | ||
datahub_graph.emit( | ||
MetadataChangeProposalWrapper( | ||
entityUrn=str(platform_urn), aspect=data_platform_info | ||
) | ||
mcp = MetadataChangeProposalWrapper( | ||
entityUrn=str(platform_urn), | ||
pedro93 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
aspect=data_platform_info, | ||
systemMetadata=SystemMetadataClass(runId=run_id), | ||
) | ||
datahub_graph.emit(mcp) | ||
click.echo( | ||
f"✅ Successfully wrote data platform metadata for {platform_urn} to DataHub ({datahub_graph})" | ||
) |
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.
Reminder: Add tests.
The function
aspect
is missing test coverage.Do you want me to generate the unit testing code or open a GitHub issue to track this task?