MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / against

Method against

lib/sqlalchemy/sql/ddl.py:193–226  ·  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

191
192 @_generative
193 def against(self, target: SchemaItem) -> Self:
194 """Return a copy of this :class:`_schema.ExecutableDDLElement` which
195 will include the given target.
196
197 This essentially applies the given item to the ``.target`` attribute of
198 the returned :class:`_schema.ExecutableDDLElement` object. This target
199 is then usable by event handlers and compilation routines in order to
200 provide services such as tokenization of a DDL string in terms of a
201 particular :class:`_schema.Table`.
202
203 When a :class:`_schema.ExecutableDDLElement` object is established as
204 an event handler for the :meth:`_events.DDLEvents.before_create` or
205 :meth:`_events.DDLEvents.after_create` events, and the event then
206 occurs for a given target such as a :class:`_schema.Constraint` or
207 :class:`_schema.Table`, that target is established with a copy of the
208 :class:`_schema.ExecutableDDLElement` object using this method, which
209 then proceeds to the :meth:`_schema.ExecutableDDLElement.execute`
210 method in order to invoke the actual DDL instruction.
211
212 :param target: a :class:`_schema.SchemaItem` that will be the subject
213 of a DDL operation.
214
215 :return: a copy of this :class:`_schema.ExecutableDDLElement` with the
216 ``.target`` attribute assigned to the given
217 :class:`_schema.SchemaItem`.
218
219 .. seealso::
220
221 :class:`_schema.DDL` - uses tokenization against the "target" when
222 processing the DDL string.
223
224 """
225 self.target = target
226 return self
227
228 @_generative
229 def execute_if(

Callers 1

__call__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected