Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a complete/high-level async client API #1149

Open
matt-clarson opened this issue Jun 11, 2024 · 2 comments
Open

Provide a complete/high-level async client API #1149

matt-clarson opened this issue Jun 11, 2024 · 2 comments
Assignees
Labels
api: spanner Issues related to the googleapis/python-spanner API.

Comments

@matt-clarson
Copy link

Is your feature request related to a problem? Please describe.
The high-level spanner.Client API is all blocking methods. To develop a FastAPI service using Spanner as a datastore it would be good to be able to take advantage of Python's async features and interact with Spanner in an asyncio context.

Describe the solution you'd like
Provide a spanner.AsyncClient class that mirrors the API of spanner.Client but with async methods that allow usage in an async context without having to block on IO calls.

Describe alternatives you've considered
There is a low-level AsyncSpannerClient class that wraps the underlying gRPC API, but making use of this requires re-implementing large parts of the existing spanner.Client API and then having to maintain that code separately to the python-spanner library - in particular needing to manage session pooling and ResultSet/PartialResultSet response types, which is frustrating when a lot of this functionality already exists in this library, but only behind a blocking API

Additional context
I'm happy to contribute this feature if it is accepted.

@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/python-spanner API. label Jun 11, 2024
@AkanshDivker
Copy link

This would be useful or at the least working samples on using the AsyncSpannerClient API. I've been trying to just get it functional but have been struggling, testing with the emulator.

@matt-clarson
Copy link
Author

@larkee would it be possible to get some input on this - is this a feature that is desired/needs more discussion?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/python-spanner API.
Projects
None yet
Development

No branches or pull requests

3 participants