[sqlalchemy] Getting a join in one object

2009-11-21 Thread Jeff Cook
Hi all. I want to get a join in one object. I have ret = db.query(a, b).select_from(orm.join(a, b, a.a == b.a)).all() and that returns a tuple with an a object in [0] and a b object in [1]. I want to have SA return the object directly, and I want that object to include the joined fields, so that I

[sqlalchemy] more than one "one to many" relation

2009-11-21 Thread laurent FRANCOIS
Hello, What is the pattern for more than one relation "one to many". I have on parent with 2 childs. parent_table = Table('parent', metadata, Column('parent_id', Integer, primary_key=True) ) child1_table = Table('child1', metadata,

Re: [sqlalchemy] Re: Subquery questions

2009-11-21 Thread Michael Bayer
On Nov 21, 2009, at 1:19 PM, Michael Bayer wrote: > > Here is entirely idiomatic SQLAlchemy code which approximates the types of > constructs your code snippets below are using - it places both the Query > object into a NOT IN, as well as the select() construct generated by > Query.subquery()

Re: [sqlalchemy] Re: Subquery questions

2009-11-21 Thread Michael Bayer
On Nov 21, 2009, at 12:30 PM, jcm wrote: > Thanks. But there's still a problem preventing me from actually using > this. And it's the inability for sqlalchemy to insert correct > parentheses in the subquery it generates (which has come up here > before). I'm not aware of any mailing list message

[sqlalchemy] Re: Subquery questions

2009-11-21 Thread jcm
On Nov 11, 10:22 am, "Michael Bayer" wrote: > > On Tue, Nov 10, 2009 at 9:55 PM, jcm wrote: > > >> Folks, > > >> I could do with some decent docs on subqueries. I've tried to play > > since you got some help here, I'll also note that I was surprised I didn't > have "NOT IN" in the docs so I added

Re: [sqlalchemy] Weird error with update

2009-11-21 Thread Mariano Mara
Excerpts from Mike Conley's message of Sat Nov 21 03:36:07 -0300 2009: > On Fri, Nov 20, 2009 at 5:14 PM, Mariano Mara wrote: > > > ... or, at least, is weird for me :) > > Hi everyone. I'm running a pylons controller > > with the following instruction: > > > >meta.Session.query(ESMagicNum

Re: [sqlalchemy] Re: Something wrong with pool. Got "Connection is already closed None None" with copy_from and big file.

2009-11-21 Thread Michael Bayer
On Nov 21, 2009, at 8:51 AM, sector119 wrote: > > > On Nov 4, 7:13 pm, "Michael Bayer" wrote: >> copy_from() probably creates some state that is not compatible with the >> connection being used afterwards for subsequent operations, or >> alternatively copy_from() is not compatible with some pr

Re: [sqlalchemy] Re: Something wrong with pool. Got "Connection is already closed None None" with copy_from and big file.

2009-11-21 Thread Michael Bayer
On Nov 21, 2009, at 8:51 AM, sector119 wrote: > > > On Nov 4, 7:13 pm, "Michael Bayer" wrote: >> copy_from() probably creates some state that is not compatible with the >> connection being used afterwards for subsequent operations, or >> alternatively copy_from() is not compatible with some pr

[sqlalchemy] Re: Something wrong with pool. Got "Connection is already closed None None" with copy_from and big file.

2009-11-21 Thread sector119
On Nov 4, 7:13 pm, "Michael Bayer" wrote: > copy_from() probably creates some state that is not compatible with the > connection being used afterwards for subsequent operations, or > alternatively copy_from() is not compatible with some previous state.   > The pool does nothing special to the co