Comments (7)
I'm wondering what the use cases for this are. I have never wanted to interrogate any of this.
from transaction.
@jimfulton I have a Pyramid
application with a PostgreSQL backend. After an INSERT I am using transaction.savepoint()
to make sure that an IntegrityError is raised immediately. (Otherwise it would occur on the next implicit flush which does not help at all.)
transaction.savepoint()
sets the status of the transaction to COMMITFAILED
if there was an error.
I catch the IntegrityError and return (not raise!) a custom exception which the front end can handle and display.
pyramid_tm
does not check for the status of the transaction but does a transaction.commit()
which leads to a long and nested error message which cannot be displayed to the user. But it supports calling a function which can veto the commit (e. g. for 4xx and 5xx status codes.)
Thus I ended writing such a veto function which checks whether the status of the transaction is transaction._transaction.Status.COMMITFAILED
to force pyramind_tm
to abort the transaction.
Wow, this is complicated.
TL;DR: If the transaction in the status COMMITFAILED (which was set by a failed savepoint) I do not want to commit it at the end of the request as this would fail, too. I have to check the status and then abort it if needed.
from transaction.
from transaction.
from transaction.
from transaction.
from transaction.
Closing as suggested by myself.
from transaction.
Related Issues (20)
- 3.0.1: pytest warnings HOT 8
- 3.0.1: setuptools build_sphinx command fails HOT 11
- 3.0.1: transaction not sphinx 4.0.x ready? HOT 5
- Print the stack when a resource manager joins a transaction HOT 4
- Question: Nested transaction.manager HOT 2
- Add support for QA tooling? HOT 3
- 3.0.1: sphinx warnings `reference target not found` HOT 1
- Transactions with multiprocessing HOT 2
- Question: How to find a transaction’s data manager, if any? HOT 1
- No status to indicate aborted transaction. HOT 7
- Reach 100% coverage HOT 1
- DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working HOT 2
- 'ThreadTransactionManager' object has no attribute '_retryable' HOT 1
- Support abort hooks (symmetrically to commit hooks) HOT 1
- It's very easy to create reference cycles that require the GC to clean up HOT 9
- Docs: Confusion between resource and data managers HOT 1
- Still possible to join aborted and doomed transactions
- RTD integration broken HOT 2
- Remove legacy functionality from ITransactionDeprecated
- transaction 3.0 breaks afterCommitHooks HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from transaction.