Skip to content

Inserting a json field insert it as a string #144

@a-candiotti-pvotal

Description

@a-candiotti-pvotal

'Not sure about the diagnostic but here is the bug:

Using this lib : cloud.google.com/go/bigquery, I'm inserting some events with a bigquery.Inserter.

The field is marked as a JsonField in the schema but when I'm using bq to query the emulator and check the json data here is what's going on.

$> bq --api http://0.0.0.0:9050 query --project_id=test "SELECT data FROM test_dataset.test_table"
+-----------------------------------------------------------------------------------+
|                                       data                                        |
+-----------------------------------------------------------------------------------+
| "{\"name\": \"Alice\",\"address\": {\"street\": \"A Ave\",\"city\": \"Aville\"}}" |
+-----------------------------------------------------------------------------------+

$> bq --api http://0.0.0.0:9050 query --project_id=test "SELECT data.lol.name FROM test_dataset.test_table"
+----------+
|   name   |
+----------+
|  "Alice" |
+----------+

I could use any other value than lol and it would work.

The exact same code works ok on a real big query instance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions