[storm] Questions about inserts

David Koblas koblas at extra.com
Thu Jun 12 17:06:35 BST 2008


I've got two issues, the first is that I have a column that is basically 
a random number.. But, I cant quite figure out how to get in inserted 
correctly, what I thought would work is something akin to the following 
code:

        inv = schema.Invite()
        inv.invite_id       = SQL("MD5(UUID())")
        inv.account_id   = acct.id
        inv.email            = unicode(toaddr)
   
        store.add(inv)

Of course, first I get an exception that 'invite_id' is not unicode 
(since it's defined as Unicode() column).   Of course a quick cast to 
unicode(...) yeilds nothing but trouble.  So, is there a way I can pass 
a SQL expression into an add(...) statement?

I'm finding it a bit tidious to constantly be casting from str(...) to 
unicode(...) to keep the database happy.  Is there really a best 
practice for how to have VARCHAR columns that are should be treated as 
RawStr() for purposes of development?

Thanks



More information about the storm mailing list