-
Notifications
You must be signed in to change notification settings - Fork 7
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
New Dagster Openmetadata Ingestion Pipeline #1484
Open
quazi-h
wants to merge
3
commits into
main
Choose a base branch
from
dagster-openmetadata-pipeline
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
Empty file.
Empty file.
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from dagster import ( | ||
AssetExecutionContext, | ||
AssetKey, | ||
DataVersion, | ||
Output, | ||
asset, | ||
) | ||
from metadata.workflow.metadata import MetadataWorkflow | ||
|
||
from ol_orchestrate.partitions.openmetadata import TRINO_DAILY_PARTITIONS | ||
from ol_orchestrate.resources.openmetadata.trino import trino_config | ||
|
||
|
||
@asset( | ||
description=("An instance of metadata from our Trino database."), | ||
group_name="platform", | ||
key=AssetKey(["platform", "database", "trino", "metadata"]), | ||
partitions_def=TRINO_DAILY_PARTITIONS, | ||
) | ||
def trino_metadata(context: AssetExecutionContext): | ||
date = context.partition_key | ||
workflow = MetadataWorkflow.create(trino_config) | ||
workflow.execute() | ||
workflow.raise_from_status() | ||
workflow.print_status() | ||
workflow.stop() | ||
return Output( | ||
workflow, | ||
data_version=DataVersion(workflow["published_version"]), | ||
metadata={"source": "Trino", "date": date}, | ||
) |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from dagster import create_repository_using_definitions_args | ||
from dagster_aws.s3 import S3Resource | ||
|
||
from ol_orchestrate.assets.platform.openmetadata import trino_metadata | ||
from ol_orchestrate.lib.constants import DAGSTER_ENV, VAULT_ADDRESS | ||
from ol_orchestrate.resources.secrets.vault import Vault | ||
|
||
if DAGSTER_ENV == "dev": | ||
vault = Vault(vault_addr=VAULT_ADDRESS, vault_auth_type="github") | ||
vault._auth_github() # noqa: SLF001 | ||
else: | ||
vault = Vault( | ||
vault_addr=VAULT_ADDRESS, vault_role="dagster-server", aws_auth_mount="aws" | ||
) | ||
vault._auth_aws_iam() # noqa: SLF001 | ||
|
||
|
||
deployment_name = "openmetadata" | ||
deployment_assets = [ | ||
trino_metadata, | ||
] | ||
|
||
create_repository_using_definitions_args( | ||
name=f"{deployment_name}_assets", | ||
resources={ | ||
"vault": vault, | ||
"s3": S3Resource(), | ||
}, | ||
assets=deployment_assets, | ||
) |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from dagster import DailyPartitionsDefinition | ||
|
||
# Define daily partitions | ||
TRINO_DAILY_PARTITIONS = DailyPartitionsDefinition(start_date="2023-01-01") |
Empty file.
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# treat this as a dictionary and reference variables in the appropriate locations | ||
trino_config = { | ||
"source": { | ||
"type": "trino", | ||
"serviceName": "Starburst Galaxy", | ||
"serviceConnection": { | ||
"config": { | ||
"type": "Trino", | ||
"hostPort": "mitol-ol-data-lake-production.trino.galaxy.starburst.io:443", # noqa: E501 | ||
"username": "[email protected]", | ||
"authType": { | ||
"password": "<retrieve this from https://vault-production.odl.mit.edu/ui/vault/secrets/platform-secrets/kv/starburst-galaxy/details?version=4>" | ||
}, | ||
"catalog": "ol_data_lake_production", | ||
} | ||
}, | ||
"sourceConfig": { | ||
"config": { | ||
"type": "DatabaseMetadata", | ||
"markDeletedTables": True, | ||
"markDeletedStoredProcedures": True, | ||
"includeTables": True, | ||
"includeViews": True, | ||
"includeTags": True, | ||
"includeOwners": True, | ||
"includeStoredProcedures": True, | ||
"includeDDL": True, | ||
"threads": 10, | ||
} | ||
}, | ||
}, | ||
"sink": {"type": "metadata-rest", "config": {}}, | ||
"workflowConfig": { | ||
"loggerLevel": "DEBUG", | ||
"openMetadataServerConfig": { | ||
"hostPort": "https://open-metadata-qa.ol.mit.edu/api", | ||
"authProvider": "openmetadata", | ||
"securityConfig": { | ||
"jwtToken": "<retrieve this from https://open-metadata-ci.ol.mit.edu/bots/ingestion-bot>" | ||
}, | ||
Comment on lines
+39
to
+40
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. |
||
"storeServiceConnection": True, | ||
}, | ||
}, | ||
} |
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
Large diffs are not rendered by default.
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.
Storing credentials directly in the code is a security risk. Consider using a more secure method, such as retrieving the password from Vault or another secrets management system. This is a critical security concern that needs to be addressed before merging.