Repository navigation
Expose sql_mode connection parameter - #142
Merged
Merged
Conversation
Add sql_mode to singlestoredb.connect() and register it as a config option (SINGLESTOREDB_SQL_MODE). The MySQL driver already applied sql_mode on connect; it is now reachable via kwargs, URLs, and env. The HTTP Data API is stateless and has no session-variable support, so the HTTP connection accepts sql_mode for API parity but emits a RuntimeWarning that it is ignored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
The implementation consistently exposes, routes, documents, and tests the new connection option.
0 open findings
What changed in this PR
Exposes sql_mode through public connection APIs while preserving protocol-specific behavior.
Changes:
- Adds
sql_modeconfiguration and URL support. - Applies it to MySQL sessions and warns when HTTP ignores it.
- Adds MySQL and HTTP coverage.
| File | Description |
|---|---|
singlestoredb/config.py |
Registers the sql_mode option and environment variable. |
singlestoredb/connection.py |
Adds the public connection parameter and documentation. |
singlestoredb/http/connection.py |
Accepts but warns about unsupported sql_mode. |
singlestoredb/tests/test_connection.py |
Tests parameter parsing and protocol behavior. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
kesmit13
marked this pull request as ready for review
October 13, 2026 18:01
kesmit13
requested review from
mgiannakopoulos,
pmishchenko-ua and
volodymyr-memsql
as code owners
October 13, 2026 18:01
This branch was successfully 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
sql_modetosinglestoredb.connect()and register a matchingsql_modeconfig option (SINGLESTOREDB_SQL_MODE). It can also be set in a connection URL (...?sql_mode=ANSI_QUOTES).SET sql_mode=%son connect; this change exposes that through the public API.sql_modecan't be applied server-side. The HTTP connection accepts the parameter for API parity and emits aRuntimeWarningsaying it is ignored.vectorstore.connect()is unchanged: it forwards to the externalVectorDBpackage, which may not acceptsql_mode.Test plan
test_sql_mode/test_sql_mode_paramintest_connection.pypass over MySQL (checks@@sql_mode)USE_DATA_API=1(checks the warning)test_connection.py+test_config.pypass over MySQL (84 passed)🤖 Generated with Claude Code
Note
Low Risk
Additive optional connection setting with documented HTTP no-op; MySQL path only changes session SQL semantics when callers opt in.
Overview
Adds a public
sql_modeconnection option so callers can set the sessionsql_modewhen opening a connection viasinglestoredb.connect(), theSINGLESTOREDB_SQL_MODEenv var, or a URL query parameter (e.g.?sql_mode=ANSI_QUOTES).On MySQL protocol connections, the value flows through existing
build_params/ config wiring into the driver (tests assert@@sql_modereflects the requested mode). On HTTP Data API connections, the parameter is accepted for API parity but is not applied; the HTTP client emits aRuntimeWarningthat it is ignored.Tests cover live session behavior (MySQL) vs warning (HTTP) and URL/keyword param parsing.
Reviewed by Cursor Bugbot for commit ec061c3. Bugbot is set up for automated code reviews on this repo. Configure here.