Skip to content

fix dbapi executemany insert routing - #1015

Merged
joe-clickhouse merged 9 commits into
mainfrom
joe/934-preserve-executemany-sql
Sep 5, 2026
Merged

fix dbapi executemany insert routing#1015
joe-clickhouse merged 9 commits into
mainfrom
joe/934-preserve-executemany-sql

Conversation

@joe-clickhouse

@joe-clickhouse joe-clickhouse commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Preserve SQL semantics for parameterized DB-API executemany() inserts
  • Retain Native bulk inserts for safe bare-VALUES and compiled SQLAlchemy paths
  • Fail closed when Native routing can't be proven safe
  • Fix expressions, bind reuse, quoted identifiers, bind_expression() types, and joined-table inheritance

Closes #930
Closes #932
Closes #934

Checklist

Delete items not relevant to your PR:

  • Unit and integration tests covering the common scenarios were added
  • A human-readable description of the changes was provided to include in CHANGELOG
  • For significant changes, documentation in https://github.com/ClickHouse/clickhouse-docs was updated with further explanations or tutorials

@workflow-authentication-public workflow-authentication-public Bot added the needs-docs PR has user-visible changes without matching docs updates label Aug 31, 2026
@workflow-authentication-public

workflow-authentication-public Bot commented Aug 31, 2026

Copy link
Copy Markdown

Docs drift check: resolved, docs now match this PR's changes.

@workflow-authentication-public workflow-authentication-public Bot removed the needs-docs PR has user-visible changes without matching docs updates label Aug 31, 2026
@joe-clickhouse
joe-clickhouse requested a balanced review from Copilot and removed request for peter-leonov-ch August 31, 2026 18:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes DB-API executemany() routing while retaining safe Native insert paths.

Changes:

  • Preserves SQL semantics for parameterized inserts.
  • Adds validated Native plans for bare VALUES and SQLAlchemy inserts.
  • Updates row counts, tests, documentation, and changelog.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
clickhouse_connect/dbapi/cursor.py Implements routing, validation, and row counting.
clickhouse_connect/cc_sqlalchemy/dialect.py Builds safe SQLAlchemy Native insert plans.
tests/unit_tests/test_driver/test_cursor.py Tests DB-API routing and results.
tests/unit_tests/test_sqlalchemy/test_native_insert.py Tests SQLAlchemy Native planning.
tests/unit_tests/test_sqlalchemy/test_query_settings.py Updates settings coverage.
tests/integration_tests/test_dbapi.py Adds DB-API regressions.
tests/integration_tests/test_sqlalchemy/test_inserts.py Adds SQLAlchemy integration coverage.
docs/driver-api.mdx Documents DB-API behavior.
docs/sqlalchemy.mdx Documents SQLAlchemy routing.
CHANGELOG.md Records the user-facing fix.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread clickhouse_connect/cc_sqlalchemy/dialect.py
Comment thread clickhouse_connect/dbapi/cursor.py Outdated
@joe-clickhouse
joe-clickhouse merged commit c81ba17 into main Sep 5, 2026
33 checks passed
@joe-clickhouse
joe-clickhouse deleted the joe/934-preserve-executemany-sql branch September 5, 2026 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants