Skip to content

Commit 4635b4e

Browse files
authored
Merge pull request #214 from grillazz/12-add-json-field-example
12 add json field example
2 parents b3c664e + 8312f06 commit 4635b4e

File tree

6 files changed

+288
-184
lines changed

6 files changed

+288
-184
lines changed

README.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ leveraging the power of asyncio and event loops.
5454

5555
Notably, this example showcases the latest and greatest versions of SQLAlchemy and psycopg,
5656
which are renowned for their robustness, power, and speed. The inclusion of FastAPI adds a modern, fast, and high-performance web framework to the mix
57-
allowing for the rapid development of APIs with Python 3.8+.
57+
allowing for the rapid development of APIs with Python 3.13.
5858

5959
FastAPI has received significant recognition in the industry, including a review on thoughtworks Technology Radar in April 2021,
6060
where it was classified as a Trial technology, with comments praising its performance, ease of use,
@@ -217,7 +217,9 @@ I've included a few of my favorites to kick things off!
217217
<details>
218218
<summary>2025 (3 changes)</summary>
219219
<ul>
220-
<li>[MAY 3 2025] add large language model integration :robot:</li>
220+
<li>[AUG 23 2025] intro exception handlers</li>
221+
<li>[JUL some sunny day 2025] add rotoger</li>
222+
<li>[MAY 3, 2025] add large language model integration :robot:</li>
221223
<li>[MAR 8 2025] switch from poetry to uv :fast_forward:</li>
222224
<li>[JAN 28 2025] add SMTP setup :email:</li>
223225
</ul>
@@ -229,7 +231,7 @@ I've included a few of my favorites to kick things off!
229231
<li>[OCT 16 2024] apscheduler added to project :clock1:</li>
230232
<li>[AUG 17 2024] granian use case implemented with docker compose and rich logger :fast_forward:</li>
231233
<li>[JUN 8 2024] implement asyncpg connection pool :fast_forward:</li>
232-
<li>[MAR 15 2024] add polars and calamine to project :heart_eyes_cat:</li>
234+
<li>[MAR 15, 2024] add polars and calamine to project :heart_eyes_cat:</li>
233235
<li>[FEB 1 2024] bump project to Python 3.12 :fast_forward:</li>
234236
</ul>
235237
</details>
@@ -274,21 +276,21 @@ I've included a few of my favorites to kick things off!
274276
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555
275277
[linkedin-url]: https://www.linkedin.com/in/python-has-powers/
276278

277-
[fastapi.tiangolo.com]: https://img.shields.io/badge/FastAPI-0.115.11-009485?style=for-the-badge&logo=fastapi&logoColor=white
279+
[fastapi.tiangolo.com]: https://img.shields.io/badge/FastAPI-0.116.1-009485?style=for-the-badge&logo=fastapi&logoColor=white
278280
[fastapi-url]: https://fastapi.tiangolo.com/
279-
[pydantic.com]: https://img.shields.io/badge/Pydantic-2.10.6-e92063?style=for-the-badge&logo=pydantic&logoColor=white
281+
[pydantic.com]: https://img.shields.io/badge/Pydantic-2.12.0a1-e92063?style=for-the-badge&logo=pydantic&logoColor=white
280282
[pydantic-url]: https://docs.pydantic.dev/latest/
281-
[sqlalchemy.org]: https://img.shields.io/badge/SQLAlchemy-2.0.38-bb0000?color=bb0000&style=for-the-badge
283+
[sqlalchemy.org]: https://img.shields.io/badge/SQLAlchemy-2.0.43-bb0000?color=bb0000&style=for-the-badge
282284
[sqlalchemy-url]: https://docs.sqlalchemy.org/en/20/
283-
[uvicorn.org]: https://img.shields.io/badge/Uvicorn-0.34.0-2094f3?style=for-the-badge&logo=uvicorn&logoColor=white
285+
[uvicorn.org]: https://img.shields.io/badge/Uvicorn-0.35.0-2094f3?style=for-the-badge&logo=uvicorn&logoColor=white
284286
[uvicorn-url]: https://www.uvicorn.org/
285287
[asyncpg.github.io]: https://img.shields.io/badge/asyncpg-0.30.0-2e6fce?style=for-the-badge&logo=postgresql&logoColor=white
286288
[asyncpg-url]: https://magicstack.github.io/asyncpg/current/
287-
[pytest.org]: https://img.shields.io/badge/pytest-8.3.5-fff?style=for-the-badge&logo=pytest&logoColor=white
289+
[pytest.org]: https://img.shields.io/badge/pytest-8.4.1-fff?style=for-the-badge&logo=pytest&logoColor=white
288290
[pytest-url]: https://docs.pytest.org/en/6.2.x/
289-
[alembic.sqlalchemy.org]: https://img.shields.io/badge/alembic-1.15.1-6BA81E?style=for-the-badge&logo=alembic&logoColor=white
291+
[alembic.sqlalchemy.org]: https://img.shields.io/badge/alembic-1.16.4-6BA81E?style=for-the-badge&logo=alembic&logoColor=white
290292
[alembic-url]: https://alembic.sqlalchemy.org/en/latest/
291-
[rich.readthedocs.io]: https://img.shields.io/badge/rich-13.9.4-009485?style=for-the-badge&logo=rich&logoColor=white
293+
[rich.readthedocs.io]: https://img.shields.io/badge/rich-14.1.0-009485?style=for-the-badge&logo=rich&logoColor=white
292294
[rich-url]: https://rich.readthedocs.io/en/latest/
293-
[redis.io]: https://img.shields.io/badge/redis-5.2.1-dc382d?style=for-the-badge&logo=redis&logoColor=white
295+
[redis.io]: https://img.shields.io/badge/redis-6.4.0-dc382d?style=for-the-badge&logo=redis&logoColor=white
294296
[redis-url]: https://redis.io/

