Coder Social home page Coder Social logo

r2g's Introduction

Relational to Graph

This package under development With this package you can map your relational data from mysql to neo4j graph database

Features

  • automatically map your RDBMS data to graph DB
  • By using observer pattern, keep update your graph data

Dependencies

Run with docker

you must fist create a config json file:

{
  "Database": {
    "Graph": {
      "Host": "172.17.0.1",
      "Port": "7687",
      "Username": "neo4j",
      "Password": "123456"
    },
    "Mysql": {
      "Host": "172.17.0.1",
      "Port": "3306",
      "DbName": "csp",
      "Username": "username",
      "Password": "password"
    }
  },
  "TablesConfig": [],
  "RelationsConfig": []
}

and then run the following command :

$ docker run -v /path/to/your/conf.json:/app/conf.json amirasaran/r2g 

How to customize configuration:

TablesConfig:

For example (Not for many to many tables is relation):

"TablesConfig": [
    {
      "name": "continent",
      "label": "CNT",
      "UniqueColumns": [
        "hid"
      ],
      "SkipColumns": [
        "id",
        "updated_at",
        "created_at"
      ]
    }
]

name: Mysql table name

label: Neo4j node label

UniqueColumns: The unique columns (set index or this properties in neo4j)

SkipColumns: skip this columns and don't save to node properties


If you want set many-to-many tables as relation in neo4j you can use the following config for table:

"TablesConfig": [
    {
      "name": "user_orders",
      "label": "ORD_USR",
      "IsManyToMany": true,
      "UniqueColumns": [
        "id"
      ],
      "SkipColumns": [
        "updated_at",
        "created_at"
      ]
    }
]

this configuration is mostly like the first example.

name: Mysql table name

label: Neo4j relation label

IsManyToMany: set this table is many-to-many troth table

UniqueColumns: The unique columns (set index or this properties in neo4j)

SkipColumns: skip this columns and don't save to node properties

RelationsConfig

For example (without relation properties):

"RelationsConfig": [
    {
      "Label": "CTN_CTR",
      "Table": "country",
      "ReferenceTable": "continent"
    }
]

This method find relations from mysql foreign keys and you can customize the relations.

Label: Neo4j relation label

Table: The mysql table

ReferenceTable: The mysql reference table


example with relation properties:

you can use table or reference table columns value as relation values

"RelationsConfig": [
    {
      "Label": "CNT_CTR",
      "Table": "country",
      "ReferenceTable": "continent",
      "Properties": {
        "title": "country.title"
    }
]

Label: Neo4j relation label

Table: The mysql table

ReferenceTable: The mysql reference table

Properties: you can set properties

r2g's People

Contributors

amirasaran avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

mazafard

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.