OPG4Py Autonomous Database Graph
- class opg4py.adb.AdbClient(config)
- static from_connection(jdbc_url, username, password)
Creates an AdbClient instance given the jdbc url and the credentials of a database.
To use this API, the user must execute a GRANT statement for selection on the V$PDBS table for the GRAPH_DEVELOPER role.
- Parameters
jdbc_url – The jdbc url of the connection.
username – The username of the database.
password – The password of the database.
- Returns
The configuration object created from the connection.
- get_available_memory()
Gets the available memory for environments to allocate. Only returns the memory if environment is in detached status.
- Returns
the available memory for the environments to allocate. The results’ units are in Gigabytes and in decimal format.
- get_current_memory()
Gets the current environment’s allocated memory. Only returns the memory if environment is in attached status.
- Returns
the allocated memory for the currently attached environment. The results’ units are in Gigabytes and in decimal format.
- get_environment_status()
Fetches the environment status of the Autonomous Database.
- Returns
the environment status of the Autonomous Database.
- get_pgx_instance()
Gets the PGX ServerInstance object of an attached environment which can be used to create a new session for in-memory graph analysis.
- Returns
the PGX ServerInstance of the Autonomous Database.
- is_attached()
Checks if the Autonomous Database is currently attached to an environment.
- Returns
True if the Autonomous Database is currently attached to an environment. False otherwise.
- restart_environment()
Starts re-attaching the Autonomous Database to a new environment.
- Returns
a Job instance which completes once re-attachment operation completes.
Throws: IllegalStateException - if the Autonomous Database is currently not in EnvironmentStatus#ATTACHED state
- start_environment(memory)
Starts attaching the Autonomous Database to a new environment.
- Parameters
memory – the amount of system memory (in gigabytes) to allocate on the attached environment.
- Returns
a Job instance which completes once attachment operation completes.
Throws: IllegalStateException - if the Autonomous Database is currently not in EnvironmentStatus#DETACHED state
- stop_environment()
Starts detaching the Autonomous Database from the current environment. Note: all in-memory data will be lost
- Returns
a Job instance which completes once detachment operation completes.
Throws: IllegalStateException - if the Autonomous Database is currently not in EnvironmentStatus#ATTACHED state
- class opg4py._adb.job.Job(javaJob)
- get()
Waits if necessary for this job to complete, and then returns its result.
- Returns
the result value
- Throws:
CancellationException - if this job was cancelled ExecutionException - if this job completed exceptionally InterruptedException - if the current thread was interrupted while waiting
- get_created_by()
Get the database username who created this job.
- Returns
the username of the creator of this job.
- get_description()
Get the job description.
- Returns
the description of this job.
- get_error()
Get an optional error message returned by the server.
- Returns
an error message in case this job has completed unsuccessfully or NULL if job is still running or completed successfully
- get_id()
Get the job ID.
- Returns
the ID of this job.
- get_logs()
Get the log entries emitted by this job.
- Returns
the log entries.
- get_name()
Get the job name.
- Returns
the name of this job.
- get_status()
Get the job status.
- Returns
the status of this job.
- get_type()
Get the job type.
- Returns
the type of this job.
- is_cancelled()
Returns true if this job was cancelled before it completed normally.
- Returns
True if this job was cancelled before it completed normally, False otherwise
- is_completed_exceptionally()
Returns true if this job completed exceptionally, in any way. Possible causes include cancellation, explicit invocation of completeExceptionally, and abrupt termination of a CompletionStage action.
- Returns
True if this CompletableFuture completed exceptionally, False otherwise
- is_done()
Returns True if completed in any fashion: normally, exceptionally, or via cancellation.
- Returns
True if completed, False otherwise
- poll()
Starts polling the server using a background thread and updates this job’s status and log as results come in. Once job completes, fails or gets cancelled, this job is marked as such as well. If this job has completed, this method will do nothing.
- Returns
this job