{"categories":["Python"],"url":"https://aroundthedistance.hatenadiary.jp/entry/2016/02/28/212631","width":"100%","provider_url":"https://hatena.blog","blog_title":"Life is Really Short, Have Your Life!!","height":"190","title":"SQLAlchemy\u3067\u30af\u30ed\u30b9\u96c6\u8a08","published":"2016-02-28 21:26:31","version":"1.0","type":"rich","image_url":null,"blog_url":"https://aroundthedistance.hatenadiary.jp/","author_url":"https://blog.hatena.ne.jp/gothedistance/","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Faroundthedistance.hatenadiary.jp%2Fentry%2F2016%2F02%2F28%2F212631\" title=\"SQLAlchemy\u3067\u30af\u30ed\u30b9\u96c6\u8a08 - Life is Really Short, Have Your Life!!\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","description":"\u3053\u3093\u306a\u611f\u3058\u3067\u3067\u304d\u307e\u3059\u3002 import sqlalchemy from case, func rs = session.query(User,case[ func.sum(case([(User.blood_type == 'A',1)],else_=0)).label(\"A\"), func.sum(case([(User.blood_type == 'B',1)],else_=0)).label(\"B\"), func.sum(case([(User.blood_type == 'O',1)],else_=0)).label(\"O\"), func.sum(case([(User.blood_ty\u2026","author_name":"gothedistance","provider_name":"Hatena Blog"}