Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Move scalar type aliases to new 'types' module.
  • Loading branch information
tseaver committed Jul 27, 2017
commit 291df8c5ca712c7ff579f98f888c942903cf2615
16 changes: 8 additions & 8 deletions spanner/google/cloud/spanner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@
import pkg_resources
__version__ = pkg_resources.get_distribution('google-cloud-spanner').version

from google.cloud.spanner._helpers import BOOL_PARAM_TYPE
from google.cloud.spanner._helpers import BYTES_PARAM_TYPE
from google.cloud.spanner._helpers import DATE_PARAM_TYPE
from google.cloud.spanner._helpers import FLOAT64_PARAM_TYPE
from google.cloud.spanner._helpers import INT64_PARAM_TYPE
from google.cloud.spanner._helpers import STRING_PARAM_TYPE
from google.cloud.spanner._helpers import TIMESTAMP_PARAM_TYPE

from google.cloud.spanner.client import Client

from google.cloud.spanner.keyset import KeyRange
Expand All @@ -35,6 +27,14 @@
from google.cloud.spanner.pool import BurstyPool
from google.cloud.spanner.pool import FixedSizePool

from google.cloud.spanner.types import BOOL_PARAM_TYPE
from google.cloud.spanner.types import BYTES_PARAM_TYPE
from google.cloud.spanner.types import DATE_PARAM_TYPE
from google.cloud.spanner.types import FLOAT64_PARAM_TYPE
from google.cloud.spanner.types import INT64_PARAM_TYPE
from google.cloud.spanner.types import STRING_PARAM_TYPE
from google.cloud.spanner.types import TIMESTAMP_PARAM_TYPE


__all__ = [
'__version__',
Expand Down
10 changes: 0 additions & 10 deletions spanner/google/cloud/spanner/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,6 @@
from google.cloud._helpers import UTC


# Scalar paramter types
STRING_PARAM_TYPE = type_pb2.Type(code=type_pb2.STRING)
BYTES_PARAM_TYPE = type_pb2.Type(code=type_pb2.BYTES)
BOOL_PARAM_TYPE = type_pb2.Type(code=type_pb2.BOOL)
INT64_PARAM_TYPE = type_pb2.Type(code=type_pb2.INT64)
FLOAT64_PARAM_TYPE = type_pb2.Type(code=type_pb2.FLOAT64)
DATE_PARAM_TYPE = type_pb2.Type(code=type_pb2.DATE)
TIMESTAMP_PARAM_TYPE = type_pb2.Type(code=type_pb2.TIMESTAMP)


class TimestampWithNanoseconds(datetime.datetime):
"""Track nanosecond in addition to normal datetime attrs.

Expand Down
27 changes: 27 additions & 0 deletions spanner/google/cloud/spanner/types.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2017 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Types exported from this package."""

from google.cloud.proto.spanner.v1 import type_pb2


# Scalar paramter types
STRING_PARAM_TYPE = type_pb2.Type(code=type_pb2.STRING)

This comment was marked as spam.

This comment was marked as spam.

BYTES_PARAM_TYPE = type_pb2.Type(code=type_pb2.BYTES)
BOOL_PARAM_TYPE = type_pb2.Type(code=type_pb2.BOOL)
INT64_PARAM_TYPE = type_pb2.Type(code=type_pb2.INT64)
FLOAT64_PARAM_TYPE = type_pb2.Type(code=type_pb2.FLOAT64)
DATE_PARAM_TYPE = type_pb2.Type(code=type_pb2.DATE)
TIMESTAMP_PARAM_TYPE = type_pb2.Type(code=type_pb2.TIMESTAMP)