You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "rawwar (via GitHub)" <gi...@apache.org> on 2024/02/13 15:15:26 UTC

[PR] fix: Signature of "insert_rows" incompatible with supertype "DbApiHook" [airflow]

rawwar opened a new pull request, #37391:
URL: https://github.com/apache/airflow/pull/37391

   This PR fixes the following mypy check failures for the google provider.
   
   ```
   airflow/providers/google/cloud/hooks/bigquery.py:228: error: Signature of
   "insert_rows" incompatible with supertype "DbApiHook"  [override]
           def insert_rows(
           ^
   airflow/providers/google/cloud/hooks/bigquery.py:228: note:      Superclass:
   airflow/providers/google/cloud/hooks/bigquery.py:228: note:          def insert_rows(self, table: Any, rows: Any, target_fields: Any = ..., commit_every: Any = ..., replace: Any = ..., executemany: Any = ..., **kwargs: Any) -> Any
   airflow/providers/google/cloud/hooks/bigquery.py:228: note:      Subclass:
   airflow/providers/google/cloud/hooks/bigquery.py:228: note:          def insert_rows(self, table: Any, rows: Any, target_fields: Any = ..., commit_every: Any = ..., replace: Any = ..., **kwargs: Any) -> None
   ```
   
   in DbApiHook--> insert_rows  [method](https://github.com/dabla/airflow/blob/d3e89f82faae157c9c1b9ffd97d1934852f76071/airflow/providers/common/sql/hooks/sql.py#L519)  was recently updated to include executemany parameter.  But,  Google provider --> BigQueryHook  inherits the DbApiHook. Is it necessary that insert_rows ([link](https://github.com/apache/airflow/blob/c020fbd360663607463083cae8528dd1c8dc4281/airflow/providers/google/cloud/hooks/bigquery.py#L228) to the def) defined in an inherited class to have same signature? I've been seeing the following error locally and am wondering if BigQueryHook also needs to include the newly added executemany parameter
   
   Related slack chat: https://apache-airflow.slack.com/archives/CCPRP7943/p1707836093751379


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix: Signature of "insert_rows" incompatible with supertype "DbApiHook" [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk merged PR #37391:
URL: https://github.com/apache/airflow/pull/37391


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org