GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Silent error when calling datastore.put() on nonlist · Issue #649 · googleapis/google-cloud-python

Silent error when calling datastore.put() on nonlist #649

New issue
Copy link
New issue
Copy link
Closed
#677
Closed
Silent error when calling datastore.put() on nonlist#649
#677
Copy link
Assignees
tseaver
Labels
api: datastoreIssues related to the Datastore API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Description

@elibixby
elibixby
opened on Feb 15, 2015
Issue body actions

Repro instructions:

ent = datastore.Entity(key=datastore.Key('test',1))
datastore.put(ent)

Entity is not put in the datastore, and call completes successfully.

Activity

  1. elibixby
    added
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    cla: yesThis human has signed the Contributor License Agreement.
    fix asap
    on Feb 15, 2015
  2. dhermes commented on Feb 17, 2015

    @dhermes
    dhermes
    on Feb 17, 2015
    Contributor
    More actions

    @elibixby Thanks for reporting, this is bad! The entity is False-y, hence nothing is added to the batch.

    By using a non-empty entity, the type mismatch actually causes an error (which is a "positive" in some sense):

    >>> ent['foo'] = 10
    >>> datastore.put(ent)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "gcloud/datastore/api.py", line 257, in put
        dataset_id = _require_dataset_id(dataset_id, entities[0].key)
    KeyError: 0

    PROPOSED FIX: Define __bool__ and __nonzero__ on the class so that Entity objects are never False-y.

  3. dhermes
    added
    api: datastoreIssues related to the Datastore API.
    on Feb 18, 2015
  4. dhermes
    modified the milestone: This milestone has been deleted on Feb 18, 2015
  5. jgeewax
    removed
    cla: yesThis human has signed the Contributor License Agreement.
    on Feb 24, 2015
  6. tseaver commented on Feb 24, 2015

    @tseaver
    tseaver
    on Feb 24, 2015
    Contributor
    More actions

    Changing __bool__ / __nonzero__ would break the "dict-ness" of Entity. #677 adds a guard for that case, raising a ValueError.

  7. dhermes commented on Feb 24, 2015

    @dhermes
    dhermes
    on Feb 24, 2015
    Contributor
    More actions

    Yeah that occurred to me after writing. Fix looks good.

  8. tseaver
    closed this as completedin #677on Feb 25, 2015
  9. tseaver
    added a commit that references this issue on Feb 25, 2015

    Merge pull request #677 from tseaver/649-raise-on-single-entity-passe…

    277ba80
  10. JustinBeckwith
    assigned
    tseaver
    on Feb 1, 2021
  11. vchudnov-g
    added a commit that references this issue on Sep 20, 2023

    chore: Update gapic-generator-python to v1.11.2 (#649)

    78d1114
  12. parthea
    added 8 commits that reference this issue on Nov 24, 2025

    chore: release 0.35.0 (#649)

    8e5e109

    chore: move retry async check to wrap time (#649)

    a6056b6

    chore(revert): Revert "chore: move retry async check to wrap time (#649…

    6819fb4

    fix: Fix typehint on AsyncDocumentReference.get() (#649)

    562b330

    feat: set partial_success to default to true for batched logs (#649)

    610ff78

    feat: don't flush entire global cache on transient errors (#654)

    afa4fdb

    feat: set partial_success to default to true for batched logs (#649)

    cd50b2e

    chore: add constraints file (#649)

    d278216
  13. parthea
    added 5 commits that reference this issue on Mar 6, 2026

    chore: release 2.16.0 (#649)

    08ee023

    fix: correct import path (#649)

    f5ae316

    chore(deps): update dependency packaging to v25 (#649)

    2712a03

    chore(deps): update dependency google-cloud-pubsub to v2.9.0 (#649)

    543d9c8

    chore(deps): update dependency google-cloud-spanner to v3.12.0 (#649)

    16504cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @tseaver
    tseaver

Labels

api: datastoreIssues related to the Datastore API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.