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

Method add_table

pydbml/database.py:73–87  ·  view source on GitHub ↗
(self, obj: Table)

Source from the content-addressed store, hash-verified

71 raise DatabaseValidationError(f'Unsupported type {type(obj)}.')
72
73 def add_table(self, obj: Table) -> Table:
74 if obj in self.tables:
75 raise DatabaseValidationError(f'{obj} is already in the database.')
76 if obj.full_name in self.table_dict:
77 raise DatabaseValidationError(f'Table {obj.full_name} is already in the database.')
78 if obj.alias and obj.alias in self.table_dict:
79 raise DatabaseValidationError(f'Table {obj.alias} is already in the database.')
80
81 self._set_database(obj)
82
83 self.tables.append(obj)
84 self.table_dict[obj.full_name] = obj
85 if obj.alias:
86 self.table_dict[obj.alias] = obj
87 return obj
88
89 def add_reference(self, obj: Reference):
90 for col in (*obj.col1, *obj.col2):

Callers 12

test_add_tableMethod · 0.95
test_add_table_aliasMethod · 0.95
test_add_table_badMethod · 0.95
test_delete_tableMethod · 0.95
test_add_referenceMethod · 0.95
test_delete_referenceMethod · 0.95
test_geititemMethod · 0.95
test_iterMethod · 0.95
addMethod · 0.95

Calls 2

_set_databaseMethod · 0.95

Tested by 11

test_add_tableMethod · 0.76
test_add_table_aliasMethod · 0.76
test_add_table_badMethod · 0.76
test_delete_tableMethod · 0.76
test_add_referenceMethod · 0.76
test_delete_referenceMethod · 0.76
test_geititemMethod · 0.76
test_iterMethod · 0.76