cube-js / cube-js/cube

Time dimension returns [object Object] values from mssql

Open
#9,488 20 comments 4 reactions 1 assignee Claimed by @igorlukanin View on GitHub
driver:mssql help wanted
Dominant language
Rust
Stars
20.8k
Forks
2.1k
Avg merge
1d 2h
Merged PRs (30d)
181

Description

**Problem**
I have a problem with time type with MSSQL source database. In playground I got [object Object] result instead of real dates values.
I am using:
- MSSQL 2019
- Latests Cube Core Docker Image

![Image](https://github.com/user-attachments/assets/992558bf-d060-45e7-9f2f-30d4daae49dc)

The generated script works fine and returns values.

![Image](https://github.com/user-attachments/assets/85296715-8cba-4ef9-8649-4a7a5c128301)

My cube yaml:
```yaml
cubes:
- name: cube_mes_supply
sql_table: cube.v_mes_supply
data_source: dwh_reporting_development

joins:
- name: dim_document_status
relationship: many_to_one
sql: "{cube_mes_supply}.ATTB = {dim_document_status.operation_id}"

dimensions:
- name: id
sql: id
type: number
primary_key: true

- name: company_guid
sql: COMPANY
type: string

- name: mars_reason
sql: mars_reason
type: string

- name: is_cross_docking
sql: IS_CROSS_DOCKING
type: boolean

- name: create_date
sql: create_datetime
type: time

- name: test_datetimeoffset
sql: test_datetimeoffset
type: time

measures:
- name: count
type: count

- name: quantity
sql: Quantity
type: sum

- name: amount_rub
sql: Amount_Rub
type: sum

pre_aggregations:
- name: marsReasonIsCrossDockingMeasure
measures:
- amount_rub
- quantity
dimensions:
- mars_reason
- is_cross_docking
refreshKey:
every: 10 minute
```
I think that the problem is that MSSQL returns DATETIMEOFFSET type with nanoseconds.
How can I fix that?

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.