Pydantic的关系目的地的过滤器
我正在使用fastapi。
如下所示,
class Parent(Base):
id: int
children = relationship(
"Child",
backref="parent",
uselist=True
)
class Child(Base):
__tablename__ = 'children'
id = Column(Integer, primary_key=True, nullable=False)
parent.id = Column(Integer, ForeignKey(Parent.id))
is_detele = Column(Boolean)
class ParentBase(BaseModel):
id: int
children = list
class Config:
orm_mode = True
如果目前使用parentbase,也可以获得嵌套的孩子,但是我想用is_delete为false的数据过滤。
如果您对此一无所知,这将不胜感激。
I am using fastapi.
There is a simple relation as follows
class Parent(Base):
id: int
children = relationship(
"Child",
backref="parent",
uselist=True
)
class Child(Base):
__tablename__ = 'children'
id = Column(Integer, primary_key=True, nullable=False)
parent.id = Column(Integer, ForeignKey(Parent.id))
is_detele = Column(Boolean)
class ParentBase(BaseModel):
id: int
children = list
class Config:
orm_mode = True
If ParentBase is used at this time, nested children can also be obtained, but I would like to filter with data for which is_delete is False.
If you know anything about it, it would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论