Skip to content

Commit

Permalink
chore(polars): add database arg, for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
deepyaman committed Dec 8, 2024
1 parent 5daddaf commit eda3d92
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions ibis/backends/polars/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,13 @@ def version(self) -> str:
def list_tables(self, like=None, database=None):
return self._filter_with_like(list(self._tables.keys()), like)

def table(self, name: str) -> ir.Table:
def table(self, name: str, database: None = None) -> ir.Table:
if database is not None:
raise com.IbisError(
"Passing `database` to the Polars backend's `table()` method is not "
"supported: Polars cannot set a database."
)

table = self._tables.get(name)
if table is None:
raise com.TableNotFound(name)
Expand Down Expand Up @@ -390,19 +396,20 @@ def create_table(
) -> ir.Table:
if database is not None:
raise com.IbisError(
"Passing `database` to the Polars backend create_table method has no "
"effect: Polars cannot set a database."
"Passing `database` to the Polars backend's `create_table()` method is "
"not supported: Polars cannot set a database."
)

if temp is False:
raise com.IbisError(
"Passing `temp=False` to the Polars backend create_table method is not "
"supported: all tables are in memory and temporary."
"Passing `temp=False` to the Polars backend's `create_table()` method "
"is not supported: all tables are in memory and temporary."
)

if not overwrite and name in self._tables:
raise com.IntegrityError(
f"Table {name} already exists. Use overwrite=True to clobber existing tables"
f"Table {name!r} already exists. Use `overwrite=True` to clobber "
"existing tables."
)

if schema is not None and obj is None:
Expand Down

0 comments on commit eda3d92

Please sign in to comment.