-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Ability to set vertex or edge ID #98
Comments
Given that that last bit of code doesn't actually work, I tried something similar to:
but I am really just grasping at straws here. |
Well, as far as the In [1]: from goblin import Vertex
In [2]: class Person(Vertex): pass
In [3]: p = Person()
In [4]: p.id = 1
In [5]: p.id
Out[5]: 1 Goblin currently doesn't support custom id data types. It possibly could in the future. May I ask why you need this functionality? What provider are you working with? Typically they will handle element ids... |
That makes sense, thanks for the response. My use case is that I have objects with a As an easy solution, I can create my own custom property I am working with Amazon Neptune which returns a random uuid when you create a vertex or edge, so I was trying to control that. Running a simple create vertex function sets the id of the object to something similar to
I am not running the latest goblin due to Neptune's limitations if that makes a difference. Here are my relevant pip packages:
|
What if you simply set the id with your own uuid and then save per usual? leif.id = 'myobjectsuuid'
session.add(leif)
await session.flush() I ask because I truly don't know... |
I thought it would be that easy originally, but it does not seem to be the case.
EDIT: The behavior is the same with or without setting the |
In looking through the code for goblin and aiogremlin I can't see to figure out how to set the vertex or edge ID to a user defined value.
I would presume it would be something as simple as
But in looking at this file there seems to be a lot of special handling for the
id
values. I found this which lead me down the path of something similar tobut the id doesnt seem to stick when I set the vertex and then check the
id
value.Can you point me in the right direction?
The text was updated successfully, but these errors were encountered: