-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Fix #83: Add 'exclude_from_indexes' method to Entity. #330
Conversation
@@ -387,6 +388,9 @@ def save_entity(self, dataset_id, key_pb, properties): | |||
|
|||
:type properties: dict | |||
:param properties: The properties to store on the entity. | |||
|
|||
:type exclude_from_indexes: sequence of str |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@silvolu Do you guys support this in For example, a simple test like: e1 = dataset.entity(kind='Test')
e1['name'] = 'val'
e1.save()
e2 = dataset.entity(kind='Test')
e2['name'] = 'val'
e2._exclude_from_indexes = set(['name'])
e2.save()
query = dataset.query('Test').filter('name =', 'val').limit(2)
results = query.fetch()
# Make sure len(results) == 1 @tseaver Shouldn't we have support for this in the |
Ugh, yet more reasons to detest those "convenience" APIs. ;) |
Indeed. We should work hard to have a single entry point, but one that is very nice. The "old way", i.e. within the App Engine environment, the dataset ID is always known, so users can just skip right to creating entities. Maybe we could do similar here by reading an env var or modifying a constant on a module or something else. |
@dhermes we support it in a different way (you set it on the attribute), and we have unit tests only for it, given that the essence of it is setting the correct value on the pb sent over. |
@silvolu An equality query on a single property does not require an index. My test code above should return a single entry ( FWIW I'm a bit worried about more regression tests as they already take a fair bit of time to run. Maybe we could have a simple suite and an expanded suite that runs only when releases are cut. |
@dhermes I seem to constantly forget how indexes work :) |
Everything looks good except for str vs. unicode question |
@tseaver Thanks for making the change. LGTM. I'm still unclear if using |
Rebased to resolve conflict from #331. |
Still LGTM. Still unclear about using |
Fix #83: Add 'exclude_from_indexes' method to Entity.
Set it via ctor argument.
Pass it to
Connection.save_entity
.Fields in the sequence will have the
indexed
field set False in thecorrsponding protobuf.
Fixes #83.