MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _should_execute

Method _should_execute

lib/sqlalchemy/sql/ddl.py:127–159  ·  view source on GitHub ↗
(
        self,
        ddl: BaseDDLElement,
        target: Union[SchemaItem, str],
        bind: Optional[Connection],
        compiler: Optional[DDLCompiler] = None,
        **kw: Any,
    )

Source from the content-addressed store, hash-verified

125 state: Optional[Any]
126
127 def _should_execute(
128 self,
129 ddl: BaseDDLElement,
130 target: Union[SchemaItem, str],
131 bind: Optional[Connection],
132 compiler: Optional[DDLCompiler] = None,
133 **kw: Any,
134 ) -> bool:
135 if bind is not None:
136 dialect = bind.dialect
137 elif compiler is not None:
138 dialect = compiler.dialect
139 else:
140 assert False, "compiler or dialect is required"
141
142 if isinstance(self.dialect, str):
143 if self.dialect != dialect.name:
144 return False
145 elif isinstance(self.dialect, (tuple, list, set)):
146 if dialect.name not in self.dialect:
147 return False
148 if self.callable_ is not None and not self.callable_(
149 ddl,
150 target,
151 bind,
152 state=self.state,
153 dialect=dialect,
154 compiler=compiler,
155 **kw,
156 ):
157 return False
158
159 return True
160
161
162class ExecutableDDLElement(roles.DDLRole, Executable, BaseDDLElement):

Callers 3

_should_executeMethod · 0.45
test_filterMethod · 0.45

Calls

no outgoing calls

Tested by 1

test_filterMethod · 0.36