Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
64c28fd
Updating datastore URI template for v1beta3.
dhermes Jan 21, 2016
712077e
Removing use of isolation level in datastore.
dhermes Jan 3, 2016
323eff8
Renaming Makefile dirs to be Bigtable specific.
dhermes Jan 7, 2016
3fbe2ec
Upgrading Makefile to generate datastore v1beta3.
dhermes Jan 7, 2016
62abc15
Updating lint rules to account for new generated files.
dhermes Jan 7, 2016
5e6ab59
Using more descriptive shell var names in Makefile.
dhermes Feb 12, 2016
77322e0
Renaming dataset_id->project_id on PartitionId.
dhermes Jan 7, 2016
9957fb5
Renaming namespace->namespace_id on PartitionId.
dhermes Jan 7, 2016
a2493e2
Rename Value.indexed->exclude_from_indexes.
dhermes Jan 15, 2016
f734f0a
Renaming datastore operation->op on CompositeFilter and PropertyFilter.
dhermes Jan 7, 2016
ad509aa
Renaming filter->filters in CompositeFilter.
dhermes Jan 7, 2016
bced58c
Updating to new default for CompositeFilter.Operator.
dhermes Jan 7, 2016
47540b8
Updating to new default for ReadOptions.ReadConsistency.
dhermes Jan 7, 2016
eccd475
Renaming group_by->distinct_on in Query.
dhermes Jan 7, 2016
de20e17
Updating Query.limit from int32 to google.protobuf.Int32Value.
dhermes Jan 7, 2016
01a6b3c
Renaming entity_result->entity_results in QueryResultBatch.
dhermes Jan 7, 2016
b925c1a
Renaming key->keys in AllocateIdsResponse/AllocateIdsRequest.
dhermes Jan 7, 2016
43ba890
Renaming key->keys in LookupRequest.
dhermes Jan 7, 2016
e7a6e20
Renaming path_element->path in Key.
dhermes Jan 7, 2016
08789e3
Upgrading Entity.property to properties map in datastore.
dhermes Jan 7, 2016
8f06584
Upgrading timestamp_microseconds_value to timestamp_value.
dhermes Jan 7, 2016
58855a3
Upgrading list_value -> array_value for v1beta3.
dhermes Jan 7, 2016
ff76cb4
Updating CommitRequest, Mutation and helpers for v1beta3.
dhermes Jan 7, 2016
1f17183
Follow-on commit to clean-up out-of-sync code.
dhermes Feb 13, 2016
10c4393
Using WhichOneof when parsing a Value protobuf.
dhermes Feb 13, 2016
2336b8f
Adding support for null and geo point values in v1beta3.
dhermes Feb 13, 2016
c0a5306
Removing custom dataset ID environment variable.
dhermes Feb 13, 2016
ba8c262
Removing hacks that avoid using project ID in key protos.
dhermes Feb 13, 2016
4524b53
Removing checks for dataset ID prefixes.
dhermes Feb 13, 2016
44e12b1
Parse Datastore error message using Status protocol buffer.
pcostell Mar 15, 2016
8538095
Merge branch master into datastore-v1beta3
dhermes Apr 1, 2016
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
Next Next commit
Updating datastore URI template for v1beta3.
Also updating the docs link in the README.
  • Loading branch information
dhermes committed Mar 28, 2016
commit 64c28fdee0e053f1fc5443a88b0195cd1f72a0ed
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ writes, strong consistency for reads and ancestor queries, and eventual
consistency for all other queries.

.. _Cloud Datastore: https://cloud.google.com/datastore/docs
.. _Datastore API docs: https://cloud.google.com/datastore/docs/apis/v1beta2/
.. _Datastore API docs: https://cloud.google.com/datastore/docs/apis/v1beta3/

See the ``gcloud-python`` API `datastore documentation`_ to learn how to
interact with the Cloud Datastore using this Client Library.
Expand Down
11 changes: 5 additions & 6 deletions gcloud/datastore/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,17 @@ class Connection(connection.Connection):
:attr:`API_BASE_URL`.
"""

API_BASE_URL = 'https://www.googleapis.com'
API_BASE_URL = 'https://datastore.googleapis.com'
"""The base of the API call URL."""

API_VERSION = 'v1beta2'
API_VERSION = 'v1beta3'
"""The version of the API, used in building the API call's URL."""

API_URL_TEMPLATE = ('{api_base}/datastore/{api_version}'
'/datasets/{project}/{method}')
API_URL_TEMPLATE = ('{api_base}/{api_version}/projects'
'/{project}:{method}')
"""A template for the URL of a particular API call."""

SCOPE = ('https://www.googleapis.com/auth/datastore',
'https://www.googleapis.com/auth/userinfo.email')
SCOPE = ('https://www.googleapis.com/auth/datastore',)
"""The scopes required for authenticating as a Cloud Datastore consumer."""

def __init__(self, credentials=None, http=None, api_base_url=None):
Expand Down
131 changes: 44 additions & 87 deletions gcloud/datastore/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ def _verifyProtobufCall(self, called_with, URI, conn):
conn.USER_AGENT)

def test_default_url(self):
from gcloud.connection import API_BASE_URL

