(myenv) ➜ myenv python new_script.py
2016-08-23 13:41:26,665 INFO sqlalchemy.engine.base.Engine SHOW VARIABLES LIKE 'sql_mode'
2016-08-23 13:41:26,665 INFO sqlalchemy.engine.base.Engine {}
2016-08-23 13:41:26,668 INFO sqlalchemy.engine.base.Engine SELECT DATABASE()
2016-08-23 13:41:26,668 INFO sqlalchemy.engine.base.Engine {}
2016-08-23 13:41:26,671 INFO sqlalchemy.engine.base.Engine show collation where `Charset` = 'utf8' and `Collation` = 'utf8_bin'
2016-08-23 13:41:26,671 INFO sqlalchemy.engine.base.Engine {}
2016-08-23 13:41:26,673 INFO sqlalchemy.engine.base.Engine SELECT CAST('test plain returns' AS CHAR(60)) AS anon_1
2016-08-23 13:41:26,673 INFO sqlalchemy.engine.base.Engine {}
2016-08-23 13:41:26,675 INFO sqlalchemy.engine.base.Engine SELECT CAST('test unicode returns' AS CHAR(60)) AS anon_1
2016-08-23 13:41:26,675 INFO sqlalchemy.engine.base.Engine {}
2016-08-23 13:41:26,676 INFO sqlalchemy.engine.base.Engine SELECT CAST('test collated returns' AS CHAR CHARACTER SET utf8) COLLATE utf8_bin AS anon_1
2016-08-23 13:41:26,676 INFO sqlalchemy.engine.base.Engine {}
2016-08-23 13:41:26,677 INFO sqlalchemy.engine.base.Engine DESCRIBE `a`
2016-08-23 13:41:26,677 INFO sqlalchemy.engine.base.Engine {}
2016-08-23 13:41:26,685 INFO sqlalchemy.engine.base.Engine ROLLBACK
2016-08-23 13:41:26,686 INFO sqlalchemy.engine.base.Engine DESCRIBE `a`
2016-08-23 13:41:26,686 INFO sqlalchemy.engine.base.Engine {}
2016-08-23 13:41:26,687 INFO sqlalchemy.engine.base.Engine ROLLBACK
2016-08-23 13:41:26,688 INFO sqlalchemy.engine.base.Engine
CREATE TABLE a (
id INTEGER NOT NULL,
PRIMARY KEY (id)
)
2016-08-23 13:41:26,688 INFO sqlalchemy.engine.base.Engine {}
2016-08-23 13:41:26,741 INFO sqlalchemy.engine.base.Engine COMMIT
2016-08-23 13:41:26,742 INFO sqlalchemy.engine.base.Engine BEGIN (implicit)
2016-08-23 13:41:26,742 INFO sqlalchemy.engine.base.Engine SAVEPOINT sa_savepoint_1
2016-08-23 13:41:26,742 INFO sqlalchemy.engine.base.Engine {}
2016-08-23 13:41:26,743 INFO sqlalchemy.engine.base.Engine rollback
2016-08-23 13:41:26,743 INFO sqlalchemy.engine.base.Engine {}
2016-08-23 13:41:26,745 INFO sqlalchemy.engine.base.Engine INSERT INTO a () VALUES ()
2016-08-23 13:41:26,745 INFO sqlalchemy.engine.base.Engine {}
/Users/aignatov/work/myenv/lib/python2.7/site-packages/pymysql/cursors.py:167: Warning: (1364, "Field 'id' doesn't have a default value")
result = self._query(query)
2016-08-23 13:41:26,752 INFO sqlalchemy.engine.base.Engine ROLLBACK TO SAVEPOINT sa_savepoint_1
2016-08-23 13:41:26,752 INFO sqlalchemy.engine.base.Engine {}
/Users/aignatov/work/myenv/lib/python2.7/site-packages/sqlalchemy/orm/session.py:430: SAWarning: An exception raised during a Session persistence operation cannot be raised due to an additional ROLLBACK exception; the exception is: Instance <A at 0x104a5e650> has a NULL identity key. If this is an auto-generated value, check that the database table allows generation of new primary key values, and that the mapped Column object is configured to expect these generated values. Ensure also that this flush() is not occurring at an inappropriate time, such aswithin a load() event.
"the exception is: %s" % captured_exception)
Traceback (most recent call last):
File "new_script.py", line 17, in <module>
s.commit()
File "/Users/aignatov/work/myenv/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 813, in commit
self.transaction.commit()
File "/Users/aignatov/work/myenv/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 392, in commit
self._prepare_impl()
File "/Users/aignatov/work/myenv/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 372, in _prepare_impl
self.session.flush()
File "/Users/aignatov/work/myenv/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 2027, in flush
self._flush(objects)
File "/Users/aignatov/work/myenv/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 2145, in _flush
transaction.rollback(_capture_exception=True)
File "/Users/aignatov/work/myenv/lib/python2.7/site-packages/sqlalchemy/util/langhelpers.py", line 63, in __exit__
compat.reraise(type_, value, traceback)
File "/Users/aignatov/work/myenv/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 2145, in _flush
transaction.rollback(_capture_exception=True)
File "/Users/aignatov/work/myenv/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 423, in rollback
from sqlalchemy.orm import Session
from sqlalchemy import create_engine, Column, Integer
from sqlalchemy.ext.declarative import declarative_base
transaction._rollback_impl()
File "/Users/aignatov/work/myenv/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 461, in _rollback_impl
t[1].rollback()
File "/Users/aignatov/work/myenv/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1563, in rollback
self._do_rollback()
File "/Users/aignatov/work/myenv/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1625, in _do_rollback
self._savepoint, self._parent)
File "/Users/aignatov/work/myenv/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 717, in _rollback_to_savepoint_impl
self.engine.dialect.do_rollback_to_savepoint(self, name)
File "/Users/aignatov/work/myenv/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 441, in do_rollback_to_savepoint
connection.execute(expression.RollbackToSavepointClause(name))
File "/Users/aignatov/work/myenv/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 914, in execute
return meth(self, multiparams, params)
File "/Users/aignatov/work/myenv/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 323, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File "/Users/aignatov/work/myenv/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1010, in _execute_clauseelement
compiled_sql, distilled_params
File "/Users/aignatov/work/myenv/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context
context)
File "/Users/aignatov/work/myenv/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1341, in _handle_dbapi_exception
exc_info
File "/Users/aignatov/work/myenv/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 200, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb)
File "/Users/aignatov/work/myenv/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context
context)
File "/Users/aignatov/work/myenv/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 450, in do_execute
cursor.execute(statement, parameters)
File "/Users/aignatov/work/myenv/lib/python2.7/site-packages/pymysql/cursors.py", line 167, in execute
result = self._query(query)
File "/Users/aignatov/work/myenv/lib/python2.7/site-packages/pymysql/cursors.py", line 323, in _query
conn.query(q)
File "/Users/aignatov/work/myenv/lib/python2.7/site-packages/pymysql/connections.py", line 836, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/Users/aignatov/work/myenv/lib/python2.7/site-packages/pymysql/connections.py", line 1020, in _read_query_result
result.read()
File "/Users/aignatov/work/myenv/lib/python2.7/site-packages/pymysql/connections.py", line 1303, in read
first_packet = self.connection._read_packet()
File "/Users/aignatov/work/myenv/lib/python2.7/site-packages/pymysql/connections.py", line 982, in _read_packet
packet.check_error()
File "/Users/aignatov/work/myenv/lib/python2.7/site-packages/pymysql/connections.py", line 394, in check_error
err.raise_mysql_exception(self._data)
File "/Users/aignatov/work/myenv/lib/python2.7/site-packages/pymysql/err.py", line 120, in raise_mysql_exception
_check_mysql_exception(errinfo)
File "/Users/aignatov/work/myenv/lib/python2.7/site-packages/pymysql/err.py", line 115, in _check_mysql_exception
raise InternalError(errno, errorvalue)
sqlalchemy.exc.InternalError: (pymysql.err.InternalError) (1305, u'SAVEPOINT sa_savepoint_1 does not exist') [SQL: u'ROLLBACK TO SAVEPOINT sa_savepoint_1']
Traceback generated by script above:
(myenv) ➜ myenv python new_script.py engine. base.Engine SHOW VARIABLES LIKE 'sql_mode' engine. base.Engine {} engine. base.Engine SELECT DATABASE() engine. base.Engine {} engine. base.Engine show collation where `Charset` = 'utf8' and `Collation` = 'utf8_bin' engine. base.Engine {} engine. base.Engine SELECT CAST('test plain returns' AS CHAR(60)) AS anon_1 engine. base.Engine {} engine. base.Engine SELECT CAST('test unicode returns' AS CHAR(60)) AS anon_1 engine. base.Engine {} engine. base.Engine SELECT CAST('test collated returns' AS CHAR CHARACTER SET utf8) COLLATE utf8_bin AS anon_1 engine. base.Engine {} engine. base.Engine DESCRIBE `a` engine. base.Engine {} engine. base.Engine ROLLBACK engine. base.Engine DESCRIBE `a` engine. base.Engine {} engine. base.Engine ROLLBACK engine. base.Engine
2016-08-23 13:41:26,665 INFO sqlalchemy.
2016-08-23 13:41:26,665 INFO sqlalchemy.
2016-08-23 13:41:26,668 INFO sqlalchemy.
2016-08-23 13:41:26,668 INFO sqlalchemy.
2016-08-23 13:41:26,671 INFO sqlalchemy.
2016-08-23 13:41:26,671 INFO sqlalchemy.
2016-08-23 13:41:26,673 INFO sqlalchemy.
2016-08-23 13:41:26,673 INFO sqlalchemy.
2016-08-23 13:41:26,675 INFO sqlalchemy.
2016-08-23 13:41:26,675 INFO sqlalchemy.
2016-08-23 13:41:26,676 INFO sqlalchemy.
2016-08-23 13:41:26,676 INFO sqlalchemy.
2016-08-23 13:41:26,677 INFO sqlalchemy.
2016-08-23 13:41:26,677 INFO sqlalchemy.
2016-08-23 13:41:26,685 INFO sqlalchemy.
2016-08-23 13:41:26,686 INFO sqlalchemy.
2016-08-23 13:41:26,686 INFO sqlalchemy.
2016-08-23 13:41:26,687 INFO sqlalchemy.
2016-08-23 13:41:26,688 INFO sqlalchemy.
CREATE TABLE a (
id INTEGER NOT NULL,
PRIMARY KEY (id)
)
2016-08-23 13:41:26,688 INFO sqlalchemy. engine. base.Engine {} engine. base.Engine COMMIT engine. base.Engine BEGIN (implicit) engine. base.Engine SAVEPOINT sa_savepoint_1 engine. base.Engine {} engine. base.Engine rollback engine. base.Engine {} engine. base.Engine INSERT INTO a () VALUES () engine. base.Engine {} aignatov/ work/myenv/ lib/python2. 7/site- packages/ pymysql/ cursors. py:167: Warning: (1364, "Field 'id' doesn't have a default value") engine. base.Engine ROLLBACK TO SAVEPOINT sa_savepoint_1 engine. base.Engine {} aignatov/ work/myenv/ lib/python2. 7/site- packages/ sqlalchemy/ orm/session. py:430: SAWarning: An exception raised during a Session persistence operation cannot be raised due to an additional ROLLBACK exception; the exception is: Instance <A at 0x104a5e650> has a NULL identity key. If this is an auto-generated value, check that the database table allows generation of new primary key values, and that the mapped Column object is configured to expect these generated values. Ensure also that this flush() is not occurring at an inappropriate time, such aswithin a load() event. aignatov/ work/myenv/ lib/python2. 7/site- packages/ sqlalchemy/ orm/session. py", line 813, in commit transaction. commit( ) aignatov/ work/myenv/ lib/python2. 7/site- packages/ sqlalchemy/ orm/session. py", line 392, in commit _prepare_ impl() aignatov/ work/myenv/ lib/python2. 7/site- packages/ sqlalchemy/ orm/session. py", line 372, in _prepare_impl session. flush() aignatov/ work/myenv/ lib/python2. 7/site- packages/ sqlalchemy/ orm/session. py", line 2027, in flush _flush( objects) aignatov/ work/myenv/ lib/python2. 7/site- packages/ sqlalchemy/ orm/session. py", line 2145, in _flush .rollback( _capture_ exception= True) aignatov/ work/myenv/ lib/python2. 7/site- packages/ sqlalchemy/ util/langhelper s.py", line 63, in __exit__ reraise( type_, value, traceback) aignatov/ work/myenv/ lib/python2. 7/site- packages/ sqlalchemy/ orm/session. py", line 2145, in _flush .rollback( _capture_ exception= True) aignatov/ work/myenv/ lib/python2. 7/site- packages/ sqlalchemy/ orm/session. py", line 423, in rollback ext.declarative import declarative_base ._rollback_ impl() aignatov/ work/myenv/ lib/python2. 7/site- packages/ sqlalchemy/ orm/session. py", line 461, in _rollback_impl aignatov/ work/myenv/ lib/python2. 7/site- packages/ sqlalchemy/ engine/ base.py" , line 1563, in rollback _do_rollback( ) aignatov/ work/myenv/ lib/python2. 7/site- packages/ sqlalchemy/ engine/ base.py" , line 1625, in _do_rollback _savepoint, self._parent) aignatov/ work/myenv/ lib/python2. 7/site- packages/ sqlalchemy/ engine/ base.py" , line 717, in _rollback_ to_savepoint_ impl engine. dialect. do_rollback_ to_savepoint( self, name) aignatov/ work/myenv/ lib/python2. 7/site- packages/ sqlalchemy/ engine/ default. py", line 441, in do_rollback_ to_savepoint execute( expression. RollbackToSavep ointClause( name)) aignatov/ work/myenv/ lib/python2. 7/site- packages/ sqlalchemy/ engine/ base.py" , line 914, in execute aignatov/ work/myenv/ lib/python2. 7/site- packages/ sqlalchemy/ sql/elements. py", line 323, in _execute_ on_connection _execute_ clauseelement( self, multiparams, params) aignatov/ work/myenv/ lib/python2. 7/site- packages/ sqlalchemy/ engine/ base.py" , line 1010, in _execute_ clauseelement aignatov/ work/myenv/ lib/python2. 7/site- packages/ sqlalchemy/ engine/ base.py" , line 1146, in _execute_context aignatov/ work/myenv/ lib/python2. 7/site- packages/ sqlalchemy/ engine/ base.py" , line 1341, in _handle_ dbapi_exception aignatov/ work/myenv/ lib/python2. 7/site- packages/ sqlalchemy/ util/compat. py", line 200, in raise_from_cause type(exception) , exception, tb=exc_tb) aignatov/ work/myenv/ lib/python2. 7/site- packages/ sqlalchemy/ engine/ base.py" , line 1139, in _execute_context aignatov/ work/myenv/ lib/python2. 7/site- packages/ sqlalchemy/ engine/ default. py", line 450, in do_execute execute( statement, parameters) aignatov/ work/myenv/ lib/python2. 7/site- packages/ pymysql/ cursors. py", line 167, in execute aignatov/ work/myenv/ lib/python2. 7/site- packages/ pymysql/ cursors. py", line 323, in _query aignatov/ work/myenv/ lib/python2. 7/site- packages/ pymysql/ connections. py", line 836, in query _affected_ rows = self._read_ query_result( unbuffered= unbuffered) aignatov/ work/myenv/ lib/python2. 7/site- packages/ pymysql/ connections. py", line 1020, in _read_query_result aignatov/ work/myenv/ lib/python2. 7/site- packages/ pymysql/ connections. py", line 1303, in read ._read_ packet( ) aignatov/ work/myenv/ lib/python2. 7/site- packages/ pymysql/ connections. py", line 982, in _read_packet check_error( ) aignatov/ work/myenv/ lib/python2. 7/site- packages/ pymysql/ connections. py", line 394, in check_error raise_mysql_ exception( self._data) aignatov/ work/myenv/ lib/python2. 7/site- packages/ pymysql/ err.py" , line 120, in raise_mysql_ exception mysql_exception (errinfo) aignatov/ work/myenv/ lib/python2. 7/site- packages/ pymysql/ err.py" , line 115, in _check_ mysql_exception errno, errorvalue) exc.InternalErr or: (pymysql. err.InternalErr or) (1305, u'SAVEPOINT sa_savepoint_1 does not exist') [SQL: u'ROLLBACK TO SAVEPOINT sa_savepoint_1']
2016-08-23 13:41:26,741 INFO sqlalchemy.
2016-08-23 13:41:26,742 INFO sqlalchemy.
2016-08-23 13:41:26,742 INFO sqlalchemy.
2016-08-23 13:41:26,742 INFO sqlalchemy.
2016-08-23 13:41:26,743 INFO sqlalchemy.
2016-08-23 13:41:26,743 INFO sqlalchemy.
2016-08-23 13:41:26,745 INFO sqlalchemy.
2016-08-23 13:41:26,745 INFO sqlalchemy.
/Users/
result = self._query(query)
2016-08-23 13:41:26,752 INFO sqlalchemy.
2016-08-23 13:41:26,752 INFO sqlalchemy.
/Users/
"the exception is: %s" % captured_exception)
Traceback (most recent call last):
File "new_script.py", line 17, in <module>
s.commit()
File "/Users/
self.
File "/Users/
self.
File "/Users/
self.
File "/Users/
self.
File "/Users/
transaction
File "/Users/
compat.
File "/Users/
transaction
File "/Users/
from sqlalchemy.orm import Session
from sqlalchemy import create_engine, Column, Integer
from sqlalchemy.
transaction
File "/Users/
t[1].rollback()
File "/Users/
self.
File "/Users/
self.
File "/Users/
self.
File "/Users/
connection.
File "/Users/
return meth(self, multiparams, params)
File "/Users/
return connection.
File "/Users/
compiled_sql, distilled_params
File "/Users/
context)
File "/Users/
exc_info
File "/Users/
reraise(
File "/Users/
context)
File "/Users/
cursor.
File "/Users/
result = self._query(query)
File "/Users/
conn.query(q)
File "/Users/
self.
File "/Users/
result.read()
File "/Users/
first_packet = self.connection
File "/Users/
packet.
File "/Users/
err.
File "/Users/
_check_
File "/Users/
raise InternalError(
sqlalchemy.