-
Notifications
You must be signed in to change notification settings - Fork 52
suggestion: let me construct the query myself. #129
Comments
When you say "let me construct the query myself", what do you mean? Having To get custom behavior, you're better off using an For example, from an application I wrote in 2013:
|
I mean , just provide me with the arguments (in this case it is the using |
Using With a clear name like I am thinking about ways to get the query info back in a simple way. You could hack this now by using query_in = Product.ProtoModel(fields=...)
query_out = Product.ProtoCollection(collection_fields=...)
@Product.method(request_message=query_in, response_message=query_out, ...)
def my_query(self, req_obj):
# turn the request obj req_obj into a query
query = do_something(req_obj)
items, _, _ = query.fetch_page(some_limit)
# Turn the items into the necessary output of type `query_out`
result = do_something_else(items)
return result |
If so , using As for your example , of course I could do anything I want by just setting custom |
I'm happy to leave this open and discuss. I think it's a legitimate thing to want. As for using |
Although this is an old issue I would love to jump in to the discussion as I just encountered a frustrating use case. def foo_set(self, foo_index):
if 1 == foo_index:
# FooModel.id should be one of 1, 2, 3
else:
# FooModel.id == 5 OR FooModel.id == 212
@EndpointsAliasProperty(name='foo_id', setter=foo_set)
def foo_id(self):
... Using Currently the only thing I can do is not use endpoints-proto-datastore for the specific model. EDIT: Saw it was already accepted in #59. Is there any work around currently? |
@maxandron Thanks for tuning in! There is no work around currently. Any requests / suggestions for how this behavior might be enabled? |
Currently the way I solved it (instead of writing the logic without using your library - which does make life a lot easier), is add the "query" as an additional header. This is not recommended though and I will think of another solution and post it here. |
Thanks. I look forward to it! |
in a
query_method
, when you specifyquery_fields
the library automatically adds a filter of equallityI have found that in many uses you wouldn't nesseceraly want to have an equality filter in there.
examples:
date < now
)ndb.AND(Kind.prop >= 'abc' , Kind.prop <= 'abcz')
)i have found a workaround , but it involves accessing a private property.
The text was updated successfully, but these errors were encountered: