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
Юрий Пайков 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
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
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
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
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
Юрий Пайков 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