MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / has_table

Method has_table

lib/sqlalchemy/engine/interfaces.py:1844–1883  ·  view source on GitHub ↗

For internal dialect use, check the existence of a particular table or view in the database. Given a :class:`_engine.Connection` object, a string table_name and optional schema name, return True if the given table exists in the database, False otherwise. Thi

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

Source from the content-addressed store, hash-verified

1842 raise NotImplementedError()
1843
1844 def has_table(
1845 self,
1846 connection: Connection,
1847 table_name: str,
1848 schema: Optional[str] = None,
1849 **kw: Any,
1850 ) -> bool:
1851 """For internal dialect use, check the existence of a particular table
1852 or view in the database.
1853
1854 Given a :class:`_engine.Connection` object, a string table_name and
1855 optional schema name, return True if the given table exists in the
1856 database, False otherwise.
1857
1858 This method serves as the underlying implementation of the
1859 public facing :meth:`.Inspector.has_table` method, and is also used
1860 internally to implement the "checkfirst" behavior for methods like
1861 :meth:`_schema.Table.create` and :meth:`_schema.MetaData.create_all`.
1862
1863 .. note:: This method is used internally by SQLAlchemy, and is
1864 published so that third-party dialects may provide an
1865 implementation. It is **not** the public API for checking for table
1866 presence. Please use the :meth:`.Inspector.has_table` method.
1867
1868 .. versionchanged:: 2.0:: :meth:`_engine.Dialect.has_table` now
1869 formally supports checking for additional table-like objects:
1870
1871 * any type of views (plain or materialized)
1872 * temporary tables of any kind
1873
1874 Previously, these two checks were not formally specified and
1875 different dialects would vary in their behavior. The dialect
1876 testing suite now includes tests for all of these object types,
1877 and dialects to the degree that the backing database supports views
1878 or temporary tables should seek to support locating these objects
1879 for full compliance.
1880
1881 """
1882
1883 raise NotImplementedError()
1884
1885 def has_index(
1886 self,

Callers 15

_can_create_tableMethod · 0.45
_can_drop_tableMethod · 0.45
has_indexMethod · 0.45
test_has_tableMethod · 0.45
test_has_table_cacheMethod · 0.45
test_has_table_schemaMethod · 0.45
test_has_table_viewMethod · 0.45

Calls

no outgoing calls