Skip to content
This repository was archived by the owner on Feb 23, 2026. It is now read-only.
This repository was archived by the owner on Feb 23, 2026. It is now read-only.

Setting struct.Value message attributes? #104

@busunkim96

Description

@busunkim96

How do you set 'values' for the message below?

class Row(proto.Message):
    r"""A representation of a row in a relational table.

    Attributes:
        column_spec_ids (Sequence[str]):
            The resource IDs of the column specs describing the columns
            of the row. If set must contain, but possibly in a different
            order, all input feature

            [column_spec_ids][google.cloud.automl.v1beta1.TablesModelMetadata.input_feature_column_specs]
            of the Model this row is being passed to. Note: The below
            ``values`` field must match order of this field, if this
            field is set.
        values (Sequence[~.struct.Value]):
            Required. The values of the row cells, given in the same
            order as the column_spec_ids, or, if not set, then in the
            same order as input feature

            [column_specs][google.cloud.automl.v1beta1.TablesModelMetadata.input_feature_column_specs]
            of the Model this row is being passed to.
    """

    column_spec_ids = proto.RepeatedField(proto.STRING, number=2)

    values = proto.RepeatedField(proto.MESSAGE, number=3, message=struct.Value,)

Things I've tried:

>>> row = Row()
>>> values = [struct_pb2.Value(string_value="hello")]
>>> values
[string_value: "hello"
]
>>> row.values=values
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/google/home/busunkim/github/python-automl/.nox/unit-3-8/lib/python3.8/site-packages/proto/message.py", line 543, in __setattr__
    self._pb.MergeFrom(self._meta.pb(**{key: pb_value}))
TypeError: Value must be iterable

Metadata

Metadata

Assignees

Labels

priority: p3Desirable enhancement or fix. May not be included in next release.type: docsImprovement to the documentation for an API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions