[storm] get_select_expr
Nachiketa Mishra
nmishra at uab.edu
Wed Nov 10 14:57:51 GMT 2010
That definitely works. I will go ahead and pull the branch. How do you want
to structure the documentation ?
On Wed, Nov 10, 2010 at 8:32 AM, Jamu Kakar <jkakar at kakar.ca> wrote:
> Hi Nachiketa,
>
> (Please use 'Reply all' to make sure the list is included when you
> respond to messages)
>
> Great, glad to hear it! We'd would *love* help with documentation,
> it's a real sore spot for the project. I've started a branch:
>
> lp:~jkakar/storm/documentation
>
> With some very basic beginning work at putting a manual in place.
> Maybe we can work together to develop and outline for it and then
> start to fill in sections?
>
> Thanks,
> J.
>
> On Wed, Nov 10, 2010 at 3:22 PM, Nachiketa Mishra <nmishra at uab.edu> wrote:
> > This is great.
> > Thanks a lot. This worked perfectly. As I love storm, can I help in
> > documentation ?
> > Nachiketa
> >
> > On Wed, Nov 10, 2010 at 8:02 AM, Jamu Kakar <jkakar at kakar.ca> wrote:
> >>
> >> Hi Nachiketa,
> >>
> >> On Wed, Nov 10, 2010 at 2:57 PM, Nachiketa Mishra <nmishra at uab.edu>
> wrote:
> >> > I have a type table with name, category_name and description and some
> >> > audit
> >> > columns. With Storm I am trying to just get these three columns. I am
> >> > new to
> >> > Storm and I am not able to figure out from the get_select_expr api
> >> > documentation, how to just fetch these three columns.
> >>
> >> Unless you want to perform a subselect, you don't need to use
> >> get_select_expr. Given a class:
> >>
> >> class Thing(Storm):
> >>
> >> __storm_table__ = "thing"
> >>
> >> id = Int(primary=True)
> >> name = Unicode()
> >> category_name = Unicode()
> >> description = Unicode()
> >> audit_stuff = Unicode()
> >>
> >> You can get just the columns you want with:
> >>
> >> result = store.find(Thing)
> >> result = result.values(Thing.name, Thing.category_name,
> Thing.description)
> >> for name, category_name, description in result:
> >> print name, category_name, description
> >>
> >> The ResultSet.values method is handy when you have a result set that
> >> would normally yield objects, but for which you only want columns. If
> >> you know you'll only ever want columns from the result set you can
> >> specify them in the call to find:
> >>
> >> result = store.find((Thing.name, Thing.category_name,
> Thing.description))
> >> for name, category_name, description in result:
> >> print name, category_name, description
> >>
> >> I hope this helps!
> >>
> >> Thanks,
> >> J.
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/storm/attachments/20101110/49a54ce8/attachment.htm
More information about the storm
mailing list