MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / against

Method against

lib/sqlalchemy/sql/ddl.py:208–241  ·  view source on GitHub ↗

Return a copy of this :class:`_schema.ExecutableDDLElement` which will include the given target. This essentially applies the given item to the ``.target`` attribute of the returned :class:`_schema.ExecutableDDLElement` object. This target is then usable by event han

(self, target: SchemaItem)

Source from the content-addressed store, hash-verified

206
207 @_generative
208 def against(self, target: SchemaItem) -> Self:
209 """Return a copy of this :class:`_schema.ExecutableDDLElement` which
210 will include the given target.
211
212 This essentially applies the given item to the ``.target`` attribute of
213 the returned :class:`_schema.ExecutableDDLElement` object. This target
214 is then usable by event handlers and compilation routines in order to
215 provide services such as tokenization of a DDL string in terms of a
216 particular :class:`_schema.Table`.
217
218 When a :class:`_schema.ExecutableDDLElement` object is established as
219 an event handler for the :meth:`_events.DDLEvents.before_create` or
220 :meth:`_events.DDLEvents.after_create` events, and the event then
221 occurs for a given target such as a :class:`_schema.Constraint` or
222 :class:`_schema.Table`, that target is established with a copy of the
223 :class:`_schema.ExecutableDDLElement` object using this method, which
224 then proceeds to the :meth:`_schema.ExecutableDDLElement.execute`
225 method in order to invoke the actual DDL instruction.
226
227 :param target: a :class:`_schema.SchemaItem` that will be the subject
228 of a DDL operation.
229
230 :return: a copy of this :class:`_schema.ExecutableDDLElement` with the
231 ``.target`` attribute assigned to the given
232 :class:`_schema.SchemaItem`.
233
234 .. seealso::
235
236 :class:`_schema.DDL` - uses tokenization against the "target" when
237 processing the DDL string.
238
239 """
240 self.target = target
241 return self
242
243 @_generative
244 def execute_if(

Callers 1

__call__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected