py3 migration and memcache

30 views
Skip to first unread message

Daniel Kramer

unread,
Aug 24, 2021, 4:36:42 AM8/24/21
to Google App Engine
I've been porting my python2.7 app to python3. I've got it mostly working with the exception of memcache.  

In the 2.7 legacy appengine I was able to store and retrieve ndb models, or lists of them etc. With Redis I'm not clear how to do this as it doesn't accept models directly.. looks like I need to serialize them first.  Just having issues with date objects in my models that won't serialize.  I'm sure there are work arounds and figure many of you have been here before but I'm not finding an elegant solution

I also noticed that Memcached is an alternative (maybe beta?) option to Redis on google cloud services.  I spun up an instance and I am able to save and retrieve models.. when the model comes back it's actually a str object.. sort of looks like what you'd get if you print() your model to see all the properties.  Is it possible to populate a model with the data from this string simply?

What's the recommended solution?  I imagine pickle may also be an option but I've been reading it's not very fast

Thanks
D

NoCommandLine

unread,
Oct 5, 2021, 11:45:58 AM10/5/21
to Google App Engine
Hi,

If you haven't gotten this working and in case you're not aware, you can now use the memcache API with Python 3 (i.e. there is no reason to use Redis). See this Twitter thread for more details 

..... NoCommandLine ......
 https://nocommandline.com

A GUI for Google App Engine
Reply all
Reply to author
Forward
0 new messages