Re: [sqlalchemy] Re: subqueryload with multiple joined table inheritance hierarchies

2016-08-12 Thread Mike Bayer
On 08/12/2016 05:07 PM, Douglas Russell wrote: Sorry to return again so soon, but I think I have uncovered a bug in the subqueryload. Continuing my example above. I had some with_polymorphic subqueries, followed by a non-polymorphic subquery. | r = session.query( B ).options( subquery

Re: [sqlalchemy] Updates with GROUP BY and subquery

2016-08-12 Thread Rahul Ahuja
Got it, thanks! One last question if you have the time: for some reason it's looking at the wrong schema when parsing my UDF func.non_conflict_middlename in the update statement, despite parsing fine in the base query and subquery. I suspect that this is because my first table in the update sta

Re: [sqlalchemy] Updates with GROUP BY and subquery

2016-08-12 Thread Rahul Ahuja
Got it, thanks! One last question if you have the time: for some reason it's looking at the wrong schema when parsing my UDF func.non_conflict_middlename in the update statement, despite parsing fine in the base query and subquery. I suspect that this is because my first table in the update sta

Re: [sqlalchemy] Updates with GROUP BY and subquery

2016-08-12 Thread Rahul Ahuja
Got it, thanks! One last question if you have the time: for some reason it's looking at the wrong schema when parsing my UDF func.non_conflict_middlename in the update statement, despite parsing fine in the base query and subquery. I suspect that this is because my first table in the update sta

Re: [sqlalchemy] Re: subqueryload with multiple joined table inheritance hierarchies

2016-08-12 Thread Douglas Russell
Sorry to return again so soon, but I think I have uncovered a bug in the subqueryload. Continuing my example above. I had some with_polymorphic subqueries, followed by a non-polymorphic subquery. r = session.query( B ).options( subqueryload( B.cs.of_type(c_c2) ).subqueryload

Re: [sqlalchemy] Updates with GROUP BY and subquery

2016-08-12 Thread Mike Bayer
it's a Core selectable so you need to use the .c. prefix - alias.c.columnname On 08/12/2016 02:03 PM, Rahul Ahuja wrote: Thank you so much for the reply! I'm almost there but am having trouble selecting the abms_biog.id column from my subquery - I'm getting an "AttributeError: 'Alias' object

Re: [sqlalchemy] Updates with GROUP BY and subquery

2016-08-12 Thread Rahul Ahuja
Thank you so much for the reply! I'm almost there but am having trouble selecting the abms_biog.id column from my subquery - I'm getting an "AttributeError: 'Alias' object has no attribute 'abms_biog'" when I try: u = update(abms_biog) u = u.prefix_with("ignore", dialect="mysql") q

Re: [sqlalchemy] Updates with GROUP BY and subquery

2016-08-12 Thread Mike Bayer
build an update out of abms_biog: stmt = update(abms_biog) use prefixes to get the "ignore" part: stmt = stmt.prefix_with("ignore", dialect="mysql") make sure your subquery is a Core selectable: subq = my_orm_query.subquery() add your subquery to the WHERE clause. e.g. the JOIN keyword won'

Re: [sqlalchemy] Querying a dict collection by key/value pair

2016-08-12 Thread Dominik George
Hi, Am Freitag, 12. August 2016 11:12:37 UTC+2 schrieb Dominik George: > > I would probably go with monkey-patching SQLAlchemy at runtime and I am > afraid Python would actually allow that. > > > Did it, and it actually works nicely: https://github.com/Natureshadow/OSMAlchemy/blob/master/osmalch

Re: [sqlalchemy] Querying a dict collection by key/value pair

2016-08-12 Thread Dominik George
Hi, >Unfortunately this is not supported right now and I've created >https://bitbucket.org/zzzeek/sqlalchemy/issues/3769/chained-any-has-with-association-proxy > >which includes a patch so that this can be provided in the future. OK, thank you! Can you give me a hint on how to work-around it fo