Skip to content

Commit

Permalink
feat(dask): 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 78cbbdd commit 67eed42
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ibis/backends/dask/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ class Backend(BasePandasBackend):

def do_connect(
self,
dictionary: MutableMapping[str, dd.DataFrame],
dictionary: MutableMapping[str, dd.DataFrame] | None = None,
) -> None:
"""Construct a Dask backend client from a dictionary of data sources.
Parameters
----------
dictionary
Mapping from `str` table names to Dask DataFrames.
An optional mapping from `str` table names to Dask DataFrames.
Examples
--------
Expand All @@ -52,6 +52,9 @@ def do_connect(
# register dispatchers
from ibis.backends.dask import udf # noqa: F401

if dictionary is None:
dictionary = {}

for k, v in dictionary.items():
if not isinstance(v, (dd.DataFrame, pd.DataFrame)):
raise TypeError(
Expand Down
5 changes: 5 additions & 0 deletions ibis/backends/dask/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ def table(client):
return client.table('df')


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


def test_client_table(table):
assert isinstance(table.op(), ibis.expr.operations.DatabaseTable)
assert isinstance(table.op(), DaskTable)
Expand Down

0 comments on commit 67eed42

Please sign in to comment.