From 6010afb28f95c7050ca48ddd2e6f65ca6cbae5a1 Mon Sep 17 00:00:00 2001 From: Michael Trier Date: Tue, 31 Mar 2009 22:31:08 +0000 Subject: Lots of fixes to the code examples to specify imports explicitly. Explicit imports make it easier for users to understand the examples. Additionally a lot of the examples were fixed to work with the changes in the 0.5.x code base. One small correction to the Case expression. Thanks a bunch to Adam Lowry! Fixes #717. --- examples/graphs/graph1.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/graphs') diff --git a/examples/graphs/graph1.py b/examples/graphs/graph1.py index 8188d7c87..6122e65f1 100644 --- a/examples/graphs/graph1.py +++ b/examples/graphs/graph1.py @@ -1,7 +1,7 @@ """a directed graph example.""" -from sqlalchemy import * -from sqlalchemy.orm import * +from sqlalchemy import MetaData, Table, Column, Integer, ForeignKey +from sqlalchemy.orm import mapper, relation, create_session import logging logging.basicConfig() @@ -70,10 +70,10 @@ n7.add_neighbor(n2) n1.add_neighbor(n3) n2.add_neighbor(n1) -[session.save(x) for x in [n1, n2, n3, n4, n5, n6, n7]] +[session.add(x) for x in [n1, n2, n3, n4, n5, n6, n7]] session.flush() -session.clear() +session.expunge_all() n2 = session.query(Node).get(2) n3 = session.query(Node).get(3) -- cgit v1.2.1