There is a longstanding issue with pickling locally-defined Pydantic models that is suddenly biting a lot of users (including myself 😅 ) now that we are optimistically persisting results by default for the transactional layer. A user testing ControlFlow immediately ran into this last night. We can take steps in CF proactively because we know what the user is trying to do, but I'm not sure how heavy-handed we can be in Prefect proper. For example, I do not think we can automatically select a different serializer at this point. Instead, this PR adds an explanation to what is otherwise a very cryptic error (TypeError: cannot pickle 'sqlite3.Connection' object), which we reraise.
There is a longstanding issue with pickling locally-defined Pydantic models that is suddenly biting a lot of users (including myself 😅 ) now that we are optimistically persisting results by default for the transactional layer. A user testing ControlFlow immediately ran into this last night. We can take steps in CF proactively because we know what the user is trying to do, but I'm not sure how heavy-handed we can be in Prefect proper. For example, I do not think we can automatically select a different serializer at this point. Instead, this PR adds an explanation to what is otherwise a very cryptic error (
TypeError: cannot pickle 'sqlite3.Connection' object
), which we reraise.