<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>chyka</author_name>
  <author_url>https://blog.hatena.ne.jp/chyka/</author_url>
  <blog_title>Sing it out</blog_title>
  <blog_url>https://chyka.hatenablog.jp/</blog_url>
  <categories>
    <anon>Python</anon>
    <anon>SQLAlchemy</anon>
  </categories>
  <description>サブクエリのフィールドが見つからないといわれてちょっとハマった。 複数のカゴの中にりんごが複数入っているとする。 すべてのカゴに入っているりんごの総数を集計するサブクエリは以下のように書ける。 りんごのID (apple_id) と総数 (total) をフィールドとしてもたせる。 apple_in_bucket = session.query( AppleInBucket.apple_id, func.sum(AppleInBucket.count).label(&quot;total&quot;) ).group_by( AppleInBucket.apple_id ).subquery() この時、appl…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fchyka.hatenablog.jp%2Fentry%2F2016%2F03%2F13%2F233947&quot; title=&quot;SQLAlchemy のサブクエリ - Sing it out&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2016-03-13 23:39:47</published>
  <title>SQLAlchemy のサブクエリ</title>
  <type>rich</type>
  <url>https://chyka.hatenablog.jp/entry/2016/03/13/233947</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
