I think it shoud be done throught mapping against arbitrary select
( 
http://www.sqlalchemy.org/docs/04/documentation.html#advdatamapping_mapper_selects
).

Thanks.

On 7 дек, 13:23, Andrew Stromnov <[EMAIL PROTECTED]> wrote:
> How to implement this stat behaviour (RPG-like stats):
>
> players_table = Table('player',
>   Column('id', Integer, primary_key=True),
>   Column('name', String),
>   Column('level', Integer),
> )
>
> # SELECT 'level', count('level') as 'count' FROM player ORDER BY
> 'level' GROUP BY 'level'
> #
>
> class Stats(object): pass
>
> mapper(Stats, players_table, include_properties=['level'], properties
> = {
>   'count': column_property(  func.count('level).label('count') )
>
> })
>
> this fails with error...
>
> And where 'ORDER BY' and 'GROUP BY' must be placed?
--~--~---------~--~----~------------~-------~--~----~
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, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to