Skip to content

Commit 579f5e7

Browse files
authored
feat: add test of ExecuteQuery with bind parameters (#17)
1 parent 19a8a68 commit 579f5e7

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

adbc_drivers_validation/tests/statement.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,24 @@ def generate_tests(quirks: model.DriverQuirks, metafunc) -> None:
6262

6363

6464
class TestStatement:
65+
def test_parameter_execute(
66+
self,
67+
driver: model.DriverQuirks,
68+
conn: adbc_driver_manager.dbapi.Connection,
69+
) -> None:
70+
# N.B. no need to test execute_update since the regular bind tests
71+
# cover that
72+
parameters = pyarrow.RecordBatch.from_pydict({"0": [1, 2, 3, 4]})
73+
with conn.cursor() as cursor:
74+
cursor.adbc_statement.set_sql_query(
75+
f"SELECT 1 + {driver.bind_parameter(1)}"
76+
)
77+
cursor.adbc_statement.bind(parameters)
78+
cursor.adbc_statement.prepare()
79+
handle, _ = cursor.adbc_statement.execute_query()
80+
result = pyarrow.RecordBatchReader._import_from_c(handle.address).read_all()
81+
assert result[0].to_pylist() == [2, 3, 4, 5]
82+
6583
def test_parameter_schema(
6684
self, driver: model.DriverQuirks, conn: adbc_driver_manager.dbapi.Connection
6785
) -> None:

0 commit comments

Comments
 (0)