cube
cube copied to clipboard
graphQL 、 RestFul ===》 Query different(timezone: "Asia/Shanghai")。
Problem graphQL 、 RestFul ===》 Query different(timezone: "Asia/Shanghai")。 The return time is inconsistent: for example: rest "store.stats_date":"2023-05-10T00:00:00.000" graphQL "stats_date":{"value":"2023-05-09T16:00:00.000Z"}
How do I get them back on the same page, like the REST?
** rest **
{
"measures": [
"store.sales_qty"
],
"order": {
"store.sales_qty": "desc"
},
"dimensions": [
"store.store_id",
"store.stats_date"
],
"timezone": "Asia/Shanghai",
"filters": [
{
"member": "store.store_id",
"operator": "equals",
"values": [
"1668"
]
},
{
"member": "store.stats_date",
"operator": "inDateRange",
"values": [
"2023-05-10",
"2023-05-11"
]
}
]
}
"data":[{"store.store_id":"1668","store.stats_date":"2023-05-10T00:00:00.000","store.sales_qty":"12"},{"store.store_id":"1668","store.stats_date":"2023-05-11T00:00:00.000","store.sales_qty":"10"}]
** graphQL **
query CubeQuery {
cube(
where: {store: {store_id: {equals: 1668 } , stats_date: {inDateRange: ["2023-05-10", "2023-05-11"]}}}
timezone: "Asia/Shanghai"
) {
store(orderBy: {sales_qty: desc}) {
sales_qty
store_id
stats_date {
value
}
}
}
}
{"data":{"cube":[{"store":{"sales_qty":12,"store_id":1668,"stats_date":{"value":"2023-05-09T16:00:00.000Z"}}},{"store":{"sales_qty":10,"store_id":1668,"stats_date":{"value":"2023-05-10T16:00:00.000Z"}}}]}}
Hey @TaoPanfeng, could you please try to use timeDimensions for the REST API query format? Cube will automatically convert timezones for timeDimensions fields in queries.
It's been a week. Please, look at this problem. (已经过去一周了,求求您,看一下这个问题。)
https://github.com/cube-js/cube/issues/7666