r"""Represent a table in a database. e.g.:: mytable = Table( "mytable", metadata, Column("mytable_id", Integer, primary_key=True), Column("value", String(50)), ) The :class:`_schema.Table` object constructs a unique insta
| 315 | |
| 316 | |
| 317 | class Table( |
| 318 | DialectKWArgs, HasSchemaAttr, TableClause, inspection.Inspectable["Table"] |
| 319 | ): |
| 320 | r"""Represent a table in a database. |
| 321 | |
| 322 | e.g.:: |
| 323 | |
| 324 | mytable = Table( |
| 325 | "mytable", |
| 326 | metadata, |
| 327 | Column("mytable_id", Integer, primary_key=True), |
| 328 | Column("value", String(50)), |
| 329 | ) |
| 330 | |
| 331 | The :class:`_schema.Table` |
| 332 | object constructs a unique instance of itself based |
| 333 | on its name and optional schema name within the given |
| 334 | :class:`_schema.MetaData` object. Calling the :class:`_schema.Table` |
| 335 | constructor with the same name and same :class:`_schema.MetaData` argument |
| 336 | a second time will return the *same* :class:`_schema.Table` |
| 337 | object - in this way |
| 338 | the :class:`_schema.Table` constructor acts as a registry function. |
| 339 | |
| 340 | .. seealso:: |
| 341 | |
| 342 | :ref:`metadata_describing` - Introduction to database metadata |
| 343 | |
| 344 | """ |
| 345 | |
| 346 | __visit_name__ = "table" |
| 347 | |
| 348 | if TYPE_CHECKING: |
| 349 | |
| 350 | @util.ro_non_memoized_property |
| 351 | def primary_key(self) -> PrimaryKeyConstraint: ... |
| 352 | |
| 353 | @util.ro_non_memoized_property |
| 354 | def foreign_keys(self) -> Set[ForeignKey]: ... |
| 355 | |
| 356 | _columns: DedupeColumnCollection[Column[Any]] |
| 357 | |
| 358 | _sentinel_column: Optional[Column[Any]] |
| 359 | |
| 360 | constraints: Set[Constraint] |
| 361 | """A collection of all :class:`_schema.Constraint` objects associated with |
| 362 | this :class:`_schema.Table`. |
| 363 | |
| 364 | Includes :class:`_schema.PrimaryKeyConstraint`, |
| 365 | :class:`_schema.ForeignKeyConstraint`, :class:`_schema.UniqueConstraint`, |
| 366 | :class:`_schema.CheckConstraint`. A separate collection |
| 367 | :attr:`_schema.Table.foreign_key_constraints` refers to the collection |
| 368 | of all :class:`_schema.ForeignKeyConstraint` objects, and the |
| 369 | :attr:`_schema.Table.primary_key` attribute refers to the single |
| 370 | :class:`_schema.PrimaryKeyConstraint` associated with the |
| 371 | :class:`_schema.Table`. |
| 372 | |
| 373 | .. seealso:: |
| 374 |
no outgoing calls