Closed mmarklar closed 10 years ago
Here's the code for VertexProxy.get_or_create()
:
https://github.com/espeed/bulbs/blob/master/bulbs/element.py#L584
What database server are you using (Rexster, Neo4j Server, Titan Server, etc)?
And how did add the model...?
>>> from people import Person
>>> from bulbs.rexster import Graph
>>> g = Graph()
>>> g.add_proxy("people", Person)
>>> james1 = g.people.create(name="James")
>>> james2 = g.people.get_or_create(name, "James")
>>> assert james1 == james2
Thanks for the prompt reply!
I am using Titan Server. My code looks like this:
from models import User
from bulbs.titan import Graph, Config
titanConfig = Config("host address")
graph = Graph(titanConfig)
graph.add_proxy("user", User)
user = graph.user.get_or_create(username, "emailaddress")
The get_unique()
method was missing from bulbs.titan.index
-- I added it back and pushed the changes to GitHub and PyPi:
https://github.com/espeed/bulbs/blob/master/bulbs/titan/index.py#L274
However, I didn't have time to fire up Titan and test it so please let me know how it works.
Did this resolve the issue?
Presume fixed.
Hi,
Using Titan, I tried following the documentation to get or create a vertex and am getting an error:
I've created a model and added a proxy to it on the graph. This error shows up when I call graph.objectproxy.get_or_create(). I thought I had seen it in the source code but when I looked at my installed version its not there.
Am I doing something wrong or is this a case of the documentation and source getting out of sync?
Thanks