griff122 commented on issue #4423: [AIRFLOW-3618] - Fix 
models.connection.Connection get_hook function
URL: 
https://github.com/apache/incubator-airflow/pull/4423#issuecomment-451254464
 
 
   @jgao54  - Ahhh, you are correct! I add the airflow connections from the 
command line during setup:
   ```
   airflow connections --add --conn_id test_local_mysql --conn_type "MySQL" ...
   ```
   I was matching the name that was found on the UI. 
   
   After updating the connection add command to use `--conn_type "mysql"`, it 
now works as expected:
   ```
   >>> from airflow.hooks.base_hook import BaseHook
   >>> conn = BaseHook.get_connection('test_local_mysql')
   [2019-01-03 14:38:37,639] {base_hook.py:83} INFO - Using connection to: 
localhost
   >>> conn.conn_type
   'mysql'
   >>> type(conn.get_hook())
   <class 'airflow.hooks.mysql_hook.MySqlHook'>
   ```
   
   Thanks for that! I was wondering why no one else was seeing this issue.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to