Getting My Data Out Of AWS Neptune (In Theory)


Getting My Data Out Of AWS Neptune (In Theory)

One of the first things a dev would ask when starting to work with a new data storage tool is probably how to get data in/out?

What is the new DBs version of an “INSERT” or a “SELECT”. Well I have complicated news for you…. It appears to support 3 languages that I, and I would guess many of you, have not heard of before. I picked one at random to dig in on but before I did let's look into what it's going to cost to boot up an instance to play with.

A Note On Pricing:

Of course they don’t offer a Micro instance for Neptune; no small either. They start out with a db.t4g.medium at $0.093/hr or $66.96 per month. Not bad but slightly annoying for the more price sensitive AWS users out there.

Open Cypher:

Open Cypher’s Docs at a glance seems straight forward enough.

This gets a count of John’s friends.

MATCH (n {name: 'John'})-[:FRIEND]-(friend) WITH n, count(friend) AS friendsCount WHERE friendsCount > 3 RETURN n, friendsCount

Here is an example of an update that caches the friend count in the node:

MATCH (n {name: 'John'})-[:FRIEND]-(friend) WITH n, count(friend) AS friendsCount SET n.friendsCount = friendsCount RETURN n.friendsCount 

And this is how you populate data:

CREATE (adam:User {name: 'Adam'}), (pernilla:User {name: 'Pernilla'}),   (david:User {name: 'David'}),   (adam)-[:FRIEND]->(pernilla), (pernilla)-[:FRIEND]->(david) 

Personally I am already looking for an ORM to simplify the whole process. If you have any recommended resources please send them my way.

Question For You:

What, if any, language are you using to interact with your GraphDB?