MCPcopy Index your code
hub / github.com/dask/dask / test_empty

Function test_empty

dask/dataframe/io/tests/test_sql.py:43–63  ·  view source on GitHub ↗
(db)

Source from the content-addressed store, hash-verified

41
42
43def test_empty(db):
44 from sqlalchemy import Column, Integer, MetaData, Table, create_engine
45
46 with tmpfile() as f:
47 uri = f"sqlite:///{f}"
48 metadata = MetaData()
49 engine = create_engine(uri)
50 table = Table(
51 "empty_table",
52 metadata,
53 Column("id", Integer, primary_key=True),
54 Column("col2", Integer),
55 )
56 metadata.create_all(engine)
57
58 dask_df = read_sql_table(table.name, uri, index_col="id", npartitions=1)
59 assert dask_df.index.name == "id"
60 # The dtype of the empty result might no longer be as expected
61 # assert dask_df.col2.dtype == np.dtype("int64")
62 pd_dataframe = dask_df.compute()
63 assert pd_dataframe.empty is True
64
65
66@pytest.mark.filterwarnings(

Callers

nothing calls this directly

Calls 3

tmpfileFunction · 0.90
read_sql_tableFunction · 0.90
computeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…