Execute a schema.ColumnDefault object.
(
self,
default: DefaultGenerator,
distilled_parameters: _CoreMultiExecuteParams,
execution_options: CoreExecuteOptionsParameter,
)
| 1464 | ) |
| 1465 | |
| 1466 | def _execute_default( |
| 1467 | self, |
| 1468 | default: DefaultGenerator, |
| 1469 | distilled_parameters: _CoreMultiExecuteParams, |
| 1470 | execution_options: CoreExecuteOptionsParameter, |
| 1471 | ) -> Any: |
| 1472 | """Execute a schema.ColumnDefault object.""" |
| 1473 | |
| 1474 | exec_opts = self._execution_options.merge_with(execution_options) |
| 1475 | |
| 1476 | event_multiparams: Optional[_CoreMultiExecuteParams] |
| 1477 | event_params: Optional[_CoreAnyExecuteParams] |
| 1478 | |
| 1479 | # note for event handlers, the "distilled parameters" which is always |
| 1480 | # a list of dicts is broken out into separate "multiparams" and |
| 1481 | # "params" collections, which allows the handler to distinguish |
| 1482 | # between an executemany and execute style set of parameters. |
| 1483 | if self._has_events or self.engine._has_events: |
| 1484 | ( |
| 1485 | default, |
| 1486 | distilled_parameters, |
| 1487 | event_multiparams, |
| 1488 | event_params, |
| 1489 | ) = self._invoke_before_exec_event( |
| 1490 | default, distilled_parameters, exec_opts |
| 1491 | ) |
| 1492 | else: |
| 1493 | event_multiparams = event_params = None |
| 1494 | |
| 1495 | try: |
| 1496 | conn = self._dbapi_connection |
| 1497 | if conn is None: |
| 1498 | conn = self._revalidate_connection() |
| 1499 | |
| 1500 | dialect = self.dialect |
| 1501 | ctx = dialect.execution_ctx_cls._init_default( |
| 1502 | dialect, self, conn, exec_opts |
| 1503 | ) |
| 1504 | except (exc.PendingRollbackError, exc.ResourceClosedError): |
| 1505 | raise |
| 1506 | except BaseException as e: |
| 1507 | self._handle_dbapi_exception(e, None, None, None, None) |
| 1508 | |
| 1509 | ret = ctx._exec_default(None, default, None) |
| 1510 | |
| 1511 | if self._has_events or self.engine._has_events: |
| 1512 | self.dispatch.after_execute( |
| 1513 | self, |
| 1514 | default, |
| 1515 | event_multiparams, |
| 1516 | event_params, |
| 1517 | exec_opts, |
| 1518 | ret, |
| 1519 | ) |
| 1520 | |
| 1521 | return ret |
| 1522 | |
| 1523 | def _execute_ddl( |
no test coverage detected