Enhancement: Add recursive relations to PiccoloDTO
Author: beerbrewingmanCreated Nov 1, 2023Updated Sep 12, 2026
LabelsEnhancementHelp Wanted :sos:DTOsDatabases / ORMs
Summary
As mentioned by @Goldziher in #1533 there currently isn't support for recursive relationships in PiccoloDTO. This would be a nice feature to have.
Basic Example
from piccolo.columns import ForeignKey, Integer, Varchar
from litestar.dto import DTOConfig
from litestar.contrib.piccolo import PiccoloDTO
class Manager(Table):
name = Varchar(length=100)
class Band(Table):
name = Varchar(length=100)
manager = ForeignKey(references=Manager)
popularity = Integer()
class BandOutputDTO (PiccoloDTO[Band]):
config = DTOConfig(include={"name", "manager.name", "popularity"})Drawbacks and Impact
No response
Unresolved questions
No response
Source: litestar-org/litestar