Skip to content

Problem with one-to-one relationship #1433

Closed Answered by tavaresmatheus
tavaresmatheus asked this question in Questions
Discussion options

You must be logged in to vote

Found the error.
The problem was not (only) my user and doctor model, but all the other models depending on them, since they are the main domain of my application, almost everything depend on them.

I've had to refactor all my other models, but it worked, I'm sharing the code of my new user and doctor model's so you guys in the future having the same problem can see this:

import uuid
from datetime import datetime, timezone, date
from typing import List, Optional
from sqlmodel import Field, SQLModel, Relationship

class User(SQLModel, table=True):
    __tablename__ = 'users'

    user_id: uuid.UUID = Field(default_factory=uuid.uuid4, primary_key=True)
    name: str
    email: str
    birth_…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by tavaresmatheus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
1 participant