FSX / momoko

Wraps (asynchronous) Psycopg2 for Tornado.
http://momoko.61924.nl/
Other
360 stars 73 forks source link

Momoko compatibility with Postgres transactions #26

Closed aleksj closed 12 years ago

aleksj commented 12 years ago

Psycopg2 interprets a single connection to be a transaction - see http://initd.org/psycopg/docs/usage.html#transactions-control

One nice way to solve this would be the QueryChain to reuse a single connection. This way, it's at least possible to do transactions.

A further extension would be a way to insert commands rather than just queries.

FSX commented 12 years ago

In asynchronous mode autocommit is enabled. That means each query is committed right after it finishes. In other words, the transaction end when a single query is finished. Even if the same connection is used.

You can manually use transactions with the BEGIN, COMMIT and ROLLBACK commands. This is being addressed in the rewrite of Momoko.

What do you mean with just insert commands instead of queries?

aleksj commented 12 years ago

Thanks! Is there a way to use the BEGIN/COMMIT/ROLLBACK with Momoko already? What's the ETA?

FSX commented 12 years ago

Look for transactions in the PostgreSQL documentation. They're just normal SQL commands. I'm planning to provide a nice API for it.

I don't have an ETA for the rewrite currently. Don't want to rush it.