コード例 #1
0
 def query_count(session: Session, query: DbQuery) -> int:
     return session.execute(select(func.count(user_cls.id))).scalar()
コード例 #2
0
 def query_count(session: Session, query: Select) -> int:
     return session.execute(select(
         func.count()).select_from(user_cls)).scalar()
コード例 #3
0
 def count_user_notes(user_id: int, session: Session = Depends()) -> int:
     return session.execute(
         select(func.count(
             note_cls.id)).where(note_cls.user_id == user_id)).scalar()