Re: [sqlalchemy] Error during roll back

2013-03-18 Thread Michael Bayer
that's an old bug that's been fixed.   0.7.1 is ancient you should upgrade to 
0.7.10.


On Mar 17, 2013, at 1:38 AM, Warwick Prince warwi...@mushroomsys.com wrote:

 Hi Michael
 
 I have some fairly basic code which is moving data from one DB to another.  I 
 have trapped errors on inserts just in case there were unexpected duplicates. 
  When I go to commit this transaction, MySQL correctly throws an 
 IntegrityError exception: Duplicate Entry which I trap, and perform a 
 rollback.  However, the rollback ALSO receives an IntegrityError exception 
 from MySQL for the same insert query??
 
 
   File C:\Documents and Settings\wprince\Desktop\PY CODE 
 DEVELOPMENT\CESyncSQL\Sync_AU.py, line 1868, in SYNC_CustomersOUT
 session.rollback()
   File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line 586, 
 in rollback
 self.transaction.rollback()
   File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line 324, 
 in rollback
 self.close()
   File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line 351, 
 in close
 self.session.begin()
   File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line 557, 
 in begin
 self, nested=nested)
   File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line 137, 
 in __init__
 self._take_snapshot()
   File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line 197, 
 in _take_snapshot
 self.session.flush()
   File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line 1473, 
 in flush
 self._flush(objects)
   File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line 1542, 
 in _flush
 flush_context.execute()
   File C:\Python27\lib\site-packages\sqlalchemy\orm\unitofwork.py, line 
 327, in execute
 rec.execute(self)
   File C:\Python27\lib\site-packages\sqlalchemy\orm\unitofwork.py, line 
 471, in execute
 uow
   File C:\Python27\lib\site-packages\sqlalchemy\orm\mapper.py, line 2163, 
 in _save_obj
 execute(statement, params)
   File C:\Python27\lib\site-packages\sqlalchemy\engine\base.py, line 1358, 
 in execute
 params)
   File C:\Python27\lib\site-packages\sqlalchemy\engine\base.py, line 1491, 
 in _execute_clauseelement
 compiled_sql, distilled_params
   File C:\Python27\lib\site-packages\sqlalchemy\engine\base.py, line 1599, 
 in _execute_context
 context)
   File C:\Python27\lib\site-packages\sqlalchemy\engine\base.py, line 1592, 
 in _execute_context
 context)
   File C:\Python27\lib\site-packages\sqlalchemy\engine\default.py, line 
 325, in do_execute
 cursor.execute(statement, parameters)
   File C:\Python27\lib\site-packages\mysql\connector\cursor.py, line 309, 
 in execute
 res = self.db().protocol.cmd_query(stmt)
   File C:\Python27\lib\site-packages\mysql\connector\protocol.py, line 136, 
 in deco
 return func(*args, **kwargs)
   File C:\Python27\lib\site-packages\mysql\connector\protocol.py, line 474, 
 in cmd_query
 return self.handle_cmd_result(self._recv_packet())
   File C:\Python27\lib\site-packages\mysql\connector\protocol.py, line 173, 
 in _recv_packet
 MySQLProtocol.raise_error(buf)
   File C:\Python27\lib\site-packages\mysql\connector\protocol.py, line 167, 
 in raise_error
 raise errors.get_mysql_exception(errno,errmsg)
 IntegrityError: (IntegrityError) 1062: Duplicate entry '1231-63565' for key 
 'userID' u'INSERT INTO customer_master bla..
 
 Any ideas?   This is 0.7.1
 
 Cheers
 Warwick
 
 
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 sqlalchemy group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to sqlalchemy+unsubscr...@googlegroups.com.
 To post to this group, send email to sqlalchemy@googlegroups.com.
 Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [sqlalchemy] Error during roll back

2013-03-18 Thread Michael Bayer
specifically it occurs when you receive an exception on flush(), but then you 
keep doing things that change the state of the session before calling 
rollback().  here's the original test:

http://www.sqlalchemy.org/trac/attachment/ticket/2389/sqlalchemy_rollback_bug.py



On Mar 17, 2013, at 1:38 AM, Warwick Prince warwi...@mushroomsys.com wrote:

 Hi Michael
 
 I have some fairly basic code which is moving data from one DB to another.  I 
 have trapped errors on inserts just in case there were unexpected duplicates. 
  When I go to commit this transaction, MySQL correctly throws an 
 IntegrityError exception: Duplicate Entry which I trap, and perform a 
 rollback.  However, the rollback ALSO receives an IntegrityError exception 
 from MySQL for the same insert query??
 
 
   File C:\Documents and Settings\wprince\Desktop\PY CODE 
 DEVELOPMENT\CESyncSQL\Sync_AU.py, line 1868, in SYNC_CustomersOUT
 session.rollback()
   File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line 586, 
 in rollback
 self.transaction.rollback()
   File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line 324, 
 in rollback
 self.close()
   File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line 351, 
 in close
 self.session.begin()
   File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line 557, 
 in begin
 self, nested=nested)
   File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line 137, 
 in __init__
 self._take_snapshot()
   File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line 197, 
 in _take_snapshot
 self.session.flush()
   File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line 1473, 
 in flush
 self._flush(objects)
   File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line 1542, 
 in _flush
 flush_context.execute()
   File C:\Python27\lib\site-packages\sqlalchemy\orm\unitofwork.py, line 
 327, in execute
 rec.execute(self)
   File C:\Python27\lib\site-packages\sqlalchemy\orm\unitofwork.py, line 
 471, in execute
 uow
   File C:\Python27\lib\site-packages\sqlalchemy\orm\mapper.py, line 2163, 
 in _save_obj
 execute(statement, params)
   File C:\Python27\lib\site-packages\sqlalchemy\engine\base.py, line 1358, 
 in execute
 params)
   File C:\Python27\lib\site-packages\sqlalchemy\engine\base.py, line 1491, 
 in _execute_clauseelement
 compiled_sql, distilled_params
   File C:\Python27\lib\site-packages\sqlalchemy\engine\base.py, line 1599, 
 in _execute_context
 context)
   File C:\Python27\lib\site-packages\sqlalchemy\engine\base.py, line 1592, 
 in _execute_context
 context)
   File C:\Python27\lib\site-packages\sqlalchemy\engine\default.py, line 
 325, in do_execute
 cursor.execute(statement, parameters)
   File C:\Python27\lib\site-packages\mysql\connector\cursor.py, line 309, 
 in execute
 res = self.db().protocol.cmd_query(stmt)
   File C:\Python27\lib\site-packages\mysql\connector\protocol.py, line 136, 
 in deco
 return func(*args, **kwargs)
   File C:\Python27\lib\site-packages\mysql\connector\protocol.py, line 474, 
 in cmd_query
 return self.handle_cmd_result(self._recv_packet())
   File C:\Python27\lib\site-packages\mysql\connector\protocol.py, line 173, 
 in _recv_packet
 MySQLProtocol.raise_error(buf)
   File C:\Python27\lib\site-packages\mysql\connector\protocol.py, line 167, 
 in raise_error
 raise errors.get_mysql_exception(errno,errmsg)
 IntegrityError: (IntegrityError) 1062: Duplicate entry '1231-63565' for key 
 'userID' u'INSERT INTO customer_master bla..
 
 Any ideas?   This is 0.7.1
 
 Cheers
 Warwick
 
 
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 sqlalchemy group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to sqlalchemy+unsubscr...@googlegroups.com.
 To post to this group, send email to sqlalchemy@googlegroups.com.
 Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [sqlalchemy] Error during roll back

2013-03-18 Thread Warwick Prince
Cool - Thanks.  Upgrade on the way..  :-)

Cheers
Warwick

 specifically it occurs when you receive an exception on flush(), but then you 
 keep doing things that change the state of the session before calling 
 rollback().  here's the original test:
 
 http://www.sqlalchemy.org/trac/attachment/ticket/2389/sqlalchemy_rollback_bug.py
 
 
 
 On Mar 17, 2013, at 1:38 AM, Warwick Prince warwi...@mushroomsys.com wrote:
 
 Hi Michael
 
 I have some fairly basic code which is moving data from one DB to another.  
 I have trapped errors on inserts just in case there were unexpected 
 duplicates.  When I go to commit this transaction, MySQL correctly throws an 
 IntegrityError exception: Duplicate Entry which I trap, and perform a 
 rollback.  However, the rollback ALSO receives an IntegrityError exception 
 from MySQL for the same insert query??
 
 
   File C:\Documents and Settings\wprince\Desktop\PY CODE 
 DEVELOPMENT\CESyncSQL\Sync_AU.py, line 1868, in SYNC_CustomersOUT
 session.rollback()
   File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line 586, 
 in rollback
 self.transaction.rollback()
   File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line 324, 
 in rollback
 self.close()
   File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line 351, 
 in close
 self.session.begin()
   File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line 557, 
 in begin
 self, nested=nested)
   File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line 137, 
 in __init__
 self._take_snapshot()
   File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line 197, 
 in _take_snapshot
 self.session.flush()
   File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line 1473, 
 in flush
 self._flush(objects)
   File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line 1542, 
 in _flush
 flush_context.execute()
   File C:\Python27\lib\site-packages\sqlalchemy\orm\unitofwork.py, line 
 327, in execute
 rec.execute(self)
   File C:\Python27\lib\site-packages\sqlalchemy\orm\unitofwork.py, line 
 471, in execute
 uow
   File C:\Python27\lib\site-packages\sqlalchemy\orm\mapper.py, line 2163, 
 in _save_obj
 execute(statement, params)
   File C:\Python27\lib\site-packages\sqlalchemy\engine\base.py, line 1358, 
 in execute
 params)
   File C:\Python27\lib\site-packages\sqlalchemy\engine\base.py, line 1491, 
 in _execute_clauseelement
 compiled_sql, distilled_params
   File C:\Python27\lib\site-packages\sqlalchemy\engine\base.py, line 1599, 
 in _execute_context
 context)
   File C:\Python27\lib\site-packages\sqlalchemy\engine\base.py, line 1592, 
 in _execute_context
 context)
   File C:\Python27\lib\site-packages\sqlalchemy\engine\default.py, line 
 325, in do_execute
 cursor.execute(statement, parameters)
   File C:\Python27\lib\site-packages\mysql\connector\cursor.py, line 309, 
 in execute
 res = self.db().protocol.cmd_query(stmt)
   File C:\Python27\lib\site-packages\mysql\connector\protocol.py, line 
 136, in deco
 return func(*args, **kwargs)
   File C:\Python27\lib\site-packages\mysql\connector\protocol.py, line 
 474, in cmd_query
 return self.handle_cmd_result(self._recv_packet())
   File C:\Python27\lib\site-packages\mysql\connector\protocol.py, line 
 173, in _recv_packet
 MySQLProtocol.raise_error(buf)
   File C:\Python27\lib\site-packages\mysql\connector\protocol.py, line 
 167, in raise_error
 raise errors.get_mysql_exception(errno,errmsg)
 IntegrityError: (IntegrityError) 1062: Duplicate entry '1231-63565' for key 
 'userID' u'INSERT INTO customer_master bla..
 
 Any ideas?   This is 0.7.1
 
 Cheers
 Warwick
 
 
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 sqlalchemy group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to sqlalchemy+unsubscr...@googlegroups.com.
 To post to this group, send email to sqlalchemy@googlegroups.com.
 Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  
 
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 sqlalchemy group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to sqlalchemy+unsubscr...@googlegroups.com.
 To post to this group, send email to sqlalchemy@googlegroups.com.
 Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
