Skip to content

Commit

Permalink
Add auto-commit true in snowflake hook (#767)
Browse files Browse the repository at this point in the history
  • Loading branch information
rajaths010494 authored Nov 18, 2022
1 parent 2bd8fb3 commit 1838fa9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion astronomer/providers/snowflake/hooks/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class SnowflakeHookAsync(SnowflakeHook):
def run( # type: ignore[override]
self,
sql: Union[str, List[str]],
autocommit: bool = False,
autocommit: bool = True,
parameters: Optional[dict] = None, # type: ignore[type-arg]
) -> List[str]:
"""
Expand Down
4 changes: 1 addition & 3 deletions astronomer/providers/snowflake/operators/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ class SnowflakeOperatorAsync(SnowflakeOperator):
def __init__(
self,
*,
autocommit: bool = True,
snowflake_conn_id: str = "snowflake_default",
warehouse: Optional[str] = None,
database: Optional[str] = None,
Expand All @@ -94,7 +93,6 @@ def __init__(
poll_interval: int = 5,
**kwargs: Any,
) -> None:
self.autocommit = autocommit
self.poll_interval = poll_interval
self.warehouse = warehouse
self.database = database
Expand Down Expand Up @@ -152,7 +150,7 @@ def execute(self, context: Context) -> None:
self.log.info("SQL after adding query tag: %s", self.sql)

hook = self.get_db_hook()
hook.run(self.sql, autocommit=self.autocommit, parameters=self.parameters) # type: ignore[arg-type]
hook.run(self.sql, parameters=self.parameters) # type: ignore[arg-type]
self.query_ids = hook.query_ids

if self.do_xcom_push:
Expand Down

0 comments on commit 1838fa9

Please sign in to comment.