From: jonathan vanasco Date: Wed, 2 Dec 2020 19:42:02 +0000 (-0500) Subject: update docs that reference the deprecated `from_engine` inspection X-Git-Tag: rel_1_4_0b2~116^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8cb1e372fc8711069220182b75a31647dd51e3cb;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git update docs that reference the deprecated `from_engine` inspection Change-Id: I8db8752722f3ac7c410b39970224204caa9d4b72 --- diff --git a/doc/build/core/reflection.rst b/doc/build/core/reflection.rst index c320478a03..b95d3e44a5 100644 --- a/doc/build/core/reflection.rst +++ b/doc/build/core/reflection.rst @@ -131,9 +131,9 @@ lists of schema, table, column, and constraint descriptions from a given database is also available. This is known as the "Inspector":: from sqlalchemy import create_engine - from sqlalchemy.engine import reflection + from sqlalchemy import inspect engine = create_engine('...') - insp = reflection.Inspector.from_engine(engine) + insp = inspect(engine) print(insp.get_table_names()) .. autoclass:: sqlalchemy.engine.reflection.Inspector diff --git a/lib/sqlalchemy/engine/reflection.py b/lib/sqlalchemy/engine/reflection.py index 142637693f..c5d66081a1 100644 --- a/lib/sqlalchemy/engine/reflection.py +++ b/lib/sqlalchemy/engine/reflection.py @@ -712,12 +712,12 @@ class Inspector(object): table reflection. Direct usage is like:: from sqlalchemy import create_engine, MetaData, Table - from sqlalchemy.engine.reflection import Inspector + from sqlalchemy import inspect engine = create_engine('...') meta = MetaData() user_table = Table('user', meta) - insp = Inspector.from_engine(engine) + insp = inspect(engine) insp.reflect_table(user_table, None) .. versionchanged:: 1.4 Renamed from ``reflecttable`` to diff --git a/lib/sqlalchemy/inspection.py b/lib/sqlalchemy/inspection.py index 4d9ee30c44..69b160ce70 100644 --- a/lib/sqlalchemy/inspection.py +++ b/lib/sqlalchemy/inspection.py @@ -20,7 +20,7 @@ cases it will return the object itself. The rationale for :func:`_sa.inspect` is twofold. One is that it replaces the need to be aware of a large variety of "information getting" functions in SQLAlchemy, such as -:meth:`_reflection.Inspector.from_engine`, +:meth:`_reflection.Inspector.from_engine` (deprecated in 1.4), :func:`.orm.attributes.instance_state`, :func:`_orm.class_mapper`, and others. The other is that the return value of :func:`_sa.inspect` is guaranteed to obey a documented API, thus allowing third party