Created
December 10, 2017 10:29
-
-
Save dsuch/2c4786c304c5ce63a43e61ab2478a9d0 to your computer and use it in GitHub Desktop.
SA - no rollback - https://bitbucket.org/zzzeek/sqlalchemy/issues/4139/implicit-rollback-and-postgresql-95
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
from sqlalchemy import create_engine | |
config = { | |
'username': 'zato1', | |
'password': 'zato1', | |
'database': 'zato1', | |
} | |
url = 'postgresql+pg8000://{username}:{password}@localhost/{database}'.format(**config) | |
engine = create_engine(url, echo=True) | |
conn = engine.connect() | |
result = conn.execute('SELECT 1+1') | |
print(result.fetchone()) | |
conn.close() | |
""" | |
$ py sa1.py | |
2017-12-10 11:28:52,146 INFO sqlalchemy.engine.base.Engine select version() | |
2017-12-10 11:28:52,146 INFO sqlalchemy.engine.base.Engine () | |
2017-12-10 11:28:52,148 INFO sqlalchemy.engine.base.Engine select current_schema() | |
2017-12-10 11:28:52,148 INFO sqlalchemy.engine.base.Engine () | |
2017-12-10 11:28:52,149 INFO sqlalchemy.engine.base.Engine SELECT CAST('test plain returns' AS VARCHAR(60)) AS anon_1 | |
2017-12-10 11:28:52,149 INFO sqlalchemy.engine.base.Engine () | |
2017-12-10 11:28:52,149 INFO sqlalchemy.engine.base.Engine SELECT CAST('test unicode returns' AS VARCHAR(60)) AS anon_1 | |
2017-12-10 11:28:52,149 INFO sqlalchemy.engine.base.Engine () | |
2017-12-10 11:28:52,150 INFO sqlalchemy.engine.base.Engine show standard_conforming_strings | |
2017-12-10 11:28:52,150 INFO sqlalchemy.engine.base.Engine () | |
2017-12-10 11:28:52,151 INFO sqlalchemy.engine.base.Engine SELECT 1+1 | |
2017-12-10 11:28:52,151 INFO sqlalchemy.engine.base.Engine () | |
(2,) | |
$ | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment