A Presto client for the Go programming language.
Switch branches/tags
Nothing to show
Clone or download
BlueStalker and fiorix Add Kerberos Support
* Add Kerberos Support

* Update travis config

* Update https support with customer client
Latest commit c52a526 Dec 10, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
integration_tests Add copyright headers Oct 17, 2018
presto Add Kerberos Support Dec 10, 2018
.travis.yml Add Kerberos Support Dec 10, 2018
CODE_OF_CONDUCT.md Add code of conduct file Oct 17, 2018
CONTRIBUTING.md Add contribution docs Oct 10, 2017
LICENSE Add license file Oct 10, 2017
README.md fix go get path in README Jun 4, 2018


Presto client

A Presto client for the Go programming language.

Build Status GoDoc


  • Native Go implementation
  • Connections over HTTP or HTTPS
  • Basic auth
  • Support custom HTTP client (tunable conn pools, timeouts, TLS)
  • Supports conversion from Presto to native Go data types
    • string, sql.NullString
    • int64, presto.NullInt64
    • float64, presto.NullFloat64
    • map, presto.NullMap
    • time.Time, presto.NullTime
    • Up to 3-dimensional arrays to Go slices, of any supported type


  • Go 1.8 or newer
  • Presto 0.16x or newer


You need a working environment with Go installed and $GOPATH set.

Download and install presto database/sql driver:

go get github.com/prestodb/presto-go-client/presto

Make sure you have Git installed and in your $PATH.


This Presto client is an implementation of Go's database/sql/driver interface. In order to use it, you need to import the package and use the database/sql API then.

Only read operations are supported, such as SHOW and SELECT.

Use presto as driverName and a valid DSN as the dataSourceName.


import "database/sql"
import _ "github.com/prestodb/presto-go-client/presto"

dsn := "http://user@localhost:8080?catalog=default&schema=test"
db, err := sql.Open("presto", dsn)

DSN (Data Source Name)

The Data Source Name is a URL with a mandatory username, and optional query string parameters that are supported by this driver, in the following format:


The easiest way to build your DSN is by using the Config.FormatDSN helper function.

The driver supports both HTTP and HTTPS. If you use HTTPS it's recommended that you also provide a custom http.Client that can validate (or skip) the security checks of the server certificate, and/or to configure TLS client authentication.

HTTP Basic authentication

If the DSN contains a password, the client enables HTTP Basic authentication by setting the Authorization header in every request to presto.

HTTP Basic authentication is only supported on encrypted connections over HTTPS.


Parameters are case-sensitive

Refer to the Presto Concepts documentation for more information.

Type:           string
Valid values:   string describing the source of the connection to presto
Default:        empty

The source parameter is optional, but if used, can help presto admins troubleshoot queries and trace them back to the original client.

Type:           string
Valid values:   the name of a catalog configured in the presto server
Default:        empty

The catalog parameter defines the presto catalog where schemas exist to organize tables.

Type:           string
Valid values:   the name of an existing schema in the catalog
Default:        empty

The schema parameter defines the presto schema where tables exist. This is also known as namespace in some environments.

Type:           string
Valid values:   comma-separated list of key=value session properties
Default:        empty

The session_properties parameter must contain valid parameters accepted by the presto server. Run SHOW SESSION in presto to get the current list.

Type:           string
Valid values:   the name of a client previously registered to the driver
Default:        empty (defaults to http.DefaultClient)

The custom_client parameter allows the use of custom http.Client for the communication with presto.

Register your custom client in the driver, then refer to it by name in the DSN, on the call to sql.Open:

foobarClient := &http.Client{
    Transport: &http.Transport{
        Proxy: http.ProxyFromEnvironment,
        DialContext: (&net.Dialer{
            Timeout:   30 * time.Second,
            KeepAlive: 30 * time.Second,
            DualStack: true,
        MaxIdleConns:          100,
        IdleConnTimeout:       90 * time.Second,
        TLSHandshakeTimeout:   10 * time.Second,
        ExpectContinueTimeout: 1 * time.Second,
        TLSClientConfig:       &tls.Config{
        // your config here...
presto.RegisterCustomClient("foobar", foobarClient)
db, err := sql.Open("presto", "https://user@localhost:8080?custom_client=foobar")




As described in the LICENSE file.