Skip to content

Commit 1700630

Browse files
feat: Add ExternalRuntimeOptions to BigQuery routine
This change introduces the `ExternalRuntimeOptions` class to the `google.cloud.bigquery.routine` module, allowing users to configure runtime options for external routines. Key changes: - Created the `ExternalRuntimeOptions` class with setters and getters for `container_memory`, `container_cpu`, `runtime_connection`, `max_batching_rows`, and `runtime_version`. - Updated the `Routine` class to include an `external_runtime_options` property that accepts an `ExternalRuntimeOptions` object. - Added comprehensive unit tests for the new class and its integration with the `Routine` class, including tests for both valid and invalid input values. - Added additional tests to improve code coverage based on feedback. - Addressed PyType errors by using helper functions for type conversion.
1 parent ff253f9 commit 1700630

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

google/cloud/bigquery/routine/routine.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ def __init__(
831831
@property
832832
def container_memory(self) -> Optional[str]:
833833
"""Optional. Amount of memory provisioned for a Python UDF container instance."""
834-
return self._properties.get("containerMemory")
834+
return _helpers._str_or_none(self._properties.get("containerMemory"))
835835

836836
@container_memory.setter
837837
def container_memory(self, value: Optional[str]):
@@ -842,7 +842,7 @@ def container_memory(self, value: Optional[str]):
842842
@property
843843
def container_cpu(self) -> Optional[int]:
844844
"""Optional. Amount of CPU provisioned for a Python UDF container instance."""
845-
return self._properties.get("containerCpu")
845+
return _helpers._int_or_none(self._properties.get("containerCpu"))
846846

847847
@container_cpu.setter
848848
def container_cpu(self, value: Optional[int]):
@@ -853,7 +853,7 @@ def container_cpu(self, value: Optional[int]):
853853
@property
854854
def runtime_connection(self) -> Optional[str]:
855855
"""Optional. Fully qualified name of the connection."""
856-
return self._properties.get("runtimeConnection")
856+
return _helpers._str_or_none(self._properties.get("runtimeConnection"))
857857

858858
@runtime_connection.setter
859859
def runtime_connection(self, value: Optional[str]):
@@ -875,7 +875,7 @@ def max_batching_rows(self, value: Optional[int]):
875875
@property
876876
def runtime_version(self) -> Optional[str]:
877877
"""Optional. Language runtime version."""
878-
return self._properties.get("runtimeVersion")
878+
return _helpers._str_or_none(self._properties.get("runtimeVersion"))
879879

880880
@runtime_version.setter
881881
def runtime_version(self, value: Optional[str]):

0 commit comments

Comments
 (0)