MCPcopy
hub / github.com/dask/dask / test_shuffle_after_read_sql

Function test_shuffle_after_read_sql

dask/dataframe/dask_expr/io/tests/test_sql.py:15–41  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13
14
15def test_shuffle_after_read_sql():
16 with tmpfile() as f:
17 uri = f"sqlite:///{f}"
18
19 df = pd.DataFrame(
20 {
21 "id": [1, 2, 3, 4, 5, 6, 7, 8],
22 "value": [
23 "value1",
24 "value2",
25 "value3",
26 "value3",
27 "value4",
28 "value4",
29 "value4",
30 "value5",
31 ],
32 }
33 ).set_index("id")
34 ddf = from_pandas(df, npartitions=1)
35
36 ddf.to_sql("test_table", uri, if_exists="append")
37 result = read_sql_table("test_table", con=uri, index_col="id")
38 assert_eq(
39 result["value"].unique(), pd.Series(df["value"].unique(), name="value")
40 )
41 assert_eq(result.shuffle(on_index=True), df)

Callers

nothing calls this directly

Calls 8

tmpfileFunction · 0.90
from_pandasFunction · 0.90
read_sql_tableFunction · 0.90
assert_eqFunction · 0.90
set_indexMethod · 0.80
to_sqlMethod · 0.80
uniqueMethod · 0.45
shuffleMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…