[sqlalchemy] Re: Adding few deferred properties from select()

2007-05-02 Thread askel
On May 2, 8:28 pm, Michael Bayer <[EMAIL PROTECTED]> wrote: > take a look at your SQL output with echo and make sure the queries > make sense. that it works with arbitrary columns as pk/fk could just > be due to particular data youre working with, but you definitely want > to pick a proper candi

[sqlalchemy] Re: Adding few deferred properties from select()

2007-05-02 Thread Michael Bayer
On May 2, 2007, at 7:56 PM, askel wrote: > > Michael, > > transaction.account_id is not a primary key of transactions table. I > added fields I use for grouping to primary_key. Then I had to add > foreign_key argument to 'summary' relation() call. And finally it all > worked as expected. > > How

[sqlalchemy] Re: Adding few deferred properties from select()

2007-05-02 Thread askel
Michael, transaction.account_id is not a primary key of transactions table. I added fields I use for grouping to primary_key. Then I had to add foreign_key argument to 'summary' relation() call. And finally it all worked as expected. However, I noticed that it doesn't actually matter which field

[sqlalchemy] Re: Adding few deferred properties from select()

2007-05-02 Thread Michael Bayer
On May 2, 2007, at 3:53 PM, askel wrote: > > Michael, > > Thank you for answering. The following is what I tried in order to > follow your advise: > > account_summaries = select( > [ > transactions.c.account_id, > func.max(transactions.c.processed_at).label('last_used'), > func.cou

[sqlalchemy] Re: Adding few deferred properties from select()

2007-05-02 Thread askel
Michael, Thank you for answering. The following is what I tried in order to follow your advise: account_summaries = select( [ transactions.c.account_id, func.max(transactions.c.processed_at).label('last_used'), func.count(transactions.c.id).label('times_used'), ], group_by=[tra

[sqlalchemy] Re: Adding few deferred properties from select()

2007-05-02 Thread Michael Bayer
On May 2, 2007, at 2:12 PM, askel wrote: > > Hello everyone! > > I'm trying to implement deferred property loading using select(): > > summaries = select( > [ > func.max(transactions.c.processed_at).label('last_used'), > func.count(transactions.c.id).label('times_used'), > ], > fro