Skip to content

Fix mypy and add snowflake sensor dag to master dag #907

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
merged 10 commits into from
Mar 3, 2023
1 change: 1 addition & 0 deletions .circleci/integration-tests/master_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ def prepare_dag_dependency(task_info, execution_time):
snowflake_task_info = [
{"snowflake_dag": "example_snowflake"},
{"snowflake_sql_api_dag": "example_snowflake_sql_api"},
{"example_snowflake_sensor": "example_snowflake_sensor"},
]
snowflake_trigger_tasks, ids = prepare_dag_dependency(snowflake_task_info, "{{ ds }}")
dag_run_ids.extend(ids)
Expand Down
5 changes: 3 additions & 2 deletions astronomer/providers/snowflake/hooks/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

def fetch_all_snowflake_handler(
cursor: SnowflakeCursor,
) -> list[tuple[Any, ...]] | list[dict[str, Any]] | None:
) -> list[dict[str, Any] | tuple[Any, ...] | None]:
"""Handler for SnowflakeCursor to return results"""
return cursor.fetchall()

Expand Down Expand Up @@ -88,7 +88,8 @@ def run( # type: ignore[override]
cur.execute_async(sql_statement)
query_id = cur.sfqid
self.log.info("Snowflake query id: %s", query_id)
self.query_ids.append(query_id)
if query_id:
self.query_ids.append(query_id)

# If autocommit was set to False for db that supports autocommit,
# or if db does not supports autocommit, we do a manual commit.
Expand Down