This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2 | |
""" | |
This script automates the task of connecting to a running App Engine server, | |
whether it's a local dev_appserver or a live app. | |
If PyQt4 is installed, it will ask for credentials inside a dialog box | |
instead of prompting in the terminal. This is good for shells that do | |
not support getpass (iPython). | |
It will automatically add an import path for a local virtualenv in the app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This Gist is an alternative to ndb.get_multi which is a lot faster in some circumstances. | |
# For example, fetching 500 small entities with 90% hit rate is 3x faster than ndb, | |
# based on my tests in App Engine production environment (F1). | |
# In general it is worthwhile when fetching a large number of small entities, with >50% memcache hit rate. | |
# For any keys not in memcache, it falls back on a normal ndb.get_multi | |
# The code is based on the original ndb.context code, but avoids the task queue overhead. | |
import logging | |
from google.appengine.api import memcache |