diff --git a/.gitignore b/.gitignore index 4355a67..b103907 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,68 @@ wheels/ .installed.cfg *.egg +# 虚拟环境(非常重要,防止把本地依赖包提交上去) +venv/ +env/ +.idea +.idea/ +.venv/ +ENV/ + +# 日志文件 +*.log + +# 操作系统文件 +.DS_Store +Thumbs.db + +# pytest 测试产物 +.pytest_cache/ +.coverage +coverage.xml +htmlcov/ +junit.xml + +# mypy 类型检查缓存 +.mypy_cache/ +# 向量库、本地数据库、模型文件(大文件不要提交git) +*.db +*.sqlite +*.milvus +*.neo4j +*.bin +*.pth +*.ckpt +*.onnx + +# 本地导出数据、临时csv/excel +data/tmp/ +data/output/ +*.csv +*.xlsx +*.parquet +# Python 缓存与编译文件 +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg + # 虚拟环境(非常重要,防止把本地依赖包提交上去) venv/ env/ diff --git a/api/router.py b/api/router.py index 42dbb97..2e35ced 100644 --- a/api/router.py +++ b/api/router.py @@ -7,9 +7,14 @@ from api.routers import auth from api.routers import customer_agent from api.routers import knowledge from api.routers import auth, product, questionnaire +from api.routers import account, auth, holdings, purchase, redeem api_router = APIRouter() api_router.include_router(auth.router, prefix="/api", tags=["认证"]) +api_router.include_router(account.router, prefix="/api", tags=["资金账户"]) +api_router.include_router(holdings.router, prefix="/api", tags=["持仓"]) +api_router.include_router(purchase.router, prefix="/api", tags=["交易"]) +api_router.include_router(redeem.router, prefix="/api", tags=["交易"]) api_router.include_router(customer_agent.router, prefix="/api/agent/customer", tags=["客服Agent"]) api_router.include_router(knowledge.router, prefix="/api/knowledge", tags=["知识库"]) api_router.include_router(product.router, prefix="/api", tags=["产品"]) diff --git a/logs/error.log b/logs/error.log index 428d8f4..e69de29 100644 --- a/logs/error.log +++ b/logs/error.log @@ -1,1256 +0,0 @@ -2026-09-08 17:26:52,160 ERROR [-] api: unhandled error on /api/auth/login -Traceback (most recent call last): - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\errors.py", line 164, in __call__ - await self.app(scope, receive, _send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\base.py", line 193, in __call__ - response = await self.dispatch_func(request, call_next) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "D:\Projects\py\Memory_demo\utils\request_id.py", line 28, in dispatch - response: Response = await call_next(request) - ^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\base.py", line 168, in call_next - raise app_exc from app_exc.__cause__ or app_exc.__context__ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\base.py", line 144, in coro - await self.app(scope, receive_or_disconnect, send_no_error) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\exceptions.py", line 63, in __call__ - await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app - raise exc - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app - await app(scope, receive, sender) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in __call__ - await self.app(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\routing.py", line 670, in __call__ - await self.middleware_stack(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 2734, in app - await route.handle(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 1780, in handle - await self.original_router.handle(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 2789, in handle - await included_router._handle_selected(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 1791, in _handle_selected - await route.handle(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 1780, in handle - await self.original_router.handle(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 2789, in handle - await included_router._handle_selected(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 1800, in _handle_selected - await original_route.handle(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 1279, in handle - await app(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 158, in app - await wrap_app_handling_exceptions(app, request)(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app - raise exc - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app - await app(scope, receive, sender) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 144, in app - response = await f(request) - ^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 481, in app - solved_result = await solve_dependencies( - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\dependencies\utils.py", line 668, in solve_dependencies - solved = await _solve_generator( - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\dependencies\utils.py", line 574, in _solve_generator - return await stack.enter_async_context(cm) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\contextlib.py", line 647, in enter_async_context - result = await _enter(cm) - ^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\contextlib.py", line 204, in __aenter__ - return await anext(self.gen) - ^^^^^^^^^^^^^^^^^^^^^ - File "D:\Projects\py\Memory_demo\config\deps.py", line 7, in get_db - async with mysql.get_session_factory() as session: -TypeError: 'async_sessionmaker' object does not support the asynchronous context manager protocol -2026-09-08 17:26:52,230 ERROR [-] sqlalchemy.pool.impl.AsyncAdaptedQueuePool: Exception closing connection > -Traceback (most recent call last): - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\pool\base.py", line 375, in _close_connection - self._dialect.do_close(connection) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\default.py", line 721, in do_close - dbapi_connection.close() - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\dialects\mysql\aiomysql.py", line 114, in close - self.await_(self._connection.ensure_closed()) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 132, in await_only - return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 196, in greenlet_spawn - value = await result - ^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiomysql\connection.py", line 349, in ensure_closed - self._writer.write(send_data) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\asyncio\streams.py", line 331, in write - self._transport.write(data) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\asyncio\proactor_events.py", line 366, in write - self._loop_writing(data=bytes(data)) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\asyncio\proactor_events.py", line 402, in _loop_writing - self._write_fut = self._loop._proactor.send(self._sock, data) - ^^^^^^^^^^^^^^^^^^^^^^^^^ -AttributeError: 'NoneType' object has no attribute 'send' -2026-09-08 17:27:10,975 ERROR [7920a7ecec5e4f8b] sqlalchemy.pool.impl.AsyncAdaptedQueuePool: Exception terminating connection > -Traceback (most recent call last): - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\pool\base.py", line 373, in _close_connection - self._dialect.do_terminate(connection) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\dialects\mysql\aiomysql.py", line 242, in do_terminate - dbapi_connection.terminate() - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\connectors\asyncio.py", line 402, in terminate - self.await_(asyncio.shield(self._terminate_graceful_close())) # type: ignore[attr-defined] # noqa: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 132, in await_only - return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 196, in greenlet_spawn - value = await result - ^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\dialects\mysql\aiomysql.py", line 117, in _terminate_graceful_close - await self._connection.ensure_closed() - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiomysql\connection.py", line 349, in ensure_closed - self._writer.write(send_data) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\asyncio\streams.py", line 331, in write - self._transport.write(data) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\asyncio\proactor_events.py", line 366, in write - self._loop_writing(data=bytes(data)) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\asyncio\proactor_events.py", line 402, in _loop_writing - self._write_fut = self._loop._proactor.send(self._sock, data) - ^^^^^^^^^^^^^^^^^^^^^^^^^ -AttributeError: 'NoneType' object has no attribute 'send' -2026-09-08 17:27:11,025 ERROR [-] api: unhandled error on /api/auth/login -Traceback (most recent call last): - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\errors.py", line 164, in __call__ - await self.app(scope, receive, _send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\base.py", line 193, in __call__ - response = await self.dispatch_func(request, call_next) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "D:\Projects\py\Memory_demo\utils\request_id.py", line 28, in dispatch - response: Response = await call_next(request) - ^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\base.py", line 168, in call_next - raise app_exc from app_exc.__cause__ or app_exc.__context__ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\base.py", line 144, in coro - await self.app(scope, receive_or_disconnect, send_no_error) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\exceptions.py", line 63, in __call__ - await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app - raise exc - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app - await app(scope, receive, sender) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in __call__ - await self.app(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\routing.py", line 670, in __call__ - await self.middleware_stack(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 2734, in app - await route.handle(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 1780, in handle - await self.original_router.handle(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 2789, in handle - await included_router._handle_selected(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 1791, in _handle_selected - await route.handle(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 1780, in handle - await self.original_router.handle(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 2789, in handle - await included_router._handle_selected(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 1800, in _handle_selected - await original_route.handle(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 1279, in handle - await app(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 158, in app - await wrap_app_handling_exceptions(app, request)(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app - raise exc - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app - await app(scope, receive, sender) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 144, in app - response = await f(request) - ^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 706, in app - raw_response = await run_endpoint_function( - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 352, in run_endpoint_function - return await dependant.call(**values) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "D:\Projects\py\Memory_demo\api\routers\auth.py", line 35, in login - user = await SysUserRepo(db).get_by_username(body.username) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "D:\Projects\py\Memory_demo\repositories\sys_user.py", line 14, in get_by_username - return await self.db.scalar(select(SysUser).where(SysUser.username == username)) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\ext\asyncio\session.py", line 504, in scalar - return await greenlet_spawn( - ^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 201, in greenlet_spawn - result = context.throw(*sys.exc_info()) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\session.py", line 2421, in scalar - return self._execute_internal( - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\session.py", line 2261, in _execute_internal - conn = self._connection_for_bind(bind) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\session.py", line 2113, in _connection_for_bind - return trans._connection_for_bind(engine, execution_options) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "", line 2, in _connection_for_bind - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\state_changes.py", line 137, in _go - ret_value = fn(self, *arg, **kw) - ^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\session.py", line 1191, in _connection_for_bind - conn = bind.connect() - ^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 3295, in connect - return self._connection_cls(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 144, in __init__ - self._dbapi_connection = engine.raw_connection() - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 3319, in raw_connection - return self.pool.connect() - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\pool\base.py", line 448, in connect - return _ConnectionFairy._checkout(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\pool\base.py", line 1371, in _checkout - with util.safe_reraise(): - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\pool\base.py", line 1309, in _checkout - result = pool._dialect._do_ping_w_event( - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\default.py", line 729, in _do_ping_w_event - return self.do_ping(dbapi_connection) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\dialects\mysql\pymysql.py", line 144, in do_ping - dbapi_connection.ping() - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\dialects\mysql\aiomysql.py", line 100, in ping - self.await_(self._connection.ping(reconnect=False)) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 132, in await_only - return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 196, in greenlet_spawn - value = await result - ^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiomysql\connection.py", line 493, in ping - await self._execute_command(COMMAND.COM_PING, "") - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiomysql\connection.py", line 724, in _execute_command - self._write_bytes(prelude + sql[:chunk_size - 1]) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiomysql\connection.py", line 669, in _write_bytes - return self._writer.write(data) - ^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\asyncio\streams.py", line 331, in write - self._transport.write(data) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\asyncio\proactor_events.py", line 366, in write - self._loop_writing(data=bytes(data)) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\asyncio\proactor_events.py", line 402, in _loop_writing - self._write_fut = self._loop._proactor.send(self._sock, data) - ^^^^^^^^^^^^^^^^^^^^^^^^^ -AttributeError: 'NoneType' object has no attribute 'send' -2026-09-08 17:27:39,262 ERROR [c744544f6e564c1a] sqlalchemy.pool.impl.AsyncAdaptedQueuePool: Exception terminating connection > -Traceback (most recent call last): - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\pool\base.py", line 373, in _close_connection - self._dialect.do_terminate(connection) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\dialects\mysql\aiomysql.py", line 242, in do_terminate - dbapi_connection.terminate() - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\connectors\asyncio.py", line 402, in terminate - self.await_(asyncio.shield(self._terminate_graceful_close())) # type: ignore[attr-defined] # noqa: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 132, in await_only - return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 196, in greenlet_spawn - value = await result - ^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\dialects\mysql\aiomysql.py", line 117, in _terminate_graceful_close - await self._connection.ensure_closed() - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiomysql\connection.py", line 349, in ensure_closed - self._writer.write(send_data) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\asyncio\streams.py", line 331, in write - self._transport.write(data) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\asyncio\proactor_events.py", line 366, in write - self._loop_writing(data=bytes(data)) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\asyncio\proactor_events.py", line 402, in _loop_writing - self._write_fut = self._loop._proactor.send(self._sock, data) - ^^^^^^^^^^^^^^^^^^^^^^^^^ -AttributeError: 'NoneType' object has no attribute 'send' -2026-09-08 17:27:39,266 ERROR [-] api: unhandled error on /api/auth/login -Traceback (most recent call last): - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\errors.py", line 164, in __call__ - await self.app(scope, receive, _send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\base.py", line 193, in __call__ - response = await self.dispatch_func(request, call_next) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "D:\Projects\py\Memory_demo\utils\request_id.py", line 28, in dispatch - response: Response = await call_next(request) - ^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\base.py", line 168, in call_next - raise app_exc from app_exc.__cause__ or app_exc.__context__ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\base.py", line 144, in coro - await self.app(scope, receive_or_disconnect, send_no_error) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\exceptions.py", line 63, in __call__ - await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app - raise exc - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app - await app(scope, receive, sender) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in __call__ - await self.app(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\routing.py", line 670, in __call__ - await self.middleware_stack(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 2734, in app - await route.handle(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 1780, in handle - await self.original_router.handle(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 2789, in handle - await included_router._handle_selected(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 1791, in _handle_selected - await route.handle(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 1780, in handle - await self.original_router.handle(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 2789, in handle - await included_router._handle_selected(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 1800, in _handle_selected - await original_route.handle(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 1279, in handle - await app(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 158, in app - await wrap_app_handling_exceptions(app, request)(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app - raise exc - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app - await app(scope, receive, sender) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 144, in app - response = await f(request) - ^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 706, in app - raw_response = await run_endpoint_function( - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 352, in run_endpoint_function - return await dependant.call(**values) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "D:\Projects\py\Memory_demo\api\routers\auth.py", line 35, in login - user = await SysUserRepo(db).get_by_username(body.username) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "D:\Projects\py\Memory_demo\repositories\sys_user.py", line 14, in get_by_username - return await self.db.scalar(select(SysUser).where(SysUser.username == username)) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\ext\asyncio\session.py", line 504, in scalar - return await greenlet_spawn( - ^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 201, in greenlet_spawn - result = context.throw(*sys.exc_info()) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\session.py", line 2421, in scalar - return self._execute_internal( - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\session.py", line 2261, in _execute_internal - conn = self._connection_for_bind(bind) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\session.py", line 2113, in _connection_for_bind - return trans._connection_for_bind(engine, execution_options) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "", line 2, in _connection_for_bind - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\state_changes.py", line 137, in _go - ret_value = fn(self, *arg, **kw) - ^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\session.py", line 1191, in _connection_for_bind - conn = bind.connect() - ^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 3295, in connect - return self._connection_cls(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 144, in __init__ - self._dbapi_connection = engine.raw_connection() - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 3319, in raw_connection - return self.pool.connect() - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\pool\base.py", line 448, in connect - return _ConnectionFairy._checkout(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\pool\base.py", line 1371, in _checkout - with util.safe_reraise(): - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\pool\base.py", line 1309, in _checkout - result = pool._dialect._do_ping_w_event( - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\default.py", line 729, in _do_ping_w_event - return self.do_ping(dbapi_connection) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\dialects\mysql\pymysql.py", line 144, in do_ping - dbapi_connection.ping() - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\dialects\mysql\aiomysql.py", line 100, in ping - self.await_(self._connection.ping(reconnect=False)) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 132, in await_only - return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 196, in greenlet_spawn - value = await result - ^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiomysql\connection.py", line 493, in ping - await self._execute_command(COMMAND.COM_PING, "") - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiomysql\connection.py", line 724, in _execute_command - self._write_bytes(prelude + sql[:chunk_size - 1]) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiomysql\connection.py", line 669, in _write_bytes - return self._writer.write(data) - ^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\asyncio\streams.py", line 331, in write - self._transport.write(data) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\asyncio\proactor_events.py", line 366, in write - self._loop_writing(data=bytes(data)) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\asyncio\proactor_events.py", line 402, in _loop_writing - self._write_fut = self._loop._proactor.send(self._sock, data) - ^^^^^^^^^^^^^^^^^^^^^^^^^ -AttributeError: 'NoneType' object has no attribute 'send' -2026-09-10 20:49:20,257 ERROR [-] api: unhandled error on /api/auth/login -Traceback (most recent call last): - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\errors.py", line 164, in __call__ - await self.app(scope, receive, _send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\base.py", line 193, in __call__ - response = await self.dispatch_func(request, call_next) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\utils\request_id.py", line 28, in dispatch - response: Response = await call_next(request) - ^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\base.py", line 168, in call_next - raise app_exc from app_exc.__cause__ or app_exc.__context__ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\base.py", line 144, in coro - await self.app(scope, receive_or_disconnect, send_no_error) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\exceptions.py", line 63, in __call__ - await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app - raise exc - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app - await app(scope, receive, sender) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in __call__ - await self.app(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\routing.py", line 670, in __call__ - await self.middleware_stack(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 2734, in app - await route.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1780, in handle - await self.original_router.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 2789, in handle - await included_router._handle_selected(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1791, in _handle_selected - await route.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1780, in handle - await self.original_router.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 2789, in handle - await included_router._handle_selected(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1800, in _handle_selected - await original_route.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1279, in handle - await app(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 158, in app - await wrap_app_handling_exceptions(app, request)(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app - raise exc - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app - await app(scope, receive, sender) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 144, in app - response = await f(request) - ^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 706, in app - raw_response = await run_endpoint_function( - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 352, in run_endpoint_function - return await dependant.call(**values) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\api\routers\auth.py", line 19, in login - return success(await auth_login(db, body.username, body.password)) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\service\auth.py", line 68, in login - user = await SysUserRepo(db).get_by_username(username) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\repositories\sys_user.py", line 14, in get_by_username - return await self.db.scalar(select(SysUser).where(SysUser.username == username)) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\ext\asyncio\session.py", line 504, in scalar - return await greenlet_spawn( - ^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 201, in greenlet_spawn - result = context.throw(*sys.exc_info()) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 2421, in scalar - return self._execute_internal( - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 2261, in _execute_internal - conn = self._connection_for_bind(bind) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 2113, in _connection_for_bind - return trans._connection_for_bind(engine, execution_options) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "", line 2, in _connection_for_bind - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\state_changes.py", line 137, in _go - ret_value = fn(self, *arg, **kw) - ^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 1191, in _connection_for_bind - conn = bind.connect() - ^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 3295, in connect - return self._connection_cls(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 144, in __init__ - self._dbapi_connection = engine.raw_connection() - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 3319, in raw_connection - return self.pool.connect() - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 448, in connect - return _ConnectionFairy._checkout(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 1272, in _checkout - fairy = _ConnectionRecord.checkout(pool) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 712, in checkout - rec = pool._do_get() - ^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 178, in _do_get - with util.safe_reraise(): - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 176, in _do_get - return self._create_connection() - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 389, in _create_connection - return _ConnectionRecord(self) - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 674, in __init__ - self.__connect() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 900, in __connect - with util.safe_reraise(): - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 896, in __connect - self.dbapi_connection = connection = pool._invoke_creator(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\create.py", line 667, in connect - return dialect.connect(*cargs_tup, **cparams) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\default.py", line 630, in connect - return self.loaded_dbapi.connect(*cargs, **cparams) # type: ignore[no-any-return] # NOQA: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\dialects\mysql\aiomysql.py", line 176, in connect - await_only(creator_fn(*arg, **kw)), - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 132, in await_only - return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 196, in greenlet_spawn - value = await result - ^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 74, in _connect - await conn._connect() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 540, in _connect - await self._request_authentication() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 865, in _request_authentication - await self.caching_sha2_password_auth(auth_packet) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 984, in caching_sha2_password_auth - data = _auth.sha2_rsa_encrypt( - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\pymysql\_auth.py", line 144, in sha2_rsa_encrypt - raise RuntimeError( -RuntimeError: 'cryptography' package is required for sha256_password or caching_sha2_password auth methods -2026-09-10 20:50:16,723 ERROR [-] api: unhandled error on /api/auth/login -Traceback (most recent call last): - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 144, in __init__ - self._dbapi_connection = engine.raw_connection() - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 3319, in raw_connection - return self.pool.connect() - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 448, in connect - return _ConnectionFairy._checkout(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 1272, in _checkout - fairy = _ConnectionRecord.checkout(pool) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 712, in checkout - rec = pool._do_get() - ^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 178, in _do_get - with util.safe_reraise(): - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 176, in _do_get - return self._create_connection() - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 389, in _create_connection - return _ConnectionRecord(self) - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 674, in __init__ - self.__connect() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 900, in __connect - with util.safe_reraise(): - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 896, in __connect - self.dbapi_connection = connection = pool._invoke_creator(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\create.py", line 667, in connect - return dialect.connect(*cargs_tup, **cparams) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\default.py", line 630, in connect - return self.loaded_dbapi.connect(*cargs, **cparams) # type: ignore[no-any-return] # NOQA: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\dialects\mysql\aiomysql.py", line 176, in connect - await_only(creator_fn(*arg, **kw)), - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 132, in await_only - return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 196, in greenlet_spawn - value = await result - ^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 74, in _connect - await conn._connect() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 540, in _connect - await self._request_authentication() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 865, in _request_authentication - await self.caching_sha2_password_auth(auth_packet) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 989, in caching_sha2_password_auth - pkt = await self._read_packet() - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 652, in _read_packet - packet.raise_for_error() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\pymysql\protocol.py", line 219, in raise_for_error - err.raise_mysql_exception(self._data) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\pymysql\err.py", line 154, in raise_mysql_exception - raise errorclass(errno, errval, sqlstate=sqlstate) -pymysql.err.OperationalError: (1049, "Unknown database 'memory'") - -The above exception was the direct cause of the following exception: - -Traceback (most recent call last): - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\errors.py", line 164, in __call__ - await self.app(scope, receive, _send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\base.py", line 193, in __call__ - response = await self.dispatch_func(request, call_next) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\utils\request_id.py", line 28, in dispatch - response: Response = await call_next(request) - ^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\base.py", line 168, in call_next - raise app_exc from app_exc.__cause__ or app_exc.__context__ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\base.py", line 144, in coro - await self.app(scope, receive_or_disconnect, send_no_error) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\exceptions.py", line 63, in __call__ - await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app - raise exc - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app - await app(scope, receive, sender) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in __call__ - await self.app(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\routing.py", line 670, in __call__ - await self.middleware_stack(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 2734, in app - await route.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1780, in handle - await self.original_router.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 2789, in handle - await included_router._handle_selected(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1791, in _handle_selected - await route.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1780, in handle - await self.original_router.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 2789, in handle - await included_router._handle_selected(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1800, in _handle_selected - await original_route.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1279, in handle - await app(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 158, in app - await wrap_app_handling_exceptions(app, request)(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app - raise exc - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app - await app(scope, receive, sender) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 144, in app - response = await f(request) - ^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 706, in app - raw_response = await run_endpoint_function( - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 352, in run_endpoint_function - return await dependant.call(**values) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\api\routers\auth.py", line 19, in login - return success(await auth_login(db, body.username, body.password)) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\service\auth.py", line 68, in login - user = await SysUserRepo(db).get_by_username(username) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\repositories\sys_user.py", line 14, in get_by_username - return await self.db.scalar(select(SysUser).where(SysUser.username == username)) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\ext\asyncio\session.py", line 504, in scalar - return await greenlet_spawn( - ^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 201, in greenlet_spawn - result = context.throw(*sys.exc_info()) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 2421, in scalar - return self._execute_internal( - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 2261, in _execute_internal - conn = self._connection_for_bind(bind) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 2113, in _connection_for_bind - return trans._connection_for_bind(engine, execution_options) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "", line 2, in _connection_for_bind - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\state_changes.py", line 137, in _go - ret_value = fn(self, *arg, **kw) - ^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 1191, in _connection_for_bind - conn = bind.connect() - ^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 3295, in connect - return self._connection_cls(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 146, in __init__ - Connection._handle_dbapi_exception_noconnection( - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 2450, in _handle_dbapi_exception_noconnection - raise sqlalchemy_exception.with_traceback(exc_info[2]) from e - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 144, in __init__ - self._dbapi_connection = engine.raw_connection() - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 3319, in raw_connection - return self.pool.connect() - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 448, in connect - return _ConnectionFairy._checkout(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 1272, in _checkout - fairy = _ConnectionRecord.checkout(pool) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 712, in checkout - rec = pool._do_get() - ^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 178, in _do_get - with util.safe_reraise(): - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 176, in _do_get - return self._create_connection() - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 389, in _create_connection - return _ConnectionRecord(self) - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 674, in __init__ - self.__connect() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 900, in __connect - with util.safe_reraise(): - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 896, in __connect - self.dbapi_connection = connection = pool._invoke_creator(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\create.py", line 667, in connect - return dialect.connect(*cargs_tup, **cparams) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\default.py", line 630, in connect - return self.loaded_dbapi.connect(*cargs, **cparams) # type: ignore[no-any-return] # NOQA: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\dialects\mysql\aiomysql.py", line 176, in connect - await_only(creator_fn(*arg, **kw)), - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 132, in await_only - return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 196, in greenlet_spawn - value = await result - ^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 74, in _connect - await conn._connect() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 540, in _connect - await self._request_authentication() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 865, in _request_authentication - await self.caching_sha2_password_auth(auth_packet) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 989, in caching_sha2_password_auth - pkt = await self._read_packet() - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 652, in _read_packet - packet.raise_for_error() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\pymysql\protocol.py", line 219, in raise_for_error - err.raise_mysql_exception(self._data) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\pymysql\err.py", line 154, in raise_mysql_exception - raise errorclass(errno, errval, sqlstate=sqlstate) -sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (1049, "Unknown database 'memory'") -(Background on this error at: https://sqlalche.me/e/20/e3q8) -2026-09-10 20:51:21,189 ERROR [-] api: unhandled error on /api/auth/login -Traceback (most recent call last): - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 144, in __init__ - self._dbapi_connection = engine.raw_connection() - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 3319, in raw_connection - return self.pool.connect() - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 448, in connect - return _ConnectionFairy._checkout(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 1272, in _checkout - fairy = _ConnectionRecord.checkout(pool) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 712, in checkout - rec = pool._do_get() - ^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 178, in _do_get - with util.safe_reraise(): - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 176, in _do_get - return self._create_connection() - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 389, in _create_connection - return _ConnectionRecord(self) - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 674, in __init__ - self.__connect() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 900, in __connect - with util.safe_reraise(): - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 896, in __connect - self.dbapi_connection = connection = pool._invoke_creator(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\create.py", line 667, in connect - return dialect.connect(*cargs_tup, **cparams) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\default.py", line 630, in connect - return self.loaded_dbapi.connect(*cargs, **cparams) # type: ignore[no-any-return] # NOQA: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\dialects\mysql\aiomysql.py", line 176, in connect - await_only(creator_fn(*arg, **kw)), - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 132, in await_only - return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 196, in greenlet_spawn - value = await result - ^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 74, in _connect - await conn._connect() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 540, in _connect - await self._request_authentication() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 865, in _request_authentication - await self.caching_sha2_password_auth(auth_packet) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 952, in caching_sha2_password_auth - pkt = await self._read_packet() - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 652, in _read_packet - packet.raise_for_error() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\pymysql\protocol.py", line 219, in raise_for_error - err.raise_mysql_exception(self._data) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\pymysql\err.py", line 154, in raise_mysql_exception - raise errorclass(errno, errval, sqlstate=sqlstate) -pymysql.err.OperationalError: (1049, "Unknown database 'memory'") - -The above exception was the direct cause of the following exception: - -Traceback (most recent call last): - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\errors.py", line 164, in __call__ - await self.app(scope, receive, _send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\base.py", line 193, in __call__ - response = await self.dispatch_func(request, call_next) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\utils\request_id.py", line 28, in dispatch - response: Response = await call_next(request) - ^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\base.py", line 168, in call_next - raise app_exc from app_exc.__cause__ or app_exc.__context__ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\base.py", line 144, in coro - await self.app(scope, receive_or_disconnect, send_no_error) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\exceptions.py", line 63, in __call__ - await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app - raise exc - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app - await app(scope, receive, sender) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in __call__ - await self.app(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\routing.py", line 670, in __call__ - await self.middleware_stack(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 2734, in app - await route.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1780, in handle - await self.original_router.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 2789, in handle - await included_router._handle_selected(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1791, in _handle_selected - await route.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1780, in handle - await self.original_router.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 2789, in handle - await included_router._handle_selected(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1800, in _handle_selected - await original_route.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1279, in handle - await app(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 158, in app - await wrap_app_handling_exceptions(app, request)(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app - raise exc - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app - await app(scope, receive, sender) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 144, in app - response = await f(request) - ^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 706, in app - raw_response = await run_endpoint_function( - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 352, in run_endpoint_function - return await dependant.call(**values) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\api\routers\auth.py", line 19, in login - return success(await auth_login(db, body.username, body.password)) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\service\auth.py", line 68, in login - user = await SysUserRepo(db).get_by_username(username) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\repositories\sys_user.py", line 14, in get_by_username - return await self.db.scalar(select(SysUser).where(SysUser.username == username)) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\ext\asyncio\session.py", line 504, in scalar - return await greenlet_spawn( - ^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 201, in greenlet_spawn - result = context.throw(*sys.exc_info()) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 2421, in scalar - return self._execute_internal( - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 2261, in _execute_internal - conn = self._connection_for_bind(bind) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 2113, in _connection_for_bind - return trans._connection_for_bind(engine, execution_options) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "", line 2, in _connection_for_bind - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\state_changes.py", line 137, in _go - ret_value = fn(self, *arg, **kw) - ^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 1191, in _connection_for_bind - conn = bind.connect() - ^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 3295, in connect - return self._connection_cls(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 146, in __init__ - Connection._handle_dbapi_exception_noconnection( - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 2450, in _handle_dbapi_exception_noconnection - raise sqlalchemy_exception.with_traceback(exc_info[2]) from e - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 144, in __init__ - self._dbapi_connection = engine.raw_connection() - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 3319, in raw_connection - return self.pool.connect() - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 448, in connect - return _ConnectionFairy._checkout(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 1272, in _checkout - fairy = _ConnectionRecord.checkout(pool) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 712, in checkout - rec = pool._do_get() - ^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 178, in _do_get - with util.safe_reraise(): - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 176, in _do_get - return self._create_connection() - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 389, in _create_connection - return _ConnectionRecord(self) - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 674, in __init__ - self.__connect() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 900, in __connect - with util.safe_reraise(): - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 896, in __connect - self.dbapi_connection = connection = pool._invoke_creator(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\create.py", line 667, in connect - return dialect.connect(*cargs_tup, **cparams) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\default.py", line 630, in connect - return self.loaded_dbapi.connect(*cargs, **cparams) # type: ignore[no-any-return] # NOQA: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\dialects\mysql\aiomysql.py", line 176, in connect - await_only(creator_fn(*arg, **kw)), - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 132, in await_only - return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 196, in greenlet_spawn - value = await result - ^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 74, in _connect - await conn._connect() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 540, in _connect - await self._request_authentication() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 865, in _request_authentication - await self.caching_sha2_password_auth(auth_packet) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 952, in caching_sha2_password_auth - pkt = await self._read_packet() - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 652, in _read_packet - packet.raise_for_error() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\pymysql\protocol.py", line 219, in raise_for_error - err.raise_mysql_exception(self._data) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\pymysql\err.py", line 154, in raise_mysql_exception - raise errorclass(errno, errval, sqlstate=sqlstate) -sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (1049, "Unknown database 'memory'") -(Background on this error at: https://sqlalche.me/e/20/e3q8) -2026-09-10 21:54:16,943 ERROR [-] api: unhandled error on /api/products -Traceback (most recent call last): - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 144, in __init__ - self._dbapi_connection = engine.raw_connection() - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 3319, in raw_connection - return self.pool.connect() - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 448, in connect - return _ConnectionFairy._checkout(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 1272, in _checkout - fairy = _ConnectionRecord.checkout(pool) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 712, in checkout - rec = pool._do_get() - ^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 178, in _do_get - with util.safe_reraise(): - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 176, in _do_get - return self._create_connection() - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 389, in _create_connection - return _ConnectionRecord(self) - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 674, in __init__ - self.__connect() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 900, in __connect - with util.safe_reraise(): - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 896, in __connect - self.dbapi_connection = connection = pool._invoke_creator(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\create.py", line 667, in connect - return dialect.connect(*cargs_tup, **cparams) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\default.py", line 630, in connect - return self.loaded_dbapi.connect(*cargs, **cparams) # type: ignore[no-any-return] # NOQA: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\dialects\mysql\aiomysql.py", line 176, in connect - await_only(creator_fn(*arg, **kw)), - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 132, in await_only - return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 196, in greenlet_spawn - value = await result - ^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 74, in _connect - await conn._connect() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 540, in _connect - await self._request_authentication() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 865, in _request_authentication - await self.caching_sha2_password_auth(auth_packet) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 989, in caching_sha2_password_auth - pkt = await self._read_packet() - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 652, in _read_packet - packet.raise_for_error() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\pymysql\protocol.py", line 219, in raise_for_error - err.raise_mysql_exception(self._data) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\pymysql\err.py", line 154, in raise_mysql_exception - raise errorclass(errno, errval, sqlstate=sqlstate) -pymysql.err.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: YES)") - -The above exception was the direct cause of the following exception: - -Traceback (most recent call last): - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\errors.py", line 164, in __call__ - await self.app(scope, receive, _send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\base.py", line 193, in __call__ - response = await self.dispatch_func(request, call_next) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\utils\request_id.py", line 28, in dispatch - response: Response = await call_next(request) - ^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\base.py", line 168, in call_next - raise app_exc from app_exc.__cause__ or app_exc.__context__ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\base.py", line 144, in coro - await self.app(scope, receive_or_disconnect, send_no_error) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\exceptions.py", line 63, in __call__ - await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app - raise exc - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app - await app(scope, receive, sender) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in __call__ - await self.app(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\routing.py", line 670, in __call__ - await self.middleware_stack(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 2734, in app - await route.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1780, in handle - await self.original_router.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 2789, in handle - await included_router._handle_selected(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1791, in _handle_selected - await route.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1780, in handle - await self.original_router.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 2789, in handle - await included_router._handle_selected(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1800, in _handle_selected - await original_route.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1279, in handle - await app(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 158, in app - await wrap_app_handling_exceptions(app, request)(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app - raise exc - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app - await app(scope, receive, sender) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 144, in app - response = await f(request) - ^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 706, in app - raw_response = await run_endpoint_function( - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 352, in run_endpoint_function - return await dependant.call(**values) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\api\routers\product.py", line 26, in products - data = await list_products( - ^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\service\product.py", line 54, in list_products - items, total = await ProductRepo(db).search( - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\repositories\product.py", line 64, in search - items = list((await self.db.scalars(stmt)).all()) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\ext\asyncio\session.py", line 561, in scalars - result = await self.execute( - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\ext\asyncio\session.py", line 448, in execute - result = await greenlet_spawn( - ^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 201, in greenlet_spawn - result = context.throw(*sys.exc_info()) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 2373, in execute - return self._execute_internal( - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 2261, in _execute_internal - conn = self._connection_for_bind(bind) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 2113, in _connection_for_bind - return trans._connection_for_bind(engine, execution_options) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "", line 2, in _connection_for_bind - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\state_changes.py", line 137, in _go - ret_value = fn(self, *arg, **kw) - ^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 1191, in _connection_for_bind - conn = bind.connect() - ^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 3295, in connect - return self._connection_cls(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 146, in __init__ - Connection._handle_dbapi_exception_noconnection( - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 2450, in _handle_dbapi_exception_noconnection - raise sqlalchemy_exception.with_traceback(exc_info[2]) from e - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 144, in __init__ - self._dbapi_connection = engine.raw_connection() - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 3319, in raw_connection - return self.pool.connect() - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 448, in connect - return _ConnectionFairy._checkout(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 1272, in _checkout - fairy = _ConnectionRecord.checkout(pool) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 712, in checkout - rec = pool._do_get() - ^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 178, in _do_get - with util.safe_reraise(): - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 176, in _do_get - return self._create_connection() - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 389, in _create_connection - return _ConnectionRecord(self) - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 674, in __init__ - self.__connect() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 900, in __connect - with util.safe_reraise(): - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 896, in __connect - self.dbapi_connection = connection = pool._invoke_creator(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\create.py", line 667, in connect - return dialect.connect(*cargs_tup, **cparams) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\default.py", line 630, in connect - return self.loaded_dbapi.connect(*cargs, **cparams) # type: ignore[no-any-return] # NOQA: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\dialects\mysql\aiomysql.py", line 176, in connect - await_only(creator_fn(*arg, **kw)), - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 132, in await_only - return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 196, in greenlet_spawn - value = await result - ^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 74, in _connect - await conn._connect() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 540, in _connect - await self._request_authentication() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 865, in _request_authentication - await self.caching_sha2_password_auth(auth_packet) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 989, in caching_sha2_password_auth - pkt = await self._read_packet() - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 652, in _read_packet - packet.raise_for_error() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\pymysql\protocol.py", line 219, in raise_for_error - err.raise_mysql_exception(self._data) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\pymysql\err.py", line 154, in raise_mysql_exception - raise errorclass(errno, errval, sqlstate=sqlstate) -sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (1045, "Access denied for user 'root'@'localhost' (using password: YES)") -(Background on this error at: https://sqlalche.me/e/20/e3q8) diff --git a/logs/info.log b/logs/info.log index 7a4fbc2..e69de29 100644 --- a/logs/info.log +++ b/logs/info.log @@ -1,1265 +0,0 @@ -2026-09-08 15:14:35,174 INFO [-] httpx2: HTTP Request: GET http://testserver/ "HTTP/1.1 200 OK" -2026-09-08 15:14:45,647 INFO [-] httpx2: HTTP Request: GET http://testserver/api/health/ready "HTTP/1.1 503 Service Unavailable" -2026-09-08 15:14:45,648 INFO [-] httpx2: HTTP Request: GET http://testserver/openapi.json "HTTP/1.1 200 OK" -2026-09-08 15:15:03,333 INFO [-] httpx2: HTTP Request: GET http://testserver/t/ok "HTTP/1.1 200 OK" -2026-09-08 15:15:03,334 INFO [-] httpx2: HTTP Request: GET http://testserver/t/notfound "HTTP/1.1 404 Not Found" -2026-09-08 15:15:03,335 INFO [-] httpx2: HTTP Request: GET http://testserver/t/param?q=abc "HTTP/1.1 422 Unprocessable Content" -2026-09-08 15:27:03,604 INFO [-] httpx2: HTTP Request: GET http://testserver/api/health/ready "HTTP/1.1 503 Service Unavailable" -2026-09-08 15:59:18,441 INFO [-] httpx2: HTTP Request: GET http://testserver/api/health/ready "HTTP/1.1 503 Service Unavailable" -2026-09-08 16:42:12,463 INFO [-] httpx2: HTTP Request: GET http://testserver/api/health/ready "HTTP/1.1 200 OK" -2026-09-08 17:26:52,160 ERROR [-] api: unhandled error on /api/auth/login -Traceback (most recent call last): - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\errors.py", line 164, in __call__ - await self.app(scope, receive, _send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\base.py", line 193, in __call__ - response = await self.dispatch_func(request, call_next) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "D:\Projects\py\Memory_demo\utils\request_id.py", line 28, in dispatch - response: Response = await call_next(request) - ^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\base.py", line 168, in call_next - raise app_exc from app_exc.__cause__ or app_exc.__context__ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\base.py", line 144, in coro - await self.app(scope, receive_or_disconnect, send_no_error) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\exceptions.py", line 63, in __call__ - await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app - raise exc - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app - await app(scope, receive, sender) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in __call__ - await self.app(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\routing.py", line 670, in __call__ - await self.middleware_stack(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 2734, in app - await route.handle(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 1780, in handle - await self.original_router.handle(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 2789, in handle - await included_router._handle_selected(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 1791, in _handle_selected - await route.handle(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 1780, in handle - await self.original_router.handle(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 2789, in handle - await included_router._handle_selected(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 1800, in _handle_selected - await original_route.handle(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 1279, in handle - await app(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 158, in app - await wrap_app_handling_exceptions(app, request)(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app - raise exc - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app - await app(scope, receive, sender) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 144, in app - response = await f(request) - ^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 481, in app - solved_result = await solve_dependencies( - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\dependencies\utils.py", line 668, in solve_dependencies - solved = await _solve_generator( - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\dependencies\utils.py", line 574, in _solve_generator - return await stack.enter_async_context(cm) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\contextlib.py", line 647, in enter_async_context - result = await _enter(cm) - ^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\contextlib.py", line 204, in __aenter__ - return await anext(self.gen) - ^^^^^^^^^^^^^^^^^^^^^ - File "D:\Projects\py\Memory_demo\config\deps.py", line 7, in get_db - async with mysql.get_session_factory() as session: -TypeError: 'async_sessionmaker' object does not support the asynchronous context manager protocol -2026-09-08 17:26:52,230 ERROR [-] sqlalchemy.pool.impl.AsyncAdaptedQueuePool: Exception closing connection > -Traceback (most recent call last): - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\pool\base.py", line 375, in _close_connection - self._dialect.do_close(connection) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\default.py", line 721, in do_close - dbapi_connection.close() - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\dialects\mysql\aiomysql.py", line 114, in close - self.await_(self._connection.ensure_closed()) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 132, in await_only - return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 196, in greenlet_spawn - value = await result - ^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiomysql\connection.py", line 349, in ensure_closed - self._writer.write(send_data) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\asyncio\streams.py", line 331, in write - self._transport.write(data) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\asyncio\proactor_events.py", line 366, in write - self._loop_writing(data=bytes(data)) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\asyncio\proactor_events.py", line 402, in _loop_writing - self._write_fut = self._loop._proactor.send(self._sock, data) - ^^^^^^^^^^^^^^^^^^^^^^^^^ -AttributeError: 'NoneType' object has no attribute 'send' -2026-09-08 17:27:10,975 ERROR [7920a7ecec5e4f8b] sqlalchemy.pool.impl.AsyncAdaptedQueuePool: Exception terminating connection > -Traceback (most recent call last): - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\pool\base.py", line 373, in _close_connection - self._dialect.do_terminate(connection) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\dialects\mysql\aiomysql.py", line 242, in do_terminate - dbapi_connection.terminate() - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\connectors\asyncio.py", line 402, in terminate - self.await_(asyncio.shield(self._terminate_graceful_close())) # type: ignore[attr-defined] # noqa: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 132, in await_only - return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 196, in greenlet_spawn - value = await result - ^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\dialects\mysql\aiomysql.py", line 117, in _terminate_graceful_close - await self._connection.ensure_closed() - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiomysql\connection.py", line 349, in ensure_closed - self._writer.write(send_data) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\asyncio\streams.py", line 331, in write - self._transport.write(data) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\asyncio\proactor_events.py", line 366, in write - self._loop_writing(data=bytes(data)) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\asyncio\proactor_events.py", line 402, in _loop_writing - self._write_fut = self._loop._proactor.send(self._sock, data) - ^^^^^^^^^^^^^^^^^^^^^^^^^ -AttributeError: 'NoneType' object has no attribute 'send' -2026-09-08 17:27:11,025 ERROR [-] api: unhandled error on /api/auth/login -Traceback (most recent call last): - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\errors.py", line 164, in __call__ - await self.app(scope, receive, _send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\base.py", line 193, in __call__ - response = await self.dispatch_func(request, call_next) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "D:\Projects\py\Memory_demo\utils\request_id.py", line 28, in dispatch - response: Response = await call_next(request) - ^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\base.py", line 168, in call_next - raise app_exc from app_exc.__cause__ or app_exc.__context__ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\base.py", line 144, in coro - await self.app(scope, receive_or_disconnect, send_no_error) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\exceptions.py", line 63, in __call__ - await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app - raise exc - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app - await app(scope, receive, sender) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in __call__ - await self.app(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\routing.py", line 670, in __call__ - await self.middleware_stack(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 2734, in app - await route.handle(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 1780, in handle - await self.original_router.handle(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 2789, in handle - await included_router._handle_selected(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 1791, in _handle_selected - await route.handle(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 1780, in handle - await self.original_router.handle(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 2789, in handle - await included_router._handle_selected(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 1800, in _handle_selected - await original_route.handle(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 1279, in handle - await app(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 158, in app - await wrap_app_handling_exceptions(app, request)(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app - raise exc - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app - await app(scope, receive, sender) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 144, in app - response = await f(request) - ^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 706, in app - raw_response = await run_endpoint_function( - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 352, in run_endpoint_function - return await dependant.call(**values) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "D:\Projects\py\Memory_demo\api\routers\auth.py", line 35, in login - user = await SysUserRepo(db).get_by_username(body.username) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "D:\Projects\py\Memory_demo\repositories\sys_user.py", line 14, in get_by_username - return await self.db.scalar(select(SysUser).where(SysUser.username == username)) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\ext\asyncio\session.py", line 504, in scalar - return await greenlet_spawn( - ^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 201, in greenlet_spawn - result = context.throw(*sys.exc_info()) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\session.py", line 2421, in scalar - return self._execute_internal( - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\session.py", line 2261, in _execute_internal - conn = self._connection_for_bind(bind) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\session.py", line 2113, in _connection_for_bind - return trans._connection_for_bind(engine, execution_options) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "", line 2, in _connection_for_bind - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\state_changes.py", line 137, in _go - ret_value = fn(self, *arg, **kw) - ^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\session.py", line 1191, in _connection_for_bind - conn = bind.connect() - ^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 3295, in connect - return self._connection_cls(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 144, in __init__ - self._dbapi_connection = engine.raw_connection() - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 3319, in raw_connection - return self.pool.connect() - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\pool\base.py", line 448, in connect - return _ConnectionFairy._checkout(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\pool\base.py", line 1371, in _checkout - with util.safe_reraise(): - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\pool\base.py", line 1309, in _checkout - result = pool._dialect._do_ping_w_event( - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\default.py", line 729, in _do_ping_w_event - return self.do_ping(dbapi_connection) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\dialects\mysql\pymysql.py", line 144, in do_ping - dbapi_connection.ping() - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\dialects\mysql\aiomysql.py", line 100, in ping - self.await_(self._connection.ping(reconnect=False)) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 132, in await_only - return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 196, in greenlet_spawn - value = await result - ^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiomysql\connection.py", line 493, in ping - await self._execute_command(COMMAND.COM_PING, "") - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiomysql\connection.py", line 724, in _execute_command - self._write_bytes(prelude + sql[:chunk_size - 1]) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiomysql\connection.py", line 669, in _write_bytes - return self._writer.write(data) - ^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\asyncio\streams.py", line 331, in write - self._transport.write(data) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\asyncio\proactor_events.py", line 366, in write - self._loop_writing(data=bytes(data)) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\asyncio\proactor_events.py", line 402, in _loop_writing - self._write_fut = self._loop._proactor.send(self._sock, data) - ^^^^^^^^^^^^^^^^^^^^^^^^^ -AttributeError: 'NoneType' object has no attribute 'send' -2026-09-08 17:27:39,262 ERROR [c744544f6e564c1a] sqlalchemy.pool.impl.AsyncAdaptedQueuePool: Exception terminating connection > -Traceback (most recent call last): - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\pool\base.py", line 373, in _close_connection - self._dialect.do_terminate(connection) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\dialects\mysql\aiomysql.py", line 242, in do_terminate - dbapi_connection.terminate() - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\connectors\asyncio.py", line 402, in terminate - self.await_(asyncio.shield(self._terminate_graceful_close())) # type: ignore[attr-defined] # noqa: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 132, in await_only - return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 196, in greenlet_spawn - value = await result - ^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\dialects\mysql\aiomysql.py", line 117, in _terminate_graceful_close - await self._connection.ensure_closed() - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiomysql\connection.py", line 349, in ensure_closed - self._writer.write(send_data) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\asyncio\streams.py", line 331, in write - self._transport.write(data) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\asyncio\proactor_events.py", line 366, in write - self._loop_writing(data=bytes(data)) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\asyncio\proactor_events.py", line 402, in _loop_writing - self._write_fut = self._loop._proactor.send(self._sock, data) - ^^^^^^^^^^^^^^^^^^^^^^^^^ -AttributeError: 'NoneType' object has no attribute 'send' -2026-09-08 17:27:39,266 ERROR [-] api: unhandled error on /api/auth/login -Traceback (most recent call last): - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\errors.py", line 164, in __call__ - await self.app(scope, receive, _send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\base.py", line 193, in __call__ - response = await self.dispatch_func(request, call_next) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "D:\Projects\py\Memory_demo\utils\request_id.py", line 28, in dispatch - response: Response = await call_next(request) - ^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\base.py", line 168, in call_next - raise app_exc from app_exc.__cause__ or app_exc.__context__ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\base.py", line 144, in coro - await self.app(scope, receive_or_disconnect, send_no_error) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\exceptions.py", line 63, in __call__ - await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app - raise exc - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app - await app(scope, receive, sender) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in __call__ - await self.app(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\routing.py", line 670, in __call__ - await self.middleware_stack(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 2734, in app - await route.handle(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 1780, in handle - await self.original_router.handle(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 2789, in handle - await included_router._handle_selected(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 1791, in _handle_selected - await route.handle(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 1780, in handle - await self.original_router.handle(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 2789, in handle - await included_router._handle_selected(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 1800, in _handle_selected - await original_route.handle(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 1279, in handle - await app(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 158, in app - await wrap_app_handling_exceptions(app, request)(scope, receive, send) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app - raise exc - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app - await app(scope, receive, sender) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 144, in app - response = await f(request) - ^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 706, in app - raw_response = await run_endpoint_function( - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 352, in run_endpoint_function - return await dependant.call(**values) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "D:\Projects\py\Memory_demo\api\routers\auth.py", line 35, in login - user = await SysUserRepo(db).get_by_username(body.username) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "D:\Projects\py\Memory_demo\repositories\sys_user.py", line 14, in get_by_username - return await self.db.scalar(select(SysUser).where(SysUser.username == username)) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\ext\asyncio\session.py", line 504, in scalar - return await greenlet_spawn( - ^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 201, in greenlet_spawn - result = context.throw(*sys.exc_info()) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\session.py", line 2421, in scalar - return self._execute_internal( - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\session.py", line 2261, in _execute_internal - conn = self._connection_for_bind(bind) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\session.py", line 2113, in _connection_for_bind - return trans._connection_for_bind(engine, execution_options) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "", line 2, in _connection_for_bind - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\state_changes.py", line 137, in _go - ret_value = fn(self, *arg, **kw) - ^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\session.py", line 1191, in _connection_for_bind - conn = bind.connect() - ^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 3295, in connect - return self._connection_cls(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 144, in __init__ - self._dbapi_connection = engine.raw_connection() - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 3319, in raw_connection - return self.pool.connect() - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\pool\base.py", line 448, in connect - return _ConnectionFairy._checkout(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\pool\base.py", line 1371, in _checkout - with util.safe_reraise(): - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\pool\base.py", line 1309, in _checkout - result = pool._dialect._do_ping_w_event( - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\default.py", line 729, in _do_ping_w_event - return self.do_ping(dbapi_connection) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\dialects\mysql\pymysql.py", line 144, in do_ping - dbapi_connection.ping() - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\dialects\mysql\aiomysql.py", line 100, in ping - self.await_(self._connection.ping(reconnect=False)) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 132, in await_only - return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 196, in greenlet_spawn - value = await result - ^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiomysql\connection.py", line 493, in ping - await self._execute_command(COMMAND.COM_PING, "") - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiomysql\connection.py", line 724, in _execute_command - self._write_bytes(prelude + sql[:chunk_size - 1]) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\site-packages\aiomysql\connection.py", line 669, in _write_bytes - return self._writer.write(data) - ^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\asyncio\streams.py", line 331, in write - self._transport.write(data) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\asyncio\proactor_events.py", line 366, in write - self._loop_writing(data=bytes(data)) - File "C:\Users\24434\AppData\Local\Programs\Python\Python312\Lib\asyncio\proactor_events.py", line 402, in _loop_writing - self._write_fut = self._loop._proactor.send(self._sock, data) - ^^^^^^^^^^^^^^^^^^^^^^^^^ -AttributeError: 'NoneType' object has no attribute 'send' -2026-09-10 20:49:20,257 ERROR [-] api: unhandled error on /api/auth/login -Traceback (most recent call last): - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\errors.py", line 164, in __call__ - await self.app(scope, receive, _send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\base.py", line 193, in __call__ - response = await self.dispatch_func(request, call_next) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\utils\request_id.py", line 28, in dispatch - response: Response = await call_next(request) - ^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\base.py", line 168, in call_next - raise app_exc from app_exc.__cause__ or app_exc.__context__ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\base.py", line 144, in coro - await self.app(scope, receive_or_disconnect, send_no_error) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\exceptions.py", line 63, in __call__ - await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app - raise exc - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app - await app(scope, receive, sender) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in __call__ - await self.app(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\routing.py", line 670, in __call__ - await self.middleware_stack(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 2734, in app - await route.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1780, in handle - await self.original_router.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 2789, in handle - await included_router._handle_selected(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1791, in _handle_selected - await route.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1780, in handle - await self.original_router.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 2789, in handle - await included_router._handle_selected(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1800, in _handle_selected - await original_route.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1279, in handle - await app(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 158, in app - await wrap_app_handling_exceptions(app, request)(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app - raise exc - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app - await app(scope, receive, sender) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 144, in app - response = await f(request) - ^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 706, in app - raw_response = await run_endpoint_function( - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 352, in run_endpoint_function - return await dependant.call(**values) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\api\routers\auth.py", line 19, in login - return success(await auth_login(db, body.username, body.password)) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\service\auth.py", line 68, in login - user = await SysUserRepo(db).get_by_username(username) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\repositories\sys_user.py", line 14, in get_by_username - return await self.db.scalar(select(SysUser).where(SysUser.username == username)) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\ext\asyncio\session.py", line 504, in scalar - return await greenlet_spawn( - ^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 201, in greenlet_spawn - result = context.throw(*sys.exc_info()) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 2421, in scalar - return self._execute_internal( - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 2261, in _execute_internal - conn = self._connection_for_bind(bind) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 2113, in _connection_for_bind - return trans._connection_for_bind(engine, execution_options) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "", line 2, in _connection_for_bind - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\state_changes.py", line 137, in _go - ret_value = fn(self, *arg, **kw) - ^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 1191, in _connection_for_bind - conn = bind.connect() - ^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 3295, in connect - return self._connection_cls(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 144, in __init__ - self._dbapi_connection = engine.raw_connection() - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 3319, in raw_connection - return self.pool.connect() - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 448, in connect - return _ConnectionFairy._checkout(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 1272, in _checkout - fairy = _ConnectionRecord.checkout(pool) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 712, in checkout - rec = pool._do_get() - ^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 178, in _do_get - with util.safe_reraise(): - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 176, in _do_get - return self._create_connection() - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 389, in _create_connection - return _ConnectionRecord(self) - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 674, in __init__ - self.__connect() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 900, in __connect - with util.safe_reraise(): - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 896, in __connect - self.dbapi_connection = connection = pool._invoke_creator(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\create.py", line 667, in connect - return dialect.connect(*cargs_tup, **cparams) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\default.py", line 630, in connect - return self.loaded_dbapi.connect(*cargs, **cparams) # type: ignore[no-any-return] # NOQA: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\dialects\mysql\aiomysql.py", line 176, in connect - await_only(creator_fn(*arg, **kw)), - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 132, in await_only - return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 196, in greenlet_spawn - value = await result - ^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 74, in _connect - await conn._connect() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 540, in _connect - await self._request_authentication() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 865, in _request_authentication - await self.caching_sha2_password_auth(auth_packet) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 984, in caching_sha2_password_auth - data = _auth.sha2_rsa_encrypt( - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\pymysql\_auth.py", line 144, in sha2_rsa_encrypt - raise RuntimeError( -RuntimeError: 'cryptography' package is required for sha256_password or caching_sha2_password auth methods -2026-09-10 20:50:16,723 ERROR [-] api: unhandled error on /api/auth/login -Traceback (most recent call last): - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 144, in __init__ - self._dbapi_connection = engine.raw_connection() - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 3319, in raw_connection - return self.pool.connect() - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 448, in connect - return _ConnectionFairy._checkout(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 1272, in _checkout - fairy = _ConnectionRecord.checkout(pool) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 712, in checkout - rec = pool._do_get() - ^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 178, in _do_get - with util.safe_reraise(): - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 176, in _do_get - return self._create_connection() - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 389, in _create_connection - return _ConnectionRecord(self) - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 674, in __init__ - self.__connect() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 900, in __connect - with util.safe_reraise(): - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 896, in __connect - self.dbapi_connection = connection = pool._invoke_creator(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\create.py", line 667, in connect - return dialect.connect(*cargs_tup, **cparams) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\default.py", line 630, in connect - return self.loaded_dbapi.connect(*cargs, **cparams) # type: ignore[no-any-return] # NOQA: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\dialects\mysql\aiomysql.py", line 176, in connect - await_only(creator_fn(*arg, **kw)), - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 132, in await_only - return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 196, in greenlet_spawn - value = await result - ^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 74, in _connect - await conn._connect() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 540, in _connect - await self._request_authentication() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 865, in _request_authentication - await self.caching_sha2_password_auth(auth_packet) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 989, in caching_sha2_password_auth - pkt = await self._read_packet() - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 652, in _read_packet - packet.raise_for_error() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\pymysql\protocol.py", line 219, in raise_for_error - err.raise_mysql_exception(self._data) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\pymysql\err.py", line 154, in raise_mysql_exception - raise errorclass(errno, errval, sqlstate=sqlstate) -pymysql.err.OperationalError: (1049, "Unknown database 'memory'") - -The above exception was the direct cause of the following exception: - -Traceback (most recent call last): - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\errors.py", line 164, in __call__ - await self.app(scope, receive, _send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\base.py", line 193, in __call__ - response = await self.dispatch_func(request, call_next) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\utils\request_id.py", line 28, in dispatch - response: Response = await call_next(request) - ^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\base.py", line 168, in call_next - raise app_exc from app_exc.__cause__ or app_exc.__context__ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\base.py", line 144, in coro - await self.app(scope, receive_or_disconnect, send_no_error) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\exceptions.py", line 63, in __call__ - await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app - raise exc - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app - await app(scope, receive, sender) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in __call__ - await self.app(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\routing.py", line 670, in __call__ - await self.middleware_stack(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 2734, in app - await route.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1780, in handle - await self.original_router.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 2789, in handle - await included_router._handle_selected(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1791, in _handle_selected - await route.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1780, in handle - await self.original_router.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 2789, in handle - await included_router._handle_selected(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1800, in _handle_selected - await original_route.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1279, in handle - await app(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 158, in app - await wrap_app_handling_exceptions(app, request)(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app - raise exc - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app - await app(scope, receive, sender) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 144, in app - response = await f(request) - ^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 706, in app - raw_response = await run_endpoint_function( - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 352, in run_endpoint_function - return await dependant.call(**values) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\api\routers\auth.py", line 19, in login - return success(await auth_login(db, body.username, body.password)) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\service\auth.py", line 68, in login - user = await SysUserRepo(db).get_by_username(username) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\repositories\sys_user.py", line 14, in get_by_username - return await self.db.scalar(select(SysUser).where(SysUser.username == username)) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\ext\asyncio\session.py", line 504, in scalar - return await greenlet_spawn( - ^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 201, in greenlet_spawn - result = context.throw(*sys.exc_info()) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 2421, in scalar - return self._execute_internal( - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 2261, in _execute_internal - conn = self._connection_for_bind(bind) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 2113, in _connection_for_bind - return trans._connection_for_bind(engine, execution_options) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "", line 2, in _connection_for_bind - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\state_changes.py", line 137, in _go - ret_value = fn(self, *arg, **kw) - ^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 1191, in _connection_for_bind - conn = bind.connect() - ^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 3295, in connect - return self._connection_cls(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 146, in __init__ - Connection._handle_dbapi_exception_noconnection( - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 2450, in _handle_dbapi_exception_noconnection - raise sqlalchemy_exception.with_traceback(exc_info[2]) from e - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 144, in __init__ - self._dbapi_connection = engine.raw_connection() - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 3319, in raw_connection - return self.pool.connect() - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 448, in connect - return _ConnectionFairy._checkout(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 1272, in _checkout - fairy = _ConnectionRecord.checkout(pool) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 712, in checkout - rec = pool._do_get() - ^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 178, in _do_get - with util.safe_reraise(): - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 176, in _do_get - return self._create_connection() - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 389, in _create_connection - return _ConnectionRecord(self) - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 674, in __init__ - self.__connect() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 900, in __connect - with util.safe_reraise(): - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 896, in __connect - self.dbapi_connection = connection = pool._invoke_creator(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\create.py", line 667, in connect - return dialect.connect(*cargs_tup, **cparams) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\default.py", line 630, in connect - return self.loaded_dbapi.connect(*cargs, **cparams) # type: ignore[no-any-return] # NOQA: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\dialects\mysql\aiomysql.py", line 176, in connect - await_only(creator_fn(*arg, **kw)), - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 132, in await_only - return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 196, in greenlet_spawn - value = await result - ^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 74, in _connect - await conn._connect() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 540, in _connect - await self._request_authentication() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 865, in _request_authentication - await self.caching_sha2_password_auth(auth_packet) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 989, in caching_sha2_password_auth - pkt = await self._read_packet() - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 652, in _read_packet - packet.raise_for_error() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\pymysql\protocol.py", line 219, in raise_for_error - err.raise_mysql_exception(self._data) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\pymysql\err.py", line 154, in raise_mysql_exception - raise errorclass(errno, errval, sqlstate=sqlstate) -sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (1049, "Unknown database 'memory'") -(Background on this error at: https://sqlalche.me/e/20/e3q8) -2026-09-10 20:51:21,189 ERROR [-] api: unhandled error on /api/auth/login -Traceback (most recent call last): - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 144, in __init__ - self._dbapi_connection = engine.raw_connection() - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 3319, in raw_connection - return self.pool.connect() - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 448, in connect - return _ConnectionFairy._checkout(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 1272, in _checkout - fairy = _ConnectionRecord.checkout(pool) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 712, in checkout - rec = pool._do_get() - ^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 178, in _do_get - with util.safe_reraise(): - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 176, in _do_get - return self._create_connection() - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 389, in _create_connection - return _ConnectionRecord(self) - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 674, in __init__ - self.__connect() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 900, in __connect - with util.safe_reraise(): - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 896, in __connect - self.dbapi_connection = connection = pool._invoke_creator(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\create.py", line 667, in connect - return dialect.connect(*cargs_tup, **cparams) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\default.py", line 630, in connect - return self.loaded_dbapi.connect(*cargs, **cparams) # type: ignore[no-any-return] # NOQA: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\dialects\mysql\aiomysql.py", line 176, in connect - await_only(creator_fn(*arg, **kw)), - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 132, in await_only - return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 196, in greenlet_spawn - value = await result - ^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 74, in _connect - await conn._connect() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 540, in _connect - await self._request_authentication() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 865, in _request_authentication - await self.caching_sha2_password_auth(auth_packet) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 952, in caching_sha2_password_auth - pkt = await self._read_packet() - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 652, in _read_packet - packet.raise_for_error() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\pymysql\protocol.py", line 219, in raise_for_error - err.raise_mysql_exception(self._data) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\pymysql\err.py", line 154, in raise_mysql_exception - raise errorclass(errno, errval, sqlstate=sqlstate) -pymysql.err.OperationalError: (1049, "Unknown database 'memory'") - -The above exception was the direct cause of the following exception: - -Traceback (most recent call last): - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\errors.py", line 164, in __call__ - await self.app(scope, receive, _send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\base.py", line 193, in __call__ - response = await self.dispatch_func(request, call_next) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\utils\request_id.py", line 28, in dispatch - response: Response = await call_next(request) - ^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\base.py", line 168, in call_next - raise app_exc from app_exc.__cause__ or app_exc.__context__ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\base.py", line 144, in coro - await self.app(scope, receive_or_disconnect, send_no_error) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\exceptions.py", line 63, in __call__ - await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app - raise exc - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app - await app(scope, receive, sender) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in __call__ - await self.app(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\routing.py", line 670, in __call__ - await self.middleware_stack(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 2734, in app - await route.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1780, in handle - await self.original_router.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 2789, in handle - await included_router._handle_selected(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1791, in _handle_selected - await route.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1780, in handle - await self.original_router.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 2789, in handle - await included_router._handle_selected(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1800, in _handle_selected - await original_route.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1279, in handle - await app(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 158, in app - await wrap_app_handling_exceptions(app, request)(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app - raise exc - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app - await app(scope, receive, sender) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 144, in app - response = await f(request) - ^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 706, in app - raw_response = await run_endpoint_function( - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 352, in run_endpoint_function - return await dependant.call(**values) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\api\routers\auth.py", line 19, in login - return success(await auth_login(db, body.username, body.password)) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\service\auth.py", line 68, in login - user = await SysUserRepo(db).get_by_username(username) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\repositories\sys_user.py", line 14, in get_by_username - return await self.db.scalar(select(SysUser).where(SysUser.username == username)) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\ext\asyncio\session.py", line 504, in scalar - return await greenlet_spawn( - ^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 201, in greenlet_spawn - result = context.throw(*sys.exc_info()) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 2421, in scalar - return self._execute_internal( - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 2261, in _execute_internal - conn = self._connection_for_bind(bind) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 2113, in _connection_for_bind - return trans._connection_for_bind(engine, execution_options) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "", line 2, in _connection_for_bind - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\state_changes.py", line 137, in _go - ret_value = fn(self, *arg, **kw) - ^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 1191, in _connection_for_bind - conn = bind.connect() - ^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 3295, in connect - return self._connection_cls(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 146, in __init__ - Connection._handle_dbapi_exception_noconnection( - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 2450, in _handle_dbapi_exception_noconnection - raise sqlalchemy_exception.with_traceback(exc_info[2]) from e - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 144, in __init__ - self._dbapi_connection = engine.raw_connection() - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 3319, in raw_connection - return self.pool.connect() - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 448, in connect - return _ConnectionFairy._checkout(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 1272, in _checkout - fairy = _ConnectionRecord.checkout(pool) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 712, in checkout - rec = pool._do_get() - ^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 178, in _do_get - with util.safe_reraise(): - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 176, in _do_get - return self._create_connection() - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 389, in _create_connection - return _ConnectionRecord(self) - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 674, in __init__ - self.__connect() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 900, in __connect - with util.safe_reraise(): - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 896, in __connect - self.dbapi_connection = connection = pool._invoke_creator(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\create.py", line 667, in connect - return dialect.connect(*cargs_tup, **cparams) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\default.py", line 630, in connect - return self.loaded_dbapi.connect(*cargs, **cparams) # type: ignore[no-any-return] # NOQA: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\dialects\mysql\aiomysql.py", line 176, in connect - await_only(creator_fn(*arg, **kw)), - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 132, in await_only - return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 196, in greenlet_spawn - value = await result - ^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 74, in _connect - await conn._connect() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 540, in _connect - await self._request_authentication() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 865, in _request_authentication - await self.caching_sha2_password_auth(auth_packet) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 952, in caching_sha2_password_auth - pkt = await self._read_packet() - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 652, in _read_packet - packet.raise_for_error() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\pymysql\protocol.py", line 219, in raise_for_error - err.raise_mysql_exception(self._data) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\pymysql\err.py", line 154, in raise_mysql_exception - raise errorclass(errno, errval, sqlstate=sqlstate) -sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (1049, "Unknown database 'memory'") -(Background on this error at: https://sqlalche.me/e/20/e3q8) -2026-09-10 21:54:16,943 ERROR [-] api: unhandled error on /api/products -Traceback (most recent call last): - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 144, in __init__ - self._dbapi_connection = engine.raw_connection() - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 3319, in raw_connection - return self.pool.connect() - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 448, in connect - return _ConnectionFairy._checkout(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 1272, in _checkout - fairy = _ConnectionRecord.checkout(pool) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 712, in checkout - rec = pool._do_get() - ^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 178, in _do_get - with util.safe_reraise(): - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 176, in _do_get - return self._create_connection() - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 389, in _create_connection - return _ConnectionRecord(self) - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 674, in __init__ - self.__connect() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 900, in __connect - with util.safe_reraise(): - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 896, in __connect - self.dbapi_connection = connection = pool._invoke_creator(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\create.py", line 667, in connect - return dialect.connect(*cargs_tup, **cparams) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\default.py", line 630, in connect - return self.loaded_dbapi.connect(*cargs, **cparams) # type: ignore[no-any-return] # NOQA: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\dialects\mysql\aiomysql.py", line 176, in connect - await_only(creator_fn(*arg, **kw)), - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 132, in await_only - return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 196, in greenlet_spawn - value = await result - ^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 74, in _connect - await conn._connect() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 540, in _connect - await self._request_authentication() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 865, in _request_authentication - await self.caching_sha2_password_auth(auth_packet) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 989, in caching_sha2_password_auth - pkt = await self._read_packet() - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 652, in _read_packet - packet.raise_for_error() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\pymysql\protocol.py", line 219, in raise_for_error - err.raise_mysql_exception(self._data) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\pymysql\err.py", line 154, in raise_mysql_exception - raise errorclass(errno, errval, sqlstate=sqlstate) -pymysql.err.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: YES)") - -The above exception was the direct cause of the following exception: - -Traceback (most recent call last): - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\errors.py", line 164, in __call__ - await self.app(scope, receive, _send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\base.py", line 193, in __call__ - response = await self.dispatch_func(request, call_next) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\utils\request_id.py", line 28, in dispatch - response: Response = await call_next(request) - ^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\base.py", line 168, in call_next - raise app_exc from app_exc.__cause__ or app_exc.__context__ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\base.py", line 144, in coro - await self.app(scope, receive_or_disconnect, send_no_error) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\middleware\exceptions.py", line 63, in __call__ - await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app - raise exc - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app - await app(scope, receive, sender) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in __call__ - await self.app(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\routing.py", line 670, in __call__ - await self.middleware_stack(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 2734, in app - await route.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1780, in handle - await self.original_router.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 2789, in handle - await included_router._handle_selected(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1791, in _handle_selected - await route.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1780, in handle - await self.original_router.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 2789, in handle - await included_router._handle_selected(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1800, in _handle_selected - await original_route.handle(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 1279, in handle - await app(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 158, in app - await wrap_app_handling_exceptions(app, request)(scope, receive, send) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app - raise exc - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\starlette\_exception_handler.py", line 42, in wrapped_app - await app(scope, receive, sender) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 144, in app - response = await f(request) - ^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 706, in app - raw_response = await run_endpoint_function( - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\fastapi\routing.py", line 352, in run_endpoint_function - return await dependant.call(**values) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\api\routers\product.py", line 26, in products - data = await list_products( - ^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\service\product.py", line 54, in list_products - items, total = await ProductRepo(db).search( - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\repositories\product.py", line 64, in search - items = list((await self.db.scalars(stmt)).all()) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\ext\asyncio\session.py", line 561, in scalars - result = await self.execute( - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\ext\asyncio\session.py", line 448, in execute - result = await greenlet_spawn( - ^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 201, in greenlet_spawn - result = context.throw(*sys.exc_info()) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 2373, in execute - return self._execute_internal( - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 2261, in _execute_internal - conn = self._connection_for_bind(bind) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 2113, in _connection_for_bind - return trans._connection_for_bind(engine, execution_options) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "", line 2, in _connection_for_bind - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\state_changes.py", line 137, in _go - ret_value = fn(self, *arg, **kw) - ^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\orm\session.py", line 1191, in _connection_for_bind - conn = bind.connect() - ^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 3295, in connect - return self._connection_cls(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 146, in __init__ - Connection._handle_dbapi_exception_noconnection( - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 2450, in _handle_dbapi_exception_noconnection - raise sqlalchemy_exception.with_traceback(exc_info[2]) from e - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 144, in __init__ - self._dbapi_connection = engine.raw_connection() - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\base.py", line 3319, in raw_connection - return self.pool.connect() - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 448, in connect - return _ConnectionFairy._checkout(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 1272, in _checkout - fairy = _ConnectionRecord.checkout(pool) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 712, in checkout - rec = pool._do_get() - ^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 178, in _do_get - with util.safe_reraise(): - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\impl.py", line 176, in _do_get - return self._create_connection() - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 389, in _create_connection - return _ConnectionRecord(self) - ^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 674, in __init__ - self.__connect() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 900, in __connect - with util.safe_reraise(): - ^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 122, in __exit__ - raise exc_value.with_traceback(exc_tb) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\pool\base.py", line 896, in __connect - self.dbapi_connection = connection = pool._invoke_creator(self) - ^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\create.py", line 667, in connect - return dialect.connect(*cargs_tup, **cparams) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\engine\default.py", line 630, in connect - return self.loaded_dbapi.connect(*cargs, **cparams) # type: ignore[no-any-return] # NOQA: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\dialects\mysql\aiomysql.py", line 176, in connect - await_only(creator_fn(*arg, **kw)), - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 132, in await_only - return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\sqlalchemy\util\_concurrency_py3k.py", line 196, in greenlet_spawn - value = await result - ^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 74, in _connect - await conn._connect() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 540, in _connect - await self._request_authentication() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 865, in _request_authentication - await self.caching_sha2_password_auth(auth_packet) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 989, in caching_sha2_password_auth - pkt = await self._read_packet() - ^^^^^^^^^^^^^^^^^^^^^^^^^ - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\aiomysql\connection.py", line 652, in _read_packet - packet.raise_for_error() - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\pymysql\protocol.py", line 219, in raise_for_error - err.raise_mysql_exception(self._data) - File "C:\Users\Windows\PycharmProjects\Mutual_Fund\.venv\Lib\site-packages\pymysql\err.py", line 154, in raise_mysql_exception - raise errorclass(errno, errval, sqlstate=sqlstate) -sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (1045, "Access denied for user 'root'@'localhost' (using password: YES)") -(Background on this error at: https://sqlalche.me/e/20/e3q8) diff --git a/main.py b/main.py index da752ab..42a4162 100644 --- a/main.py +++ b/main.py @@ -1,6 +1,7 @@ """应用入口:四库异步生命周期 + 中间件 + 全局异常 + 路由装配。""" from contextlib import asynccontextmanager +import uvicorn from fastapi import FastAPI from api.router import api_router @@ -17,8 +18,6 @@ from utils.request_id import RequestIdMiddleware @asynccontextmanager async def lifespan(app: FastAPI): setup_logging() # 幂等:分级日志 + trace_id + 脱敏 - app.state.customer_agent_runtime = build_default_runtime() - app.state.knowledge_upload_service = build_default_knowledge_upload_service() # 四库会话懒创建:启动不连接任何库,首次访问才建,可手动预热: # asyncio.run(database.init_db()) yield @@ -34,8 +33,4 @@ app.include_router(api_router) @app.get("/") async def root(): - return {"message": "智能公募基金系统 API", "docs": "/docs"} - -if __name__ == '__main__': - import uvicorn - uvicorn.run('main:app', host="127.0.0.1", port=8000) + return {"message": "智能公募基金系统 API", "docs": "/docs"} \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 1b34b21..a62e987 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,4 +22,16 @@ neo4j~=6.3.0 redis~=8.1.0 pymilvus~=3.0.1 pydantic-settings~=2.15.0 +pyjwt~=2.13.0 +fastapi~=0.141.1 +sqlalchemy~=2.0.52 +aiomysql~=0.3.2 +cryptography~=50.0.1 +httpx~=0.28.1 +pydantic~=2.13.5 +starlette~=1.6.0 +neo4j~=6.3.0 +redis~=8.1.0 +pymilvus~=3.0.1 +pydantic-settings~=2.15.0 pyjwt~=2.13.0 \ No newline at end of file diff --git a/sql/schema.sql b/sql/schema.sql index a71c2a3..d05feeb 100644 --- a/sql/schema.sql +++ b/sql/schema.sql @@ -267,9 +267,14 @@ CREATE TABLE IF NOT EXISTS conversation_archive ( tool_calls JSON NULL COMMENT '工具调用记录 [{"tool":"nl2sql",...}]', trace_id VARCHAR(64) NULL COMMENT '请求链路追踪ID', create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + trace_id VARCHAR(64) NULL COMMENT '请求链路追踪ID', KEY idx_session (session_id), KEY idx_user_time (user_id, create_time), - KEY idx_agent (agent_type) + KEY idx_agent (agent_type), + message_id VARCHAR(64) NULL COMMENT '消息唯一ID,用于归档幂等', + agent_run_id VARCHAR(64) NULL COMMENT 'Agent运行ID,用于调用链路追踪', + UNIQUE KEY uk_session_message (session_id, message_id), + KEY idx_agent_run (agent_run_id) ) COMMENT='会话归档表(审计回溯 + Agent 持续学习素材,归档前脱敏)'; -- --------------------------------------------------------------------- @@ -337,7 +342,7 @@ CREATE TABLE IF NOT EXISTS audit_log ( target VARCHAR(128) NULL COMMENT '操作对象(单号/ID)', detail TEXT NULL COMMENT '详情(JSON 字符串)', ip VARCHAR(64) NULL, - trace_id VARCHAR(64) NULL COMMENT '链路号', + trace_id VARCHAR(32) NULL COMMENT '链路号', status VARCHAR(8) NOT NULL DEFAULT '成功' COMMENT '成功/失败', create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, KEY idx_user (user_id), @@ -437,4 +442,4 @@ CREATE TABLE IF NOT EXISTS portfolio_benchmark ( create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, UNIQUE KEY uk_risk_level (risk_level) -) COMMENT='组合基准配置表(投顾Agent 再平衡参照,运营可调整)'; +) COMMENT='组合基准配置表(投顾Agent 再平衡参照,运营可调整)'; \ No newline at end of file