-
Notifications
You must be signed in to change notification settings - Fork 3.3k
feat(ingest/airflow): add teradata operator support for Airflow plugin #15418
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
Merged
sgomezvillamor
merged 7 commits into
datahub-project:master
from
btkcodedev:btkcodedev/teradataOperatorExtractor
Dec 1, 2025
+965
−1
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c8f7445
feat: add teradata operator support for Airflow plugin
btkcodedev e18ce56
chore: add more tests for improving test coverage, update documentation
btkcodedev 3368c4c
test: add integration test and generated golden file
btkcodedev a41575d
Merge branch 'master' into btkcodedev/teradataOperatorExtractor
btkcodedev 4917311
Merge branch 'master' into btkcodedev/teradataOperatorExtractor
btkcodedev 65fe8e4
Merge branch 'master' into btkcodedev/teradataOperatorExtractor
btkcodedev 95097b3
Merge branch 'master' into btkcodedev/teradataOperatorExtractor
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 hidden or 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 hidden or 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 hidden or 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
39 changes: 39 additions & 0 deletions
39
metadata-ingestion-modules/airflow-plugin/tests/integration/dags/teradata_operator.py
This file contains hidden or 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,39 @@ | ||
| from datetime import datetime | ||
|
|
||
| from airflow import DAG | ||
| from airflow.providers.teradata.operators.teradata import TeradataOperator | ||
|
|
||
| TERADATA_COST_TABLE = "costs" | ||
| TERADATA_PROCESSED_TABLE = "processed_costs" | ||
|
|
||
|
|
||
| def _fake_teradata_execute(*args, **kwargs): | ||
| pass | ||
|
|
||
|
|
||
| with DAG( | ||
| "teradata_operator", | ||
| start_date=datetime(2023, 1, 1), | ||
| schedule_interval=None, | ||
| catchup=False, | ||
| ) as dag: | ||
| TeradataOperator.execute = _fake_teradata_execute | ||
|
|
||
| transform_cost_table = TeradataOperator( | ||
| teradata_conn_id="my_teradata", | ||
| task_id="transform_cost_table", | ||
| sql=""" | ||
| CREATE OR REPLACE TABLE {{ params.out_table_name }} AS | ||
| SELECT | ||
| id, | ||
| month, | ||
| total_cost, | ||
| area, | ||
| total_cost / area as cost_per_area | ||
| FROM {{ params.in_table_name }} | ||
| """, | ||
| params={ | ||
| "in_table_name": TERADATA_COST_TABLE, | ||
| "out_table_name": TERADATA_PROCESSED_TABLE, | ||
| }, | ||
| ) |
Oops, something went wrong.
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.
I would expect this dag integration test to produce some golden file in
https://github.com/btkcodedev/datahub/tree/btkcodedev/teradataOperatorExtractor/metadata-ingestion-modules/airflow-plugin/tests/integration/goldens
May adding the test case in https://github.com/btkcodedev/datahub/blob/btkcodedev/teradataOperatorExtractor/metadata-ingestion-modules/airflow-plugin/tests/integration/test_plugin.py be missed?
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.
Added integration test and generated golden file
Uses extra param as ANSI as declared in docs
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.
Integration test results:

pytest 'tests/integration/test_plugin.py::test_airflow_plugin[v2_teradata_operator]' -v