mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-25 09:15:57 +00:00
fix(airflow): fix airflow snowflake tests (#10803)
This commit is contained in:
parent
65a1dd1d82
commit
6f1f7691a0
@ -6,12 +6,21 @@ from airflow.providers.snowflake.operators.snowflake import SnowflakeOperator
|
|||||||
SNOWFLAKE_COST_TABLE = "costs"
|
SNOWFLAKE_COST_TABLE = "costs"
|
||||||
SNOWFLAKE_PROCESSED_TABLE = "processed_costs"
|
SNOWFLAKE_PROCESSED_TABLE = "processed_costs"
|
||||||
|
|
||||||
|
|
||||||
|
def _fake_snowflake_execute(*args, **kwargs):
|
||||||
|
raise ValueError("mocked snowflake execute to not run queries")
|
||||||
|
|
||||||
|
|
||||||
with DAG(
|
with DAG(
|
||||||
"snowflake_operator",
|
"snowflake_operator",
|
||||||
start_date=datetime(2023, 1, 1),
|
start_date=datetime(2023, 1, 1),
|
||||||
schedule_interval=None,
|
schedule_interval=None,
|
||||||
catchup=False,
|
catchup=False,
|
||||||
) as dag:
|
) as dag:
|
||||||
|
# HACK: We don't want to send real requests to Snowflake. As a workaround,
|
||||||
|
# we can simply monkey-patch the operator.
|
||||||
|
SnowflakeOperator.execute = _fake_snowflake_execute # type: ignore
|
||||||
|
|
||||||
transform_cost_table = SnowflakeOperator(
|
transform_cost_table = SnowflakeOperator(
|
||||||
snowflake_conn_id="my_snowflake",
|
snowflake_conn_id="my_snowflake",
|
||||||
task_id="transform_cost_table",
|
task_id="transform_cost_table",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user