Skip to content

Commit

Permalink
Make executemany keyword arguments only in DbApiHook.insert_rows (#…
Browse files Browse the repository at this point in the history
…37840)

* Make `executemany` keyword arguments only in `DbApiHook.insert_rows`

* Change stubs file signature for insert_rows
  • Loading branch information
Taragolis committed Mar 1, 2024
1 parent e1f60bf commit 2ab6081
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion airflow/providers/common/sql/hooks/sql.py
Expand Up @@ -516,7 +516,15 @@ def _generate_insert_sql(self, table, values, target_fields, replace, **kwargs)
return self._replace_statement_format.format(table, target_fields, ",".join(placeholders))

def insert_rows(
self, table, rows, target_fields=None, commit_every=1000, replace=False, executemany=False, **kwargs
self,
table,
rows,
target_fields=None,
commit_every=1000,
replace=False,
*,
executemany=False,
**kwargs,
):
"""Insert a collection of tuples into a table.
Expand Down
2 changes: 2 additions & 0 deletions airflow/providers/common/sql/hooks/sql.pyi
Expand Up @@ -93,6 +93,8 @@ class DbApiHook(BaseForDbApiHook):
target_fields: Incomplete | None = ...,
commit_every: int = ...,
replace: bool = ...,
*,
executemany: bool = ...,
**kwargs,
) -> None: ...
def bulk_dump(self, table, tmp_file) -> None: ...
Expand Down
2 changes: 0 additions & 2 deletions airflow/providers/google/cloud/hooks/bigquery.py
Expand Up @@ -232,8 +232,6 @@ def insert_rows(
target_fields: Any = None,
commit_every: Any = 1000,
replace: Any = False,
*,
executemany=False,
**kwargs,
) -> None:
"""Insert rows.
Expand Down

0 comments on commit 2ab6081

Please sign in to comment.