lytics

package
v0.0.0-...-f111e62 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2017 License: MIT Imports: 15 Imported by: 0

README

Lytics Source

Query Lytics Api Or more specifically the Segment Scan api.

Use SQL To query the api and via the mysql protocol, uses Secure HTTPS for transport to Lytics Api.

Example

The default example dataux docker container includes a single table appearances in database baseball that is made from a single csv file stored in the container.

We are going to add an additional source (Lytics) via a SQL CREATE statement.


docker pull gcr.io/dataux-io/dataux:latest
docker run --rm -e "LOGGING=debug" -p 4000:4000 --name dataux gcr.io/dataux-io/dataux:latest

dataux_lytics

mysql -h 127.0.0.1 -P4000


-- Get api key from Account in Lytics

CREATE source lytics WITH {
  "type":"lytics", 
  "schema":"lytics", 
  "settings" : {
     "apikey":"YOUR_API_KEY"
  }
};

use lytics;

show tables;

describe user;

select * from user WHERE EXISTS email limit 10;

TODO

  • handle ending paging/limits (ie, don't open cursors)
  • paging segment scans efficiently
  • Select INTO (mytable)

Documentation

Index

Constants

View Source
const (
	// SourceType defines the "source" type from qlbridge datasource
	SourceType = "lytics"
)

Variables

View Source
var (
	DefaultLimit = 1000
)

Functions

This section is empty.

Types

type Generator

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

Generator Generate Lytics api requests from Sql Statements - convert sql WHERE into SegmentQL api statements - fetch entities from entity scan api

func NewGenerator

func NewGenerator(table *schema.Table, apiKey string) *Generator

func (*Generator) Close

func (m *Generator) Close() error

func (*Generator) WalkExecSource

func (m *Generator) WalkExecSource(p *plan.Source) (exec.Task, error)

func (*Generator) WalkSourceSelect

func (m *Generator) WalkSourceSelect(planner plan.Planner, p *plan.Source) (plan.Task, error)

WalkSourceSelect is used during planning phase, to create a plan (plan.Task)

or error, and to report back any poly-fill necessary

type ResultReader

type ResultReader struct {
	*exec.TaskBase

	Docs     []u.JsonHelper
	Vals     [][]driver.Value
	Total    int
	Aggs     u.JsonHelper
	ScrollId string
	Req      *Generator
	// contains filtered or unexported fields
}

ResultReader, adapts the lytics http json response

func NewResultReader

func NewResultReader(req *Generator) *ResultReader

func (*ResultReader) Close

func (m *ResultReader) Close() error

func (*ResultReader) Run

func (m *ResultReader) Run() error

Run() Fetch api response

type ResultReaderNext

type ResultReaderNext struct {
	*ResultReader
}

A wrapper, allowing us to implement sql/driver Next() interface

which is different than qlbridge/datasource Next()

type Source

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

Source is the Lytics data source provider responsible for schema management, and connection management to Lytics

func (*Source) Close

func (m *Source) Close() error

func (*Source) DataSource

func (m *Source) DataSource() schema.Source

func (*Source) Init

func (m *Source) Init()

func (*Source) Open

func (m *Source) Open(schemaName string) (schema.Conn, error)

func (*Source) Setup

func (m *Source) Setup(ss *schema.SchemaSource) error

func (*Source) Table

func (m *Source) Table(table string) (*schema.Table, error)

func (*Source) Tables

func (m *Source) Tables() []string

Jump to

Keyboard shortcuts

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