Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions airflow/providers/snowflake/hooks/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import os
from contextlib import closing
from io import StringIO
from typing import Any, Callable, Dict, Iterable, List, Optional, Union
from typing import Any, Callable, Dict, List, Optional, Sequence, Union

from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization
Expand Down Expand Up @@ -262,7 +262,7 @@ def run(
self,
sql: Union[str, list],
autocommit: bool = False,
parameters: Optional[Union[dict, Iterable]] = None,
parameters: Optional[Union[Sequence[Any], Dict[Any, Any]]] = None,
handler: Optional[Callable] = None,
):
"""
Expand Down Expand Up @@ -290,7 +290,8 @@ def run(
sql = [sql_string for sql_string, _ in split_statements_tuple if sql_string]

self.log.debug("Executing %d statements against Snowflake DB", len(sql))
with closing(conn.cursor(DictCursor)) as cur:
# SnowflakeCursor does not extend ContextManager, so we have to ignore mypy error here
with closing(conn.cursor(DictCursor)) as cur: # type: ignore[type-var]

for sql_statement in sql:

Expand Down
9 changes: 2 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,13 +510,8 @@ def write_version(filename: str = os.path.join(*[my_dir, "airflow", "git_version
'slack_sdk>=3.0.0',
]
snowflake = [
# Snowflake connector 2.7.2 requires pyarrow >=6.0.0 but apache-beam requires < 6.0.0
# We should remove the limitation when apache-beam upgrades pyarrow
'snowflake-connector-python>=2.4.1,<2.7.2',
# The snowflake-alchemy 1.2.5 introduces a hard dependency on sqlalchemy>=1.4.0, but they didn't define
# this requirements in setup.py, so pip cannot figure out the correct set of dependencies.
# See: https://github.com/snowflakedb/snowflake-sqlalchemy/issues/234
'snowflake-sqlalchemy>=1.1.0,!=1.2.5',
'snowflake-connector-python>=2.4.1',
'snowflake-sqlalchemy>=1.1.0',
]
spark = [
'pyspark',
Expand Down