Skip to content

Commit

Permalink
Create parameter type aliases for scalar field types. (googleapis#3670)
Browse files Browse the repository at this point in the history
  • Loading branch information
tseaver authored and landrito committed Aug 22, 2017
1 parent ecb6240 commit 20688e0
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 4 deletions.
29 changes: 25 additions & 4 deletions spanner/google/cloud/spanner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import pkg_resources
__version__ = pkg_resources.get_distribution('google-cloud-spanner').version


from google.cloud.spanner.client import Client

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


__all__ = ['__version__', 'AbstractSessionPool', 'BurstyPool', 'Client',
'FixedSizePool', 'KeyRange', 'KeySet']
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__',
'AbstractSessionPool',
'BOOL_PARAM_TYPE',
'BYTES_PARAM_TYPE',
'BurstyPool',
'Client',
'DATE_PARAM_TYPE',
'FLOAT64_PARAM_TYPE',
'FixedSizePool',
'INT64_PARAM_TYPE',
'KeyRange',
'KeySet',
'STRING_PARAM_TYPE',
'TIMESTAMP_PARAM_TYPE',
]
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)
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)

0 comments on commit 20688e0

Please sign in to comment.