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

docs: Update code example of prefetching related objects #952

Merged
merged 1 commit into from
Mar 14, 2024

Conversation

jrycw
Copy link
Contributor

@jrycw jrycw commented Mar 14, 2024

To ensure equivalence between the two code snippets, I believe we may be missing the .first() method call in the last one.

# These are equivalent:
ticket = await Ticket.objects(
    Ticket.concert.all_related()
).first()

ticket = await Ticket.objects().prefetch(
    Ticket.concert.all_related()
) # <= missing `.first()` here

@dantownsend
Copy link
Member

@jrycw You're right - great catch! 👍

@dantownsend dantownsend merged commit 51f58a6 into piccolo-orm:master Mar 14, 2024
@jrycw jrycw deleted the update-query-types-objects branch March 14, 2024 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants