Source

talks / python-serialization / src / sqlalchemy_example2.py

Full commit
1
2
3
4
5
6
7
8
Session = sessionmaker(bind=engine)

session = Session()
session.add_all([Point(1, 1), Point(2, 2)])
session.commit()

p1 = session.query(Point).filter_by(x=1).first()
assert p1.y == 1, 'corrupted data'