Skip to content

fix: raise CompileError on Index.create and drop instead of silent no-op (#78) - #83

Open
dwaddle wants to merge 1 commit into
databendlabs:mainfrom
dwaddle:fix/index-create-raise-compile-error
Open

dwaddle wants to merge 1 commit into
databendlabs:mainfrom
dwaddle:fix/index-create-raise-compile-error

Conversation

@dwaddle

@dwaddle dwaddle commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Problem

In databend_sqlalchemy/databend_dialect.py, visit_create_index and visit_drop_index return empty strings (""). In connector.py, execution of empty statements is swallowed (if not operation: return).

As a result, executing Index("ix_t_b", table.c.b).create(conn) or dropping an index returns normally with zero warnings and zero exceptions, leading callers and migration tooling to assume the index was successfully created when Databend does not support standard secondary indexes.

Solution

Raise an explicit sqlalchemy.exc.CompileError in both visit_create_index and visit_drop_index:

  • Clarifies that standard secondary indexes are not supported by Databend.
  • Suggests native alternatives supported by Databend (CLUSTER BY or INVERTED INDEX).
  • Eliminates silent false successes in migration scripts and index management code.

Verification

  • Added test_create_and_drop_index_raises_compile_error in tests/unit/test_databend_dialect.py verifying that compiling CreateIndex or DropIndex against DatabendDialect raises CompileError with descriptive diagnostic messages.
  • Verified 100% test pass via pytest.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T12:43:30.670539Z b78e2de PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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