Skip to content

fix: coerce dict-style requests into DescribeTableRequest in catalog impls - #182

Open
ZackFairTS wants to merge 1 commit into
lance-format:mainfrom
ZackFairTS:fix/coerce-dict-request-describe-table
Open

ZackFairTS wants to merge 1 commit into
lance-format:mainfrom
ZackFairTS:fix/coerce-dict-request-describe-table

Conversation

@ZackFairTS

Copy link
Copy Markdown

Root cause

pylance's Rust namespace bridge (python/src/namespace.rs) invokes the Python namespace implementation's describe_table with a DictWithModelDump — a plain dict subclass that exposes only model_dump() and no attributes — during the write-path storage-options callback (lance-io fetch_storage_options).

The catalog impls in this package access request fields as attributes (request.load_detailed_metadata, then request.id, ...), so they raise:

AttributeError: 'DictWithModelDump' object has no attribute 'load_detailed_metadata'

which surfaces end-to-end as:

OSError: LanceError(IO): Failed to fetch storage options: ... Python error in describe_table:
AttributeError: 'DictWithModelDump' object has no attribute 'load_detailed_metadata'

pylance's own DirectoryNamespace/RestNamespace wrappers avoid this because they call request.model_dump(); the catalog impls here use attribute access and therefore break on the write path.

Changes

  • Coerce a non-model request into the real DescribeTableRequest (request = DescribeTableRequest.from_dict(dict(request))) at the top of describe_table in all six catalog impls: glue, hive2, hive3, unity, iceberg, polaris. The check is a no-op when a real model is already passed, so existing callers are unaffected.
  • Adds a regression test per impl (test_describe_table_accepts_dict_request) that feeds a DictWithModelDump and asserts describe_table succeeds (no AttributeError) and returns the correct location.

describe_table is the method exercised by the pylance Rust storage-options write callback, so it is the minimum required fix. Other request-taking methods share the same attribute-access pattern and could be coerced similarly in a follow-up if desired.

Verification

cd python && uv sync --extra glue --extra hive2 --extra hive3 --extra unity --extra iceberg --extra polaris --extra dev

  • ruff check + ruff format --check on all six impls and their tests: clean.
  • pytest tests/test_{glue,hive2,hive3,unity,iceberg,polaris}.py: 129 passed (incl. the 6 new tests).

Fixes #181

…impls

pylance's Rust namespace bridge (python/src/namespace.rs) invokes the Python
namespace impl's describe_table with a DictWithModelDump (a plain dict subclass
exposing only model_dump(), no attributes) during the write-path storage-options
callback. The catalog impls (glue, hive2, hive3, unity, iceberg, polaris) access
request fields as attributes (request.load_detailed_metadata), which raises
AttributeError. pylance's own DirectoryNamespace/RestNamespace avoid this by
calling request.model_dump().

Coerce a non-model request into the real DescribeTableRequest via from_dict at
the top of each describe_table. Adds a regression test per impl feeding a
DictWithModelDump.

Fixes lance-format#181
@github-actions github-actions Bot added bug Something isn't working python labels Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Catalog impls access request fields as attributes but pylance's Rust bridge passes a DictWithModelDump (AttributeError on describe_table write path)

1 participant