Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
7f46c52
added basics for query profiling
daniel-sanche May 6, 2024
e66c57f
changes dataclass ordering
daniel-sanche May 6, 2024
1f1e8e1
refactored
daniel-sanche May 6, 2024
1af61d1
added exceptions
daniel-sanche May 6, 2024
ac11cd2
refactoring of dataclasses
daniel-sanche May 6, 2024
730411b
outlines of unit tests
daniel-sanche May 6, 2024
5823dbc
got system tests passing
daniel-sanche May 10, 2024
aa9f334
implemented some unit tests
daniel-sanche May 10, 2024
5cdba98
got query tests passing
daniel-sanche May 11, 2024
0f971c6
added profiling to aggregation query
daniel-sanche May 11, 2024
387b01b
added kwargs to client.aggregation_query
daniel-sanche May 20, 2024
ddec61d
partially implemented aggregation query system tests
daniel-sanche May 20, 2024
cca1f00
removed outdated test
daniel-sanche May 20, 2024
cd97827
added last agg system test
daniel-sanche May 20, 2024
96d6d52
fixed lint
daniel-sanche May 20, 2024
3cf9d8a
fixed system tests
daniel-sanche May 20, 2024
4c24b84
added in transaction tests
daniel-sanche May 21, 2024
73ad241
fixed system tests
daniel-sanche May 21, 2024
686e722
moved datacalsses into new file
daniel-sanche May 21, 2024
4ebf0de
improved docstrings
daniel-sanche May 21, 2024
f2de107
aggregation uses nested query explain options
daniel-sanche May 21, 2024
0abea2f
fixed parsing bug
daniel-sanche May 21, 2024
d4f4475
added samples
daniel-sanche May 21, 2024
fc6187e
moved query_profile model tests to new file
daniel-sanche May 21, 2024
eced67d
better handle empty debug stats
daniel-sanche May 21, 2024
730e7cb
fixed test
daniel-sanche May 21, 2024
ab8d7a2
fixed lint
daniel-sanche May 21, 2024
e02b20d
fixed samples lint
daniel-sanche May 21, 2024
02afe92
added missing test cases
daniel-sanche May 21, 2024
5dcf063
added back removed test
daniel-sanche May 21, 2024
5cf1f88
fixed lint
daniel-sanche May 21, 2024
51ffa9e
added test
daniel-sanche May 21, 2024
c6df706
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] May 21, 2024
7d2e597
more lenient in system test
daniel-sanche May 21, 2024
e9e72b6
removed import
daniel-sanche May 21, 2024
083e604
added debug stats checks
daniel-sanche May 24, 2024
58c3c57
Apply suggestions from code review
daniel-sanche Jun 21, 2024
c77f299
Merge branch 'main' into query_profiling
daniel-sanche Jul 8, 2024
7d802e3
Merge branch 'main' into query_profiling
daniel-sanche Jul 29, 2024
5a644ab
Merge branch 'main' into query_profiling
daniel-sanche Aug 2, 2024
b2a9a77
🦉 Updates from OwlBot post-processor
gcf-owl-bot[bot] Aug 2, 2024
e67ca72
fixed new_query calculation
daniel-sanche Aug 2, 2024
4319ac7
added comment
daniel-sanche Aug 7, 2024
175c76a
Merge branch 'main' into query_profiling
daniel-sanche Aug 7, 2024
c5d8a76
fixed offset calculation
daniel-sanche Aug 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixed new_query calculation
  • Loading branch information
daniel-sanche authored Aug 2, 2024
commit e67ca728a982b15b6d2bc0f18fe9c27f07014471
10 changes: 5 additions & 5 deletions google/cloud/datastore/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,11 +831,11 @@ def _next_page(self):
# skipped all of the results yet. Don't return any results.
# Instead, rerun query, adjusting offsets. Datastore doesn't process
# more than 1000 skipped results in a query.
old_query_pb = query_pb
query_pb = query_pb2.Query()
query_pb._pb.CopyFrom(old_query_pb._pb) # copy for testability
query_pb.start_cursor = response_pb.batch.end_cursor
query_pb.offset -= response_pb.batch.skipped_results
new_query_pb = query_pb2.Query()
new_query_pb._pb.CopyFrom(request["query"]._pb) # copy for testability
new_query_pb.start_cursor = response_pb.batch.skipped_cursor
new_query_pb.offset -= response_pb.batch.end_cursor
request["query"] = new_query_pb

response_pb = self.client._datastore_api.run_query(
request=request.copy(), **kwargs
Copy link

Choose a reason for hiding this comment

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

Is request.copy() here also for testability? copy() is only a shallow copy for dict, do we need to make a deep copy here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, IIRC it's just for testability.

We want to be able to make assertions about the arguments passed in to each call, which doesn't work if the same request instance is used for each request

Expand Down