MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / from_engine

Method from_engine

lib/sqlalchemy/engine/reflection.py:293–310  ·  view source on GitHub ↗

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:`_reflect

(cls, bind: Engine)

Source from the content-addressed store, hash-verified

291 "acquire an :class:`_reflection.Inspector`.",
292 )
293 def from_engine(cls, bind: Engine) -> Inspector:
294 """Construct a new dialect-specific Inspector object from the given
295 engine or connection.
296
297 :param bind: a :class:`~sqlalchemy.engine.Connection`
298 or :class:`~sqlalchemy.engine.Engine`.
299
300 This method differs from direct a direct constructor call of
301 :class:`_reflection.Inspector` in that the
302 :class:`~sqlalchemy.engine.interfaces.Dialect` is given a chance to
303 provide a dialect-specific :class:`_reflection.Inspector` instance,
304 which may
305 provide additional methods.
306
307 See the example at :class:`_reflection.Inspector`.
308
309 """
310 return cls._construct(cls._init_legacy, bind)
311
312 @inspection._inspects(Engine)
313 def _engine_insp(bind: Engine) -> Inspector: # type: ignore[misc]

Callers 1

Calls 1

_constructMethod · 0.45

Tested by 1