app/exception_handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
logger = AppStructLogger().get_logger()
88

9-
9+
#TODO: add reasoning for this in readme plus higligh using re-raise in db session
1010
async def sqlalchemy_exception_handler(
1111
request: Request, exc: SQLAlchemyError
1212
) -> JSONResponse:

app/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ async def lifespan(app: FastAPI):
4444
def create_app() -> FastAPI:
4545
app = FastAPI(
4646
title="Stuff And Nonsense API",
47-
version="0.19.0",
47+
version="0.20.0",
4848
lifespan=lifespan,
4949
)
5050
app.include_router(stuff_router)

db/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# pull official base image
2-
FROM postgres:17.4-alpine
2+
FROM postgres:17.6-alpine
33

44
# run create.sql on init
55
ADD create.sql /docker-entrypoint-initdb.d

pyproject.toml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
11
[project]
22
name = "fastapi-sqlalchemy-asyncpg"
3-
version = "0.19.0"
3+
version = "0.20.0"
44
description = "A modern FastAPI application with SQLAlchemy 2.0 and AsyncPG for high-performance async database operations. Features include JWT authentication with Redis token storage, password hashing, connection pooling, data processing with Polars, Rich logging, task scheduling with APScheduler, and Shakespeare datasets integration."
55
readme = "README.md"
66
requires-python = ">=3.13"
77
dependencies = [
8-
"fastapi[all]>=0.115.12",
9-
"pydantic[email]>=2.11.5",
10-
"pydantic-settings>=2.9.1",
11-
"sqlalchemy>=2.0.41",
12-
"uvicorn[standard]>=0.34.3",
8+
"fastapi[all]>=0.116.1",
9+
"pydantic[email]>=2.12.0a1",
10+
"pydantic-settings>=2.10.1",
11+
"sqlalchemy>=2.0.43",
12+
"uvicorn[standard]>=0.35.0",
1313
"asyncpg>=0.30.0",
14-
"alembic>=1.16.1",
14+
"alembic>=1.16.4",
1515
"httpx>=0.28.1",
16-
"pytest>=8.4.0",
17-
"pytest-cov>=6.1.1",
16+
"pytest>=8.4.1",
17+
"pytest-cov>=6.2.1",
1818
"uvloop>=0.21.0",
1919
"httptools>=0.6.4",
20-
"rich>=14.0.0",
20+
"rich>=14.1.0",
2121
"pyjwt>=2.10.1",
22-
"redis>=6.2.0",
22+
"redis>=6.4.0",
2323
"bcrypt>=4.3.0",
24-
"polars>=1.30.0",
24+
"polars>=1.32.3",
2525
"python-multipart>=0.0.20",
2626
"fastexcel>=0.14.0",
27-
"inline-snapshot>=0.23.2",
27+
"inline-snapshot>=0.27.2",
2828
"dirty-equals>=0.9.0",
29-
"polyfactory>=2.21.0",
30-
"granian>=2.3.2",
29+
"polyfactory>=2.22.2",
30+
"granian>=2.5.0",
3131
"apscheduler[redis,sqlalchemy]>=4.0.0a6",
3232
"rotoger",
3333
]
3434

3535
[tool.uv]
3636
dev-dependencies = [
37-
"ruff>=0.11.13",
37+
"ruff>=0.12.10",
3838
"devtools[pygments]>=0.12.2",
3939
"pyupgrade>=3.20.0",
40-
"ipython>=9.3.0",
41-
"sqlacodegen>=3.0.0",
40+
"ipython>=9.4.0",
41+
"sqlacodegen<=3.1.0",
4242
"tryceratops>=2.4.1",
43-
"locust>=2.37.9"
43+
"locust>=2.39.0"
4444

4545
]
4646

0 commit comments

Comments
 (0)