You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Beam JIRA Bot (Jira)" <ji...@apache.org> on 2021/02/10 17:16:01 UTC
[jira] [Updated] (BEAM-11441) Python
io.gcp.datastore.v1new.types.Entity.to_client_entity does not handle list
of Keys
[ https://issues.apache.org/jira/browse/BEAM-11441?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Beam JIRA Bot updated BEAM-11441:
---------------------------------
Labels: stale-P2 (was: )
> 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: P2
> Labels: stale-P2
>
> 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)