# PolarsExportHandler

## class nominal.thirdparty.polars.polars_export_handler.PolarsExportHandler(client, points_per_request=DEFAULT_POINTS_PER_REQUEST, points_per_dataframe=DEFAULT_POINTS_PER_DATAFRAME, channels_per_request=DEFAULT_CHANNELS_PER_REQUEST, num_workers=DEFAULT_NUM_WORKERS)

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object "(in Python v3.15)")

Streams data out of Nominal into Polars DataFrames.

Pipeline:

- Filter to exportable channel types (DOUBLE/INT/STRING).
- Confirm each channel has data in the range (via `filter_channels_with_data`) and
  estimate per-channel peak points-per-second.
- Compute a batch duration such that each DataFrame batch stays under `points_per_dataframe`,
  unless the caller passes an explicit `batch_duration`.
- Bin-pack channels into per-request groups within the `points_per_request` rate budget;
  channels whose rate exceeds the budget are split across sub-slices of the time range.
- For each time slice, fetch channel groups in parallel and stitch the results back into a
  single DataFrame (via vertical concat within equal-column groups, outer-join across groups
  on the timestamp column) before yielding.

Initialize export handler

### export(channels, start, end, tags=None, batch_duration=None, timestamp_type='epoch_seconds', buckets=None, resolution=None, join_batches=True)

Yield exported data one DataFrame at a time.

Only DOUBLE, INT, and STRING channels flow through the export pipeline; channels of any
other data type are filtered out with a warning.

Parameters:
:   - **channels** ([*Sequence*](https://docs.python.org/3/library/typing.html#typing.Sequence "(in Python v3.15)")*[*[*Channel*](https://dev.nominal.io/python/ref/generated/nominal.core.Channel.md#nominal.core.Channel "nominal.core.channel.Channel")*]*)

      Channels to export.
    - **start** ([*int*](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)"))

      Start of the export time range (nanoseconds UTC).
    - **end** ([*int*](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)"))

      End of the export time range (nanoseconds UTC).
    - **tags** ([*Mapping*](https://docs.python.org/3/library/typing.html#typing.Mapping "(in Python v3.15)")*[*[*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")*,* [*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")*]* *|* *None*)

      Key-value pairs used to filter channel data server-side.
    - **batch_duration** ([*timedelta*](https://docs.python.org/3/library/datetime.html#datetime.timedelta "(in Python v3.15)") *|* *None*)

      Explicit per-batch time window. If omitted, one is computed
      from total channel rate and `points_per_dataframe`.
    - **timestamp_type** ([*Iso8601*](https://dev.nominal.io/python/ref/generated/nominal.ts.Iso8601.md#nominal.ts.Iso8601 "nominal.ts.Iso8601") *|* [*Epoch*](https://dev.nominal.io/python/ref/generated/nominal.ts.Epoch.md#nominal.ts.Epoch "nominal.ts.Epoch") *|* [*Relative*](https://dev.nominal.io/python/ref/generated/nominal.ts.Relative.md#nominal.ts.Relative "nominal.ts.Relative") *|* [*Literal*](https://docs.python.org/3/library/typing.html#typing.Literal "(in Python v3.15)")*[**'iso_8601'**,* *'epoch_picoseconds'**,* *'epoch_nanoseconds'**,* *'epoch_microseconds'**,* *'epoch_milliseconds'**,* *'epoch_seconds'**,* *'epoch_minutes'**,* *'epoch_hours'**,* *'epoch_days'**]*)

      Output timestamp representation (`epoch_seconds`, `iso8601`, etc.).
    - **buckets** ([*int*](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)") *|* *None*)

      Decimate each channel to at most this many buckets per request. Mutually
      exclusive with `resolution`.
    - **resolution** ([*int*](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)") *|* *None*)

      Decimate each channel to samples at this interval (nanoseconds).
      Mutually exclusive with `buckets`.
    - **join_batches** ([*bool*](https://docs.python.org/3/builtins/functions.html#bool "(in Python v3.15)"))

      If True (default), each yielded DataFrame is the outer-joined merge of
      all channel groups for a single time slice. If False, yields one DataFrame per
      channel group without merging.

Yields:
:   Polars DataFrames covering successive time slices of the export range.

Return type:
:   [*Iterator*](https://docs.python.org/3/library/typing.html#typing.Iterator "(in Python v3.15)")[*DataFrame*]
