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

Method add_reference

pydbml/database.py:89–103  ·  view source on GitHub ↗
(self, obj: Reference)

Source from the content-addressed store, hash-verified

87 return obj
88
89 def add_reference(self, obj: Reference):
90 for col in (*obj.col1, *obj.col2):
91 if col.table and col.table.database == self:
92 break
93 else:
94 raise DatabaseValidationError(
95 'Cannot add reference. At least one of the referenced tables'
96 ' should belong to this database'
97 )
98 if obj in self.refs:
99 raise DatabaseValidationError(f'{obj} is already in the database.')
100
101 self._set_database(obj)
102 self.refs.append(obj)
103 return obj
104
105 def add_enum(self, obj: Enum) -> Enum:
106 if obj in self.enums:

Callers 4

test_add_referenceMethod · 0.95
test_delete_referenceMethod · 0.95
addMethod · 0.95

Calls 2

_set_databaseMethod · 0.95

Tested by 3

test_add_referenceMethod · 0.76
test_delete_referenceMethod · 0.76