Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Add recursive relations to PiccoloDTO #2595

Open
beerbrewingman opened this issue Nov 1, 2023 · 0 comments
Open

Enhancement: Add recursive relations to PiccoloDTO #2595

beerbrewingman opened this issue Nov 1, 2023 · 0 comments
Labels
Databases / ORMs This is related to database or ORM interaction DTOs This is related to our DTO feature Enhancement This is a new feature or request Help Wanted 🆘 This is good for people to work on

Comments

@beerbrewingman
Copy link

beerbrewingman commented Nov 1, 2023

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


Note

While we are open for sponsoring on GitHub Sponsors and
OpenCollective, we also utilize Polar.sh to engage in pledge-based sponsorship.

Check out all issues funded or available for funding on our Polar.sh Litestar dashboard

  • If you would like to see an issue prioritized, make a pledge towards it!
  • We receive the pledge once the issue is completed & verified
  • This, along with engagement in the community, helps us know which features are a priority to our users.
Fund with Polar
@beerbrewingman beerbrewingman added the Enhancement This is a new feature or request label Nov 1, 2023
@peterschutt peterschutt added the Help Wanted 🆘 This is good for people to work on label Nov 2, 2023
@JacobCoffee JacobCoffee added Databases / ORMs This is related to database or ORM interaction DTOs This is related to our DTO feature labels Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Databases / ORMs This is related to database or ORM interaction DTOs This is related to our DTO feature Enhancement This is a new feature or request Help Wanted 🆘 This is good for people to work on
Projects
Status: Ideas
Development

No branches or pull requests

3 participants