MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / has_table

Method has_table

lib/sqlalchemy/engine/reflection.py:411–442  ·  view source on GitHub ↗

r"""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

(
        self, table_name: str, schema: Optional[str] = None, **kw: Any
    )

Source from the content-addressed store, hash-verified

409 )
410
411 def has_table(
412 self, table_name: str, schema: Optional[str] = None, **kw: Any
413 ) -> bool:
414 r"""Return True if the backend has a table, view, or temporary
415 table of the given name.
416
417 :param table_name: name of the table to check
418 :param schema: schema name to query, if not the default schema.
419 :param \**kw: Additional keyword argument to pass to the dialect
420 specific implementation. See the documentation of the dialect
421 in use for more information.
422
423 .. versionadded:: 1.4 - the :meth:`.Inspector.has_table` method
424 replaces the :meth:`_engine.Engine.has_table` method.
425
426 .. versionchanged:: 2.0:: :meth:`.Inspector.has_table` now formally
427 supports checking for additional table-like objects:
428
429 * any type of views (plain or materialized)
430 * temporary tables of any kind
431
432 Previously, these two checks were not formally specified and
433 different dialects would vary in their behavior. The dialect
434 testing suite now includes tests for all of these object types
435 and should be supported by all SQLAlchemy-included dialects.
436 Support among third party dialects may be lagging, however.
437
438 """
439 with self._operation_context() as conn:
440 return self.dialect.has_table(
441 conn, table_name, schema, info_cache=self.info_cache, **kw
442 )
443
444 def has_sequence(
445 self, sequence_name: str, schema: Optional[str] = None, **kw: Any

Callers 1

reflect_tableMethod · 0.95

Calls 1

_operation_contextMethod · 0.95

Tested by

no test coverage detected