[sqlalchemy] sqlalchemy aggregation query

2011-06-10 Thread Jojo
hi guys, I'm new in sqlalchemy and I need some help. I want make a simple aggregation query for a game chart, so, I need max score for a player, player name and row number (for chart position) this is the query in t-sql (mssql): select row_number() over (order by max(score) desc), max(score),

[sqlalchemy] Help using SqlSoup with database views

2011-06-10 Thread Reece Hart
I'd like to use SqlSoup with an existing database that contains views. Accessing a table goes swimmingly, but accessing a view results in PKNotFoundError: table '[viewname]' does not have a primary key defined... Do I correctly infer that SqlSoup does not work with database views (by default, at

[sqlalchemy] Help using SqlSoup with database views

2011-06-10 Thread Reece Hart
I'd like to use SqlSoup with an existing database that contains views. Accessing a table goes swimmingly, but accessing a view results in PKNotFoundError: table '[viewname]' does not have a primary key defined... Do I correctly infer that SqlSoup does not work with database views (by default, at

[sqlalchemy] Declaring compound primary key on reflective model

2011-06-10 Thread Cody Django
Hi all -- I'm new on pylons, coming from a django background. I'm working on a mapfish project. I'd like to autoload a model based on a db table, but in doing so I get the error could not assemble any primary key columns for mapped table. The table itself is a postgres view with no declared

[sqlalchemy] Re: Declaring compound primary key on reflective model

2011-06-10 Thread Cody Django
A related query: reflecting two tables, and wanting to identity a one- to-one relation based on a mutual id field on the model class. Cody On Jun 10, 11:25 am, Cody Django codydja...@gmail.com wrote: Hi all -- I'm new on pylons, coming from a django background.  I'm working on a mapfish

Re: [sqlalchemy] Declaring compound primary key on reflective model

2011-06-10 Thread A.M.
On Jun 10, 2011, at 2:25 PM, Cody Django wrote: Hi all -- I'm new on pylons, coming from a django background. I'm working on a mapfish project. I'd like to autoload a model based on a db table, but in doing so I get the error could not assemble any primary key columns for mapped table.

[sqlalchemy] standard way of initializing an empty clause?

2011-06-10 Thread Darren Yin
I want to construct a clause by anding the previous clause with new clauses, and I was wondering if there was a standard way to initialize an empty clause. First, here's some code that illustrates the general idea of what I'm trying to do: clause = True if cond1: clause = and_(clause,

Re: [sqlalchemy] Help using SqlSoup with database views

2011-06-10 Thread Michael Bayer
On Jun 9, 2011, at 12:41 AM, Reece Hart wrote: I'd like to use SqlSoup with an existing database that contains views. Accessing a table goes swimmingly, but accessing a view results in PKNotFoundError: table '[viewname]' does not have a primary key defined... Do I correctly infer that

Re: [sqlalchemy] standard way of initializing an empty clause?

2011-06-10 Thread Michael Bayer
On Jun 10, 2011, at 6:15 PM, Darren Yin wrote: I want to construct a clause by anding the previous clause with new clauses, and I was wondering if there was a standard way to initialize an empty clause. First, here's some code that illustrates the general idea of what I'm trying to do: