]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
update docs that reference the deprecated `from_engine` inspection
authorjonathan vanasco <jonathan@2xlp.com>
Wed, 2 Dec 2020 19:42:02 +0000 (14:42 -0500)
committerjonathan vanasco <jonathan@2xlp.com>
Mon, 7 Dec 2020 17:37:18 +0000 (12:37 -0500)
Change-Id: I8db8752722f3ac7c410b39970224204caa9d4b72

doc/build/core/reflection.rst
lib/sqlalchemy/engine/reflection.py
lib/sqlalchemy/inspection.py

index c320478a032171a520388bd14de2be2c5c352676..b95d3e44a5e58dbcc9f9021f9ab707302656776f 100644 (file)
@@ -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
index 142637693f422ad7e3172172ca6220f59ff70dbc..c5d66081a16e0aa3ad5aef2f6aa980cc411c36a2 100644 (file)
@@ -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
index 4d9ee30c44fcaded93a8a8e9e794878d124c2371..69b160ce70a9feca0d16572f94716b091bd6b3da 100644 (file)
@@ -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