def routing_info_procedure(self, routing_context): if ServerVersion.from_str( self._connection.server.version).at_least_version(3, 2): return self.call_get_routing_table, { self.get_routing_table_param: routing_context } else: return self.call_get_servers, {}
def __run__(self, _, routing_context): if ServerVersion.from_str( self._connection.server.version).at_least_version( 3, 2): statement, parameters = ( "CALL dbms.cluster.routing.getRoutingTable({context})", { "context": routing_context }) else: statement, parameters = "CALL dbms.cluster.routing.getServers", {} return self._run(statement, parameters)
def server_version_info(cls): with GraphDatabase.driver(cls.bolt_uri, auth=cls.auth_token) as driver: with driver.session() as session: full_version = session.run("RETURN 1").summary().server.version return ServerVersion.from_str(full_version)