[sqlalchemy] Re: How does query.get() work?

2009-04-01 Thread Christiaan Putter
What I would do is simply iterate through the list of id's the user gives. Then use sess.query(SomeClass).get(id) to retrieve the required instance, apply changes if needed and loop to the next id. Then issue sess.commit() at the end. SA will take care of either updating things from the db,

[sqlalchemy] Re: How does query.get() work?

2009-03-31 Thread Dan F
It's not so much that I'm querying but that I get a set of id's from the user and I've got some logic that will often change some of the values. I wanted to take advantage of SA's orm capabilities as opposed to issuing selects and updates. It's possible in the logic that I already have some

[sqlalchemy] Re: How does query.get() work?

2009-03-25 Thread Dan F
I understand what get() is supposed to do, but it doesn't clear it up because it still seems like there should be a way of retrieving a *set* of records back from the database at once. I only see a couple choices currently. Either I can use filter() and retrieve every record in the set (even

[sqlalchemy] Re: How does query.get() work?

2009-03-24 Thread Christiaan Putter
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