Closed GoogleCodeExporter closed 9 years ago
i'm curious, what is the use case for this? for the most part, i figured that
if a property was worth querying, it would be made into a real property instead
of a dynamic property. do you have situations where you have wildly varying
models where you need to query the disparate properties?
using your type inference rules, how would you query a dynamic string property
which contains a number value?
some alternatives to this which might be a little more robust:
- allow extra configuration on the model which indicates the type of some
dynamic properties (e.g. "well known" dynamic properties), although you would
probably just make them real properties
- add another query parameter which provides type information, e.g.:
feq_some_prop=1.0&type_some_prop=float
Original comment by jahlborn@gmail.com
on 13 Jan 2012 at 11:57
There are really TWO points in this issue, a BUGFIX or an Enhancement.
1) MUST BUGFIX: There is a DynamicPropertyHandler BUG that causes the REST API
to crash when someone tries a dynamic property query.
FIX: Add the can_query() method as shown below, with NO dynamic property query
feature.
OR...
2)CAN MAKE Enhancement: Allow dynamic property queries with the full GNU Diff
patch.
a) This patch does allow dynamic string properties which contain a number values.
The number has quotes around it to "cast" as a string, when it matches the
reg-ex already.
ESCAPE RULE: Values can be in quotes: "3.14" or "T23:00:00" to be strings.
b) ONE DATATYPE: Yes, we may have wildly varying models, but only one datatype per property.
The DataStore query-system only considers values "of the same type" when it
reads a query. So, property x can have some "strings" & some "integers, but
feq_x=10 only matches the integer columns.
BUGFIX:
=======
class DynamicPropertyHandler(object):
"""PropertyHandler for dynamic properties on Expando models."""
def __init__(self, property_name):
self.property_name = property_name
# .....
def can_query(self):
"""If Dynamic properties cannot be used in query filters,
then this method must return False.
Otherwise, the code raises AttributeError.
"""
return False
# .....
Original comment by adroffner
on 17 Jan 2012 at 5:23
for some reason, when i wrote my original reply, i missed that you included the
option to quote values to force interpreting them as strings.
Original comment by jahlborn@gmail.com
on 18 Jan 2012 at 3:53
Original comment by jahlborn@gmail.com
on 15 May 2012 at 12:17
This issue was closed by revision r71.
Original comment by jahlborn@gmail.com
on 15 May 2012 at 2:54
i've added support for querying on dynamic properties. i'm not sure why your
code used the "T" prefix on the time string. i used the time format without
the T prefix and added a date format match as well.
Original comment by jahlborn@gmail.com
on 15 May 2012 at 2:54
Original comment by jahlborn@gmail.com
on 6 Jun 2012 at 1:04
Original issue reported on code.google.com by
adroffner
on 13 Jan 2012 at 6:54Attachments: