[sqlalchemy] Re: automating inheritance

2012-05-01 Thread lars van gemerden
Well thats the thing, my users will determine the data structure (graphically) and it is hard to predict what they will come up with. On the other hand, I am only building a prototype at the moment, so speed issues (if not easily solved) will have to wait. I'll stick with joined inheritance for

[sqlalchemy] Making an association proxy distinct

2012-05-01 Thread Benjamin Sims
Is there an obvious way to set up an association proxy so that it only returns distinct objects? For example, if I have: Post - Tag - Tag_Category and would like to access Post.Tag_Categories so that it contains each category only once. Any tips appreciated, sure I am missing something obvious

Re: [sqlalchemy] Re: automating inheritance

2012-05-01 Thread Michael Bayer
building SQLAlchemy apps graphically, that's extremely challenging good luck ! On May 1, 2012, at 5:19 AM, lars van gemerden wrote: Well thats the thing, my users will determine the data structure (graphically) and it is hard to predict what they will come up with. On the other hand, I am

Re: [sqlalchemy] Making an association proxy distinct

2012-05-01 Thread Michael Bayer
Since the uniqueness makes this kind of a read only thing, I'd use a plain @property: @property def unique_tags(self): return set(cat.tag for cat in self.tag_categories) On May 1, 2012, at 10:08 AM, Benjamin Sims wrote: Is there an obvious way to set up an association proxy so that it

[sqlalchemy] Saas deployment suggestions for SQLAlchemy?

2012-05-01 Thread Iain Duncan
Hey all, we've been using SQLAlchemy for about 5 years now, currently with Pyramid, but have not ever deployed to anything other than a standard vps for a one client install. We're now gearing up to make some of our products available as monthly subscriptions, and am looking for opinions and

[sqlalchemy] GROUP BY ... WITH ROLLUP

2012-05-01 Thread Ben Hayden
Is it possible to use the 'WITH ROLLUP' clause in SQLAlchemy? I'm having problems locating any examples on how to do so. Here's a link to MySQL (dialect I'm using) docs on the statement - http://dev.mysql.com/doc/refman/5.0/en/group-by-modifiers.html -- You received this message because you

Re: [sqlalchemy] GROUP BY ... WITH ROLLUP

2012-05-01 Thread Michael Bayer
this isn't built in right now, here's a recipe: from sqlalchemy.ext.compiler import compiles from sqlalchemy.sql.expression import ColumnElement, _clause_element_as_expr class rollup(ColumnElement): def __init__(self, element): self.element = _clause_element_as_expr(element)

Re: [sqlalchemy] GROUP BY ... WITH ROLLUP

2012-05-01 Thread Ben Hayden
Awesome, Thanks! On Tuesday, May 1, 2012 10:41:19 AM UTC-5, Michael Bayer wrote: this isn't built in right now, here's a recipe: from sqlalchemy.ext.compiler import compiles from sqlalchemy.sql.expression import ColumnElement, _clause_element_as_expr class rollup(ColumnElement): def

Re: [sqlalchemy] Making an association proxy distinct

2012-05-01 Thread Benjamin Sims
Thanks, works perfectly. On 1 May 2012 15:16, Michael Bayer mike...@zzzcomputing.com wrote: Since the uniqueness makes this kind of a read only thing, I'd use a plain @property: @property def unique_tags(self): return set(cat.tag for cat in self.tag_categories) On May 1, 2012, at

Re: [sqlalchemy] GROUP BY ... WITH ROLLUP

2012-05-01 Thread Ben Hayden
Here's a modification we made to ROLLUP so it would work with multiple columns: class rollup(ColumnElement): def __init__(self, *elements): self.elements = [_clause_element_as_expr(e) for e in elements] @compiles(rollup, mysql) def _mysql_rollup(element, compiler, **kw): return