pola-rs/polars · error · NotImplementedError

write_table: table format of

Error message

write_table: table format of {catalog_name}.{namespace}.{table_name} ({data_source_format}) is unsupported.

What it means

`write_table` raises NotImplementedError when the target Unity Catalog table's `data_source_format` is one Polars cannot write to. Polars supports writing only a subset of catalog table formats (e.g. Delta); other formats are rejected with a message identifying the fully-qualified table name and its format. This is a capability limit, not a transient failure.

Solutions

  1. Write to a Delta-backed table (convert the target table to Delta in Databricks)
  2. Write the data via the format-appropriate tool (e.g. use SQL COPY INTO / Databricks SDK for non-Delta targets)
  3. Read the error's data_source_format and check Polars docs for the supported write formats

Example fix

// before
client.write_table("cat", "sch", "csv_table", df)  # NotImplementedError
// after
# write via Databricks SQL for non-Delta tables, or target a Delta table:
client.write_table("cat", "sch", "delta_table", df)
Defensive patterns

Strategy: fallback

Validate before calling

fmt = client.get_table(catalog, ns, table).data_source_format
if fmt.upper() not in {'DELTA'}:
    raise NotImplementedError(f'polars cannot write to {fmt} catalog tables')

Try / catch

try:
    client.write_table(c, n, t, df)
except NotImplementedError as e:
    logging.warning('unsupported catalog write, falling back to SQL path: %s', e)
    write_via_databricks_sql(c, n, t, df)

Prevention

When it happens

Trigger: Calling `client.write_table(catalog, ns, table, data)` (or the higher-level write API) where the table's format is unsupported, e.g. CSV or ORC-backed external tables.

Common situations: Writing to an external CSV/JSON table in Unity Catalog; assuming all catalog tables accept writes like Delta ones do; legacy tables on older formats.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18). Data as JSON: /api/errors/d3c6eb122d2e0168. Report an issue: GitHub.

Appendix: source

Thrown at py-polars/src/polars/catalog/unity/client.py:396

        )

        if data_source_format in ["DELTA", "DELTASHARING"]:
            return df.write_delta(  # type: ignore[misc]
                storage_location,
                storage_options=storage_options,
                credential_provider=credential_provider,
                mode=delta_mode,
                delta_write_options=delta_write_options,
                delta_merge_options=delta_merge_options,
            )  # type: ignore[call-overload]

        else:
            msg = (
                "write_table: table format of "
                f"{catalog_name}.{namespace}.{table_name} "
                f"({data_source_format}) is unsupported."
            )
            raise NotImplementedError(msg)

    def create_catalog(
        self,
        catalog_name: str,
        *,
        comment: str | None = None,
        storage_root: str | None = None,
    ) -> CatalogInfo:
        """
        Create a catalog.

        .. warning::
            This functionality is considered **unstable**. It may be changed
            at any point without it being considered a breaking change.

        Parameters
        ----------
        catalog_name

View on GitHub (pinned to fe841f959e)