googleapis / googleapis/google-cloud-python

Support user_agent via connect_args or url query parameters

Offen
#15,763 2 Kommentare 1 Reaktion 1 zugewiesene Person Zugewiesen an @chalmerlowe Auf GitHub ansehen
api: bigquery priority: p3 type: feature request
Vorherrschende Sprache
Python
Sterne
5.4k
Forks
1.8k
Ø Merge
3 T. 4 Std.
Gemergte PRs (30 T.)
122

Beschreibung

**Is your feature request related to a problem? Please describe.**

It's frustrating to manually create client objects with `user_supplied_client` just to be able to customize the `user_agent`.

**Describe the solution you'd like**

I'd like `user_agent` to be configurable via `connect_args` when invoking `sa.engine.create_engine`. Since the`Client` is automatically created as part of `create_connect_args`, any user-provided `connect_args` can't currently be incorporated.

One solution would be to defer the creation of the `Client` object until `BigQueryDialect.connect` so that all `connect_args` (both from `create_connect_args` and the user) can be incorporated.

However, as a smaller iteration to allow control over this, it would be helpful to be able to specify the `user_agent` string as part of the URL so that `parse_url` (in the context of `create_connect_args`) can extract it as a `ClientInfo` object and pass it to `_helpers.create_bigquery_client` for automatic client creation.

https://github.com/googleapis/python-bigquery-sqlalchemy/blob/f363b87f7587c21ad32501e17cb4d9987fdd5d5d/sqlalchemy_bigquery/base.py#L1170-L1177

**Describe alternatives you've considered**

Today, our only option seems to be `user_supplied_client` and creating our own `client` – and `bq_storage_client` – with appropriate `ClientInfo` populated.

**Additional context**
Add any other context or screenshots about the feature request here.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.