You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/08/04 02:30:59 UTC

[GitHub] [airflow] coopergillan opened a new pull request #10148: Add typing coverage and fix small bug in sqlite

coopergillan opened a new pull request #10148:
URL: https://github.com/apache/airflow/pull/10148


   1. Fix small bug that kept subclasses of `SqliteHook` from being able to use a custom `conn_name_attr`.
   2. Remove unnecessary class attribute `supports_autocommit` [since the same value is provided in the parent class `DbApiHook`](https://github.com/apache/airflow/blob/a6db84afe1b2824149f735105665da39c2d7b6db/airflow/hooks/dbapi_hook.py#L54)
   3. Finish adding type annotations to the hook and operator
   
   This one was pretty interesting. I actually created https://github.com/apache/airflow/issues/10147 and then started adding the type annotations. Then the `mypy` check helped uncover the bug, too!
   
   ```bash
   airflow/providers/sqlite/hooks/sqlite.py:37: error: "SqliteHook" has no attribute "sqlite_conn_id"
               conn = self.get_connection(self.sqlite_conn_id)  # pylint: disable=no-member
                                          ^
   ```
   
   `mypy` also got confused by having two different variables called `conn`:
   
   ```bash
   airflow/providers/sqlite/hooks/sqlite.py:38: error: Incompatible types in assignment (expression has type
   "sqlite3.dbapi2.Connection", variable has type "airflow.models.connection.Connection")
               conn = sqlite3.connect(conn.host)
                      ^
   ```
   
   Changing the airflow `Connection` object to `airflow_conn` helped clear that up.
   
   closes: #10147
   related: #9708
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
   


----------------------------------------------------------------
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.

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



[GitHub] [airflow] coopergillan commented on pull request #10148: Add typing coverage and fix small bug in sqlite

Posted by GitBox <gi...@apache.org>.
coopergillan commented on pull request #10148:
URL: https://github.com/apache/airflow/pull/10148#issuecomment-668603851


   Closed with #10156 and #10157. 


----------------------------------------------------------------
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.

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



[GitHub] [airflow] potiuk commented on pull request #10148: Add typing coverage and fix small bug in sqlite

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #10148:
URL: https://github.com/apache/airflow/pull/10148#issuecomment-668574431


   > @potiuk - ah yep, should have known! 
   
   No worries: See the #10156 where I explained some why's on our approach. I have the feeling this part is not perfectly described and I am about to update some of the contributing docs soon so I might add it to the explanation.


----------------------------------------------------------------
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.

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



[GitHub] [airflow] coopergillan commented on pull request #10148: Add typing coverage and fix small bug in sqlite

Posted by GitBox <gi...@apache.org>.
coopergillan commented on pull request #10148:
URL: https://github.com/apache/airflow/pull/10148#issuecomment-668566550


   #10157 has the typing coverage. Waiting on builds now.


----------------------------------------------------------------
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.

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



[GitHub] [airflow] potiuk commented on pull request #10148: Add typing coverage and fix small bug in sqlite

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #10148:
URL: https://github.com/apache/airflow/pull/10148#issuecomment-668472832


   Hey @coopergillan -> can youpplease split it into two separate PRs? one for typing coverage and one for bugfix? This way we can merge it separately (we use squash&rebase policy) but they shoudl be two separate commits.


----------------------------------------------------------------
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.

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



[GitHub] [airflow] coopergillan commented on pull request #10148: Add typing coverage and fix small bug in sqlite

Posted by GitBox <gi...@apache.org>.
coopergillan commented on pull request #10148:
URL: https://github.com/apache/airflow/pull/10148#issuecomment-668544484


   @potiuk - ah yep, should have known!
   
   Here's the bug fix: https://github.com/apache/airflow/pull/10156
   
   I guess the typing one will need this merged first, right?


----------------------------------------------------------------
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.

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



[GitHub] [airflow] potiuk edited a comment on pull request #10148: Add typing coverage and fix small bug in sqlite

Posted by GitBox <gi...@apache.org>.
potiuk edited a comment on pull request #10148:
URL: https://github.com/apache/airflow/pull/10148#issuecomment-668472832


   Hey @coopergillan -> can you please split it into two separate PRs? one for typing coverage and one for bugfix? This way we can merge it separately (we use squash&rebase policy) but they shoudl be two separate commits.


----------------------------------------------------------------
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.

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



[GitHub] [airflow] coopergillan closed pull request #10148: Add typing coverage and fix small bug in sqlite

Posted by GitBox <gi...@apache.org>.
coopergillan closed pull request #10148:
URL: https://github.com/apache/airflow/pull/10148


   


----------------------------------------------------------------
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.

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