Re: [sqlalchemy] Re: alchemy-migrate with DeclarativeBase

2010-07-10 Thread Michael Bayer
On Jul 10, 2010, at 1:08 AM, Steven Wei wrote: On Jun 17, 4:00 am, Francisco Souza franci...@franciscosouza.net wrote: But do I do this? Part of the problem is that I don't know of a way to generate tables other than create_all() (or drop_all()) when using declarative syntax. Is there

[sqlalchemy] RE:joining/aliasing problems

2010-07-10 Thread Daniel
I've managed to fix it using sqalchemy.orm.outerjoin in conjunction with query's select_from function. Out of interest, why is the naming scheme different for these 2 functions? Thanks, Daniel -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To

[sqlalchemy] unexpected query behaviour

2010-07-10 Thread Ste
Hello Group, I see the following behaviour which I can not explain (don't know sqlalchemy too well though): I have the following table setup (heavily simplified): class WikiPage(Base): __tablename__ = 'wiki_page' id = Column(Integer, primary_key=True) name = Column(Unicode(40))

[sqlalchemy] joining/aliasing problems

2010-07-10 Thread Daniel
Hi, I'm trying to translate this sql expression: (select max(id) as max_id from votes group by user_id, idea_id) as m left join votes on m.max_id=votes.id Into python code. So far I have: s = Session() q = s.query(sa.func.max_(Vote.id).label('max_id')).group_by(Vote.idea_id, Vote.user_id)

[sqlalchemy] Re: unexpected query behaviour

2010-07-10 Thread Michael Bayer
On Jul 10, 8:37 am, Ste stefan.aeschbac...@gmail.com wrote: Hello Group, I see the following behaviour which I can not explain (don't know sqlalchemy too well though): I have the following table setup (heavily simplified): class WikiPage(Base):     __tablename__ = 'wiki_page'     id =

Re: [sqlalchemy] joining/aliasing problems

2010-07-10 Thread Michael Bayer
On Jul 10, 2010, at 5:17 AM, Daniel wrote: Hi, I'm trying to translate this sql expression: (select max(id) as max_id from votes group by user_id, idea_id) as m left join votes on m.max_id=votes.id Into python code. So far I have: s = Session() q =

Re: [sqlalchemy] RE:joining/aliasing problems

2010-07-10 Thread Michael Bayer
On Jul 10, 2010, at 7:57 AM, Daniel wrote: I've managed to fix it using sqalchemy.orm.outerjoin in conjunction with query's select_from function. Out of interest, why is the naming scheme different for these 2 functions? which two names/functions are you referring to ? Thanks,

Re: [sqlalchemy] problems with multi-table mapping on IronPython

2010-07-10 Thread Harry Percival
OK, just in case anyone else is foolishly trying to run SQLA on ironpython, here's the workaround I've found: instead of attempting to use the mapper directly on the join: j = join(movies_table,md_table).join(directors_table) mapper(MoviesAndDirectors,j) #ipy errors here use a mapper on a

Re: [sqlalchemy] problems with multi-table mapping on IronPython

2010-07-10 Thread Michael Bayer
On Jul 10, 2010, at 12:07 PM, Harry Percival wrote: OK, just in case anyone else is foolishly trying to run SQLA on ironpython, here's the workaround I've found: instead of attempting to use the mapper directly on the join: j = join(movies_table,md_table).join(directors_table)