App Engine:如何“重置”数据存储? [英] App Engine: How to "reset" the datastore?

查看:93
本文介绍了App Engine:如何“重置”数据存储?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我正在App Engine(Java)中进行开发,经过大量尝试和部署之后,我需要重置数据存储。我添加了很多随机数据来测试性能,除了实体改变了很多,所以我需要删除所有数据,表,索引。

Well, I'm developing in App Engine (Java) and after a lot of tries and deployments, I need to reset the datastore. There is a lot of random data I added to test performance, and besides that the entities changed a lot, so I need to delete all: data, tables, indexes.

我该怎么做?

推荐答案

没有与SQL中的DROP TABLE或TRUNCATE TABLE等效的内置命令。您只需在您的应用中创建一个删除所有内容页面,然后通过脚本重复呼叫该页面。在该页面中,您希望删除尽可能多的实体,但在请求超时之前仍然可以合理地完成。确切的代码取决于您使用的是JDO / JPA还是低级API。 (低级别API会更快,因为您可以使用批量操作。)

There is no built in command equivalent to DROP TABLE or TRUNCATE TABLE in SQL. You just need to create a "delete everything" page in your app, then repeatedly call that page via a script. In that page, you want to delete as many entities as you can yet still reasonably expect to finish before the request times out. The exact code depends on whether you're using JDO/JPA or the low level API. (the low level API will be faster because you can use batch operations.)

previous 所以问题几乎相同,只适用于Python

This previous SO question is pretty much the same, only for Python

这篇关于App Engine:如何“重置”数据存储?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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