R2PG-DM is a powerful tool that allows you to construct property graphs from relational databases.
- Convert relational databases into property graphs
- Support for MySQL and Microsoft SQL Server databases
- Generate CSV files for Neo4j graph database
- Generate schema following PG-Schema language
To install R2PG-DM, follow these steps:
- Clone the repository:
git clone https://github.com/lsiecker/r2pg-dm.git
- Navigate into the project directory:
cd r2pg-dm
- Build the R2PG-DM using Maven:
mvn clean build
Before using R2PG-DM, you need to set up a config.ini
file to specify the input database connections. Here's the format:
[input]
connectionString=jdbc:DRIVER://IP_ADDRESS:PORT/DATABASE_NAME?user=USER&password=PASSWORD
database=DATABASE_NAME
driver=DRIVER
[output]
connectionString=jdbc:DRIVER://IP_ADDRESS:PORT/DATABASE_NAME?user=USER&password=PASSWORD
database=DATABASE_NAME
driver=DRIVER
[mapping]
tables=true
views=true
schema=dbo
tableNames=*
deleteCopy=false
The connectionString should be in the JDBC connection string format. You can find more information about this format here. Furthermore there are some settings regarding the mapping. Boolean values for tables and views determine wheter or not to take into account these table types. Keep in mind that views do not include foreign key information, only column information. Schema is the schema in the source database that needs to be mapped. tableNames is a parameter that can be filled with several table/view names to specify that mapping. The names should be seperated with a comma not in quotes: country,countrylanguage,city
.
To use R2PG-DM, follow these steps:
- Set up your
config.ini
file as described in the Configuration section. - Run the application
- View the output in the output folder and in your target database tables. The output consists of
nodes.csv
,edges.csv
,properties.csv
: The property graph divided in the different information types.combined.json
: All information from the nodes, edges and properties combined in one json to be imported by AvantGraph.schema.pgs
: Schema following PG-Schema language.
R2PG-DM generates three CSV files: nodes.csv
, edges.csv
and properties.csv
. You can use these files as input for a Neo4j instance by running the script in the script.cypher
located in this repository.
For more information on how to install and setup a Neo4j instance refer to the Neo4j download page For information on where to place the CSV files, see Section 2 of this Neo4j tutorial. During this tutorial you can ignore the cypher (LOAD) queries and use the queries from script.cypher instead.
To use a Neo4j instance for visualization, you need the APOC plugin installed (dynamic labels).
If you encounter any issues while using R2PG-DM, please check the Issues page of this repository. If you don't find a solution there, feel free to open a new issue.
We welcome contributions to R2PG-DM! If you'd like to contribute, please fork the repository, make your changes, and open a pull request.