Can't put Callable in SQLModel even when not persisted #605
Unanswered
alexkreidler
asked this question in
Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
First Check
Commit to Help
Example Code
Description
python test.py
orpython -m test
The problem is that the Callable type should be allowed in a model, as it is in Pydantic, just not persisted to the database. I looked at various suggestions for how to do that, and #147 recommended adding a subclass (
Tool
fromBaseTool
) that has the private field, and then casting the instance to the superclass when persisting to a DB. However, the error here happens when initializing the model definition, not when trying to save the model. It is likely that #472 (a small change that adds support for PydanticPrivateAttribute
s) might be able to help fix thisOperating System
Linux
Operating System Details
Ubuntu 22.04.1 LTS
,Linux 5.15.0-25-generic #25-Ubuntu SMP x86_64 GNU/Linux
SQLModel Version
0.0.8
Python Version
Python 3.11.3
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions