metabase-clickhouse-driver icon indicating copy to clipboard operation
metabase-clickhouse-driver copied to clipboard

GUI query with a self join won't work

Open paoliniluis opened this issue 2 years ago • 1 comments

Seems that doing a self join will build a query that won't work in Clickhouse:

image

sql: image

Code: 352. DB::Exception: Ambiguous column 'ecommerce.ecommerce_sanitized.event_time': While processing ecommerce.ecommerce_sanitized.event_time AS event_time. (AMBIGUOUS_COLUMN_NAME) (version 23.7.4.5 (official build))
, server ClickHouseNode [uri=http://clickhouse:8123/ecommerce, options={use_server_time_zone_for_dates=true,use_no_proxy=false,product_name=metabase/1.2.1}]@581467449

But in postgres it will work: image


SELECT "public"."people"."id" AS "id", "public"."people"."address" AS "address", "public"."people"."email" AS "email", "public"."people"."password" AS "password", "public"."people"."name" AS "name", "public"."people"."city" AS "city", "public"."people"."longitude" AS "longitude", "public"."people"."state" AS "state", "public"."people"."source" AS "source", "public"."people"."birth_date" AS "birth_date", "public"."people"."zip" AS "zip", "public"."people"."latitude" AS "latitude", "public"."people"."created_at" AS "created_at", "People"."id" AS "People__id", "People"."address" AS "People__address", "People"."email" AS "People__email", "People"."password" AS "People__password", "People"."name" AS "People__name", "People"."city" AS "People__city", "People"."longitude" AS "People__longitude", "People"."state" AS "People__state", "People"."source" AS "People__source", "People"."birth_date" AS "People__birth_date", "People"."zip" AS "People__zip", "People"."latitude" AS "People__latitude", "People"."created_at" AS "People__created_at"
FROM "public"."people"
LEFT JOIN "public"."people" AS "People" ON "public"."people"."id" = "People"."id"
LIMIT 1048575

EDIT: using 47-RC3 and latest clickhouse driver

paoliniluis avatar Aug 14 '23 19:08 paoliniluis

how much work is this to fix given this bug has been around so long? we run salesforce reports in metabase, and it would help if we could join the "Account.ParentId" to the same table "Account.Id" .

camerondavison avatar Feb 19 '25 19:02 camerondavison