Spaces:
Sleeping
Sleeping
File size: 529 Bytes
570f7bd c1bc4eb 570f7bd c1bc4eb 570f7bd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
from nl2sql.executor import Executor
from adapters.db.sqlite_adapter import SQLiteAdapter
def test_executor_runs_select(tmp_path):
db_path = tmp_path / "test.db"
import sqlite3
conn = sqlite3.connect(db_path)
conn.execute("CREATE TABLE users(id INT, name TEXT);")
conn.execute("INSERT INTO users VALUES (1, 'Alice');")
conn.commit()
conn.close()
ex = Executor(SQLiteAdapter(str(db_path)))
res = ex.run("SELECT * FROM users;")
assert res.ok
assert res.data["rows"][0][1] == "Alice"
|