Repository navigation
Conversation
MysqlConfig.charset (DATABASE_MYSQL_CHARSET, --short-term-memory-charset) was documented but never used: MysqlSTMBackend built the database URL without it, so the driver always fell back to its own default. Append ?charset= to both the pymysql and aiomysql URLs. Change the default from utf8 to utf8mb4, which is what both drivers already used when no charset was passed, so deployments that never set it keep the same behavior. An empty value still leaves the choice to the driver. Update the docs and sample configs to match.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MysqlConfig.charsetis documented as a setting:DATABASE_MYSQL_CHARSET, the--short-term-memory-charsetflag ofveadk harness, and thecharsetrow in the MySQL short-term memory docs. ButMysqlSTMBackendnever used it. It built the URL aswith no
charset, so whatever you set was silently ignored and PyMySQL/aiomysql used their own default.This PR appends
?charset=<value>to both the pymysql and aiomysql URLs. SQLAlchemy passes it to the driver as thecharsetconnect argument.Compatibility
utf8. Both drivers actually useutf8mb4when no charset is passed (PyMySQL 1.4.6DEFAULT_CHARSET, aiomysql 0.3.2charset="utf8mb4"). If the backend started sendingutf8(utf8mb3), existing deployments would lose emoji / 4-byte characters in session data. So the default changes toutf8mb4. For anyone who never set the option, the effective charset is the same as before.DATABASE_MYSQL_CHARSET/charsetnow gets that value. That is the documented behavior.charset=""leaves the choice to the driver (no query parameter).config.yaml.fulland theveadk harnesssample config.No public Python import or signature changes.
Verification
tests/memory/test_mysql_charset.py:DATABASE_MYSQL_CHARSETall end up in the URL query, for both sync and async drivers;pytest -n 8 -m "not codex_smoke" tests/memory tests/cli: 1904 passed. The one failure,test_build_offline_runtime_creates_local_only_contract, also fails onmainlocally becausenodeis not installed here.pre-commit runon the changed files: ruff check / ruff format / secret checks pass.