summaryrefslogtreecommitdiff
path: root/examples/custom_attributes/custom_management.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-04-27 17:24:23 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2013-04-27 17:24:23 -0400
commitc38c63fdbf7020b857bef16b0d490b222a2234d8 (patch)
tree4f69b10e11a0cb6e58f0bab326a534b7dbcd12f8 /examples/custom_attributes/custom_management.py
parent00f3fcd641b8ec313fd2201182fa61a786991ff0 (diff)
parent8cdb4543bd7a85bef0286433576aafe0fb8e7c4c (diff)
downloadsqlalchemy-c38c63fdbf7020b857bef16b0d490b222a2234d8.tar.gz
merge default
Diffstat (limited to 'examples/custom_attributes/custom_management.py')
-rw-r--r--examples/custom_attributes/custom_management.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/examples/custom_attributes/custom_management.py b/examples/custom_attributes/custom_management.py
index 12b745db6..2199e0138 100644
--- a/examples/custom_attributes/custom_management.py
+++ b/examples/custom_attributes/custom_management.py
@@ -64,7 +64,8 @@ class MyClass(object):
if __name__ == '__main__':
- meta = MetaData(create_engine('sqlite://'))
+ engine = create_engine('sqlite://')
+ meta = MetaData()
table1 = Table('table1', meta,
Column('id', Integer, primary_key=True),
@@ -73,7 +74,7 @@ if __name__ == '__main__':
Column('id', Integer, primary_key=True),
Column('name', Text),
Column('t1id', Integer, ForeignKey('table1.id')))
- meta.create_all()
+ meta.create_all(engine)
class A(MyClass):
pass
@@ -82,7 +83,7 @@ if __name__ == '__main__':
pass
mapper(A, table1, properties={
- 'bs':relationship(B)
+ 'bs': relationship(B)
})
mapper(B, table2)
@@ -92,7 +93,7 @@ if __name__ == '__main__':
assert a1.name == 'a1'
assert a1.bs[0].name == 'b1'
- sess = Session()
+ sess = Session(engine)
sess.add(a1)
sess.commit()