Transaction context manager patch
Bug #583656 reported by
Denis Malinovsky
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
PySQLPool |
Fix Released
|
Critical
|
Nikoleta Verbeck |
Bug Description
It's not a bug really, but proposal, with a patch.
As you know Python 2.5 introduced handy 'with' statement. It's ideal candidate for use with transactions, something like this:
q = PySQLPool.
with q: # internal queries are wrapped into transaction
I attached the patch, hope it'll be useful.
Changed in pysqlpool: | |
importance: | Undecided → Critical |
status: | New → In Progress |
assignee: | nobody → Nick Verbeck (nerdynick) |
milestone: | none → 0.3.6 |
Changed in pysqlpool: | |
status: | In Progress → Fix Committed |
Changed in pysqlpool: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
Your patch is applied and committed to the 0.3.6 Release. Which I'm hoping to release very soon. Just need to wrap up the documentation effort that is the main focus of the release.
I have to say, I never even gave the with statement a thought when it came to transactions. Not a bad idea. There is 1 bug in your implementation but this more relates to a bug I have with transactions in general when it comes to PySQLPool. The 0.4 release should fix the whole transaction model. Currently the problem is when you have multiple connections going out to 1 DB. There is nothing that locks a connection to 1 query object. So some other thread could end up getting into your transaction.