dify-plugin-tools-dbquery icon indicating copy to clipboard operation
dify-plugin-tools-dbquery copied to clipboard

cannot specify ssl_mode=required on mysql

Open davidkhala opened this issue 2 months ago • 2 comments

Please confirm before submission 在提交之前,请确认

Is this request related to a challenge you're experiencing? Tell me about your story. 这个请求与你正在经历的挑战有关吗?给我讲讲你的故事。

Today I want to use connection property Database properties to configure ssl is mandatory, for a mysql connection by ssl_mode=REQUIRED

But I get

req_id: 566834a4b1 PluginInvokeError: {"args":{},"error_type":"RuntimeError","message":"Error connection database: Connection.__init__() got an unexpected keyword argument 'ssl_mode'"}

I do some research, but it might be the dependency program. If this tool is using pip pymysql or mysqldb, it is not supported. The only supported driver is mysql-connector-python, the Oracle official one.

Expected solution

  • add another connection configuration item for ssl mode enablement specifically, or
  • replace current python driver with mysql-connector-python

Can you help us with this feature? 你能帮我们实现这个功能吗?

  • [x] I am interested in contributing to this feature. 我有兴趣为这个特性做贡献。

davidkhala avatar Oct 01 '25 03:10 davidkhala

SSL Connections The PyMySQL DBAPI accepts the same SSL arguments as that of MySQLdb, described at SSL Connections. See that section for additional examples.

If the server uses an automatically-generated certificate that is self-signed or does not match the host name (as seen from the client), it may also be necessary to indicate ssl_check_hostname=false in PyMySQL:

connection_uri = ( "mysql+pymysql://scott:[email protected]/test" "?ssl_ca=/home/gord/client-ssl/ca.pem" "&ssl_cert=/home/gord/client-ssl/client-cert.pem" "&ssl_key=/home/gord/client-ssl/client-key.pem" "&ssl_check_hostname=false" )

junjiem avatar Oct 09 '25 02:10 junjiem

em. I am not using self-signed cert. I am using public certified mysql endpoint managed by aiven cloud. So is there a plan to allow specifying ssl_cert in plugin ui? Instead, passing a cert content instead of file make more sense.

davidkhala avatar Oct 09 '25 03:10 davidkhala