File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -270,9 +270,8 @@ def from_api_repr(cls, api_repr: dict) -> "SchemaField":
270270 """Return a ``SchemaField`` object deserialized from a dictionary.
271271
272272 Args:
273- api_repr (Mapping[str, str]): The serialized representation
274- of the SchemaField, such as what is output by
275- :meth:`to_api_repr`.
273+ api_repr (dict): The serialized representation of the SchemaField,
274+ such as what is output by :meth:`to_api_repr`.
276275
277276 Returns:
278277 google.cloud.bigquery.schema.SchemaField: The ``SchemaField`` object.
@@ -282,11 +281,10 @@ def from_api_repr(cls, api_repr: dict) -> "SchemaField":
282281 # The API would return a string despite we send an integer. To ensure
283282 # success of resending received schema, we convert string to integer
284283 # to ensure consistency.
285- if (
286- isinstance (api_repr , dict )
287- and type (api_repr .get ("timestampPrecision" )) is str
288- ):
284+ try :
289285 api_repr ["timestampPrecision" ] = int (api_repr ["timestampPrecision" ])
286+ except (TypeError , KeyError ):
287+ pass
290288
291289 # Note: we don't make a copy of api_repr because this can cause
292290 # unnecessary slowdowns, especially on deeply nested STRUCT / RECORD
You can’t perform that action at this time.
0 commit comments