long2ice / asyncmy

A fast asyncio MySQL/MariaDB driver with replication protocol support
https://github.com/long2ice/asyncmy
Apache License 2.0
230 stars 25 forks source link

AttributeError raised if set ssl with boolean #90

Open simonsmh opened 4 months ago

simonsmh commented 4 months ago

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.

long2ice commented 2 months ago

What version?

simonsmh commented 2 months ago

tested with asyncmy v0.2.9