-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add tests and wip integration tests
- Loading branch information
1 parent
3d54e19
commit 51557be
Showing
9 changed files
with
117 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This folder contains future "DAG tests", with should be run in CI with running OCI images. At the moment we had not enough time to finish these integration tests, and it is one of the highest priorities. |
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 __future__ import annotations | ||
|
||
import datetime | ||
|
||
from airflow import DAG | ||
from airflow.providers.common.sql.operators.sql import SQLExecuteQueryOperator | ||
from dagcellent.operators.sql_reflect import SQLReflectOperator | ||
|
||
CONN_ID = "mssql_test" | ||
DAG_ID = __file__.rstrip(".py").split("/")[-1] | ||
|
||
with DAG( | ||
dag_id=DAG_ID, | ||
start_date=datetime.datetime(2020, 2, 2), | ||
schedule="@once", | ||
catchup=False, | ||
) as dag: | ||
|
||
reflect_table = SQLReflectOperator( | ||
task_id="reflect_database", conn_id=CONN_ID, table_name="kaka", database="model" | ||
) | ||
|
||
execute = SQLExecuteQueryOperator( | ||
task_id="execute_query", | ||
conn_id=CONN_ID, | ||
sql=reflect_table.output, | ||
database="model", | ||
) | ||
|
||
reflect_table >> execute |
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,33 @@ | ||
from __future__ import annotations | ||
|
||
import datetime | ||
|
||
from airflow import DAG | ||
from airflow.providers.common.sql.operators.sql import SQLExecuteQueryOperator | ||
from dagcellent.operators.sql_reflect import SQLReflectOperator | ||
|
||
CONN_ID = "mssql_test" | ||
DAG_ID = __file__.rstrip(".py").split("/")[-1] | ||
|
||
with DAG( | ||
dag_id=DAG_ID, | ||
start_date=datetime.datetime(2020, 2, 2), | ||
schedule="@once", | ||
catchup=False, | ||
) as dag: | ||
reflect_table = SQLReflectOperator( | ||
task_id="reflect_database", | ||
conn_id=CONN_ID, | ||
schema="guest", | ||
table_name="schema_test", | ||
database="model", | ||
) | ||
|
||
execute = SQLExecuteQueryOperator( | ||
task_id="execute_query", | ||
conn_id=CONN_ID, | ||
sql=reflect_table.output, | ||
database="model", | ||
) | ||
|
||
reflect_table >> execute |
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
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,45 @@ | ||
"""Test SQL reflection on PostrgeSQL.""" | ||
from __future__ import annotations | ||
|
||
import datetime | ||
|
||
from airflow import DAG | ||
from dagcellent.operators import SqlToS3Operator | ||
from dagcellent.operators.sql_reflect import SQLReflectOperator | ||
|
||
DAG_ID = __file__.rstrip(".py").split("/")[-1] | ||
CONN_ID = "postgres_test" | ||
AWS_CONN_ID = "dummy" | ||
S3_BUCKET = "dummy" | ||
|
||
with DAG( | ||
dag_id=DAG_ID, | ||
description=__doc__, | ||
start_date=datetime.datetime(2020, 2, 2), | ||
schedule="@once", | ||
catchup=False, | ||
) as dag: | ||
reflect_table = SQLReflectOperator( | ||
table_name="ats", | ||
task_id="reflect_database", | ||
conn_id=CONN_ID, | ||
) | ||
|
||
sql_to_s3 = SqlToS3Operator( | ||
task_id="to_s3", | ||
query=reflect_table.output, | ||
database="doesnt matter", | ||
sql_conn_id=CONN_ID, | ||
s3_bucket=S3_BUCKET, | ||
s3_key="airflow/wms_test/lea_inbounddocument/full_load.parquet", | ||
aws_conn_id=AWS_CONN_ID, | ||
file_format="parquet", | ||
replace=True, | ||
pd_kwargs={ | ||
"engine": "pyarrow", | ||
"version": "2.6", | ||
"coerce_timestamps": "us", | ||
}, | ||
) | ||
|
||
reflect_table >> sql_to_s3 # pyright: ignore[reportUnusedExpression] |
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