-
Notifications
You must be signed in to change notification settings - Fork 35
JDBC Configuration
seanbarzilay edited this page Oct 10, 2017
·
1 revision
In order to map data from a JDBC data source our mapping file will look something like this:
{
"class": "org.unipop.jdbc.JdbcSourceProvider",
"driver": "your.jdbc.driver",
"address": ["connection string"],
"sqlDialect": "sql dialect",
"vertices": [],
"edges": []
}
You'll need to specify your JDBC driver class, your connection strings and the sql dialect used
by your database (you can find a list of supported dialects in JOOQ).
Each element we map requires some more information from us about it's whereabouts, we'll need to provide a table.
So elements will look like:
{
"table": "table_name"
}
A vertex will look like:
{
"table": "vertex_table",
"id": "@vertex_id",
"label": "vertex_label",
"properties": {}
}
In JDBC we have two ways to map edges depending on how your data is structured.
Each edge is represented by a row in our table:
{
"table": "edge_table",
"id": "@edge_id",
"label": "edge_label",
"properties": {},
"outVertex": {
"ref": true,
"id": "@out_vertex_id",
"label": "@out_vertex_label"
},
"inVertex": {
"ref": true,
"id": "@in_vertex_id",
"label": "@in_vertex_label"
}
}
Each edge is represented by a set of columns from our vertex row.
{
"table":"vertex_table",
"id": "@_id",
"label": "my_vertex_label",
"properties": {},
"edges": [
{
"id": "@edgeId",
"label": "@edgeLabel",
"direction": "OUT",
"properties": {},
"vertex":{
"ref": true,
"id": "@inner_vertex_id",
"label": "@inner_vertex_label"
}
}
]
}
Because this edge is a child within our vertex we need to specify its direction.