This is an automated email from the ASF dual-hosted git repository.
husseinawala pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 2ab60812a0 Make `executemany` keyword arguments only in
`DbApiHook.insert_rows` (#37840)
2ab60812a0 is described below
commit 2ab60812a040cb8b760acaf396f625d0d719e4be
Author: Andrey Anshin <[email protected]>
AuthorDate: Sat Mar 2 02:43:27 2024 +0400
Make `executemany` keyword arguments only in `DbApiHook.insert_rows`
(#37840)
* Make `executemany` keyword arguments only in `DbApiHook.insert_rows`
* Change stubs file signature for insert_rows
---
airflow/providers/common/sql/hooks/sql.py | 10 +++++++++-
airflow/providers/common/sql/hooks/sql.pyi | 2 ++
airflow/providers/google/cloud/hooks/bigquery.py | 2 --
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/airflow/providers/common/sql/hooks/sql.py
b/airflow/providers/common/sql/hooks/sql.py
index 1da7d2c739..8bf37953e7 100644
--- a/airflow/providers/common/sql/hooks/sql.py
+++ b/airflow/providers/common/sql/hooks/sql.py
@@ -516,7 +516,15 @@ class DbApiHook(BaseHook):
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.
diff --git a/airflow/providers/common/sql/hooks/sql.pyi
b/airflow/providers/common/sql/hooks/sql.pyi
index 58d6b874d8..08e8553a68 100644
--- a/airflow/providers/common/sql/hooks/sql.pyi
+++ b/airflow/providers/common/sql/hooks/sql.pyi
@@ -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: ...
diff --git a/airflow/providers/google/cloud/hooks/bigquery.py
b/airflow/providers/google/cloud/hooks/bigquery.py
index 5f5ab68c1f..2b252f3c3f 100644
--- a/airflow/providers/google/cloud/hooks/bigquery.py
+++ b/airflow/providers/google/cloud/hooks/bigquery.py
@@ -232,8 +232,6 @@ class BigQueryHook(GoogleBaseHook, DbApiHook):
target_fields: Any = None,
commit_every: Any = 1000,
replace: Any = False,
- *,
- executemany=False,
**kwargs,
) -> None:
"""Insert rows.