Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Cypher

You're reading from   Learning Cypher Write powerful and efficient queries for Neo4j with Cypher, its official query language

Arrow left icon
Product type Paperback
Published in May 2014
Publisher
ISBN-13 9781783287758
Length 162 pages
Edition Edition
Arrow right icon
Author (1):
Arrow left icon
Onofrio Panzarino Onofrio Panzarino
Author Profile Icon Onofrio Panzarino
Onofrio Panzarino
Arrow right icon
View More author details
Toc

Migrating queries


Since Neo4j supports ACID transactions, you won't need to change the infrastructure of your application to simulate a transaction (this will be required if we are migrating from SQL to a non-transactional database), but you will still need to rewrite your queries.

CRUD

First and foremost, we must migrate the Create, Read, Update, and Delete ( CRUD ) queries. We already did this step in the previous section, but we overlooked a point—how do we migrate auto-incremented IDs (identities) from SQL to Neo4j? You could use the node ID generated and autoincremented by Neo4j. Yet, as we noticed in Chapter 1, Querying Neo4j Effectively with Pattern Matching, Neo4j could recompute the node IDs, and you should not trust them. If you really need an auto-incremented reliable ID, you will have to simulate the creation of an auto-incremented ID. Suppose we want to create an Author entity, and we want the application to set the next available ID. For this, we can write the following code...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime