From 79e83ac286b85164d52cd703dc04d3fb51e277d5 Mon Sep 17 00:00:00 2001 From: Florian Valeye Date: Thu, 15 Oct 2026 15:48:10 +0200 Subject: [PATCH] refactor(client): drop compute size string helper ComputeSize mixes in str, so its members already are the string values protobuf expects. Pass compute_size straight to SessionOptionValue instead of unwrapping it through _compute_size_value. --- src/altertable_flightsql/client.py | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/altertable_flightsql/client.py b/src/altertable_flightsql/client.py index 4447daa..cfdb818 100644 --- a/src/altertable_flightsql/client.py +++ b/src/altertable_flightsql/client.py @@ -59,12 +59,6 @@ class ComputeSize(str, Enum): XXXXL = "4XL" -def _compute_size_value(compute_size: Union[ComputeSize, str]) -> str: - if isinstance(compute_size, ComputeSize): - return compute_size.value - return compute_size - - @dataclass(frozen=True) class IngestIncrementalOptions: """Options for incremental ingestion.""" @@ -185,9 +179,7 @@ def __init__( options["schema"] = flight_pb2.SessionOptionValue(string_value=schema) if compute_size: - options["compute_size"] = flight_pb2.SessionOptionValue( - string_value=_compute_size_value(compute_size) - ) + options["compute_size"] = flight_pb2.SessionOptionValue(string_value=compute_size) if options: self._set_options(options) @@ -234,11 +226,7 @@ def set_compute_size(self, compute_size: Union[ComputeSize, str]): takes effect if called before the first query. """ self._set_options( - { - "compute_size": flight_pb2.SessionOptionValue( - string_value=_compute_size_value(compute_size) - ) - } + {"compute_size": flight_pb2.SessionOptionValue(string_value=compute_size)} ) def query(