Re: [sqlalchemy] Temporary mapped classes for testing

2012-06-26 Thread Michael Bayer
On Jun 26, 2012, at 7:59 AM, Iwan Vosloo wrote: > Hi there, > > When we test, we sometimes create temporary classes just for a specific test > (or group of tests). You might want to inherit from a class that is part of > production code, for example and override a method for testing purposes,

Re: [sqlalchemy] Creating a filtered relationship which excludes soft deleted records

2012-06-26 Thread Michael Bayer
relationship accepts a "primaryjoin" attribute for this purpose: http://docs.sqlalchemy.org/en/rel_0_7/orm/relationships.html#specifying-alternate-join-conditions On Jun 25, 2012, at 7:23 PM, Amos wrote: > I have a one-to-many relationship from parent to items. In my Parent class I > define th

Re: [sqlalchemy] MySQL's STRAIGHT_JOIN in SQLAlchemy?

2012-06-26 Thread Michael Bayer
you can build your own join construct using @compiles: # Core Level from sqlalchemy.sql.expression import Join from sqlalchemy.ext.compiler import compiles class StraightJoin(Join): pass @compiles(StraightJoin) def compile(element, compiler, **kw): return "%s STRAIGHT_JOIN %s ON %s" % (

[sqlalchemy] Temporary mapped classes for testing

2012-06-26 Thread Iwan Vosloo
Hi there, When we test, we sometimes create temporary classes just for a specific test (or group of tests). You might want to inherit from a class that is part of production code, for example and override a method for testing purposes, etc. When these temporary classes are declarative sqlalche