Binning option not showing

Hi there,

I have a numeric field (integer in the database) which is not giving me the option to bin the results.
I have chosen to summarise my results by count of this field and intended to bin the data. But there is not bin option showing on this line.
Is there a particular setup I should be aware of that I'm missing in order to get this functionality on a field like this?

Hi @ed.s
Post "Diagnostic Info" from Admin > Troubleshooting.
And include the field metadata by going to the URL /api/field/123, where 123 is the field ID, which you can find by going to Admin > Data Model > (db) > (table) > (field) :gear: > look in the URL .../123/general

1 Like

Table URL is

database/2/table/61/602/general

{
  "browser-info": {
    "language": "en-GB",
    "platform": "MacIntel",
    "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36",
    "vendor": "Google Inc."
  },
  "system-info": {
    "file.encoding": "UTF-8",
    "java.runtime.name": "OpenJDK Runtime Environment",
    "java.runtime.version": "1.8.0_332-heroku-b09",
    "java.vendor": "Oracle Corporation",
    "java.vendor.url": "http://java.oracle.com/",
    "java.version": "1.8.0_332-heroku",
    "java.vm.name": "OpenJDK 64-Bit Server VM",
    "java.vm.version": "25.332-b09",
    "os.name": "Linux",
    "os.version": "4.4.0-1103-aws",
    "user.language": "en",
    "user.timezone": "Etc/UTC"
  },
  "metabase-info": {
    "databases": [
      "postgres",
      "h2"
    ],
    "hosting-env": "heroku",
    "application-database": "postgres",
    "application-database-details": {
      "database": {
        "name": "PostgreSQL",
        "version": "13.6 (Ubuntu 13.6-1.pgdg20.04+1+b1)"
      },
      "jdbc-driver": {
        "name": "PostgreSQL JDBC Driver",
        "version": "42.3.2"
      }
    },
    "run-mode": "prod",
    "version": {
      "tag": "v0.43.1",
      "date": "2022-05-16",
      "branch": "release-x.43.x",
      "hash": "7f1a1c4"
    },
    "settings": {
      "report-timezone": null
    }
  }
}

For clarity, I have also changed the semantic type several times to no avail. (Score, quantity, cost etc)

@ed.s Post the metadata output of the field by going to the URL /api/field/602

{

* description: null,

* database_type: "int4",

* semantic_type: "type/Score",

* table_id: 61,

* coercion_strategy: null,

* table:{
  * description: null,

  * entity_type: "entity/GenericTable",

  * schema: "public",

  * db:{
    * description: null,

    * features:[
      * "full-join",

      * "basic-aggregations",

      * "nested-field-columns",

      * "standard-deviation-aggregations",

      * "expression-aggregations",

      * "percentile-aggregations",

      * "foreign-keys",

      * "right-join",

      * "left-join",

      * "native-parameters",

      * "nested-queries",

      * "expressions",

      * "set-timezone",

      * "regex",

      * "case-sensitivity-string-filter-options",

      * "binning",

      * "inner-join",

      * "advanced-math-expressions"],

    * cache_field_values_schedule: "0 0 23 * * ? *",

    * timezone: "UTC",

    * auto_run_queries: true,

    * metadata_sync_schedule: "0 23 * * * ? *",

    * settings: null,

    * caveats: null,

    * creator_id: null,

    * is_full_sync: true,

    * updated_at: "2021-11-19T22:50:41.262303Z",

    * cache_ttl: null,

    * details:{

      * port: 5432,

      * ssl: true,

      * additional-options: null,

      * tunnel-enabled: false},

    * is_sample: false,

    * id: 2,

    * is_on_demand: false,

    * options: null,

    * engine: "postgres",

    * initial_sync_status: "complete",

    * refingerprint: null,

    * created_at: "2021-11-17T21:42:03.283057Z",

    * points_of_interest: null},

  * show_in_getting_started: false,

  * name: "posts",

  * caveats: null,

  * updated_at: "2022-05-16T11:38:56.235619Z",

  * active: true,

  * id: 61,

  * db_id: 2,

  * visibility_type: null,

  * field_order: "database",

  * initial_sync_status: "complete",

  * display_name: "Posts",

  * created_at: "2021-11-17T21:44:42.888786Z",

  * points_of_interest: null},

* name: "int_cost_per_engagement",

* fingerprint_version: 5,

* has_field_values: "list",

* settings: null,

* caveats: null,

* fk_target_field_id: null,

* dimensions: [ ],

* updated_at: "2022-05-17T13:36:38.702146Z",

* custom_position: 0,

* effective_type: "type/Integer",

* active: true,

* nfc_path: null,

* parent_id: null,

* id: 602,

* last_analyzed: "2021-11-17T21:45:15.158059Z",

* position: 72,

* visibility_type: "normal",

* preview_display: true,

* display_name: "Int Cost Per Engagement",

* database_position: 72,

* name_field: null,

* fingerprint:{
  * global:{
    * distinct-count: 1,

    * nil%: 1},

  * type:{
    * type/Number:{
      * min: null,

      * q1: null,

      * q3: null,

      * max: null,

      * sd: null,

      * avg: null}}},

* created_at: "2021-11-17T21:44:45.83566Z",

* base_type: "type/Integer",

* points_of_interest: null

}

@ed.s Metabase fingerprinted the field, when there were only null values.
Have a look at this issue, which gives you a workaround to re-running fingerprints:
https://github.com/metabase/metabase/issues/18074 - upvote by clicking :+1: on the first post

2 Likes

I was pretty certain I called for a re-scan the field values for the whole database and did it again for the specific table. I will run them again and let you know.

Thank you for your help

@ed.s The analysis process is multiple sub-processes. Sync, fingerprinting and scan. They all do different things, and to most people they call all three "sync", which makes it difficult for me to debug sometimes. We're getting into the more complex parts of Metabase, so it's a lot more technical.

1 Like

For clarity then, I've looked at that issue and as I have a self hosted version, should I drop the field fingerprint or use a combination of 're-scan' and 'sync schema'?

@ed.s I'm scared when you write "drop". It means something a lot more destructive in databases.
You should update as the SQL snippet shows, so Metabase can do a new fingerprint, when it syncs again.
Scanning is completely unrelated here. Sync is what triggers fingerprinting.

1 Like

Sorry, I meant this part from the issue.

I have asked for a 'sync the database schema' in the meantime

@ed.s If you have done it already, then you can check the fingerprinting data by going to /api/field/:id and look.

I'm clearly doing something wrong. I have rescanned the DB and have even discarded the cached field values and rescanned but still not seeing the fingerprint change. I have also gone into the DB and ran

UPDATE metabase_field
SET fingerprint = null, fingerprint_version = 0
WHERE id = 602

Fingerprint is now set to null and version to 0. I requested a rescan of the field, the table and db but nothing has changed.

@ed.s Okay. Scanning will not make any difference. Scanning is a completely different process. It has nothing to do with sync or fingerprinting.

You need to null your fingerprint, then run sync (Admin > Databases > db > Sync database schema now)

1 Like

That did it.
Sorry for being slow on this.
Really appreciate the help

I had the same problem, following workaround in PR worked for me