This is an automated email from the ASF dual-hosted git repository. taragolis pushed a commit to branch fix-dbapi-hook-signature in repository https://gitbox.apache.org/repos/asf/airflow.git
commit eb174682dfd7f25111242bb8899717ef24be6369 Author: Andrey Anshin <[email protected]> AuthorDate: Sat Mar 2 00:53:11 2024 +0400 Make `executemany` keyword arguments only in `DbApiHook.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..9548223762 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=False, **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.
