How to automatically import MYSQL database into Neo4j using java

Hello folks,
As I'm importing the SQL DB into neo4j using the Neo4j ETL tool, where data tables map to nodes, labels and, relationships within tables. Please refer to the below attached screenshot.

I want to load this MySQL data with nodes, labels and their relations using java. I want to have it automatically. I want to do the same thing as given in the screenshot, but I just want to do it in Java through programming.

So, you want something like a real-time integration between a MySql and a Neo4j database?

There are a few ways to accomplish something like that, but not with the ETL tool. I'm currently working on a plugin for Neo4j that does something similar, and will become open-source this year. There are two big caveats to what you are trying to do.

  • You'll have to hard-code converting your specific MySql data architecture into Cypher commands.
  • The MySql data structure must already have data in it that allows retrieving a change-set (Only return records that have changed since the last data-sync).

With that in mind, it can be as simple are running an application on top of Neo4j, with a connection to both databases. Retrieve and recreate all changed mysql records.

Hi Tony,

Thanks for the answer.

Yes, I want something like a real-time integration between MySQL and Neo4j using java.
I guess just hard-code to convert specific MySql data into Cypher will not be sufficient. It needs to trigger automatically like it should work like the scheduler to import the data.

Coming to your plugin, may I know when it can be available openly?

Plugin going public will likely happen in July.

Hardcoded doesn't mean that it can't be automated, it means that it will only work with your specific mysql data structure. Plan and build a set of mysql queries, and cypher commands, which can be run at any time, and result in updating the Neo4j graph from changes in MySql since the last run.

Even in extending and modifying my plugin, you'll still need do that.

1 Like

Hi Tony,

Any news concerning your awesome plugin?

Hello Lawrence,

I have made it public, there are a few caveats before it's really ready for adoption:

  • It still needs a good amount of work before it's easy to repurpose.
  • The data-source for the art archives is still in development.
  • Sections of config and code, for now, make it only useful for the art archive.

That said, there are many sections of code in here which could be useful: