[storm] Storm : Multiple fields request

Gerdus van Zyl gerdusvanzyl at gmail.com
Wed Nov 12 13:24:01 GMT 2008


Some code that I use to do the same thing:

cls = Employee
param = { 'age':30,'lastname':'smith' }

expressions = []
for k in param:
    v = param[k]
    if v == "none":
        v = None
    if hasattr(cls,k):
        expressions += [ getattr(cls,k) == v ]


sl = store.find(cls,And(*expressions))


~Gerdus

On Wed, Nov 12, 2008 at 2:06 PM, Adriano Teixeira
<adrfil.teixeira at gmail.com> wrote:
>
> I think you might want to try something like this (untested):
> list = [Class.ref="225654", Class.name="dfdfdf"] # And so on...
> result= store.find(Class, And(*list))
>
> Using this approach, you will add the necessary fields to 'list'
> (corresponding to the user request), so the find statement is always the
> same.
>
>
> Regards,
>
> Adriano Teixeira
> On Wed, Nov 12, 2008 at 11:33 AM, getdown balesh <blondin.boris at gmail.com>
> wrote:
>>
>> Hi,
>>
>> first, sorry for my bad english, I'm french.
>>
>> I will try to make a good explain of what I don't understand in Storm.
>>
>> I have to catch a storm class in a database according to multiples fields.
>> My problem is that the number of these fields can be various, it depends
>> to the program user choices.
>>
>> I have a string list containing the fields (and their values) I want to
>> make the request with.
>>
>> exemple:
>> list=[
>> "ref"="225654",
>> "name"="dfdfdf",
>> "surname"="mlolm",
>> ...
>> ]
>>
>> I can't do that:
>> result=store.find(Class, Class.ref="225654", Class.name="dfdfdf" ... )
>> because the fields number is unknown
>>
>> What I want to do :
>> result= store.find(Class, list)
>>
>> I didn't find the solution on https://storm.canonical.com/Tutorial, that's
>> why I'm asking you to.
>>
>> I hope I were clear.
>>
>> Thank you very much.
>>
>> --
>> storm mailing list
>> storm at lists.canonical.com
>> Modify settings or unsubscribe at:
>> https://lists.ubuntu.com/mailman/listinfo/storm
>>
>
>
>
> --
> storm mailing list
> storm at lists.canonical.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/storm
>
>



More information about the storm mailing list