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

Method get_table_names

lib/sqlalchemy/dialects/mysql/base.py:3271–3291  ·  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

3269
3270 @reflection.cache
3271 def get_table_names(
3272 self, connection: Connection, schema: Optional[str] = None, **kw: Any
3273 ) -> List[str]:
3274 """Return a Unicode SHOW TABLES from a given schema."""
3275 if schema is not None:
3276 current_schema: str = schema
3277 else:
3278 current_schema = self.default_schema_name # type: ignore
3279
3280 charset = self._connection_charset
3281
3282 rp = connection.exec_driver_sql(
3283 "SHOW FULL TABLES FROM %s"
3284 % self.identifier_preparer.quote_identifier(current_schema)
3285 )
3286
3287 return [
3288 row[0]
3289 for row in self._compat_fetchall(rp, charset=charset)
3290 if row[1] == "BASE TABLE"
3291 ]
3292
3293 @reflection.cache
3294 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