Skip to content

Commit

Permalink
fix(polars): use drop_table when cleaning the cache and remove dupl…
Browse files Browse the repository at this point in the history
…icated `_remove_table` method
  • Loading branch information
cpcloud committed Aug 26, 2024
1 parent 91141cf commit d6e6e10
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions ibis/backends/polars/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,6 @@ def _add_table(self, name: str, obj: pl.LazyFrame | pl.DataFrame) -> None:
self._tables[name] = obj
self._context.register(name, obj)

def _remove_table(self, name: str) -> None:
del self._tables[name]
self._context.unregister(name)

def sql(
self, query: str, schema: sch.Schema | None = None, dialect: str | None = None
) -> ir.Table:
Expand Down Expand Up @@ -407,6 +403,7 @@ def create_view(
def drop_table(self, name: str, *, force: bool = False) -> None:
if name in self._tables:
del self._tables[name]
self._context.unregister(name)
elif not force:
raise com.IbisError(f"Table {name!r} does not exist")

Expand Down Expand Up @@ -559,7 +556,7 @@ def _load_into_cache(self, name, expr):
self.create_table(name, self.compile(expr).cache())

def _clean_up_cached_table(self, name):
self._remove_table(name)
self.drop_table(name, force=True)


@lazy_singledispatch
Expand Down

0 comments on commit d6e6e10

Please sign in to comment.