MCPcopy Create free account
hub / github.com/dask/dask / test_query_with_meta

Function test_query_with_meta

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

Source from the content-addressed store, hash-verified

431
432
433def test_query_with_meta(db):
434 from sqlalchemy import sql
435
436 data = {
437 "name": pd.Series([], name="name", dtype="str"),
438 "age": pd.Series([], name="age", dtype="int"),
439 }
440 index = pd.Index([], name="number", dtype="int")
441 meta = pd.DataFrame(data, index=index)
442
443 s1 = sql.select(
444 sql.column("number"), sql.column("name"), sql.column("age")
445 ).select_from(sql.table("test"))
446 out = read_sql_query(s1, db, npartitions=2, index_col="number", meta=meta)
447 # Don't check dtype for windows https://github.com/dask/dask/issues/8620
448 assert_eq(out, df[["name", "age"]], check_dtype=sys.platform != "win32")
449
450
451def test_read_sql_query_string_raises_error(db):

Callers

nothing calls this directly

Calls 2

read_sql_queryFunction · 0.90
assert_eqFunction · 0.90

Tested by

no test coverage detected