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

Class TableGroup

pydbml/_classes/table_group.py:9–49  ·  view source on GitHub ↗

TableGroup `items` parameter initially holds just the names of the tables, but after parsing the whole document, PyDBMLParseResults class replaces them with references to actual tables.

Source from the content-addressed store, hash-verified

7
8
9class TableGroup(DBMLObject):
10 '''
11 TableGroup `items` parameter initially holds just the names of the tables,
12 but after parsing the whole document, PyDBMLParseResults class replaces
13 them with references to actual tables.
14 '''
15 dont_compare_fields = ('database',)
16
17 def __init__(self,
18 name: str,
19 items: List[Table],
20 comment: Optional[str] = None,
21 note: Optional[Note] = None,
22 color: Optional[str] = None):
23 self.database = None
24 self.name = name
25 self.items = items
26 self.comment = comment
27 self.note = note
28 self.color = color
29
30 def __repr__(self):
31 """
32 >>> tg = TableGroup('mygroup', ['t1', 't2'])
33 >>> tg
34 <TableGroup 'mygroup', ['t1', 't2']>
35 >>> t1 = Table('t1')
36 >>> t2 = Table('t2')
37 >>> tg.items = [t1, t2]
38 >>> tg
39 <TableGroup 'mygroup', ['t1', 't2']>
40 """
41
42 items = [i if isinstance(i, str) else i.name for i in self.items]
43 return f'<TableGroup {self.name!r}, {items!r}>'
44
45 def __getitem__(self, key: int) -> Table:
46 return self.items[key]
47
48 def __iter__(self):
49 return iter(self.items)

Callers 12

test_add_table_groupMethod · 0.90
test_addMethod · 0.90
test_deleteMethod · 0.90
create_databaseMethod · 0.90
test_simpleMethod · 0.90
test_fullMethod · 0.90
test_getitemMethod · 0.90
test_iterMethod · 0.90
buildMethod · 0.90

Calls

no outgoing calls

Tested by 11

test_add_table_groupMethod · 0.72
test_addMethod · 0.72
test_deleteMethod · 0.72
create_databaseMethod · 0.72
test_simpleMethod · 0.72
test_fullMethod · 0.72
test_getitemMethod · 0.72
test_iterMethod · 0.72