Go wrapper for DuckDB CLI
- Doesn't require CGO.
- Requires duckdb cli to be in the path.
db := NewInMemoryDB()
commands := []string{
"CREATE TABLE t1 (i INTEGER, j INTEGER);",
"INSERT INTO t1 VALUES (1, 5);",
"SELECT * from t1;",
}
res, err := db.RunCommands(commands)
db := NewDuckDB("foo")
commands := []string{
"CREATE TABLE t1 (i INTEGER, j INTEGER);",
"INSERT INTO t1 VALUES (1, 5);",
}
_, err := db.RunCommands(commands)
res, err := db.Query("SELECT * from t1;")
- Allows querying dataframes using SQL, with all the aggregate/window/analytics functions from DuckDB.
db := NewInMemoryDB()
var values = []string{"test"}
frame := data.NewFrame("foo", data.NewField("value", nil, values))
frame.RefID = "foo"
frames := []*data.Frame{frame}
res, err := db.QueryFrames("foo", "select * from foo", frames)