Hey folks, I have a false positive error occurring...
# prefect-community
h
Hey folks, I have a false positive error occurring when a flow runs. It concerns an SQLAlchemy Result object not being pickable. The flow achieves it’s objective successfully, with data inserted into a database but I still get this error. What is Prefect pickling at runtime that could be the cause of this error. Here’s the specific output from the logs:
Unexpected error: TypeError("can't pickle sqlalchemy.cprocessors.UnicodeResultProcessor objects")
1
a
Can you provide a little more background - is this for Prefect 1.0 or 2.0? Are you on Cloud or self-hosted? What storage do you use and how do you define storage, run config and results in your flow?
h
Hey Anna, thanks for the question. I wasn’t sure what would be relevant. • Prefect Core version: 0.15.6 • Prefect Cloud • ECS RunConfig (configured for FarGate) • S3 Storage All storage and RunConfig are defined at flow build time in the same module.
a
Thanks! Are you using sqlalchemy within your flow and do you happen to have the DB connection defined within your Flow's scope? Sharing your flow code would help to say why you are getting this pickling error - you can share via DM for privacy or redact any sensitive info and you can post it here
k
This looks like it’s pickling the return of your task and trying to store it as a result, you can turn off the default checkpointing, or return something else
h
Apologies for the very late response to this. @Kevin Kho I switched the checkpointing off and it now works. The result of the insert was an SQLAlchemy object which couldn’t be pickled. I didn’t notice it when developing locally because I don’t think the checkpointing and result persistence operates when just using
flow.run()
.
a
You're right, result persistence is by default only turned on for flows running on the backend, not for local flow runs. nice you figured that out!
h
Thanks @Anna Geller. I suppose it’s best to run the flow using the CLI perhaps rather than
flow.run()
to get as close to production as possible.
a
100% yes, CLI is best and allows for cleaner flow code