Index.create() reports success and creates nothing: the compiler emits an empty string and the connector returns early

Open Beginner friendly
#78 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
python, sqlalchemy
Domain
database

Research direction

Start at the compiler path used by Index.create() and the connector's early return for a falsy operation. Trace the empty-string DDL flow and verify that unsupported index creation raises CompileError or NotImplementedError instead of reporting success; confirm the behavior with the Index.create() example and index inspection described in the issue.

Written by the indexing model from the issue text.

Description

Versions

  • databend-sqlalchemy 0.5.5
  • databend-driver 0.34.2
  • SQLAlchemy 2.0.51
  • Python 3.12.9, macOS
  • Server: datafuselabs/databend:v1.2.925-patch-4 in Docker

What happens

Index("ix_t_b", table.c.b).create(conn)

raises nothing and creates nothing. The statement reaching the driver is the empty string, and the connector returns early for a falsy one — with a comment saying exactly that:

# ToDo - Fix this, which is preventing the execution of blank DDL such as CREATE INDEX
# statements which aren't currently supported
if not operation:
    return

Afterwards inspect(conn).get_indexes(t) is empty and so is SHOW INDEXES.

Expected: a CompileError or NotImplementedError, so the caller finds out.

Why the silent version is the bad one

The caller is left holding an index name that doesn't exist — one that can't be listed, can't be dropped, and won't be used. Any tooling that creates an index and then reports it back to a user is now reporting something untrue. A refusal would have been fine; I'd have caught it in a minute.

What Databend does offer, measured on the live server

statement result
ALTER TABLE t CLUSTER BY (b) accepted; SHOW CREATE TABLE then reads … ENGINE=FUSE CLUSTER BY linear(b)
CREATE INVERTED INDEX iv ON t(b), b a STRING column accepted; shows as SYNC INVERTED INDEX iv (b)
CREATE INVERTED INDEX iv ON t(a), a an INT column refused — Inverted index currently only support String and Variant type

Neither is reflectable through get_indexes.

Suggested fix

Raise instead of emitting an empty string. Mapping Index onto CLUSTER BY or an inverted index where the column type allows it would be nice, but the raise is the part that matters — right now the failure is invisible.

Dominant language
Python
Stars
15
Forks
4
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from databendlabs/databend-sqlalchemy

All issues in databendlabs/databend-sqlalchemy

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.