pola-rs/polars · error · ValueError
cannot apply delta_table_version for table of type
Error message
cannot apply delta_table_version for table of type {data_source_format} What it means
`scan_table` raises ValueError when `delta_table_version` is supplied for a table whose `data_source_format` is not Delta Lake. Version/time-travel reads are a Delta-specific feature; other formats (PARQUET, CSV, etc.) have no version history, so the parameter cannot be honored. The error names the actual format detected server-side.
Solutions
- Remove `delta_table_version` for non-Delta tables, or scan the table without time travel
- Check the table's format (e.g. via the Unity Catalog REST API / catalog explorer) before passing Delta options
- Convert the table to Delta Lake if versioned reads are genuinely needed
Example fix
// before
lf = pl.scan_unity_catalog_table("cat", "sch", "tbl", delta_table_version=3) # PARQUET table
// after
lf = pl.scan_unity_catalog_table("cat", "sch", "tbl") # drop Delta-only option Defensive patterns
Strategy: validation
Validate before calling
info = client.get_table(catalog, ns, table)
if info.data_source_format != 'DELTA' and delta_table_version is not None:
raise ValueError('delta_table_version only applies to DELTA tables') Type guard
def supports_delta_version(fmt: str) -> bool:
return fmt.upper() == 'DELTA' Try / catch
try:
lf = client.scan_table(c, n, t, delta_table_version=ver)
except ValueError as e:
if 'delta_table_version' in str(e):
lf = client.scan_table(c, n, t) # scan without time travel
else:
raise Prevention
- Look up the table's data_source_format before passing Delta-specific kwargs
- Keep Delta and non-Delta scan code paths separate
- Confirm tables are Delta-managed when relying on time travel
When it happens
Trigger: Calling `client.scan_table(catalog, ns, table, delta_table_version=3)` (or the higher-level `pl.scan_unity_catalog_table(..., delta_table_version=n)`) where the table's format is e.g. PARQUET.
Common situations: Assuming every Unity Catalog table is a Delta table; pointing a Delta-specific option set at a plain external parquet table; drift where a table was converted from Delta to another format.
Understand the failure class
Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.
Related errors
- cannot apply delta_table_options for table of type
- a non-HTTPS workspace_url was given
- cannot override reserved namespace
- cannot use credential_provider when passing a DeltaTable…
- cannot use credential_provider when passing a DeltaTable…
AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18).
Data as JSON: /api/errors/01d30976c084337a.
Report an issue: GitHub.
Appendix: source
Thrown at py-polars/src/polars/catalog/unity/client.py:274
)
if data_source_format in ["DELTA", "DELTASHARING"]:
from polars.io.delta import scan_delta
return scan_delta(
storage_location,
version=delta_table_version,
delta_table_options=delta_table_options,
storage_options=storage_options,
credential_provider=credential_provider,
)
if delta_table_version is not None:
msg = (
"cannot apply delta_table_version for table of type "
f"{data_source_format}"
)
raise ValueError(msg)
if delta_table_options is not None:
msg = (
"cannot apply delta_table_options for table of type "
f"{data_source_format}"
)
raise ValueError(msg)
return wrap_ldf(
self._client.scan_table(
catalog_name,
namespace,
table_name,
credential_provider=credential_provider,
cloud_options=storage_options,
)
)
View on GitHub (pinned to fe841f959e)