Using Graph Importer
You can import graphs contained in a GraphSON file to your database by using the GraphImporter. You can provide the configuration for the Graph Importer via a configuration dictionary as illustrated in the next example:
 1from opg4py.graph_importer import GraphImporter
 2
 3config = {
 4    'jdbc_url'     : '<jdbc_url>',
 5    'username'     : '<username>',
 6    'password'     : '<password_for_username>',
 7    'file_path'    : '<graphson_file_path>',
 8    'graph_name'   : '<name_of_resulting_graph>',
 9    'output_format': '<pg_pgql | pg_sql>',
10    'input_format' : 'graphson'
11}
12
13importer = GraphImporter(config)
14create_statement = importer.import_graph()
When the import has finished you will obtain the CPG statement in the variable create_statement as a result of the success of the import process.
Once the process is done, you can start working with your graph via any client (e.g., SQLcl, SQL Developer).
- class opg4py.graph_importer.GraphImporter(config)
- Wrapper class for oracle.pg.imports.GraphImporter. - import_graph()
- Import the graph to the database provided to the constructor. - Returns
- A string containing the CPG statement indicating the import finished successfully.