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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add session and connection properties to QueryJobConfig #1024

Merged
merged 8 commits into from Oct 27, 2021

Conversation

tswast
Copy link
Contributor

@tswast tswast commented Oct 15, 2021

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes internal issue 202792922 馃
Closes #1026
Closes #1029

@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/python-bigquery API. label Oct 15, 2021
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Oct 15, 2021
@tswast tswast marked this pull request as ready for review October 15, 2021 22:13
@tswast tswast requested a review from a team October 15, 2021 22:13
@tswast tswast requested a review from a team as a code owner October 15, 2021 22:13
Copy link
Contributor

@plamut plamut left a comment

Choose a reason for hiding this comment

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

Don't know the exact acceptance criteria for this addition, but at a face value it more or less looks good to me. Had just a few nit comments about type annotations and docstrings.

google/cloud/bigquery/job/query.py Show resolved Hide resolved
google/cloud/bigquery/job/query.py Outdated Show resolved Hide resolved
google/cloud/bigquery/job/base.py Outdated Show resolved Hide resolved
google/cloud/bigquery/job/query.py Outdated Show resolved Hide resolved
@tswast tswast mentioned this pull request Oct 25, 2021
4 tasks
@tswast tswast requested a review from plamut October 25, 2021 22:26
Copy link
Contributor

@plamut plamut left a comment

Choose a reason for hiding this comment

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

Looks good, just a question about exposing SessionInfo in the generated docs.

@@ -990,6 +1003,24 @@ def evaluation_kind(self) -> Optional[str]:
return self._properties.get("evaluationKind")


class SessionInfo(object):
Copy link
Contributor

@plamut plamut Oct 26, 2021

Choose a reason for hiding this comment

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

(nit) Explicitly inheriting from object is not needed.

Also, shouldn't we expose this class in the top level namespace? And both new classes in the reference docs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added to docs via job_base.rst and query.rst. I noticed in #1023 that we'd missed a few classes, so I migrated some docs back to automodule. Even though I don't think it's the best UX to have so many classes in one page, I'd rather we not forget in the future.

Screen Shot 2021-10-26 at 9 16 56 AM

Screen Shot 2021-10-26 at 9 20 28 AM

@plamut
Copy link
Contributor

plamut commented Oct 26, 2021

#1029 is not that much different, the differences are the following:

  • No SessionInfo class, session_id is exposed directly on the QueryJob instance (similarly to query stats, e.g. estimated_bytes_processed).
  • Accepting None as a valid value, the new properties has mostly been marked as Optional[...]
  • Contains a fix for the script_options's docstring.

@tswast
Copy link
Contributor Author

tswast commented Oct 26, 2021

No SessionInfo class, session_id is exposed directly on the QueryJob instance (similarly to query stats, e.g. estimated_bytes_processed).

That makes sense, but I'd rather stick with a close mapping to the actual REST API. I suspect it's a class because they might want to add a lot more session-related stats in the future.

Accepting None as a valid value, the new properties has mostly been marked as Optional[...]

The docs at https://cloud.google.com/bigquery/docs/reference/rest/v2/ConnectionProperty don't appear to indicate that key/value are optional. I'm not sure how useful a connection property will be without a key/value. Certainly the two existing ones require something for both.

Contains a fix for the script_options's docstring.

Good catch. Done!

@tswast tswast requested a review from plamut October 26, 2021 14:51
plamut
plamut approved these changes Oct 27, 2021
@plamut plamut merged commit e4c94f4 into main Oct 27, 2021
14 checks passed
@plamut plamut deleted the b202792922-session branch October 27, 2021 07:12
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 API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add session support
2 participants