select
t.*,
j.`single_value`
from
database_name.`table_name` as t
inner join
json_table(
json_array(t.`csv_source_field_name`)
'$[*]'
columns (
`single_value` varchar(50)
path '$'
)
) as j
;
select
t.*,
j.`single_value`
from
database_name.`table_name` as t
inner join
json_table(
json_array(t.`csv_source_field_name`)
'$[*]'
columns (
`single_value` varchar(50)
path '$'
)
) as j
;
select
table_alias.*
-- See how the field was split into several columns
-- (index, value, etc)
, flattened_alias.*
-- How to extract only the value
, TRIM(flattened_alias.value::string) as "flattened_value"
from
"database_name"."schema_name"."table_name" as table_alias
cross join
lateral flatten(
input => split(
table_alias."csv_source_field_name",
';' -- Separator
)
) as flattened_alias
;
for file in *.FILE_EXTENSION_IF_ANY
do
mv "$file" "STRING-TO-APPEND-${file}"
done