Skip to content

Commit 579b9d3

Browse files
Update _data_frame_client.py
Make linter happy
1 parent 5eb05c9 commit 579b9d3

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

nisystemlink/clients/dataframe/_data_frame_client.py

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
"""Implementation of DataFrameClient."""
22

3-
import pyarrow as pa # type: ignore
43
from collections.abc import Iterable
54
from io import BytesIO
6-
from typing import Any, List, Optional, Union
5+
from typing import List, Optional, Union
76

7+
import pyarrow as pa # type: ignore
88
from nisystemlink.clients import core
99
from nisystemlink.clients.core._uplink._base_client import BaseClient
1010
from nisystemlink.clients.core._uplink._methods import (
@@ -255,7 +255,9 @@ def get_table_data(
255255
@post("tables/{id}/data", args=[Path, Body])
256256
def _append_table_data_json(
257257
self, id: str, data: models.AppendTableDataRequest
258-
) -> None: ...
258+
) -> None:
259+
"""Internal uplink-implemented JSON append call."""
260+
...
259261

260262
@post(
261263
"tables/{id}/data",
@@ -264,7 +266,9 @@ def _append_table_data_json(
264266
)
265267
def _append_table_data_arrow(
266268
self, id: str, data: bytes, end_of_data: Optional[bool] = None
267-
) -> None: ...
269+
) -> None:
270+
"""Internal uplink-implemented Arrow (binary) append call."""
271+
...
268272

269273
def append_table_data(
270274
self,
@@ -283,18 +287,24 @@ def append_table_data(
283287
284288
Args:
285289
id: Unique ID of a data table.
286-
data: The data to append in one of the following forms:
287-
- AppendTableDataRequest: Sent as-is via JSON. ``end_of_data`` must be ``None``.
288-
- DataFrame (service model): Wrapped into an AppendTableDataRequest (``end_of_data`` optional) and sent as JSON.
289-
- Iterable[pyarrow.RecordBatch]: Streamed as Arrow IPC. ``end_of_data`` (if provided) is sent as a query parameter. If the iterator yields no batches, it is treated like ``None`` and requires ``end_of_data``.
290-
- None: ``end_of_data`` must be provided; sends JSON containing only the ``endOfData`` flag.
291-
end_of_data: Whether the table should expect any additional rows to be appended in future requests. Required when ``data`` is ``None`` or an empty RecordBatch iterator; must be omitted when supplying an ``AppendTableDataRequest`` (put it inside that model instead).
290+
data: The data to append. Supported forms:
291+
* AppendTableDataRequest: Sent as-is via JSON; ``end_of_data`` must be ``None``.
292+
* DataFrame (service model): Wrapped into an AppendTableDataRequest (``end_of_data``
293+
optional) and sent as JSON.
294+
* Iterable[pyarrow.RecordBatch]: Streamed as Arrow IPC. ``end_of_data`` (if provided)
295+
is sent as a query parameter. If the iterator yields no batches, it is treated as
296+
``None`` and requires ``end_of_data``.
297+
* None: ``end_of_data`` must be provided; sends JSON containing only the
298+
``endOfData`` flag.
299+
end_of_data: Whether additional rows may be appended in future requests. Required when
300+
``data`` is ``None`` or the RecordBatch iterator is empty; must be omitted when
301+
passing an ``AppendTableDataRequest`` (include it inside that model instead).
292302
293303
Raises:
294304
ValueError: If parameter constraints are violated.
295-
ApiException: If unable to communicate with the DataFrame Service or an invalid argument is provided.
305+
ApiException: If unable to communicate with the DataFrame Service or an
306+
invalid argument is provided.
296307
"""
297-
298308
if isinstance(data, models.AppendTableDataRequest):
299309
if end_of_data is not None:
300310
raise ValueError(
@@ -372,8 +382,10 @@ def _build_body() -> bytes:
372382
if wrap:
373383
raise core.ApiException(
374384
(
375-
"Arrow ingestion request was rejected. The target DataFrame Service doesn't support Arrow streaming. "
376-
"Install a DataFrame Service version with Arrow support or fall back to JSON ingestion."
385+
"Arrow ingestion request was rejected. The target "
386+
"DataFrame Service doesn't support Arrow streaming. "
387+
"Install a DataFrame Service version with Arrow support "
388+
"or fall back to JSON ingestion."
377389
),
378390
error=ex.error,
379391
http_status_code=ex.http_status_code,

0 commit comments

Comments
 (0)