BigQuery: raise a TypeError
if a dictionary is passed to insert_rows_json
#10132
Labels
api: bigquery
Issues related to the BigQuery API.
type: feature request
‘Nice-to-have’ improvement, new feature or different behavior or design.
Is your feature request related to a problem? Please describe.
If I want to only insert a single row at a time into a table, it's easy to accidentally try something like:
This results in a
400 BadRequest
error from the API, because it expects a list of rows, not a single row.Describe the solution you'd like
It's difficult to debug this situation from the API response, so it'd be better if we raised a client-side error for passing in the wrong type for
json_rows
.Describe alternatives you've considered
Leave as-is and request a better server-side message. This may be difficult to do, as the error happens at a level above BigQuery, which translates JSON to Protobuf for internal use.
Additional context
This issue was encountered by a customer engineer, and it took me a bit of debugging to figure out the actual issue. I expect other customers will encounter this problem as well.
The text was updated successfully, but these errors were encountered: