forked from googleapis/google-cloud-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatastore-client.html
More file actions
717 lines (677 loc) · 55.4 KB
/
datastore-client.html
File metadata and controls
717 lines (677 loc) · 55.4 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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Datastore Client — gcloud 0.9.0 documentation</title>
<link rel="stylesheet" href="_static/css/main.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/normalize.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.9.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/js/vendor/modernizr-2.6.2.min.js"></script>
<link rel="shortcut icon" href="_static/favicon.ico"/>
<link rel="top" title="gcloud 0.9.0 documentation" href="index.html" />
<link rel="next" title="Entities" href="datastore-entities.html" />
<link rel="prev" title="Authentication" href="gcloud-auth.html" />
</head>
<body role="document">
<header class="page-header fixed" role="banner">
<h1 class="logo">
<a href="index.html" title="back to home">
<img src="_static/images/logo.svg" alt="Google Cloud Platform" />
<span class="gcloud">gcloud</span>
</a>
</h1>
<nav class="main-nav">
<div class="nav-current">Python</div>
<ul class="menu">
<li>
<a href="
https://googlecloudplatform.github.io/gcloud-java/" title="gcloud-java page">
<img src="_static/images/icon-lang-java-duke.svg" alt="Duke icon" class="menu-icon" />
Java
</a>
</li>
<li>
<a href="
https://googlecloudplatform.github.io/gcloud-node/#/docs" title="Node.js docs page">
<img src="_static/images/icon-lang-nodejs.svg" alt="Node.js icon" class="menu-icon" />
Node.js
</a>
</li>
<li>
<a href="#" title="Python docs page">
<img src="_static/images/icon-lang-python.svg" alt="Python icon" class="menu-icon" />
Python
</a>
</li>
<li>
<a href="
http://googlecloudplatform.github.io/gcloud-ruby/docs/latest" title="Ruby docs page">
<img src="_static/images/icon-lang-ruby.svg" alt="Ruby icon" class="menu-icon" />
Ruby
</a>
</li>
</ul>
</nav><!-- end of .main-nav -->
<a href="https://github.com/GoogleCloudPlatform/gcloud-python/issues/new?title=%5BDocumentation+Issue%5D+&body=Page+Name%3A+datastore-client%0ARelease%3A%200.9.0" target="_blank" class="v-btn" id="file-issue">
<img src="_static/images/icon-link-github.svg" />
Report an Issue
</a>
</header><!-- end of .page-header -->
<article class="main lang-page" role="main">
<header class="docs-header">
<div class="versions">
<a href="/gcloud-python/versions.html" class="v-btn">
<img src="_static/images/icon-arrow-bullet.svg" />
Version History (0.9.0)
</a>
</div><!-- end of .versions -->
<div>
<a href="https://github.com/GoogleCloudPlatform/gcloud-python/issues/new?title=%5BDocumentation+Issue%5D+" target="_blank" class="v-btn" id="file-issue-secondary">
<img src="_static/images/icon-link-github.svg" />
Report an Issue
</a>
</div>
</header>
<section class="content">
<div class="section" id="module-gcloud.datastore.client">
<span id="datastore-client"></span><h1>Datastore Client<a class="headerlink" href="#module-gcloud.datastore.client" title="Permalink to this headline">#</a></h1>
<p>Convenience wrapper for invoking APIs/factories w/ a project.</p>
<dl class="class">
<dt id="gcloud.datastore.client.Client">
<em class="property">class </em><code class="descclassname">gcloud.datastore.client.</code><code class="descname">Client</code><span class="sig-paren">(</span><em>project=None</em>, <em>namespace=None</em>, <em>credentials=None</em>, <em>http=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/datastore/client.html#Client"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.datastore.client.Client" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <a class="reference internal" href="gcloud-api.html#gcloud.client.Client" title="gcloud.client.Client"><code class="xref py py-class docutils literal"><span class="pre">gcloud.client.Client</span></code></a></p>
<p>Convenience wrapper for invoking APIs/factories w/ a project.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>project</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – (optional) The project to pass to proxied API methods.</li>
<li><strong>namespace</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – (optional) namespace to pass to proxied API methods.</li>
<li><strong>credentials</strong> (<a class="reference external" href="http://oauth2client.readthedocs.org/en/latest/source/oauth2client.client.html#oauth2client.client.OAuth2Credentials" title="(in oauth2client v1.5.2)"><code class="xref py py-class docutils literal"><span class="pre">oauth2client.client.OAuth2Credentials</span></code></a> or
<code class="xref py py-class docutils literal"><span class="pre">NoneType</span></code>) – The OAuth2 Credentials to use for the connection
owned by this client. If not passed (and if no <code class="docutils literal"><span class="pre">http</span></code>
object is passed), falls back to the default inferred
from the environment.</li>
<li><strong>http</strong> (<a class="reference external" href="http://bitworking.org/projects/httplib2/doc/html/libhttplib2.html#httplib2.Http" title="(in httplib2 v0.4)"><code class="xref py py-class docutils literal"><span class="pre">httplib2.Http</span></code></a> or class that defines <code class="docutils literal"><span class="pre">request()</span></code>.) – An optional HTTP object to make requests. If not passed, an
<code class="docutils literal"><span class="pre">http</span></code> object is created that is bound to the
<code class="docutils literal"><span class="pre">credentials</span></code> for the current object.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="gcloud.datastore.client.Client.allocate_ids">
<code class="descname">allocate_ids</code><span class="sig-paren">(</span><em>incomplete_key</em>, <em>num_ids</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/datastore/client.html#Client.allocate_ids"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.datastore.client.Client.allocate_ids" title="Permalink to this definition">#</a></dt>
<dd><p>Allocate a list of IDs from a partial key.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>incomplete_key</strong> (<a class="reference internal" href="datastore-keys.html#gcloud.datastore.key.Key" title="gcloud.datastore.key.Key"><code class="xref py py-class docutils literal"><span class="pre">gcloud.datastore.key.Key</span></code></a>) – Partial key to use as base for allocated IDs.</li>
<li><strong>num_ids</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#int" title="(in Python v2.7)"><em>int</em></a>) – The number of IDs to allocate.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">list of <a class="reference internal" href="datastore-keys.html#gcloud.datastore.key.Key" title="gcloud.datastore.key.Key"><code class="xref py py-class docutils literal"><span class="pre">gcloud.datastore.key.Key</span></code></a></p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The (complete) keys allocated with <code class="docutils literal"><span class="pre">incomplete_key</span></code> as
root.</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">ValueError</span></code> if <code class="docutils literal"><span class="pre">incomplete_key</span></code> is not a
partial key.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="gcloud.datastore.client.Client.batch">
<code class="descname">batch</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/datastore/client.html#Client.batch"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.datastore.client.Client.batch" title="Permalink to this definition">#</a></dt>
<dd><p>Proxy to <a class="reference internal" href="datastore-batches.html#gcloud.datastore.batch.Batch" title="gcloud.datastore.batch.Batch"><code class="xref py py-class docutils literal"><span class="pre">gcloud.datastore.batch.Batch</span></code></a>.</p>
</dd></dl>
<dl class="attribute">
<dt id="gcloud.datastore.client.Client.current_batch">
<code class="descname">current_batch</code><a class="headerlink" href="#gcloud.datastore.client.Client.current_batch" title="Permalink to this definition">#</a></dt>
<dd><p>Currently-active batch.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="datastore-batches.html#gcloud.datastore.batch.Batch" title="gcloud.datastore.batch.Batch"><code class="xref py py-class docutils literal"><span class="pre">gcloud.datastore.batch.Batch</span></code></a>, or an object
implementing its API, or <code class="docutils literal"><span class="pre">NoneType</span></code> (if no batch is active).</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The batch/transaction at the top of the batch stack.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="gcloud.datastore.client.Client.current_transaction">
<code class="descname">current_transaction</code><a class="headerlink" href="#gcloud.datastore.client.Client.current_transaction" title="Permalink to this definition">#</a></dt>
<dd><p>Currently-active transaction.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="datastore-transactions.html#gcloud.datastore.transaction.Transaction" title="gcloud.datastore.transaction.Transaction"><code class="xref py py-class docutils literal"><span class="pre">gcloud.datastore.transaction.Transaction</span></code></a>, or an object
implementing its API, or <code class="docutils literal"><span class="pre">NoneType</span></code> (if no transaction is
active).</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The transaction at the top of the batch stack.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="gcloud.datastore.client.Client.delete">
<code class="descname">delete</code><span class="sig-paren">(</span><em>key</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/datastore/client.html#Client.delete"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.datastore.client.Client.delete" title="Permalink to this definition">#</a></dt>
<dd><p>Delete the key in the Cloud Datastore.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This is just a thin wrapper over <a class="reference internal" href="#gcloud.datastore.client.Client.delete_multi" title="gcloud.datastore.client.Client.delete_multi"><code class="xref py py-meth docutils literal"><span class="pre">delete_multi()</span></code></a>.
The backend API does not make a distinction between a single key or
multiple keys in a commit request.</p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>key</strong> (<a class="reference internal" href="datastore-keys.html#gcloud.datastore.key.Key" title="gcloud.datastore.key.Key"><code class="xref py py-class docutils literal"><span class="pre">gcloud.datastore.key.Key</span></code></a>) – The key to be deleted from the datastore.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="gcloud.datastore.client.Client.delete_multi">
<code class="descname">delete_multi</code><span class="sig-paren">(</span><em>keys</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/datastore/client.html#Client.delete_multi"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.datastore.client.Client.delete_multi" title="Permalink to this definition">#</a></dt>
<dd><p>Delete keys from the Cloud Datastore.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>keys</strong> (list of <a class="reference internal" href="datastore-keys.html#gcloud.datastore.key.Key" title="gcloud.datastore.key.Key"><code class="xref py py-class docutils literal"><span class="pre">gcloud.datastore.key.Key</span></code></a>) – The keys to be deleted from the datastore.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="gcloud.datastore.client.Client.get">
<code class="descname">get</code><span class="sig-paren">(</span><em>key</em>, <em>missing=None</em>, <em>deferred=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/datastore/client.html#Client.get"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.datastore.client.Client.get" title="Permalink to this definition">#</a></dt>
<dd><p>Retrieve an entity from a single key (if it exists).</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This is just a thin wrapper over <a class="reference internal" href="#gcloud.datastore.client.Client.get_multi" title="gcloud.datastore.client.Client.get_multi"><code class="xref py py-meth docutils literal"><span class="pre">get_multi()</span></code></a>.
The backend API does not make a distinction between a single key or
multiple keys in a lookup request.</p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>key</strong> (<a class="reference internal" href="datastore-keys.html#gcloud.datastore.key.Key" title="gcloud.datastore.key.Key"><code class="xref py py-class docutils literal"><span class="pre">gcloud.datastore.key.Key</span></code></a>) – The key to be retrieved from the datastore.</li>
<li><strong>missing</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#list" title="(in Python v2.7)"><em>list</em></a>) – (Optional) If a list is passed, the key-only entities
returned by the backend as “missing” will be copied
into it.</li>
<li><strong>deferred</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#list" title="(in Python v2.7)"><em>list</em></a>) – (Optional) If a list is passed, the keys returned
by the backend as “deferred” will be copied into it.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first"><a class="reference internal" href="datastore-entities.html#gcloud.datastore.entity.Entity" title="gcloud.datastore.entity.Entity"><code class="xref py py-class docutils literal"><span class="pre">gcloud.datastore.entity.Entity</span></code></a> or <code class="docutils literal"><span class="pre">NoneType</span></code></p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">The requested entity if it exists.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="gcloud.datastore.client.Client.get_multi">
<code class="descname">get_multi</code><span class="sig-paren">(</span><em>keys</em>, <em>missing=None</em>, <em>deferred=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/datastore/client.html#Client.get_multi"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.datastore.client.Client.get_multi" title="Permalink to this definition">#</a></dt>
<dd><p>Retrieve entities, along with their attributes.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>keys</strong> (list of <a class="reference internal" href="datastore-keys.html#gcloud.datastore.key.Key" title="gcloud.datastore.key.Key"><code class="xref py py-class docutils literal"><span class="pre">gcloud.datastore.key.Key</span></code></a>) – The keys to be retrieved from the datastore.</li>
<li><strong>missing</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#list" title="(in Python v2.7)"><em>list</em></a>) – (Optional) If a list is passed, the key-only entities
returned by the backend as “missing” will be copied
into it. If the list is not empty, an error will occur.</li>
<li><strong>deferred</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#list" title="(in Python v2.7)"><em>list</em></a>) – (Optional) If a list is passed, the keys returned
by the backend as “deferred” will be copied into it.
If the list is not empty, an error will occur.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">list of <a class="reference internal" href="datastore-entities.html#gcloud.datastore.entity.Entity" title="gcloud.datastore.entity.Entity"><code class="xref py py-class docutils literal"><span class="pre">gcloud.datastore.entity.Entity</span></code></a></p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The requested entities.</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-class docutils literal"><span class="pre">ValueError</span></code> if one or more of <code class="docutils literal"><span class="pre">keys</span></code> has a project
which does not match our project.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="gcloud.datastore.client.Client.key">
<code class="descname">key</code><span class="sig-paren">(</span><em>*path_args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/datastore/client.html#Client.key"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.datastore.client.Client.key" title="Permalink to this definition">#</a></dt>
<dd><p>Proxy to <a class="reference internal" href="datastore-keys.html#gcloud.datastore.key.Key" title="gcloud.datastore.key.Key"><code class="xref py py-class docutils literal"><span class="pre">gcloud.datastore.key.Key</span></code></a>.</p>
<p>Passes our <code class="docutils literal"><span class="pre">project</span></code>.</p>
</dd></dl>
<dl class="method">
<dt id="gcloud.datastore.client.Client.put">
<code class="descname">put</code><span class="sig-paren">(</span><em>entity</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/datastore/client.html#Client.put"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.datastore.client.Client.put" title="Permalink to this definition">#</a></dt>
<dd><p>Save an entity in the Cloud Datastore.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This is just a thin wrapper over <a class="reference internal" href="#gcloud.datastore.client.Client.put_multi" title="gcloud.datastore.client.Client.put_multi"><code class="xref py py-meth docutils literal"><span class="pre">put_multi()</span></code></a>.
The backend API does not make a distinction between a single
entity or multiple entities in a commit request.</p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>entity</strong> (<a class="reference internal" href="datastore-entities.html#gcloud.datastore.entity.Entity" title="gcloud.datastore.entity.Entity"><code class="xref py py-class docutils literal"><span class="pre">gcloud.datastore.entity.Entity</span></code></a>) – The entity to be saved to the datastore.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="gcloud.datastore.client.Client.put_multi">
<code class="descname">put_multi</code><span class="sig-paren">(</span><em>entities</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/datastore/client.html#Client.put_multi"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.datastore.client.Client.put_multi" title="Permalink to this definition">#</a></dt>
<dd><p>Save entities in the Cloud Datastore.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>entities</strong> (list of <a class="reference internal" href="datastore-entities.html#gcloud.datastore.entity.Entity" title="gcloud.datastore.entity.Entity"><code class="xref py py-class docutils literal"><span class="pre">gcloud.datastore.entity.Entity</span></code></a>) – The entities to be saved to the datastore.</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-class docutils literal"><span class="pre">ValueError</span></code> if <code class="docutils literal"><span class="pre">entities</span></code> is a single entity.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="gcloud.datastore.client.Client.query">
<code class="descname">query</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/datastore/client.html#Client.query"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.datastore.client.Client.query" title="Permalink to this definition">#</a></dt>
<dd><p>Proxy to <a class="reference internal" href="datastore-queries.html#gcloud.datastore.query.Query" title="gcloud.datastore.query.Query"><code class="xref py py-class docutils literal"><span class="pre">gcloud.datastore.query.Query</span></code></a>.</p>
<p>Passes our <code class="docutils literal"><span class="pre">project</span></code>.</p>
</dd></dl>
<dl class="method">
<dt id="gcloud.datastore.client.Client.transaction">
<code class="descname">transaction</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/datastore/client.html#Client.transaction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.datastore.client.Client.transaction" title="Permalink to this definition">#</a></dt>
<dd><p>Proxy to <a class="reference internal" href="datastore-transactions.html#gcloud.datastore.transaction.Transaction" title="gcloud.datastore.transaction.Transaction"><code class="xref py py-class docutils literal"><span class="pre">gcloud.datastore.transaction.Transaction</span></code></a>.</p>
</dd></dl>
</dd></dl>
<div class="section" id="module-gcloud.datastore.connection">
<span id="connection"></span><h2>Connection<a class="headerlink" href="#module-gcloud.datastore.connection" title="Permalink to this headline">#</a></h2>
<p>Connections to gcloud datastore API servers.</p>
<dl class="class">
<dt id="gcloud.datastore.connection.Connection">
<em class="property">class </em><code class="descclassname">gcloud.datastore.connection.</code><code class="descname">Connection</code><span class="sig-paren">(</span><em>credentials=None</em>, <em>http=None</em>, <em>api_base_url=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/datastore/connection.html#Connection"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.datastore.connection.Connection" title="Permalink to this definition">#</a></dt>
<dd><p>Bases: <a class="reference internal" href="gcloud-api.html#gcloud.connection.Connection" title="gcloud.connection.Connection"><code class="xref py py-class docutils literal"><span class="pre">gcloud.connection.Connection</span></code></a></p>
<p>A connection to the Google Cloud Datastore via the Protobuf API.</p>
<p>This class should understand only the basic types (and protobufs)
in method arguments, however should be capable of returning advanced types.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>credentials</strong> (<a class="reference external" href="http://oauth2client.readthedocs.org/en/latest/source/oauth2client.client.html#oauth2client.client.OAuth2Credentials" title="(in oauth2client v1.5.2)"><code class="xref py py-class docutils literal"><span class="pre">oauth2client.client.OAuth2Credentials</span></code></a>) – The OAuth2 Credentials to use for this connection.</li>
<li><strong>http</strong> (<a class="reference external" href="http://bitworking.org/projects/httplib2/doc/html/libhttplib2.html#httplib2.Http" title="(in httplib2 v0.4)"><code class="xref py py-class docutils literal"><span class="pre">httplib2.Http</span></code></a> or class that defines <code class="docutils literal"><span class="pre">request()</span></code>.) – An optional HTTP object to make requests.</li>
<li><strong>api_base_url</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The base of the API call URL. Defaults to
<a class="reference internal" href="#gcloud.datastore.connection.Connection.API_BASE_URL" title="gcloud.datastore.connection.Connection.API_BASE_URL"><code class="xref py py-attr docutils literal"><span class="pre">API_BASE_URL</span></code></a>.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="attribute">
<dt id="gcloud.datastore.connection.Connection.API_BASE_URL">
<code class="descname">API_BASE_URL</code><em class="property"> = 'https://www.googleapis.com'</em><a class="headerlink" href="#gcloud.datastore.connection.Connection.API_BASE_URL" title="Permalink to this definition">#</a></dt>
<dd><p>The base of the API call URL.</p>
</dd></dl>
<dl class="attribute">
<dt id="gcloud.datastore.connection.Connection.API_URL_TEMPLATE">
<code class="descname">API_URL_TEMPLATE</code><em class="property"> = '{api_base}/datastore/{api_version}/datasets/{project}/{method}'</em><a class="headerlink" href="#gcloud.datastore.connection.Connection.API_URL_TEMPLATE" title="Permalink to this definition">#</a></dt>
<dd><p>A template for the URL of a particular API call.</p>
</dd></dl>
<dl class="attribute">
<dt id="gcloud.datastore.connection.Connection.API_VERSION">
<code class="descname">API_VERSION</code><em class="property"> = 'v1beta2'</em><a class="headerlink" href="#gcloud.datastore.connection.Connection.API_VERSION" title="Permalink to this definition">#</a></dt>
<dd><p>The version of the API, used in building the API call’s URL.</p>
</dd></dl>
<dl class="attribute">
<dt id="gcloud.datastore.connection.Connection.SCOPE">
<code class="descname">SCOPE</code><em class="property"> = ('https://www.googleapis.com/auth/datastore', 'https://www.googleapis.com/auth/userinfo.email')</em><a class="headerlink" href="#gcloud.datastore.connection.Connection.SCOPE" title="Permalink to this definition">#</a></dt>
<dd><p>The scopes required for authenticating as a Cloud Datastore consumer.</p>
</dd></dl>
<dl class="method">
<dt id="gcloud.datastore.connection.Connection.allocate_ids">
<code class="descname">allocate_ids</code><span class="sig-paren">(</span><em>project</em>, <em>key_pbs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/datastore/connection.html#Connection.allocate_ids"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.datastore.connection.Connection.allocate_ids" title="Permalink to this definition">#</a></dt>
<dd><p>Obtain backend-generated IDs for a set of keys.</p>
<p>Maps the <code class="docutils literal"><span class="pre">DatastoreService.AllocateIds</span></code> protobuf RPC.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>project</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The project to which the transaction belongs.</li>
<li><strong>key_pbs</strong> (list of
<code class="xref py py-class docutils literal"><span class="pre">gcloud.datastore._generated.entity_pb2.Key</span></code>) – The keys for which the backend should allocate IDs.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">list of <code class="xref py py-class docutils literal"><span class="pre">gcloud.datastore._generated.entity_pb2.Key</span></code></p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">An equal number of keys, with IDs filled in by the backend.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="gcloud.datastore.connection.Connection.begin_transaction">
<code class="descname">begin_transaction</code><span class="sig-paren">(</span><em>project</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/datastore/connection.html#Connection.begin_transaction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.datastore.connection.Connection.begin_transaction" title="Permalink to this definition">#</a></dt>
<dd><p>Begin a transaction.</p>
<p>Maps the <code class="docutils literal"><span class="pre">DatastoreService.BeginTransaction</span></code> protobuf RPC.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>project</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The project to which the transaction applies.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bytes</td>
</tr>
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The serialized transaction that was begun.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="gcloud.datastore.connection.Connection.build_api_url">
<code class="descname">build_api_url</code><span class="sig-paren">(</span><em>project</em>, <em>method</em>, <em>base_url=None</em>, <em>api_version=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/datastore/connection.html#Connection.build_api_url"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.datastore.connection.Connection.build_api_url" title="Permalink to this definition">#</a></dt>
<dd><p>Construct the URL for a particular API call.</p>
<p>This method is used internally to come up with the URL to use when
making RPCs to the Cloud Datastore API.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>project</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The project to connect to. This is
usually your project name in the cloud console.</li>
<li><strong>method</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The API method to call (e.g. ‘runQuery’, ‘lookup’).</li>
<li><strong>base_url</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The base URL where the API lives.
You shouldn’t have to provide this.</li>
<li><strong>api_version</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The version of the API to connect to.
You shouldn’t have to provide this.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="gcloud.datastore.connection.Connection.commit">
<code class="descname">commit</code><span class="sig-paren">(</span><em>project</em>, <em>request</em>, <em>transaction_id</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/datastore/connection.html#Connection.commit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.datastore.connection.Connection.commit" title="Permalink to this definition">#</a></dt>
<dd><p>Commit mutations in context of current transation (if any).</p>
<p>Maps the <code class="docutils literal"><span class="pre">DatastoreService.Commit</span></code> protobuf RPC.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>project</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The project to which the transaction applies.</li>
<li><strong>request</strong> (<code class="xref py py-class docutils literal"><span class="pre">_generated.datastore_pb2.CommitRequest</span></code>) – The protobuf with the mutations being committed.</li>
<li><strong>transaction_id</strong> (<em>string or None</em>) – The transaction ID returned from
<a class="reference internal" href="#gcloud.datastore.connection.Connection.begin_transaction" title="gcloud.datastore.connection.Connection.begin_transaction"><code class="xref py py-meth docutils literal"><span class="pre">begin_transaction()</span></code></a>. Non-transactional
batches must pass <code class="docutils literal"><span class="pre">None</span></code>.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This method will mutate <code class="docutils literal"><span class="pre">request</span></code> before using it.</p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/library/functions.html#tuple" title="(in Python v2.7)">tuple</a></td>
</tr>
<tr class="field-even field"><th class="field-name">Returns’:</th><td class="field-body">The pair of the number of index updates and a list of
<code class="xref py py-class docutils literal"><span class="pre">_generated.entity_pb2.Key</span></code> for each incomplete key
that was completed in the commit.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="gcloud.datastore.connection.Connection.lookup">
<code class="descname">lookup</code><span class="sig-paren">(</span><em>project</em>, <em>key_pbs</em>, <em>eventual=False</em>, <em>transaction_id=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/datastore/connection.html#Connection.lookup"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.datastore.connection.Connection.lookup" title="Permalink to this definition">#</a></dt>
<dd><p>Lookup keys from a project in the Cloud Datastore.</p>
<p>Maps the <code class="docutils literal"><span class="pre">DatastoreService.Lookup</span></code> protobuf RPC.</p>
<p>This uses mostly protobufs
(<code class="xref py py-class docutils literal"><span class="pre">gcloud.datastore._generated.entity_pb2.Key</span></code> as input and
<code class="xref py py-class docutils literal"><span class="pre">gcloud.datastore._generated.entity_pb2.Entity</span></code> as output). It
is used under the hood in
<a class="reference internal" href="#gcloud.datastore.client.Client.get" title="gcloud.datastore.client.Client.get"><code class="xref py py-meth docutils literal"><span class="pre">Client.get()</span></code></a>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">gcloud</span> <span class="kn">import</span> <span class="n">datastore</span>
<span class="gp">>>> </span><span class="n">client</span> <span class="o">=</span> <span class="n">datastore</span><span class="o">.</span><span class="n">Client</span><span class="p">(</span><span class="n">project</span><span class="o">=</span><span class="s1">'project'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">key</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">key</span><span class="p">(</span><span class="s1">'MyKind'</span><span class="p">,</span> <span class="mi">1234</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">client</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">key</span><span class="p">)</span>
<span class="go">[<Entity object>]</span>
</pre></div>
</div>
<p>Using a <a class="reference internal" href="#gcloud.datastore.connection.Connection" title="gcloud.datastore.connection.Connection"><code class="xref py py-class docutils literal"><span class="pre">Connection</span></code></a> directly:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">connection</span><span class="o">.</span><span class="n">lookup</span><span class="p">(</span><span class="s1">'project'</span><span class="p">,</span> <span class="p">[</span><span class="n">key</span><span class="o">.</span><span class="n">to_protobuf</span><span class="p">()])</span>
<span class="go">[<Entity protobuf>]</span>
</pre></div>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>project</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The project to look up the keys in.</li>
<li><strong>key_pbs</strong> (list of
<code class="xref py py-class docutils literal"><span class="pre">gcloud.datastore._generated.entity_pb2.Key</span></code>) – The keys to retrieve from the datastore.</li>
<li><strong>eventual</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#bool" title="(in Python v2.7)"><em>bool</em></a>) – If False (the default), request <code class="docutils literal"><span class="pre">STRONG</span></code> read
consistency. If True, request <code class="docutils literal"><span class="pre">EVENTUAL</span></code> read
consistency.</li>
<li><strong>transaction_id</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – If passed, make the request in the scope of
the given transaction. Incompatible with
<code class="docutils literal"><span class="pre">eventual==True</span></code>.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first"><a class="reference external" href="https://docs.python.org/library/functions.html#tuple" title="(in Python v2.7)">tuple</a></p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A triple of (<code class="docutils literal"><span class="pre">results</span></code>, <code class="docutils literal"><span class="pre">missing</span></code>, <code class="docutils literal"><span class="pre">deferred</span></code>) where
both <code class="docutils literal"><span class="pre">results</span></code> and <code class="docutils literal"><span class="pre">missing</span></code> are lists of
<code class="xref py py-class docutils literal"><span class="pre">gcloud.datastore._generated.entity_pb2.Entity</span></code> and
<code class="docutils literal"><span class="pre">deferred</span></code> is a list of
<code class="xref py py-class docutils literal"><span class="pre">gcloud.datastore._generated.entity_pb2.Key</span></code>.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="gcloud.datastore.connection.Connection.rollback">
<code class="descname">rollback</code><span class="sig-paren">(</span><em>project</em>, <em>transaction_id</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/datastore/connection.html#Connection.rollback"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.datastore.connection.Connection.rollback" title="Permalink to this definition">#</a></dt>
<dd><p>Rollback the connection’s existing transaction.</p>
<p>Maps the <code class="docutils literal"><span class="pre">DatastoreService.Rollback</span></code> protobuf RPC.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>project</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The project to which the transaction belongs.</li>
<li><strong>transaction_id</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The transaction ID returned from
<a class="reference internal" href="#gcloud.datastore.connection.Connection.begin_transaction" title="gcloud.datastore.connection.Connection.begin_transaction"><code class="xref py py-meth docutils literal"><span class="pre">begin_transaction()</span></code></a>.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="gcloud.datastore.connection.Connection.run_query">
<code class="descname">run_query</code><span class="sig-paren">(</span><em>project</em>, <em>query_pb</em>, <em>namespace=None</em>, <em>eventual=False</em>, <em>transaction_id=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/gcloud/datastore/connection.html#Connection.run_query"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#gcloud.datastore.connection.Connection.run_query" title="Permalink to this definition">#</a></dt>
<dd><p>Run a query on the Cloud Datastore.</p>
<p>Maps the <code class="docutils literal"><span class="pre">DatastoreService.RunQuery</span></code> protobuf RPC.</p>
<p>Given a Query protobuf, sends a <code class="docutils literal"><span class="pre">runQuery</span></code> request to the
Cloud Datastore API and returns a list of entity protobufs
matching the query.</p>
<p>You typically wouldn’t use this method directly, in favor of the
<a class="reference internal" href="datastore-queries.html#gcloud.datastore.query.Query.fetch" title="gcloud.datastore.query.Query.fetch"><code class="xref py py-meth docutils literal"><span class="pre">gcloud.datastore.query.Query.fetch()</span></code></a> method.</p>
<p>Under the hood, the <a class="reference internal" href="datastore-queries.html#gcloud.datastore.query.Query" title="gcloud.datastore.query.Query"><code class="xref py py-class docutils literal"><span class="pre">gcloud.datastore.query.Query</span></code></a> class
uses this method to fetch data:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">gcloud</span> <span class="kn">import</span> <span class="n">datastore</span>
<span class="gp">>>> </span><span class="n">query</span> <span class="o">=</span> <span class="n">datastore</span><span class="o">.</span><span class="n">Query</span><span class="p">(</span><span class="n">kind</span><span class="o">=</span><span class="s1">'MyKind'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">query</span><span class="o">.</span><span class="n">add_filter</span><span class="p">(</span><span class="s1">'property'</span><span class="p">,</span> <span class="s1">'='</span><span class="p">,</span> <span class="s1">'val'</span><span class="p">)</span>
</pre></div>
</div>
<p>Using the query iterator’s
<a class="reference internal" href="datastore-queries.html#gcloud.datastore.query.Iterator.next_page" title="gcloud.datastore.query.Iterator.next_page"><code class="xref py py-meth docutils literal"><span class="pre">next_page()</span></code></a> method:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">query_iter</span> <span class="o">=</span> <span class="n">query</span><span class="o">.</span><span class="n">fetch</span><span class="p">()</span>
<span class="gp">>>> </span><span class="n">entities</span><span class="p">,</span> <span class="n">more_results</span><span class="p">,</span> <span class="n">cursor</span> <span class="o">=</span> <span class="n">query_iter</span><span class="o">.</span><span class="n">next_page</span><span class="p">()</span>
<span class="gp">>>> </span><span class="n">entities</span>
<span class="go">[<list of Entity unmarshalled from protobuf>]</span>
<span class="gp">>>> </span><span class="n">more_results</span>
<span class="go"><boolean of more results></span>
<span class="gp">>>> </span><span class="n">cursor</span>
<span class="go"><string containing cursor where fetch stopped></span>
</pre></div>
</div>
<p>Under the hood this is doing:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">connection</span><span class="o">.</span><span class="n">run_query</span><span class="p">(</span><span class="s1">'project'</span><span class="p">,</span> <span class="n">query</span><span class="o">.</span><span class="n">to_protobuf</span><span class="p">())</span>
<span class="go">[<list of Entity Protobufs>], cursor, more_results, skipped_results</span>
</pre></div>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>project</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The project over which to run the query.</li>
<li><strong>query_pb</strong> (<code class="xref py py-class docutils literal"><span class="pre">gcloud.datastore._generated.query_pb2.Query</span></code>) – The Protobuf representing the query to run.</li>
<li><strong>namespace</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – The namespace over which to run the query.</li>
<li><strong>eventual</strong> (<a class="reference external" href="https://docs.python.org/library/functions.html#bool" title="(in Python v2.7)"><em>bool</em></a>) – If False (the default), request <code class="docutils literal"><span class="pre">STRONG</span></code> read
consistency. If True, request <code class="docutils literal"><span class="pre">EVENTUAL</span></code> read
consistency.</li>
<li><strong>transaction_id</strong> (<a class="reference external" href="https://docs.python.org/library/string.html#module-string" title="(in Python v2.7)"><em>string</em></a>) – If passed, make the request in the scope of
the given transaction. Incompatible with
<code class="docutils literal"><span class="pre">eventual==True</span></code>.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
</div>
</div>
</section><!-- end of .content -->
<nav class="side-nav">
<p class="caption"><span class="caption-text">gcloud</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="gcloud-api.html">Shared Core Modules</a></li>
<li class="toctree-l1"><a class="reference internal" href="gcloud-auth.html">Authentication</a></li>
</ul>
<p class="caption"><span class="caption-text">Datastore</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="">Client</a></li>
<li class="toctree-l1"><a class="reference internal" href="datastore-entities.html">Entities</a></li>
<li class="toctree-l1"><a class="reference internal" href="datastore-keys.html">Keys</a></li>
<li class="toctree-l1"><a class="reference internal" href="datastore-queries.html">Queries</a></li>
<li class="toctree-l1"><a class="reference internal" href="datastore-transactions.html">Transactions</a></li>
<li class="toctree-l1"><a class="reference internal" href="datastore-batches.html">Batches</a></li>
</ul>
<p class="caption"><span class="caption-text">Storage</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="storage-client.html">Client</a></li>
<li class="toctree-l1"><a class="reference internal" href="storage-blobs.html">Blobs / Objects</a></li>
<li class="toctree-l1"><a class="reference internal" href="storage-buckets.html">Buckets</a></li>
<li class="toctree-l1"><a class="reference internal" href="storage-acl.html">ACL</a></li>
</ul>
<p class="caption"><span class="caption-text">Pub/Sub</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="pubsub-usage.html">Using the API</a></li>
<li class="toctree-l1"><a class="reference internal" href="pubsub-client.html">Client</a></li>
<li class="toctree-l1"><a class="reference internal" href="pubsub-topic.html">Topics</a></li>
<li class="toctree-l1"><a class="reference internal" href="pubsub-subscription.html">Subscriptions</a></li>
<li class="toctree-l1"><a class="reference internal" href="pubsub-message.html">Message</a></li>
</ul>
<p class="caption"><span class="caption-text">BigQuery</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="bigquery-usage.html">Using the API</a></li>
<li class="toctree-l1"><a class="reference internal" href="bigquery-client.html">Client</a></li>
<li class="toctree-l1"><a class="reference internal" href="bigquery-dataset.html">Datasets</a></li>
<li class="toctree-l1"><a class="reference internal" href="bigquery-job.html">Jobs</a></li>
<li class="toctree-l1"><a class="reference internal" href="bigquery-table.html">Tables</a></li>
</ul>
<p class="caption"><span class="caption-text">Resource Manager</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="resource-manager-api.html">Overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="resource-manager-client.html">Client</a></li>
<li class="toctree-l1"><a class="reference internal" href="resource-manager-project.html">Projects</a></li>
</ul>
<p class="caption"><span class="caption-text">DNS</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="dns-usage.html">Using the API</a></li>
<li class="toctree-l1"><a class="reference internal" href="dns-client.html">Client</a></li>
<li class="toctree-l1"><a class="reference internal" href="dns-zone.html">Managed Zones</a></li>
<li class="toctree-l1"><a class="reference internal" href="dns-resource-record-set.html">Resource Record Sets</a></li>
<li class="toctree-l1"><a class="reference internal" href="dns-changes.html">Change Sets</a></li>
</ul>
<p class="caption"><span class="caption-text">Cloud Search</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="search-usage.html">Using the API</a></li>
<li class="toctree-l1"><a class="reference internal" href="search-client.html">Client</a></li>
<li class="toctree-l1"><a class="reference internal" href="search-index.html">Indexes</a></li>
<li class="toctree-l1"><a class="reference internal" href="search-document.html">Documents</a></li>
</ul>
<p class="caption"><span class="caption-text">External Links</span></p>
<ul>
<li class="toctree-l1"><a class="reference external" href="https://github.com/GoogleCloudPlatform/gcloud-python/">GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/GoogleCloudPlatform/gcloud-python/issues">Issues</a></li>
<li class="toctree-l1"><a class="reference external" href="http://stackoverflow.com/questions/tagged/gcloud-python">Stack Overflow</a></li>
<li class="toctree-l1"><a class="reference external" href="https://pypi.python.org/pypi/gcloud">PyPI</a></li>
</ul>
</nav><!-- end of .side-nav -->
</article><!-- end of .main -->
<script src="_static/js/vendor/jquery-1.10.2.min.js"></script>
<script src="_static/js/plugins.js"></script>
<script src="_static/js/main.js"></script>
</body>
</html>