Skip to content

Commit

Permalink
refactor(postgres): deprecate database for schema in list_tables
Browse files Browse the repository at this point in the history
  • Loading branch information
gforsyth authored and cpcloud committed Oct 22, 2023
1 parent 3e0f0fa commit d622730
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions ibis/backends/postgres/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,37 @@ def connect(dbapi_connection, connection_record):

super().do_connect(engine)

def list_tables(self, like=None, database=None, schema=None):
"""List the tables in the database.
Parameters
----------
like
A pattern to use for listing tables.
database
(deprecated) The database to perform the list against.
schema
The schema to perform the list against.
::: {.callout-warning}
## `schema` refers to database hierarchy
The `schema` parameter does **not** refer to the column names and
types of `table`.
:::
"""
if database is not None:
util.warn_deprecated(
"database",
instead="Use the `schema` keyword argument instead",
as_of="7.1",
removed_in="8.0",
)
schema = schema or database
tables = self.inspector.get_table_names(schema=schema)
views = self.inspector.get_view_names(schema=schema)
return self._filter_with_like(tables + views, like)

def list_databases(self, like=None) -> list[str]:
# http://dba.stackexchange.com/a/1304/58517
dbs = sa.table(
Expand Down

0 comments on commit d622730

Please sign in to comment.