Conversation
Source-Link: googleapis/synthtool@571ee2c Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:660abdf857d3ab9aabcd967c163c70e657fcc5653595c709263af5f3fa23ef67
* chore(deps): update all dependencies to v3 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Source-Link: googleapis/synthtool@ca87909 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:6162c384d685c5fe22521d3f37f6fc732bf99a085f6d47b677dbcae97fc21392 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
fix(deps): require proto-plus>=1.15.0
Source-Link: googleapis/synthtool@38e11ad Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:4e1991042fe54b991db9ca17c8fb386e61b22fe4d1472a568bf0fcac85dcf5d3
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
* feat: add support for IN/NOT_IN/!= operator * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: fix tests * chore: fix tests Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
This reverts commit be1164d05e50e6a25b6752cbfaeee06e06f8814d.
* feat: add IN/NOT_IN/NOT_EQUALS support to cloud datastore proto PiperOrigin-RevId: 434824722 Source-Link: googleapis/googleapis@4bfdcd3 Source-Link: googleapis/googleapis-gen@5982b9b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTk4MmI5YjA4NTM4OGQ2YzlhOTBhNTU3OGViZTQ3NTE4ZmUwOTMyZSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
* chore: Change the Codeowner to cloud-native-db-dpes * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Source-Link: googleapis/synthtool@6fab84a Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe
Source-Link: googleapis/synthtool@7ff4aad Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:462782b0b492346b2d9099aaff52206dd30bc8e031ea97082e6facecc2373244
) Source-Link: googleapis/synthtool@7804ade Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:eede5672562a32821444a8e803fb984a6f61f2237ea3de229d2de24453f4ae7d
Source-Link: googleapis/synthtool@06e8279 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:b3500c053313dc34e07b1632ba9e4e589f4f77036a7cf39e1fe8906811ae0fce
Source-Link: googleapis/synthtool@993985f Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:1894490910e891a385484514b22eb5133578897eb5b3c380e6d8ad475c6647cd
* chore: allow releases on previous major versions * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Source-Link: googleapis/synthtool@eb78c98 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:8a5d3f6a2e43ed8293f34e06a2f56931d1e88a2694c3bb11b15df4eb256ad163 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 440970084 Source-Link: googleapis/googleapis@5e0a3d5 Source-Link: googleapis/googleapis-gen@b0c628a Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjBjNjI4YTNmYWRlNzY4ZjIyNWQ3Njk5Mjc5MWVhMWJhMmE4ODFiZSJ9 feat: expose new read_time API fields, currently only available in private preview docs: fix type in docstring for map fields PiperOrigin-RevId: 440914241 Source-Link: googleapis/googleapis@0ed730f Source-Link: googleapis/googleapis-gen@b2e5ae9 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjJlNWFlOTdmZDI0ZjY0YWYwZmVmMTk5OWRhZDE0OTQ1ZmRjMzY2MyJ9
* chore: use gapic-generator-python 0.65.1 PiperOrigin-RevId: 441524537 Source-Link: googleapis/googleapis@2a27391 Source-Link: googleapis/googleapis-gen@ab6756a Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWI2NzU2YTQ4Yzg5YjViY2I5ZmI3MzQ0M2NiOGU1NWQ1NzRmNDY0MyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Source-Link: googleapis/synthtool@1b71c10 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:00c9d764fd1cd56265f12a5ef4b99a0c9e87cf261018099141e2ca5158890416 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Source-Link: googleapis/synthtool@f15cc72 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:bc5eed3804aec2f05fad42aacf973821d9500c174015341f721a984a0825b6fd
…307) Source-Link: googleapis/synthtool@6b4d5a6 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f792ee1320e03eda2d13a5281a2989f7ed8a9e50b73ef6da97fac7e1e850b149 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Source-Link: googleapis/synthtool@453a5d9 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:81ed5ecdfc7cac5b699ba4537376f3563f6f04122c4ec9e735d3b3dc1d43dd32
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
* fix: regenerate pb2 file with grpcio-tools * set coverage level to 99% * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Added `pragma: NO COVER` to the generated code. Closes #315 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Code Review
This pull request migrates the google-cloud-datastore package into the monorepo structure. The changes primarily consist of adding new files for the package source, configuration, and CI/CD workflows. The migration appears to be comprehensive. I've identified a few areas for improvement, including a bare except clause that should be more specific, a potential enhancement to the ExplainMetrics API design for better usability, and an incorrect Python version warning that could confuse users, which relates to maintaining clear environment requirements.
| except: # noqa: E722 do not use bare except, specify exception instead | ||
| self._status = self._ABORTED | ||
| raise |
There was a problem hiding this comment.
Using a bare except: can catch system-exiting exceptions like SystemExit or KeyboardInterrupt, which is generally not intended. It's better to catch Exception to handle application-level errors while allowing system-level exceptions to propagate.
| except: # noqa: E722 do not use bare except, specify exception instead | |
| self._status = self._ABORTED | |
| raise | |
| except Exception: | |
| self._status = self._ABORTED | |
| raise | |
| @dataclass(frozen=True) | ||
| class ExplainMetrics: | ||
| """ | ||
| ExplainMetrics contains information about the planning and execution of a query. | ||
|
|
||
| When explain_options.analyze is false, only plan_summary is available. | ||
| When explain_options.analyze is true, execution_stats is also available. | ||
|
|
||
| :type plan_summary: PlanSummary | ||
| :param plan_summary: Planning phase information about the query. | ||
| :type execution_stats: ExecutionStats | ||
| :param execution_stats: Execution phase information about the query. | ||
| """ | ||
|
|
||
| plan_summary: PlanSummary | ||
|
|
||
| @staticmethod | ||
| def _from_pb(metrics_pb): | ||
| dict_repr = MessageToDict(metrics_pb._pb, preserving_proto_field_name=True) | ||
| plan_summary = PlanSummary( | ||
| indexes_used=dict_repr.get("plan_summary", {}).get("indexes_used", []) | ||
| ) | ||
| if "execution_stats" in dict_repr: | ||
| stats_dict = dict_repr.get("execution_stats", {}) | ||
| execution_stats = ExecutionStats( | ||
| results_returned=int(stats_dict.get("results_returned", 0)), | ||
| execution_duration=metrics_pb.execution_stats.execution_duration, | ||
| read_operations=int(stats_dict.get("read_operations", 0)), | ||
| debug_stats=stats_dict.get("debug_stats", {}), | ||
| ) | ||
| return _ExplainAnalyzeMetrics( | ||
| plan_summary=plan_summary, _execution_stats=execution_stats | ||
| ) | ||
| else: | ||
| return ExplainMetrics(plan_summary=plan_summary) | ||
|
|
||
| @property | ||
| def execution_stats(self) -> ExecutionStats: | ||
| raise QueryExplainError( | ||
| "execution_stats not available when explain_options.analyze=False." | ||
| ) | ||
|
|
There was a problem hiding this comment.
The current implementation for conditionally available execution_stats uses a subclass _ExplainAnalyzeMetrics and a base class property that always raises an exception. This can be unintuitive for users, who would need to use try...except or isinstance checks.
A more idiomatic Python approach would be to make execution_stats an optional attribute on ExplainMetrics. This would allow users to simply check if execution_stats is None.
For example:
from typing import Optional
@dataclass(frozen=True)
class ExplainMetrics:
plan_summary: PlanSummary
execution_stats: Optional[ExecutionStats] = None
@staticmethod
def _from_pb(metrics_pb):
dict_repr = MessageToDict(metrics_pb._pb, preserving_proto_field_name=True)
plan_summary = PlanSummary(
indexes_used=dict_repr.get("plan_summary", {}).get("indexes_used", [])
)
execution_stats = None
if "execution_stats" in dict_repr:
stats_dict = dict_repr.get("execution_stats", {})
execution_stats = ExecutionStats(
results_returned=int(stats_dict.get("results_returned", 0)),
execution_duration=metrics_pb.execution_stats.execution_duration,
read_operations=int(stats_dict.get("read_operations", 0)),
debug_stats=stats_dict.get("debug_stats", {}),
)
return ExplainMetrics(
plan_summary=plan_summary, execution_stats=execution_stats
)This would remove the need for the _ExplainAnalyzeMetrics subclass and provide a cleaner API for consumers.
| if sys.version_info < (3, 9): | ||
| warnings.warn( | ||
| "You are using a non-supported Python version " | ||
| + f"({_py_version_str}). Google will not post any further " | ||
| + f"updates to {_package_label} supporting this Python version. " | ||
| + "Please upgrade to the latest Python version, or at " | ||
| + f"least to Python 3.9, and then update {_package_label}.", | ||
| FutureWarning, | ||
| ) |
There was a problem hiding this comment.
This warning for Python versions < 3.9 seems incorrect. It states that these versions are non-supported, but setup.py specifies python_requires=">=3.7" and noxfile.py includes tests for Python 3.7 and 3.8. This could cause unnecessary concern for users on these supported versions. This check should probably be for versions older than 3.7.
References
- When a release introduces breaking changes in environment requirements, such as dropping support for specific Python versions or major dependency versions (e.g., protobuf), prefer a minor version bump over a patch version bump. This maintains the ability to provide patches for the previous minor version for users still requiring the older environment. This comment highlights an inconsistency in stated Python version support, which relates to maintaining clear environment requirements.
fe717b2 to
545663e
Compare
9e13acd to
c453b4d
Compare
aa9cc78 to
23d9d42
Compare
See #11015.
This PR should be merged with a merge-commit, not a squash-commit, in order to preserve the git history.