diff options
author | Michael Trier <mtrier@gmail.com> | 2009-03-31 22:31:08 +0000 |
---|---|---|
committer | Michael Trier <mtrier@gmail.com> | 2009-03-31 22:31:08 +0000 |
commit | 6010afb28f95c7050ca48ddd2e6f65ca6cbae5a1 (patch) | |
tree | 46259c03c209a89702c32c939c8ea035edee9425 /examples/graphs/graph1.py | |
parent | 832ea82fefa366f4717e889511f66ecfce3313de (diff) | |
download | sqlalchemy-6010afb28f95c7050ca48ddd2e6f65ca6cbae5a1.tar.gz |
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.
Diffstat (limited to 'examples/graphs/graph1.py')
-rw-r--r-- | examples/graphs/graph1.py | 8 |
1 files changed, 4 insertions, 4 deletions
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) |