diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-06-03 13:13:16 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-06-03 13:13:16 -0400 |
commit | 74c98bf182a1cac1ca1837da69e1c0550beaaab5 (patch) | |
tree | 4815d198d2aa4a6497330fb5d81e53bf4acfbb2d /examples/dogpile_caching/helloworld.py | |
parent | ff399ac75074916045410cedae72489cb60e8b50 (diff) | |
parent | c2a158c137ee07a146f02e5ee89ec42e486c6a37 (diff) | |
download | sqlalchemy-74c98bf182a1cac1ca1837da69e1c0550beaaab5.tar.gz |
Merge branch 'master' into ticket_1068
Diffstat (limited to 'examples/dogpile_caching/helloworld.py')
-rw-r--r-- | examples/dogpile_caching/helloworld.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/examples/dogpile_caching/helloworld.py b/examples/dogpile_caching/helloworld.py index e2e4d4f78..4561097b6 100644 --- a/examples/dogpile_caching/helloworld.py +++ b/examples/dogpile_caching/helloworld.py @@ -4,12 +4,12 @@ Illustrate how to load some data, and cache the results. """ -from environment import Session -from model import Person -from caching_query import FromCache +from .environment import Session +from .model import Person +from .caching_query import FromCache # load Person objects. cache the result under the namespace "all_people". -print "loading people...." +print("loading people....") people = Session.query(Person).options(FromCache("default")).all() # remove the Session. next query starts from scratch. @@ -17,12 +17,12 @@ Session.remove() # load again, using the same FromCache option. now they're cached # under "all_people", no SQL is emitted. -print "loading people....again!" +print("loading people....again!") people = Session.query(Person).options(FromCache("default")).all() # want to load on some different kind of query ? change the namespace # you send to FromCache -print "loading people two through twelve" +print("loading people two through twelve") people_two_through_twelve = Session.query(Person).\ options(FromCache("default")).\ filter(Person.name.between("person 02", "person 12")).\ @@ -32,7 +32,7 @@ people_two_through_twelve = Session.query(Person).\ # the bind parameters of the query. So this query, having # different literal parameters under "Person.name.between()" than the # previous one, issues new SQL... -print "loading people five through fifteen" +print("loading people five through fifteen") people_five_through_fifteen = Session.query(Person).\ options(FromCache("default")).\ filter(Person.name.between("person 05", "person 15")).\ @@ -40,7 +40,7 @@ people_five_through_fifteen = Session.query(Person).\ # ... but using the same params as are already cached, no SQL -print "loading people two through twelve...again!" +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")).\ @@ -51,7 +51,7 @@ people_two_through_twelve = Session.query(Person).\ # each Query, which includes at the very least the same FromCache, # same list of objects to be loaded, and the same parameters in the # same order, then call invalidate(). -print "invalidating everything" +print("invalidating everything") Session.query(Person).options(FromCache("default")).invalidate() Session.query(Person).\ options(FromCache("default")).\ |