Re: [sqlalchemy] Is it possible to populate relationship's collection with only query-filtered results using contains_eager()?

2015-02-01 Thread Юрий Пайков
Well, I added echo=True and saw the queries - no additional were made. Then I added populate_existing() and out of the blue I started to get the desired result, but frankly I don't quite understand why. What side-effects this could bring? суббота, 31 января 2015 г., 21:22:08 UTC+5

Re: [sqlalchemy] Is it possible to populate relationship's collection with only query-filtered results using contains_eager()?

2015-02-01 Thread Michael Bayer
Юрий Пайков dia...@cry5tal.in wrote: Well, I added echo=True and saw the queries - no additional were made. Then I added populate_existing() and out of the blue I started to get the desired result, but frankly I don't quite understand why. What side-effects this could bring? it

Re: [sqlalchemy] Is it possible to populate relationship's collection with only query-filtered results using contains_eager()?

2015-02-01 Thread Юрий Пайков
Thanks Michael for your attention! понедельник, 2 февраля 2015 г., 2:56:51 UTC+5 пользователь Michael Bayer написал: Юрий Пайков dia...@cry5tal.in javascript: wrote: Well, I added echo=True and saw the queries - no additional were made. Then I added populate_existing() and

[sqlalchemy] Is it possible to populate relationship's collection with only query-filtered results using contains_eager()?

2015-01-31 Thread Юрий Пайков
When I do a query like this result = session.query(A).\ join(A.bs).\ join(B.cs).\ filter_by(C.somedata.in_([4455, 4466])).\ options(contains_eager(A.bs).contains_eager(B.cs)).one() and list related C objects for b in result.bs: b.cs I get all related to B C objects instead of only those

Re: [sqlalchemy] Is it possible to populate relationship's collection with only query-filtered results using contains_eager()?

2015-01-31 Thread Michael Bayer
dia...@cry5tal.in wrote: Ok, I've only put one() here for an example. I saw the query, there is no LIMIT. And it selects only filtered results, as i wanted. But I' m still unsure if i get it right about how SQLalchemy treat contains_eager-does it load data for mentioned relationships

Re: [sqlalchemy] Is it possible to populate relationship's collection with only query-filtered results using contains_eager()?

2015-01-31 Thread diario
Ok, I've only put one() here for an example. I saw the query, there is no LIMIT. And it selects only filtered results, as i wanted. But I' m still unsure if i get it right about how SQLalchemy treat contains_eager-does it load data for mentioned relationships only from query which we declare

Re: [sqlalchemy] Is it possible to populate relationship's collection with only query-filtered results using contains_eager()?

2015-01-31 Thread Michael Bayer
Юрий Пайков dia...@cry5tal.in wrote: When I do a query like this result = session.query(A).\ join(A.bs).\ join(B.cs).\ filter_by(C.somedata.in_([4455, 4466])).\ options(contains_eager(A.bs).contains_eager(B.cs)).one() and list related C objects for b in result.bs: b.cs I