Initialize execution context for an ExecutableDDLElement construct.
(
cls,
dialect: Dialect,
connection: Connection,
dbapi_connection: PoolProxiedConnection,
execution_options: _ExecuteOptions,
compiled_ddl: DDLCompiler,
)
| 1397 | |
| 1398 | @classmethod |
| 1399 | def _init_ddl( |
| 1400 | cls, |
| 1401 | dialect: Dialect, |
| 1402 | connection: Connection, |
| 1403 | dbapi_connection: PoolProxiedConnection, |
| 1404 | execution_options: _ExecuteOptions, |
| 1405 | compiled_ddl: DDLCompiler, |
| 1406 | ) -> ExecutionContext: |
| 1407 | """Initialize execution context for an ExecutableDDLElement |
| 1408 | construct.""" |
| 1409 | |
| 1410 | self = cls.__new__(cls) |
| 1411 | self.root_connection = connection |
| 1412 | self._dbapi_connection = dbapi_connection |
| 1413 | self.dialect = connection.dialect |
| 1414 | |
| 1415 | self.compiled = compiled = compiled_ddl |
| 1416 | self.isddl = True |
| 1417 | |
| 1418 | self.execution_options = execution_options |
| 1419 | |
| 1420 | self.unicode_statement = str(compiled) |
| 1421 | if compiled.schema_translate_map: |
| 1422 | schema_translate_map = self.execution_options.get( |
| 1423 | "schema_translate_map", {} |
| 1424 | ) |
| 1425 | |
| 1426 | rst = compiled.preparer._render_schema_translates |
| 1427 | self.unicode_statement = rst( |
| 1428 | self.unicode_statement, schema_translate_map |
| 1429 | ) |
| 1430 | |
| 1431 | self.statement = self.unicode_statement |
| 1432 | |
| 1433 | self.cursor = self.create_cursor() |
| 1434 | self.compiled_parameters = [] |
| 1435 | |
| 1436 | if dialect.positional: |
| 1437 | self.parameters = [dialect.execute_sequence_format()] |
| 1438 | else: |
| 1439 | self.parameters = [self._empty_dict_params] |
| 1440 | |
| 1441 | return self |
| 1442 | |
| 1443 | @classmethod |
| 1444 | def _init_compiled( |
nothing calls this directly
no test coverage detected