If i want to search for a specific user with the Username the API returns:
GET /users/test HTTP/1.1" 422 Unprocessable Entity
And if I put an id there it returns the correct id with the correct user. Does smn know the fix
main.py
@app.get("/user/{username}")
async def get_user_username(username: str):
return conn.execute(users.select().where(users.c.username == username)).fetchall()
models/users.py
users = Table(
'users',meta,
Column('id',Integer,primary_key=True),
Column('username',String),
Column('password',String)
)
schemas/users.py
from pydantic import BaseModel
class User(BaseModel):
id:int
username:str
password:str
