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

ModelBuilder and recursive foreign keys #950

Closed
dantownsend opened this issue Mar 13, 2024 · 0 comments · Fixed by #951
Closed

ModelBuilder and recursive foreign keys #950

dantownsend opened this issue Mar 13, 2024 · 0 comments · Fixed by #951
Labels
bug Something isn't working
Projects

Comments

@dantownsend
Copy link
Member

If you have a foreign key which references its own table:

class MyTable(Table):
    fk = ForeignKey("self")

You get an error when using ModelBuilder:

>>> await ModelBuilder.build(MyTable)
Max recursion error!

If the foreign key is nullable, we can set the value to None, to avoid an infinite loop.

@dantownsend dantownsend added the bug Something isn't working label Mar 13, 2024
@dantownsend dantownsend added this to Needs triage in Bugs via automation Mar 13, 2024
Bugs automation moved this from Needs triage to Closed Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Bugs
Closed
Development

Successfully merging a pull request may close this issue.

1 participant