[SOLVED] Does Metabase support rename the table column name?

My Case is In China,Name the field(column) name in English in the database, but, for friendly display on the web page, we will rename it in Chinese.
So is there any way support me to rename the column name in the Metabase, or I have to rename the column name in the database?
It’s not only suport for the result, and for the filter and Grouping.

You can rename all the columns in the Data Model:


From 0.31, you can rename the columns in the questions:
image

2 Likes

This doesn’t work for me. I followed the procedure you described, renaming a column in the Data Model screen. However, when I use that column in creating a question, it still displays the original column name in the header. I tried clearing my browser cache, but that didn’t help.

I’m using version 0.37.0.2.

@bkonia Please post “Diagnostic Info” from Admin > Troubleshooting, and which database you’re using, and which type of question you’re creating.

{
  "browser-info": {
    "language": "en-US",
    "platform": "Win32",
    "userAgent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4309.0 Safari/537.36 Edg/88.0.698.0",
    "vendor": "Google Inc."
  },
  "system-info": {
    "file.encoding": "UTF-8",
    "java.runtime.name": "OpenJDK Runtime Environment",
    "java.runtime.version": "11.0.9+11",
    "java.vendor": "AdoptOpenJDK",
    "java.vendor.url": "https://adoptopenjdk.net/",
    "java.version": "11.0.9",
    "java.vm.name": "OpenJDK 64-Bit Server VM",
    "java.vm.version": "11.0.9+11",
    "os.name": "Linux",
    "os.version": "5.4.0-1018-aws",
    "user.language": "en",
    "user.timezone": "America/New_York"
  },
  "metabase-info": {
    "databases": [
      "mysql"
    ],
    "hosting-env": "unknown",
    "application-database": "h2",
    "application-database-details": {
      "database": {
        "name": "H2",
        "version": "1.4.197 (2018-03-18)"
      },
      "jdbc-driver": {
        "name": "H2 JDBC Driver",
        "version": "1.4.197 (2018-03-18)"
      }
    },
    "run-mode": "prod",
    "version": {
      "date": "2020-10-26",
      "tag": "v0.37.0.2",
      "branch": "release-x.37.x",
      "hash": "ba7be09"
    },
    "settings": {
      "report-timezone": "US/Eastern"
    }
  }
}

Database is MySQL and it doesn’t matter what type of question. It uses the original name generated by Metabase everywhere in the front end. For example, if I browse the table, it shows the original name in the column header, not the name I assigned in the Data Model screen.

@bkonia Please post the output of the data from one of the columns you have renamed. You’ll find the field ID in the URL, when going to Admin > Data Model > (database) > (table) > (field) :gear:
Example, where 83 would be the ID in this URL /admin/datamodel/database/4/table/11/83/general
And then post the output from /api/field/83

And migrate away from H2 if you’re using Metabase in production:
https://www.metabase.com/docs/latest/operations-guide/migrating-from-h2.html

{
	"description": null,
	"database_type": "TINYINT UNSIGNED",
	"table_id": 8,
	"table": {
		"description": null,
		"entity_type": "entity/GenericTable",
		"schema": null,
		"db": {
			"description": null,
			"features": [
				"basic-aggregations",
				"standard-deviation-aggregations",
				"expression-aggregations",
				"foreign-keys",
				"right-join",
				"left-join",
				"native-parameters",
				"nested-queries",
				"expressions",
				"set-timezone",
				"binning",
				"inner-join",
				"advanced-math-expressions"
			],
			"cache_field_values_schedule": "0 0 0 * * ? *",
			"timezone": "US/Eastern",
			"auto_run_queries": true,
			"metadata_sync_schedule": "0 0 * * * ? *",
			"name": "Clinical Match Me",
			"caveats": null,
			"is_full_sync": true,
			"updated_at": "2020-11-12T15:24:11.326",
			"details": {
				"ssl": false,
				"additional-options": null,
				"tunnel-enabled": false
			},
			"is_sample": false,
			"id": 2,
			"is_on_demand": false,
			"options": null,
			"engine": "mysql",
			"created_at": "2020-11-12T15:24:11.116",
			"points_of_interest": null
		},
		"show_in_getting_started": false,
		"name": "placements",
		"caveats": null,
		"updated_at": "2020-11-12T17:45:11.566",
		"entity_name": null,
		"active": true,
		"id": 8,
		"db_id": 2,
		"visibility_type": null,
		"field_order": "database",
		"display_name": "Placements",
		"created_at": "2020-11-12T15:24:15.47",
		"points_of_interest": null
	},
	"special_type": "type/FK",
	"name": "specialty_id",
	"fingerprint_version": 5,
	"has_field_values": "list",
	"settings": null,
	"caveats": null,
	"fk_target_field_id": 339,
	"dimensions": {
		"id": 1,
		"field_id": 123,
		"name": "Specialty ID",
		"type": "external",
		"human_readable_field_id": 340,
		"created_at": "2020-11-12T16:57:21.096",
		"updated_at": "2020-11-12T16:57:21.096"
	},
	"updated_at": "2020-11-12T18:50:46.4",
	"custom_position": 0,
	"active": true,
	"parent_id": null,
	"id": 123,
	"last_analyzed": "2020-11-12T15:24:42.694",
	"position": 5,
	"visibility_type": "normal",
	"preview_display": true,
	"display_name": "Specialty",
	"database_position": 5,
	"name_field": null,
	"fingerprint": {
		"global": {
			"distinct-count": 17,
			"nil%": 0.0
		}
	},
	"created_at": "2020-11-12T15:24:15.745",
	"base_type": "type/Integer",
	"points_of_interest": null
}

@bkonia Are you saying that the column is not called Specialty in the UI? Please show a screenshot of the column and question.

Yes, that’s exactly what I’m saying. Everywhere in the UI, the column is displayed as “Specialty ID”, not “Specialty”. I tried clearing my browser cache, restarting the Metabase process, etc… No matter what I do, it shows up as Specialty ID, unless I manually override it in the Label settings for a question.

@bkonia Are you using some reverse-proxy that has some type of cache?
https://www.metabase.com/docs/latest/troubleshooting-guide/proxies.html

If you rename “Status” to “NEWStatus”, then that is not applied correctly anywhere (besides in the Data Model) either?

What is your setting for Admin > Settings > General > “Friendly Table and Field Names” ?

  1. No reverse proxy, I’m connecting directly to the Metabase server locally, on port 3000.

  2. Interestingly, renaming other fields works fine. The problem seems to be specific to the Specialty ID field.

  3. Friendly Table and Field Names is enabled.

@bkonia Ahhhhh, now I see it, you’re seeing this issue:
https://github.com/metabase/metabase/issues/5558 - upvote by clicking :+1: on the first post
Workaround is to rename the field, when you click into the fields details :gear:

Yes, that worked. Thank you!