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

fix: REST API one-to-one relationship #1965

Merged
merged 3 commits into from
Dec 21, 2022
Merged

fix: REST API one-to-one relationship #1965

merged 3 commits into from
Dec 21, 2022

Conversation

dpgaspar
Copy link
Owner

@dpgaspar dpgaspar commented Dec 20, 2022

Description

Fixes ModelRestApi one to one relation when it's defined like:

class Child(Model):
    id = Column(Integer, primary_key=True)
    name = Column(String(50), unique=True, nullable=False)
    parent_id = Column(Integer, ForeignKey("contact.id"))
    parent = relationship("Parent", back_populates="child")

class Parent(Model):
    id = Column(Integer, primary_key=True)
    name = Column(String(150), unique=True, nullable=False)
    child = relationship("Child", back_populates="parent", uselist=False)

@hughhhh

ADDITIONAL INFORMATION

  • Has associated issue:
  • Is CRUD MVC related.
  • Is Auth, RBAC security related.
  • Changes the security db schema.
  • Introduces new feature
  • Removes existing feature

@dpgaspar dpgaspar merged commit 6136b57 into master Dec 21, 2022
@dpgaspar dpgaspar deleted the fix/one-one-relation branch December 21, 2022 13:26
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.

1 participant