You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 with the MySql provider's MySqlHook.
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 to UTC at connection time, like so:
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.
Uh oh!
There was an error while loading. Please reload this page.
Description
There is currently no way to pass an
init_command
connection argument for a mysql connection when using either themysqlclient
ormysql-connector-python
libraries with the MySql provider'sMySqlHook
.Documentation for connection arguments for
mysqlclient
library, listinginit_command
:https://mysqlclient.readthedocs.io/user_guide.html?highlight=init_command#functions-and-attributes
Documentation for connection arguments for
mysql-connector-python
library, listinginit_command
: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 thetime_zone
session variable to UTC at connection time, like so: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 atime_zone
argument for connections via themysql-connector-python
library, however that argument is not supported by connections made withmysqlclient
library. Both libraries do support theinit_command
argument.Related issues
No response
Are you willing to submit a PR?
Code of Conduct
The text was updated successfully, but these errors were encountered: