lquerel / gcp-bigquery-client

GCP BigQuery Client (Rust)
Apache License 2.0
92 stars 60 forks source link

skip schema field when the schema has no fields #19

Closed jeffreybolle closed 2 years ago

jeffreybolle commented 2 years ago

Context

With version 0.12 of the library I get a 400 Error Schema field shouldn't be used as input with a view when I try to create a view.

In order to make it possible to create views using the library we need to make sure that there is a way to stop the library sending the schema field. The obvious way to do this would be to make the schema field an Option<TableSchema> but this has comparability implications for existing code.

The alternative approach that I went with is to add a is_none method to TableSchema so that we can skip serialisation for this field if its inner Option is none. I have tested this and it works as expected.

Changes

Testing

jeffreybolle commented 2 years ago

@lquerel could you take a look at this PR for me please? Thanks.

lquerel commented 2 years ago

Sorry for the delay. LGTM.

lquerel commented 2 years ago

Version 0.12.1 published. Thanks.

jeffreybolle commented 2 years ago

Great, thanks @lquerel