diff options
| author | Michael Trier <mtrier@gmail.com> | 2009-04-13 03:23:19 +0000 |
|---|---|---|
| committer | Michael Trier <mtrier@gmail.com> | 2009-04-13 03:23:19 +0000 |
| commit | b5ad47271e68a30b2acd8f990af331de8e1069f3 (patch) | |
| tree | 3f5e960ae01b98bf4b013afc951f20415748cec1 | |
| parent | eba7328c46202af92de63d2b019bb2e4892255b7 (diff) | |
| download | sqlalchemy-b5ad47271e68a30b2acd8f990af331de8e1069f3.tar.gz | |
Cleaned up the deprecation problems with the examples.
| -rw-r--r-- | examples/adjacencytree/basic_tree.py | 4 | ||||
| -rw-r--r-- | examples/elementtree/adjacency_list.py | 2 | ||||
| -rw-r--r-- | examples/elementtree/optimized_al.py | 2 | ||||
| -rw-r--r-- | examples/elementtree/pickle.py | 2 | ||||
| -rw-r--r-- | examples/sharding/attribute_shard.py | 4 |
5 files changed, 7 insertions, 7 deletions
diff --git a/examples/adjacencytree/basic_tree.py b/examples/adjacencytree/basic_tree.py index ac149d68a..dec03e550 100644 --- a/examples/adjacencytree/basic_tree.py +++ b/examples/adjacencytree/basic_tree.py @@ -72,7 +72,7 @@ print "Flushing:" print "----------------------------" session = create_session() -session.save(node) +session.add(node) session.flush() print "\n\n\n----------------------------" @@ -113,7 +113,7 @@ print "Clearing session, selecting " print "tree new where node_id=%d:" % nodeid print "----------------------------" -session.clear() +session.expunge_all() t = session.query(TreeNode).filter(TreeNode.id==nodeid)[0] print "\n\n\n----------------------------" diff --git a/examples/elementtree/adjacency_list.py b/examples/elementtree/adjacency_list.py index 9efacad87..58156dcb6 100644 --- a/examples/elementtree/adjacency_list.py +++ b/examples/elementtree/adjacency_list.py @@ -155,7 +155,7 @@ session = create_session() # get ElementTree documents for file in ('test.xml', 'test2.xml', 'test3.xml'): - filename = os.path.join(os.path.dirname(sys.argv[0]), file) + filename = os.path.join(os.path.dirname(__file__), file) doc = ElementTree.parse(filename) session.add(Document(file, doc)) diff --git a/examples/elementtree/optimized_al.py b/examples/elementtree/optimized_al.py index 39d35921a..c03acee1d 100644 --- a/examples/elementtree/optimized_al.py +++ b/examples/elementtree/optimized_al.py @@ -164,7 +164,7 @@ session = create_session() # get ElementTree documents for file in ('test.xml', 'test2.xml', 'test3.xml'): - filename = os.path.join(os.path.dirname(sys.argv[0]), file) + filename = os.path.join(os.path.dirname(__file__), file) doc = ElementTree.parse(filename) session.add(Document(file, doc)) diff --git a/examples/elementtree/pickle.py b/examples/elementtree/pickle.py index 53d2ee2b6..220bb2295 100644 --- a/examples/elementtree/pickle.py +++ b/examples/elementtree/pickle.py @@ -49,7 +49,7 @@ mapper(Document, documents) ###### time to test ! ######### # get ElementTree document -filename = os.path.join(os.path.dirname(sys.argv[0]), "test.xml") +filename = os.path.join(os.path.dirname(__file__), "test.xml") doc = ElementTree.parse(filename) # save to DB diff --git a/examples/sharding/attribute_shard.py b/examples/sharding/attribute_shard.py index 45a019f13..2f03a5a34 100644 --- a/examples/sharding/attribute_shard.py +++ b/examples/sharding/attribute_shard.py @@ -184,10 +184,10 @@ quito.reports.append(Report(85)) sess = create_session() for c in [tokyo, newyork, toronto, london, dublin, brasilia, quito]: - sess.save(c) + sess.add(c) sess.flush() -sess.clear() +sess.expunge_all() t = sess.query(WeatherLocation).get(tokyo.id) assert t.city == tokyo.city |
