-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[db] Support InsertOrUpdate #1092
Comments
Hi, thanks for the issue. Can you please elaborate on what the feature should be? Current |
I intend to perform a full data synchronization from the client to the database, without the client having knowledge of whether each node or the corresponding alias already exists. My current data model strategy involves using the uid field of the node data for alias naming. Nodes are created with the alias method. However, the current implementation of agdb requires that the existence of an alias be verified first; if the alias exists, it results in an immediate error.
|
I understand now. That is definitely doable and I think inserts with existing aliases should not fail in order to uphold the insertOrUpdate. A suggestion what to use instead until this is implemented you could also use an index but I suspect you are doing something similar already using an alias. The one reason I would reommend index is that it is not limited to just one "string" value per node:
|
Anyway, I will update the insert with aliases so it does not fail on existing ones. |
Thx. |
When inserting edges, there is a similar issue. For example, if there is an edge of type 'out' between two nodes, when I attempt to insert another edge of type 'out', it will no longer create a new edge but will simply update the 'values' instead." when attempting to insert an edge of the same type between two nodes that already have such an edge, the system will not create a duplicate edge but will update the existing edge's values. |
Yes with the server one cannot batch the "if". I might implement more general insertOrUpdate accounting for topology as well including edges. Thanks again for bringing this up, good use case. :-) |
I think I have a solution that is robust enough to support any use case in the "insertOrUpdate" area. Motivational example how it would look like:
Basically adding I will separately update the insert nodes if the alias exists so that does not to fail because that should not be failing regardless I think. The above however will not support aliases as they are not searchable, they are more topology anchors akin to table names in RDBMS/SQL. Still I find it neat you figured you could use them to simulate "insertOrUpdate"! |
I believe this is a great solution. |
[db] Support InsertOrUpdate feature
The text was updated successfully, but these errors were encountered: