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: Support the Count aggregation query #673

Merged
merged 11 commits into from
Jan 12, 2023
Merged

feat: Support the Count aggregation query #673

merged 11 commits into from
Jan 12, 2023

Conversation

Mariatta
Copy link
Contributor

@Mariatta Mariatta commented Jan 4, 2023

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 #<issue_number_goes_here> 🦕

@Mariatta Mariatta requested review from a team as code owners January 4, 2023 23:01
@product-auto-label product-auto-label bot added size: xl Pull request size is extra large. api: firestore Issues related to the googleapis/python-firestore API. labels Jan 4, 2023
@Mariatta Mariatta force-pushed the feat-aggregate-query branch from 023213f to 76a3690 Compare January 4, 2023 23:03
Copy link

@danieljbruce danieljbruce left a comment

Choose a reason for hiding this comment

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

First pass.

result = count_query.get()
assert len(result) == 1
for r in result[0]:
assert r.alias == "total"

Choose a reason for hiding this comment

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

assert len(result[0]) == 2

for r in result[0]:
assert r.alias in ["total", "all"]

Choose a reason for hiding this comment

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

Would it be more precise to do an assert check here that also verifies the order of "total" and "all" in r.alias? Perhaps two assert statements instead of using a loop?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From my tests, the order of the result has been inconsistent. It doesn't always return it in the order of "total" and then "all".

I've now adjusted this test to assert that:

  • there are two elements returned in the result
  • the returned result has two values and they are both unique
  • the result contains both aliases: "total" and "all"

kolea2
kolea2 previously requested changes Jan 6, 2023
tests/system/test_system.py Show resolved Hide resolved
@Mariatta Mariatta force-pushed the feat-aggregate-query branch from 29864f6 to 674d242 Compare January 6, 2023 23:29
Copy link
Contributor

@kolea2 kolea2 left a comment

Choose a reason for hiding this comment

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

lgtm to me after header fix and PTAL at last comment.

Would like someone from yoshi-python to review as I've only looked from an API perspective. Thanks!

google/cloud/firestore_v1/base_aggregation.py Show resolved Hide resolved
Mariatta and others added 2 commits January 10, 2023 11:30
Refactor system test suite to fallback to default creds
@Mariatta Mariatta added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jan 10, 2023
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jan 10, 2023
@kolea2 kolea2 dismissed their stale review January 11, 2023 18:47

comments addressed. thanks!

@Mariatta Mariatta requested review from kolea2 and nicain January 12, 2023 17:33
Copy link
Contributor

@kolea2 kolea2 left a comment

Choose a reason for hiding this comment

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

lgtm after @googleapis/yoshi-python takes a look as well. Thanks!

credentials = service_account.Credentials.from_service_account_file(
FIRESTORE_CREDS
)
project = FIRESTORE_PROJECT or credentials.project_id
else:
Copy link
Contributor

Choose a reason for hiding this comment

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

would like someone from @googleapis/yoshi-python to take a look at this specifically

Copy link
Contributor

Choose a reason for hiding this comment

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

@kolea2 did anyone from @googleapis/yoshi-python review this? I can't tell from the conversation.

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe @nicain did!

@nicain nicain merged commit dfd4c5d into main Jan 12, 2023
@nicain nicain deleted the feat-aggregate-query branch January 12, 2023 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the googleapis/python-firestore API. size: xl Pull request size is extra large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants