Skip to content

TypeError: unhashable type: 'ReflectedPartitionInfo'` in Python SQLAlchemy dialect breaks Superset dataset creation #70733

Description

@aholowko

Steps to reproduce the behavior (Required)

  1. Install starrocks Python package v1.3.3 (pip install starrocks)
  2. Connect Apache Superset (v4.1.2) to a StarRocks instance using the starrocks SQLAlchemy dialect
  3. Create any table in StarRocks, e.g.:
CREATE TABLE test_db.example (
    id INT,
    dt DATE
) PARTITION BY RANGE(dt) (
    PARTITION p1 VALUES LESS THAN ('2026-01-01')
)
DISTRIBUTED BY HASH(id) BUCKETS 4;
  1. In Superset, attempt to create a dataset pointing to that table

Expected behavior (Required)

The dataset should be created successfully and Superset should reflect the table schema.

Real behavior (Required)

Dataset creation fails with TypeError: unhashable type: 'ReflectedPartitionInfo'.

The root cause is in contrib/starrocks-python-client/starrocks/engine/interfaces.py. The dataclasses ReflectedPartitionInfo, ReflectedDistributionInfo, ReflectedTableKeyInfo, and ReflectedRefreshInfo do not define __hash__. Python dataclasses that define __eq__ (implicitly) become unhashable by default. These objects are stored in table_options and get passed into SQLAlchemy's reflection cache, which uses them as dictionary keys — causing the TypeError.

Full traceback:

File "sqlalchemy/engine/reflection.py", line 497, in get_columns
    col_defs = self.dialect.get_columns(
File "<string>", line 2, in get_columns
File "sqlalchemy/engine/reflection.py", line 53, in cache
    ret = info_cache.get(key)
TypeError: unhashable type: 'ReflectedPartitionInfo'

StarRocks version (Required)

  • StarRocks server: 4.0 (via starrocks/fe-ubuntu:4.0-latest Docker image)
  • starrocks Python package: 1.3.3
  • Apache Superset: 4.1.2
  • SQLAlchemy: 1.4.x / 2.x

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions