-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #112 from neo4j/1.1-apidocs
Updated API docs
- Loading branch information
Showing
12 changed files
with
233 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,57 @@ | ||
============================ | ||
**************************** | ||
Neo4j Bolt Driver for Python | ||
============================ | ||
**************************** | ||
|
||
|
||
Installation | ||
============ | ||
|
||
To install the latest stable version, use: | ||
|
||
.. code:: bash | ||
pip install neo4j-driver | ||
For the most up-to-date version (possibly unstable), use: | ||
|
||
.. code:: bash | ||
pip install git+https://github.com/neo4j/neo4j-python-driver.git#egg=neo4j-driver | ||
The Official Neo4j Driver for Python supports Neo4j 3.0 and above and Python versions 2.7, 3.4 and 3.5. | ||
|
||
|
||
Example Usage | ||
Quick Example | ||
============= | ||
|
||
.. code:: python | ||
.. code-block:: python | ||
from neo4j.v1 import GraphDatabase, basic_auth | ||
driver = GraphDatabase.driver("bolt://localhost:7687", auth=basic_auth("neo4j", "password")) | ||
uri = "bolt://localhost:7687" | ||
auth_token = basic_auth("neo4j", "password") | ||
driver = GraphDatabase.driver(uri, auth=auth_token) | ||
with driver.session() as session: | ||
def print_friends_of(name): | ||
with driver.session() as session: | ||
with session.begin_transaction() as tx: | ||
for record in tx.run("MATCH (a:Person)-[:KNOWS]->(f) " | ||
"WHERE a.name = {name} " | ||
"RETURN f.name", name=name): | ||
print(record["f.name"]) | ||
with session.begin_transaction() as write_tx: | ||
write_tx.run("CREATE (a:Person {name:{name},age:{age}})", name="Alice", age=33) | ||
write_tx.run("CREATE (a:Person {name:{name},age:{age}})", name="Bob", age=44) | ||
print_friends_of("Alice") | ||
with session.begin_transaction() as read_tx: | ||
result = read_tx.run("MATCH (a:Person) RETURN a.name AS name, a.age AS age") | ||
for record in result: | ||
print("%s is %d years old" % (record["name"], record["age"])) | ||
driver.close() | ||
Command Line | ||
Installation | ||
============ | ||
|
||
To install the latest stable version, use: | ||
|
||
.. code:: bash | ||
python -m neo4j "CREATE (a:Person {name:'Alice'}) RETURN a, labels(a), a.name" | ||
pip install neo4j-driver | ||
For the most up-to-date version (possibly unstable), use: | ||
|
||
.. code:: bash | ||
Documentation | ||
============= | ||
pip install git+https://github.com/neo4j/neo4j-python-driver.git#egg=neo4j-driver | ||
For more information such as manual, driver API documentations, changelogs, please find them in the wiki of this repo. | ||
* `Driver Wiki`_ | ||
Other Information | ||
================= | ||
|
||
* `Neo4j Manual`_ | ||
* `Neo4j Refcard`_ | ||
* `Sample Project Using Driver`_ | ||
* `Neo4j Quick Reference Card`_ | ||
* `Example Project`_ | ||
* `Driver Wiki`_ (includes change logs) | ||
|
||
.. _`Sample Project Using Driver`: https://github.com/neo4j-examples/movies-python-bolt | ||
.. _`Driver Wiki`: https://github.com/neo4j/neo4j-python-driver/wiki | ||
.. _`Neo4j Manual`: https://neo4j.com/docs/ | ||
.. _`Neo4j Refcard`: https://neo4j.com/docs/cypher-refcard/current/ | ||
.. _`Neo4j Quick Reference Card`: https://neo4j.com/docs/cypher-refcard/current/ | ||
.. _`Example Project`: https://github.com/neo4j-examples/movies-python-bolt | ||
.. _`Driver Wiki`: https://github.com/neo4j/neo4j-python-driver/wiki |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
************** | ||
Driver Objects | ||
************** | ||
|
||
A `Driver` object holds the detail of a Neo4j database including server URIs, credentials and other configuration. | ||
It also manages a pool of connections which are used to power :class:`.Session` instances. | ||
|
||
The scheme of the URI passed to the `Driver` constructor determines the type of `Driver` object constructed. | ||
Two types are currently available: the :class:`.DirectDriver` and the :class:`.RoutingDriver`. | ||
These are described in more detail below. | ||
|
||
|
||
.. autoclass:: neo4j.v1.GraphDatabase | ||
:members: | ||
|
||
.. autoclass:: neo4j.v1.DirectDriver | ||
:members: | ||
:inherited-members: | ||
|
||
.. autoclass:: neo4j.v1.RoutingDriver | ||
:members: | ||
:inherited-members: | ||
|
||
.. autoclass:: neo4j.v1.AuthToken | ||
:members: | ||
|
||
.. autofunction:: neo4j.v1.basic_auth | ||
|
||
.. autofunction:: neo4j.v1.custom_auth | ||
|
||
|
||
Encryption Settings | ||
------------------- | ||
.. py:attribute:: neo4j.v1.ENCRYPTION_OFF | ||
.. py:attribute:: neo4j.v1.ENCRYPTION_ON | ||
.. py:attribute:: neo4j.v1.ENCRYPTION_DEFAULT | ||
Trust Settings | ||
-------------- | ||
.. py:attribute:: neo4j.v1.TRUST_ON_FIRST_USE | ||
.. py:attribute:: neo4j.v1.TRUST_SIGNED_CERTIFICATES | ||
.. py:attribute:: neo4j.v1.TRUST_ALL_CERTIFICATES | ||
.. py:attribute:: neo4j.v1.TRUST_CUSTOM_CA_SIGNED_CERTIFICATES | ||
.. py:attribute:: neo4j.v1.TRUST_SYSTEM_CA_SIGNED_CERTIFICATES | ||
.. py:attribute:: neo4j.v1.TRUST_DEFAULT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,101 +1,68 @@ | ||
============================ | ||
**************************** | ||
Neo4j Bolt Driver for Python | ||
============================ | ||
**************************** | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
|
||
Session API | ||
=========== | ||
|
||
.. autoclass:: neo4j.v1.GraphDatabase | ||
:members: | ||
|
||
.. autoclass:: neo4j.v1.Driver | ||
:members: | ||
|
||
.. autoclass:: neo4j.v1.Session | ||
:members: | ||
|
||
.. autoclass:: neo4j.v1.Transaction | ||
:members: | ||
|
||
.. autoclass:: neo4j.v1.Record | ||
:members: | ||
|
||
.. autoclass:: neo4j.v1.StatementResult | ||
:members: | ||
The Official Neo4j Driver for Python supports Neo4j 3.0 and above and Python versions 2.7, 3.4 and 3.5. | ||
|
||
|
||
Encryption Settings | ||
------------------- | ||
.. py:attribute:: neo4j.v1.ENCRYPTION_OFF | ||
.. py:attribute:: neo4j.v1.ENCRYPTION_ON | ||
.. py:attribute:: neo4j.v1.ENCRYPTION_NON_LOCAL | ||
.. py:attribute:: neo4j.v1.ENCRYPTION_DEFAULT | ||
Quick Example | ||
============= | ||
|
||
.. code-block:: python | ||
Trust Settings | ||
-------------- | ||
.. py:attribute:: neo4j.v1.TRUST_ON_FIRST_USE | ||
.. py:attribute:: neo4j.v1.TRUST_SIGNED_CERTIFICATES | ||
.. py:attribute:: neo4j.v1.TRUST_DEFAULT | ||
Query Summary Details | ||
--------------------- | ||
|
||
.. autoclass:: neo4j.v1.summary.ResultSummary | ||
:members: | ||
|
||
.. autoclass:: neo4j.v1.summary.SummaryCounters | ||
:members: | ||
from neo4j.v1 import GraphDatabase, basic_auth | ||
uri = "bolt://localhost:7687" | ||
auth_token = basic_auth("neo4j", "password") | ||
driver = GraphDatabase.driver(uri, auth=auth_token) | ||
Exceptions | ||
========== | ||
def print_friends_of(name): | ||
with driver.session() as session: | ||
with session.begin_transaction() as tx: | ||
for record in tx.run("MATCH (a:Person)-[:KNOWS]->(f) " | ||
"WHERE a.name = {name} " | ||
"RETURN f.name", name=name): | ||
print(record["f.name"]) | ||
.. autoclass:: neo4j.v1.ProtocolError | ||
:members: | ||
print_friends_of("Alice") | ||
.. autoclass:: neo4j.v1.CypherError | ||
:members: | ||
.. autoclass:: neo4j.v1.ResultError | ||
:members: | ||
Installation | ||
============ | ||
|
||
To install the latest stable version, use: | ||
|
||
Example | ||
======= | ||
.. code:: bash | ||
.. code-block:: python | ||
pip install neo4j-driver | ||
from neo4j.v1 import GraphDatabase, basic_auth | ||
For the most up-to-date version (possibly unstable), use: | ||
|
||
driver = GraphDatabase.driver("bolt://localhost:7687", auth=basic_auth("neo4j", "password")) | ||
.. code:: bash | ||
with driver.session() as session: | ||
pip install git+https://github.com/neo4j/neo4j-python-driver.git#egg=neo4j-driver | ||
with session.begin_transaction() as tx: | ||
session.run("MERGE (a:Person {name:'Alice'})") | ||
friends = ["Bob", "Carol", "Dave", "Eve", "Frank"] | ||
with session.begin_transaction() as tx: | ||
for friend in friends: | ||
tx.run("MATCH (a:Person {name:'Alice'}) " | ||
"MERGE (a)-[:KNOWS]->(x:Person {name:{n}})", {"n": friend}) | ||
API Documentation | ||
================= | ||
|
||
for record in session.run("MATCH (a:Person {name:'Alice'})-[:KNOWS]->(friend) RETURN friend"): | ||
print('Alice says, "hello, %s"' % record["friend"]["name"]) | ||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
driver.close() | ||
driver | ||
session | ||
types | ||
|
||
|
||
Indices and tables | ||
================== | ||
Other Information | ||
================= | ||
|
||
* :ref:`genindex` | ||
* :ref:`modindex` | ||
* :ref:`search` | ||
* `Neo4j Manual`_ | ||
* `Neo4j Quick Reference Card`_ | ||
* `Example Project`_ | ||
* `Driver Wiki`_ (includes change logs) | ||
|
||
.. _`Neo4j Manual`: https://neo4j.com/docs/ | ||
.. _`Neo4j Quick Reference Card`: https://neo4j.com/docs/cypher-refcard/current/ | ||
.. _`Example Project`: https://github.com/neo4j-examples/movies-python-bolt | ||
.. _`Driver Wiki`: https://github.com/neo4j/neo4j-python-driver/wiki |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
*************** | ||
Cypher Sessions | ||
*************** | ||
|
||
|
||
.. autoclass:: neo4j.v1.Session | ||
:members: | ||
|
||
.. autoclass:: neo4j.v1.Transaction | ||
:members: | ||
|
||
.. autoclass:: neo4j.v1.StatementResult | ||
:members: | ||
|
||
.. autoclass:: neo4j.v1.Record | ||
:members: | ||
|
||
|
||
Summary Details | ||
--------------- | ||
|
||
.. autoclass:: neo4j.v1.summary.ResultSummary | ||
:members: | ||
|
||
.. autoclass:: neo4j.v1.summary.SummaryCounters | ||
:members: | ||
|
||
|
||
Exceptions | ||
---------- | ||
|
||
.. autoclass:: neo4j.v1.ProtocolError | ||
:members: | ||
|
||
.. autoclass:: neo4j.v1.Unauthorized | ||
:members: | ||
|
||
.. autoclass:: neo4j.v1.CypherError | ||
:members: | ||
|
||
.. autoclass:: neo4j.v1.TransactionError | ||
:members: | ||
|
||
.. autoclass:: neo4j.v1.ResultError | ||
:members: | ||
|
||
.. autoclass:: neo4j.v1.ServiceUnavailable | ||
:members: | ||
|
||
.. autoclass:: neo4j.v1.SessionExpired | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
*********** | ||
Type System | ||
*********** | ||
|
||
|
||
.. autoclass:: neo4j.v1.Node | ||
:members: | ||
:inherited-members: | ||
|
||
.. autoclass:: neo4j.v1.Relationship | ||
:members: | ||
:inherited-members: | ||
|
||
.. autoclass:: neo4j.v1.Path | ||
:members: | ||
:inherited-members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.