Sitelet https://github.com/googleapis/google-cloud-java/issues/638
Skip to content

Support put for parameters of type FullEntity<IncompleteKey> in v1beta3 #638

Description

@ajkannan
No description provided.

Activity

  1. self-assigned this
    on Feb 11, 2016
  2. mziccard commented on May 26, 2016

    @mziccard
    Contributor

    Is this really necessary? The behavior of add and put for incomplete keys kind of overlaps in my mind, am I wrong? Isn't add(FullEntity<?>... entities) already enough to handle the creation of entities with incomplete keys?

    If we must support this then we should also change put signature to

    List<Entity> put(FullEntity<?>... entities)

    so that we return the generated complete keys (this might be a bit counter-intuitive as we remove duplicates from input entities, hence returned entities do not necessarily match the input). Thoughts? /cc @aozarov

  3. aozarov commented on May 26, 2016

    @aozarov
    Contributor

    In v1beta2* the datastore forced separating the entities with non complete keys which could only be used for add operations. v1beta3 now allows to specify incomplete keys also for put operations.

    A user can mimic this by (1) in the program separate the entities that are incomplete and use them in add instead of put (2) use batch to allow committing it in 1 RPC. However, that require some boilerplate code which now could be avoided.

    I don't think this issue is a high priority, but worth fixing when possible.
    Yes, in that case the put should return a List<Entity> similar to add.
    Also, DatastoreBatchWriter will need to support it by either adding
    putWithDeferredIdAllocation or decoupling DatastoreBatchWriter from DatastoreWriter.

  4. mziccard commented on May 26, 2016

    @mziccard
    Contributor

    A user can mimic this by (1) in the program separate the entities that are incomplete and use them in add instead of put (2) use batch to allow committing it in 1 RPC. However, that require some boilerplate code which now could be avoided.

    I see. I just wanted to understand the reason for this.

    In put now we remove duplicates in the input entities, should the returned list of updated/added entities have the cardinality (and order) of the input or of the input-without-duplicates? Both ways might seem a bit strange at first.

  5. aozarov commented on May 26, 2016

    @aozarov
    Contributor

    We should return the list of entities matching the order of the input.
    De-dup is an internal implementation detail and should only apply to entities with complete keys (obviously) and the same result should be associated with all the entities with matching keys.

  6. added a commit that references this issue on Dec 22, 2025
  7. added a commit that references this issue on Jan 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api: datastoreIssues related to the Datastore API.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions