[storm] Truncating a table

Paul Hummer paul.hummer at canonical.com
Tue Dec 9 17:52:58 GMT 2008


>> I have a need to basically clear out all the records from a table.  I could
>> probably use store.execute, but the reason I'm using an ORM in the first place
>> is to avoid writing SQL.  So I have the following code:
>>     
>
> Storm was never designed with the assumption that you'd *never* have
> to write SQL.  It makes it so that you mostly don't have to.  I
> would use store.execute in this situation, mostly for performance
> reasons.  The example code you've provided will perform very poorly
> when you have a lot of rows to delete.
>
>   


Yea, and eventually I'll be executing the SQL itself as an optimization,
but if I can avoid it on proof of concept code, I'd rather do that.  The
issue was more about how to find out what locked the database and why.

For those of you following along at home, adding the database.DEBUG =
True allowed me to see what was going on.  I had been using an extra
store on the same database to make assertions from a unittest, and
neglected to remember to call store.rollback() after doing the selects, etc.

Cheers,
Paul



More information about the storm mailing list