mirror of
https://github.com/chenyme/grok2api.git
synced 2026-12-05 16:02:12 +00:00
Both asyncpg and aiomysql reject SSL-related query parameters (sslmode,
ssl-mode, ssl) when passed through SQLAlchemy URLs. This extracts SSL
mode from the URL, normalizes it per backend, and passes proper
connect_args instead.
- Postgres: passes libpq-style mode string via connect_args={"ssl": mode}
- MySQL: builds an SSLContext matching the requested verification level
- Supports cross-dialect aliases (e.g. verify-full works for both backends)
- Adds mariadb+aiomysql:// prefix handling
- Raises ValueError on unrecognized SSL modes
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>