python-bigquery-pandas
python-bigquery-pandas copied to clipboard
Improve InvalidSchema exception by adding specific fields that do not match
I am talking about this InvalidSchema exception.
It may be useful to show at most 3 (for example) fields that have different types. It should help to debug a type mismatch faster.
Great suggestion. I think we do a "set difference" in order to discover schema mismatch, so this should be possible to figure out and include in the exception.
Great, I will start working on it then.
I'm a bit wary of including this information in the actual exception message due to potential privacy issues around logging. Instead, I'm adding local_schema
and remote_schema
properties to InvalidSchema in https://github.com/googleapis/python-bigquery-pandas/pull/449
So long as we leave out description (and other column metadata like IAM roles), which can contain arbitrary text (possibly, though unlikely to be PII) I do think it would be an improved experience if the string representation of InvalidSchema showed the diff of field names and the types.