fastapi-pagination icon indicating copy to clipboard operation
fastapi-pagination copied to clipboard

How to add new key in query result before add in to paginate?

Open sombathoudom opened this issue 2 years ago • 1 comments

I'm using from fastapi_pagination.ext.sqlalchemy import paginate

Here is my qurey ex: q = db.query(User) and after query end i want to add another key to q like this. Ex: default q has {name: 'ABC'} I want to add {name: 'ABC', map: 'Worldwide'} but that map is not in user table or another table

and i return paginate(q) but i got an error.

sombathoudom avatar Dec 07 '23 04:12 sombathoudom

Hi @sombathoudom, Could you please show what kind of error you receive?

uriyyo avatar Dec 07 '23 11:12 uriyyo

@sombathoudom I guess, you can try to use transformer to add another key to result set before passing it to validation stage.

uriyyo avatar Feb 22 '24 06:02 uriyyo

@sombathoudom Any updates?

uriyyo avatar Mar 15 '24 17:03 uriyyo

@sombathoudom I'm closing this issue. Please, reopen it in case this issue is still relevant.

uriyyo avatar Apr 06 '24 14:04 uriyyo