title: FastAPI - GET request results in typeerror (value is not a valid dict)
body: <p>this is my database schema.</p>
  <p><a href="https://i.stack.imgur.com/JnTih.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/JnTih.jpg" alt="enter image description here" /></a></p>
  <p>I defined my Schema like this:</p>
  <p>from pydantic import BaseModel</p>
  <pre><code>class Userattribute(BaseModel):
      name: str
      value: str
      user_id: str
      id: str
  </code></pre>
  <p>This is my model:</p>
  <pre><code>class Userattribute(Base):
      __tablename__ = &quot;user_attribute&quot;
  
      name = Column(String)
      value = Column(String)
      user_id = Column(String)
      id = Column(String, primary_key=True, index=True)
  </code></pre>
  <p>In a crud.py I define a <code>get_attributes</code> method.</p>
  <pre><code>def get_attributes(db: Session, skip: int = 0, limit: int = 100):
      return db.query(models.Userattribute).offset(skip).limit(limit).all()
  </code></pre>
  <p>This is my <code>GET</code> endpoint:</p>
  <pre><code>@app.get(&quot;/attributes/&quot;, response_model=List[schemas.Userattribute])
  def read_attributes(skip: int = 0, limit: int = 100, db: Session = Depends(get_db)):
      users = crud.get_attributes(db, skip=skip, limit=limit)
      print(users)
      return users
  </code></pre>
  <p>The connection to the database seems to work, but a problem is the datatype:</p>
  <pre><code>pydantic.error_wrappers.ValidationError: 7 validation errors for Userattribute
  response -&gt; 0
    value is not a valid dict (type=type_error.dict)
  response -&gt; 1
    value is not a valid dict (type=type_error.dict)
  response -&gt; 2
    value is not a valid dict (type=type_error.dict)
  response -&gt; 3
    value is not a valid dict (type=type_error.dict)
  response -&gt; 4
    value is not a valid dict (type=type_error.dict)
  response -&gt; 5
    value is not a valid dict (type=type_error.dict)
  response -&gt; 6
    value is not a valid dict (type=type_error.dict)
  </code></pre>
  <p>Why does FASTApi expect a dictionary here? I don´t really understand it, since I am not able to even print the response. How can I fix this?</p>