On Apr 3, 2007, at 11:26 AM, Glauco wrote:
>
> Yes, but i lost generative methods filter_by
>
First of all, filter_by() has no interaction with instances(). with
instances(), no SQL is constructed by the Query object - it takes the
result set of whatever exact select() statement youve constructed and
thats it. its roughly equivalent functionality to hibernate's
session.createSQLQuery(). its used when you know the exact SQL you
want to issue and youd rather not have Query build the SQL for you.
so as far as getting columns in conjunction with filter_by(), we are
only talking about add_column() and add_entity().
so basically youre saying that this:
session.query(MyClass).filter_by(foo='bar').list()
will return instances of MyClass, while this:
session.query(MyClass).filter_by(foo='bar').add_column
('somecolumn').list()
will return a result set of "somecolumn". but *not* MyClass. thats
probably not what people expect.
the only way I can see this happening would be some new method:
session.query(MyClass).filter_by(foo='bar').remove_entity
(MyClass).add_column('somecolumn').list()
or perhaps:
session.query(MyClass).filter_by(foo='bar').set_column
('somecolumn').list()
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---