Skip to content

fix(db): avoid duplicate Doris and StarRocks connection parameters - #1397

Open
sunlishuo25 wants to merge 1 commit into
dataease:mainfrom
sunlishuo25:fix/doris-starrocks-connection-kwargs
Open

sunlishuo25 wants to merge 1 commit into
dataease:mainfrom
sunlishuo25:fix/doris-starrocks-connection-kwargs

Conversation

@sunlishuo25

Copy link
Copy Markdown

Doris/StarRocks table discovery fails when additional connection parameters are set, for example extraJdbc="charset=utf8mb4":

TypeError: pymysql.connections.Connection() got multiple values for keyword argument 'charset'

get_driver_connection passes both **conn_conf and **args, although args already contains conn_conf plus the SSL options. This removes the duplicate expansion from the direct-connection branch.

The regression tests cover both databases, SSL on/off, empty and nonempty parameters, explicit overrides, and pooled connections. On main (e02f717), 8 cases fail and 8 controls pass. With the fix, all 16 pass; the 13 existing connection-pool, SQL Server, and Hive tests also pass.

cd backend
python -m pytest -q tests/test_doris_starrocks_connection.py \
  tests/test_connection_pool_manager.py tests/test_sqlserver_pool_lifecycle.py \
  tests/test_hive_fields.py
# 29 passed

Also checked with real PyMySQL 1.2.3 using defer_connect=True: both connection objects are created with charset=utf8mb4, without opening a socket. Tests use Python 3.11.9 and the existing AST-isolation pattern with the real DatasourceConf model. A live Doris/StarRocks server and full application startup were not tested.

The new test file passes Ruff and format checks. db.py has the same 14 existing Ruff findings before and after the change; no unrelated formatting was applied. Searches found no matching issue or open PR (#1390 is a separate Hive authentication problem).

@sunlishuo25
sunlishuo25 marked this pull request as ready for review October 3, 2026 02:31

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant