7.3 Migrating PGQL Property Graphs to SQL Property Graphs
You can call the migrate_pgql_to_sql
function to migrate a PGQL property graph to SQL property graph.
The migrate_pgql_to_sql
function accepts the following parameters:
source_schema
: Underlying schema of the original PGQL property graph.source_graph_name
: Name of the original PGQL property graph.destination_schema (optional)
: Underlying schema of the SQL property graph. If not specified, then the graph is created in the source PGQL property graph schema.destination_graph (optional)
: Name of the new SQL property graph. If not specified, then the new graph is created with the original name of the PGQL property graph and the original graph will be renamed by appending_PGQL
at the end of the name.
Note:
PGQL property graphs based on database views cannot be migrated.Example 7-1 Migrating a PGQL Property Graph to SQL Property Graph
The following example assumes that the PGQL property graph
FRIENDS
exists in Oracle Database 23ai.
opg4j> var jdbcUrl="jdbc:oracle:thin:@<host_name>:<port>/<db_service>"
opg4j> var conn = DriverManager.getConnection(jdbcUrl,"<username>","<password>")
opg4j> PgqlConnection pgqlConn = PgqlConnection.getConnection(conn)
opg4j> PgqlStatement pgqlStmt = pgqlConn.createStatement()
opg4j> pgqlStmt.execute("CALL pg.migrate_pgql_to_sql('GRAPHUSER', 'FRIENDS', 'GRAPHUSER', 'FRIENDS_SQL_GRAPH')")
$9 ==> false
DriverManager.registerDriver(new PgqlJdbcRdbmsDriver());
Connection conn = DriverManager.getConnection(<jdbcUrl>, <username>, <password>);
PgqlConnection pgqlConn = PgqlConnection.getConnection(conn);
PgqlStatement pgqlStmt = pgqlConn.createStatement();
pgqlStmt.execute("CALL pg.migrate_pgql_to_sql('GRAPHUSER', 'FRIENDS', 'GRAPHUSER', 'FRIENDS_SQL_GRAPH')");
>>> pgql_conn = opg4py.pgql.get_connection("<username>","<password>", "jdbc:oracle:thin:@<host_name>:<port>/<db_service>")
>>> pgql_statement = pgql_conn.create_statement()
>>> pgql_statement.execute("CALL pg.migrate_pgql_to_sql('GRAPHUSER', 'FRIENDS', 'GRAPHUSER', 'FRIENDS_SQL_GRAPH')")
$4 ==> false
Parent topic: Executing PGQL Queries Against SQL Property Graphs