Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to model measure as an attribute (and bug for attributes of Type.ID) #8

Open
jankatins opened this issue Dec 8, 2020 · 1 comment

Comments

@jankatins
Copy link
Member

jankatins commented Dec 8, 2020

Metabase allows measure columns (so something with an order, like revenue per hour) to be used in Groupings by binning it. Unfortunately, mara-schema (together with mara-metabase) currently does not allow this, as measure columns are hidden in each sync. To work around this, I can precompute the bins and add this as an Type.ENUM Attribute, but this removes the flexibility metabase gives me to chose my own bins during the analysis as it's converted to a string.

One could currently use Type.ID for this, as, despite the docs saying so, it is not converted to TEXT:

Type.ID: A numeric ID that is converted to text in a flattened table so that it can be filtered

but in the code: cast_to_text=attribute.type == Type.ENUM

My first guess is that the the docs correct and the code incorrect here and this inconsistency should be fixed.

If so, I would like to request a Type.BINNED or Type.QUANTITY or so which is not converted to TEXT during SQL generation for metabase.

Any other idea?

(Example: in our case it's for "measures" like "revenue per hour" which I precompute and put into a column: other examples could be "xth order" or simply "number if items in order")

@jankatins
Copy link
Member Author

jankatins commented Jan 24, 2021

Another issue here: If I send stuff over to metabase as ID (to not cast it as TEXT), metabase, autoassigns a type to it. It would be nice if mara-metabase could use this to assign "Quantity" to it, because that gets you binning (if the values have not a big range, it seems they get Category assigned and so no binning...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant