Alias of a query and how to add queries in bulk when DataSource is mysql

Hello everyone,
My grafana’s version is 10.4.2, my grafana’s datasource is mysql, it stored the power consumption per minute of over 200 cabinets, so I used ‘Time series’ to display them. Now I have two questions that I hope you can help me with.
1.The name displayed of the data taken out on the panel is the column name of the power_consumption by default. How can I change this name to the cabinet_id searched by sql statement?
2.Normally, one query must be added to each cabinet. Can I add more than 200 cabinets in batches? Or can I use a script?

The data format is as follows, hope can get help from here, thanks a lot

select timestamp as [time], 
cabinet_id as metric, 
power_consumption as value
from vader

and make sure the Format selected right by the query in gragana ui is Time Series

I tried it, but the name changed to string ‘value’, not real value.

Hope to get your response!

  1. the query looks different than the data you originally provided and its blurry

  2. the Format you are using says Table right above the query

The data format of the two tables is actually the same. Thank you very much for your help, otherwise I could not have noticed this oversight.

so is your issue solved?

Yes, thanks a lot.