Create a new MetaData object. :param schema: The default schema to use for the :class:`_schema.Table`, :class:`.Sequence`, and potentially other objects associated with this :class:`_schema.MetaData`. Defaults to ``None``. .. seealso::
(
self,
schema: Optional[str] = None,
quote_schema: Optional[bool] = None,
naming_convention: Optional[_NamingSchemaParameter] = None,
info: Optional[_InfoType] = None,
)
| 5814 | __visit_name__ = "metadata" |
| 5815 | |
| 5816 | def __init__( |
| 5817 | self, |
| 5818 | schema: Optional[str] = None, |
| 5819 | quote_schema: Optional[bool] = None, |
| 5820 | naming_convention: Optional[_NamingSchemaParameter] = None, |
| 5821 | info: Optional[_InfoType] = None, |
| 5822 | ) -> None: |
| 5823 | """Create a new MetaData object. |
| 5824 | |
| 5825 | :param schema: |
| 5826 | The default schema to use for the :class:`_schema.Table`, |
| 5827 | :class:`.Sequence`, and potentially other objects associated with |
| 5828 | this :class:`_schema.MetaData`. Defaults to ``None``. |
| 5829 | |
| 5830 | .. seealso:: |
| 5831 | |
| 5832 | :ref:`schema_metadata_schema_name` - details on how the |
| 5833 | :paramref:`_schema.MetaData.schema` parameter is used. |
| 5834 | |
| 5835 | :paramref:`_schema.Table.schema` |
| 5836 | |
| 5837 | :paramref:`.Sequence.schema` |
| 5838 | |
| 5839 | :param quote_schema: |
| 5840 | Sets the ``quote_schema`` flag for those :class:`_schema.Table`, |
| 5841 | :class:`.Sequence`, and other objects which make usage of the |
| 5842 | local ``schema`` name. |
| 5843 | |
| 5844 | :param info: Optional data dictionary which will be populated into the |
| 5845 | :attr:`.SchemaItem.info` attribute of this object. |
| 5846 | |
| 5847 | :param naming_convention: a dictionary referring to values which |
| 5848 | will establish default naming conventions for :class:`.Constraint` |
| 5849 | and :class:`.Index` objects, for those objects which are not given |
| 5850 | a name explicitly. |
| 5851 | |
| 5852 | The keys of this dictionary may be: |
| 5853 | |
| 5854 | * a constraint or Index class, e.g. the :class:`.UniqueConstraint`, |
| 5855 | :class:`_schema.ForeignKeyConstraint` class, the :class:`.Index` |
| 5856 | class |
| 5857 | |
| 5858 | * a string mnemonic for one of the known constraint classes; |
| 5859 | ``"fk"``, ``"pk"``, ``"ix"``, ``"ck"``, ``"uq"`` for foreign key, |
| 5860 | primary key, index, check, and unique constraint, respectively. |
| 5861 | |
| 5862 | * the string name of a user-defined "token" that can be used |
| 5863 | to define new naming tokens. |
| 5864 | |
| 5865 | The values associated with each "constraint class" or "constraint |
| 5866 | mnemonic" key are string naming templates, such as |
| 5867 | ``"uq_%(table_name)s_%(column_0_name)s"``, |
| 5868 | which describe how the name should be composed. The values |
| 5869 | associated with user-defined "token" keys should be callables of the |
| 5870 | form ``fn(constraint, table)``, which accepts the constraint/index |
| 5871 | object and :class:`_schema.Table` as arguments, returning a string |
| 5872 | result. |
| 5873 |