postgres.schema.db_schema_tables

postgres.schema.db_schema_tables(
    schema,
    *,
    views=False,
    user=None,
    host=None,
    database=None,
    dbname=None,
    port=None,
)

Get a list of relations in a PostgreSQL schema.

Parameters

Name Type Description Default
schema str Name of the PostgreSQL schema to inspect. required
views bool If True, include views in addition to base tables. False
user str PostgreSQL user role. None
host str PostgreSQL host name. None
database str PostgreSQL database name. None
dbname str Alias for database. None
port int PostgreSQL port. None

Returns

Name Type Description
list[str] Sorted relation names in the requested schema.

Examples

>>> db_schema_tables("public")
>>> db_schema_tables("crsp", views=True, database="research")