MCPcopy Create free account
hub / github.com/apache/cassandra-python-driver / _query_all

Method _query_all

cassandra/metadata.py:2372–2439  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2370 return trigger_meta
2371
2372 def _query_all(self):
2373 cl = ConsistencyLevel.ONE
2374 queries = [
2375 QueryMessage(query=self._SELECT_KEYSPACES, consistency_level=cl),
2376 QueryMessage(query=self._SELECT_COLUMN_FAMILIES, consistency_level=cl),
2377 QueryMessage(query=self._SELECT_COLUMNS, consistency_level=cl),
2378 QueryMessage(query=self._SELECT_TYPES, consistency_level=cl),
2379 QueryMessage(query=self._SELECT_FUNCTIONS, consistency_level=cl),
2380 QueryMessage(query=self._SELECT_AGGREGATES, consistency_level=cl),
2381 QueryMessage(query=self._SELECT_TRIGGERS, consistency_level=cl)
2382 ]
2383
2384 ((ks_success, ks_result),
2385 (table_success, table_result),
2386 (col_success, col_result),
2387 (types_success, types_result),
2388 (functions_success, functions_result),
2389 (aggregates_success, aggregates_result),
2390 (triggers_success, triggers_result)) = (
2391 self.connection.wait_for_responses(*queries, timeout=self.timeout,
2392 fail_on_error=False)
2393 )
2394
2395 self.keyspaces_result = self._handle_results(ks_success, ks_result)
2396 self.tables_result = self._handle_results(table_success, table_result)
2397 self.columns_result = self._handle_results(col_success, col_result)
2398
2399 # if we're connected to Cassandra < 2.0, the triggers table will not exist
2400 if triggers_success:
2401 self.triggers_result = dict_factory(triggers_result.column_names, triggers_result.parsed_rows)
2402 else:
2403 if isinstance(triggers_result, InvalidRequest):
2404 log.debug("triggers table not found")
2405 elif isinstance(triggers_result, Unauthorized):
2406 log.warning("this version of Cassandra does not allow access to schema_triggers metadata with authorization enabled (CASSANDRA-7967); "
2407 "The driver will operate normally, but will not reflect triggers in the local metadata model, or schema strings.")
2408 else:
2409 raise triggers_result
2410
2411 # if we're connected to Cassandra < 2.1, the usertypes table will not exist
2412 if types_success:
2413 self.types_result = dict_factory(types_result.column_names, types_result.parsed_rows)
2414 else:
2415 if isinstance(types_result, InvalidRequest):
2416 log.debug("user types table not found")
2417 self.types_result = {}
2418 else:
2419 raise types_result
2420
2421 # functions were introduced in Cassandra 2.2
2422 if functions_success:
2423 self.functions_result = dict_factory(functions_result.column_names, functions_result.parsed_rows)
2424 else:
2425 if isinstance(functions_result, InvalidRequest):
2426 log.debug("user functions table not found")
2427 else:
2428 raise functions_result
2429

Callers 1

get_all_keyspacesMethod · 0.95

Calls 5

_aggregate_resultsMethod · 0.95
QueryMessageClass · 0.90
dict_factoryFunction · 0.90
wait_for_responsesMethod · 0.80
_handle_resultsMethod · 0.80

Tested by

no test coverage detected