1# Copyright 2014 Google LLC 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15"""Shortcut methods for getting set up with Google Cloud Datastore. 16 17You'll typically use these to get started with the API: 18 19.. doctest:: constructors 20 21 >>> from google.cloud import datastore 22 >>> 23 >>> client = datastore.Client() 24 >>> key = client.key('EntityKind', 1234) 25 >>> key 26 <Key('EntityKind', 1234), project=...> 27 >>> entity = datastore.Entity(key) 28 >>> entity['question'] = u'Life, universe?' # Explicit unicode for text 29 >>> entity['answer'] = 42 30 >>> entity 31 <Entity('EntityKind', 1234) {'question': 'Life, universe?', 'answer': 42}> 32 >>> query = client.query(kind='EntityKind') 33 34The main concepts with this API are: 35 36- :class:`~google.cloud.datastore.client.Client` 37 which represents a project (string) and namespace (string) bundled with 38 a connection and has convenience methods for constructing objects with that 39 project / namespace. 40 41- :class:`~google.cloud.datastore.entity.Entity` 42 which represents a single entity in the datastore 43 (akin to a row in relational database world). 44 45- :class:`~google.cloud.datastore.key.Key` 46 which represents a pointer to a particular entity in the datastore 47 (akin to a unique identifier in relational database world). 48 49- :class:`~google.cloud.datastore.query.Query` 50 which represents a lookup or search over the rows in the datastore. 51 52- :class:`~google.cloud.datastore.transaction.Transaction` 53 which represents an all-or-none transaction and enables consistency 54 when race conditions may occur. 55""" 56 57 58from google.cloud.datastore.version import __version__ 59from google.cloud.datastore.batch import Batch 60from google.cloud.datastore.client import Client 61from google.cloud.datastore.entity import Entity 62from google.cloud.datastore.key import Key 63from google.cloud.datastore.query import Query 64from google.cloud.datastore.transaction import Transaction 65 66__all__ = ["__version__", "Batch", "Client", "Entity", "Key", "Query", "Transaction"] 67