Correct gaedatastore As-Lib Use


Hello, I’m attempting to include Cayley in an appengine project with a datastore backend. I’m having difficulty finding examples of this use case, and my guesses must be wrong because nothing is added to my datastore.

My imports look like this:
_ “

Then I copied the Quickstart As-Lib instruction code but added

graph.InitQuadStore(“gaedatastore”, “”, map[string]interface{}{“HTTPRequest”: r})

and replaced

store, err := cayley.NewMemoryGraph()


store, err := cayley.NewGraph(“gaedatastore”, “”, map[string]interface{}{“HTTPRequest”: r})

where r is the http.Request pointer.

Am I close?


Hi @GreyhoundZero,

Sorry for a long wait. Because of GAE datastore specifics, the code to initialize the database effectively does nothing, except for creating a valid QuadStore for later use. After getting this database handle, you can call ForRequest function to get a connection to GAE datastore associated with a given request. Returned object is ready to use, so you can start writing data to it.



I’m still not able to get this to work. Could you perhaps provide an example of the code to set it up?


I’ve the same problem: how to get this to work? :slight_smile:



I am currently working on a similar project.

My issue is dat http.SetupRoutes is an internal package ( which prevents me from using Cayley as a lib. I might need to fork the project.


@emicklei Feel free to file a PR instead! There is an issue opened for it as well.