airflow.providers.neo4j.hooks.neo4j

This module allows to connect to a Neo4j database.

Module Contents

Classes

Neo4jHook

Interact with Neo4j.

class airflow.providers.neo4j.hooks.neo4j.Neo4jHook(conn_id=default_conn_name, *args, **kwargs)[source]

Bases: airflow.hooks.base.BaseHook

Interact with Neo4j.

Performs a connection to Neo4j and runs the query.

Parameters

neo4j_conn_id – Reference to Neo4j connection id.

conn_name_attr = 'neo4j_conn_id'[source]
default_conn_name = 'neo4j_default'[source]
conn_type = 'neo4j'[source]
hook_name = 'Neo4j'[source]
get_conn()[source]

Initiate a new Neo4j connection with username, password and database schema.

get_client(conn, encrypted, uri)[source]

Determine that relevant driver based on extras.

Parameters
  • conn (airflow.models.Connection) – Connection object.

  • encrypted (bool) – boolean if encrypted connection or not.

  • uri (str) – uri string for connection.

Returns

Driver

Return type

neo4j.Driver

get_uri(conn)[source]

Build the uri based on extras.

  • Default - uses bolt scheme(bolt://)

  • neo4j_scheme - neo4j://

  • certs_self_signed - neo4j+ssc://

  • certs_trusted_ca - neo4j+s://

Parameters

conn (airflow.models.Connection) – connection object.

Returns

uri

Return type

str

run(query)[source]

Create a neo4j session and execute the query in the session.

Parameters

query – Neo4j query

Returns

Result

Return type

list[Any]

Was this entry helpful?