[storm] Dynamically change __storm_table__ is it possible?

Steve Kieu msh.computing at gmail.com
Tue Apr 12 21:26:29 UTC 2011


Hi,

Thanks for replying, I have thought about subclassing but how to do it
dynamically. The only one way I can think of is dynamically generate
python string contains the class definitions and then eval it to
return the class object.

Where is my python doc for eval-ing string :-)

Any other way better than this?

Cheers,




On Wed, Apr 13, 2011 at 6:48 AM, Gustavo Niemeyer
<gustavo.niemeyer at canonical.com> wrote:
>> I have tried to use setattr(AccessLog, '__storm_table__',
>> 'table-name')  which get rid of the error. However I can only set it
>> once. Reset it to another value will not work, it still pointing to
>> the old one.
>
> Yes, as you have figured the attribute is cached for performance, so
> that kind of trick won't work indeed.
>
> What you can do, though, is have multiple subclasses and define custom
> tables for them.
>
> --
> Gustavo Niemeyer
> http://niemeyer.net
> http://niemeyer.net/blog
> http://niemeyer.net/twitter
>



-- 
Steve Kieu



More information about the storm mailing list