Created
July 20, 2016 14:26
-
-
Save omsobliga/0f7dc19e2ca80302b6083b96a854e229 to your computer and use it in GitHub Desktop.
SQLAlchemy Transaction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://docs.sqlalchemy.org/en/latest/core/connections.html#sqlalchemy.engine.Transaction | |
from sqlalchemy import create_engine | |
engine = create_engine("postgresql://scott:tiger@localhost/test") | |
connection = engine.connect() | |
trans = connection.begin() | |
connection.execute("insert into x (a, b) values (1, 2)") | |
trans.commit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment