[sqlalchemy] Re: Context based execution

2011-04-14 Thread bool
Thanks Michael Trier. Michael Bayer, Can you help me with the other two questions I asked ? -- 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,

[sqlalchemy] Create a one-to-many relationship using association object with two foreign key primary keys

2011-04-14 Thread frankentux
I have packages and repos. A package can be in many different repos and a repo has many packages. I want to have an additional relationship to capture the 'status' of a particular package in a particular repo. This would be a many-to-many relationship with an additional field, so I guess I have to

RE: [sqlalchemy] Create a one-to-many relationship using association object with two foreign key primary keys

2011-04-14 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalchemy@googlegroups.com] On Behalf Of frankentux Sent: 14 April 2011 14:42 To: sqlalchemy Subject: [sqlalchemy] Create a one-to-many relationship using association object with two foreign key primary keys I have

[sqlalchemy] Re: Create a one-to-many relationship using association object with two foreign key primary keys

2011-04-14 Thread GHZ
Looks like you need to specify a composite ForeignKey http://www.sqlalchemy.org/docs/core/schema.html?highlight=foreign_keys#sqlalchemy.schema.ForeignKeyConstraint comment_table = Table('comment',metadata, Column('id',Integer,primary_key=True), Column('package_id', Integer),

Re: [sqlalchemy] Re: Context based execution

2011-04-14 Thread Michael Bayer
On Apr 14, 2011, at 9:36 AM, bool wrote: Thanks Michael Trier. Michael Bayer, Can you help me with the other two questions I asked ? yes but I would note that lots of people on this list are capable of answering these questions. Am trying to slow my responses so that others can

Re: [sqlalchemy] ORM performance

2011-04-14 Thread Chung
Thanks Michael! Re: the heavy get() workload, that's a neat trick :-) Unfortunately for our workload, we don't really know which set of gets() are going to fire, and we can't fit the entire table into memory. I was curious about whether passing in fields instead of tables into Query and

Re: [sqlalchemy] ORM performance

2011-04-14 Thread Michael Bayer
On Apr 14, 2011, at 5:07 PM, Chung wrote: Thanks Michael! Re: the heavy get() workload, that's a neat trick :-) Unfortunately for our workload, we don't really know which set of gets() are going to fire, and we can't fit the entire table into memory. I was curious about whether

[sqlalchemy] using window functions in expressions

2011-04-14 Thread botz
Here's a quick example: the query form i'm aiming for is: select x - lag(x) over ( order by x ) from a; meta=MetaData() a = Table('a', meta, Column('x',Integer)) print select([ a.c.x , over( func.lag(a.c.x), order_by = a.c.x ) ] ) # no problem print select([ a.c.x - over(

Re: [sqlalchemy] using window functions in expressions

2011-04-14 Thread Michael Bayer
On Apr 14, 2011, at 10:51 PM, botz wrote: Here's a quick example: the query form i'm aiming for is: select x - lag(x) over ( order by x ) from a; meta=MetaData() a = Table('a', meta, Column('x',Integer)) print select([ a.c.x , over( func.lag(a.c.x), order_by = a.c.x ) ] ) # no

Re: [sqlalchemy] Re: multiple inheritance experiment

2011-04-14 Thread Michael Bayer
On Apr 13, 2011, at 5:52 AM, Lars wrote: Hi Michael, I am trying to figure out the two suggestions you did, and not getting very far. Some basic questions: - if A, B, C are mapped classes, can you do A.join(B, A.id == B.id).join(C, B.id == C.id).join( ? usually if you want to use

[sqlalchemy] Re: using window functions in expressions

2011-04-14 Thread botz
Great, thanks for the quick fix. Found another minor bug with the window functions, syntax should be ( partition by x order by y) not ( partition by x, order by y) ... at least for postgresql. On Apr 14, 8:51 pm, botz randa...@gmail.com wrote: Here's a quick example: the query form i'm