forked from googleapis/google-cloud-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatastore-integration.yaml
More file actions
206 lines (183 loc) · 7.22 KB
/
Copy pathdatastore-integration.yaml
File metadata and controls
206 lines (183 loc) · 7.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# Copyright 2023 Google LLC
#
# 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.
description: Integrate Google Cloud Datastore Handwritten code
# TODO(Fill in issue number below to add more context)
url: https://github.com/googleapis/gapic-generator-python/issues/123
replacements:
- paths: [
"packages/google-cloud-datastore/docs/conf.py",
]
before: |
exclude_patterns = \[
\ "_build",
after: |
exclude_patterns = [
"datastore_admin_v1/**",
"datastore_v1/**",
"multiprocessing.rst",
"_build",
count: 1
- paths: [
"packages/google-cloud-datastore/setup.py"
]
before: |
"google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0",
\ "grpcio >= 1.59.0, < 2.0.0",
after: |
"google-auth >= 2.14.1, <3.0.0,!=2.24.0,!=2.25.0",
"google-cloud-core >= 2.0.0, <3.0.0",
"grpcio >= 1.59.0, < 2.0.0",
count: 1
- paths: [
"packages/google-cloud-datastore/docs/index.rst",
]
before: |
\.\. include:: multiprocessing\.rst[\s\S]*?CHANGELOG
after: |
.. note::
Because the Datastore client uses the :mod:`grpcio` library by default
and uses third-party :mod:`requests` library if the GRPC is disabled,
clients are safe to share instances across threads. In multiprocessing
scenarios, the best practice is to create client instances *after*
:class:`multiprocessing.Pool` or :class:`multiprocessing.Process` invokes
:func:`os.fork`.
API Reference
-------------
.. toctree::
:maxdepth: 2
client
entities
keys
queries
aggregations
transactions
batches
helpers
admin_client
Changelog
---------
For a list of all ``google-cloud-datastore`` releases:
.. toctree::
:maxdepth: 2
CHANGELOG
count: 1
- paths: [
"packages/google-cloud-datastore/google/cloud/datastore/__init__.py",
]
before: |
from google.cloud.datastore import gapic_version as package_version
[\s\S]*?"PlanSummary",\n\)
after: |
"""Shortcut methods for getting set up with Google Cloud Datastore.
You'll typically use these to get started with the API:
.. doctest:: constructors
>>> from google.cloud import datastore
>>>
>>> client = datastore.Client()
>>> key = client.key('EntityKind', 1234)
>>> key
<Key('EntityKind', 1234), project=...>
>>> entity = datastore.Entity(key)
>>> entity['question'] = u'Life, universe?' # Explicit unicode for text
>>> entity['answer'] = 42
>>> entity
<Entity('EntityKind', 1234) {'question': 'Life, universe?', 'answer': 42}>
>>> query = client.query(kind='EntityKind')
The main concepts with this API are:
- :class:`~google.cloud.datastore.client.Client`
which represents a project (string), database (string), and namespace
(string) bundled with a connection and has convenience methods for
constructing objects with that project/database/namespace.
- :class:`~google.cloud.datastore.entity.Entity`
which represents a single entity in the datastore
(akin to a row in relational database world).
- :class:`~google.cloud.datastore.key.Key`
which represents a pointer to a particular entity in the datastore
(akin to a unique identifier in relational database world).
- :class:`~google.cloud.datastore.query.Query`
which represents a lookup or search over the rows in the datastore.
- :class:`~google.cloud.datastore.transaction.Transaction`
which represents an all-or-none transaction and enables consistency
when race conditions may occur.
"""
from google.cloud.datastore.batch import Batch
from google.cloud.datastore.client import Client
from google.cloud.datastore.entity import Entity
from google.cloud.datastore.key import Key
from google.cloud.datastore.query import Query
from google.cloud.datastore.query_profile import ExplainOptions
from google.cloud.datastore.transaction import Transaction
from google.cloud.datastore.version import __version__
__all__ = [
"__version__",
"Batch",
"Client",
"Entity",
"Key",
"Query",
"ExplainOptions",
"Transaction",
]
count: 1
- paths: [
"packages/google-cloud-datastore/noxfile.py",
]
before: |
@nox\.session\(python=SYSTEM_TEST_PYTHON_VERSIONS\)
def system\(session\):\s+"""Run the system test suite\."""[\s\S]*?system_test_folder_path,\s*\*session\.posargs,\s*\)
after: |
@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
@nox.parametrize("disable_grpc", [False, True])
def system(session, disable_grpc):
"""Run the system test suite."""
constraints_path = str(
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
)
system_test_path = os.path.join("tests", "system.py")
system_test_folder_path = os.path.join("tests", "system")
# Check the value of `RUN_SYSTEM_TESTS` env var. It defaults to true.
if os.environ.get("RUN_SYSTEM_TESTS", "true") == "false":
session.skip("RUN_SYSTEM_TESTS is set to false, skipping")
# Install pyopenssl for mTLS testing.
if os.environ.get("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true":
session.install("pyopenssl")
system_test_exists = os.path.exists(system_test_path)
system_test_folder_exists = os.path.exists(system_test_folder_path)
# Sanity check: only run tests if found.
if not system_test_exists and not system_test_folder_exists:
session.skip("System tests were not found")
install_systemtest_dependencies(session, "-c", constraints_path)
env = {}
if disable_grpc:
env["GOOGLE_CLOUD_DISABLE_GRPC"] = "True"
# Run py.test against the system tests.
if system_test_exists:
session.run(
"py.test",
"--quiet",
f"--junitxml=system_{session.python}_sponge_log.xml",
system_test_path,
env=env,
*session.posargs,
)
if system_test_folder_exists:
session.run(
"py.test",
"--quiet",
f"--junitxml=system_{session.python}_sponge_log.xml",
system_test_folder_path,
env=env,
*session.posargs,
)
count: 1