4141 TransientError ,
4242 TransactionError ,
4343)
44- from neo4j .io import Neo4jPool
4544from neo4j .work import Workspace
4645from neo4j .work .result import Result
4746from neo4j .work .transaction import Transaction
@@ -78,13 +77,6 @@ class Session(Workspace):
7877 # The current auto-transaction result, if any.
7978 _autoResult = None
8079
81- # The set of bookmarks after which the next
82- # :class:`.Transaction` should be carried out.
83- _bookmarks = None
84-
85- # Sessions are supposed to cache the database on which to operate.
86- _cached_database = False
87-
8880 # The state this session is in.
8981 _state_failed = False
9082
@@ -110,47 +102,10 @@ def __exit__(self, exception_type, exception_value, traceback):
110102 self ._state_failed = True
111103 self .close ()
112104
113- def _set_cached_database (self , database ):
114- self ._cached_database = True
115- self ._config .database = database
116-
117105 def _connect (self , access_mode ):
118106 if access_mode is None :
119107 access_mode = self ._config .default_access_mode
120- if self ._connection :
121- # TODO: Investigate this
122- # log.warning("FIXME: should always disconnect before connect")
123- self ._connection .send_all ()
124- self ._connection .fetch_all ()
125- self ._disconnect ()
126- if not self ._cached_database :
127- if (self ._config .database is not None
128- or not isinstance (self ._pool , Neo4jPool )):
129- self ._set_cached_database (self ._config .database )
130- else :
131- # This is the first time we open a connection to a server in a
132- # cluster environment for this session without explicitly
133- # configured database. Hence, we request a routing table update
134- # to try to fetch the home database. If provided by the server,
135- # we shall use this database explicitly for all subsequent
136- # actions within this session.
137- self ._pool .update_routing_table (
138- database = self ._config .database ,
139- imp_user = self ._config .impersonated_user ,
140- bookmarks = self ._bookmarks ,
141- database_callback = self ._set_cached_database
142- )
143- self ._connection = self ._pool .acquire (
144- access_mode = access_mode ,
145- timeout = self ._config .connection_acquisition_timeout ,
146- database = self ._config .database ,
147- bookmarks = self ._bookmarks
148- )
149-
150- def _disconnect (self ):
151- if self ._connection :
152- self ._pool .release (self ._connection )
153- self ._connection = None
108+ super ()._connect (access_mode )
154109
155110 def _collect_bookmark (self , bookmark ):
156111 if bookmark :
0 commit comments