MCPcopy Create free account
hub / github.com/PyTables/PyTables / IndexesTableG

Class IndexesTableG

tables/index.py:2502–2545  ·  view source on GitHub ↗

Table indexes.

Source from the content-addressed store, hash-verified

2500
2501
2502class IndexesTableG(NotLoggedMixin, Group):
2503 """Table indexes."""
2504
2505 _c_classid = "TINDEX"
2506
2507 @property
2508 def auto(self) -> bool:
2509 """Return True if auto-index is set."""
2510 if "AUTO_INDEX" not in self._v_attrs:
2511 return default_auto_index
2512 return self._v_attrs.AUTO_INDEX
2513
2514 @auto.setter
2515 def auto(self, auto: bool) -> None:
2516 self._v_attrs.AUTO_INDEX = bool(auto)
2517
2518 @auto.deleter
2519 def auto(self) -> None:
2520 del self._v_attrs.AUTO_INDEX
2521
2522 def _g_width_warning(self) -> None:
2523 warnings.warn(
2524 "the number of indexed columns on a single table "
2525 "is exceeding the recommended maximum (%d); "
2526 "be ready to see PyTables asking for *lots* of memory "
2527 "and possibly slow I/O" % self._v_max_group_width,
2528 PerformanceWarning,
2529 )
2530
2531 def _g_check_name(self, name: str) -> None:
2532 if not name.startswith("_i_"):
2533 raise ValueError(
2534 "names of index groups must start with ``_i_``: %s" % name
2535 )
2536
2537 @property
2538 def table(self) -> Table:
2539 """Accessor for the `Table` object of this `IndexesTableG` container."""
2540 names = self._v_pathname.split("/")
2541 tablename = names.pop()[3:] # "_i_" is at the beginning
2542 parentpathname = "/".join(names)
2543 tablepathname = join_path(parentpathname, tablename)
2544 table = self._v_file._get_node(tablepathname)
2545 return table
2546
2547
2548class OldIndex(NotLoggedMixin, Group):

Callers 1

create_indexes_tableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected