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

Function test_query

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

Source from the content-addressed store, hash-verified

391
392
393def test_query(db):
394 import sqlalchemy as sa
395 from sqlalchemy import sql
396
397 s1 = sql.select(sql.column("number"), sql.column("name")).select_from(
398 sql.table("test")
399 )
400 out = read_sql_query(s1, db, npartitions=2, index_col="number")
401 assert_eq(out, df[["name"]])
402
403 s2 = (
404 sql.select(
405 sa.cast(sql.column("number"), sa.types.BigInteger).label("number"),
406 sql.column("name"),
407 )
408 .where(sql.column("number") >= 5)
409 .select_from(sql.table("test"))
410 )
411
412 out = read_sql_query(s2, db, npartitions=2, index_col="number")
413 assert_eq(out, df.loc[5:, ["name"]])
414
415
416def test_query_index_from_query(db):

Callers

nothing calls this directly

Calls 3

read_sql_queryFunction · 0.90
assert_eqFunction · 0.90
whereMethod · 0.45

Tested by

no test coverage detected