[ 
https://issues.apache.org/jira/browse/AIRFLOW-3167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17032409#comment-17032409
 ] 

Heitor Silva commented on AIRFLOW-3167:
---------------------------------------

I recently created a Python 3.7 Docker image, based on Debian 9 (Stretch). In 
this image, I run these commands:
{code:java}
pip install --upgrade pip && \
pip install --no-cache-dir -r requirements.txt{code}
 

Here are the dependencies inside requirements.txt:
{code:java}
apache-airflow[devel,mysql]==1.10.6
cryptography
marshmallow<2.20,>=2.18.0
mysql-client
mysql-connector-python
werkzeug==0.16.0
{code}
 

In the docker-compose file, I chose a MySQL 8.0 image for my database, and I 
was connecting to it with:
{code:java}
mysql+mysqlconnector://${DB_USER:-airflow}:${DB_PASSWORD:-Test1234}@airflow.secretdomain.db:${DB_PORT:-3306}/${DB_NAME:-airflow}
{code}
 

When I switched mysqlconnector to mysqldb, I stopped having problems with 
_AttributeError: 'MySQLConverter' object has no attribute '_pendulum_to_mysql'_.

The result connection that works is below:

 
{code:java}
mysql+mysqldb://${DB_USER:-airflow}:${DB_PASSWORD:-Test1234}@airflow.secretdomain.db:${DB_PORT:-3306}/${DB_NAME:-airflow}
{code}
 

Then, I started having problems with the auth system of MySQL 8, which demands 
_caching_sha2_password_. To solve it, I started MySQL with the 
_--default-authentication-plugin=mysql_native_password_. This happens because 
probably the mysqldb driver doesn't support the new hashing of MySQL 8, while 
mysqlconnector does.

I hope I contributed.
Cheers

> airflow test command failed with mysql-connector driver config as the 
> sql_alchemy_conn
> --------------------------------------------------------------------------------------
>
>                 Key: AIRFLOW-3167
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-3167
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: cli, configuration
>    Affects Versions: 1.10.0
>         Environment: macOS High Sierra (10.13.6)
>            Reporter: Yutian Wu
>            Priority: Minor
>             Fix For: 1.8.0
>
>
> After I set the sql_alchemy_conn with the following connection string
> {quote}mysql+mysqlconnector://airflow:airflow_password@localhost/airflow
> {quote}
> the *`airflow test`* command seems not working and complains about the mysql 
> connector library with the following error message:
> {quote}ERROR - Failed on pre-execution callback using <function 
> default_action_log at 0x10bd368c8>
>  Traceback (most recent call last):
>  File 
> "/Users/cielo/.local/share/virtualenvs/MDP-GIS-AaZ6ub-8/lib/python3.6/site-packages/mysql/connector/conversion.py",
>  line 179, in to_mysql
>  return getattr(self, "_\{0}_to_mysql".format(type_name))(value)
>  AttributeError: 'MySQLConverter' object has no attribute '_pendulum_to_mysql'
> {quote}
>  This is not a issue if I use the default driver `MySQLdb(mysqlclient)` in 
> apache-airflow 1.10 (installed using `pip install apache-airflow`).
> Meanwhile, the above issue doesn't happens in airflow 1.8 (installed using 
> `pip install airflow`).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to