[
https://issues.apache.org/jira/browse/BEAM-11441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17290097#comment-17290097
]
Beam JIRA Bot commented on BEAM-11441:
--------------------------------------
This issue was marked "stale-P2" and has not received a public comment in 14
days. It is now automatically moved to P3. If you are still affected by it, you
can comment and move it back to P2.
> Python io.gcp.datastore.v1new.types.Entity.to_client_entity does not handle
> list of Keys
> ----------------------------------------------------------------------------------------
>
> Key: BEAM-11441
> URL: https://issues.apache.org/jira/browse/BEAM-11441
> Project: Beam
> Issue Type: Bug
> Components: io-py-gcp
> Affects Versions: 2.23.0
> Reporter: Alex Indaco
> Priority: P3
>
> in io.gcp.datastore.v1new.types, Entity's method `to_client_entity` does not
> do it's conversions for repeated properties (arrays)
> I believe that changing the code of `to_client_entity` to the following
> should fix the issue
> {code:java}
> def _to_client_value(self, value)
> if isinstance(value, Key):
> if not value.project:
> value.project = self.key.project
> value = value.to_client_key()
> if isinstance(value, Entity):
> if not value.key.project:
> value.key.project = self.key.project
> value = value.to_client_entity()
> return value
> def to_client_entity(self):
> """
> Returns a :class:`google.cloud.datastore.entity.Entity` instance that
> represents this entity.
> """
> res = entity.Entity(
> key=self.key.to_client_key(),
> exclude_from_indexes=tuple(self.exclude_from_indexes))
> for name, value in self.properties.items():
> if isinstance(value, list):
> value = [self._to_client_value(item) for item in value]
> else:
> value = self._to_client_value(value)
> res[name] = value
> return res{code}
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)