80d73d1b74
- redis/client.py: use BlockingConnectionPool.from_url() (fixes 'url' kwarg error) - database/engine_compat.py: patch aiomysql do_ping to satisfy pool_pre_ping - database/session.py: apply engine_compat patch before create_async_engine - requirements.txt: SQLAlchemy 2.0.49 (fixes aiomysql ping() reconnect signature) - .env.example: document NEXUS_REDIS_URL format - scripts/wsl_ensure_venv.sh: create project .venv (PEP 668 safe) - scripts/wsl_start_dev.sh: use .venv python, validate Redis before start - scripts/wsl_integration_smoke.sh: code-only verification mode - scripts/wsl_check_mysql.py / bootstrap_database.py: MySQL setup helpers - scripts/sync_frontend_vendor.py: vendor asset sync utility Co-authored-by: Cursor <cursoragent@cursor.com>
24 lines
649 B
Python
24 lines
649 B
Python
"""SQLAlchemy + aiomysql compatibility for pool_pre_ping.
|
|
|
|
SQLAlchemy 2.0.36+ pymysql do_ping may call ping() with no args; aiomysql's async
|
|
adapter requires ``ping(reconnect)``. Patch the dialect once before create_async_engine.
|
|
"""
|
|
|
|
from typing import Any
|
|
|
|
_patched = False
|
|
|
|
|
|
def patch_aiomysql_do_ping() -> None:
|
|
global _patched
|
|
if _patched:
|
|
return
|
|
from sqlalchemy.dialects.mysql.aiomysql import MySQLDialect_aiomysql
|
|
|
|
def do_ping(self, dbapi_connection: Any) -> bool:
|
|
dbapi_connection.ping(False)
|
|
return True
|
|
|
|
MySQLDialect_aiomysql.do_ping = do_ping # type: ignore[method-assign]
|
|
_patched = True
|