forked from datahub-project/datahub
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'datahub-project:master' into master
- Loading branch information
Showing
120 changed files
with
5,321 additions
and
3,549 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
71 changes: 71 additions & 0 deletions
71
...ules/airflow-plugin/tests/integration/dags/datahub_emitter_operator_jinja_template_dag.py
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,71 @@ | ||
from datetime import datetime, timedelta | ||
|
||
from airflow import DAG | ||
from datahub.emitter.mcp import MetadataChangeProposalWrapper | ||
from datahub.metadata.com.linkedin.pegasus2avro.mxe import MetadataChangeEvent | ||
from datahub.metadata.schema_classes import ( | ||
BrowsePathEntryClass, | ||
BrowsePathsV2Class, | ||
DatasetPropertiesClass, | ||
DatasetSnapshotClass, | ||
) | ||
|
||
from datahub_airflow_plugin.operators.datahub import DatahubEmitterOperator | ||
|
||
default_args = { | ||
"owner": "airflow", | ||
"depends_on_past": False, | ||
"start_date": datetime(2023, 1, 1), | ||
"email": ["[email protected]"], | ||
"email_on_failure": False, | ||
"execution_timeout": timedelta(minutes=5), | ||
} | ||
|
||
|
||
with DAG( | ||
"datahub_emitter_operator_jinja_template_dag", | ||
default_args=default_args, | ||
description="An example dag with jinja template", | ||
schedule_interval=None, | ||
tags=["example_tag"], | ||
catchup=False, | ||
default_view="tree", | ||
): | ||
add_custom_properties = DatahubEmitterOperator( | ||
task_id="datahub_emitter_operator_jinja_template_dag_task", | ||
mces=[ | ||
MetadataChangeProposalWrapper( | ||
entityUrn="urn:li:dataset:(urn:li:dataPlatform:hive,datahub.example.mcpw_example,DEV)", | ||
aspect=BrowsePathsV2Class( | ||
path=[BrowsePathEntryClass("mcpw_example {{ ds }}")], | ||
), | ||
), | ||
MetadataChangeProposalWrapper( | ||
entityUrn="urn:li:dataset:(urn:li:dataPlatform:hive,datahub.example.mcpw_example_{{ ts_nodash }},DEV)", | ||
aspect=BrowsePathsV2Class( | ||
path=[BrowsePathEntryClass("mcpw_example {{ ds }}")], | ||
), | ||
), | ||
MetadataChangeEvent( | ||
proposedSnapshot=DatasetSnapshotClass( | ||
urn="urn:li:dataset:(urn:li:dataPlatform:hive,datahub.example.lineage_example,DEV)", | ||
aspects=[ | ||
DatasetPropertiesClass( | ||
customProperties={"jinjaTemplate": "{{ ds }}"} | ||
) | ||
], | ||
), | ||
), | ||
MetadataChangeEvent( | ||
proposedSnapshot=DatasetSnapshotClass( | ||
urn="urn:li:dataset:(urn:li:dataPlatform:hive,datahub.example.lineage_example_{{ ts_nodash }},DEV)", | ||
aspects=[ | ||
DatasetPropertiesClass( | ||
customProperties={"jinjaTemplate": "{{ ds }}"} | ||
) | ||
], | ||
), | ||
), | ||
], | ||
datahub_conn_id="datahub_file_default", | ||
) |
Oops, something went wrong.