Hi,

You won't be able to get() multiple objects at the same time.
query(SomeClass).get(pk1, pk2, pk3)  takes in a tuple of values
representing the primary key of some record in your table.  In this
case the primary key consists of three separate columns (thus a
composite key), though the record they identify will always be unique
within your table.  That's sort of the point of it being a primary
key.  Read the docs for an explanation of what parameters get()
expects.

Of course you could use filter() and get the same result.  I'm not
sure but I guess the actual SQL executed by SA should look exactly the
same, set echo to True and have a look.

The difference being of course that you can use filter to return more
then one record.

I'm not sure how get() works on databases that don't need primary
keys.  I'm guessing it won't.  Maybe it's in the docs.

Hope that cleared things up.

Regards,
Christian



2009/3/23 Dan F <danielfal...@gmail.com>:
>
> Hi,
>
> Is there a difference between using query.get(ident) and using
> query.filter(MyClass.id.in_())?  Specifically with regard to how the
> mapper is used?  If I'm right in my assumption, get() uses the map to
> avoid extra lookups, but I question whether the filter method is doing
> the same.  If I'm correct, shouldn't there be a way to get() multiple
> objects at the same time?
>
> Thanks.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to