this is what the output should look like, after all the INSERT statements:
loading people....
2014-02-27 18:49:25,502 INFO sqlalchemy.engine.base.Engine BEGIN (implicit)
2014-02-27 18:49:25,503 INFO sqlalchemy.engine.base.Engine SELECT person.id AS
person_id, person.name AS person_name
FROM person
2014-02-27 18:49:25,503 INFO sqlalchemy.engine.base.Engine ()
2014-02-27 18:49:25,520 INFO sqlalchemy.engine.base.Engine ROLLBACK
loading people....again!
loading people two through twelve
2014-02-27 18:49:25,530 INFO sqlalchemy.engine.base.Engine BEGIN (implicit)
2014-02-27 18:49:25,531 INFO sqlalchemy.engine.base.Engine SELECT person.id AS
person_id, person.name AS person_name
FROM person
WHERE person.name BETWEEN ? AND ?
2014-02-27 18:49:25,531 INFO sqlalchemy.engine.base.Engine ('person 02',
'person 12')
loading people five through fifteen
2014-02-27 18:49:25,542 INFO sqlalchemy.engine.base.Engine SELECT person.id AS
person_id, person.name AS person_name
FROM person
WHERE person.name BETWEEN ? AND ?
2014-02-27 18:49:25,543 INFO sqlalchemy.engine.base.Engine ('person 05',
'person 15')
loading people two through twelve...again!
invalidating everythingOn Feb 27, 2014, at 1:54 PM, [email protected] wrote: > I just checked out the examples for using dogpile caching mentioned here: > http://docs.sqlalchemy.org/en/rel_0_9/orm/examples.html#module-examples.dogpile_caching. > > According to the example in helloworld.py if a query is cached i.e. run the > second time then the SQL is not generated. > To illustrate attached is the code below: > > # Specifying a different query produces a different cache key, so > # these results are independently cached. > print("loading people two through twelve") > people_two_through_twelve = Session.query(Person).\ > options(FromCache("default")).\ > filter(Person.name.between("person 02", "person > 12")).\ > all() > > > > # ... but using the same params as are already cached, no SQL > print("loading people two through twelve...again!") > people_two_through_twelve = Session.query(Person).\ > options(FromCache("default")).\ > filter(Person.name.between("person 02", "person > 12")).\ > all() > > > The second time we shouldn't see a SQL statement being fired. But I am. > Is there any other way to confirm that the cache is being used when querying > second time around. > > > -Sandeep > > > > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/groups/opt_out.
signature.asc
Description: Message signed with OpenPGP using GPGMail
