MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _constraint_name_for_table

Function _constraint_name_for_table

lib/sqlalchemy/sql/naming.py:149–169  ·  view source on GitHub ↗
(const, table)

Source from the content-addressed store, hash-verified

147
148
149def _constraint_name_for_table(const, table):
150 metadata = table.metadata
151 convention = _get_convention(metadata.naming_convention, type(const))
152
153 if isinstance(const.name, conv):
154 return const.name
155 elif (
156 convention is not None
157 and not isinstance(const.name, conv)
158 and (
159 const.name is None
160 or "constraint_name" in convention
161 or const.name is _NONE_NAME
162 )
163 ):
164 return conv(
165 convention
166 % ConventionDict(const, table, metadata.naming_convention)
167 )
168 elif convention is _NONE_NAME:
169 return None
170
171
172@event.listens_for(

Callers 2

_constraint_nameFunction · 0.85

Calls 3

_get_conventionFunction · 0.85
convClass · 0.85
ConventionDictClass · 0.85

Tested by

no test coverage detected