Skip to content

Commit

Permalink
Support empty array in _from_api_repr_struct
Browse files Browse the repository at this point in the history
  • Loading branch information
TommyDew42 committed Sep 3, 2024
1 parent ea69fe3 commit 54e3a59
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion google/cloud/bigquery/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,20 @@ def _from_api_repr_struct(cls, resource):
struct_resource["parameterValue"] = array_value
struct_value = StructQueryParameter.from_api_repr(struct_resource)
converted.append(struct_value)
return cls(name, "STRUCT", converted)
return cls(
name,
StructQueryParameterType(
*[
ScalarQueryParameterType(
struct_type["type"]["type"], name=struct_type["name"]
)
for struct_type in resource["parameterType"]["arrayType"][
"structTypes"
]
]
),
values=converted,
)

@classmethod
def _from_api_repr_scalar(cls, resource):
Expand Down

0 comments on commit 54e3a59

Please sign in to comment.