?[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'
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.
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'