You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As far as we know, this is the only pure golang driver for Apache Impala that has TLS and LDAP support.
We at Bipp, want to make large scale data analytics accesible to every business user.
As part of that, we are commited to making this is a production grade driver that be used in serious enterprise scenarios in lieu of the ODBC/JDBC drivers.
Issues and contributions are welcome.
Using
package main
// Simple program to list databases and the tablesimport (
"context""fmt""log"
impala "github.com/bippio/go-impala"
)
funcmain() {
host:="<impala host>"port:=21000opts:=impala.DefaultOptions// enable LDAP authentication:opts.UseLDAP=trueopts.Username="<ldap username>"opts.Password="<ldap password>"// enable TLSopts.UseTLS=trueopts.CACertPath="/path/to/cacert"con, err:=impala.Connect(host, port, &opts)
iferr!=nil {
log.Fatal(err)
}
ctx:=context.Background()
varrows impala.RowSet// get all databases for the connection objectquery:=fmt.Sprintf("SHOW DATABASES")
rows, err=con.Query(ctx, query)
iferr!=nil {
log.Fatal("error in retriving databases: ", err)
}
databases:=make([]string, 0) // databases will contain all the DBs to enumerate laterfor {
row:=make(map[string]interface{})
err=rows.MapScan(row)
iferr!=nil {
log.Println(err)
continue
}
ifdb, ok:=row["name"].(string); ok {
databases=append(databases, db)
}
}
log.Println("List of Databases", databases)
for_, d:=rangedatabases {
q:="SHOW TABLES IN "+drows, err=con.Query(ctx, q)
iferr!=nil {
log.Printf("error in querying database %s: %s", d, err.Error())
continue
}
tables:=make([]string, 0) // databases will contain all the DBs to enumerate laterforrows.Next(ctx) {
row:=make(map[string]interface{})
err=rows.MapScan(row)
iferr!=nil {
log.Println(err)
continue
}
iftab, ok:=row["name"].(string); ok {
tables=append(tables, tab)
}
}
log.Printf("List of Tables in Database %s: %v\n", d, tables)
}
}