You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Laura (Jira)" <ji...@apache.org> on 2021/11/22 20:37:00 UTC
[jira] [Comment Edited] (BEAM-13270) Google Spanner dependency is too old; cannot deal with JSON type code
[ https://issues.apache.org/jira/browse/BEAM-13270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17447614#comment-17447614 ]
Laura edited comment on BEAM-13270 at 11/22/21, 8:36 PM:
---------------------------------------------------------
I've found a way to update the SDK and use the new version of spanner - instead of importing client separately, if you
from google.cloud import spanner
and call spanner.client() instead of Client() by itself, it doesn't throw a Nonetype error and works as I'd expect.
was (Author: JIRAUSER280415):
I've found a way to update the SDK and use the new version of spanner - instead of importing client separately, if you
```
from google.cloud import spanner
```
and call spanner.client() instead of Client() by itself, it doesn't throw a Nonetype error and works as I'd expect.
> Google Spanner dependency is too old; cannot deal with JSON type code
> ---------------------------------------------------------------------
>
> Key: BEAM-13270
> URL: https://issues.apache.org/jira/browse/BEAM-13270
> Project: Beam
> Issue Type: Bug
> Components: io-py-gcp
> Affects Versions: 2.34.0
> Environment: MacOs BigSur, python 3.7.9
> Reporter: Laura
> Priority: P2
> Labels: types
>
> Apache Beam is using google-cloud-spanner version 1.19.1, while current version of google-cloud-spanner is 3.11.1.
> I was attempting to use ReadFromSpanner when I ran into a ValueError - it was getting a type code 11 from Spanner and couldn't parse it.
> Here is (some) relevant code from v3.11.1 of Spanner:
> {code:python}
> class TypeCode(proto.Enum):
> r"""``TypeCode`` is used as part of [Type][google.spanner.v1.Type] to
> indicate the type of a Cloud Spanner value.
> Each legal value of a type can be encoded to or decoded from a JSON
> value, using the encodings described below. All Cloud Spanner values
> can be ``null``, regardless of type; ``null``\ s are always encoded
> as a JSON ``null``.
> """
> TYPE_CODE_UNSPECIFIED = 0
> BOOL = 1
> INT64 = 2
> FLOAT64 = 3
> TIMESTAMP = 4
> DATE = 5
> STRING = 6
> BYTES = 7
> ARRAY = 8
> STRUCT = 9
> NUMERIC = 10
> JSON = 11{code}
> and the same from v1.19.1:
> {code:python}
> _sym_db.RegisterEnumDescriptor(_TYPECODE)
> TypeCode = enum_type_wrapper.EnumTypeWrapper(_TYPECODE)
> TYPE_CODE_UNSPECIFIED = 0
> BOOL = 1
> INT64 = 2
> FLOAT64 = 3T
> IMESTAMP = 4
> DATE = 5
> STRING = 6
> BYTES = 7
> ARRAY = 8
> STRUCT = 9
> NUMERIC = 10 {code}
> There is no support for type code 11, aka JSON in Apache Beam right now.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)