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

Lookup Tables #6009

Open
nickcarenza opened this Issue Sep 19, 2017 · 6 comments

Comments

Projects
None yet
3 participants
@nickcarenza
Copy link

nickcarenza commented Sep 19, 2017

This feature request is for the ability to create static lookup tables that I can use to map values in query results to end-user friendly names.

A basic implementation would allow me to create a static table for lookups managed by Metabase and allow me to use it when displaying query results.

An advanced implementation would allow me to connect to a json api to use for mapping. For example: http://some-json-api/users or then map $.id to $.name using json path syntax OR http://some-json-api/users/{{user_id}} and map to $.name.

[{
  "id": "361d6a1e-0deb-492e-b7c2-5309195e1c5a",
  "name": "john smith"
}]

My Specific Use Case:
The database I am connecting to uses UUIDs for user accounts that exist in a separate database not accessible from Metabase. The reporting system I am trying to replace queries the json api for users and then maps them client-side. It would be sufficient to support mapping values client-side from a static lookup table managed by Metabase.

@nickcarenza

This comment has been minimized.

Copy link
Author

nickcarenza commented Sep 19, 2017

For now, I am accomplishing this by creating a massive case statement which works.

@jornh

This comment has been minimized.

Copy link
Contributor

jornh commented Sep 19, 2017

Sounds like either #3454 or #2657 delivered as part of https://github.com/metabase/metabase/releases/tag/v0.25.0 could help towards what you want? Implemented in a different way though.

The enum lookup requires you to add the names for the ids in the admin UI. The foreign key lookup would require you to expose your current case statement as another database table.

Update ah - here's the relevant section of the admin guide - though I saw the pictures explaining those features somewhere 😄 just couldn't remember where ... http://www.metabase.com/docs/latest/administration-guide/03-metadata-editing.html#remapping-field-values

@nickcarenza

This comment has been minimized.

Copy link
Author

nickcarenza commented Sep 20, 2017

thanks @jornh.

Another option is custom remapping, which is currently only possible for numeric fields.

that is an unfortunate limitation as we have decided to use UUIDs instead of integers. there's also hundreds of items and this could be quite tedious to do through the ui but i could probably just interact with the db directly to do it faster.

either way, thank's for the info.

@salsakran

This comment has been minimized.

Copy link
Contributor

salsakran commented Sep 25, 2017

we're planning on extending remappings to strings as well, and you can always just use our API to bulk update them vs doing it manually.

@nickcarenza

This comment has been minimized.

Copy link
Author

nickcarenza commented Sep 26, 2017

Ok, great thanks. I didn't even know there was an api.

@salsakran

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.