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. - clear_graph_metadata_cache()
- Clear the cache that stores graph metadata. 
 - clear_translation_cache()
- Clear the cache that stores translations. 
 - 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 
 
 - disable_graph_metadata_cache()
- Disable the cache that stores graph metadata. 
 - disable_translation_cache()
- Disable the cache that stores translations. 
 - enable_graph_metadata_cache()
- Enable the cache that stores graph metadata. 
 - enable_translation_cache()
- Enable the cache that stores translations. 
 - 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, timeout=0, parallel=0, dynamicSampling=2, maxResults=-1, matchOptions=None, options=None)
- Creates a new PgqlPreparedStatement object, which represents a pre-compiled PGQL statement. - Parameters
- pgql – the PGQL query to compile 
- timeout – the number of seconds for query execution to finish 
- parallel – the degree of parallelism to use for query and modify execution 
- dynamicSampling – the value for dynamic sampling 
- maxResults – the maximum number of rows returned 
- matchOptions – additional options used to influence query translation and execution 
- options – additional options used to influence modify translation and execution 
 
- Returns
- a 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_graph_metadata_cache_max_capacity(max_capacity)
- Set max capacity value for the graph metadata cache - Parameters
- max_capacity – value for max capacity 
 
 - 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 
 
 - set_translation_cache_max_capacity(max_capacity)
- Set max capacity value for the translation cache - Parameters
- max_capacity – value for max capacity