on a related note... web apps rarely need to load the blob data at the
same time as the record...   the record should get loaded and then
that will create a link/img on a page which will make a separate
request for the blob.  and if I've read correctly... GAE always pulls
the entire object when you request it (you can't only select a few
fields)... do you know if this is still true?

if so, then I suppose the best design would be to put the blobs in a
separate table instead of the same table...

but as for automating the schema maintenance... if I create
  auth_user.Field('photo','upload')
instead of creating a 'photo' (string) and 'photo_blob' (blob) on the
same table, it should maybe create just 'photo' (string) and another
table called 'auth_user_photo' with one field and a reference?  or
maybe some other scheme... I dunno...

I did run across this Webslices post... but haven't dug into it yet to
see what it solves/provides...
  http://www.web2pyslices.com/main/slices/take_slice/63


On Jun 22, 3:27 pm, NickFranceschina <[email protected]>
wrote:
> OK... I had uploaded a 900+kb photo by mistake (thought I had uploaded
> 100k photo)
>
> also just realized that the schema for an "upload" Field on GAE
> includes an extra 'blob' type on the record (obviously, since we can't
> store files)... and my code was trying to convert records to JSON and
> blowing up... have to tell it to skip any 'blob' fields.
>
> working now!  thanks!!
>
> On Jun 22, 2:50 am, mdipierro <[email protected]> wrote:
>
>
>
> > You have something too large in the session and the datastore refuses
> > to store the session in the database.
>
> > On Jun 21, 11:32 pm, NickFranceschina <[email protected]>
> > wrote:
>
> > > I'm not sure what I'm doing wrong...   I've built a JSON service on
> > > top of Web2py that uses Auth.login_bare() to authenticate via
> > > AJAX...   my auth_user table looked like this (standard):
>
> > > auth.settings.table_user = db.define_table('auth_user',
> > >     Field('first_name', length=512,default='', required=True),
> > >     Field('last_name', length=512,default='', required=True),
> > >     Field('display_name', length=512,default='', required=True),
> > >     Field('email', length=512,default='',required=True,
> > >           requires = [IS_EMAIL(),IS_NOT_IN_DB(db,'auth_user.email')]),
> > >     Field('password', 'password', readable=False, required=True,
> > >           label='Password',
> > >           requires=CRYPT(auth.settings.hmac_key)),
> > >     Field('registration_key', length=512,
> > >           writable=True, readable=True,default=''),
> > >     Field('reset_password_key', length=512,
> > >           writable=False, readable=False, default=''),
> > >     )
>
> > > but then I added this field to the auth_user table:
>
> > >     Field('photo', 'upload')
>
> > > and now it blows up on GAE at the moment it tries to do this (inside
> > > of login_bare):
>
> > >                 session.auth = Storage(user=user,
> > > last_visit=request.now,
>
> > > expiration=self.settings.expiration)
>
> > > with this error message:
>
> > > 'Traceback (most recent call last):\n  File "C:\\SVNs\\T4H\\Buttrcup\
> > > \www\\gluon\\main.py", line 391, in wsgibase\n
> > > session._try_store_in_db(request, response)\n  File "C:\\SVNs\\T4H\
> > > \Buttrcup\\www\\gluon\\globals.py", line 356, in _try_store_in_db\n
> > > table._db(table.id == record_id).update(**dd)\n  File "C:\\SVNs\\T4H\
> > > \Buttrcup\\www\\gluon\\contrib\\gql.py", line 744, in update\n
> > > item.put()\n  File "C:\\Program Files (x86)\\Google\\google_appengine\
> > > \google\\appengine\\ext\\db\\__init__.py", line 833, in put\n
> > > return datastore.Put(self._entity, rpc=rpc)\n  File "C:\\Program Files
> > > (x86)\\Google\\google_appengine\\google\\appengine\\api\
> > > \datastore.py", line 282, in Put\n    \'datastore_v3\', \'Put\', req,
> > > datastore_pb.PutResponse(), rpc)\n  File "C:\\Program Files (x86)\
> > > \Google\\google_appengine\\google\\appengine\\api\\datastore.py", line
> > > 186, in _MakeSyncCall\n    rpc.check_success()\n  File "C:\\Program
> > > Files (x86)\\Google\\google_appengine\\google\\appengine\\api\
> > > \apiproxy_stub_map.py", line 474, in check_success\n
> > > self.__rpc.CheckSuccess()\n  File "C:\\Program Files (x86)\\Google\
> > > \google_appengine\\google\\appengine\\api\\apiproxy_rpc.py", line 149,
> > > in _WaitImpl\n    self.request, self.response)\n  File "C:\\Program
> > > Files (x86)\\Google\\google_appengine\\google\\appengine\\api\
> > > \datastore_file_stub.py", line 667, in MakeSyncCall\n    response)\n
> > > File "C:\\Program Files (x86)\\Google\\google_appengine\\google\
> > > \appengine\\api\\apiproxy_stub.py", line 75, in MakeSyncCall\n
> > > \'The request to API call %s.%s() was too large.\' % (service, call))
> > > \nRequestTooLargeError: The request to API call datastore_v3.Put() was
> > > too large.\n'
>
> > > I'm using Wing IDE, and can't figure out how to debut through the GAE
> > > server...
>
> > > can someone point me in the right direction?  I'm going on about 40hrs
> > > of straight development... and I can't think straight anymore...
>
> > > Thank you!!
> > > -Nick Franceschina

Reply via email to