summaryrefslogtreecommitdiff
path: root/examples/backref/backref_tree.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2006-06-08 16:58:14 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2006-06-08 16:58:14 +0000
commit8005c151593f1b9ffcc69b3b32ac57ef1c052fa0 (patch)
tree72630291746b9e66be9a1291aaaab3c961bf541d /examples/backref/backref_tree.py
parent8f8f5dec6cc53bf8bac18b515f20e572842c9675 (diff)
downloadsqlalchemy-8005c151593f1b9ffcc69b3b32ac57ef1c052fa0.tar.gz
late compilation of mappers. now you can create mappers in any order, and they will compile their internal state when first used in a query or flush operation (or their props or 'c'/'columns' attributes are used). includes various cleanups and fixes in support of the change, including some unit test changes, additional unit tests.
Diffstat (limited to 'examples/backref/backref_tree.py')
-rw-r--r--examples/backref/backref_tree.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/examples/backref/backref_tree.py b/examples/backref/backref_tree.py
index 3f81b1145..d217b22f1 100644
--- a/examples/backref/backref_tree.py
+++ b/examples/backref/backref_tree.py
@@ -19,7 +19,7 @@ table.create()
mapper(Tree, table,
properties={
- 'childs':relation(Tree, foreignkey=table.c.father_id, primaryjoin=table.c.father_id==table.c.id, backref=backref('father', uselist=False, foreignkey=table.c.id))},
+ 'childs':relation(Tree, foreignkey=table.c.father_id, primaryjoin=table.c.father_id==table.c.id, backref=backref('father', foreignkey=table.c.id))},
)
root = Tree('root')
@@ -27,6 +27,9 @@ child1 = Tree('child1', root)
child2 = Tree('child2', root)
child3 = Tree('child3', child1)
+child4 = Tree('child4')
+child1.childs.append(child4)
+
session = create_session()
session.save(root)
session.flush()