a guest Jun 25th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- engine = create_engine('postgresql://postgres:passw0rd@localhost:5432/mini_amazon')
- Session = sessionmaker(bind=engine, expire_on_commit=False)
- def session_scope():
- Provide a transactional scope around a series of operations.
- session = Session()
- yield session
- with session_scope() as session:
- while True:
- order = session.query(models.Order).get(arrived_message.packageid)
- if order.status == 'packed':
- order.status = 'loading'
RAW Paste Data