prestodb / presto-go-client

A Presto client for the Go programming language.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

can not insert into table

pashifika opened this issue · comments

CREATE TABLE test_dl (
userip STRING,
dmname STRING,
time STRING,
serverip STRING
)
STORED AS PARQUET
TBLPROPERTIES ("serialization.null.format"="")

insert SQL:

insert into test_dl
select
userip userip,
dmname dmname,
time time,
coalesce(serverip, '0.0.0.0') serverip
from tmp_1516270919359966300_rxu4khl0

code:

var i interface{}
err := db.QueryRow(sql).Scan(&i)
if err != nil {
return err
}
fmt.Println("info:", i)

run this program is success, but uesd presto-cli run sql "select count(*) from test_dl" rows count is 0?

In Go, the Query* commands are for reading data from a database, for example the result of a SELECT. In order to write data you have to use Exec* instead, but we don't support writing to presto in this driver yet.

Here: https://github.com/prestodb/presto-go-client/blob/master/presto/presto.go#L375

I'd be happy to review PRs to add support for Exec.

commented

It seems like the ability to write to a DB is a pretty crucial feature for a DB driver. Is there any plan to add this?

Or if not, does anyone know of an alternative golang SDK for using presto DB that has the ability to write?