(
self,
table: sa_schema.Table,
col_d: ReflectedColumn,
include_columns: Optional[Collection[str]],
exclude_columns: Collection[str],
cols_by_orig_name: Dict[str, sa_schema.Column[Any]],
)
| 1628 | ) |
| 1629 | |
| 1630 | def _reflect_column( |
| 1631 | self, |
| 1632 | table: sa_schema.Table, |
| 1633 | col_d: ReflectedColumn, |
| 1634 | include_columns: Optional[Collection[str]], |
| 1635 | exclude_columns: Collection[str], |
| 1636 | cols_by_orig_name: Dict[str, sa_schema.Column[Any]], |
| 1637 | ) -> None: |
| 1638 | orig_name = col_d["name"] |
| 1639 | |
| 1640 | table.metadata.dispatch.column_reflect(self, table, col_d) |
| 1641 | table.dispatch.column_reflect(self, table, col_d) |
| 1642 | |
| 1643 | # fetch name again as column_reflect is allowed to |
| 1644 | # change it |
| 1645 | name = col_d["name"] |
| 1646 | if (include_columns and name not in include_columns) or ( |
| 1647 | exclude_columns and name in exclude_columns |
| 1648 | ): |
| 1649 | return |
| 1650 | |
| 1651 | coltype = col_d["type"] |
| 1652 | |
| 1653 | col_kw = { |
| 1654 | k: col_d[k] # type: ignore[literal-required] |
| 1655 | for k in [ |
| 1656 | "nullable", |
| 1657 | "autoincrement", |
| 1658 | "quote", |
| 1659 | "info", |
| 1660 | "key", |
| 1661 | "comment", |
| 1662 | ] |
| 1663 | if k in col_d |
| 1664 | } |
| 1665 | |
| 1666 | if "dialect_options" in col_d: |
| 1667 | col_kw.update(col_d["dialect_options"]) |
| 1668 | |
| 1669 | colargs = [] |
| 1670 | default: Any |
| 1671 | if col_d.get("default") is not None: |
| 1672 | default_text = col_d["default"] |
| 1673 | assert default_text is not None |
| 1674 | if isinstance(default_text, TextClause): |
| 1675 | default = sa_schema.DefaultClause( |
| 1676 | default_text, _reflected=True |
| 1677 | ) |
| 1678 | elif not isinstance(default_text, sa_schema.FetchedValue): |
| 1679 | default = sa_schema.DefaultClause( |
| 1680 | sql.text(default_text), _reflected=True |
| 1681 | ) |
| 1682 | else: |
| 1683 | default = default_text |
| 1684 | colargs.append(default) |
| 1685 | |
| 1686 | if "computed" in col_d: |
| 1687 | computed = sa_schema.Computed(**col_d["computed"]) |
no test coverage detected