MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / get_table_names

Method get_table_names

lib/sqlalchemy/dialects/mysql/base.py:3220–3240  ·  view source on GitHub ↗

Return a Unicode SHOW TABLES from a given schema.

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

Source from the content-addressed store, hash-verified

3218
3219 @reflection.cache
3220 def get_table_names(
3221 self, connection: Connection, schema: Optional[str] = None, **kw: Any
3222 ) -> list[str]:
3223 """Return a Unicode SHOW TABLES from a given schema."""
3224 if schema is not None:
3225 current_schema: str = schema
3226 else:
3227 current_schema = self.default_schema_name # type: ignore
3228
3229 charset = self._connection_charset
3230
3231 rp = connection.exec_driver_sql(
3232 "SHOW FULL TABLES FROM %s"
3233 % self.identifier_preparer.quote_identifier(current_schema)
3234 )
3235
3236 return [
3237 row[0]
3238 for row in self._compat_fetchall(rp, charset=charset)
3239 if row[1] == "BASE TABLE"
3240 ]
3241
3242 @reflection.cache
3243 def get_view_names(

Callers

nothing calls this directly

Calls 3

_compat_fetchallMethod · 0.95
quote_identifierMethod · 0.80
exec_driver_sqlMethod · 0.45

Tested by

no test coverage detected