diff --git a/ibis/backends/polars/__init__.py b/ibis/backends/polars/__init__.py index d2620b9d9e0d..4ce9ce7c5359 100644 --- a/ibis/backends/polars/__init__.py +++ b/ibis/backends/polars/__init__.py @@ -383,6 +383,27 @@ def create_table( self._add_table(name, obj) return self.table(name) + def create_view( + self, + name: str, + obj: ir.Table, + *, + database: str | None = None, + overwrite: bool = False, + ) -> ir.Table: + return self.create_table( + name, obj=obj, temp=None, database=database, overwrite=overwrite + ) + + def drop_table(self, name: str, *, force: bool = False) -> None: + if name in self._tables: + del self._tables[name] + elif not force: + raise com.IbisError(f"Table {name!r} does not exist") + + def drop_view(self, name: str, *, force: bool = False) -> None: + self.drop_table(name, force=force) + def get_schema(self, table_name): return self._tables[table_name].schema @@ -532,12 +553,3 @@ def _load_into_cache(self, name, expr): def _clean_up_cached_table(self, op): self._remove_table(op.name) - - def create_view(self, *_, **__) -> ir.Table: - raise NotImplementedError(self.name) - - def drop_table(self, *_, **__) -> ir.Table: - raise NotImplementedError(self.name) - - def drop_view(self, *_, **__) -> ir.Table: - raise NotImplementedError(self.name) diff --git a/ibis/backends/tests/test_client.py b/ibis/backends/tests/test_client.py index 0ec3edff5a36..bba0f64de98d 100644 --- a/ibis/backends/tests/test_client.py +++ b/ibis/backends/tests/test_client.py @@ -391,7 +391,7 @@ def test_nullable_input_output(con, temp_table): assert t.schema().types[2].nullable -@mark.notimpl(["druid", "polars"]) +@mark.notimpl(["druid"]) def test_create_drop_view(ddl_con, temp_view): # setup table_name = "functional_alltypes" @@ -1392,11 +1392,6 @@ def gen_test_name(con: BaseBackend): con.drop_table(name, force=True) -@mark.notimpl( - ["polars"], - raises=NotImplementedError, - reason="overwriting not implemented in ibis for this backend", -) @mark.broken( ["druid"], raises=NotImplementedError, reason="generated SQL fails to parse" )