Google App Engine Versioning in the Datastore

戏子无情 提交于 2019-12-03 05:58:26

问题


Google App Engine has the concept of app versions. i.e., you can have multiple versions of your app running concurrently and accessible at different subdomains. For instance: http://1.my-app-name.appspot.com, http://2.my-app-name.appspot.com.

What aspects of the app are actually "versioned" by this? Is it only the Python + Static files codebase? Does the datastore have the concept of "versions"? If not, then what happens when I update the definition of a Google App Engine model?

Thanks!


回答1:


Correct, app version refers only to your uploaded files. Both versions use with the same datastore.

Note that the datastore itself is schema-less. Each entity is an independent collection of key/value pairs. Two entities of the same kind don't have to share the same set of properties, or property types. db.Model provides an ORM abstraction around the datastore, but doesn't define or enforce any kind of global schema.

While the datstore isn't versioned, it does support namespacing. If you want a new datastore segment for each major version of your app, you can do this:

import os
from google.appengine.api import namespace_manager

namespace_manager.set_namespace(os.environ['CURRENT_VERSION_ID'])



回答2:


Datastore has no concept of versions.

When you update a model definition, any entities you create in the future will be of the new type, and the old ones will be of the old type. This frequently leads to runtime errors if your code is not aware of these changes.



来源:https://stackoverflow.com/questions/6063286/google-app-engine-versioning-in-the-datastore

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!