I'm migrating from the original file- based datastore to the sqlite version.
I have a command line script which initialises the stub as follows:
from google.appengine.api import apiproxy_stub_map
from google.appengine.datastore.datastore_sqlite_stub import DatastoreSqliteStub
apiproxy_stub_map.apiproxy=apiproxy_stub_map.APIProxyStubMap()
apiproxy_stub_map.apiproxy.RegisterStub("datastore_v3", DatastoreSqliteStub("myapp", Datastore, "/"))
Querying the datastore raises NeedIndexError; however -
- the relevant index definitions 开发者_如何转开发are staring me in the face in index.yaml
- there was no problem accessing the old file- based datastore [using DatastoreFileStub]
Am I somehow failing to initialise the datastore with index.yaml ?
The constructor arguments DatastoreSqliteStub
takes are:
app_id,
datastore_file,
require_indexes=False,
verbose=False,
service_name='datastore_v3',
trusted=False,
consistency_policy=None
By providing those named arguments, you're specifying the app ID (correctly), the datastore file, which you've specified is some object called Datastore
, and whether or not to require indexes (which you've set to '/', which evaluates to True). Instead, just specify the first and third arguments.
精彩评论