pyrooka / metabase-cubejs-driver

Connect Metabase with Cube.js.
GNU Affero General Public License v3.0
4 stars 6 forks source link

Relative Date Conversios/Inheritance for Query Builder #45

Open norbertbede opened 4 years ago

norbertbede commented 4 years ago

Use Case. Let say I have field dateordered. I select “orderfacts” table - open in query builder, group by dateordered then select Month of year. Error “month-of-year granularity not supported by Cube.js”.

Test Result: Fall - any of relative driver doesn't works, not implemented yet.

quarter-groupby-date

I have asked @PavelTiunov slack chat

As a rule of a thumb formatting is usually client side problem. probably related topic: https://github.com/cube-js/cube.js/issues/177

As get help I made a forum thread in Metabase forum https://discourse.metabase.com/t/month-of-year-api-for-driver-implementation/9102

The Question: ATM we can’t find way how to convert datefield to relative date formats in metabase driver. (postgres can do this by “commands” Mon, NM, dy, DD, WW…etc. ). We are looking for example code, how to improve the cubejs driver or API doc for handling relative date in driver. (convert/inherit relative dates from a simpe datetime field.) - avoid generate unnecessary fake dimensions.

norbertbede commented 4 years ago

Meanwhile i found the above piece code in metabase google analytics driver. https://github.com/metabase/metabase/blob/master/modules/drivers/googleanalytics/src/metabase/driver/googleanalytics/query_processor.clj

then confirmed on google page https://ga-dev-tools.appspot.com/dimensions-metrics-explorer/?#ga:week

pyrooka commented 4 years ago

This is fixed in your PR #47 , right?

igorpojzl commented 4 years ago

I think this issue is about special granularities eg. (Month of Year, Week of Year) and not Relative DateTime in filter.

pyrooka commented 4 years ago

You are right, my bad.