Hi,
I need to safely increase a numeric value via SQLAlchemy:
I have a table that has a column with numeric data. For increasing the value, 
I need to read the data, add some value and store it, so it would look like 
that:

- select myvalue from mytable
- myvalue += 123
- update mytable and set myvalue to 123

However, problems arise when two of this operations are done simultaneously, 
e.g. operation A and B:

A - select
B - select
A - increase
B - increase
A - update
B - update

In this case, operation A is overwritten by B.

One viable solution would be to make the operation atomic, by e.g. locking the 
database row. Is this possible with SQLAlchemy? If yes, how?

Or is there a better way?

Best Regards,
Hermann

-- 
[EMAIL PROTECTED]
GPG key ID: 299893C7 (on keyservers)
FP: 0124 2584 8809 EF2A DBF9  4902 64B4 D16B 2998 93C7

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to