Skip to content

Commit 19c6241

Browse files
committed
python(feat): updated export.protos to support parquet
1 parent c47512b commit 19c6241

6 files changed

Lines changed: 46 additions & 15 deletions

File tree

python/lib/sift/exports/v1/exports_pb2.py

Lines changed: 15 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

python/lib/sift/exports/v1/exports_pb2.pyi

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ class _ExportOutputFormatEnumTypeWrapper(google.protobuf.internal.enum_type_wrap
3030
EXPORT_OUTPUT_FORMAT_UNSPECIFIED: _ExportOutputFormat.ValueType # 0
3131
EXPORT_OUTPUT_FORMAT_CSV: _ExportOutputFormat.ValueType # 1
3232
EXPORT_OUTPUT_FORMAT_SUN: _ExportOutputFormat.ValueType # 2
33+
EXPORT_OUTPUT_FORMAT_PARQUET: _ExportOutputFormat.ValueType # 3
3334

3435
class ExportOutputFormat(_ExportOutputFormat, metaclass=_ExportOutputFormatEnumTypeWrapper): ...
3536

3637
EXPORT_OUTPUT_FORMAT_UNSPECIFIED: ExportOutputFormat.ValueType # 0
3738
EXPORT_OUTPUT_FORMAT_CSV: ExportOutputFormat.ValueType # 1
3839
EXPORT_OUTPUT_FORMAT_SUN: ExportOutputFormat.ValueType # 2
40+
EXPORT_OUTPUT_FORMAT_PARQUET: ExportOutputFormat.ValueType # 3
3941
global___ExportOutputFormat = ExportOutputFormat
4042

4143
@typing.final
@@ -225,19 +227,23 @@ class ExportDataResponse(google.protobuf.message.Message):
225227

226228
PRESIGNED_URL_FIELD_NUMBER: builtins.int
227229
JOB_ID_FIELD_NUMBER: builtins.int
230+
SERVICE_MESSAGE_FIELD_NUMBER: builtins.int
228231
presigned_url: builtins.str
229232
"""Pre-signed URL of exported zip containing export files. This will be blank if
230233
the job is processed as a background job, in which case `job_id` will be non-empty.
231234
"""
232235
job_id: builtins.str
233236
"""This will be non-empty if the export is being processed asynchronously in a background job."""
237+
service_message: builtins.str
238+
"""Optional message for the client to display in success or error notification (e.g. exclusions or 403 reason)."""
234239
def __init__(
235240
self,
236241
*,
237242
presigned_url: builtins.str = ...,
238243
job_id: builtins.str = ...,
244+
service_message: builtins.str = ...,
239245
) -> None: ...
240-
def ClearField(self, field_name: typing.Literal["job_id", b"job_id", "presigned_url", b"presigned_url"]) -> None: ...
246+
def ClearField(self, field_name: typing.Literal["job_id", b"job_id", "presigned_url", b"presigned_url", "service_message", b"service_message"]) -> None: ...
241247

242248
global___ExportDataResponse = ExportDataResponse
243249

@@ -261,12 +267,16 @@ class GetDownloadUrlResponse(google.protobuf.message.Message):
261267
DESCRIPTOR: google.protobuf.descriptor.Descriptor
262268

263269
PRESIGNED_URL_FIELD_NUMBER: builtins.int
270+
SERVICE_MESSAGE_FIELD_NUMBER: builtins.int
264271
presigned_url: builtins.str
272+
service_message: builtins.str
273+
"""Optional message for the client to display in success or error notification."""
265274
def __init__(
266275
self,
267276
*,
268277
presigned_url: builtins.str = ...,
278+
service_message: builtins.str = ...,
269279
) -> None: ...
270-
def ClearField(self, field_name: typing.Literal["presigned_url", b"presigned_url"]) -> None: ...
280+
def ClearField(self, field_name: typing.Literal["presigned_url", b"presigned_url", "service_message", b"service_message"]) -> None: ...
271281

272282
global___GetDownloadUrlResponse = GetDownloadUrlResponse

python/lib/sift_client/_tests/resources/test_exports.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
START = datetime(2025, 1, 1, tzinfo=timezone.utc)
3939
STOP = datetime(2025, 1, 2, tzinfo=timezone.utc)
4040
CSV = ExportOutputFormat.CSV
41+
PARQUET = ExportOutputFormat.PARQUET
4142

4243

4344
@pytest.fixture
@@ -240,6 +241,20 @@ def test_export_by_time_range(self, exports_api_sync, sift_client, nostromo_run)
240241
assert isinstance(job, Job)
241242

242243

244+
class TestParquetFormat:
245+
@pytest.mark.asyncio
246+
async def test_export_parquet_format(self, exports_api):
247+
"""Test that Parquet output format is accepted."""
248+
await exports_api.export(
249+
runs=["run-1"],
250+
start_time=START,
251+
stop_time=STOP,
252+
output_format=PARQUET,
253+
)
254+
call_kwargs = exports_api._low_level_client.export_data.call_args.kwargs
255+
assert call_kwargs["output_format"] == PARQUET
256+
257+
243258
class TestDictConversion:
244259
@pytest.mark.asyncio
245260
async def test_calculated_channel_dict_converted(self, exports_api):

python/lib/sift_client/resources/exports.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ async def export(
7171
You cannot provide both ``runs`` and ``assets`` at the same time.
7272
7373
Args:
74-
output_format: The file format for the export (CSV or Sun/WinPlot).
74+
output_format: The file format for the export (CSV, Parquet, or Sun/WinPlot).
7575
runs: One or more Run objects or run IDs to export data from.
7676
assets: One or more Asset objects or asset IDs to export data from.
7777
start_time: Start of the time range to export. Required when using

python/lib/sift_client/resources/sync_stubs/__init__.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ class DataExportAPI:
593593
You cannot provide both ``runs`` and ``assets`` at the same time.
594594
595595
Args:
596-
output_format: The file format for the export (CSV or Sun/WinPlot).
596+
output_format: The file format for the export (CSV, Parquet, or Sun/WinPlot).
597597
runs: One or more Run objects or run IDs to export data from.
598598
assets: One or more Asset objects or asset IDs to export data from.
599599
start_time: Start of the time range to export. Required when using

python/lib/sift_client/sift_types/export.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ class ExportOutputFormat(Enum):
1111
Attributes:
1212
CSV: Comma-separated values format.
1313
SUN: Sun (WinPlot) format (not used in certain environments).
14+
PARQUET: Apache Parquet columnar storage format.
1415
"""
1516

1617
CSV = ExportOutputFormatProto.EXPORT_OUTPUT_FORMAT_CSV
1718
SUN = ExportOutputFormatProto.EXPORT_OUTPUT_FORMAT_SUN
19+
PARQUET = ExportOutputFormatProto.EXPORT_OUTPUT_FORMAT_PARQUET

0 commit comments

Comments
 (0)