async def getlogs( session: AsyncSession, limit: Optional[int] = 10, requesturl:…
Jump to turn (10)
- 1async def getlogs( session: AsyncSession, limit: Optional[int] = 10, requesturl:
- 2why here we first execute and then fetchall @router.get("/get-log", responsemode
- 3how to pass metadata to env.py of alembic migrations if I use this model from sq
- 4Do I need metadata in general?
- 5Base = declarativebase() and class Base(DeclarativeBase): pass it is the same?
- 6why it is better use is not None then just if requesturl in query = select(Log).
- 7from sqlalchemy import Integer, SmallInteger, String, TIMESTAMP, Text, Interval,
- 8why pycharm gies this on parametr log in insert Expected type 'TableClause | Joi
- 9what difference between inser and addall
- 10what I need to yous in my case
- User
async def get_logs( session: AsyncSession, limit: Optional[int] = 10, request_url: Optional[str] = None, response_status_code: Optional[int] = None, phone_number: Optional[str] = None, ):
codequery = session.query(Log).limit(limit) if filter: if request_url: query = query.filter(Log.request_url == request_url) if response_status_code is not None: query = query(Log.response_status_code == response_status_code) if phone_number: query = query(Log.phone_number == phone_number) result = await query.all() return mapper.map_model_list_to_dto(result) is that correct? Can I use query with AsyncSession? - Assistant