Skip to content

Instantly share code, notes, and snippets.

@nilleb
Last active January 6, 2018 13:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nilleb/419122f2f6f1228650dd2dccbd01c5af to your computer and use it in GitHub Desktop.
Save nilleb/419122f2f6f1228650dd2dccbd01c5af to your computer and use it in GitHub Desktop.
Hack: use google-cloud-spanner in a google-app-engine app
from google.appengine.ext import vendor
vendor.add('vendor/libs')
import pickle
class DummyProcess(object):
def start(self, target):
target()
class DummyProcessing(ModuleType):
def __init__(self):
pass
@staticmethod
def Process(target):
return DummyProcess(target)
@staticmethod
def Queue():
return Queue()
sys.modules['multiprocessing'] = DummyProcessing
sys.modules['dill'] = pickle
from google.cloud import spanner
# your google-cloud-spanner consumer code goes here
cd vendor/libs
pip install --upgrade -t . google-cloud google-cloud-core==0.23.0 google-cloud-spanner
cd ../..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment