从命令行访问sqlite数据存储区

时间:2011-08-10 13:41:10

标签: google-app-engine

我一直在从命令行访问传统数据存储区,如下所示:

from google.appengine.api import apiproxy_stub_map
from google.appengine.api.datastore_file_stub import DatastoreFileStub

os.environ['APPLICATION_ID']="myapp"
apiproxy_stub_map.apiproxy=apiproxy_stub_map.APIProxyStubMap()
stubname, stub = 'datastore_v3', DatastoreFileStub(os.environ["APPLICATION_ID"], Datastore, "/")  
apiproxy_stub_map.apiproxy.RegisterStub(stubname, stub)

我已升级到sqlite数据存储区,需要更新存根(可能是stubname),大概是使用DatastoreSqliteStub,但似乎无法初始化它;有什么建议吗?

谢谢!

1 个答案:

答案 0 :(得分:0)

这是我经常在AppEngine项目中重用的一个小模块:ae.py

它让我这样做:

import ae
ae.connect_local_datastore()

位于脚本的顶部。或者使用remote_api设置,您也可以这样做:

ae.connect_remote_datastore()

可以找到使用此功能的简单console.py脚本here

希望他们有所帮助。

相关问题