Skip to content

Commit

Permalink
feat(pandas): support connect() with no arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrist authored and cpcloud committed Jan 24, 2023
1 parent 65e65c1 commit 78cbbdd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
6 changes: 3 additions & 3 deletions ibis/backends/pandas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ class Options(ibis.config.Config):

def do_connect(
self,
dictionary: MutableMapping[str, pd.DataFrame],
dictionary: MutableMapping[str, pd.DataFrame] | None = None,
) -> None:
"""Construct a client from a dictionary of pandas DataFrames.
Parameters
----------
dictionary
Mutable mapping of string table names to pandas DataFrames.
An optional mapping of string table names to pandas DataFrames.
Examples
--------
Expand All @@ -51,7 +51,7 @@ def do_connect(
# register dispatchers
from ibis.backends.pandas import execution, udf # noqa: F401

self.dictionary = dictionary
self.dictionary = dictionary or {}
self.schemas: MutableMapping[str, sch.Schema] = {}

def from_dataframe(
Expand Down
5 changes: 5 additions & 0 deletions ibis/backends/pandas/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ def test_data():
return test_data


def test_connect_no_args():
con = ibis.pandas.connect()
assert dict(con.tables) == {}


def test_client_table(table):
assert isinstance(table.op(), ibis.expr.operations.DatabaseTable)
assert isinstance(table.op(), PandasTable)
Expand Down
2 changes: 1 addition & 1 deletion ibis/backends/polars/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def do_connect(
Parameters
----------
tables
Mutable mapping of string table names to polars LazyFrames.
An optional mapping of string table names to polars LazyFrames.
"""
if not tables:
tables = {}
Expand Down

0 comments on commit 78cbbdd

Please sign in to comment.