asyncmy icon indicating copy to clipboard operation
asyncmy copied to clipboard

AttributeError raised if set ssl with boolean

Open simonsmh opened this issue 1 year ago • 2 comments
trafficstars

I'm using tortoise-orm with asyncmy, with DB_URL and with ssl parameter with docs like this.

await Tortoise.init(
        db_url="mysql://user:pswd@host/db?ssl=True",
        use_tz=True,
    )

When I switching from aiomysql to asyncmy, the error occurs.

  File "/***/tortoise/backends/mysql/client.py", line 114, in create_connection
    self._pool = await mysql.create_pool(password=self.password, **self._template)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "asyncmy/pool.pyx", line 216, in _create_pool
  File "asyncmy/pool.pyx", line 217, in asyncmy.pool._create_pool
  File "asyncmy/pool.pyx", line 145, in fill_free_pool
  File "asyncmy/connection.pyx", line 1340, in _connect
  File "asyncmy/connection.pyx", line 232, in asyncmy.connection.Connection.__init__
  File "asyncmy/connection.pyx", line 303, in asyncmy.connection.Connection._create_ssl_ctx
AttributeError: 'bool' object has no attribute 'get'

I think there should be a default setting if the ssl param is not a dict instance. Everything works on aiomysql btw.

simonsmh avatar Mar 03 '24 09:03 simonsmh

What version?

long2ice avatar Apr 24 '24 08:04 long2ice

tested with asyncmy v0.2.9

simonsmh avatar Apr 27 '24 05:04 simonsmh