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 2021/03/17 17:39:44 UTC

[GitHub] [airflow] ericpp opened a new issue #14857: MySQL hook uses wrong autocommit calls for mysql-connector-python

ericpp opened a new issue #14857:
URL: https://github.com/apache/airflow/issues/14857


   The MySQL hook seems to be using `conn.get_autocommit()` and `conn.autocommit()` to get/set the autocommit flag for both mysqlclient and mysql-connector-python. These method don't actually exist in mysql-connector-python as it uses autocommit as a property rather than a method.
   
   I was able to work around it by adding an `if not callable(conn.autocommit)` condition to detect when mysql-connector-python is being used, but I'm sure there's probably a more elegant way of detecting which client is being used.
   
   mysql-connector-python documentation:
   https://dev.mysql.com/doc/connector-python/en/connector-python-api-mysqlconnection-autocommit.html
   
   Autocommit calls:
   https://github.com/apache/airflow/blob/2a2adb3f94cc165014d746102e12f9620f271391/airflow/providers/mysql/hooks/mysql.py#L55
   https://github.com/apache/airflow/blob/2a2adb3f94cc165014d746102e12f9620f271391/airflow/providers/mysql/hooks/mysql.py#L66


----------------------------------------------------------------
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] ericpp commented on issue #14857: MySQL hook uses wrong autocommit calls for mysql-connector-python

Posted by GitBox <gi...@apache.org>.
ericpp commented on issue #14857:
URL: https://github.com/apache/airflow/issues/14857#issuecomment-801362326


   @eladkal I did try that, but `conn` seems to point to a mysql-connector-python instance rather than the Airflow Connection model


----------------------------------------------------------------
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] eladkal commented on issue #14857: MySQL hook uses wrong autocommit calls for mysql-connector-python

Posted by GitBox <gi...@apache.org>.
eladkal commented on issue #14857:
URL: https://github.com/apache/airflow/issues/14857#issuecomment-801354085


   You can know which is used by using `client_name`:
   https://github.com/apache/airflow/blob/2a2adb3f94cc165014d746102e12f9620f271391/airflow/providers/mysql/hooks/mysql.py#L140
   
   
   https://github.com/apache/airflow/blob/2a2adb3f94cc165014d746102e12f9620f271391/airflow/providers/mysql/hooks/mysql.py#L142
   
   https://github.com/apache/airflow/blob/2a2adb3f94cc165014d746102e12f9620f271391/airflow/providers/mysql/hooks/mysql.py#L148
   
   Will you submit a PR to fix the issue?
   
   


----------------------------------------------------------------
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] dstandish closed issue #14857: MySQL hook uses wrong autocommit calls for mysql-connector-python

Posted by GitBox <gi...@apache.org>.
dstandish closed issue #14857:
URL: https://github.com/apache/airflow/issues/14857


   


-- 
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] eladkal edited a comment on issue #14857: MySQL hook uses wrong autocommit calls for mysql-connector-python

Posted by GitBox <gi...@apache.org>.
eladkal edited a comment on issue #14857:
URL: https://github.com/apache/airflow/issues/14857#issuecomment-801354085


   You can know which is used by using `client_name`:
   https://github.com/apache/airflow/blob/2a2adb3f94cc165014d746102e12f9620f271391/airflow/providers/mysql/hooks/mysql.py#L140
   
   
   https://github.com/apache/airflow/blob/2a2adb3f94cc165014d746102e12f9620f271391/airflow/providers/mysql/hooks/mysql.py#L142
   
   https://github.com/apache/airflow/blob/2a2adb3f94cc165014d746102e12f9620f271391/airflow/providers/mysql/hooks/mysql.py#L148
   
   Will you submit a PR to fix the issue?
   
   FYI @feluelle I believe you added the library?


----------------------------------------------------------------
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] boring-cyborg[bot] commented on issue #14857: MySQL hook uses wrong autocommit calls for mysql-connector-python

Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on issue #14857:
URL: https://github.com/apache/airflow/issues/14857#issuecomment-801278015


   Thanks for opening your first issue here! Be sure to follow the issue template!
   


----------------------------------------------------------------
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] ericpp edited a comment on issue #14857: MySQL hook uses wrong autocommit calls for mysql-connector-python

Posted by GitBox <gi...@apache.org>.
ericpp edited a comment on issue #14857:
URL: https://github.com/apache/airflow/issues/14857#issuecomment-801362326


   @eladkal I did try that, but `conn` seems to point to a mysql-connector-python instance rather than the Airflow Connection model in `set_autocommit` and `get_autocommit`


----------------------------------------------------------------
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] ericpp edited a comment on issue #14857: MySQL hook uses wrong autocommit calls for mysql-connector-python

Posted by GitBox <gi...@apache.org>.
ericpp edited a comment on issue #14857:
URL: https://github.com/apache/airflow/issues/14857#issuecomment-801362326






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