[sqlalchemy] classes in separate files

2009-02-09 Thread camlost
Hi, could someone advice me, please, how to split classes into individual files? I'm studying the documentation: Creating Table, Class and Mapper All at Once Declaratively http://www.sqlalchemy.org/docs/05/ormtutorial.html#creating-table- class-and-mapper-all-at-once-declaratively. If I keep all

[sqlalchemy] Re: classes in separate files

2009-02-09 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of camlost Sent: 09 February 2009 09:18 To: sqlalchemy Subject: [sqlalchemy] classes in separate files Hi, could someone advice me, please, how to split classes into individual

[sqlalchemy] Re: classes in separate files

2009-02-09 Thread camlost
Yes, of course. This feature is provided by dbinit.py (mentioned at the bottom of the orig. message). c. On 9 Ún, 10:42, King Simon-NFHD78 simon.k...@motorola.com wrote: Are all your classes using the same declarative_base? I think this is necessary so that the tables use the same metadata

[sqlalchemy] declarative base and association object

2009-02-09 Thread vctr...@gmail.com
Hi, I would like to use an association object with two tables derived from two declarative base classes. What would be (if one may say) the right way to access (get and set) the additional values in the association object? When I set the 2 entities from the base classes and associate them I get

[sqlalchemy] Re: classes in separate files

2009-02-09 Thread MikeCo
Here is an example of how we are doing it. http://dpaste.com/hold/118525 separate the big paste into files as indicated by the comments and you should be able to run it. One key is that you need to import the user class into the address.py -- Mike

[sqlalchemy] Re: classes in separate files

2009-02-09 Thread Jiri Novak
Thank you both for the answers. Actually, I've just found a mistake in one of the files - there was a line: Base = declarative_base() :-/ It was left there from the previously all-in-one file version. Best regards c. 2009/2/9 MikeCo mconl...@gmail.com Here is an example of how we are doing

[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-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 =

[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 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 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

[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

[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
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

[sqlalchemy] BUG: autoload for DateTime in SQL Server 2000 fails

2009-02-09 Thread Eric R. Palakovich Carr
When creating a Table object with the autoload parameter set to True, DateTime fields in SQL Server 2000 apepar to cause fatal errors in SQLAlchemy. In the reflecttable method in mssql.py, it pulls a numericprec and numericscale value for the DateTime column. It then stuffs these two values

[sqlalchemy] Re: BUG: autoload for DateTime in SQL Server 2000 fails

2009-02-09 Thread Michael Bayer
On Feb 9, 2009, at 5:41 PM, Eric R. Palakovich Carr wrote: Is this a real bug or am I doing something wrong? there is ! you're reporting a bug against an 0.5 version prior to the current 0.5 release (I know this since you're referencing a line of code only present in prior versions of

[sqlalchemy] Re: BUG: autoload for DateTime in SQL Server 2000 fails

2009-02-09 Thread Michael Trier
On Mon, Feb 9, 2009 at 7:56 PM, Michael Bayer mike...@zzzcomputing.comwrote: On Feb 9, 2009, at 5:41 PM, Eric R. Palakovich Carr wrote: Is this a real bug or am I doing something wrong? there is ! you're reporting a bug against an 0.5 version prior to the current 0.5 release (I