ClickHouse / metabase-clickhouse-driver

ClickHouse database driver for the Metabase business intelligence front-end
Apache License 2.0
479 stars 92 forks source link

Request error when filtering by field #47

Closed sergeymong closed 1 year ago

sergeymong commented 4 years ago

Hi!, Thank you very much for your work. We have 2 types of tables, some are called through snake_case, others through dot.case. When you do a filter by dot.case table, you get this error (this is part of traceback):

Code: 47, e.displayText() = DB::Exception: Missing columns: 'replicated.backend.booking.issuing.success.date' while processing query: 'SELECT date, datetime, client_id, visit_id, agent, tag, ab_tag, token, order_number, email, account_id, phone, order_total, tickets_total, cross_total, payment_type, amount_insurance, amount_fly_sms, amount_refund, amount_coverage, amount_online_registration, amount_vip, departure_iata_code, arrival_iata_code, departure_date, return_date, passengers, adults, childs, infants, cabin_class, x_request_id, profit, bonus_use_amount, bonus_from_order_amount, marker, `segments.segment_index`, `segments.ticket_index`, `segments.gds_pnr`, `segments.airline_pnr`, `segments.part_index`, `segments.departure_code`, `segments.arrival_code`, `segments.departure_time`, `segments.arrival_time`, `segments.flight_time_mins`, `segments.operating_carrier`, `segments.marketing_carrier`, `segments.plating_carrier`, `segments.marketing_flight_number`, `segments.booking_class` FROM replicated.`backend.booking.issuing.success` WHERE (toDate(replicated.backend.booking.issuing.success.date) >= '2020-01-01') AND (toDate(replicated.backend.booking.issuing.success.date) <= '2020-01-31') LIMIT 100

You can see that the point is that there are no necessary backquotes in toDate function. Is it possible to fix this problem, please?

sergeymong commented 4 years ago

Also has problem with Materialized View's .inner tables. Traceback:

Code: 62, e.displayText() = DB::Exception: Syntax error: failed at position 183 (line 4, col 27): ``.`inner`.`by_airline`.`search_date`) BETWEEN '2020-07-01' AND '2020-07-31'\nLIMIT

Query:

SELECT count()
FROM directions.`.inner.by_airline`
WHERE {{ search_date }}
LIMIT 100
enqueue commented 4 years ago

Hi @sergeymong thank you for reporting this issue. Which version are you running?

sergeymong commented 4 years ago

If you are asking about the Metabase version, it is 0.34.3. Driver version: 0.7.

julienmarie commented 4 years ago

Encountering the same issue on filtering

slvrtrn commented 1 year ago

Re-tested it with 1.2.0; both cases work fine now. Likely, this should be the case with 1.1.7 as well. Please open a new issue if the problem persists.