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

Supporting metabase "Display values" for foreign keys (/api/field/XXX/dimension) #184

Closed
janmechtel opened this issue Oct 17, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@janmechtel
Copy link

In metabase admin > Table Metadata one can choose to display a value from the

Display values
Choose to show the original value from the database, or have this field display associated or custom information.

If metabase know of the columns relation to another table via foreign/primary key...
... there are usually two options:

  1. Use Original Value - which display for example the ID (this is usually the metabase type Entity Key in the Primary Key's table)
  2. Use Foreign key - which shows a second dropdown from where one can chose which field to display, it defaults to the field that has the metabase type Entity Name

Ideally I'd like to set this "dimension" via the .yml:

          metabase.semantic_type: type/FK
          metabase.fk_target_table: schema.entities
          metabase.fk_target_field: entity_id
          metabase.display_field: entity_name 

This would indicate to display the column called entity_name .

This would require a POST https://metabase.domain.com/api/field/20000/dimension with the payload:

{"type":"external","name":"Name","human_readable_field_id":25000}

Removing reqiores a DELETE toward /api/field/20000/dimension

Questions:

  1. Whether this functionality already exists? I suspect not because I didn't find any code mentioning dimension
  2. Would you consider giving me pointers how to add this?
@janmechtel janmechtel changed the title Supporting metabase dimension Supporting metabase "Display values" for foreign keys (/api/field/XXX/dimension) Oct 17, 2023
@gouline
Copy link
Owner

gouline commented Oct 17, 2023

Does not currently exist. Have a look at existing fields (like display_name) for how to add it to the metadata. Since it requires a separate API call though, you'll have to figure out where that lives against the existing calls.

@gouline gouline added the enhancement New feature or request label Oct 17, 2023
@gouline gouline closed this as not planned Won't fix, can't repro, duplicate, stale Jan 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants