trovares_connector.Neo4jDriver#

class trovares_connector.Neo4jDriver(host='localhost', bolt_port=7687, http_port=7474, arrow_port=9999, auth=None, database=None, driver='neo4j-bolt', protocol='neo4j', http_protocol='http', verbose=False)[source]#
__init__(host='localhost', bolt_port=7687, http_port=7474, arrow_port=9999, auth=None, database=None, driver='neo4j-bolt', protocol='neo4j', http_protocol='http', verbose=False)[source]#

Initializes the driver class.

Parameters:
  • host (str) – Host address of the Neo4j server.

  • bolt_port (int) – Bolt port of the Neo4j server.

  • http_port (int) – HTTP port of the Neo4j server. Used with HTTP drivers.

  • arrow_port (int) – Arrow port of the Neo4j server. Used with Arrow driver.

  • auth (neo4j.Auth) – Authentication details.

  • database (str) – Neo4j database to connect to.

  • driver (str) – Driver to use for transferring data from Neo4j. Options include ‘neo4j-bolt’, ‘py2neo-bolt’, ‘py2neo-http’, and ‘neo4j-arrow’. Some connections, such as schema querying will still go through ‘neo4j-bolt’, but all data transferring will use the method selected here. ‘neo4j-arrow’ is considered very experimental. See the documentation for requirements for using.

  • protocol (str) – Protocol used when connecting to Neo4j through bolt. Acceptable values include: neo4j, neo4j+s, neo4j+ssc, bolt, bolt+s, and bolt+ssc.

  • http_protocol (str) – Protocol used when connecting to Neo4j through http with http drivers. Acceptable values include: http, https, http+s, http+ssc.

  • verbose (bool) – Print detailed information during calls.

Methods

__init__([host, bolt_port, http_port, ...])

Initializes the driver class.

from_Neo4jDriver(neo4j_driver[, database])

query(query[, write, use_neo4j_always])

Runs the query on Neo4j as returns the results.

Attributes

bolt

Retrieve the Python bolt driver connected to the Neo4j database.

__init__(host='localhost', bolt_port=7687, http_port=7474, arrow_port=9999, auth=None, database=None, driver='neo4j-bolt', protocol='neo4j', http_protocol='http', verbose=False)[source]#

Initializes the driver class.

Parameters:
  • host (str) – Host address of the Neo4j server.

  • bolt_port (int) – Bolt port of the Neo4j server.

  • http_port (int) – HTTP port of the Neo4j server. Used with HTTP drivers.

  • arrow_port (int) – Arrow port of the Neo4j server. Used with Arrow driver.

  • auth (neo4j.Auth) – Authentication details.

  • database (str) – Neo4j database to connect to.

  • driver (str) – Driver to use for transferring data from Neo4j. Options include ‘neo4j-bolt’, ‘py2neo-bolt’, ‘py2neo-http’, and ‘neo4j-arrow’. Some connections, such as schema querying will still go through ‘neo4j-bolt’, but all data transferring will use the method selected here. ‘neo4j-arrow’ is considered very experimental. See the documentation for requirements for using.

  • protocol (str) – Protocol used when connecting to Neo4j through bolt. Acceptable values include: neo4j, neo4j+s, neo4j+ssc, bolt, bolt+s, and bolt+ssc.

  • http_protocol (str) – Protocol used when connecting to Neo4j through http with http drivers. Acceptable values include: http, https, http+s, http+ssc.

  • verbose (bool) – Print detailed information during calls.

property bolt: Neo4jDriver#

Retrieve the Python bolt driver connected to the Neo4j database.

Returns:

The Python bolt driver object that is connected to the Neo4j database.

Return type:

neo4j.Neo4jDriver

query(query, write=True, use_neo4j_always=False)[source]#

Runs the query on Neo4j as returns the results.

Parameters:
  • write (write) – If true, the query can write to the database. By default this is True.

  • use_neo4j_always (bool) – If true uses the neo4j.Neo4jDriver to run the query. Otherwise will attempt to use a faster driver if set such as py2neo. By default this is False.

Returns:

Closure object with results.

Return type:

object