klass = self._getTargetClass()
conn = self._makeOne()
self.assertEqual(conn.api_base_url, API_BASE_URL)
self.assertEqual(conn.api_base_url, klass.API_BASE_URL)

def test_custom_url_from_env(self):
import os
Expand Down Expand Up @@ -143,11 +142,9 @@ def test__request_w_200(self):
conn = self._makeOne()
URI = '/'.join([
conn.api_base_url,
'datastore',
conn.API_VERSION,
'datasets',
PROJECT,
METHOD,
'projects',
PROJECT + ':' + METHOD,
])
http = conn._http = Http({'status': '200'}, 'CONTENT')
self.assertEqual(conn._request(PROJECT, METHOD, DATA), 'CONTENT')
Expand Down Expand Up @@ -189,11 +186,9 @@ def FromString(cls, pb):
conn = self._makeOne()
URI = '/'.join([
conn.api_base_url,
'datastore',
conn.API_VERSION,
'datasets',
PROJECT,
METHOD,
'projects',
PROJECT + ':' + METHOD,
])
http = conn._http = Http({'status': '200'}, 'CONTENT')
response = conn._rpc(PROJECT, METHOD, ReqPB(), RspPB)
Expand All @@ -208,11 +203,9 @@ def test_build_api_url_w_default_base_version(self):
conn = self._makeOne()
URI = '/'.join([
conn.api_base_url,
'datastore',
conn.API_VERSION,
'datasets',
PROJECT,
METHOD,
'projects',
PROJECT + ':' + METHOD,
])
self.assertEqual(conn.build_api_url(PROJECT, METHOD), URI)

