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

Method has_table

lib/sqlalchemy/engine/interfaces.py:1875–1914  ·  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

1873 raise NotImplementedError()
1874
1875 def has_table(
1876 self,
1877 connection: Connection,
1878 table_name: str,
1879 schema: Optional[str] = None,
1880 **kw: Any,
1881 ) -> bool:
1882 """For internal dialect use, check the existence of a particular table
1883 or view in the database.
1884
1885 Given a :class:`_engine.Connection` object, a string table_name and
1886 optional schema name, return True if the given table exists in the
1887 database, False otherwise.
1888
1889 This method serves as the underlying implementation of the
1890 public facing :meth:`.Inspector.has_table` method, and is also used
1891 internally to implement the "checkfirst" behavior for methods like
1892 :meth:`_schema.Table.create` and :meth:`_schema.MetaData.create_all`.
1893
1894 .. note:: This method is used internally by SQLAlchemy, and is
1895 published so that third-party dialects may provide an
1896 implementation. It is **not** the public API for checking for table
1897 presence. Please use the :meth:`.Inspector.has_table` method.
1898
1899 .. versionchanged:: 2.0:: :meth:`_engine.Dialect.has_table` now
1900 formally supports checking for additional table-like objects:
1901
1902 * any type of views (plain or materialized)
1903 * temporary tables of any kind
1904
1905 Previously, these two checks were not formally specified and
1906 different dialects would vary in their behavior. The dialect
1907 testing suite now includes tests for all of these object types,
1908 and dialects to the degree that the backing database supports views
1909 or temporary tables should seek to support locating these objects
1910 for full compliance.
1911
1912 """
1913
1914 raise NotImplementedError()
1915
1916 def has_index(
1917 self,

Calls

no outgoing calls