Async Client: Asynchronous Queries for Async Client by alkatrivedi · Pull Request #758 · googleapis/python-spanner · GitHub
Skip to content
This repository was archived by the owner on Jun 8, 2026. It is now read-only.

Async Client: Asynchronous Queries for Async Client#758

Closed
alkatrivedi wants to merge 0 commit into
googleapis:mainfrom
alkatrivedi:main
Closed

Async Client: Asynchronous Queries for Async Client#758
alkatrivedi wants to merge 0 commit into
googleapis:mainfrom
alkatrivedi:main

Conversation

@alkatrivedi

Copy link
Copy Markdown
Contributor

This PR contains the hand written code layer for Asynchronous implementation of the Async Client Queries.

@alkatrivedi alkatrivedi requested a review from a team as a code owner June 29, 2022 09:28
@alkatrivedi alkatrivedi requested review from a team and kurtisvg June 29, 2022 09:28
@product-auto-label product-auto-label Bot added the size: l Pull request size is large. label Jun 29, 2022
@snippet-bot

snippet-bot Bot commented Jun 29, 2022

Copy link
Copy Markdown

@product-auto-label product-auto-label Bot added the api: spanner Issues related to the googleapis/python-spanner API. label Jun 29, 2022
alkatrivedi added a commit to alkatrivedi/python-spanner that referenced this pull request Jun 29, 2022
@alkatrivedi alkatrivedi requested a review from a team June 29, 2022 10:39

@rajatbhatta rajatbhatta left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are a few points I've from my first look. I'll take a look at the implementation in more detail and add more comments later if need be.

Comment thread samples/samples/async_client_sample.py Outdated
Comment thread samples/samples/async_client_sample.py Outdated
Comment thread samples/samples/async_client_sample.py Outdated
# Create the session object associated with the database object
session_object = session.Session(database_object)

"""Create the session."""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can have comments starting with # for comments like this.

Comment thread samples/samples/async_client_sample.py Outdated
Comment thread samples/samples/async_client_sample.py Outdated
Comment thread samples/samples/async_client_sample.py Outdated
Comment thread samples/samples/async_client_sample.py Outdated
"""Request object for batch create session."""
request = BatchCreateSessionsRequest(
database = database_object.name,
session_count=1420,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did we arrive at this session count here? Or are we setting this to a random value?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are setting it to a random value. This parameter is the number of sessions to be created in this batch call, hence we can set any value to it.

Comment thread samples/samples/async_client_sample.py Outdated
Comment thread samples/samples/async_client_sample.py Outdated
Comment thread samples/samples/async_client_sample.py Outdated
Comment thread samples/samples/async_client_sample.py Outdated
Comment thread samples/samples/async_client_sample.py Outdated


# [ FUNCTION for creating async client and spanner client object]
def getObjects(instance_id, database_id):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a lowercase word or words for function names. Separate words by underscores.
Method name can be more intuitive. Can we have a better name than get_objects?

Comment thread samples/samples/async_client_sample.py Outdated
Comment thread samples/samples/async_client_sample.py Outdated
session = session_object.name,
table = 'Singers',
columns = ["SingerId", "FirstName", "LastName"],
key_set = keyset.KeySet(all_=True)._to_pb(),

@rajatbhatta rajatbhatta Jul 1, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Names with a leading underscore indicate to other programmers that the attribute or method is intended to be private (However, privacy is not enforced in any way). We should avoid calling _to_pb() from here, as it is intended to be private.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'key_set' was the required parameter for making this request. And this parameter requires calling _to_pb() method. Hence, I am not sure if there is any way we can avoid calling it.

Comment thread samples/samples/async_client_sample.py Outdated
Comment thread samples/samples/async_client_sample.py Outdated
Comment thread samples/samples/async_client_sample.py Outdated
Comment thread samples/samples/async_client_sample.py Outdated
Comment thread samples/samples/async_client_sample.py Outdated
Comment thread samples/samples/async_client_sample.py Outdated
Comment thread tests/system/_helpers.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this file deleted? Use checkout instead

@product-auto-label product-auto-label Bot removed the size: l Pull request size is large. label Sep 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: spanner Issues related to the googleapis/python-spanner API. size: u Pull request is empty.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants