Skip to content

Commit 3caae20

Browse files
author
Zhen Li
committed
Merge branch '1.6' into 1.7
2 parents 19066ea + bb9d3a0 commit 3caae20

24 files changed

+496
-409
lines changed

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
neotime
12
sphinx
60.3 KB
Loading

docs/source/_images/core_type_mappings.svg

Lines changed: 1 addition & 0 deletions
Loading

docs/source/conf.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
'sphinx.ext.coverage',
3939
'sphinx.ext.ifconfig',
4040
'sphinx.ext.viewcode',
41+
'sphinx.ext.intersphinx',
4142
]
4243

4344
# Add any paths that contain templates here, relative to this directory.
@@ -118,7 +119,7 @@
118119

119120
# The theme to use for HTML and HTML Help pages. See the documentation for
120121
# a list of builtin themes.
121-
html_theme = 'alabaster'
122+
html_theme = 'nature'
122123

123124
# Theme options are theme-specific and customize the look and feel of a theme
124125
# further. For a list of options available for each theme, see the
@@ -296,3 +297,11 @@
296297

297298
def setup(app):
298299
app.add_stylesheet('custom.css')
300+
301+
302+
# -- Options for Intersphinx
303+
304+
intersphinx_mapping = {
305+
'python': ('https://docs.python.org/3', None),
306+
'neotime': ('http://neotime.readthedocs.io/en/latest/', None),
307+
}

