uriyyo / fastapi-pagination

FastAPI pagination 📖
https://uriyyo-fastapi-pagination.netlify.app/
MIT License
1.1k stars 126 forks source link

Adjustment to support Databases and SQLAlchemy 2.0 #1155

Closed mes5k closed 1 week ago

mes5k commented 1 month ago

I tried using fastapi-pagination on a FastAPI + Databases project where I ran databases version 0.9.0 with SQLAlchemy > 2.0.

This line fails: https://github.com/uriyyo/fastapi-pagination/blob/main/fastapi_pagination/ext/databases.py#L30

select([func.count()]) needs to become select(func.count()) (i.e. remove brackets) for SQLAlchemy 2.0.

I'm not sure how you want to handle compatibility with different versions of SQLAlchemy, otherwise I would have created a PR.

uriyyo commented 3 weeks ago

Hi @mes5k,

Sorry for long response. I'm planning to release fix today/tomorrow.

mes5k commented 3 weeks ago

No problem, thanks for the effort @uriyyo !

uriyyo commented 3 weeks ago

@mes5k

New version 0.12.25 has been released, this issue should be fixed now!

Let me know in case of any questions

uriyyo commented 1 week ago

@mes5k I'm closing this issue. Please, reopen it if issue still exists on your side

mes5k commented 1 week ago

Confirmed that it works, thanks for the effort @uriyyo!