Skip to content

Commit

Permalink
fix(pandas, dask): fix drop_table handling of force keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrist committed Jul 2, 2024
1 parent f3cd8b2 commit 8a9535f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
10 changes: 5 additions & 5 deletions ibis/backends/pandas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,11 @@ def drop_view(self, name: str, *, force: bool = False) -> None:
self.drop_table(name, force=force)

def drop_table(self, name: str, *, force: bool = False) -> None:
if not force and name in self.dictionary:
raise com.IbisError(
"Cannot drop existing table. Call drop_table with force=True to drop existing table."
)
del self.dictionary[name]
try:
del self.dictionary[name]
except KeyError:
if not force:
raise com.IbisError(f"Table {name} does not exist") from None

def _convert_object(self, obj: Any) -> Any:
return _convert_object(obj, self)
Expand Down
4 changes: 1 addition & 3 deletions ibis/backends/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1024,9 +1024,7 @@ def test_create_table_in_memory(con, obj, table_name, monkeypatch):

assert result.equals(t.to_pyarrow())

with contextlib.suppress(NotImplementedError):
# polars doesn't have drop_table
con.drop_table(table_name, force=True)
con.drop_table(table_name, force=True)


def test_default_backend_option(con, monkeypatch):
Expand Down

0 comments on commit 8a9535f

Please sign in to comment.