Skip to content

Commit a290f75

Browse files
committed
support empty array in _from_api_repr_struct
1 parent ea69fe3 commit a290f75

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

google/cloud/bigquery/query.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,20 @@ def _from_api_repr_struct(cls, resource):
689689
struct_resource["parameterValue"] = array_value
690690
struct_value = StructQueryParameter.from_api_repr(struct_resource)
691691
converted.append(struct_value)
692-
return cls(name, "STRUCT", converted)
692+
return cls(
693+
name,
694+
StructQueryParameterType(
695+
*[
696+
ScalarQueryParameterType(
697+
struct_type["type"]["type"], name=struct_type["name"]
698+
)
699+
for struct_type in resource["parameterType"]["arrayType"][
700+
"structTypes"
701+
]
702+
]
703+
),
704+
values=converted,
705+
)
693706

694707
@classmethod
695708
def _from_api_repr_scalar(cls, resource):

0 commit comments

Comments
 (0)