6.1.1 Loading a SQL Property Graph from a Different Schema

You can specify the schema name when using the readGraphByName API for loading a SQL property graph.

If you only provide the graph name when calling the readGraphByName API, it is assumed that the graph is owned by current user. But if you want to load a graph owned by another user, then you must provide the schema name as well. Also, ensure that you have SELECT permission on the SQL graph and all its underlying data tables.

The following example loads a SQL property graph from the GRAPHUSER schema:

opg4j> var graph = session.readGraphByName("GRAPHUSER", "STUDENT_NETWORK", GraphSource.PG_SQL)
graph ==> PgxGraph[name=STUDENT_NETWORK,N=4,E=4,created=1680769031393]
PgxGraph graph = session.readGraphByName("GRAPHUSER", "STUDENT_NETWORK", GraphSource.PG_SQL);
>>> graph = session.read_graph_by_name("STUDENT_NETWORK", "pg_sql", "GRAPHUSER")
>>> graph
PgxGraph(name: STUDENT_NETWORK_2, v: 4, e: 4, directed: True, memory(Mb): 0)