ARRAY_TO_STRING() works with string arrays but is not supported with integer arrays.
I have a repeated column that contains a list of IDs, I want to export this from a US dataset to an EU dataset. So far I'm using
bq query --nouse_legacy_sql --allow_large_results --max_rows=100000000000 --format=csv < {sql_file} > {output_file} but this does not work with nested columns as CSV does not support them.
Another option is exporting as json but I would need to convert this to newline JSON. I could use jq to convert this but it is not installed on the server by default.
Instead of that, I'm going down the path of flattening repeated columns before export. What I think I need to do is convert every element in the array to string and then use ARRAY_TO_STRING(). Am I going down the right path here?
I believe I want something similar to
SELECT ARRAY_TO_STRING(ARRAY((SELECT CAST(* AS STRING)), ';') FROM UNNEST(segments)) FROM my_table
but this gives me Syntax error: Unexpected "*" as it should. Any ideas?