Skip to content
Advertisement

How do you swap two attributes in array column on Bigquery?

I have a table with two columns: group_id, students (Array of student). Each student have a two attribute: name and last_name. How do you swap name with last_name for each student?

I need to swapping students.name to students.last_name, any idea?

Advertisement

Answer

Finally, thanks to Mikhail Berlyant who answered this question (Update values in struct arrays in BigQuery), i was able to exchange attributes on update clause.

Too, i was able to exchange attributes on update clause with if condition for example.

It’s very important the position in the STRUCT, in my case name is first and last_name is second, for achieve the exchange just by changing its position the objective is achieved.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement