Async Client: Asynchronous Queries for Async Client#758
Conversation
| # Create the session object associated with the database object | ||
| session_object = session.Session(database_object) | ||
|
|
||
| """Create the session.""" |
There was a problem hiding this comment.
You can have comments starting with # for comments like this.
| """Request object for batch create session.""" | ||
| request = BatchCreateSessionsRequest( | ||
| database = database_object.name, | ||
| session_count=1420, |
There was a problem hiding this comment.
How did we arrive at this session count here? Or are we setting this to a random value?
There was a problem hiding this comment.
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.
|
|
||
|
|
||
| # [ FUNCTION for creating async client and spanner client object] | ||
| def getObjects(instance_id, database_id): |
There was a problem hiding this comment.
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?
| session = session_object.name, | ||
| table = 'Singers', | ||
| columns = ["SingerId", "FirstName", "LastName"], | ||
| key_set = keyset.KeySet(all_=True)._to_pb(), |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
'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.
There was a problem hiding this comment.
Why is this file deleted? Use checkout instead

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