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

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.

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
Status: Closed
Development

Successfully merging a pull request may close this issue.

1 participant