Split Column into multiple columns

  • What Grafana version and what operating system are you using? 10.0.1

  • What are you trying to achieve?

I am new to Grafana and I am using a POSTGRES DB as the data source. Within the POSTGRES DB, there is a table with a column named “distName” that I would like to split into multiple columns using the delimiter “/”.

Below is an example of the “distName” column:

distName
/BTS/BTS/LNBTS-1000/LNCEL-1/LTE1309a
/BTS/BTS/LNBTS-2000/LNCEL-1/LTE1200a
/BTS/BTS/LNBTS-3000/LNCEL-3/LTE1800a

I want to split the “distName” column into five columns: distName1, distName2, Node, Cell, and ID.

  • How are you trying to achieve it?

I looked at the Transformation, but not able to figure out a way to split the columns.

  • What happened?

  • What did you expect to happen?

  • Can you copy/paste the configuration(s) that you are having problems with?

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

  • Did you follow any online instructions? If so, what is the URL?

Thank you for your help.

I changed your input to below to get the query I want

SELECT
REVERSE(SPLIT_PART(REVERSE(“distName”), ‘/’, 1)) AS id,
REVERSE(SPLIT_PART(REVERSE(“distName”), ‘/’, 2)) AS Cell,
REVERSE(SPLIT_PART(REVERSE(“distName”), ‘/’, 3)) AS eNodeB,
REVERSE(SPLIT_PART(REVERSE(“distName”), ‘/’, 4)) AS Node

Thank you!

1 Like