https://prefect.io logo
#prefect-community
Title
# prefect-community
s

Shubham Wani

12/24/2022, 7:39 PM
#needHelp Using Prefect 2.7, I'm trying to connect a MYSQL databse to write data through a prefect task. once I run
Copy code
cursor.executemany(query, values),
I run the
Copy code
connection.commit()
to to transfer all data from buffer to the table in dataset. Error faced in the following command:
Copy code
connection.commit()
Error:
Copy code
00:12:33.556 | ERROR   | Task run 'load_records-41eb504c-0' - Encountered exception during execution:
Traceback (most recent call last):
  File "/home/shubhamwani/nice/lib/python3.8/site-packages/prefect/engine.py", line 1346, in orchestrate_task_run
    result = await run_sync(task.fn, *args, **kwargs)
  File "/home/shubhamwani/nice/lib/python3.8/site-packages/prefect/utilities/asyncutils.py", line 69, in run_sync_in_worker_thread
    return await anyio.to_thread.run_sync(call, cancellable=True)
  File "/home/shubhamwani/nice/lib/python3.8/site-packages/anyio/to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/home/shubhamwani/nice/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "/home/shubhamwani/nice/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "/home/shubhamwani/nice/prefect_flows/load/prefect2_tasks.py", line 166, in load_records
    (
TypeError: cannot unpack non-iterable NoneType object
I've tried using different sql connectors(mysqlclient, mysql-connector, pymysql), but the error persists. is this somehow related to prefect? anyone else facing this issue? Any help is welcomed, Thanks.
1
s

Santhosh Solomon (Fluffy)

12/25/2022, 5:51 AM
The error seems to be from your flow only, where the load_records function is expecting an iterable but received a None object.
gratitude thank you 4
s

Shubham Wani

12/25/2022, 6:42 PM
Yep, that's the issue, thanks.
👍 1