Integer as field type in Mysql, not auto-detected in Metabase

I have set a product_id field as a int in mysql. Metabase doesn’t auto-detect this.

The number that the query builder produces for this field is then noted as 1,876 instead of 1876.

I’m also not sure which special type I should select in Metabase, there is no choice for integer or ID.

  1. Is the non-auto-detect a bug or on purpose like this?
  2. Which special field type should I select for an ID field like this in Metabase?

Hi @nevil

Which version of Metabase?

If it is a Foreign Key reference to your products table, then set it as such, but you need to set products.id to Entity Key, if it isn’t already. This would automatically be done if your database has PK and FK defined already.

I guess it failed auto-detect, since it has ..._id in the name, but couldn’t find any references. It’s auto, not magic :slight_smile:

If you want to show it as an integer, then set Field Type to Number and click :gear: to define formatting.

Hi Flamer,

Thanks for your help. I’m using version v0.32.1

The product_id field actually isn’t the primary key, but also not a foreign key. It doesn’t point to another table in the database.

Changing it to a number just changes it from 1,876 to 1.876. But I want it as 1876. Is there another field type I can use? Either in my own database or in Metabase?

Click the :gear: and then you have Formatting as menu option to the left
And upgrade to 0.32.2 - it fixes some minor issues.

Not sure my upgrade worked, it still says version 0.32.1. It also says that it’s the latest version.

What I did:

  1. docker pull metabase/metabase:latest
  2. docker kill ps -q
  3. reboot
  4. docker start metabase

I’m not a developer so I’m not entirely sure if I did it correctly?

@nevil

I don’t use Docker, but you need to stop and remove the old image:
https://ma.ttias.be/update-docker-container-latest-version/ - generic guide
You can list images available with docker images.

Remember to make backups before upgrading.