Skip to content

Commit 2932991

Browse files
authored
feat: Add optional take to DataFrame Service export table data request model (#177)
Support for restricting the number of rows returned by the export table data route. The default is to return all rows.
1 parent ded2497 commit 2932991

File tree

3 files changed

+155
-138
lines changed

3 files changed

+155
-138
lines changed

examples/dataframe/export_data.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"0001-01-01T00:00:00Z" if index_column.data_type == DataType.Timestamp else "0"
2727
)
2828

29-
# Export table data with query options
29+
# Export the first 100,000 rows of table data with query options
3030
request = ExportTableDataRequest(
3131
columns=[index_column.name],
3232
order_by=[ColumnOrderBy(column=order_column.name, descending=True)],
@@ -37,6 +37,7 @@
3737
value=filter_value,
3838
)
3939
],
40+
take=100000,
4041
response_format=ExportFormat.CSV,
4142
)
4243

nisystemlink/clients/dataframe/models/_export_table_data_request.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ class ExportTableDataRequest(JsonModel):
3535
filtering do not need to be included in the columns list, in which case
3636
they are not included in the export."""
3737

38+
take: int | None = None
39+
"""The maximum number of rows to include in the export. If ``None``
40+
(the default), all rows are included. Added in version 3 of the
41+
:py:attr:`nisystemlink.clients.dataframe.models.OperationsV1.read_data`
42+
operation. Older versions of the service will ignore this value and
43+
always include all rows."""
44+
3845
response_format: ExportFormat
3946
"""The format of the exported data. The only response format
4047
currently supported is ``CSV``."""

0 commit comments

Comments
 (0)