[Twisted-Python] recommended twisted database coding
mithrandi-twisted-python at mithrandi.za.net
Thu Jun 8 08:13:35 EDT 2006
* Thomas Vander Stichele <thomas at apestaart.org> [2006-06-08 12:05:22 +0200]:
> - Axiom seems like a nice Object layer with a database backend.
> However, the part I don't understand is that suddenly the description
> claims that Axiom is doing blocking SQLite calls, and that this isn't
> really a problem. Since Axiom is a Divmod project, I tend to trust
> their opinion when it comes to Twisted. But why is it suddenly OK to
> have blocking code being used ? Does this only apply to SQLite, or would
> it apply to any database being used ?
One thing that's "special" about SQLite is that in runs in-process, so
there are no network latency issues involved; like any other "blocking"
code, the idea is to only do small bits of work at a time. If you need
to run long queries, you would either break them up into smaller chunks,
or run them in a separate process/thread/whatever to avoid blocking the
> - how do persistent object systems typically deal with transactions ?
> Suppose you want to do three operations on three different objects as a
> transaction, is that possible at all ?
I'm only really familiar with Axiom, so I can't comment on SQLObject and
friends; in Axiom, the Store (which is the application-level object you
use to interact with the database) has a transact() method which you
invoke like store.transact(someFunc, arg1, arg2, ...). Within the
transaction, any object manipulations/queries/etc. you perform obviously
turn into SQL queries in the database layer, and these are run in an SQL
mithrandi, i Ainil en-Balandor, a faer Ambar
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: Digital signature
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20060608/7c9c8dc0/attachment.pgp
More information about the Twisted-Python