Slackbot
11/30/2023, 1:22 PMJulian Reyes
11/30/2023, 1:28 PMJulian Reyes
11/30/2023, 2:48 PM{
"type": "cascade",
"dimension": "network",
"outputName": "network",
"extractionFns": [
{
"type": "regex",
"expr": "([g,G][a,A][s,S]).*"
},
{
"type": "stringFormat",
"format": "[%s API]"
}
]
}Laksh Singla
11/30/2023, 3:11 PMcase_searched under the hood.
SELECT
CASE WHEN network = 'gas.5' THEN 'Gas API' ….. ELSE network AS transformedColumn
FROM tableJulian Reyes
11/30/2023, 3:11 PMLaksh Singla
11/30/2023, 3:12 PMLaksh Singla
11/30/2023, 3:12 PMcase_searched(expr1, result1, [[expr2, result2, ...], else-result]) is similar to CASE WHEN expr1 THEN result1 [ELSE else_result] END in SQLLaksh Singla
11/30/2023, 3:12 PMJulian Reyes
11/30/2023, 3:12 PMJulian Reyes
11/30/2023, 3:14 PMgas.5 is an example, there are plenty of them and ideally new ones could come in so need to add them for every single combination if it is the same as CASE .. WHEH .. THEN .. ENDJulian Reyes
11/30/2023, 3:14 PMLaksh Singla
11/30/2023, 3:14 PMJulian Reyes
11/30/2023, 3:15 PMgas.X where X is a numberJulian Reyes
11/30/2023, 3:15 PMLaksh Singla
11/30/2023, 3:20 PMJulian Reyes
11/30/2023, 3:21 PMLaksh Singla
11/30/2023, 3:21 PMLaksh Singla
11/30/2023, 3:22 PMJulian Reyes
11/30/2023, 3:23 PMLaksh Singla
11/30/2023, 3:24 PMJulian Reyes
11/30/2023, 3:31 PM"virtualColumns": [
{
"type": "expression",
"name": "virtual_network",
"expression": "case_searched(like(\"network\",'gas.%'),'Gas API',\"network\")",
"outputType": "STRING"
}
]
"dimensions": [
{
"type": "default",
"dimension": "method",
"outputName": "method"
},
{
"type": "default",
"dimension": "virtual_network",
"outputName": "network"
},
],