aiomysql 创建表时出现以下错误(metadata.create_all):
AttributeError: 'Engine' object has no attribute '_run_visitor'
解决方法(修改代码,不用create_all):
from models.account import token_tbl, ip_tbl, ip_token_tbl from sqlalchemy.schema import CreateTable async def create_table(engine) -> None: tables = [token_tbl, ip_tbl, ip_token_tbl] async with engine.acquire() as conn: for table in tables: create_expr = CreateTable(table) await conn.execute(create_expr)