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

feat: adds the capability to include custom user agent string #819

Merged
merged 7 commits into from
Oct 14, 2024

Conversation

chalmerlowe
Copy link
Collaborator

Adds the ability to include a custom prefix in the user agent string.
Also includes a feature that allows the hyphen in the legacy user agent string to be replaced by a slash to be more in line with RFC9110.

Current default user agent (product + delimiter + version):

Legacy: pandas-2.0.1
RFC9110: pandas/2.0.1

With a prefix:

Legacy: <your_custom_string> pandas-2.0.1
RFC9110: <your_custom_string> pandas/2.0.1

Fixes #807 🦕

@chalmerlowe chalmerlowe requested review from a team as code owners October 9, 2024 12:59
@chalmerlowe chalmerlowe requested a review from Linchin October 9, 2024 12:59
@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label Oct 9, 2024
Copy link

conventional-commit-lint-gcf bot commented Oct 9, 2024

🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use automerge label. Good luck human!

-- conventional-commit-lint bot
https://conventionalcommits.org/

@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/python-bigquery-pandas API. label Oct 9, 2024
@chalmerlowe chalmerlowe requested review from tswast and removed request for Linchin October 9, 2024 12:59
@chalmerlowe chalmerlowe self-assigned this Oct 9, 2024
@chalmerlowe
Copy link
Collaborator Author

chalmerlowe commented Oct 11, 2024

Follow-up:
In a future major release (aiming for Q4 2024), deprecate the legacy format of the user agent string.
See details here: ISSUE #820.

Copy link

@leahecole leahecole left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with this but left one small comment

@@ -337,11 +341,17 @@ def log_elapsed_seconds(self, prefix="Elapsed", postfix="s.", overlong=6):

def get_client(self):
import google.api_core.client_info
import pandas

# import pandas # noqa: F401 # TODO is this line needed here?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just adding this comment about addressing the TODO
is the concern that the import is redundant? was it in here for region tag reasons? (I don't see a region tag 🤷🏻‍♀️ )

pandas_gbq/gbq.py Outdated Show resolved Hide resolved
@chalmerlowe chalmerlowe merged commit d43457b into main Oct 14, 2024
27 checks passed
@chalmerlowe chalmerlowe deleted the add-user-agent branch October 14, 2024 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/python-bigquery-pandas API. size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow Custom User Agent in to_gbq()
3 participants