pietermartin / sqlg

TinkerPop graph over sql
MIT License
246 stars 51 forks source link

Can I swap AWS Neptune with this solution? #373

Closed ihoro closed 4 years ago

ihoro commented 4 years ago

Hello,

This project looks quite interesting, but is this solution applicable for the following set of requirements? a) "any language" gremlin client library is used to connect to ws://*:8182/gremlin endpoint and run traversals on that server; i.e. Graph DB's users are not Java apps, they can be anything, e.g. JavaScript, Go, Rust, Python, etc b) server should be configurable for single or list cardinality by default, or at least support them in queries; i.e. it should handle a vertex/edge's property as an array c) server should support custom vertex/edge IDs as UUID, or at least as strings (i.e. UUID will be presented as a string then) d) server should support some kind of indexing for performance (i.e. property indexing); it looks to be okay if it requires manual initial setup

Unfortunately, I didn't get answers to these questions from the docs. I didn't even get how to run a server, i.e. it sounds like I should inject it into my Java based app and point it to some backend like pg.

Thanks in advance.

pietermartin commented 4 years ago

a) The general pattern for languages outside java is to use the GremlinServer

b) Not quite sure what you mean here? Properties are how you create them, String or String[]... DataTypes

c) Sqlg can create user defined IDs. You have to create the topology api to create the Vertex/EdgeLabel and specify which columns make up the primary key.

VertexLabel aVertexLabel = this.sqlgGraph.getTopology().getPublicSchema().ensureVertexLabelExist(
        "A",
        new LinkedHashMap<String, PropertyType>() {{
            put("uid1", PropertyType.varChar(100));
            put("uid2", PropertyType.varChar(100));
            put("name", PropertyType.STRING);
        }},
        ListOrderedSet.listOrderedSet(Arrays.asList("uid1", "uid2"))
);

I see I have not documented this. I'll add a issue to document this. User defined uid is a requirement to use postgresql partitioning.

d) Sqlg supports indexes

I would not actually suggest using Sqlg outside java. The gremlin server will work but its a lowest common denominator vibe. Most importantly the batch mode features, which is I'd say is critical, will not work via gremlin server. The topology api is outside gremlin server, so there is no way to create custom uids using gremlin server.

As there has been very little interest to use Sqlg outside java I have not spent time on trying to support these features via the gremlin server. I am not sure but I think it would require custom somethings in the actual language variants. i.e. how to, from javascript or python, invoke Sqlg's custom api?

ihoro commented 4 years ago

Thank you for the explanation.