[sqlalchemy] Re: associative table with extra field

2007-10-28 Thread mmstud
That made difference, i think i got it working. I made a little example for study purposes. From test part you see i can fetch meaningful information with Country, CountryLanguage and Language objects. Country has many CountryLanguages (having Language object and is_primary field),

[sqlalchemy] Separate version table

2007-10-28 Thread mmstud
Next design problem for me is version table. I have Document model with DocumentVersion model, but i dont know how to: - get the latest version of document - set creator and updator, automatic behavior for this - update version number - fetch thru Document(s) and DocumentVersion(s) Lets see the

[sqlalchemy] Re: Separate version table

2007-10-28 Thread Arnar Birgisson
Hi there, On 10/28/07, mmstud [EMAIL PROTECTED] wrote: Next design problem for me is version table. I have Document model with DocumentVersion model, but i dont know how to: - get the latest version of document - set creator and updator, automatic behavior for this - update version number

[sqlalchemy] 0.3 to 0.4 migration problem

2007-10-28 Thread Marcos Dione
hi all. I've been using sqlalchemy in one of may projects. I followed the steps in http://www.sqlalchemy.org/trac/wiki/WhatsNewIn04, but the I got this backtrace: Traceback (most recent call last): File ./kress.py, line 664, in ? main(sys.argv) File ./kress.py, line 658, in main

[sqlalchemy] Looking for feedback on encapsulating SA logic (newbie)

2007-10-28 Thread [EMAIL PROTECTED]
I just started experimenting with .4 last night, and I'm really jazzed. The tutorials have been helpful, but I'm struggling to figure out how to bridge the gap between the tutorial fragments and a real- world application. So far, I've got a little idea working, and I'm hoping to get some

[sqlalchemy] Re: 0.3 to 0.4 migration problem

2007-10-28 Thread Michael Bayer
On Oct 28, 2007, at 12:23 PM, Marcos Dione wrote: q= self.query.offset (index) if count is not None: q= q.limit (count) q= q.order_by (sqlalchemy.desc ('date')) q= q.filter (constraint) print self.query.compile () --- p= q.all

[sqlalchemy] Re: Separate version table

2007-10-28 Thread sdobrev
Next design problem for me is version table. I have Document model with DocumentVersion model, but i dont know how to: - get the latest version of document - set creator and updator, automatic behavior for this - update version number - fetch thru Document(s) and DocumentVersion(s) just

[sqlalchemy] post_processors error during 0.3.10 to 0.4 migration

2007-10-28 Thread Ron
I've been trying to migrate my code to to 0.4 and I'm getting stuck on this error. I haven't been able to narrow down what property of my schema or code triggers this, but I thought I'd ask the group in case there was an easy answer. Here Thing is a class that is mapped to a table with a single

[sqlalchemy] Re: Mapper bug involving select with labeled foreign key target and clause default?

2007-10-28 Thread Brian Beck
Thanks for the response Mike... comments below. On Oct 28, 12:52 am, Michael Bayer [EMAIL PROTECTED] wrote: On Oct 27, 2007, at 8:33 PM, Brian Beck wrote: without trying it yet the first thing that seems wrong is that your select has no join condition between a_table and b_table (nor are you

[sqlalchemy] Re: Separate version table

2007-10-28 Thread mmstud
Thanks there were some good ideas to try. Btw. what does the first def constructor(fun)? On 28 loka, 18:00, Arnar Birgisson [EMAIL PROTECTED] wrote: Hi there, On 10/28/07, mmstud [EMAIL PROTECTED] wrote: Next design problem for me is version table. I have Document model with

[sqlalchemy] Re: post_processors error during 0.3.10 to 0.4 migration

2007-10-28 Thread Michael Bayer
On Oct 28, 2007, at 3:39 PM, Ron wrote: I've been trying to migrate my code to to 0.4 and I'm getting stuck on this error. I haven't been able to narrow down what property of my schema or code triggers this, but I thought I'd ask the group in case there was an easy answer. Here Thing is

[sqlalchemy] Re: Mapper bug involving select with labeled foreign key target and clause default?

2007-10-28 Thread Michael Bayer
On Oct 28, 2007, at 4:32 PM, Brian Beck wrote: Pretend the Select is more complicated and needs to reference both IDs (which may have come from subqueries) -- in this case any mapper features (like synonym) don't help, the Select needs to exist first! the select can reference whatever

[sqlalchemy] Re: Separate version table

2007-10-28 Thread Arnar Birgisson
On 10/28/07, mmstud [EMAIL PROTECTED] wrote: Thanks there were some good ideas to try. Btw. what does the first def constructor(fun)? It is a decorator I use on mapped classes constructors. It allows me to give keyword arguments to constructors with initial values for any field in class.c

[sqlalchemy] Re: post_processors error during 0.3.10 to 0.4 migration (returning different object type based on db data)

2007-10-28 Thread Ron
Ok, I've figured out the problem but not really sure what the proper solution is. Basically, I have Thing objects that can have attributes associated with them. I have other classes that are subclasses of the Thing object. These classes can provide more specific functionality based on the type

[sqlalchemy] Re: post_processors error during 0.3.10 to 0.4 migration (returning different object type based on db data)

2007-10-28 Thread Michael Bayer
On Oct 28, 2007, at 6:58 PM, Ron wrote: Ok, I've figured out the problem but not really sure what the proper solution is. Basically, I have Thing objects that can have attributes associated with them. I have other classes that are subclasses of the Thing object. These classes can

[sqlalchemy] Re: post_processors error during 0.3.10 to 0.4 migration (returning different object type based on db data)

2007-10-28 Thread Ron
So, the code I posted is a much simplified version of what I'm trying to accomplish only used to illustrate the error I was getting. What I actually want to do is select the appropriate class based on any number of Attributes a Thing might have. I have a metaclass that is applied to Thing and