[storm] Dynamically change __storm_table__ is it possible?

Steve Kieu msh.computing at gmail.com
Wed Mar 30 05:09:41 UTC 2011


I guess I am out of luck then

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.

As it is class attribute <sigh>


On Wed, Mar 30, 2011 at 12:39 PM, Steve Kieu <msh.computing at gmail.com> wrote:
> Hello everyone,
>
> I got a situation that I would like to dynamically change the table
> that a class mapped to when I make the object in constructor.
>
> Example like this
>
> class AccessLog(Storm):
> # Instead of declaring here, move it to constructor as table name is dynamic
> # __storm_table__ = "data1"
>
>  def __init__(self, tabname): self.__storm_table__ = tabname
>
> but it does not work as when I assign value to other property and I got
>
> <class '__main__.AccessLog'>.__storm_table__ missing
>
> Many thanks
>
> Cheers
>
> --
> Steve Kieu
>



-- 
Steve Kieu



More information about the storm mailing list