MCPcopy
hub / github.com/ray-project/ray / test_write_sql_many_rows

Function test_write_sql_many_rows

python/ray/data/tests/datasource/test_sql.py:152–162  ·  view source on GitHub ↗
(num_blocks: int, temp_database: str)

Source from the content-addressed store, hash-verified

150
151@pytest.mark.parametrize("num_blocks", (1, 20))
152def test_write_sql_many_rows(num_blocks: int, temp_database: str):
153 connection = sqlite3.connect(temp_database)
154 connection.cursor().execute("CREATE TABLE test(id)")
155 dataset = ray.data.range(1000).repartition(num_blocks)
156
157 dataset.write_sql(
158 "INSERT INTO test VALUES(?)", lambda: sqlite3.connect(temp_database)
159 )
160
161 result = connection.cursor().execute("SELECT * FROM test ORDER BY id")
162 assert result.fetchall() == [(i,) for i in range(1000)]
163
164
165def test_write_sql_nonexistant_table(temp_database: str):

Callers

nothing calls this directly

Calls 5

write_sqlMethod · 0.80
rangeFunction · 0.50
connectMethod · 0.45
executeMethod · 0.45
repartitionMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…