go-duckdb
go-duckdb copied to clipboard
transaction.go:6:5: undefined: conn
Hi All,
I am new to duckdb, and started testing in Windows and also on Ubuntu environment it doesn't open a connection and shows
github.com/marcboeker/go-duckdb
../../../../../go/pkg/mod/github.com/marcboeker/[email protected]/transaction.go:6:5: undefined: conn
Code examples that fails to run:
package main
import (
"database/sql"
"fmt"
_ "github.com/marcboeker/go-duckdb"
)
func main() {
db, _ := sql.Open("duckdb", "")
db.Exec(`CREATE TABLE person (id INTEGER, name VARCHAR)`)
db.Exec(`INSERT INTO person VALUES (42, 'John')`)
var (
id int
name string
)
row := db.QueryRow(`SELECT id, name FROM person`)
_ = row.Scan(&id, &name)
fmt.Println("id:", id, "name:", name)
}
Any help regarding this!?
As an FYI, I believe Windows is not currently officially supported according to these threads:
https://github.com/marcboeker/go-duckdb/issues/141 https://github.com/marcboeker/go-duckdb/issues/136
However, at least for this issue, I receive the same error on MacOS 14.4.1 Arm: github.com/marcboeker/[email protected]/transaction.go:6:5: undefined: conn
I tried both 1.6.1 and 1.6.2.
@element-of-surprise
I was able to fix it today using Linking DuckDB which is in the documentation only for Linux, but not the statically link into db
!
However, at least for this issue, I receive the same error on MacOS 14.4.1 Arm: github.com/marcboeker/[email protected]/transaction.go:6:5: undefined: conn
@element-of-surprise That's weird. I've tested it with 1.6.2 just now and it works on a M3 with 14.4.1. Could you please manually check out the go-duckdb repo and run make test
and make examples
? This should work too. Otherwise please post the error message you receive.
Hello, I have the similar issue in Debian 11 docker, but not on my Arch Linux.
# github.com/marcboeker/go-duckdb
/root/go/pkg/mod/github.com/marcboeker/[email protected]/transaction.go:6:5: undefined: conn
Installing build-essential
and running make
and make test
in /root/go/pkg/mod/github.com/marcboeker/[email protected]/
folder fixed it for me.
it works fine for mac,but not on linux GOOS=linux GOARCH=arm64 go build ../../../pkg/mod/github.com/marcboeker/[email protected]/transaction.go:6:5: undefined: conn
I get the same error when building in WSL 2 Ubuntu 22.04
I get the same error when building in WSL 2 Ubuntu 22.04
oh I actually had forgotten to set CGO_ENABLED=1 as instructed in the README, once I changed this, the build worked
oh I actually had forgotten to set CGO_ENABLED=1 as instructed in the README, once I changed this, the build worked
Yup! I think this can be closed. CGO_ENABLED=1
must be enabled when using this.