0
votes

I'm using npm BigQuery module for inserting data into bigquery. I have a custom field say params which is of type RECORD and accept any int,float or string value as a key value pair. How can I insert to such fields?

Looked into this, but could not find anything useful [https://cloud.google.com/nodejs/docs/reference/bigquery/1.3.x/Table#insert]

1
Hi Darshan not sure what's you are missing a code which does an insert or how to insert a record? Please provide an example what you have done so far and input example which can be used for testingTamir Klein

1 Answers

2
votes

If I understand correctly, you are asking for a map with ANY TYPE value, which is not support in BigQuery.

You may have a map with value type info with a record like below schema.

Your insert code needs to pick correct type_value to set.

{
    "name": "map_field",
    "type": "RECORD",
    "mode": "REPEATED",
    "fields": [
        {
            "name": "key",
            "type": "STRING",
        },
        {
            "name": "int_value",
            "type": "INTEGER"
        },
        {
            "name": "string_value",
            "type": "STRING"
        },
        {
            "name": "float_value",
            "type": "FLOAT"
        }
    ]
}

enter image description here