[storm] Query questions and misc. comments
Gustavo Niemeyer
gustavo at niemeyer.net
Tue Dec 11 22:19:13 GMT 2007
Hey guys,
> 1) study the source files (obviously ;)
> 2) turn on debugging, since you'll see the sql query that storm
> expands from your code:
>
> import storm.database
> storm.database.DEBUG = True
And probably
3) Bother the insensible people who wrote it to write more documentation.
4) Contribute some documentation to the manual.
> IN:
> from storm.expr import In
> store.find(klass, In(klass.id, [1,2,3,10,11,12]))
That's more easily written as
Class.id.is_in([1,2,3])
> AND/OR:
> from storm.expr import And, Or
> expr1 = And(klass.col == 2, klass.disabled == False)
> store.find(klass, Or(klass.sticky, expr1))
This also works as
(Class.col == 2) & (Class.disabled == False)
It may bite sometimes because the precedence rules are inverted
(taking off the parenthesis will produce unexpected results), so
your suggestion may be preferred.
>> 3. How - if at all - does Storm handle VIEWs? I'd really like to
>> hide away some of the complex queries, but I'd prefer not to
>> give up using Storm-objects.
>
> I don't know anything about this.
I believe you can pretty much put a view where a table name is
expected and have it working. The normal rules for updating views
apply.
> Hope this helps,
Thanks a lot for these explanations, Håvard.
--
Gustavo Niemeyer
http://niemeyer.net
More information about the storm
mailing list