From 93b7767d00267ebe149cabcae7246b6796352eb8 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 2 Feb 2020 13:24:40 -0500 Subject: Deprecate connection branching The :meth:`.Connection.connect` method is deprecated as is the concept of "connection branching", which copies a :class:`.Connection` into a new one that has a no-op ".close()" method. This pattern is oriented around the "connectionless execution" concept which is also being removed in 2.0. As part of this change we begin to move the internals away from "connectionless execution" overall. Remove the "connectionless execution" concept from the reflection internals and replace with explicit patterns at the Inspector level. Fixes: #5131 Change-Id: Id23d28a9889212ac5ae7329b85136157815d3e6f --- lib/sqlalchemy/sql/schema.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib/sqlalchemy/sql') diff --git a/lib/sqlalchemy/sql/schema.py b/lib/sqlalchemy/sql/schema.py index 9f66321fe..79a700ad8 100644 --- a/lib/sqlalchemy/sql/schema.py +++ b/lib/sqlalchemy/sql/schema.py @@ -4095,9 +4095,7 @@ class MetaData(SchemaItem): if bind is None: bind = _bind_or_error(self) - with bind.connect() as conn: - insp = inspection.inspect(conn) - + with inspection.inspect(bind)._inspection_context() as insp: reflect_opts = { "autoload_with": insp, "extend_existing": extend_existing, -- cgit v1.2.1