Ir para o conteúdo

schema

module wittgenstein_sql_runner.schema

Physical schema discovery — list of tables that exist in the database.

Functions

wittgenstein_sql_runner.schema.discover_db_tables

discover_db_tables(pg_dsn: str, schema: str = 'public') → set[str]

Return the set of base table names in the given schema.

Queries information_schema.tables with table_type='BASE TABLE' to exclude views and materialized views.

Parameters

  • pg_dsn : str — psycopg2-compatible DSN, e.g. 'postgresql://user:pass@host:port/dbname'

  • schema : str — PostgreSQL schema to inspect (default 'public').

Returns

  • set[str] — Set of table name strings.