Hello Michael Thank you very much for your quick answer.
I did provide the file test-data.sql that generates data. Didn't you see it or maybe would you like something different next time? Thank you Le mercredi 31 juillet 2013 10:09:54 UTC+2, Etienne Rouxel a écrit : > > Hello > > Better than a long speech, here are two files (eagerloading1.py, > eagerloading2.py) which, I though, were supposed to do the same thing. > Indeed, the difference is that in the first file, the polymorphic_identity > is hard coded and in the second file, it is set dynamically afterward (like > explained in > http://stackoverflow.com/questions/15112340/how-can-i-set-polymorphic-identity-after-a-class-is-defined > ). > > > The result is that both files trigger the query to get all the taxa. > However, the second file also triggers a new query each time there is an > access to the referenced_taxon, which is supposed to be loaded already > and of course, that query in a loop ruins the performances. > > > So my question is, how can set the polymorphic_identity dynamically and > still avoid the new queries in the loop? > > > I also provided some the SLQ commands to quickly reproduce the results > (test-data.sql). > > Tests have been performed with SQLAlchemy==0.8.2 > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/groups/opt_out.