diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-10-24 12:42:47 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-10-24 12:42:47 -0400 |
| commit | bfc0977063a32f1820fc02d9465e73b20f7fbaaf (patch) | |
| tree | 7e0099a07b29fe5f300d8044678cbd9754aea0e6 /examples/vertical/dictlike-polymorphic.py | |
| parent | a29f130be7a1589566547e94c0e283f0210f27ef (diff) | |
| download | sqlalchemy-bfc0977063a32f1820fc02d9465e73b20f7fbaaf.tar.gz | |
- remove remaining create_session() calls from examples, replace with Session
- replace all flush()/expunge_all() with commit()
Diffstat (limited to 'examples/vertical/dictlike-polymorphic.py')
| -rw-r--r-- | examples/vertical/dictlike-polymorphic.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/examples/vertical/dictlike-polymorphic.py b/examples/vertical/dictlike-polymorphic.py index e4046b3ad..1acb6aee5 100644 --- a/examples/vertical/dictlike-polymorphic.py +++ b/examples/vertical/dictlike-polymorphic.py @@ -132,7 +132,7 @@ if __name__ == '__main__': from sqlalchemy import (MetaData, Table, Column, Integer, Unicode, ForeignKey, UnicodeText, and_, not_, or_, String, Boolean, cast, text, null, case) - from sqlalchemy.orm import mapper, relationship, create_session + from sqlalchemy.orm import mapper, relationship, Session from sqlalchemy.orm.collections import attribute_mapped_collection metadata = MetaData() @@ -191,7 +191,7 @@ if __name__ == '__main__': metadata.bind = 'sqlite:///' metadata.create_all() - session = create_session() + session = Session() stoat = Animal(u'stoat') stoat[u'color'] = u'red' @@ -199,8 +199,7 @@ if __name__ == '__main__': stoat[u'weasel-like'] = True session.add(stoat) - session.flush() - session.expunge_all() + session.commit() critter = session.query(Animal).filter(Animal.name == u'stoat').one() print critter[u'color'] @@ -210,7 +209,7 @@ if __name__ == '__main__': critter[u'cuteness'] = u'very cute' metadata.bind.echo = True - session.flush() + session.commit() metadata.bind.echo = False marten = Animal(u'marten') @@ -225,7 +224,7 @@ if __name__ == '__main__': shrew[u'poisonous'] = True session.add(shrew) - session.flush() + session.commit() q = (session.query(Animal). filter(Animal.facts.any( |
