MCPcopy Create free account
hub / github.com/Vanderhoof/PyDBML / add_index

Method add_index

pydbml/_classes/table.py:91–102  ·  view source on GitHub ↗

Adds index to self.indexes attribute and sets in this index the `table` attribute.

(self, i: Index)

Source from the content-addressed store, hash-verified

89 return self.columns.pop(c)
90
91 def add_index(self, i: Index) -> None:
92 '''
93 Adds index to self.indexes attribute and sets in this index the
94 `table` attribute.
95 '''
96 if not isinstance(i, Index):
97 raise TypeError('Indexes must be of type Index')
98 for subject in i.subjects:
99 if isinstance(subject, Column) and subject.table is not self:
100 raise ColumnNotFoundError(f'Column {subject} not in the table')
101 i.table = self
102 self.indexes.append(i)
103
104 def delete_index(self, i: Union[Index, int]) -> Index:
105 if isinstance(i, Index):

Callers 9

create_databaseMethod · 0.95
test_add_indexMethod · 0.95
test_delete_indexMethod · 0.95
buildMethod · 0.95
__init__Method · 0.95
index1Function · 0.80
test_wrong_typeMethod · 0.80
test_okMethod · 0.80

Calls 1

ColumnNotFoundErrorClass · 0.90

Tested by 7

create_databaseMethod · 0.76
test_add_indexMethod · 0.76
test_delete_indexMethod · 0.76
index1Function · 0.64
test_wrong_typeMethod · 0.64
test_okMethod · 0.64