sqlalchemy case when分组查询统计
1.需求根据过滤条件将设备按升级状态分组,统计总数和各个状态的数量。2.原始数据3.原生sql语句select count(*) as "total", sum(case when upgrade_status='failed' then 1 else 0 end) as "failed_count", sum(case when upgrade_status='unstarted' then 1 else 0 end) as "unstart