[storm] Meta data

Gerdus van Zyl gerdusvanzyl at gmail.com
Tue Jul 8 21:52:33 BST 2008


I am trying to store all database column information in the storm
column object. Eg. size of varchar columns, decimal precision, is this
column included in an index, default value in database, etc.

Note that i use the existing _variable_kwargs dictionary of Property
class, the code i posted was just so that storm doesn't throw an
exception on creating the variable class because of an unknown keyword
argument. (so self._extrakwargs = otherkwargs in my posted code can be
removed, it's not necessary, just the **otherkwargs)

~G

On Tue, Jul 8, 2008 at 10:37 PM, James Henstridge <james at jamesh.id.au> wrote:
> On Tue, Jul 8, 2008 at 6:47 PM, Gerdus van Zyl <gerdusvanzyl at gmail.com> wrote:
>> Hi,
>>
>> I would like to propose the following small change to the Variable class:
>> def __init__(self, value=Undef, value_factory=Undef, from_db=False,
>>                 allow_none=True, column=None, event=None,**otherkwargs):
>>
>> .....
>>        self._extrakwargs = otherkwargs
>>
>> This allows arbitrary keyword arguments like:
>> creditlimit = Decimal(precision=(12,2))
>> that can be accessed using:
>> p = (one of self._storm_columns)
>> p._variable_kwargs['precision']
>>
>> This is ultra handy for associating meta data specific to a database column.
>> Currently Variable is throwing a hissy fit (exception) when you try to do this.
>
> Note that Storm creates a lot of variable objects (one per column per
> instance, and a number get created as part of the expression parsing),
> so I don't know if you'd want to be storing things like this.  In the
> current trunk version we've been using __slots__ to try and slim down
> the class.
>
> What exactly do you want to do?
>
> James.
>



More information about the storm mailing list