Given a bool and a ResultSet (the form returned per result from Connection.wait_for_responses), return a dictionary containing the results. Used to process results from asynchronous queries to system tables. ``expected_failures`` will usually be used to allo
(self, success, result, expected_failures=tuple())
| 1923 | self.timeout = timeout |
| 1924 | |
| 1925 | def _handle_results(self, success, result, expected_failures=tuple()): |
| 1926 | """ |
| 1927 | Given a bool and a ResultSet (the form returned per result from |
| 1928 | Connection.wait_for_responses), return a dictionary containing the |
| 1929 | results. Used to process results from asynchronous queries to system |
| 1930 | tables. |
| 1931 | |
| 1932 | ``expected_failures`` will usually be used to allow callers to ignore |
| 1933 | ``InvalidRequest`` errors caused by a missing system keyspace. For |
| 1934 | example, some DSE versions report a 4.X server version, but do not have |
| 1935 | virtual tables. Thus, running against 4.X servers, SchemaParserV4 uses |
| 1936 | expected_failures to make a best-effort attempt to read those |
| 1937 | keyspaces, but treat them as empty if they're not found. |
| 1938 | |
| 1939 | :param success: A boolean representing whether or not the query |
| 1940 | succeeded |
| 1941 | :param result: The resultset in question. |
| 1942 | :expected_failures: An Exception class or an iterable thereof. If the |
| 1943 | query failed, but raised an instance of an expected failure class, this |
| 1944 | will ignore the failure and return an empty list. |
| 1945 | """ |
| 1946 | if not success and isinstance(result, expected_failures): |
| 1947 | return [] |
| 1948 | elif success: |
| 1949 | return dict_factory(result.column_names, result.parsed_rows) if result else [] |
| 1950 | else: |
| 1951 | raise result |
| 1952 | |
| 1953 | def _query_build_row(self, query_string, build_func): |
| 1954 | result = self._query_build_rows(query_string, build_func) |
no test coverage detected