MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / get_schema_objects

Method get_schema_objects

lib/sqlalchemy/sql/schema.py:6360–6385  ·  view source on GitHub ↗

Return a sequence of schema objects of the given kind. This method can be used to return :class:`_sqltypes.Enum`, :class:`.Sequence`, etc. objects registered in this :class:`_schema.MetaData`. :param kind: a type that indicates what object to return, such as

(
        self,
        kind: Type[_T],
        *,
        schema: Union[str, None, Literal[_NoArg.NO_ARG]] = _NoArg.NO_ARG,
    )

Source from the content-addressed store, hash-verified

6358 return tuple(schemas)
6359
6360 def get_schema_objects(
6361 self,
6362 kind: Type[_T],
6363 *,
6364 schema: Union[str, None, Literal[_NoArg.NO_ARG]] = _NoArg.NO_ARG,
6365 ) -> _typing_Sequence[_T]:
6366 """Return a sequence of schema objects of the given kind.
6367
6368 This method can be used to return :class:`_sqltypes.Enum`,
6369 :class:`.Sequence`, etc. objects registered in this
6370 :class:`_schema.MetaData`.
6371
6372 :param kind: a type that indicates what object to return, such as
6373 :class:`Enum` or :class:`Sequence`.
6374 :param schema: Optional, a schema name to filter the objects by. If
6375 not provided the default schema of the metadata is used.
6376
6377 """
6378
6379 if schema is _NoArg.NO_ARG:
6380 schema = self.schema
6381 return tuple(
6382 obj
6383 for obj in self._objects
6384 if isinstance(obj, kind) and obj.schema == schema
6385 )
6386
6387 def get_schema_object_by_name(
6388 self,

Calls

no outgoing calls

Tested by 3