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

Allow class member values in projection and distinct queries #214

Merged
merged 7 commits into from
Oct 1, 2019
Merged

Allow class member values in projection and distinct queries #214

merged 7 commits into from
Oct 1, 2019

Conversation

chmoder
Copy link
Contributor

@chmoder chmoder commented Sep 27, 2019

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

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.

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

chmoder commented Sep 27, 2019

@googlebot I signed it!

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot googlebot 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
@crwilcox crwilcox added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 30, 2019
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 30, 2019
@crwilcox crwilcox added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 30, 2019
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 30, 2019
@crwilcox
Copy link
Collaborator

@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

@chrisrossi chrisrossi self-assigned this Sep 30, 2019
@chmoder
Copy link
Contributor Author

chmoder commented Oct 1, 2019

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

Copy link
Contributor

@chrisrossi chrisrossi left a comment

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.

@chrisrossi chrisrossi added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 1, 2019
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 1, 2019
@chmoder
Copy link
Contributor Author

chmoder commented Oct 1, 2019

@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
Copy link
Contributor

chrisrossi commented Oct 1, 2019

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!

@chrisrossi chrisrossi added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 1, 2019
@yoshi-kokoro yoshi-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:master Oct 1, 2019
@chrisrossi
Copy link
Contributor

Thank you for your bugfix @chmoder !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This 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