[Twisted-Python] Twisted - SQLite and SQLObject

Can I used twisted with embedded databases such as SQLite? I would like to use SQLObject and SQLite in my twisted application. Thanks Mike

Minions of Mirth, our game, makes extensive use of SQLObject, SQLite, and Twisted: http://www.prairiegames.com/games.html -Josh Ritter Prairie Games ----- Original Message ----- From: "Michael Schneider" <michaelschneider@fuse.net> To: <twisted-python@twistedmatrix.com> Sent: Tuesday, October 25, 2005 11:27 AM Subject: [Twisted-Python] Twisted - SQLite and SQLObject

You can't use SQLObject because it's synchronous. (I love sqlobject too, it's rough). You can use adbapi with sqlite's adapter: http://twistedmatrix.com/projects/core/documentation/howto/enterprise.html There's also a "row" object that does some basic abstraction, but it's nothing like sqlobject. On 10/25/05, Michael Schneider <michaelschneider@fuse.net> wrote:

On Tue, 25 Oct 2005 12:27:18 -0400, Michael Schneider <michaelschneider@fuse.net> wrote:
Can I used twisted with embedded databases such as SQLite?
I would like to use SQLObject and SQLite in my twisted application.
Divmod has had much success with SQLite in Twisted applications. In particular, see http://divmod.org/projects/axiom

If you are going to use sqlite/sqlobject as an embedded db (as the original poster suggested) then you are probably better off just writing your own deferred wrapper for your sql ops. Treat your db access (at least your select/set/update ops on your SQLObject schema classes) as you would any other blocking operation; if your db is not huge you can probably be more productive by applying twisted to other parts of your application. Since you are using sqlite as an embedded db you are not going to get any benefit from the connection marshalling and threading that seems to be t.enterprise.adbapi's raison d'etre. Rather than digging into the adbapi docs or looking at axiom you would probably be better served by just building a wrapper around your db that returns deferred's for the various db CRUD operations. Jim

On 10/25/05, Jim McCoy <jim.mccoy@gmail.com> wrote:
I've been using an in-memory sqlite database with trivial amounts of data and actually have been treating it as non-blocking. You wouldn't defer moving around python data structures, and in my experience, for a small in-memory sqlite database, you get better performance using it synchronously inline.

Minions of Mirth, our game, makes extensive use of SQLObject, SQLite, and Twisted: http://www.prairiegames.com/games.html -Josh Ritter Prairie Games ----- Original Message ----- From: "Michael Schneider" <michaelschneider@fuse.net> To: <twisted-python@twistedmatrix.com> Sent: Tuesday, October 25, 2005 11:27 AM Subject: [Twisted-Python] Twisted - SQLite and SQLObject

You can't use SQLObject because it's synchronous. (I love sqlobject too, it's rough). You can use adbapi with sqlite's adapter: http://twistedmatrix.com/projects/core/documentation/howto/enterprise.html There's also a "row" object that does some basic abstraction, but it's nothing like sqlobject. On 10/25/05, Michael Schneider <michaelschneider@fuse.net> wrote:

On Tue, 25 Oct 2005 12:27:18 -0400, Michael Schneider <michaelschneider@fuse.net> wrote:
Can I used twisted with embedded databases such as SQLite?
I would like to use SQLObject and SQLite in my twisted application.
Divmod has had much success with SQLite in Twisted applications. In particular, see http://divmod.org/projects/axiom

If you are going to use sqlite/sqlobject as an embedded db (as the original poster suggested) then you are probably better off just writing your own deferred wrapper for your sql ops. Treat your db access (at least your select/set/update ops on your SQLObject schema classes) as you would any other blocking operation; if your db is not huge you can probably be more productive by applying twisted to other parts of your application. Since you are using sqlite as an embedded db you are not going to get any benefit from the connection marshalling and threading that seems to be t.enterprise.adbapi's raison d'etre. Rather than digging into the adbapi docs or looking at axiom you would probably be better served by just building a wrapper around your db that returns deferred's for the various db CRUD operations. Jim

On 10/25/05, Jim McCoy <jim.mccoy@gmail.com> wrote:
I've been using an in-memory sqlite database with trivial amounts of data and actually have been treating it as non-blocking. You wouldn't defer moving around python data structures, and in my experience, for a small in-memory sqlite database, you get better performance using it synchronously inline.
participants (5)
-
Jean-Paul Calderone
-
Jim McCoy
-
Josh Ritter
-
Ken Kinder
-
Michael Schneider