Expand All @@ -224,11 +217,9 @@ def test_build_api_url_w_explicit_base_version(self):
conn = self._makeOne()
URI = '/'.join([
BASE,
'datastore',
VER,
'datasets',
PROJECT,
METHOD,
'projects',
PROJECT + ':' + METHOD,
])
self.assertEqual(conn.build_api_url(PROJECT, METHOD, BASE, VER),
URI)
Expand All @@ -242,11 +233,9 @@ def test_lookup_single_key_empty_response(self):
conn = self._makeOne()
URI = '/'.join([
conn.api_base_url,
'datastore',
conn.API_VERSION,
'datasets',
PROJECT,
'lookup',
'projects',
PROJECT + ':lookup',
])
http = conn._http = Http({'status': '200'}, rsp_pb.SerializeToString())
found, missing, deferred = conn.lookup(PROJECT, [key_pb])
Expand All @@ -271,11 +260,9 @@ def test_lookup_single_key_empty_response_w_eventual(self):
conn = self._makeOne()
URI = '/'.join([
conn.api_base_url,
'datastore',
conn.API_VERSION,
'datasets',
PROJECT,
'lookup',
'projects',
PROJECT + ':lookup',
])
http = conn._http = Http({'status': '200'}, rsp_pb.SerializeToString())
found, missing, deferred = conn.lookup(PROJECT, [key_pb],
Expand Down Expand Up @@ -313,11 +300,9 @@ def test_lookup_single_key_empty_response_w_transaction(self):
conn = self._makeOne()
URI = '/'.join([
conn.api_base_url,
'datastore',
conn.API_VERSION,
'datasets',
PROJECT,
'lookup',
'projects',
PROJECT + ':lookup',
])
http = conn._http = Http({'status': '200'}, rsp_pb.SerializeToString())
found, missing, deferred = conn.lookup(PROJECT, [key_pb],
Expand Down Expand Up @@ -348,11 +333,9 @@ def test_lookup_single_key_nonempty_response(self):
conn = self._makeOne()
URI = '/'.join([
conn.api_base_url,
'datastore',
conn.API_VERSION,
'datasets',
PROJECT,
'lookup',
'projects',
PROJECT + ':lookup',
])
http = conn._http = Http({'status': '200'}, rsp_pb.SerializeToString())
(found,), missing, deferred = conn.lookup(PROJECT, [key_pb])
Expand All @@ -379,11 +362,9 @@ def test_lookup_multiple_keys_empty_response(self):
conn = self._makeOne()
URI = '/'.join([
conn.api_base_url,
'datastore',
conn.API_VERSION,
'datasets',
PROJECT,
'lookup',
'projects',
PROJECT + ':lookup',
])
http = conn._http = Http({'status': '200'}, rsp_pb.SerializeToString())
found, missing, deferred = conn.lookup(PROJECT, [key_pb1, key_pb2])
Expand Down Expand Up @@ -414,11 +395,9 @@ def test_lookup_multiple_keys_w_missing(self):
conn = self._makeOne()
URI = '/'.join([
conn.api_base_url,
'datastore',
conn.API_VERSION,
'datasets',
PROJECT,
'lookup',
'projects',
PROJECT + ':lookup',
])
http = conn._http = Http({'status': '200'}, rsp_pb.SerializeToString())
result, missing, deferred = conn.lookup(PROJECT, [key_pb1, key_pb2])
Expand Down Expand Up @@ -448,11 +427,9 @@ def test_lookup_multiple_keys_w_deferred(self):
conn = self._makeOne()
URI = '/'.join([
conn.api_base_url,
'datastore',
conn.API_VERSION,
'datasets',
PROJECT,
'lookup',
'projects',
PROJECT + ':lookup',
])
http = conn._http = Http({'status': '200'}, rsp_pb.SerializeToString())
result, missing, deferred = conn.lookup(PROJECT, [key_pb1, key_pb2])
Expand Down Expand Up @@ -490,11 +467,9 @@ def test_run_query_w_eventual_no_transaction(self):
conn = self._makeOne()
URI = '/'.join([
conn.api_base_url,
'datastore',
conn.API_VERSION,
'datasets',
PROJECT,
'runQuery',
'projects',
PROJECT + ':runQuery',
])
http = conn._http = Http({'status': '200'}, rsp_pb.SerializeToString())
pbs, end, more, skipped = conn.run_query(PROJECT, q_pb,
Expand Down Expand Up @@ -531,11 +506,9 @@ def test_run_query_wo_eventual_w_transaction(self):
conn = self._makeOne()
URI = '/'.join([
conn.api_base_url,
'datastore',
conn.API_VERSION,
'datasets',
PROJECT,
'runQuery',
'projects',
PROJECT + ':runQuery',
])
http = conn._http = Http({'status': '200'}, rsp_pb.SerializeToString())
pbs, end, more, skipped = conn.run_query(
Expand Down Expand Up @@ -589,11 +562,9 @@ def test_run_query_wo_namespace_empty_result(self):
conn = self._makeOne()
URI = '/'.join([
conn.api_base_url,
'datastore',
conn.API_VERSION,
'datasets',
PROJECT,
'runQuery',
'projects',
PROJECT + ':runQuery',
])
http = conn._http = Http({'status': '200'}, rsp_pb.SerializeToString())
pbs, end, more, skipped = conn.run_query(PROJECT, q_pb)
Expand Down Expand Up @@ -624,11 +595,9 @@ def test_run_query_w_namespace_nonempty_result(self):
conn = self._makeOne()
URI = '/'.join([
conn.api_base_url,
'datastore',
conn.API_VERSION,
'datasets',
PROJECT,
'runQuery',
'projects',
PROJECT + ':runQuery',
])
http = conn._http = Http({'status': '200'}, rsp_pb.SerializeToString())
pbs = conn.run_query(PROJECT, q_pb, 'NS')[0]
Expand All @@ -651,11 +620,9 @@ def test_begin_transaction(self):
conn = self._makeOne()
URI = '/'.join([
conn.api_base_url,
'datastore',
conn.API_VERSION,
'datasets',
PROJECT,
'beginTransaction',
'projects',
PROJECT + ':beginTransaction',
])
http = conn._http = Http({'status': '200'}, rsp_pb.SerializeToString())
self.assertEqual(conn.begin_transaction(PROJECT), TRANSACTION)
Expand Down Expand Up @@ -684,11 +651,9 @@ def test_commit_wo_transaction(self):
conn = self._makeOne()
URI = '/'.join([
conn.api_base_url,
'datastore',
conn.API_VERSION,
'datasets',
PROJECT,
'commit',
'projects',
PROJECT + ':commit',
])
http = conn._http = Http({'status': '200'}, rsp_pb.SerializeToString())

Expand Down Expand Up @@ -732,11 +697,9 @@ def test_commit_w_transaction(self):
conn = self._makeOne()
URI = '/'.join([
conn.api_base_url,
'datastore',
conn.API_VERSION,
'datasets',
PROJECT,
'commit',
'projects',
PROJECT + ':commit',
])
http = conn._http = Http({'status': '200'}, rsp_pb.SerializeToString())

Expand Down Expand Up @@ -771,11 +734,9 @@ def test_rollback_ok(self):
conn = self._makeOne()
URI = '/'.join([
conn.api_base_url,
'datastore',
conn.API_VERSION,
'datasets',
PROJECT,
'rollback',
'projects',
PROJECT + ':rollback',
])
http = conn._http = Http({'status': '200'}, rsp_pb.SerializeToString())
self.assertEqual(conn.rollback(PROJECT, TRANSACTION), None)
Expand All @@ -794,11 +755,9 @@ def test_allocate_ids_empty(self):
conn = self._makeOne()
URI = '/'.join([
conn.api_base_url,
'datastore',
conn.API_VERSION,
'datasets',
PROJECT,
'allocateIds',
'projects',
PROJECT + ':allocateIds',
])
http = conn._http = Http({'status': '200'}, rsp_pb.SerializeToString())
self.assertEqual(conn.allocate_ids(PROJECT, []), [])
Expand Down Expand Up @@ -827,11 +786,9 @@ def test_allocate_ids_non_empty(self):
conn = self._makeOne()
URI = '/'.join([
conn.api_base_url,
'datastore',
conn.API_VERSION,
'datasets',
PROJECT,
'allocateIds',
'projects',
PROJECT + ':allocateIds',
])
http = conn._http = Http({'status': '200'}, rsp_pb.SerializeToString())
self.assertEqual(conn.allocate_ids(PROJECT, before_key_pbs),
Expand Down