Skip to content
This repository was archived by the owner on May 6, 2026. It is now read-only.

Allow class member values in projection and distinct queries - #214

Merged
chrisrossi merged 7 commits into
googleapis:masterfrom
chmoder:master
Oct 1, 2019
Merged

Allow class member values in projection and distinct queries #214
chrisrossi merged 7 commits into
googleapis:masterfrom
chmoder:master

Conversation

@chmoder

@chmoderchmoder commented Sep 27, 2019

Copy link
Copy Markdown
Contributor

Fixes#212 by setting the projection and distinct_on lists to their string type names. Before it converted them but did not set them.

tcross added 2 commits September 27, 2019 14:39
…o be strings. This commit sets the converted properties so they may be used by the rest of the query.
…o be strings. This commit sets the converted properties so they may be used by the rest of the query.
@googlebot

Copy link
Copy Markdown

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@googlebotgooglebot added the cla: no This human has *not* signed the Contributor License Agreement. label Sep 27, 2019
@chmoder

Copy link
Copy Markdown
ContributorAuthor

@googlebot I signed it!

@googlebot

Copy link
Copy Markdown

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebotgooglebot added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Sep 27, 2019
@crwilcoxcrwilcox added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 30, 2019
@yoshi-kokoroyoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 30, 2019
@crwilcoxcrwilcox added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 30, 2019
@yoshi-kokoroyoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 30, 2019
@crwilcox

Copy link
Copy Markdown
Contributor

@chmoder it seems that a unit test is failing currently

__________ TestQuery.test_constructor_with_class_attribute_projection __________
args = (<MagicMock name='_datastore_query' id='140197655604192'>,)
keywargs = {}
extra_args = [<MagicMock name='_datastore_query' id='140197655604192'>]
entered_patchers = [<unittest.mock._patch object at 0x7f824fab6ac8>]
exc_info = (<class 'TypeError'>, TypeError('test_constructor_with_class_attribute_projection() takes 0 positional arguments but 1 was given',), <traceback object at 0x7f82504ff808>)
patching = <unittest.mock._patch object at 0x7f824fab6ac8>
arg = <MagicMock name='_datastore_query' id='140197655604192'>
@wraps(func)
def patched(*args, **keywargs):
extra_args = []
entered_patchers = []
exc_info = tuple()
try:
for patching in patched.patchings:
arg = patching.__enter__()
entered_patchers.append(patching)
if patching.attribute_name is not None:
keywargs.update(arg)
elif patching.new is DEFAULT:
extra_args.append(arg)
args += tuple(extra_args)
> return func(*args, **keywargs)
E TypeError: test_constructor_with_class_attribute_projection() takes 0 positional arguments but 1 was given

@chrisrossichrisrossi self-assigned this Sep 30, 2019
@chmoder

chmoder commented Oct 1, 2019

Copy link
Copy Markdown
ContributorAuthor

@crwilcox, thank you. I have pushed changes to fix that along with a new test case to test distinct_on with a projection.

@chrisrossichrisrossi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks great, thank you! I will merge once Kokoro awakens from its stupor and runs the tests.

@chrisrossichrisrossi added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 1, 2019
@yoshi-kokoroyoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 1, 2019
@chmoder

Copy link
Copy Markdown
ContributorAuthor

@chrisrossi ,

Thanks Chris! I noticed the build failed due to lint checking. I ran black with kokoros build configuration and pushed that up as well.

@chrisrossi

chrisrossi commented Oct 1, 2019

Copy link
Copy Markdown
Contributor

Yep, I was in the middle of writing a not about how to use "nox" to run "blacken" when you pushed that and made my note obsolete. Thanks!

@chrisrossichrisrossi added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 1, 2019
@yoshi-kokoroyoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 1, 2019
@chrisrossi
chrisrossi merged commit f491fd1 into googleapis:masterOct 1, 2019
@chrisrossi

Copy link
Copy Markdown
Contributor

Thank you for your bugfix @chmoder !

Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yesThis human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Projection list does not support class attributes

5 participants

@chmoder@googlebot@crwilcox@chrisrossi@yoshi-kokoro