SQLAlchemy, log only one record from failed insert - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html) +--- Thread: SQLAlchemy, log only one record from failed insert (/thread-14877.html) |
SQLAlchemy, log only one record from failed insert - Master_Sergius - Dec-21-2018 Hello, sometimes I can find in logs following long tracebacks: ... (part of Traceback is skipped) ... "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py\", line 948, in execute\n return meth(self, multiparams, params)\n ... (part of Traceback is skipped) ... File \"/usr/local/lib/python3.6/site-packages/mysql/connector/connection.py\", line 396, in _handle_result\n raise errors.get_exception(packet)\nsqlalchemy.exc.DataError: (mysql.connector.errors.DataError) 1264 (22003): Out of range value for column 'tlm_1' at row 722 ... Then goes very long sql query with inserting hundreds of records ...Structure of query: INSERT INTO <table> <fields> VALUES (<row1>, <row2>, ... ) The question is: is there any possibility to log only record (row) which is failed and not whole query with almost 200 rows? |