[sqlalchemy] Joining with a subquery

2008-09-07 Thread Tony Cebzanov
I have a MySQL music database, and I wanted to display a graph of the top 10 artists played per hour in a given time period. The first query I tried was: select([func.DATE_FORMAT(Play.stime, '%Y/%m/%d').label('day'), func.COUNT(Play.id).label('playcount')], and_(Play.stime '2008/09/01',

[sqlalchemy] Re: Joining with a subquery

2008-09-07 Thread Michael Bayer
On Sep 7, 12:50 am, Tony Cebzanov [EMAIL PROTECTED] wrote: My interpretation of this error is that SQLAlchemy is having trouble joining the other tables with the results of the subquery.  So, I figured I'd provide an explicit join condition, but I don't know the right syntax to do it.  I

[sqlalchemy] weird OSX Leopard psycopg2 failed to import problem (and solution)

2008-09-07 Thread David Gardner
I fixed this problem for myself, but am posting this in case someone else runs into the same problem, and yeah I realize this is more of a psycopg2 issue. I was running into a problem where about 1/3 of the time my mac clients failed to import psycopg2, after a call to create_engine(). Which

[sqlalchemy] commit vs flush

2008-09-07 Thread sandro dentella
Hi, I'm trying to flush deletion of single objects w/o triggering a complete commit and even after reading the docs several time I think I have not got it right. In a little test I manage to do it correctly: I delete/ flush single objects and they are DELETEd from the table (at least

[sqlalchemy] Re: commit vs flush

2008-09-07 Thread Kyle Schaffrick
On Sun, 7 Sep 2008 15:31:56 -0700 (PDT) sandro dentella [EMAIL PROTECTED] wrote: Hi, I'm trying to flush deletion of single objects w/o triggering a complete commit and even after reading the docs several time I think I have not got it right. In a little test I manage to do it correctly: