presto

package module
v0.0.0-...-3d2eb4b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2016 License: MIT Imports: 6 Imported by: 1

README

Presto for Go

This is a tiny golang client for Facebook's Presto.

import (
  "fmt"
  "github.com/colinmarc/go-presto"
)

// Host, user, source, catalog, schema, query
sql := "SELECT * FROM sys.node"
query, _ := presto.NewQuery("http://presto-coordinator:8080", "", "", "", "", sql)

if row, _ := query.Next(); row != nil {
  fmt.Println(row...)
}

Documentation

Overview

Package presto provides a standard database/sql driver for Facebook's Presto query engine.

Index

Constants

View Source
const (
	ProgressUnknown float64 = -1.0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Query

type Query struct {
	// contains filtered or unexported fields
}

Query represents an open query to presto.

func NewQuery

func NewQuery(host, user, source, catalog, schema, query string) (*Query, error)

func (*Query) Close

func (q *Query) Close() error

Close closes the query, and cancels it if started.

func (*Query) Columns

func (q *Query) Columns() []string

Columns returns a list of the column names for the query.

func (*Query) Next

func (q *Query) Next() ([]interface{}, error)

Next retrieves the next row from the dataset, fetching more if need be.

func (*Query) Progress

func (q *Query) Progress() float64

Progress returns the current progress of the query, which is the proportion of splits completed. Progress is only updated on calls to Next.

If the total number of splits is not determined, Progress returns ProgressUnknown.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL