How to join() a mysql column as a tag not a field


I have a flux script that joins an influxdb table with a MySQL table. This works fine and returns a table with an additional column from the MySQL table included in the influxdb table.

My problem is that for each table returned, when I go to plot each series in a Grafana time series panel I’m unable to set the display name of the series based on the MySQL column that was added to the merged table. For existing tags from the original influxdb table, I can use these as the series ‘display name’. So how do I do a join where the joined column is viewed as a tag?

import "sql"
import "influxdata/influxdb/secrets"

tsData = from(bucket: "data")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "electricity")
|> aggregateWindow(fn: mean, every: 1d, createEmpty: false)

META_DB = secrets.get(key: "influx_meta_db")
meter_meta = sql.from(
driverName: "mysql",
dataSourceName: "${META_DB}",
query: "SELECT meter_id, name FROM meter LEFT OUTER JOIN Area ON meter.area_id = Area.area_id "
joined = join(tables: {t1: tsData, t2: meter_meta}, on: ["meter_id"])
|> yield(name: "joined")

This returns a table where the name column from the MySQL is joined to the influxdb table. But this appears to be added as a field. But in the ‘display name’ property of the time series panel in grafana I’m unable to reference the column to render it as the series name.

I feel like I’m not going about this the right way and any guidance would be much appreciated.