Note that there are some explanatory texts on larger screens.

plurals
  1. POIs it possible to use 'in' keyword to filter on ListProperty(item_type=datetime.date)?
    primarykey
    data
    text
    <p>I have google app engine Event model. I need to find events in some date range. It could be [15.02.2012, 15.03.2012, 18.04.2013]. But when I'm searching I get exception.</p> <p>Model class:</p> <pre><code>class Event(db.Model): title = db.StringProperty() dates = db.ListProperty(item_type=datetime.date) dates = [datetime.date.today(), datetime.date.today() + datetime.timedelta(days = 7), datetime.date.today() + datetime.timedelta(days = 14), datetime.date.today() + datetime.timedelta(days = 24)] </code></pre> <p>Here is my query:</p> <pre><code># exception query = db.GqlQuery('SELECT * FROM Event WHERE dates in :dates', dates=dates) </code></pre> <p>This code is without exception but with wrong results:</p> <pre><code># 0 results, it's wrong query = db.GqlQuery('SELECT * FROM Event WHERE dates in :dates', dates=[datetime.datetime.now()]) </code></pre> <p>Works, but I need 'in':</p> <pre><code>query = db.GqlQuery('SELECT * FROM Event WHERE dates = DATE(2012, 1, 23)') </code></pre> <p>The same exception:</p> <pre><code>query = db.GqlQuery('SELECT * FROM Event WHERE dates in [DATE(2012, 1, 23)]') </code></pre> <p>Description of exception:</p> <pre><code>ERROR 2012-01-23 13:38:28,335 base.py:117] error: code='internal_server_error', message="Unsupported type for property : &lt;type 'datetime.date'&gt;" ERROR 2012-01-23 13:38:28,345 base.py:119] Traceback (most recent call last): File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2\webapp2.py", line 545, in dispatch return method(*args, **kwargs) File "D:\project\eventinarea\eventinarea\handler\event.py", line 12, in get tags=self.param('tags') File "D:\project\eventinarea\eventinarea\logic\event.py", line 20, in search_events logging.info(query.count()) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\db\__init__.py", line 2059, in count raw_query = self._get_query() File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\db\__init__.py", line 2633, in _get_query self._cursor, self._end_cursor) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\gql\__init__.py", line 326, in Bind query.update(enumerated_query) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\datastore.py", line 1723, in update self.__setitem__(filter, value) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\datastore.py", line 1666, in __setitem__ datastore_types.ValidateProperty(' ', value, read_only=True) File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\datastore_types.py", line 1480, in ValidateProperty 'Unsupported type for property %s: %s' % (name, v.__class__)) BadValueError: Unsupported type for property : &lt;type 'datetime.date'&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload