-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
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:
json_row = {"col1": "hello", "col2": "world"}
errors = client.insert_rows_json(
table,
json_row
)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.