prefect-soda-core icon indicating copy to clipboard operation
prefect-soda-core copied to clipboard

Cannot pickle 'classmethod' object

Open PaoloLeonard opened this issue 2 years ago • 7 comments

Hello,

I'm getting this error with the latest prefect version (=2.13) while it works with the previous version.

The error happens when we try to import the prefect-soda-core class during the deployment of the flow: prefect.exceptions.ScriptError: Script at 'src/my_soda_flow.py' encountered an exception: TypeError("cannot pickle 'classmethod' object")

I'll investigate on my side and let you know what I find.

PaoloLeonard avatar Oct 20 '23 10:10 PaoloLeonard

Hey @PaoloLeonard 👋 Thanks for reporting the issue. Currently, there aren't any classmethods in prefect-soda-core.

However, there might be classmethods in the soda-core package that's being used under the hood.

Let me know what you find!

AlessandroLollo avatar Oct 20 '23 14:10 AlessandroLollo

I believe the issue comes from the upgrade to pydantic v2: https://github.com/PrefectHQ/prefect/blob/main/RELEASE-NOTES.md#enabling-pydantic-v2 where support for @root_validator was dropped: https://docs.pydantic.dev/latest/migration/ I will test further to confirm my suspicion

PaoloLeonard avatar Oct 23 '23 08:10 PaoloLeonard

I'm having the same issue! Have you been able to fix this? @PaoloLeonard

digitalghost-dev avatar Jan 04 '24 01:01 digitalghost-dev

@PaoloLeonard @digitalghost-dev few weeks ago we pinned pydantic<2. Can you try with prefect-soda-core==0.1.8?

Thanks!

AlessandroLollo avatar Jan 04 '24 08:01 AlessandroLollo

Looks like that worked. Thank you. Does this mean prefect-soda-core will be updated to use pydantic>2 at some point? @AlessandroLollo

digitalghost-dev avatar Jan 04 '24 16:01 digitalghost-dev

@digitalghost-dev I think so, but we'll need to figure out how to fix it first 😅

AlessandroLollo avatar Jan 04 '24 17:01 AlessandroLollo

@AlessandroLollo Fair enough haha thanks for your help.

digitalghost-dev avatar Jan 04 '24 17:01 digitalghost-dev