Closed mchlgibs closed 1 year ago
First, thanks for this contribution.
This contribution addresses the schema aspect of JSON support, but have you verified that this is sufficient for query-side JSON support? In other words, have you checked if you can query a table containing a JSON column? It would be beneficial to update the existing unit tests to include this validation.
I haven't checked. I'll look at it over the weekend and see what I can do about adding tests. (And code if necessary.)
Checked and added a test.
@lquerel it's ready for you to inspect and merge.
Sorry for the delay.
In your example the Rust type of the json column is String but in my opinion it will be more natural to use serde_json::value::Value in order to deserialize the json value in a dynamic structure directly navigable.
I added a third commit, where I change the type of the json column to serde_json::value::Value. There was kind of a trick though - when you serialize it into the request - you have to serialize that column as a single string, rather than as a JSON object. So I implemented a function to do that and updated the test. Assuming we add this functionality, other users will have to annotate their structs similarly.
I'd appreciate advice on the following: 1) Is the helper in the right place, or is there a more logical place to put it? 2) Is this even the right way to go?
@lquerel - all done :)
Assuming you like this, I'd recommend a squash, rather than just a merge.
@lquerel - all done :)
Assuming you like this, I'd recommend a squash, rather than just a merge.
I will work on this over the weekend. Thanks
@mchlgibs merged and published. Thank you.
Thank you so much.
Adding Json as a field type
Complete list is here: https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#TableFieldSchema
Json seems to be the only one that was missing in the enum, but Json & Geography were both missing in the helper functions.
This should fix https://github.com/lquerel/gcp-bigquery-client/issues/56