> On May 24, 2023, at 1:33 PM, Dan Stromberg <strom...@gmail.com> wrote:
> 
> I know, python2 is long dead.  We’re almost ready for Python3, but not quite.
> 
> Anyway, here’s a traceback that I’m not sure what to make of.  Is it
> saying that a transaction got so big that it couldn’t be fully flushed
> within the timeout window?  I’ve elided a sensitive part from the very
> end of the traceback.  I realize this error is coming from mysql, not
> SA.


Hi Dan,
I think you hit the nail on the head when you said "I realize this error is 
coming from mysql, not SA." It looks to me like your Python code attempted a 
commit, but some other transaction running on the server was locking the table 
that your Python code was attempting to INSERT into. Eventually MySQL noticed 
that your INSERT transaction had been in a lock wait state for too long and 
killed the INSERT transaction. SQLAlchemy is just reporting what happened.

The remedy might be to increase the lock wait timeout. I'm use Postgres, not 
MySQL, so rather than misdirecting you on how to do that, I'll let you look it 
up. Increasing the lock wait timeout might be a reasonable strategy if for some 
reason it's currently set to a very low value, but if it's not (and I expect 
the default is not low), then increasing the timeout   addresses the symptom 
rather than the disease. It's good practice not to have long running 
transactions. The first avenue I would explore is to figure out what other 
transaction was open for so long that your INSERT was locked out, and then to 
figure out why it was open for so long.


Hope this helps
Philip

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/397C4196-B144-46BF-91DB-1B4A56DD9876%40americanefficient.com.

Reply via email to