Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @contextmanager
- def transacting(db):
- try:
- yield db
- except:
- db.rollback()
- raise
- else:
- db.commit()
- db.close()
- with transacting(connect_db()) as db:
- with app.open_resource('schema.sql', mode='r') as f:
- db.cursor().executescript(f.read())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement