01/24/2023, 4:08 PM
Hi, Getting an error on a simple task, that is not an error with the actual task but appears to be something with the Prefect 2 internal logging. (as far as I an see so far) The task writes an reads info from a postgres DB, but close the connections after doing so. This issue did not happen when the task was running in Prefect 1 Any thoughts?
07:51:37.133 | INFO    | Flow run 'ultra-honeybee' - Finished in state Completed('All states completed.')
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/IPython/core/", line 780, in writeout_cache
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/IPython/core/", line 763, in _writeout_input_cache
    conn.execute("INSERT INTO history VALUES (?, ?, ?, ?)",
sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread. The object was created in thread id 123145498836992 and this is thread id 140704730421440.
I’ll check it out… though I do not use Sqlite in my code at all. I suspect it is Prefect is using Sqlite internally

Jeff Hale

01/24/2023, 5:19 PM


01/24/2023, 5:37 PM
This looks like an IPython error, not a Prefect error?


01/25/2023, 4:04 AM
I am not running it from IPython directly. I use pycharm, perhaps pycharm uses it in some way. I will try running directly from the command line.
just to point out, if I do not use the prefect flow and task and just run the functions in pycharm, they run without any problem
well… somehow today I do not get the error, do not know why
It looks like running jupyter notebook is causing this issue, even if I do not use it and shut it down. I need to shut it down and restart pycharm to avoid the error