I’m loading JSON data into BigQuery. The JSON contains various structs which in turn contain a numnber of STRING fields. I can parse 99% of what I need, but getting stuck with one of the remaining columns. The reason being that the column name contains both a space and a hyphen. Both of which are a no no in Big Query (until the flexible column naming support goes GA).
Im loading the data in SQL with this kind of approach:
CREATE OR REPLACE EXTERNAL TABLE <proj>.<dataset>.<tablename> {
teams_remove STRUCT<team_a STRING, team_b STRING, winning team STRING, losing-manager STRING>
)
That’s just an example to show the syntax I’m working with. In this example the third string ‘winning team’ will fail to parse/load due to the space and the fourth will fail to load die to the hyphen.
Is there any way to rename the column/field at ingestions/loading time?
I cannot pre-process the source data to fix the column names, unfortunately.
Thanks!