开发者

sqlite datastore and index.yaml

开发者 https://www.devze.com 2023-03-28 13:46 出处:网络
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:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消