1. Connecting using PGQL-on-RDBMS

To connect using DB credentials directly the following convenience method can be used, otherwise a JDBC connection object needs to be provided.

pgql.get_connection(pwd, jdbc_url)

Get a DB connection.

Parameters
  • usr – the DB user

  • pwd – the DB password

  • jdbc_url – the DB jdbc url

Returns

A PgqlConnection

Connecting to PGQL-on-RDBMS involves getting a connection object, that allows further operations such as creating a statement or retrieving metadata on the underlying JDBC connection.

class opg4py.pgql.PgqlConnection(java_pgql_connection)

Wrapper class for oracle.pg.rdbms.pgql.PgqlConnection

close()

Free the resources of the internal JDBC connection.

create_statement()

Creates a new PgqlStatement object, which is used to execute PGQL queries

Returns

a new PgqlStatement object that can be used to perform PGQL queries

static get_connection(java_sql_connection)

Factory method to get PgqlConnection instance.

Parameters

java_sql_connection – a JDBC connection

Returns

a PgqlConnection instance

get_graph()

Get the graph name on which PGQL queries will be executed for this connection.

Returns

the graph name for this connection

get_jdbc_connection()

Get the JDBC connection that is used to execute PGQL queries

Returns

the connection

get_schema()

Get the schema name that will be used to execute PGQL queries with this connection. If the schema has not been set, the schema from JDBC connection is returned.

Returns

the schema set for this connection

Throws:

PgqlToSqlException - if a database access error occurs or this method is called on a closed connection

prepare_statement(pgql)

Creates a new PgqlPreparedStatement object, which represents a pre-compiled PGQL statement.

Parameters

pgql – the PGQL query to compile

Returns

a new PgqlPreparedStatement object that can be used to efficiently execute the same query multiple times

set_graph(graph)

Sets the graph name on which PGQL queries will be executed for this connection.

Parameters

graph – the name of the graph

set_schema(schema)

Sets the schema name that will be used to execute PGQL queries with this connection.

Parameters

schema – the name of the schema