Sends SQL code to a running DuckDB CLI process and captures the output using a sentinel-based detection mechanism.
Arguments
- session
A
processx::processobject (a running DuckDB CLI session).- code
Character. SQL code to execute.
- timeout
Integer. Maximum milliseconds to wait for output. An error is thrown if the command does not complete within this time.
Examples
s = duckknit_start_session("demo")
result = duckknit_exec(s, "SELECT 1 + 1 AS two;")
cat(result$stdout)
#> ┌───────┐
#> │ two │
#> │ int32 │
#> ├───────┤
#> │ 2 │
#> └───────┘
duckknit_kill_session("demo")
