I am trying to load a SELECT database statement into a qframe DataFrame. Unfortunetely, I am getting errors due to NULL values in the database.
Does anyone know a workaround for this?
My code:
package main
import (
"database/sql"
"fmt"
_ "github.com/lib/pq"
"github.com/tobgu/qframe"
qsql "github.com/tobgu/qframe/config/sql"
)
func main() {
db, err := sql.Open("postgres", "postgres://login:password@url/db?sslmode=disable")
if err != nil {
panic(err)
}
defer db.Close()
tx, _ := db.Begin()
newQf := qframe.ReadSQL(tx,
// orcamento_id is the table being queried
qsql.Query("SELECT * FROM orcamento_item WHERE orcamento_id = 2"),
qsql.Postgres(),
)
fmt.Println(newQf)
tx.Commit()
}
I get the following error:
ReadSQL Scan: sql: Scan error on column index 5, name "item_ref_id": Column Null: non-nullable type: int
PS: I also dont know how to format very well this post, sorry...