pola-rs/polars · error · ValueError
cannot : no data_source_format found
Error message
cannot {operation}: no data_source_format found What it means
_extract_location_and_data_format raises ValueError when table_info.data_source_format is None: the Unity Catalog table metadata omits the data source format, so the reader/writer cannot determine which file format to use.
Solutions
- Recreate/alter the table with an explicit data source format (e.g. DELTA)
- Inspect table_info.data_source_format before scanning and supply format explicitly if the API allows
- Upgrade the unity-catalog server so it populates data_source_format
Example fix
// before
info = cat.get_table('catalog.schema.tbl') # data_source_format None
pl.read_delta(info) # ValueError
// after
# in UC: CREATE TABLE ... USING DELTA LOCATION 's3://bucket/tbl'
info = cat.get_table('catalog.schema.tbl') # format DELTA Defensive patterns
Strategy: validation
Validate before calling
info = cat.get_table(name)
assert info.data_source_format is not None, f'{name} has no data_source_format' Type guard
def has_known_format(info) -> bool:
return info.data_source_format is not None Try / catch
try:
lf = cat.scan_table(name)
except ValueError as e:
if 'data_source_format' in str(e):
logging.error('unknown format for table %s', name)
raise Prevention
- Create tables with an explicit USING DELTA (or other) format
- Verify format after get_table before scanning
- Keep unity-catalog server up to date
When it happens
Trigger: scan_table or write_table where TableInfo.data_source_format is None — tables created without a recognized format or metadata returned by a server that omits the field.
Common situations: Tables registered in UC without an explicit format; unsupported/unrecognized data source format serialized as null; older catalog server versions.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- cannot : no storage_location found
- did not receive credentials from temporary credentials API…
- duplicate column name
AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18).
Data as JSON: /api/errors/d9d70e3501806c23.
Report an issue: GitHub.
Appendix: source
Thrown at py-polars/src/polars/catalog/unity/client.py:751
msg = (
"did not receive credentials from temporary credentials API for "
f"{table_id = }"
)
raise Exception(msg) # noqa: TRY002
yield creds, expiry
def _extract_location_and_data_format(
table_info: TableInfo, operation: str
) -> tuple[str, DataSourceFormat]:
if table_info.storage_location is None:
msg = f"cannot {operation}: no storage_location found"
raise ValueError(msg)
if table_info.data_source_format is None:
msg = f"cannot {operation}: no data_source_format found"
raise ValueError(msg)
return table_info.storage_location, table_info.data_source_format
View on GitHub (pinned to fe841f959e)