From b8152dba4990ab19785bb265751d821d21e1c1f1 Mon Sep 17 00:00:00 2001 From: Alex Ford Date: Tue, 19 Nov 2019 09:24:28 +0000 Subject: [PATCH 1/3] fix(bigquery): import Mapping from collections.abc not from collections --- bigquery/google/cloud/bigquery/schema.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bigquery/google/cloud/bigquery/schema.py b/bigquery/google/cloud/bigquery/schema.py index d766cb542608..259970a0557e 100644 --- a/bigquery/google/cloud/bigquery/schema.py +++ b/bigquery/google/cloud/bigquery/schema.py @@ -14,7 +14,7 @@ """Schemas for BigQuery tables / queries.""" -import collections +from collections.abc import Mapping from google.cloud.bigquery_v2 import types @@ -281,7 +281,7 @@ def _to_schema_fields(schema): instance or a compatible mapping representation of the field. """ for field in schema: - if not isinstance(field, (SchemaField, collections.Mapping)): + if not isinstance(field, (SchemaField, Mapping)): raise ValueError( "Schema items must either be fields or compatible " "mapping representations." From f1a9c131bb94a0f13ebb4fcbdf4bbe1d47df191d Mon Sep 17 00:00:00 2001 From: Alex Ford Date: Wed, 20 Nov 2019 09:21:52 +0000 Subject: [PATCH 2/3] fix(bigquery): importing module not class --- bigquery/google/cloud/bigquery/schema.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bigquery/google/cloud/bigquery/schema.py b/bigquery/google/cloud/bigquery/schema.py index 259970a0557e..89f570f3561f 100644 --- a/bigquery/google/cloud/bigquery/schema.py +++ b/bigquery/google/cloud/bigquery/schema.py @@ -14,7 +14,7 @@ """Schemas for BigQuery tables / queries.""" -from collections.abc import Mapping +from collections import abc from google.cloud.bigquery_v2 import types @@ -281,7 +281,7 @@ def _to_schema_fields(schema): instance or a compatible mapping representation of the field. """ for field in schema: - if not isinstance(field, (SchemaField, Mapping)): + if not isinstance(field, (SchemaField, abc.Mapping)): raise ValueError( "Schema items must either be fields or compatible " "mapping representations." From 548c018a1daac78ec22f7bd9e0fe3faafbdddd6f Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Thu, 21 Nov 2019 10:00:07 -0800 Subject: [PATCH 3/3] Use collections_abc import from six. --- bigquery/google/cloud/bigquery/schema.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bigquery/google/cloud/bigquery/schema.py b/bigquery/google/cloud/bigquery/schema.py index 89f570f3561f..3878a80a9f94 100644 --- a/bigquery/google/cloud/bigquery/schema.py +++ b/bigquery/google/cloud/bigquery/schema.py @@ -14,7 +14,7 @@ """Schemas for BigQuery tables / queries.""" -from collections import abc +from six.moves import collections_abc from google.cloud.bigquery_v2 import types @@ -281,7 +281,7 @@ def _to_schema_fields(schema): instance or a compatible mapping representation of the field. """ for field in schema: - if not isinstance(field, (SchemaField, abc.Mapping)): + if not isinstance(field, (SchemaField, collections_abc.Mapping)): raise ValueError( "Schema items must either be fields or compatible " "mapping representations."