alexbegg opened a new issue, #33300:
URL: https://github.com/apache/airflow/issues/33300

   ### Description
   
   There is currently no way to pass an `init_command` connection argument for 
a mysql connection when using either the `mysqlclient` or 
`mysql-connector-python` libraries.
   
   Documentation for connection arguments for `mysqlclient` library:
   
https://mysqlclient.readthedocs.io/user_guide.html?highlight=init_command#functions-and-attributes
   
   Documentation for connection arguments for `mysql-connector-python` library:
   
https://dev.mysql.com/doc/connector-python/en/connector-python-connectargs.html
   
   There can be many uses for `init_command`, but also what comes to mind is 
why do we explicitly provide support to certain connection arguments and not 
others?
   
   ### Use case/motivation
   
   For my own use right now I am currently am subclassing the hook and then 
altering the connection arguments to pass in `init_command` to set the 
`time_zone` session variable at connection time, like so:
   
   ```python
   conn_config['init_command'] = r"""SET time_zone = "+00:00";"""
   ```
   
   Note: This is just an example, there can be many other uses for 
`init_command` besides the example above. Also, I am aware there is a 
`time_zone` argument for connections via the `mysql-connector-python` library, 
however that argument is not supported by connections made with `mysqlclient` 
library. Both libraries do support the `init_command` argument.
   
   ### Related issues
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to