pola-rs/polars · error · NotImplementedError

`sink_parquet` is not supported by

Error message

`sink_parquet` is not supported by {type(self).__name__}

What it means

`sink_parquet` writes a LazyFrame directly to Parquet via the query engine; sink methods are implemented only by engines that support streaming sinks. The base `Engine` class raises NotImplementedError with this message for engines lacking sink support.

Solutions

  1. Use an engine that supports sinks (e.g. `engine='streaming'`).
  2. Replace the sink with `df = lf.collect(); df.write_parquet(path)`.
  3. Implement `sink_parquet` in your custom Engine subclass.
  4. Verify sink support for your engine in polars docs.

Example fix

// before
lf.sink_parquet("out.parquet", engine="in-memory")
// after
lf.sink_parquet("out.parquet", engine="streaming")
Defensive patterns

Strategy: try-catch

Validate before calling

if type(engine_obj).sink_parquet is Engine.sink_parquet:
    engine = "streaming"

Type guard

def supports_sink(engine: object) -> bool:
    return type(engine).sink_parquet is not Engine.sink_parquet

Try / catch

try:
    lf.sink_parquet(path, engine=eng)
except NotImplementedError:
    lf.collect().write_parquet(path)

Prevention

When it happens

Trigger: Calling `LazyFrame.sink_parquet(..., engine=<engine>)` where the engine does not override `sink_parquet` (e.g. a custom engine stub).

Common situations: Streaming write pipelines pointed at a custom engine; code written for the streaming engine executed with the in-memory or a user-defined engine.

Related errors


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

Appendix: source

Thrown at py-polars/src/polars/lazyframe/engine.py:206

        *,
        compression: ParquetCompression,
        compression_level: int | None,
        statistics: bool | str | dict[str, bool],
        row_group_size: int | None,
        data_page_size: int | None,
        maintain_order: bool,
        storage_options: StorageOptionsDict | None,
        credential_provider: CredentialProviderFunction | Literal["auto"] | None,
        sync_on_close: SyncOnCloseMethod | None,
        metadata: ParquetMetadata | None,
        arrow_schema: ArrowSchemaExportable | None,
        mkdir: bool,
        optimizations: QueryOptFlags,
        sinked_paths_callback: SinkedPathsCallback | None,
    ) -> None:
        """See :meth:`polars.LazyFrame.sink_parquet`."""
        msg = f"`sink_parquet` is not supported by {type(self).__name__}"
        raise NotImplementedError(msg)

    def sink_ipc(
        self,
        lf: LazyFrame,
        path: str | Path | IO[bytes] | PartitionBy,
        *,
        compression: IpcCompression | None,
        compat_level: CompatLevel | None,
        record_batch_size: int | None,
        maintain_order: bool,
        storage_options: StorageOptionsDict | None,
        credential_provider: CredentialProviderFunction | Literal["auto"] | None,
        sync_on_close: SyncOnCloseMethod | None,
        mkdir: bool,
        optimizations: QueryOptFlags,
        _record_batch_statistics: bool,
        sinked_paths_callback: SinkedPathsCallback | None,
    ) -> None:

View on GitHub (pinned to fe841f959e)