googleapis / gapic-generator-python

Generate Python API client libraries from Protocol Buffers.
Apache License 2.0
120 stars 67 forks source link

async client does not support explicit routing #2091

Open daniel-sanche opened 1 month ago

daniel-sanche commented 1 month ago

A python-datastore user recently reported that the async client is missing some routing headers added to the sync client, making it unusable

Sync (link):

header_params = {}

if request.project_id:
    header_params["project_id"] = request.project_id

if request.database_id:
    header_params["database_id"] = request.database_id

if header_params:
    metadata = tuple(metadata) + (
        gapic_v1.routing_header.to_grpc_metadata(header_params),
    )

Async (link):

metadata = tuple(metadata) + (
    gapic_v1.routing_header.to_grpc_metadata(
        (("project_id", request.project_id),)
    ),
)
daniel-sanche commented 1 month ago

It seems like the async client doesn't support explicit_routing?

daniel-sanche commented 1 month ago

Related issue: https://github.com/googleapis/gapic-generator-python/issues/1757 discusses the performance cost of the regex verification. But also addresses that the generated output is different

adrianwbsf commented 3 weeks ago

Hi @daniel-sanche, do you have any updates on the issue? Will this issue make selecting the database possible?

daniel-sanche commented 2 weeks ago

Hey, no concrete updates yet, but it's being looked at!