Meta

Author archive for: ryguyrg

One of the most common questions we get at Neo4j is how to move from a SQL database to a Graph Database like Neo4j. The previous solution for accomplishing this was to export the SQL tables into CSV files and then importing the CSV files with neo4j-import or LOAD CSV. There’s a much better way: JDBC!

Neo4j JDBC Support

There are two distinct ways you can use JDBC within Neo4j:

Access Neo4j Data via JDBC. Do you have existing code that accesses your SQL database using JDBC, and you want to move that code to access Neo4j instead? Neo4j has a JDBC Driver. Just update your code to use the awesome power of the Cypher query language instead of SQL, and switch over the JDBC driver you’re using, and you’re off to the races!

Import SQL Databases into Neo4j. Do you have data in your SQL database that you want to move into a Graph? The APOC library for Neo4j has a set of procedures in apoc.load.jdbc to make this simple. This blog post will cover this use case.

Loading Sample Northwind SQL tables into MySQL

In order to run the code snippets in the following sections, you’ll need to have the Northwind SQL tables in a MySQL database accessible from your Neo4j server. I’ve published a GitHub Gist of the SQL script which you can execute in MySQL Workbench or using the command-line client.

Loading data from RDBMS into Neo4j using JDBC

With the APOC JDBC support, you can load data from any type of database which supports JDBC. In this post, we’ll talk about moving data from a MySQL database to Neo4j, but you can apply this concept to any other type of database: PostgreSQL, Oracle, Hive, etc. You can use it for other NoSQL databases too, but APOC has direct support for MongoDB, Couchbase and more.

1. Install APOC and JDBC Driver into Neo4j plugins directory

Note: This step is not necessary if you’re using the Neo4j Sandbox and MySQL or PostgreSQL. Each Sandbox comes with APOC and the JDBC drivers for these database systems.

All JAR files placed in the Neo4j plugins directory are made available for use by Neo4j. We need to copy the APOC library and JDBC drivers into this directory.

First, download APOC. Be sure to grab the download that is for your version of Neo4j.

Next Steps

If this was your first experience with Neo4j, you probably want to learn more about Neo4j’s Cypher query language. Neo4j has some great (free) online training you can take to learn more. You can also use the Cypher Refcard to power your journey to becoming a Graphista.

Bernie is sick and tired of hearing about Hillary’s e-mails and so am I. So, why am I writing about them? Well, they can possibly provide an interesting insight into how our government works (or doesn’t work) — if only they were in a better format than PDFs!! They represent a perfect graph!

Knowing the e-mails and senders+receivers is interesting, but I wanted to see what the e-mails are about! While the subject lines are included with the e-mails, they’re often opaque, like the meaningful subject “HEY” used in an e-mail from Jake Sullivan to Hillary Clinton. Natural language processing to the rescue!

I built a small Python script and used Py2neo to query all e-mails without attached topics. I then go through each e-mail and send the raw body text and subject to the Prismatic Topics API. The API returns a set of topics, which I then use to create REFERENCES relationships between the e-mails and topics. This code is based on the excellent post on the topic by Mark Needham.

Now I can explore e-mails by topic, like the graph below where I see e-mails related to David Cameron. When I double-clicked on the e-mail with subject ‘GUARDIAN’ in the Neo4j Browser, I can see all the other topics that e-mail references, including Sin Fein, Northern Ireland, Ireland, and Peace.

With this additional topic information, I can start to understand more context around Hillary’s e-mails.

I do not pretend to have all the answers. Only some, and pointers to places for others.

You teach me as much as I teach you. Both are critical.

When I first talked with the team at Neo4j about career opportunities, it was over a year ago. The role was VP of marketing. When I discussed this with friends and former colleagues, they were confused and thinking “but you’re an engineer.” I wasn’t confused. I’m passionate that Developer Relations needs to hold many hats – engineer, product manager, marketer, community organizer, spokesperson, press relations and e-mail answerer. Importantly, a hat it shouldn’t wear is that of a preacher.

I renewed discussions with the Neo4j team back in November without a specific role in mind. I enjoy making companies and technologies successful, and will do whatever is necessary to make that happen. We ended up agreeing on the role of Head of Developer Evangelism, North America. Well, sorta.

The industry has used the term “evangelism” for many years– I believe starting with Apple and Microsoft. At Google, we decided that the organization was about 2-way feedback and discussion, not about preaching. It was just as important to get feedback from developers about our products as it was to make developers aware of the products and their capabilities. The religious connotation with the term also offended and confused some. We needed a term which more closely aligned with the goals of the organization. We found it with Developer Relations as an organization, and Developer Advocate as a title.

I’ve now shown the light* to the folks at Neo4j and our team has decided to re-brand as Developer Relations. I’m delighted to be updating my social media profiles. Luckily I didn’t yet buy business cards!

My first “blog” was created on March 28th, 2001. It was a private and incredibly emo Livejournal blog. My last post there was in 2006. In 2007, I joined twitter and stuck to short-form content until Google+ launched in 2011.