Model.put() error from Idle

28 views
Skip to first unread message

Vijayakumar Subburaj

unread,
Aug 5, 2008, 9:01:51 AM8/5/08
to Google App Engine
I am getting some error when I do mode.put() from Idle. Anything I am
missing?

--
>>> from google.appengine.ext import db
>>> class test(db.Model):
x = db.StringProperty(required=True, default='test')


>>> a = test()
>>> a.put()

Traceback (most recent call last):
File "<pyshell#7>", line 1, in <module>
a.put()
File "C:\appe\google\appengine\ext\db\__init__.py", line 618, in put
return datastore.Put(self._entity)
File "C:\appe\google\appengine\api\datastore.py", line 160, in Put
apiproxy_stub_map.MakeSyncCall('datastore_v3', 'Put', req, resp)
File "C:\appe\google\appengine\api\apiproxy_stub_map.py", line 45,
in MakeSyncCall
assert stub, 'No api proxy found for service "%s"' % service
AssertionError: No api proxy found for service "datastore_v3"
>>> import sys
>>> print sys.path
['C:\\Python25\\Lib\\idlelib', 'C:\\appe', 'C:\\appe\\lib\\django', 'C:
\\appe\\lib\\webob', 'C:\\appe\\lib\\yaml\\lib', 'C:\\Python25', 'C:\
\WINDOWS\\system32\\python25.zip', 'C:\\Python25\\DLLs', 'C:\\Python25\
\lib', 'C:\\Python25\\lib\\plat-win', 'C:\\Python25\\lib\\lib-tk', 'C:\
\Python25\\lib\\site-packages']

Vijayakumar Subburaj

unread,
Aug 5, 2008, 9:17:10 AM8/5/08
to Google App Engine
On Aug 5, 6:01 pm, v4vijayakumar <vijayakumar.subbu...@gmail.com>
wrote:
one more issue. GQL with 'and' just executed fine, but with 'or' it is
failing.

>>> q = test.gql("WHERE x = :1 and y = :1", 'test')
>>> q = test.gql("WHERE x = :1 or y = :1", 'test')

Traceback (most recent call last):
File "<pyshell#21>", line 1, in <module>
q = test.gql("WHERE x = :1 or y = :1", 'test')
File "C:\appe\google\appengine\ext\db\__init__.py", line 887, in gql
*args, **kwds)
File "C:\appe\google\appengine\ext\db\__init__.py", line 1523, in
__init__
self._proto_query = gql.GQL(query_string, _app=app)
File "C:\appe\google\appengine\ext\gql\__init__.py", line 171, in
__init__
if not self.__Select():
File "C:\appe\google\appengine\ext\gql\__init__.py", line 560, in
__Select
return self.__From()
File "C:\appe\google\appengine\ext\gql\__init__.py", line 576, in
__From
return self.__Where()
File "C:\appe\google\appengine\ext\gql\__init__.py", line 591, in
__Where
return self.__FilterList()
File "C:\appe\google\appengine\ext\gql\__init__.py", line 621, in
__FilterList
return self.__OrderBy()
File "C:\appe\google\appengine\ext\gql\__init__.py", line 735, in
__OrderBy
return self.__Limit()
File "C:\appe\google\appengine\ext\gql\__init__.py", line 777, in
__Limit
return self.__Offset()
File "C:\appe\google\appengine\ext\gql\__init__.py", line 796, in
__Offset
return self.__Hint()
File "C:\appe\google\appengine\ext\gql\__init__.py", line 819, in
__Hint
return self.__AcceptTerminal()
File "C:\appe\google\appengine\ext\gql\__init__.py", line 546, in
__AcceptTerminal
self.__Error('Expected no additional symbols')
File "C:\appe\google\appengine\ext\gql\__init__.py", line 485, in
__Error
(error_message, self.__symbols[self.__next_symbol]))
BadQueryError: Parse Error: Expected no additional symbols at symbol or

ryan

unread,
Aug 5, 2008, 8:56:04 PM8/5/08
to Google App Engine
hi vijayakumar!

On Aug 5, 6:01 am, v4vijayakumar <vijayakumar.subbu...@gmail.com>
wrote:
> I am getting some error when I do mode.put() from Idle. Anything I am
> missing?

if you want to use the app engine python libraries from outside the
dev_appserver, you need to do a little extra setup. see this thread:

http://groups.google.com/group/google-appengine/browse_thread/thread/7c7cd1babc4484d

> one more issue. GQL with 'and' just executed fine, but with 'or' it is failing.

GQL doesn't have an OR operator. :P

http://code.google.com/appengine/docs/datastore/gqlreference.html

http://groups.google.com/group/google-appengine/browse_thread/thread/c64871727e344023

Vijayakumar Subburaj

unread,
Aug 8, 2008, 10:13:24 AM8/8/08
to Google App Engine


On Aug 6, 5:56 am, ryan <ryanb+appeng...@google.com> wrote:
> hi vijayakumar!
>
> On Aug 5, 6:01 am, v4vijayakumar <vijayakumar.subbu...@gmail.com>
> wrote:
>
> > I am getting some error when I do mode.put() from Idle. Anything I am
> > missing?
>
> if you want to use the app engine python libraries from outside the
> dev_appserver, you need to do a little extra setup. see this thread:
>
> http://groups.google.com/group/google-appengine/browse_thread/thread/...
>
> > one more issue. GQL with 'and' just executed fine, but with 'or' it is failing.
>
> GQL doesn't have an OR operator. :P

thats not fair. :(

one more doubt. whats wrong with this code,

>>> class test(db.Model):
a = db.StringProperty(required=True, default='test1')
b = db.StringProperty(required=True, default='test2')
c = db.BooleanProperty(required=True, default=False)
>>> q = test.gql("where not c and :1 in [a, b]", 'blah')
>>> q = test.gql("where c=False and :1 in [a, b]", 'blah')

--
>>> class test(db.Model):
a = db.StringProperty(required=True, default='test1')
b = db.StringProperty(required=True, default='test2')
c = db.BooleanProperty(required=True, default=False)
>>> q = test.gql("where not c and :1 in [a, b]", 'blah')

Traceback (most recent call last):
File "<pyshell#38>", line 1, in <module>
q = test.gql("where not c and :1 in [a, b]", 'blah')
File "C:\appe\google\appengine\ext\db\__init__.py", line 887, in gql
*args, **kwds)
File "C:\appe\google\appengine\ext\db\__init__.py", line 1523, in
__init__
self._proto_query = gql.GQL(query_string, _app=app)
File "C:\appe\google\appengine\ext\gql\__init__.py", line 171, in
__init__
if not self.__Select():
File "C:\appe\google\appengine\ext\gql\__init__.py", line 560, in
__Select
return self.__From()
File "C:\appe\google\appengine\ext\gql\__init__.py", line 576, in
__From
return self.__Where()
File "C:\appe\google\appengine\ext\gql\__init__.py", line 591, in
__Where
return self.__FilterList()
File "C:\appe\google\appengine\ext\gql\__init__.py", line 604, in
__FilterList
self.__Error('Invalid WHERE Condition')
File "C:\appe\google\appengine\ext\gql\__init__.py", line 485, in
__Error
(error_message, self.__symbols[self.__next_symbol]))
BadQueryError: Parse Error: Invalid WHERE Condition at symbol c
>>> q = test.gql("where c=False and :1 in [a, b]", 'blah')

Traceback (most recent call last):
File "<pyshell#39>", line 1, in <module>
q = test.gql("where c=False and :1 in [a, b]", 'blah')
File "C:\appe\google\appengine\ext\db\__init__.py", line 887, in gql
*args, **kwds)
File "C:\appe\google\appengine\ext\db\__init__.py", line 1523, in
__init__
self._proto_query = gql.GQL(query_string, _app=app)
File "C:\appe\google\appengine\ext\gql\__init__.py", line 171, in
__init__
if not self.__Select():
File "C:\appe\google\appengine\ext\gql\__init__.py", line 560, in
__Select
return self.__From()
File "C:\appe\google\appengine\ext\gql\__init__.py", line 576, in
__From
return self.__Where()
File "C:\appe\google\appengine\ext\gql\__init__.py", line 591, in
__Where
return self.__FilterList()
File "C:\appe\google\appengine\ext\gql\__init__.py", line 619, in
__FilterList
return self.__FilterList()
File "C:\appe\google\appengine\ext\gql\__init__.py", line 598, in
__FilterList
self.__Error('Invalid WHERE Identifier')
File "C:\appe\google\appengine\ext\gql\__init__.py", line 485, in
__Error
(error_message, self.__symbols[self.__next_symbol]))
BadQueryError: Parse Error: Invalid WHERE Identifier at symbol :1

ryan

unread,
Aug 8, 2008, 11:53:42 AM8/8/08
to Google App Engine
On Aug 8, 7:13 am, v4vijayakumar <vijayakumar.subbu...@gmail.com>
wrote:
>
> one more doubt. whats wrong with this code,
>
> >>> q = test.gql("where not c and :1 in [a, b]", 'blah')
> >>> q = test.gql("where c=False and :1 in [a, b]", 'blah')

positional parameters like :1 can only be used for filter values, not
for property names. you want "where c=False and blah in [a, b]"
instead.

http://code.google.com/appengine/docs/datastore/gqlreference.html
Reply all
Reply to author
Forward
0 new messages