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

2012-05-01 Thread Ben Hayden
t=mysql.dialect()) > print > s.query(Foo).group_by(rollup(Foo.__table__.c.data)).statement.compile(dialect=mysql.dialect()) > > > > > On May 1, 2012, at 11:23 AM, Ben Hayden wrote: > > Is it possible to use the 'WITH ROLLUP' clause in SQLAlchemy? I'm havi

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

2012-05-01 Thread Ben Hayden
mary_key=True) > data = Column(Integer) > s = Session() > > from sqlalchemy.dialects import mysql > print > s.query(Foo).group_by(rollup(Foo.data)).statement.compile(dialect=mysql.dialect()) > print > s.query(Foo).group_by(rollup(Foo.__table__.c.data)).statement.compile

[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 ar

[sqlalchemy] Re: How to stop SQLAlchemy from adding an ON UPDATE clause to a TIMESTAMP column by default

2011-11-28 Thread Ben Hayden
Well - I don't know what's going on, but I did find a workaround (for me at least, your mileage may vary), I set server_default to this: *date_added = Column(u'dateAdded', TIMESTAMP(), server_default=text('CURRENT_TIMESTAMP'), nullable=False)* * * Which gives me: *CREATE TABLE foo (* * id CHAR(

[sqlalchemy] Re: How to stop SQLAlchemy from adding an ON UPDATE clause to a TIMESTAMP column by default

2011-11-28 Thread Ben Hayden
Hmm... well this is a weird problem then. I ran the provided code, and got the same result you did, with the DEFAULT & ON UPDATE missing. However, I added a couple lines: *from sqlalchemy.ext.declarative import declarative_base* *from sqlalchemy import Table, CHAR, TIMESTAMP, TEXT, schema, Colum

[sqlalchemy] How to stop SQLAlchemy from adding an ON UPDATE clause to a TIMESTAMP column by default

2011-11-28 Thread Ben Hayden
Say I have a model (running on MySQL): *class Foo(DeclarativeBase):* *__tablename__ = 'foo'* * * *#column definitions* *id = Column(u'id', CHAR(length=36), default=uuid, primary_key=True, nullable=False)* *date_added = Column(u'dateAdded', TIMESTAMP(), nullable=False)* *reason