[sqlalchemy] Eager loading hates single table inheritance

2012-01-09 Thread Yuen Ho Wong
Here's a list of pathological test cases that confuses the hell out of SA while trying to eager load more than 1 collections which are mapped to the same table using single table inheritance. In short, only joinedload*() appears to work out of all the eager loading methods. This pretty much

Re: [sqlalchemy] Eager loading hates single table inheritance

2012-01-09 Thread Jimmy Yuen Ho Wong
On 10/1/12 12:19 AM, Michael Bayer wrote: A common theme in SQLAlchemy is that, despite all the flak we get for being complicated, SQLAlchemy is actually very simple. It has a handful of constructs which seek to do exactly the same thing in exactly the same way, as consistently as

Re: [sqlalchemy] Eager loading hates single table inheritance

2012-01-09 Thread Jimmy Yuen Ho Wong
Ah Thanks! A bit of a hack but certainly works for now. Thanks for helping out. Really appreciate it! Jimmy Yuen Ho Wong On 10/1/12 3:31 AM, Michael Bayer wrote: On Jan 9, 2012, at 11:19 AM, Michael Bayer wrote: The first thing I note here is, if I were doing a model like this, I'd either

[sqlalchemy] order_by with explicit column name messes up subqueryload

2012-01-08 Thread Yuen Ho Wong
Hi, I have a rather complicated problem and I was wondering if you guys could help. So I have a query, session.query(Product, Merchant, d), where Product is 1-to-many with Merchant, and d is the distance from some lat long. d is actually a sqlalchemy.sql.label() of some complicated GeoAlchemy

[sqlalchemy] Re: order_by with explicit column name messes up subqueryload

2012-01-08 Thread Yuen Ho Wong
BTW, aliased() and alias() don't work on a label() either. I tried passing the label object straight into the order_by() as well to no avail. I'm all out of ideas. On Jan 9, 3:47 am, Yuen Ho Wong wyue...@gmail.com wrote: Hi, I have a rather complicated problem and I was wondering if you guys

[sqlalchemy] Re: order_by with explicit column name messes up subqueryload

2012-01-08 Thread Yuen Ho Wong
: On Jan 8, 2012, at 2:47 PM, Yuen Ho Wong wrote: Hi, I have a rather complicated problem and I was wondering if you guys could help. So I have a query, session.query(Product, Merchant, d), where Product is 1-to-many with Merchant, and d is the distance from some lat long. d

[sqlalchemy] Re: order_by with explicit column name messes up subqueryload

2012-01-08 Thread Yuen Ho Wong
=CASCADE), nullable=False,) merchant = relationship(Merchant, uselist=False, backref=backref(products)) Hope this helps. On Jan 9, 4:16 am, Yuen Ho Wong wyue...@gmail.com wrote: Except that LIMIT and OFFSET are present in my query, gnarly

[sqlalchemy] oursql two phase commit syntax error

2011-06-06 Thread Yuen Ho Wong
I'm testing this on SQLAlchemy 0.7.1, oursql 0.9.2, MySQL 5.5.13 on Mac OS X 10.6.7 Here's my test script: from sqlalchemy import create_engine, Column, Integer, Unicode from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import scoped_session, sessionmaker Base =

[sqlalchemy] Re: oursql two phase commit syntax error

2011-06-06 Thread Yuen Ho Wong
Ah it seems that this bug only happens with sql-mode = ANSI set in my.cnf. This doesn't seem to be an issue with the mysql-python driver tho. On Jun 7, 2:57 am, Michael Bayer mike...@zzzcomputing.com wrote: On Jun 6, 2011, at 2:23 PM, Yuen Ho Wong wrote: I'm testing this on SQLAlchemy

[sqlalchemy] Re: oursql two phase commit syntax error

2011-06-06 Thread Yuen Ho Wong
Replace the double quotes around the %s with single quotes seems to have solved the problem with either default SQL MODE or ANSI_QUOTES set. Thanks for the helping! On Jun 7, 3:25 am, Yuen Ho Wong wyue...@gmail.com wrote: Ah it seems that this bug only happens with sql-mode = ANSI set

[sqlalchemy] How to get the instance back from a PropComparator?

2009-09-27 Thread Yuen Ho Wong
So I have this following code: class User(Base): class AgeComparator(PropComparator): def __lt__(self, other): pass def __gt__(self, other): pass def __eq__(self, other): pass def __ne__(self, other): return not (self == other)

[sqlalchemy] Re: How to get the instance back from a PropComparator?

2009-09-27 Thread Yuen Ho Wong
(), self.mapper.c.date_of_birth) / 365) def operate(self, op, *args, **kwargs): return op(self.__clause_element__(), *args, **kwargs) Thanks a lot! On Sep 27, 1:14 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Sep 27, 2009, at 12:49 PM, Yuen Ho Wong wrote: So I have this following code