cube-js / cube-js/cube

ClickHouse enforces timestamptz

Open
#10,289 2 comments 1 reaction 1 assignee Claimed by @igorlukanin View on GitHub
driver:clickhouse question
Dominant language
Rust
Stars
20.8k
Forks
2.1k
Avg merge
1d 2h
Merged PRs (30d)
181

Description

**Describe the bug**
Working with `Date` types from ClickHouse doesn't work, and `timestamptz` is always enforced even though it's not supported.

**To Reproduce**
Create a ClickHouse table with a `Date` column:
```sql
CREATE TABLE series (
date Date,
);
```

Create Cube.js model, as pasted below.

Then, query the date column, for example:
```json
{
"dimensions": [
"series.date"
]
}
```

You will see an error:
```
Query failed: Error: Unknown data type family: timestamptz. Maybe you meant: ['TIMESTAMP']:
```

Indeed, the generated SQL is as follow:
```sql
SELECT
timezone('UTC', "series".date :: timestamptz) "series__date"
FROM
series AS "series"
GROUP BY
1
ORDER BY
1 ASC
LIMIT
10000
```

**Expected behavior**
A clear and concise description of what you expected to happen.

**Minimally reproducible Cube Schema**

```javascript
cube("Series", {
data_source: "clickhouse",

sql: `
SELECT * FROM series
`,

dimensions: {
date: {
type: "time",
sql: "date",
},
},
});

```

**Version:**
1.6.1

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.