]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Cleaned up the deprecation problems with the examples.
authorMichael Trier <mtrier@gmail.com>
Mon, 13 Apr 2009 03:23:19 +0000 (03:23 +0000)
committerMichael Trier <mtrier@gmail.com>
Mon, 13 Apr 2009 03:23:19 +0000 (03:23 +0000)
examples/adjacencytree/basic_tree.py
examples/elementtree/adjacency_list.py
examples/elementtree/optimized_al.py
examples/elementtree/pickle.py
examples/sharding/attribute_shard.py

index ac149d68a932c972bca92c871477c31dc06fe7fc..dec03e5504c8a9645ad2810b6fc836f9bc0d5f12 100644 (file)
@@ -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----------------------------"
index 9efacad872a0baef4cb472727cc17099030ec4be..58156dcb6776060b406b8da46281447e72f15b8f 100644 (file)
@@ -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))
 
index 39d35921a7e004ac9fac088b1e73008104a21d7b..c03acee1d4ff7faa7fddad4562a0353b0dd85b9a 100644 (file)
@@ -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))
 
index 53d2ee2b6c0c16910fe491a8c6423135f1146cda..220bb2295386a75a1311c597f76514c078ad8ffb 100644 (file)
@@ -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
index 45a019f135df6cfb18d25b64d92a3a3f03654606..2f03a5a34488874d3307102b9f010be594df241e 100644 (file)
@@ -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