(
self,
table,
create_ok=False,
include_foreign_key_constraints=None,
_is_metadata_operation=False,
)
| 1442 | self.traverse_single(fkc) |
| 1443 | |
| 1444 | def visit_table( |
| 1445 | self, |
| 1446 | table, |
| 1447 | create_ok=False, |
| 1448 | include_foreign_key_constraints=None, |
| 1449 | _is_metadata_operation=False, |
| 1450 | ): |
| 1451 | if not create_ok and not self._can_create_table(table): |
| 1452 | return |
| 1453 | |
| 1454 | with self.with_ddl_events( |
| 1455 | table, |
| 1456 | checkfirst=self.checkfirst, |
| 1457 | _is_metadata_operation=_is_metadata_operation, |
| 1458 | ): |
| 1459 | for column in table.columns: |
| 1460 | if column.default is not None: |
| 1461 | self.traverse_single(column.default) |
| 1462 | |
| 1463 | if not self.dialect.supports_alter: |
| 1464 | # e.g., don't omit any foreign key constraints |
| 1465 | include_foreign_key_constraints = None |
| 1466 | |
| 1467 | if table._creator_ddl is not None: |
| 1468 | table_create_ddl = table._creator_ddl |
| 1469 | else: |
| 1470 | table_create_ddl = CreateTable( |
| 1471 | table, |
| 1472 | include_foreign_key_constraints=( |
| 1473 | include_foreign_key_constraints |
| 1474 | ), |
| 1475 | ) |
| 1476 | |
| 1477 | table_create_ddl._invoke_with(self.connection) |
| 1478 | |
| 1479 | if hasattr(table, "indexes"): |
| 1480 | for index in table.indexes: |
| 1481 | self.traverse_single(index, create_ok=True) |
| 1482 | |
| 1483 | if ( |
| 1484 | self.dialect.supports_comments |
| 1485 | and not self.dialect.inline_comments |
| 1486 | ): |
| 1487 | if table.comment is not None: |
| 1488 | SetTableComment(table)._invoke_with(self.connection) |
| 1489 | |
| 1490 | for column in table.columns: |
| 1491 | if column.comment is not None: |
| 1492 | SetColumnComment(column)._invoke_with(self.connection) |
| 1493 | |
| 1494 | if self.dialect.supports_constraint_comments: |
| 1495 | for constraint in table.constraints: |
| 1496 | if constraint.comment is not None: |
| 1497 | self.connection.execute( |
| 1498 | SetConstraintComment(constraint) |
| 1499 | ) |
| 1500 | |
| 1501 | def visit_foreign_key_constraint(self, constraint): |
nothing calls this directly
no test coverage detected