(const, table)
| 188 | @event.listens_for(Constraint, "after_parent_attach") |
| 189 | @event.listens_for(Index, "after_parent_attach") |
| 190 | def _constraint_name(const, table): |
| 191 | if isinstance(table, Column): |
| 192 | # this path occurs for a CheckConstraint linked to a Column |
| 193 | |
| 194 | # for column-attached constraint, set another event |
| 195 | # to link the column attached to the table as this constraint |
| 196 | # associated with the table. |
| 197 | event.listen( |
| 198 | table, |
| 199 | "after_parent_attach", |
| 200 | lambda col, table: _constraint_name(const, table), |
| 201 | ) |
| 202 | |
| 203 | elif isinstance(table, Table): |
| 204 | if isinstance(const.name, conv) or const.name is _NONE_NAME: |
| 205 | return |
| 206 | |
| 207 | newname = _constraint_name_for_table(const, table) |
| 208 | if newname: |
| 209 | const.name = newname |
nothing calls this directly
no test coverage detected