python-gino / gino

GINO Is Not ORM - a Python asyncio ORM on SQLAlchemy core.
https://python-gino.org/
Other
2.67k stars 150 forks source link

I want to know how gino configures mysql #763

Closed zhenzi0322 closed 3 years ago

zhenzi0322 commented 3 years ago

https://python-gino.org/docs/zh/1.0/tutorials/fastapi.html# I am experiencing unsuccessful mysql configuration when configuring fastapi.

The questions are as follows

?[31mERROR?[0m: Traceback (most recent call last): File "f:\python\python375\envs\gino-fastapi\lib\site-packages\starlette\routing.py", line 526, in lifespan async for item in self.lifespan_context(app): File "f:\python\python375\envs\gino-fastapi\lib\site-packages\starlette\routing.py", line 467, in default_lifespan await self.startup() File "f:\python\python375\envs\gino-fastapi\lib\site-packages\starlette\routing.py", line 502, in startup await handler() File "f:\python\python375\envs\gino-fastapi\lib\site-packages\gino_starlette.py", line 183, in startup config["kwargs"], File "f:\python\python375\envs\gino-fastapi\lib\site-packages\gino_starlette.py", line 226, in set_bind return await super().set_bind(bind, loop=loop, kwargs) File "f:\python\python375\envs\gino-fastapi\lib\site-packages\gino\api.py", line 417, in set_bind bind = await create_engine(bind, loop=loop, **kwargs) File "f:\python\python375\envs\gino-fastapi\lib\site-packages\gino\strategies.py", line 55, in create pool = await dialect.init_pool(u, loop, pool_class=pool_class) AttributeError: 'MySQLDialect_mysqldb' object has no attribute 'init_pool'

wwwjfy commented 3 years ago

It seems MySQLDialect_mysqldb is the SQLAlchemy implementation. This is the synchronous implementation, and gino was created to use async event loop. Try to use gino to initialize.