-
-
Notifications
You must be signed in to change notification settings - Fork 770
Closed
Labels
Description
First Check
- I added a very descriptive title to this issue.
- I used the GitHub search to find a similar issue and didn't find it.
- I searched the SQLModel documentation, with the integrated search.
- I already searched in Google "How to X in SQLModel" and didn't find any information.
- I already read and followed all the tutorial in the docs and didn't find an answer.
- I already checked if it is not related to SQLModel but to Pydantic.
- I already checked if it is not related to SQLModel but to SQLAlchemy.
Commit to Help
- I commit to help with one of those options 👆
Example Code
from fastapi import FastAPI, Query
app = FastAPI()
@app.get("/posts-lte/")
def get_posts_lte(limit: int = Query(1, lte=5)):
"""
`lte` seems not working
"""
return {"limit": limit}
@app.get("/posts-lt/")
def get_posts_lt(limit: int = Query(1, lt=5)):
"""
`lt` works
"""
return {"limit": limit}
Description
Maybe this issue is more related to FastAPI, but I found this issue from SQLModel tutorial, so I reckon it's better to report here.
The tutorial uses lte
for Query Parameters, but it seems not working (I can still get the query result if the limit is set to higher than lte
constraint). However, if I tried to use lt
, then it works fine.
Meanwhile, I didn't find the usage of lte
for Query Parameters in the FastAPI documentations.
As a result, I'm not sure whether this is a bug or FastAPI just doesn't support this operation .
Operating System
Windows
Operating System Details
No response
SQLModel Version
0.0.6
Python Version
Python 3.9.6
Additional Context
No response