Closed jovezhong closed 2 years ago
Well, I realized things are more complicated than that. The columns of dbt_alice.customers are fairly odd
SHOW CREATE TABLE customers
Query id: ccf8a564-36d4-4b51-ae5a-24286beb2d15
┌─statement───────────────────────────────────────────────────────────────────────┐ │ CREATE TABLE dbt_alice.customers (
customers.customer_id
Int32,customers.first_name
String,customers.last_name
String,customer_orders.first_order
Date,customer_orders.most_recent_order
Date,customer_orders.number_of_orders
UInt64,customer_lifetime_value
Float64 ) ENGINE = MergeTree ORDER BY tuple() SETTINGS index_granularity = 8192
It seems that Clickhouse just uses the selected columns from different join tables as the new table names. Maybe the dbt-clickhouse adapter need to add alias for the columns
WITH
final as (
select
customers.customer_id,
customers.first_name,
customers.last_name,
customer_orders.first_order,
customer_orders.most_recent_order,
customer_orders.number_of_orders,
customer_payments.total_amount as customer_lifetime_value
from customers
left join customer_orders
on customers.customer_id = customer_orders.customer_id
left join customer_payments
on customers.customer_id = customer_payments.customer_id
)
select * from final
So
There are only 3 errors.
I think this because clickhouse use a full name for column with a dot. So jaffle_shop
should use alias for columns in the final query for support a database like CH.
If want you can open issue in jaffle_shop
.
Greetings, I am running the
jaffle_shop
dbt example.dbt seed
anddbt run
passed butdbt test
failed.The dbt_project.yml
via the dbt.log, it broke because it fails to run query like this
select * from dbt_alice.customers where customer_id is null
Error log
If I wrap the column name with `(tableName).` it works in Clickhouse client select * from dbt_alice.customers where `customers.customer_id` is null
Please consider fixing this. Thanks