databendlabs/databend · error · TypeError

Unsupported source type. Expected path, pandas.DataFrame…

Error message

Unsupported source type. Expected path, pandas.DataFrame, polars.DataFrame, or pyarrow.Table.

What it means

PermitKey::parse_key requires the second of the 3 segments (parts[1]) to be the literal 'queue'. The key has the right shape (3 segments) but is not a queue permit key — it likely belongs to another key family in the same storage tree.

Solutions

  1. Verify the writer path encodes the middle segment as the literal "queue".
  2. Filter keys with a cheap prefix/segment check before calling parse_key.
  3. Search for any code building keys with a different second segment and fix or migrate it.

Example fix

// before
for key in all_keys { let p = PermitKey::parse_key(&key)?; }
// after
for key in all_keys.filter(|k| k.contains("/queue/")) { let p = PermitKey::parse_key(&key)?; }
Defensive patterns

Strategy: validation

Validate before calling

if !key.contains("/queue/") { return skip(); }

Type guard

fn is_queue_key(key: &str) -> bool { key.split('/').nth_from_end(2) == Some("queue") }

Try / catch

PermitKey::parse_key(key).map_err(|e| if msg_contains(&e, "'queue'") { warn_skip(key) } else { e.into() })?

Prevention

When it happens

Trigger: Parsing a key like '123/users/myname' or '123/foo/bar' — 3 segments, but the middle segment is not 'queue'.

Common situations: A generic storage-scan feeds unrelated meta keys into parse_key; a typo'd writer path wrote keys with a wrong middle segment; mixing keys across semaphore plugins.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of databendlabs/databend@288d84d76e (2026-09-11). Data as JSON: /api/errors/98cbfc064d4698ce. Report an issue: GitHub.

Appendix: source

Thrown at src/bendpy/python/databend/__init__.py:239

        return _normalize_path(parquet_path)

    @staticmethod
    def _to_arrow_table(source: Any):
        if hasattr(source, "schema") and hasattr(source, "to_pydict"):
            return source

        if hasattr(source, "to_arrow"):
            return source.to_arrow()

        if hasattr(source, "to_pandas"):
            source = source.to_pandas()

        try:
            import pyarrow as pa

            return pa.Table.from_pandas(source, preserve_index=False)
        except Exception as exc:
            raise TypeError(
                "Unsupported source type. Expected path, pandas.DataFrame, "
                "polars.DataFrame, or pyarrow.Table."
            ) from exc


Connection = SessionContext
DataFrame = Relation


def connect(database: str = ":memory:", *, data_path: str | None = None) -> Connection:
    if data_path is not None:
        return Connection(data_path=data_path)

    if database == ":memory:":
        conn = Connection(data_path=mkdtemp(prefix="databend-embedded-"))
        conn._ephemeral = True
        return conn

View on GitHub (pinned to 288d84d76e)