Skip to content

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

@jankatins

Description

@jankatins

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")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions