[Twisted-Python] sample twistorm code?

Jamu Kakar jkakar at kakar.ca
Thu Mar 17 01:35:19 EDT 2011

Hi Jean-Daniel,

In the future, please ask Storm-related questions on the Storm mailing
list [1] or in #storm on Freenode.

On Wed, Mar 16, 2011 at 8:55 PM, Jean-Daniel
<jeandaniel.browne at gmail.com> wrote:
> I writing a script parsing a large log file and shoveling it into Postgresql.

For what it's worth, using live objects for a large number of inserts
will be much slower than running INSERT statements directly.  Unless
the import code you're writing would be really complex with
hand-written statements, you'll probably want to avoid live objects.

> 1. I would like to read some codes examples using the twisted + storm
> integration, any idea of where to look?

The Twisted Storm code is not, as far as I know, regularly maintained.
That said, I think there are some people using it successfully.  The
generally recommended way to use Storm with Twisted is to run all
database logic in a thread with deferToThread.  You need to ensure
that Storm objects are not used outside the thread in which they were

I don't know of any examples.

> Also. I was thinking about modeling a line of logs with a namedtuple,
> because it is handy to create one without having to write a long and
> dumb __init__ which take every constructor argument and one by one
> assign them to the instance member of the same name.
> 2. Is the namedtuple compatible with storm objects? Namedtuple members
> are properties and I am not sure it plays well with the storm
> machinery.

namedtuple's aren't compatible with Storm.  Storm requires
database-backed properties to be defined on a class using Storm
properties.  Storm classes must also define a __storm_table__ class


[1] https://lists.canonical.com/mailman/listinfo/storm

More information about the Twisted-Python mailing list