metabase icon indicating copy to clipboard operation
metabase copied to clipboard

Columns Renamed in Model Metadata aren't Propagated to Downstream Questions in Some Cases

Open ixipixi opened this issue 3 months ago • 3 comments

Describe the bug

If you create a model and rename the columns in model metadata any renamed columns on the right side of the join display the original names in downstream questions.

To Reproduce

  1. Create a model in v56 with Orders + People (select a column or 2 from each table)
  2. Rename the columns in model metadata
  3. Now build a question using the model as a source
  4. Note that while building the question the names show up as expected in the notebook, in the resulting viz and in any tooltips
  5. Save the question
  6. Note the everything still appears to be correct
  7. Refresh (or add it to a dashboard)
  8. Note that only renamed columns from the first table in the question definition still show the names defined in model metadata

https://www.loom.com/share/3025c254bd5840f8907bcc9dc7d08430?sid=0de654ab-6dcd-4088-b76b-3e7e6ac5cb35

Expected behavior

The renamed column titles should be displayed downstream of the model in questions, tooltips, etc.

Logs

No response

Information about your Metabase installation

{
  "browser-info": {
    "language": "en-US",
    "platform": "Win32",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36",
    "vendor": "Google Inc."
  },
  "metabase-info": {
    "databases": [
      "postgres",
      "h2"
    ],
    "run-mode": "prod",
    "plan-alias": "enterprise-self-hosted",
    "version": {
      "date": "2025-10-06",
      "tag": "v1.56.8.7",
      "hash": "4392601"
    },
    "settings": {
      "report-timezone": null
    },
    "hosting-env": "unknown",
    "application-database": "postgres",
    "application-database-details": {
      "database": {
        "name": "PostgreSQL",
        "version": "15.1 (Debian 15.1-1.pgdg110+1)"
      },
      "jdbc-driver": {
        "name": "PostgreSQL JDBC Driver",
        "version": "42.7.7"
      }
    }
  },
  "system-info": {
    "file.encoding": "UTF-8",
    "java.runtime.name": "OpenJDK Runtime Environment",
    "java.runtime.version": "21.0.8+9-LTS",
    "java.vendor": "Eclipse Adoptium",
    "java.vendor.url": "https://adoptium.net/",
    "java.version": "21.0.8",
    "java.vm.name": "OpenJDK 64-Bit Server VM",
    "java.vm.version": "21.0.8+9-LTS",
    "os.name": "Linux",
    "os.version": "5.15.167.4-microsoft-standard-WSL2",
    "user.language": "en",
    "user.timezone": "GMT"
  }
}

Severity

defeats the purpose of a model

Additional context

Reproduced in Stats. Couldn't reproduce in v55.

ixipixi avatar Oct 07 '25 21:10 ixipixi

This sounds like we're failing to match up the overridden model metadata with the inner query's columns, when they're on the RHS of a join.

I'll follow the repro and debug into where we're losing the updated column info.

bshepherdson avatar Oct 17 '25 16:10 bshepherdson

One additional point, the ordering of the columns via the model metadata is also not respected in the tooltip.

flynfish avatar Oct 20 '25 21:10 flynfish

This appears to be partially fixed on master. With rhs model column names of "Orders → ID new", "Orders: Total", and "Orders Quantity", the resulting question gets column names of "Orders → ID", "Orders → Orders: Total", and "Orders → Orders Quantity". "Orders → ID new" gets ignored because it includes a → in it, which can be fixed. Not including the extraneous "Orders → " when the model itself includes a join is likely somewhat trickier -- I'm still investigating.

wzimrin avatar Nov 05 '25 19:11 wzimrin