Skip to content

Commit 96d98e5

Browse files
gcf-owl-bot[bot]partheaMariatta
authoredOct 4, 2022
feat: add datastore aggregation query APIs (#306)
* chore: use gapic-generator-python 0.65.2 PiperOrigin-RevId: 444333013 Source-Link: googleapis/googleapis@f91b6cf Source-Link: googleapis/googleapis-gen@16eb360 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTZlYjM2MDk1YzI5NGU3MTJjNzRhMWJmMjM1NTA4MTdiNDIxNzRlNSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * docs: Document encoding of non-UTF-8 key strings in the Cloud Datastore API PiperOrigin-RevId: 450535507 Source-Link: googleapis/googleapis@2f003c0 Source-Link: googleapis/googleapis-gen@7d78e9e Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiN2Q3OGU5ZWQ5NmRiZWE2YmY1ZTAxNzljMGVlMTY1NjEwMDc2MTZhYyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: use gapic-generator-python 1.0.0 PiperOrigin-RevId: 451250442 Source-Link: googleapis/googleapis@cca5e81 Source-Link: googleapis/googleapis-gen@0b219da Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMGIyMTlkYTE2MWE4YmRjYzNjNmY3YjJlZmNkODIxMDUxODJhMzBjYSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * docs: clarifications for `DatastoreFirestoreMigraitonMetadata` feat: new enum value `OPTIMISTIC_WITH_ENTITY_GROUPS` for `ConcurrencyMode` PiperOrigin-RevId: 452220654 Source-Link: googleapis/googleapis@454ad5e Source-Link: googleapis/googleapis-gen@45e7231 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDVlNzIzMThjNzI4YjQwYzIxMzFkZjFiNTY1MDk2NWI2OGViM2JlZCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: add audience parameter PiperOrigin-RevId: 456827138 Source-Link: googleapis/googleapis@23f1a15 Source-Link: googleapis/googleapis-gen@4075a85 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDA3NWE4NTE0ZjY3NjY5MWVjMTU2Njg4YTViYmYxODNhYTk4OTNjZSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: use gapic-generator-python 1.1.1 PiperOrigin-RevId: 459095142 Source-Link: googleapis/googleapis@4f1be99 Source-Link: googleapis/googleapis-gen@ae686d9 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWU2ODZkOWNkZTRmYzNlMzZkMGFjMDJlZmI4NjQzYjE1ODkwYzFlZCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * fix(deps): require google-api-core 2.8.0 * fix(deps): require google-api-core>=1.32.0,>=2.8.0 * feat: Add "or" query support (only in the preview API surface) docs: Clarify wording around default database_id usage PiperOrigin-RevId: 462444231 Source-Link: googleapis/googleapis@b9cbfce Source-Link: googleapis/googleapis-gen@934e426 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOTM0ZTQyNmFiNDIxMDA2ZjIwNDU0NTY4ODIxYjYxYmIzMDk3OWIxMCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore(bazel): update protobuf to v3.21.3 chore(bazel): update gax-java to 2.18.4 PiperOrigin-RevId: 463115700 Source-Link: googleapis/googleapis@52130a9 Source-Link: googleapis/googleapis-gen@6a4d9d9 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNmE0ZDlkOWJiM2FmYjIwYjBmNWZhNGY1ZDlmNjc0MGIxZDBlYjE5YSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: use gapic-generator-python 1.2.0 PiperOrigin-RevId: 467286830 Source-Link: googleapis/googleapis@e6e875a Source-Link: googleapis/googleapis-gen@0295ea1 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDI5NWVhMTRkOWNkNGQ0N2RkYjIzYjllYmQzOWEzMWUyMDM1ZTI4ZiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: update count up_to field type in aggregation queries PiperOrigin-RevId: 469555077 Source-Link: googleapis/googleapis@7c3a38d Source-Link: googleapis/googleapis-gen@cb40e6e Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2I0MGU2ZTg5MmE5YzMzZGEwYjJlNmE2MzM1ZDVmMWU0NWE4NzBkYSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: Bump gapic-generator-python version to 1.3.0 PiperOrigin-RevId: 472561635 Source-Link: googleapis/googleapis@332ecf5 Source-Link: googleapis/googleapis-gen@4313d68 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDMxM2Q2ODI4ODBmZDlkNzI0NzI5MTE2NGQ0ZTlkM2Q1YmQ5ZjE3NyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: use gapic-generator-python 1.3.1 PiperOrigin-RevId: 472772457 Source-Link: googleapis/googleapis@855b74d Source-Link: googleapis/googleapis-gen@b64b1e7 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjY0YjFlN2RhM2UxMzhmMTVjYTM2MTU1MmVmMDU0NWU1NDg5MWI0ZiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * fix: integrate gapic-generator-python-1.4.1 and enable more py_test targets PiperOrigin-RevId: 473833416 Source-Link: googleapis/googleapis@565a550 Source-Link: googleapis/googleapis-gen@1ee1a06 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMWVlMWEwNmM2ZGUzY2E4Yjg0MzU3MmMxZmRlMDU0OGY4NDIzNjk4OSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: add datastore aggregation query APIs PiperOrigin-RevId: 477890345 Source-Link: googleapis/googleapis@82bf674 Source-Link: googleapis/googleapis-gen@5fb8115 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNWZiODExNTE2MWVhMTRhNWM1NTE4ODVjNjgxYzM2MjdjMmY2NjYzMCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * Remove the tests directory from noxfile mypy session * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * Update owlbot for mypy session. * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com> Co-authored-by: Mariatta Wijaya <Mariatta@users.noreply.github.com> Co-authored-by: Mariatta Wijaya <mariattaw@google.com>
1 parent 7e76f54 commit 96d98e5

26 files changed

+3477
-105
lines changed
 

‎google/cloud/datastore_admin_v1/services/datastore_admin/async_client.py

+114-21
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,18 @@ async def export_entities(
287287
288288
.. code-block:: python
289289
290+
# This snippet has been automatically generated and should be regarded as a
291+
# code template only.
292+
# It will require modifications to work:
293+
# - It may require correct/in-range values for request initialization.
294+
# - It may require specifying regional endpoints when creating the service
295+
# client as shown in:
296+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
290297
from google.cloud import datastore_admin_v1
291298
292-
def sample_export_entities():
299+
async def sample_export_entities():
293300
# Create a client
294-
client = datastore_admin_v1.DatastoreAdminClient()
301+
client = datastore_admin_v1.DatastoreAdminAsyncClient()
295302
296303
# Initialize request argument(s)
297304
request = datastore_admin_v1.ExportEntitiesRequest(
@@ -304,7 +311,7 @@ def sample_export_entities():
304311
305312
print("Waiting for operation to complete...")
306313
307-
response = operation.result()
314+
response = await operation.result()
308315
309316
# Handle the response
310317
print(response)
@@ -409,6 +416,14 @@ def sample_export_entities():
409416
client_info=DEFAULT_CLIENT_INFO,
410417
)
411418

419+
# Certain fields should be provided within the metadata header;
420+
# add these here.
421+
metadata = tuple(metadata) + (
422+
gapic_v1.routing_header.to_grpc_metadata(
423+
(("project_id", request.project_id),)
424+
),
425+
)
426+
412427
# Send the request.
413428
response = await rpc(
414429
request,
@@ -450,11 +465,18 @@ async def import_entities(
450465
451466
.. code-block:: python
452467
468+
# This snippet has been automatically generated and should be regarded as a
469+
# code template only.
470+
# It will require modifications to work:
471+
# - It may require correct/in-range values for request initialization.
472+
# - It may require specifying regional endpoints when creating the service
473+
# client as shown in:
474+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
453475
from google.cloud import datastore_admin_v1
454476
455-
def sample_import_entities():
477+
async def sample_import_entities():
456478
# Create a client
457-
client = datastore_admin_v1.DatastoreAdminClient()
479+
client = datastore_admin_v1.DatastoreAdminAsyncClient()
458480
459481
# Initialize request argument(s)
460482
request = datastore_admin_v1.ImportEntitiesRequest(
@@ -467,7 +489,7 @@ def sample_import_entities():
467489
468490
print("Waiting for operation to complete...")
469491
470-
response = operation.result()
492+
response = await operation.result()
471493
472494
# Handle the response
473495
print(response)
@@ -540,9 +562,6 @@ def sample_import_entities():
540562
541563
}
542564
543-
The JSON representation for Empty is empty JSON
544-
object {}.
545-
546565
"""
547566
# Create or coerce a protobuf request object.
548567
# Quick check: If we got a request object, we should *not* have
@@ -576,6 +595,14 @@ def sample_import_entities():
576595
client_info=DEFAULT_CLIENT_INFO,
577596
)
578597

598+
# Certain fields should be provided within the metadata header;
599+
# add these here.
600+
metadata = tuple(metadata) + (
601+
gapic_v1.routing_header.to_grpc_metadata(
602+
(("project_id", request.project_id),)
603+
),
604+
)
605+
579606
# Send the request.
580607
response = await rpc(
581608
request,
@@ -621,11 +648,18 @@ async def create_index(
621648
622649
.. code-block:: python
623650
651+
# This snippet has been automatically generated and should be regarded as a
652+
# code template only.
653+
# It will require modifications to work:
654+
# - It may require correct/in-range values for request initialization.
655+
# - It may require specifying regional endpoints when creating the service
656+
# client as shown in:
657+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
624658
from google.cloud import datastore_admin_v1
625659
626-
def sample_create_index():
660+
async def sample_create_index():
627661
# Create a client
628-
client = datastore_admin_v1.DatastoreAdminClient()
662+
client = datastore_admin_v1.DatastoreAdminAsyncClient()
629663
630664
# Initialize request argument(s)
631665
request = datastore_admin_v1.CreateIndexRequest(
@@ -636,7 +670,7 @@ def sample_create_index():
636670
637671
print("Waiting for operation to complete...")
638672
639-
response = operation.result()
673+
response = await operation.result()
640674
641675
# Handle the response
642676
print(response)
@@ -671,6 +705,14 @@ def sample_create_index():
671705
client_info=DEFAULT_CLIENT_INFO,
672706
)
673707

708+
# Certain fields should be provided within the metadata header;
709+
# add these here.
710+
metadata = tuple(metadata) + (
711+
gapic_v1.routing_header.to_grpc_metadata(
712+
(("project_id", request.project_id),)
713+
),
714+
)
715+
674716
# Send the request.
675717
response = await rpc(
676718
request,
@@ -715,11 +757,18 @@ async def delete_index(
715757
716758
.. code-block:: python
717759
760+
# This snippet has been automatically generated and should be regarded as a
761+
# code template only.
762+
# It will require modifications to work:
763+
# - It may require correct/in-range values for request initialization.
764+
# - It may require specifying regional endpoints when creating the service
765+
# client as shown in:
766+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
718767
from google.cloud import datastore_admin_v1
719768
720-
def sample_delete_index():
769+
async def sample_delete_index():
721770
# Create a client
722-
client = datastore_admin_v1.DatastoreAdminClient()
771+
client = datastore_admin_v1.DatastoreAdminAsyncClient()
723772
724773
# Initialize request argument(s)
725774
request = datastore_admin_v1.DeleteIndexRequest(
@@ -730,7 +779,7 @@ def sample_delete_index():
730779
731780
print("Waiting for operation to complete...")
732781
733-
response = operation.result()
782+
response = await operation.result()
734783
735784
# Handle the response
736785
print(response)
@@ -765,6 +814,17 @@ def sample_delete_index():
765814
client_info=DEFAULT_CLIENT_INFO,
766815
)
767816

817+
# Certain fields should be provided within the metadata header;
818+
# add these here.
819+
metadata = tuple(metadata) + (
820+
gapic_v1.routing_header.to_grpc_metadata(
821+
(
822+
("project_id", request.project_id),
823+
("index_id", request.index_id),
824+
)
825+
),
826+
)
827+
768828
# Send the request.
769829
response = await rpc(
770830
request,
@@ -796,18 +856,25 @@ async def get_index(
796856
797857
.. code-block:: python
798858
859+
# This snippet has been automatically generated and should be regarded as a
860+
# code template only.
861+
# It will require modifications to work:
862+
# - It may require correct/in-range values for request initialization.
863+
# - It may require specifying regional endpoints when creating the service
864+
# client as shown in:
865+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
799866
from google.cloud import datastore_admin_v1
800867
801-
def sample_get_index():
868+
async def sample_get_index():
802869
# Create a client
803-
client = datastore_admin_v1.DatastoreAdminClient()
870+
client = datastore_admin_v1.DatastoreAdminAsyncClient()
804871
805872
# Initialize request argument(s)
806873
request = datastore_admin_v1.GetIndexRequest(
807874
)
808875
809876
# Make the request
810-
response = client.get_index(request=request)
877+
response = await client.get_index(request=request)
811878
812879
# Handle the response
813880
print(response)
@@ -847,6 +914,17 @@ def sample_get_index():
847914
client_info=DEFAULT_CLIENT_INFO,
848915
)
849916

917+
# Certain fields should be provided within the metadata header;
918+
# add these here.
919+
metadata = tuple(metadata) + (
920+
gapic_v1.routing_header.to_grpc_metadata(
921+
(
922+
("project_id", request.project_id),
923+
("index_id", request.index_id),
924+
)
925+
),
926+
)
927+
850928
# Send the request.
851929
response = await rpc(
852930
request,
@@ -873,11 +951,18 @@ async def list_indexes(
873951
874952
.. code-block:: python
875953
954+
# This snippet has been automatically generated and should be regarded as a
955+
# code template only.
956+
# It will require modifications to work:
957+
# - It may require correct/in-range values for request initialization.
958+
# - It may require specifying regional endpoints when creating the service
959+
# client as shown in:
960+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
876961
from google.cloud import datastore_admin_v1
877962
878-
def sample_list_indexes():
963+
async def sample_list_indexes():
879964
# Create a client
880-
client = datastore_admin_v1.DatastoreAdminClient()
965+
client = datastore_admin_v1.DatastoreAdminAsyncClient()
881966
882967
# Initialize request argument(s)
883968
request = datastore_admin_v1.ListIndexesRequest(
@@ -887,7 +972,7 @@ def sample_list_indexes():
887972
page_result = client.list_indexes(request=request)
888973
889974
# Handle the response
890-
for response in page_result:
975+
async for response in page_result:
891976
print(response)
892977
893978
Args:
@@ -930,6 +1015,14 @@ def sample_list_indexes():
9301015
client_info=DEFAULT_CLIENT_INFO,
9311016
)
9321017

1018+
# Certain fields should be provided within the metadata header;
1019+
# add these here.
1020+
metadata = tuple(metadata) + (
1021+
gapic_v1.routing_header.to_grpc_metadata(
1022+
(("project_id", request.project_id),)
1023+
),
1024+
)
1025+
9331026
# Send the request.
9341027
response = await rpc(
9351028
request,

0 commit comments

Comments
 (0)
Please sign in to comment.