在Google App Engine中更新模型模式? [英] Updating Model Schema in Google App Engine?

查看:140
本文介绍了在Google App Engine中更新模型模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谷歌提议​​每次更改一个条目的默认值....



http://code.google.com/appengine/articles/update_schema.html



我有一个有一百万行的模型,用网络浏览器做这件事会花费我很多时间。另一个选择是使用任务队列来运行它,但这会花费我很多CPU时间。因为数据存储是无模式的,所以您确实需要在模型的每个实例上添加或删除属性。使用任务队列应该使用与其他任何方式完全相同数量的CPU,所以请遵循这一点。



在完成所有这些工作之前,请确保你真的需要这样做。正如您链接到的文章中指出的那样,并非特定模型的所有实体都需要具有相同的一组属性。为什么不改变你的Model类来检查是否存在新的或删除的属性,并在你碰巧正在写入的时候更新实体。


Google is proposing changing one entry at a time to the default values ....

http://code.google.com/appengine/articles/update_schema.html

I have a model with a million rows and doing this with a web browser will take me ages. Another option is to run this using task queues but this will cost me a lot of cpu time

any easy way to do this?

解决方案

Because the datastore is schema-less, you do literally have to add or remove properties on each instance of the Model. Using Task Queues should use the exact same amount of CPU as doing it any other way, so go with that.

Before you go through all of that work, make sure that you really need to do it. As noted in the article that you link to, it is not the case that all entities of a particular model need to have the same set of properties. Why not change your Model class to check for the existence of new or removed properties and update the entity whenever you happen to be writing to it anyhow.

这篇关于在Google App Engine中更新模型模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