[sqlalchemy] Re: Missing FROM clause on a one-to-many declarative_base mapping

2009-02-09 Thread Gloria W
I will put one together with a small database comprised of three tables. Give me a couple of days, and I will have it to you. Thank you, Gloria --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To po

[sqlalchemy] Re: Missing FROM clause on a one-to-many declarative_base mapping

2009-02-09 Thread Michael Bayer
I don't suppose a full example that reproduces the behavior by itself is possible here ? if your program does not modify any data, then no autoflush would occur. Gloria W wrote: > > Understood. In my constructor, I was using a shared global > declarative_base, and a single session instance: >

[sqlalchemy] Re: Missing FROM clause on a one-to-many declarative_base mapping

2009-02-09 Thread Gloria W
Understood. In my constructor, I was using a shared global declarative_base, and a single session instance: metdata = Base.metadata engine = create_engine(config.db_conn) engine.echo = False Session = sessionmaker(bind=engine) self.session = Session() Only the self.session vari

[sqlalchemy] Re: Missing FROM clause on a one-to-many declarative_base mapping

2009-02-09 Thread Michael Bayer
this has to do with the structure of your objects prior to the flush. the answer lies in the objects being constructed and added, as well as any connections created or broken between objects loaded into the current session. Gloria W wrote: > > Just a quick update: A forced flush between quer

[sqlalchemy] Re: Missing FROM clause on a one-to-many declarative_base mapping

2009-02-09 Thread Gloria W
Just a quick update: A forced flush between queries does no good. Creating a new instance for each query seems to be the only immediate cure. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post

[sqlalchemy] Re: Missing FROM clause on a one-to-many declarative_base mapping

2009-02-09 Thread Gloria W
Ahh, true. I switch the order of these operations, and always the second one fails, no matter what. How should I debug this problem? Thank you, Gloria --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group

[sqlalchemy] Re: Missing FROM clause on a one-to-many declarative_base mapping

2009-02-09 Thread Michael Bayer
this doesn't really say anything about the problem since neither of those things changes anything about the objects. the issue is related to the flush(). Gloria W wrote: > > I've traced it further, and it's an odd problem. > > This syntax works fine: > > memberProfile = self.session.qu

[sqlalchemy] Re: Missing FROM clause on a one-to-many declarative_base mapping

2009-02-09 Thread Gloria W
I've traced it further, and it's an odd problem. This syntax works fine: memberProfile = self.session.query(MemberProfile).filter (MemberProfile.memberID.in_(memberid)).order_by (MemberProfile.memberID) memberProfile = memberProfile.filter(MemberProfile.city == 'Jamaica')

[sqlalchemy] Re: Missing FROM clause on a one-to-many declarative_base mapping

2009-02-09 Thread Gloria W
I've traced it further, and it's an odd problem. This syntax works fine: memberProfile = self.session.query(MemberProfile).filter (MemberProfile.memberID.in_(memberid)).order_by (MemberProfile.memberID) memberProfile = memberProfile.filter(MemberProfile.city == 'Jamaica')

[sqlalchemy] Re: Missing FROM clause on a one-to-many declarative_base mapping

2009-02-05 Thread Michael Bayer
that's your flush() process flushing something pending in the session. say session.flush() to see it happen. the error means you've removed a child object from a parent, which would result in a primary key that is also a foreign key being nulled out. On Feb 5, 2009, at 8:51 PM, Gloria W

[sqlalchemy] Re: Missing FROM clause on a one-to-many declarative_base mapping

2009-02-05 Thread Gloria W
OK, a new problem on the same model: I try this in my unit test: memberProfile = self.session.query(MemberProfile).filter (MemberProfile.memberID.in_(memberid)).order_by (MemberProfile.memberID).filter(MemberProfile.city == 'Jamaica').all() and I get this error: Traceback (most recent call la

[sqlalchemy] Re: Missing FROM clause on a one-to-many declarative_base mapping

2009-02-05 Thread Gloria W
Wow, awesome, it works, thank you! ~G~ --~--~-~--~~~---~--~~ 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] Re: Missing FROM clause on a one-to-many declarative_base mapping

2009-02-05 Thread Michael Bayer
you're ordering the Member and Gender relation()s by a column in the parent table, which is producing the error.The order_by expression should be local to the Member or Gender entity. On Feb 5, 2009, at 11:54 AM, Gloria W wrote: > > Hi All, > I have three classes, all using the same decl