class Inspector(inspection.Inspectable[
Known subclasses: sqlalchemy.dialects.postgresql.base.PGInspector
Performs database schema inspection. The Inspector acts as a proxy to the reflection methods of the :class:`~sqlalchemy.engine.interfaces.Dialect`, providing a consistent interface as well as caching support for previously fetched metadata. A :class:`_reflection.Inspector` object is usually created via the :func:`_sa.inspect` function, which may be passed an :class:`_engine.Engine` or a :class:`_engine.Connection`:: from sqlalchemy import inspect, create_engine engine = create_engine('...') insp = inspect(engine) Where above, the :class:`~sqlalchemy.engine.interfaces.Dialect` associated with the engine may opt to return an :class:`_reflection.Inspector` subclass that provides additional methods specific to the dialect's target database.
Class Method | from |
Construct a new dialect-specific Inspector object from the given engine or connection. |
Method | __init__ |
Initialize a new :class:`_reflection.Inspector`. |
Method | clear |
reset the cache for this :class:`.Inspector`. |
Method | get |
Return information about check constraints in ``table_name``. |
Method | get |
Return information about columns in ``table_name``. |
Method | get |
Return information about foreign_keys in ``table_name``. |
Method | get |
Return information about indexes in ``table_name``. |
Method | get |
Return all materialized view names in `schema`. |
Method | get |
Return information about check constraints in all tables in the given schema. |
Method | get |
Return information about columns in all objects in the given schema. |
Method | get |
Return information about foreign_keys in all tables in the given schema. |
Method | get |
Return information about indexes in in all objects in the given schema. |
Method | get |
Return information about primary key constraints in all tables in the given schema. |
Method | get |
Return information about the table comment in all objects in the given schema. |
Method | get |
Return a dictionary of options specified when the tables in the given schema were created. |
Method | get |
Return information about unique constraints in all tables in the given schema. |
Method | get |
Return information about primary key constraint in ``table_name``. |
Method | get |
Return all schema names. |
Method | get |
Return all sequence names in `schema`. |
Method | get |
Return dependency-sorted table and foreign key constraint names in referred to within a particular schema. |
Method | get |
Return information about the table comment for ``table_name``. |
Method | get |
Return all table names within a particular schema. |
Method | get |
Return a dictionary of options specified when the table of the given name was created. |
Method | get |
Return a list of temporary table names for the current bind. |
Method | get |
Return a list of temporary view names for the current bind. |
Method | get |
Return information about unique constraints in ``table_name``. |
Method | get |
Return definition for the plain or materialized view called ``view_name``. |
Method | get |
Return all non-materialized view names in `schema`. |
Method | has |
Check the existence of a particular index name in the database. |
Method | has |
Return True if the backend has a schema with the given name. |
Method | has |
Return True if the backend has a sequence with the given name. |
Method | has |
Return True if the backend has a table, view, or temporary table of the given name. |
Method | reflect |
Given a :class:`_schema.Table` object, load its internal constructs based on introspection. |
Method | sort |
Return dependency-sorted table and foreign key constraint names referred to within multiple schemas. |
Instance Variable | bind |
Undocumented |
Instance Variable | dialect |
Undocumented |
Instance Variable | engine |
Undocumented |
Instance Variable | info |
Undocumented |
Property | default |
Return the default schema name presented by the dialect for the current engine's database user. |
Class Method | _construct |
Undocumented |
Method | _connection |
Undocumented |
Method | _engine |
Undocumented |
Method | _get |
Undocumented |
Method | _init |
Undocumented |
Method | _init |
Undocumented |
Method | _init |
Undocumented |
Method | _inspection |
Return an :class:`_reflection.Inspector` from this one that will run all operations on a single connection. |
Method | _instantiate |
Undocumented |
Method | _operation |
Return a context that optimizes for multiple operations on a single transaction. |
Method | _reflect |
Undocumented |
Method | _reflect |
Undocumented |
Method | _reflect |
Undocumented |
Method | _reflect |
Undocumented |
Method | _reflect |
Undocumented |
Method | _reflect |
Undocumented |
Method | _reflect |
Undocumented |
Class Variable | _index |
Undocumented |
Instance Variable | _op |
Undocumented |
Inherited from Inspectable
:
Class Variable | __slots__ |
Undocumented |
@util.deprecated(
def from_engine(cls, bind:
Engine
) -> Inspector
:
(source)
¶
Construct a new dialect-specific Inspector object from the given engine or connection. :param bind: a :class:`~sqlalchemy.engine.Connection` or :class:`~sqlalchemy.engine.Engine`. This method differs from direct a direct constructor call of :class:`_reflection.Inspector` in that the :class:`~sqlalchemy.engine.interfaces.Dialect` is given a chance to provide a dialect-specific :class:`_reflection.Inspector` instance, which may provide additional methods. See the example at :class:`_reflection.Inspector`.
def __init__(self, bind:
Union[ Engine, Connection]
):
(source)
¶
Initialize a new :class:`_reflection.Inspector`. :param bind: a :class:`~sqlalchemy.engine.Connection`, which is typically an instance of :class:`~sqlalchemy.engine.Engine` or :class:`~sqlalchemy.engine.Connection`. For a dialect-specific instance of :class:`_reflection.Inspector`, see :meth:`_reflection.Inspector.from_engine`
reset the cache for this :class:`.Inspector`. Inspection methods that have data cached will emit SQL queries when next called to get new data. .. versionadded:: 2.0
str
, schema: Optional[ str]
= None, **kw: Any
) -> List[ ReflectedCheckConstraint]
:
(source)
¶
Return information about check constraints in ``table_name``. Given a string ``table_name`` and an optional string `schema`, return check constraint information as a list of :class:`.ReflectedCheckConstraint`. :param table_name: string name of the table. For special quoting, use :class:`.quoted_name`. :param schema: string schema name; if omitted, uses the default schema of the database connection. For special quoting, use :class:`.quoted_name`. :param \**kw: Additional keyword argument to pass to the dialect specific implementation. See the documentation of the dialect in use for more information. :return: a list of dictionaries, each representing the definition of a check constraints. .. versionadded:: 1.1.0 .. seealso:: :meth:`Inspector.get_multi_check_constraints`
str
, schema: Optional[ str]
= None, **kw: Any
) -> List[ ReflectedColumn]
:
(source)
¶
Return information about columns in ``table_name``. Given a string ``table_name`` and an optional string ``schema``, return column information as a list of :class:`.ReflectedColumn`. :param table_name: string name of the table. For special quoting, use :class:`.quoted_name`. :param schema: string schema name; if omitted, uses the default schema of the database connection. For special quoting, use :class:`.quoted_name`. :param \**kw: Additional keyword argument to pass to the dialect specific implementation. See the documentation of the dialect in use for more information. :return: list of dictionaries, each representing the definition of a database column. .. seealso:: :meth:`Inspector.get_multi_columns`.
str
, schema: Optional[ str]
= None, **kw: Any
) -> List[ ReflectedForeignKeyConstraint]
:
(source)
¶
Return information about foreign_keys in ``table_name``. Given a string ``table_name``, and an optional string `schema`, return foreign key information as a list of :class:`.ReflectedForeignKeyConstraint`. :param table_name: string name of the table. For special quoting, use :class:`.quoted_name`. :param schema: string schema name; if omitted, uses the default schema of the database connection. For special quoting, use :class:`.quoted_name`. :param \**kw: Additional keyword argument to pass to the dialect specific implementation. See the documentation of the dialect in use for more information. :return: a list of dictionaries, each representing the a foreign key definition. .. seealso:: :meth:`Inspector.get_multi_foreign_keys`
str
, schema: Optional[ str]
= None, **kw: Any
) -> List[ ReflectedIndex]
:
(source)
¶
Return information about indexes in ``table_name``. Given a string ``table_name`` and an optional string `schema`, return index information as a list of :class:`.ReflectedIndex`. :param table_name: string name of the table. For special quoting, use :class:`.quoted_name`. :param schema: string schema name; if omitted, uses the default schema of the database connection. For special quoting, use :class:`.quoted_name`. :param \**kw: Additional keyword argument to pass to the dialect specific implementation. See the documentation of the dialect in use for more information. :return: a list of dictionaries, each representing the definition of an index. .. seealso:: :meth:`Inspector.get_multi_indexes`
Optional[ str]
= None, **kw: Any
) -> List[ str]
:
(source)
¶
Return all materialized view names in `schema`. :param schema: Optional, retrieve names from a non-default schema. For special quoting, use :class:`.quoted_name`. :param \**kw: Additional keyword argument to pass to the dialect specific implementation. See the documentation of the dialect in use for more information. .. versionadded:: 2.0 .. seealso:: :meth:`.Inspector.get_view_names`
Optional[ str]
= None, filter_names: Optional[ Sequence[ str]]
= None, kind: ObjectKind
= ObjectKind.TABLE, scope: ObjectScope
= ObjectScope.DEFAULT, **kw: Any
) -> Dict[ TableKey, List[ ReflectedCheckConstraint]]
:
(source)
¶
Return information about check constraints in all tables in the given schema. The tables can be filtered by passing the names to use to ``filter_names``. For each table the value is a list of :class:`.ReflectedCheckConstraint`. :param schema: string schema name; if omitted, uses the default schema of the database connection. For special quoting, use :class:`.quoted_name`. :param filter_names: optionally return information only for the objects listed here. :param kind: a :class:`.ObjectKind` that specifies the type of objects to reflect. Defaults to ``ObjectKind.TABLE``. :param scope: a :class:`.ObjectScope` that specifies if constraints of default, temporary or any tables should be reflected. Defaults to ``ObjectScope.DEFAULT``. :param \**kw: Additional keyword argument to pass to the dialect specific implementation. See the documentation of the dialect in use for more information. :return: a dictionary where the keys are two-tuple schema,table-name and the values are list of dictionaries, each representing the definition of a check constraints. The schema is ``None`` if no schema is provided. .. versionadded:: 2.0 .. seealso:: :meth:`Inspector.get_check_constraints`
Optional[ str]
= None, filter_names: Optional[ Sequence[ str]]
= None, kind: ObjectKind
= ObjectKind.TABLE, scope: ObjectScope
= ObjectScope.DEFAULT, **kw: Any
) -> Dict[ TableKey, List[ ReflectedColumn]]
:
(source)
¶
Return information about columns in all objects in the given schema. The objects can be filtered by passing the names to use to ``filter_names``. For each table the value is a list of :class:`.ReflectedColumn`. :param schema: string schema name; if omitted, uses the default schema of the database connection. For special quoting, use :class:`.quoted_name`. :param filter_names: optionally return information only for the objects listed here. :param kind: a :class:`.ObjectKind` that specifies the type of objects to reflect. Defaults to ``ObjectKind.TABLE``. :param scope: a :class:`.ObjectScope` that specifies if columns of default, temporary or any tables should be reflected. Defaults to ``ObjectScope.DEFAULT``. :param \**kw: Additional keyword argument to pass to the dialect specific implementation. See the documentation of the dialect in use for more information. :return: a dictionary where the keys are two-tuple schema,table-name and the values are list of dictionaries, each representing the definition of a database column. The schema is ``None`` if no schema is provided. .. versionadded:: 2.0 .. seealso:: :meth:`Inspector.get_columns`
Optional[ str]
= None, filter_names: Optional[ Sequence[ str]]
= None, kind: ObjectKind
= ObjectKind.TABLE, scope: ObjectScope
= ObjectScope.DEFAULT, **kw: Any
) -> Dict[ TableKey, List[ ReflectedForeignKeyConstraint]]
:
(source)
¶
Return information about foreign_keys in all tables in the given schema. The tables can be filtered by passing the names to use to ``filter_names``. For each table the value is a list of :class:`.ReflectedForeignKeyConstraint`. :param schema: string schema name; if omitted, uses the default schema of the database connection. For special quoting, use :class:`.quoted_name`. :param filter_names: optionally return information only for the objects listed here. :param kind: a :class:`.ObjectKind` that specifies the type of objects to reflect. Defaults to ``ObjectKind.TABLE``. :param scope: a :class:`.ObjectScope` that specifies if foreign keys of default, temporary or any tables should be reflected. Defaults to ``ObjectScope.DEFAULT``. :param \**kw: Additional keyword argument to pass to the dialect specific implementation. See the documentation of the dialect in use for more information. :return: a dictionary where the keys are two-tuple schema,table-name and the values are list of dictionaries, each representing a foreign key definition. The schema is ``None`` if no schema is provided. .. versionadded:: 2.0 .. seealso:: :meth:`Inspector.get_foreign_keys`
Optional[ str]
= None, filter_names: Optional[ Sequence[ str]]
= None, kind: ObjectKind
= ObjectKind.TABLE, scope: ObjectScope
= ObjectScope.DEFAULT, **kw: Any
) -> Dict[ TableKey, List[ ReflectedIndex]]
:
(source)
¶
Return information about indexes in in all objects in the given schema. The objects can be filtered by passing the names to use to ``filter_names``. For each table the value is a list of :class:`.ReflectedIndex`. :param schema: string schema name; if omitted, uses the default schema of the database connection. For special quoting, use :class:`.quoted_name`. :param filter_names: optionally return information only for the objects listed here. :param kind: a :class:`.ObjectKind` that specifies the type of objects to reflect. Defaults to ``ObjectKind.TABLE``. :param scope: a :class:`.ObjectScope` that specifies if indexes of default, temporary or any tables should be reflected. Defaults to ``ObjectScope.DEFAULT``. :param \**kw: Additional keyword argument to pass to the dialect specific implementation. See the documentation of the dialect in use for more information. :return: a dictionary where the keys are two-tuple schema,table-name and the values are list of dictionaries, each representing the definition of an index. The schema is ``None`` if no schema is provided. .. versionadded:: 2.0 .. seealso:: :meth:`Inspector.get_indexes`
Optional[ str]
= None, filter_names: Optional[ Sequence[ str]]
= None, kind: ObjectKind
= ObjectKind.TABLE, scope: ObjectScope
= ObjectScope.DEFAULT, **kw: Any
) -> Dict[ TableKey, ReflectedPrimaryKeyConstraint]
:
(source)
¶
Return information about primary key constraints in all tables in the given schema. The tables can be filtered by passing the names to use to ``filter_names``. For each table the value is a :class:`.ReflectedPrimaryKeyConstraint`. :param schema: string schema name; if omitted, uses the default schema of the database connection. For special quoting, use :class:`.quoted_name`. :param filter_names: optionally return information only for the objects listed here. :param kind: a :class:`.ObjectKind` that specifies the type of objects to reflect. Defaults to ``ObjectKind.TABLE``. :param scope: a :class:`.ObjectScope` that specifies if primary keys of default, temporary or any tables should be reflected. Defaults to ``ObjectScope.DEFAULT``. :param \**kw: Additional keyword argument to pass to the dialect specific implementation. See the documentation of the dialect in use for more information. :return: a dictionary where the keys are two-tuple schema,table-name and the values are dictionaries, each representing the definition of a primary key constraint. The schema is ``None`` if no schema is provided. .. versionadded:: 2.0 .. seealso:: :meth:`Inspector.get_pk_constraint`
Optional[ str]
= None, filter_names: Optional[ Sequence[ str]]
= None, kind: ObjectKind
= ObjectKind.TABLE, scope: ObjectScope
= ObjectScope.DEFAULT, **kw: Any
) -> Dict[ TableKey, ReflectedTableComment]
:
(source)
¶
Return information about the table comment in all objects in the given schema. The objects can be filtered by passing the names to use to ``filter_names``. For each table the value is a :class:`.ReflectedTableComment`. Raises ``NotImplementedError`` for a dialect that does not support comments. :param schema: string schema name; if omitted, uses the default schema of the database connection. For special quoting, use :class:`.quoted_name`. :param filter_names: optionally return information only for the objects listed here. :param kind: a :class:`.ObjectKind` that specifies the type of objects to reflect. Defaults to ``ObjectKind.TABLE``. :param scope: a :class:`.ObjectScope` that specifies if comments of default, temporary or any tables should be reflected. Defaults to ``ObjectScope.DEFAULT``. :param \**kw: Additional keyword argument to pass to the dialect specific implementation. See the documentation of the dialect in use for more information. :return: a dictionary where the keys are two-tuple schema,table-name and the values are dictionaries, representing the table comments. The schema is ``None`` if no schema is provided. .. versionadded:: 2.0 .. seealso:: :meth:`Inspector.get_table_comment`
Optional[ str]
= None, filter_names: Optional[ Sequence[ str]]
= None, kind: ObjectKind
= ObjectKind.TABLE, scope: ObjectScope
= ObjectScope.DEFAULT, **kw: Any
) -> Dict[ TableKey, Dict[ str, Any]]
:
(source)
¶
Return a dictionary of options specified when the tables in the given schema were created. The tables can be filtered by passing the names to use to ``filter_names``. This currently includes some options that apply to MySQL and Oracle tables. :param schema: string schema name; if omitted, uses the default schema of the database connection. For special quoting, use :class:`.quoted_name`. :param filter_names: optionally return information only for the objects listed here. :param kind: a :class:`.ObjectKind` that specifies the type of objects to reflect. Defaults to ``ObjectKind.TABLE``. :param scope: a :class:`.ObjectScope` that specifies if options of default, temporary or any tables should be reflected. Defaults to ``ObjectScope.DEFAULT``. :param \**kw: Additional keyword argument to pass to the dialect specific implementation. See the documentation of the dialect in use for more information. :return: a dictionary where the keys are two-tuple schema,table-name and the values are dictionaries with the table options. The returned keys in each dict depend on the dialect in use. Each one is prefixed with the dialect name. The schema is ``None`` if no schema is provided. .. versionadded:: 2.0 .. seealso:: :meth:`Inspector.get_table_options`
Optional[ str]
= None, filter_names: Optional[ Sequence[ str]]
= None, kind: ObjectKind
= ObjectKind.TABLE, scope: ObjectScope
= ObjectScope.DEFAULT, **kw: Any
) -> Dict[ TableKey, List[ ReflectedUniqueConstraint]]
:
(source)
¶
Return information about unique constraints in all tables in the given schema. The tables can be filtered by passing the names to use to ``filter_names``. For each table the value is a list of :class:`.ReflectedUniqueConstraint`. :param schema: string schema name; if omitted, uses the default schema of the database connection. For special quoting, use :class:`.quoted_name`. :param filter_names: optionally return information only for the objects listed here. :param kind: a :class:`.ObjectKind` that specifies the type of objects to reflect. Defaults to ``ObjectKind.TABLE``. :param scope: a :class:`.ObjectScope` that specifies if constraints of default, temporary or any tables should be reflected. Defaults to ``ObjectScope.DEFAULT``. :param \**kw: Additional keyword argument to pass to the dialect specific implementation. See the documentation of the dialect in use for more information. :return: a dictionary where the keys are two-tuple schema,table-name and the values are list of dictionaries, each representing the definition of an unique constraint. The schema is ``None`` if no schema is provided. .. versionadded:: 2.0 .. seealso:: :meth:`Inspector.get_unique_constraints`
str
, schema: Optional[ str]
= None, **kw: Any
) -> ReflectedPrimaryKeyConstraint
:
(source)
¶
Return information about primary key constraint in ``table_name``. Given a string ``table_name``, and an optional string `schema`, return primary key information as a :class:`.ReflectedPrimaryKeyConstraint`. :param table_name: string name of the table. For special quoting, use :class:`.quoted_name`. :param schema: string schema name; if omitted, uses the default schema of the database connection. For special quoting, use :class:`.quoted_name`. :param \**kw: Additional keyword argument to pass to the dialect specific implementation. See the documentation of the dialect in use for more information. :return: a dictionary representing the definition of a primary key constraint. .. seealso:: :meth:`Inspector.get_multi_pk_constraint`
Return all schema names. :param \**kw: Additional keyword argument to pass to the dialect specific implementation. See the documentation of the dialect in use for more information.
Return all sequence names in `schema`. :param schema: Optional, retrieve names from a non-default schema. For special quoting, use :class:`.quoted_name`. :param \**kw: Additional keyword argument to pass to the dialect specific implementation. See the documentation of the dialect in use for more information.
Optional[ str]
= None, **kw: Any
) -> List[ Tuple[ Optional[ str], List[ Tuple[ str, Optional[ str]]]]]
:
(source)
¶
Return dependency-sorted table and foreign key constraint names in referred to within a particular schema. This will yield 2-tuples of ``(tablename, [(tname, fkname), (tname, fkname), ...])`` consisting of table names in CREATE order grouped with the foreign key constraint names that are not detected as belonging to a cycle. The final element will be ``(None, [(tname, fkname), (tname, fkname), ..])`` which will consist of remaining foreign key constraint names that would require a separate CREATE step after-the-fact, based on dependencies between tables. .. versionadded:: 1.0.- :param schema: schema name to query, if not the default schema. :param \**kw: Additional keyword argument to pass to the dialect specific implementation. See the documentation of the dialect in use for more information. .. seealso:: :meth:`_reflection.Inspector.get_table_names` :func:`.sort_tables_and_constraints` - similar method which works with an already-given :class:`_schema.MetaData`.
str
, schema: Optional[ str]
= None, **kw: Any
) -> ReflectedTableComment
:
(source)
¶
Return information about the table comment for ``table_name``. Given a string ``table_name`` and an optional string ``schema``, return table comment information as a :class:`.ReflectedTableComment`. Raises ``NotImplementedError`` for a dialect that does not support comments. :param table_name: string name of the table. For special quoting, use :class:`.quoted_name`. :param schema: string schema name; if omitted, uses the default schema of the database connection. For special quoting, use :class:`.quoted_name`. :param \**kw: Additional keyword argument to pass to the dialect specific implementation. See the documentation of the dialect in use for more information. :return: a dictionary, with the table comment. .. versionadded:: 1.2 .. seealso:: :meth:`Inspector.get_multi_table_comment`
Return all table names within a particular schema. The names are expected to be real tables only, not views. Views are instead returned using the :meth:`_reflection.Inspector.get_view_names` and/or :meth:`_reflection.Inspector.get_materialized_view_names` methods. :param schema: Schema name. If ``schema`` is left at ``None``, the database's default schema is used, else the named schema is searched. If the database does not support named schemas, behavior is undefined if ``schema`` is not passed as ``None``. For special quoting, use :class:`.quoted_name`. :param \**kw: Additional keyword argument to pass to the dialect specific implementation. See the documentation of the dialect in use for more information. .. seealso:: :meth:`_reflection.Inspector.get_sorted_table_and_fkc_names` :attr:`_schema.MetaData.sorted_tables`
str
, schema: Optional[ str]
= None, **kw: Any
) -> Dict[ str, Any]
:
(source)
¶
Return a dictionary of options specified when the table of the given name was created. This currently includes some options that apply to MySQL and Oracle tables. :param table_name: string name of the table. For special quoting, use :class:`.quoted_name`. :param schema: string schema name; if omitted, uses the default schema of the database connection. For special quoting, use :class:`.quoted_name`. :param \**kw: Additional keyword argument to pass to the dialect specific implementation. See the documentation of the dialect in use for more information. :return: a dict with the table options. The returned keys depend on the dialect in use. Each one is prefixed with the dialect name. .. seealso:: :meth:`Inspector.get_multi_table_options`
Return a list of temporary table names for the current bind. This method is unsupported by most dialects; currently only Oracle, PostgreSQL and SQLite implements it. :param \**kw: Additional keyword argument to pass to the dialect specific implementation. See the documentation of the dialect in use for more information. .. versionadded:: 1.0.0
Return a list of temporary view names for the current bind. This method is unsupported by most dialects; currently only PostgreSQL and SQLite implements it. :param \**kw: Additional keyword argument to pass to the dialect specific implementation. See the documentation of the dialect in use for more information. .. versionadded:: 1.0.0
str
, schema: Optional[ str]
= None, **kw: Any
) -> List[ ReflectedUniqueConstraint]
:
(source)
¶
Return information about unique constraints in ``table_name``. Given a string ``table_name`` and an optional string `schema`, return unique constraint information as a list of :class:`.ReflectedUniqueConstraint`. :param table_name: string name of the table. For special quoting, use :class:`.quoted_name`. :param schema: string schema name; if omitted, uses the default schema of the database connection. For special quoting, use :class:`.quoted_name`. :param \**kw: Additional keyword argument to pass to the dialect specific implementation. See the documentation of the dialect in use for more information. :return: a list of dictionaries, each representing the definition of an unique constraint. .. seealso:: :meth:`Inspector.get_multi_unique_constraints`
str
, schema: Optional[ str]
= None, **kw: Any
) -> str
:
(source)
¶
Return definition for the plain or materialized view called ``view_name``. :param view_name: Name of the view. :param schema: Optional, retrieve names from a non-default schema. For special quoting, use :class:`.quoted_name`. :param \**kw: Additional keyword argument to pass to the dialect specific implementation. See the documentation of the dialect in use for more information.
Return all non-materialized view names in `schema`. :param schema: Optional, retrieve names from a non-default schema. For special quoting, use :class:`.quoted_name`. :param \**kw: Additional keyword argument to pass to the dialect specific implementation. See the documentation of the dialect in use for more information. .. versionchanged:: 2.0 For those dialects that previously included the names of materialized views in this list (currently PostgreSQL), this method no longer returns the names of materialized views. the :meth:`.Inspector.get_materialized_view_names` method should be used instead. .. seealso:: :meth:`.Inspector.get_materialized_view_names`
str
, index_name: str
, schema: Optional[ str]
= None, **kw: Any
) -> bool
:
(source)
¶
Check the existence of a particular index name in the database. :param table_name: the name of the table the index belongs to :param index_name: the name of the index to check :param schema: schema name to query, if not the default schema. :param \**kw: Additional keyword argument to pass to the dialect specific implementation. See the documentation of the dialect in use for more information. .. versionadded:: 2.0
Return True if the backend has a schema with the given name. :param schema_name: name of the schema to check :param \**kw: Additional keyword argument to pass to the dialect specific implementation. See the documentation of the dialect in use for more information. .. versionadded:: 2.0
str
, schema: Optional[ str]
= None, **kw: Any
) -> bool
:
(source)
¶
Return True if the backend has a sequence with the given name. :param sequence_name: name of the sequence to check :param schema: schema name to query, if not the default schema. :param \**kw: Additional keyword argument to pass to the dialect specific implementation. See the documentation of the dialect in use for more information. .. versionadded:: 1.4
Return True if the backend has a table, view, or temporary table of the given name. :param table_name: name of the table to check :param schema: schema name to query, if not the default schema. :param \**kw: Additional keyword argument to pass to the dialect specific implementation. See the documentation of the dialect in use for more information. .. versionadded:: 1.4 - the :meth:`.Inspector.has_table` method replaces the :meth:`_engine.Engine.has_table` method. .. versionchanged:: 2.0:: :meth:`.Inspector.has_table` now formally supports checking for additional table-like objects: * any type of views (plain or materialized) * temporary tables of any kind Previously, these two checks were not formally specified and different dialects would vary in their behavior. The dialect testing suite now includes tests for all of these object types and should be supported by all SQLAlchemy-included dialects. Support among third party dialects may be lagging, however.
sa_schema.Table
, include_columns: Optional[ Collection[ str]]
, exclude_columns: Collection[ str]
= (), resolve_fks: bool
= True, _extend_on: Optional[ Set[ sa_schema.Table]]
= None, _reflect_info: Optional[ _ReflectionInfo]
= None):
(source)
¶
Given a :class:`_schema.Table` object, load its internal constructs based on introspection. This is the underlying method used by most dialects to produce table reflection. Direct usage is like:: from sqlalchemy import create_engine, MetaData, Table from sqlalchemy import inspect engine = create_engine('...') meta = MetaData() user_table = Table('user', meta) insp = inspect(engine) insp.reflect_table(user_table, None) .. versionchanged:: 1.4 Renamed from ``reflecttable`` to ``reflect_table`` :param table: a :class:`~sqlalchemy.schema.Table` instance. :param include_columns: a list of string column names to include in the reflection process. If ``None``, all columns are reflected.
Collection[ Optional[ str]]
= (Any
) -> List[ Tuple[ Optional[ Tuple[ Optional[ str], str]], List[ Tuple[ Tuple[ Optional[ str], str], Optional[ str]]]]]
:
(source)
¶
Return dependency-sorted table and foreign key constraint names referred to within multiple schemas. This method may be compared to :meth:`.Inspector.get_sorted_table_and_fkc_names`, which works on one schema at a time; here, the method is a generalization that will consider multiple schemas at once including that it will resolve for cross-schema foreign keys. .. versionadded:: 2.0
Return the default schema name presented by the dialect for the current engine's database user. E.g. this is typically ``public`` for PostgreSQL and ``dbo`` for SQL Server.
def _construct(cls, init:
Callable[ ..., Any]
, bind: Union[ Engine, Connection]
) -> Inspector
:
(source)
¶
Undocumented
Optional[ str]
= None, filter_names: Optional[ Collection[ str]]
= None, available: Optional[ Collection[ str]]
= None, _reflect_info: Optional[ _ReflectionInfo]
= None, **kw: Any
) -> _ReflectionInfo
:
(source)
¶
Undocumented
def _inspection_context(self) ->
Generator[ Inspector, None, None]
:
(source)
¶
Return an :class:`_reflection.Inspector` from this one that will run all operations on a single connection.
def _operation_context(self) ->
Generator[ Connection, None, None]
:
(source)
¶
Return a context that optimizes for multiple operations on a single transaction. This essentially allows connect()/close() to be called if we detected that we're against an :class:`_engine.Engine` and not a :class:`_engine.Connection`.
_ReflectionInfo
, table_key: TableKey
, table: sa_schema.Table
, cols_by_orig_name: Dict[ str, sa_schema.Column[ Any]]
, include_columns: Optional[ Collection[ str]]
, exclude_columns: Collection[ str]
, reflection_options: Dict[ str, Any]
):
(source)
¶
Undocumented
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]]
):
(source)
¶
Undocumented
_ReflectionInfo
, table_key: TableKey
, table: sa_schema.Table
, cols_by_orig_name: Dict[ str, sa_schema.Column[ Any]]
, include_columns: Optional[ Collection[ str]]
, exclude_columns: Collection[ str]
, resolve_fks: bool
, _extend_on: Optional[ Set[ sa_schema.Table]]
, reflection_options: Dict[ str, Any]
):
(source)
¶
Undocumented
_ReflectionInfo
, table_key: TableKey
, table: sa_schema.Table
, cols_by_orig_name: Dict[ str, sa_schema.Column[ Any]]
, include_columns: Optional[ Collection[ str]]
, exclude_columns: Collection[ str]
, reflection_options: Dict[ str, Any]
):
(source)
¶
Undocumented
_ReflectionInfo
, table_key: TableKey
, table: sa_schema.Table
, cols_by_orig_name: Dict[ str, sa_schema.Column[ Any]]
, exclude_columns: Collection[ str]
):
(source)
¶
Undocumented
_ReflectionInfo
, table_key: TableKey
, table: sa_schema.Table
, reflection_options: Dict[ str, Any]
):
(source)
¶
Undocumented
_ReflectionInfo
, table_key: TableKey
, table: sa_schema.Table
, cols_by_orig_name: Dict[ str, sa_schema.Column[ Any]]
, include_columns: Optional[ Collection[ str]]
, exclude_columns: Collection[ str]
, reflection_options: Dict[ str, Any]
):
(source)
¶
Undocumented