Hi,

I work with sqlalchemy v 0.4 (not possible to migrate to new versions
quickly) and I try to improve my application's performance because I
have to play with big sets of data contained in two tables.

I have table A and table B with a one-to-many relation (table B
contain a foreign key to table A). A sqlalchemy relation is define
between the two tables and I can access B items associated to the
current row of A with .itemsB.

A pseudo-algorithm code of what I'm doing  :

for itemA in itemsA:
    for itemB in itemA.itemsB
        # Play with itemB

This work perfectly, however, each time I call itemA.itemsB, a new
request is done to the database and the performance are not good.

Knowing the set of primary key of table A I'm interested in, is there
anyway to preload table B data in memory to avoid to request the
database each time I ask itemA.itemsB ?

Thanks in advance

PS: I know I can do it manually with dict out of sqlachemy framework
but this is not the goal.

Thibaud

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to