Replies: 2 comments
|
Here's the sqlalchemy thread for anyone interested. As discussed, in my actual use case I have set |
|
There are two main reasons why this happens in SQLModel with self-referential relationships, and how to configure it so both 1.
|
Uh oh!
There was an error while loading. Please reload this page.
First Check
Commit to Help
Example Code
Description
In the example above, the node instance doesn't have
parent_nodeloaded properly and the field throws:InvalidRequestError: 'Node.parent_node' is not available due to lazy='raise'sub_nodesloads properly and has value of empty list[]Using:
sqlalchemy Version: 2.0.44
sqlmodel Version: 0.0.27
Operating System
Linux
Operating System Details
No response
SQLModel Version
0.0.27
Python Version
3.13.5
Additional Context
I'ved opened a similar discussion in SqlAlchemy and determined that this is specific to SQLModel.
SQLAlchemy test scripts:
Output:
SQLModel testscript:
Output:
All reactions