The method that works 95% of the time is, just establish a connection to the
database, start a transaction, do some work that stays within the thread,
commit the transaction. Then throw all loaded state in that thread away, and
reload it all on the next transaction.
....
Its only if you expect to have many concurrent threads/processes all contending
for the same row in a table, or if you have to insert a row which other
threads/processes might be trying to insert at exactly the same time that you
have to consider different outcomes. And even then, you still don't have to
really "do" anything except have proper constraints on your tables - PG will
ensure that invalid data doesn't enter the DB.
Thanks for the reply. You brought up two topics I am curious about. Maybe you
can give me a little more details, so I know what to search for to find more
information on these topics?
> throw all loaded state in that thread away, and reload it all on the next
> transaction.
>have proper constraints on your tables - PG will ensure that invalid data
>doesn't enter the DB.
Where can I learn more about these topics and how they relate to threading
issues? What should I be searching for to learn about these?
Also, any suggestions on something that specifically describes how these
threading db issues work as a whole (from basic to advanced so I can be sure my
usage is going to be thread safe and won't fail because I happened to use one
of the few weird ways that can really mess things up).
_________________________________________________________________
Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.
http://clk.atdmt.com/GBL/go/171222985/direct/01/
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
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.