Skip to content

Commit eccf2ed

Browse files
authored
Merge pull request #160 from grillazz/158-granian-poc
minor updates for readme and asyncpg conn pool
2 parents b938b0d + 8486f55 commit eccf2ed

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

README.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ I've included a few of my favorites to kick things off!
150150
* [Passlib - password hashing library for Python](https://passlib.readthedocs.io/en/stable/)
151151
* [Polars - fast DataFrame library for Rust and Python](https://docs.pola.rs/)
152152
* [Rich - Traceback and logging, made easy](https://rich.readthedocs.io/en/stable/traceback.html)
153+
* [Calamine - Excel reader in Rust](https://github.com/tafia/calamine)
154+
* [Inline Snapshots - pytest plugin for inline snapshots]()
155+
* [Connection pool for asyncpg](https://magicstack.github.io/asyncpg/current/usage.html#connection-pools)
153156

154157
<p align="right">(<a href="#readme-top">back to top</a>)</p>
155158

@@ -169,6 +172,7 @@ I've included a few of my favorites to kick things off!
169172
- **[OCT 21 2023]** refactor shakespeare models to use sqlalchemy 2.0 :fast_forward:
170173
- **[FEB 1 2024]** bump project to Python 3.12 :fast_forward:
171174
- **[MAR 15 2024]** add polars and calamine to project :heart_eyes_cat:
175+
- **[JUN 8 2024]** implement asyncpg connection pool :fast_forward:
172176
<p align="right">(<a href="#readme-top">back to top</a>)</p>
173177

174178

@@ -189,20 +193,20 @@ I've included a few of my favorites to kick things off!
189193

190194
[fastapi.tiangolo.com]: https://img.shields.io/badge/FastAPI-0.111.0-009485?style=for-the-badge&logo=fastapi&logoColor=white
191195
[fastapi-url]: https://fastapi.tiangolo.com/
192-
[pydantic.com]: https://img.shields.io/badge/Pydantic-2.7.1-e92063?style=for-the-badge&logo=pydantic&logoColor=white
196+
[pydantic.com]: https://img.shields.io/badge/Pydantic-2.7.3-e92063?style=for-the-badge&logo=pydantic&logoColor=white
193197
[pydantic-url]: https://docs.pydantic.dev/latest/
194198
[sqlalchemy.org]: https://img.shields.io/badge/SQLAlchemy-2.0.30-bb0000?color=bb0000&style=for-the-badge
195199
[sqlalchemy-url]: https://docs.sqlalchemy.org/en/20/
196-
[uvicorn.org]: https://img.shields.io/badge/Uvicorn-0.29.0-2094f3?style=for-the-badge&logo=uvicorn&logoColor=white
200+
[uvicorn.org]: https://img.shields.io/badge/Uvicorn-0.30.1-2094f3?style=for-the-badge&logo=uvicorn&logoColor=white
197201
[uvicorn-url]: https://www.uvicorn.org/
198202
[asyncpg.github.io]: https://img.shields.io/badge/asyncpg-0.29.0-2e6fce?style=for-the-badge&logo=postgresql&logoColor=white
199203
[asyncpg-url]: https://magicstack.github.io/asyncpg/current/
200-
[pytest.org]: https://img.shields.io/badge/pytest-8.1.1-fff?style=for-the-badge&logo=pytest&logoColor=white
204+
[pytest.org]: https://img.shields.io/badge/pytest-8.2.2-fff?style=for-the-badge&logo=pytest&logoColor=white
201205
[pytest-url]: https://docs.pytest.org/en/6.2.x/
202206
[alembic.sqlalchemy.org]: https://img.shields.io/badge/alembic-1.13.1-6BA81E?style=for-the-badge&logo=alembic&logoColor=white
203207
[alembic-url]: https://alembic.sqlalchemy.org/en/latest/
204208

205209
[rich.readthedocs.io]: https://img.shields.io/badge/rich-13.7.1-009485?style=for-the-badge&logo=rich&logoColor=white
206210
[rich-url]: https://rich.readthedocs.io/en/latest/
207-
[redis.io]: https://img.shields.io/badge/redis-5.0.4-dc382d?style=for-the-badge&logo=redis&logoColor=white
211+
[redis.io]: https://img.shields.io/badge/redis-5.0.5-dc382d?style=for-the-badge&logo=redis&logoColor=white
208212
[redis-url]: https://redis.io/

app/models/stuff.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import uuid
22

3+
from sqlalchemy.dialects import postgresql
34
from sqlalchemy import String, select, ForeignKey
45
from sqlalchemy.dialects.postgresql import UUID
56
from sqlalchemy.ext.asyncio import AsyncSession
@@ -16,7 +17,7 @@ def compile_sql_or_scalar(func):
1617
async def wrapper(cls, db_session, name, compile_sql=False, *args, **kwargs):
1718
stmt = await func(cls, db_session, name, *args, **kwargs)
1819
if compile_sql:
19-
return stmt.compile(compile_kwargs={"literal_binds": True})
20+
return stmt.compile(dialect=postgresql.dialect(), compile_kwargs={"literal_binds": True})
2021
result = await db_session.execute(stmt)
2122
return result.scalars().first()
2223

0 commit comments

Comments
 (0)