If I set the user_agent in the client_info in a BigQueryClient, the resultant storage client from _ensure_bqstorage_client does not have the user agent I set.
def _ensure_bqstorage_client(
self,
bqstorage_client: Optional[
"google.cloud.bigquery_storage.BigQueryReadClient"
] = None,
client_options: Optional[google.api_core.client_options.ClientOptions] = None,
client_info: Optional[
"google.api_core.gapic_v1.client_info.ClientInfo"
] = DEFAULT_BQSTORAGE_CLIENT_INFO,
) -> Optional["google.cloud.bigquery_storage.BigQueryReadClient"]:
...
if bqstorage_client is None: # pragma: NO COVER
bqstorage_client = bigquery_storage.BigQueryReadClient(
credentials=self._credentials,
client_options=client_options,
client_info=client_info, # type: ignore # (None is also accepted)
)
Solution
For _ensure_bqstorage_client to default to using the original client's client_info if no client_info is provided in the params.
The only part of the client_info that I really need in both clients is the user_agent, so alternatively I would be fully satisfied if just the user agent were propagated to the storage client.
Alternatives
For now, I believe I will have to manually create the bqstorage client with my own client_info.
Problem
If I set the
user_agent
in theclient_info
in a BigQueryClient, the resultant storage client from_ensure_bqstorage_client
does not have the user agent I set.This is visible in the code here:
Solution
For
_ensure_bqstorage_client
to default to using the original client'sclient_info
if noclient_info
is provided in the params.The only part of the
client_info
that I really need in both clients is theuser_agent
, so alternatively I would be fully satisfied if just the user agent were propagated to the storage client.Alternatives
For now, I believe I will have to manually create the bqstorage client with my own
client_info
.Additional context