Oracle Big Data Spatial and Graph - technical tips, best practices, and news from the product team

  • January 22, 2018

Kicking off Relational to Property Graph Conversion from BDSG

Alan Wu

Today, I got a question on converting relational to PG (flat files). I actually wrote about PG data generation in the past. What makes this one different is the relational data is accessible from within an Oracle Database but the property graph database is on Big Data platform.

Here is an example flow with Python & JPype. The BDSG version is 2.1.

Assume we have a relational table with three columns, employee ID (EMPID), manager ID (MGRID), and a random property X. Say, we want to generate a set of edges based on this manager-employee relationship and treat that X column as an edge property.

SQL> desc reports
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 EMPID                                              NUMBER
 MGRID                                              NUMBER
 X                                                  NUMBER

We can use the following Python code, Java wrapped in JPype,  to convert this table into a .ope file:

conn = ora("jdbc:oracle:thin:@<host>:1521:<sid>", "<user>",                                   "<password>").getConnection()
c1=ctamCls.getInstance("X", "X", JClass("java.lang.Long"))


        util.convertRDBMSTable2OPE(conn, "reports", None, 0l, "EMPID","MGRID",

          0l, False, "reportsTo", [c1], 1, os, None)
except jpype.JException(java.lang.RuntimeException), ex :
        print ex.message()
        print ex.stacktrace()

An example output is as follows:

$ cat /tmp/test.ope
[oracle@bigdatalite ~]$


Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.