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

Support equality filter in db.ListProperty #94

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eko-wibowo
Copy link

db.ListProperty.validate expects the param to be a value to be assigned to the field (which is a List). However the .filter() method expects the value to be a single element. This issue only occurs for db.ListProperty, ndbProperty with repeated flag works just fine.

Without this changes:

python test/mapreduce/input_readers_test.py 
======================================================================
ERROR: testValidate_Filters (__main__.DatastoreInputReaderTest)
Tests validating filters parameter.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test/mapreduce/input_readers_test.py", line 814, in testValidate_Filters
    self.reader_cls.validate(mapper_spec)
  File "/Users/eko/projects/appengine-mapreduce/python/src/mapreduce/input_readers.py", line 640, in validate
    cls._validate_filters(filters, model_class)
  File "/Users/eko/projects/appengine-mapreduce/python/src/mapreduce/input_readers.py", line 683, in _validate_filters
    raise errors.BadReaderParamsError(e)
BadReaderParamsError: Property mvp_str must be a list

With this changes

......................................................................................................WARNING:root:File /testing/file-000 may have been removed. Skipping file.
WARNING:root:File /testing/file-018 may have been removed. Skipping file.
....................................................................
----------------------------------------------------------------------
Ran 170 tests in 26.231s

OK

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. 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, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@eko-wibowo
Copy link
Author

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

ka-role pushed a commit to Khan/appengine-mapreduce-1 that referenced this pull request Jul 7, 2018
It looks like the mapreduce code doesn't properly validate filters of
list properties.

I don't know if this fix is right, but we can try it!

Implements GoogleCloudPlatform#94

Test plan:
Fingers crossed

Auditors: benkraft
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants