googleapis / python-bigquery-sqlalchemy

SQLAlchemy dialect for BigQuery
MIT License
434 stars 129 forks source link

Add ability to set custom User Agent #1082

Closed travischambers closed 2 months ago

travischambers commented 4 months ago

Is your feature request related to a problem? Please describe. The Google Cloud Ready - BigQuery partnership program requires partners to set a custom UserAgent. This is so Google can correctly attribute usage. However, there is no built in way to set the UserAgent in this library. It's hardcoded to sqlalchemy right now.

https://github.com/googleapis/python-bigquery-sqlalchemy/blob/0b3ab54c368fecd148eaa101c7939e10f3cf3b05/sqlalchemy_bigquery/_helpers.py#L27-L69

Describe the solution you'd like The create_bigquery_engine method should also accept a user_agent and use that instead of the default sqlalchemy user_agent, if provided.

For now, as a workaround in my code, I'm reimplementing the create_bigquery_engine method myself and setting the client_info directly.

chalmerlowe commented 2 months ago

@travischambers

This feature should work now. Let me know if you find any problems.