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 — Shouldn't gcloud.dataset.transaction.Transaction rollback on error exit from context manager? · Issue #136 · googleapis/google-cloud-python

Shouldn't gcloud.dataset.transaction.Transaction rollback on error exit from context manager? #136

New issue
Copy link
New issue
Copy link
Closed
Closed
Shouldn't gcloud.dataset.transaction.Transaction rollback on error exit from context manager?#136
Copy link
Assignees
tseaver
Labels
api: datastoreIssues related to the Datastore API.type: questionRequest for information or clarification. Not an issue.

Description

@tseaver
tseaver
opened on Sep 16, 2014
Issue body actions

If the application raises inside a 'with transaction:' block, the transaction should be rolled back, rather than blindlin committed.

Activity

Next
  1. tseaver
    changed the title [-]gcloud.dataset.transaction.Transaction should rollback on error exit from context manager[/-] [+]Shouldn't gcloud.dataset.transaction.Transaction rollback on error exit from context manager?[/+] on Sep 22, 2014
  2. tseaver
    added
    api: datastoreIssues related to the Datastore API.
    type: questionRequest for information or clarification. Not an issue.
    on Sep 22, 2014
  3. tseaver commented on Sep 22, 2014

    @tseaver
    tseaver
    on Sep 22, 2014
    ContributorAuthor
    More actions

    The Python docs for a context manager's __exit__() method [1] show that we could just test whether the exception type is non-None to determine whether we are in the midst of an exception. E.g.:

    def __exit__(self, exc_type, exc_val, exc_tb):
        if exc_type is not None:
            self. rollback()
        self.commit()
    

    I've marked this as a question, rather than a bug, as it violates my expectation of how a transactional context manager behaves (based on Zope's 'transaction'[2] package). However, I'm open to argument that an unconditional 'commit()' is somehow the Right Thing(TM).

    [1] https://docs.python.org/2/reference/datamodel.html#object.__exit__

    [2] http://zodb.readthedocs.org/en/latest/transactions.html#context-manager-support

  4. silvolu
    added this to the This milestone has been deleted milestone on Sep 24, 2014
  5. tseaver commented on Sep 24, 2014

    @tseaver
    tseaver
    on Sep 24, 2014
    ContributorAuthor
    More actions

    The docstring explicitly documents the existing behavior:

    https://github.com/GoogleCloudPlatform/gcloud-python/blob/b97ce739519c69dc98c2fcab4d52783defa43c62/gcloud/datastore/transaction.py#L35

  6. tseaver
    closed this as completedin e5ec0a1on Oct 2, 2014
  7. silvolu
    added a commit that references this issue on Oct 2, 2014

    Merge pull request #202 from tseaver/136-rollback_on_exception-redux

    This issue will close once commit 8a35a6b is merged into the 'main' branch.
    8a35a6b
  8. jgeewax
    modified the milestones: This milestone has been deleted, This milestone has been deleted on Jan 30, 2015
  9. dhermes
    added a commit that references this issue on Jun 9, 2017

    Merge pull request googleapis#136 from jgeewax/koss-collection-4

    e39f8fb
  10. urshala
    added a commit that references this issue on Jan 17, 2020

    Merge pull request googleapis#136 from O365/tests

    6636829
  11. JustinBeckwith
    assigned
    tseaver
    on Feb 1, 2021
  12. 81 remaining items

  13. parthea
    added 9 commits that reference this issue on Nov 24, 2025

    chore: fix kokoro config for samples (#136)

    b916466

    chore: release 1.10.0 (#136)

    d1a12bb

    chore: migrate default branch to main (#136)

    9cb331b

    fix: make HTTPDatastoreAPI compatible w/ microgen Gapic API (#136)

    31553e6

    chore: preserve gRPC-disabled systests during synth (#141)

    c1832d5

    chore(python): update release.sh to use keystore (#136)

    12ba5d0

    chore(main): release 0.9.0-alpha (#136)

    ea487be

    chore: new owl bot post processor docker image (#136)

    979507e

    Fix key property. (#136)

    d9d7a5f
  14. parthea
    added 5 commits that reference this issue on Mar 2, 2026

    docs: fix changelog header to consistent size (#136)

    c36dab2

    docs: update client_documentation link (#136)

    c537626

    django: add DatabaseOperations.date_trunc_sql() and datetime_trunc_sql()

    4689281

    docs: add instructions for using a Cloud Spanner emulator (#136)

    51a7ed5

    chore: relocate owl bot post processor (#136)

    9874bb5
  15. ohmayr
    added a commit that references this issue on Mar 31, 2026

    docs: fix changelog header to consistent size (#136)

    1fbe185
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: questionRequest for information or clarification. Not an issue.

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.