For more options, visit 

[sqlalchemy] Error during roll back

2013-03-17 Thread Warwick Prince
Hi Michael

I have some fairly basic code which is moving data from one DB to another.
 I have trapped errors on inserts just in case there were unexpected
duplicates.  When I go to commit this transaction, MySQL correctly throws
an IntegrityError exception: Duplicate Entry which I trap, and perform a
rollback.  However, the rollback ALSO receives an IntegrityError exception
from MySQL for the same insert query??


  File C:\Documents and Settings\wprince\Desktop\PY CODE
DEVELOPMENT\CESyncSQL\Sync_AU.py, line 1868, in SYNC_CustomersOUT
session.rollback()
  File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line 586,
in rollback
self.transaction.rollback()
  File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line 324,
in rollback
self.close()
  File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line 351,
in close
self.session.begin()
  File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line 557,
in begin
self, nested=nested)
  File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line 137,
in __init__
self._take_snapshot()
  File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line 197,
in _take_snapshot
self.session.flush()
  File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line
1473, in flush
self._flush(objects)
  File C:\Python27\lib\site-packages\sqlalchemy\orm\session.py, line
1542, in _flush
flush_context.execute()
  File C:\Python27\lib\site-packages\sqlalchemy\orm\unitofwork.py, line
327, in execute
rec.execute(self)
  File C:\Python27\lib\site-packages\sqlalchemy\orm\unitofwork.py, line
471, in execute
uow
  File C:\Python27\lib\site-packages\sqlalchemy\orm\mapper.py, line 2163,
in _save_obj
execute(statement, params)
  File C:\Python27\lib\site-packages\sqlalchemy\engine\base.py, line
1358, in execute
params)
  File C:\Python27\lib\site-packages\sqlalchemy\engine\base.py, line
1491, in _execute_clauseelement
compiled_sql, distilled_params
  File C:\Python27\lib\site-packages\sqlalchemy\engine\base.py, line
1599, in _execute_context
context)
  File C:\Python27\lib\site-packages\sqlalchemy\engine\base.py, line
1592, in _execute_context
context)
  File C:\Python27\lib\site-packages\sqlalchemy\engine\default.py, line
325, in do_execute
cursor.execute(statement, parameters)
  File C:\Python27\lib\site-packages\mysql\connector\cursor.py, line 309,
in execute
res = self.db().protocol.cmd_query(stmt)
  File C:\Python27\lib\site-packages\mysql\connector\protocol.py, line
136, in deco
return func(*args, **kwargs)
  File C:\Python27\lib\site-packages\mysql\connector\protocol.py, line
474, in cmd_query
return self.handle_cmd_result(self._recv_packet())
  File C:\Python27\lib\site-packages\mysql\connector\protocol.py, line
173, in _recv_packet
MySQLProtocol.raise_error(buf)
  File C:\Python27\lib\site-packages\mysql\connector\protocol.py, line
167, in raise_error
raise errors.get_mysql_exception(errno,errmsg)
IntegrityError: (IntegrityError) 1062: Duplicate entry '1231-63565' for key
'userID' u'INSERT INTO customer_master bla..

Any ideas?   This is 0.7.1

Cheers
Warwick

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.