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

Function test_query

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

Source from the content-addressed store, hash-verified

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