-
Notifications
You must be signed in to change notification settings - Fork 137
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 user agent parameters to two functions #1100
Conversation
🤖 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 -- conventional-commit-lint bot |
Default location for jobs / datasets / tables. | ||
project_id (Optional[str]): | ||
Project ID for the project which the client acts on behalf of. | ||
user_agent (Optional[google.api_core.client_info.ClientInfo]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT:
Looks like it should be string?
user_agent (Optional[google.api_core.client_info.ClientInfo]): | |
user_agent (Optional[str]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is correct. The other line that had str
was in error.
google_client_info
returns a ClientInfo
object which may include the user_agent
string as well as several other attributes:
self.python_version = python_version
self.grpc_version = grpc_version
self.api_core_version = api_core_version
self.gapic_version = gapic_version
self.client_library_version = client_library_version
self.user_agent = user_agent
self.rest_version = rest_version
In addition, looking at the bigquery.Client
object, it is expecting a ClientInfo object:
client_info (Optional[google.api_core.client_info.ClientInfo]):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just looking at the code, user_agent
is passed to google_client_info()
, which is expecting a string. google.api_core.client_info.ClientInfo
seems to be what google_client_info()
returns instead?
LGTM. Just some thoughts: should we add a system test to verify that user agent is indeed successfully set up? |
I am not inclined to put the time/resources to add a system test to cover this minor update. Right now, when the Are you picturing an end-to-end system test that accounts for each element of this string? If so, then that type of test feels like it may be brittle and would be dependent on exactly what sub-components are present in this function and might involve complex checks like regex. There might be ways to simplify the checks. If you have alternate ideas on how to do this simply, easily, and in a way that is robust to change within the code, you are welcome to suggest something.
|
I will add a system test similar to the rest of tests in test_helpers.py. Sorry that I'm unable to suggest code change to locations unedited by this PR, apparently it's a feature request with github that hasn't been fulfilled. Feel free to modify as needed. |
This adds:
google_client_info
.Fixes #1082 🦕