docs/source/driver.rst

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
==============
2+
Driver Objects
3+
==============
4+
5+
Every Neo4j-backed application will require a :class:`.Driver` object.
6+
This object holds the details required to establish connections with a Neo4j database, including server URIs, credentials and other configuration.
7+
:class:`.Driver` objects hold a connection pool from which :class:`.Session` objects can borrow connections.
8+
Closing a driver will immediately shut down all connections in the pool.
9+
10+
Construction
11+
============
12+
13+
:class:`.Driver` construction can either be carried out directly or via a `classmethod` on the :class:`.GraphDatabase` class.
14+
15+
.. autoclass:: neo4j.v1.GraphDatabase
16+
:members:
17+
18+
.. autoclass:: neo4j.v1.Driver(uri, **config)
19+
:members:
20+
21+
22+
URI
23+
===
24+
25+
On construction, the scheme of the URI determines the type of :class:`.Driver` object created.
26+
Each supported scheme maps to a particular :class:`.Driver` subclass that implements a specific behaviour.
27+
The remainder of the URI should be considered subclass-specific.
28+
29+
The alternative behaviours are described in the subsections below.
30+
31+
32+
Bolt Direct
33+
-----------
34+
35+
URI scheme:
36+
``bolt``
37+
Driver subclass:
38+
:class:`.DirectDriver`
39+
40+
A Bolt :class:`.DirectDriver` is used to target a single machine.
41+
This may be a standalone server or could be a specific member of a cluster.
42+
43+
Connections established by a :class:`.DirectDriver` are always made to the exact host and port detailed in the URI.
44+
45+
.. autoclass:: neo4j.v1.DirectDriver
46+
:members:
47+
:inherited-members:
48+
49+
50+
Bolt Routing
51+
------------
52+
53+
URI scheme:
54+
``bolt+routing``
55+
Driver subclass:
56+
:class:`.RoutingDriver`
57+
58+
.. autoclass:: neo4j.v1.RoutingDriver
59+
:members:
60+
:inherited-members:
61+
62+
63+
Configuration
64+
=============
65+
66+
Additional configuration, including authentication details, can be provided via the :class:`.Driver` constructor.
67+
68+
``auth``
69+
--------
70+
71+
An authentication token for the server.
72+
For basic auth, this can be a simple tuple, for example ``("neo4j", "password")``.
73+
Alternatively, one of the auth token functions can be used.
74+
75+
.. autofunction:: neo4j.v1.basic_auth
76+
77+
.. autofunction:: neo4j.v1.custom_auth
78+
79+
``encrypted``
80+
-------------
81+
82+
A boolean indicating whether or not TLS should be used for connections.
83+
Defaults to :py:const:`True` if TLS is available.
84+
85+
``trust``
86+
---------
87+
88+
The trust level for certificates received from the server during TLS negotiation.
89+
This setting does not have any effect if ``encrypted`` is set to :py:const:`False`.
90+
91+
.. py:attribute:: neo4j.v1.TRUST_ALL_CERTIFICATES
92+
93+
Trust any server certificate (default). This ensures that communication
94+
is encrypted but does not verify the server certificate against a
95+
certificate authority. This option is primarily intended for use with
96+
the default auto-generated server certificate.
97+
98+
.. py:attribute:: neo4j.v1.TRUST_SYSTEM_CA_SIGNED_CERTIFICATES
99+
100+
Trust server certificates that can be verified against the system
101+
certificate authority. This option is primarily intended for use with
102+
full certificates.
103+
104+
``der_encoded_server_certificate``
105+
----------------------------------
106+
107+
The server certificate in DER format, if required.
108+
109+
``user_agent``
110+
--------------
111+
112+
A custom user agent string, if required.
113+
The driver will generate a user agent if none is supplied.
114+
115+
``max_connection_lifetime``
116+
---------------------------
117+
118+
The maximum time for which a connection can exist before being closed on release, instead of returned to the pool.
119+
120+
``max_connection_pool_size``
121+
----------------------------
122+
123+
The maximum number of connections managed by the connection pool
124+
125+
``connection_acquisition_timeout``
126+
----------------------------------
127+
128+
The maximum time to wait for a connection to be acquired from the pool.
129+
130+
``connection_timeout``
131+
----------------------
132+
133+
The maximum time to wait for a new connection to be established.
134+
135+
``keep_alive``
136+
--------------
137+
138+
Flag to indicate whether or not the TCP `KEEP_ALIVE` setting should be used.
139+
140+
``max_retry_time``
141+
------------------
142+
143+
The maximum time to allow for retries to be attempted when using transaction functions.
144+
After this time, no more retries will be attempted.
145+
This setting does not terminate running queries.
146+
147+
148+
149+
Object Lifetime
150+
===============
151+
152+
For general applications, it is recommended to create one top-level :class:`.Driver` object that lives for the lifetime of the application.
153+
For example:
154+
155+
.. code-block:: python
156+
157+
from neo4j.v1 import GraphDatabase
158+
159+
class Application(object):
160+
161+
def __init__(self, uri, user, password)
162+
self.driver = GraphDatabase.driver(uri, auth=(user, password))
163+
164+
def close(self):
165+
self.driver.close()
166+
167+
Connection details held by the :class:`.Driver` are immutable.
168+
Therefore if, for example, a password is changed, a replacement :class:`.Driver` object must be created.
169+
More than one :class:`.Driver` may be required if connections to multiple databases, or connections as multiple users, are required.
170+
171+
:class:`.Driver` objects are thread-safe but cannot be shared across processes.
172+
Therefore, ``multithreading`` should generally be preferred over ``multiprocessing`` for parallel database access.
173+
If using ``multiprocessing`` however, each process will require its own :class:`.Driver` object.

docs/source/drivers.rst

Lines changed: 0 additions & 61 deletions
This file was deleted.

docs/source/index.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Neo4j Bolt Driver 1.6 for Python
33
********************************
44

5-
The Official Neo4j Driver for Python supports Neo4j 3.0 and above and Python versions 2.7, 3.4, 3.5 and 3.6.
5+
The Official Neo4j Driver for Python supports Neo4j 3.1 and above and requires Python version 2.7, 3.4, 3.5 or 3.6.
66

77

88
Quick Example
@@ -47,10 +47,13 @@ API Documentation
4747
.. toctree::
4848
:maxdepth: 1
4949

50-
drivers
50+
driver
5151
transactions
5252
results
53-
types
53+
types/core
54+
types/graph
55+
types/spatial
56+
types/temporal
5457
errors
5558

5659

0 commit comments

Comments
 (0)