redshift

package
v0.0.0-...-b3895e6 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckLoadStatus

func CheckLoadStatus(t *sql.Tx, manifestURL string) (scoop_protocol.LoadStatus, error)

CheckLoadStatus checks the status of a load into redshift

func CopyCredentials

func CopyCredentials(credentials *credentials.Credentials) (accessCreds string)

CopyCredentials refreshes the redshift aws auth token aggressively

func EscapePGString

func EscapePGString(s string) string

EscapePGString is a poor attempt to escape strings in postgres Prefer using $1 syntax with additional argument to Exec when possible

Types

type ManifestRowCopyRequest

type ManifestRowCopyRequest struct {
	BuiltOn     time.Time
	Schema      string
	Name        string
	ManifestURL string
	Credentials string
}

ManifestRowCopyRequest is the redshift package's represntation of the manifest row copy object for a manifest row copy

func (ManifestRowCopyRequest) TxExec

func (r ManifestRowCopyRequest) TxExec(t *sql.Tx) error

TxExec runs the execution of the manifest row copy request in a transaction

type RSConnection

type RSConnection struct {
	Conn            *sql.DB
	InboundRequests chan RSRequest
}

RSConnection holds the actual connection to the redshift table

func BuildRSConnection

func BuildRSConnection(pgConnect string, maxOpenConnections int) (*RSConnection, error)

BuildRSConnection builds and returns a new connection to redshift

func (*RSConnection) ExecCommand

func (rs *RSConnection) ExecCommand(r RSRequest) (int, error)

ExecCommand is called by listen to initiate a transaction for a command for a RSRequest

func (*RSConnection) ExecFnInTransaction

func (rs *RSConnection) ExecFnInTransaction(work func(*sql.Tx) error) error

ExecFnInTransaction takes a closure function of a request and runs it on redshift in a transaction

func (*RSConnection) ExecInTransaction

func (rs *RSConnection) ExecInTransaction(cmds ...RSRequest) error

ExecInTransaction listens to multiple RSRequests and executes them in a single transaction

func (*RSConnection) Listen

func (rs *RSConnection) Listen()

Listen continuously listens on inbound requests to exec on the RSconnection

type RSRequest

type RSRequest interface {
	GetExec() string
	GetStartTime() time.Time
	GetCategory() string
	GetMessage() string
	GetResult(i int, err error) *RSResult
}

RSRequest is the interface that defines all query creations on redshift

type RSResult

type RSResult struct {
	ResultMessage string
	Status        int
}

RSResult represents the response from redshift after a query is run

func (*RSResult) GetResultMessage

func (r *RSResult) GetResultMessage() string

GetResultMessage returns the result message of RSResult

func (*RSResult) GetStatusCode

func (r *RSResult) GetStatusCode() int

GetStatusCode returns the status code of a RSResult

type Table

type Table struct {
	Rows      [][]interface{} `json:"rows"`
	Columns   []string        `json:"columns"`
	TimeTaken time.Duration   `json:"timeTaken"`
	Err       error           `json:"err"`
}

Table is the internal representation of the the table in the rs_adaptor

Jump to

Keyboard shortcuts

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