Ejemplo n.º 1
0
 def get_sums_by_taxon(cls, session: Session, acquis_id: AcquisitionIDT) \
         -> Dict[ClassifIDT, int]:
     res: ResultProxy = session.execute(
         "SELECT o.classif_id, count(1)"
         "  FROM obj_head o "
         " WHERE o.acquisid = :acq"
         " GROUP BY o.classif_id", {"acq": acquis_id})
     return {
         int(classif_id): int(cnt)
         for (classif_id, cnt) in res.fetchall()
     }
Ejemplo n.º 2
0
 def get_sums_by_taxon(cls, session: Session, acquis_id: AcquisitionIDT) \
         -> Dict[ClassifIDT, int]:
     sql = text("SELECT o.classif_id, count(1)"
                "  FROM obj_head o "
                " WHERE o.acquisid = :acq "
                "   AND o.classif_id IS NOT NULL "
                "   AND o.classif_qual = 'V'"
                " GROUP BY o.classif_id")
     res: Result = session.execute(sql, {"acq": acquis_id})
     return {
         int(classif_id): int(cnt)
         for (classif_id, cnt) in res.fetchall()
     }