Skip to content

Instantly share code, notes, and snippets.

@hden
Created May 10, 2016 07:53
Show Gist options
  • Select an option

  • Save hden/cf4e1bc548be1eb4d68d7922c99bc51e to your computer and use it in GitHub Desktop.

Select an option

Save hden/cf4e1bc548be1eb4d68d7922c99bc51e to your computer and use it in GitHub Desktop.
05-10 15:52:00 DEBUG metabase.query-processor ::
QUERY: 😎
{:database 2, :type "query", :query {:source_table 5, :aggregation ["count"], :breakout [["fk->" 47 216]], :filter []}, :constraints {:max-results 10000, :max-results-bare-rows 2000}}
05-10 15:52:00 DEBUG metabase.query-processor ::
PREPROCESSED/EXPANDED: 😻
{:database {:name "doh", :details "πŸ˜‹ ", :id 2, :engine :bigquery},
:type "query",
:query
{:source-table {:name "bookings", :id 5},
:aggregation {:aggregation-type :count},
:breakout [{:base-type :TextField, :table-id 16, :special-type :name, :field-name "name", :field-display-name "Name", :visibility-type :normal, :field-id 216, :table-name "restaurants"}],
:join-tables [{:source-field {:field-id 47, :field-name "restaurant_id"}, :pk-field {:field-id 213, :field-name "id"}, :table-id 16, :table-name "restaurants"}],
:order-by ({:field {:base-type :TextField, :table-id 16, :special-type :name, :field-name "name", :field-display-name "Name", :visibility-type :normal, :field-id 216, :table-name "restaurants"}, :direction :ascending})},
:constraints {:max-results 10000, :max-results-bare-rows 2000},
:driver "BigQuery",
:settings {},
:fk-field-ids #{47},
:table-ids #{16}}
05-10 15:52:00 DEBUG generic-sql.query-processor ::
KORMA FORM: πŸ˜‹
{:group [{:generated "[doh.restaurants.name]"}],
:table {:generated "[doh.bookings]"},
:fields [[{:func "COUNT(%s)", :args ({:generated "*"})} :count] [:doh.restaurants.name "doh.restaurants.name"]],
:joins [[:left "doh.restaurants" {:pred korma.sql.engine$do_infix, :args [:doh.bookings.restaurant_id "=" :doh.restaurants.id]}]],
:order [[{:generated "[doh.restaurants.name]"} :ASC]]}
SQL: 😈
SELECT COUNT(*) AS [count], [doh.restaurants.name] AS [doh.restaurants.name]
FROM [doh.bookings]
LEFT JOIN [doh.restaurants] ON [doh.bookings.restaurant_id] = [doh.restaurants.id]
GROUP BY [doh.restaurants.name]
ORDER BY [doh.restaurants.name] ASC
05-10 15:52:03 WARN query-processor.annotate :: There are fields we weren't expecting in the results: #{:doh_restaurants_name}
Expected: #{:name :count}
Actual: #{:doh_restaurants_name :count}
05-10 15:52:03 DEBUG query-processor.annotate :: Sorted fields:
([:0-breakout 0 :1-name :name] [:1-aggregation 2147483647 :2-other :count] [:3-other 2147483647 :1-name :name] [:3-other 2147483647 :2-other :doh_restaurants_name])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment