I've tried using snowflake's flatten, but it doesn't work, so I'm asking.
Example data
| id | array string |
|---|---|
| 1 | [10001,100000][10003,100000000][10004,10000][10006,100] |
I want
| id | array string |
|---|---|
| 1 | [10001,100000] |
| 1 | [10003,100000000] |
| 1 | ..... |
SELECT
id,
'[' || c.value::string AS "array string"
FROM data d,
LATERAL FLATTEN(input=>split(d."array string", '[')) c;
should work, as you are splitting on the open array token, and thus need to put it back in the output.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With