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

Method _build_table_metadata

cassandra/metadata.py:2571–2612  ·  view source on GitHub ↗
(self, row, col_rows=None, trigger_rows=None, index_rows=None, virtual=False)

Source from the content-addressed store, hash-verified

2569 aggregate_row.get('deterministic', False))
2570
2571 def _build_table_metadata(self, row, col_rows=None, trigger_rows=None, index_rows=None, virtual=False):
2572 keyspace_name = row["keyspace_name"]
2573 table_name = row[self._table_name_col]
2574
2575 col_rows = col_rows or self.keyspace_table_col_rows[keyspace_name][table_name]
2576 trigger_rows = trigger_rows or self.keyspace_table_trigger_rows[keyspace_name][table_name]
2577 index_rows = index_rows or self.keyspace_table_index_rows[keyspace_name][table_name]
2578
2579 table_meta = self._table_metadata_class(keyspace_name, table_name, virtual=virtual)
2580 try:
2581 table_meta.options = self._build_table_options(row)
2582 flags = row.get('flags', set())
2583 if flags:
2584 is_dense = 'dense' in flags
2585 compact_static = not is_dense and 'super' not in flags and 'compound' not in flags
2586 table_meta.is_compact_storage = is_dense or 'super' in flags or 'compound' not in flags
2587 elif virtual:
2588 compact_static = False
2589 table_meta.is_compact_storage = False
2590 is_dense = False
2591 else:
2592 compact_static = True
2593 table_meta.is_compact_storage = True
2594 is_dense = False
2595
2596 self._build_table_columns(table_meta, col_rows, compact_static, is_dense, virtual)
2597
2598 for trigger_row in trigger_rows:
2599 trigger_meta = self._build_trigger_metadata(table_meta, trigger_row)
2600 table_meta.triggers[trigger_meta.name] = trigger_meta
2601
2602 for index_row in index_rows:
2603 index_meta = self._build_index_metadata(table_meta, index_row)
2604 if index_meta:
2605 table_meta.indexes[index_meta.name] = index_meta
2606
2607 table_meta.extensions = row.get('extensions', {})
2608 except Exception:
2609 table_meta._exc_info = sys.exc_info()
2610 log.exception("Error while parsing metadata for table %s.%s row(%s) columns(%s)", keyspace_name, table_name, row, col_rows)
2611
2612 return table_meta
2613
2614 def _build_table_options(self, row):
2615 """ Setup the mostly-non-schema table options, like caching settings """

Callers 2

get_tableMethod · 0.95
get_all_keyspacesMethod · 0.45

Calls 6

_build_table_optionsMethod · 0.95
_build_table_columnsMethod · 0.95
_build_index_metadataMethod · 0.95
setFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected