Giter VIP home page Giter VIP logo

goperset's Introduction

goperset

Golang Apache Superset API Package

This project is mentioned in the Apache Superset official wiki as a Golang API Package.

This project is inspired from: gocloak

For Questions either raise an issue, or come to the gopher-slack into the channel #goperset

SOON: Benchmarks can be found here

Contribution

(WIP) https://github.com/justmike1/goperset/wiki/Contribute

Changelog

For release notes please consult the specific releases here

For tags please consult the specific tags here

Usage

Installation

go install github.com/justmike1/goperset@latest

Importing

 import "github.com/justmike1/goperset"

Connecting to Superset Client

func main() {
    ctx := context.Background()
    client := goperset.NewClient(ctx, "https://superset.domain.net/")
    tokens, err := goperset.GetAccessTokens(client, "admin", "admin")
    if err != nil {
        t.Errorf("Error getting access tokens: %v", err)
        return
    }
}

Example of Creating a new database connection

func createDatabase(client, tokens string) error {
    databaseUri := fmt.Sprintf("postgresql+psycopg2://%s:%s@%s:%s/database", "username", "password", "postgresql", "5432")
    payload := goperset.DatabasePayload{
        ConfigurationMethod: goperset.StringP("sqlalchemy_form"),
        Engine:              goperset.StringP("postgresql+psycopg2"),
        DatabaseName:        goperset.StringP("postgresql"),
        SQLAlchemyURI:       goperset.StringP(databaseUri),
    }
    _, err := goperset.CreateDatabase(client, tokens, payload)
    if err != nil {
        return fmt.Errorf("error sending request: %v", err)
    }
    return nil
}

Features

// GoPerset holds all methods a client should fulfill
type GoPerset interface {
	
 // Client
 NewClient(basePath string) &Goperset
 GetAccessTokens(client *Goperset, username string, password string) (ClientToken, error)
 ClientResty(client *Goperset, token string, csrfToken string, contentType string, method string, endpoint string, payload interface{}) ([]byte, error)
 
 // Database
 CreateDatabase(client *Goperset, tokens ClientToken, payload DatabasePayload) ([]byte, error)
 
 // Dashboard
 CreateDashboard(client *Goperset, tokens ClientToken, payload DashboardPayload) ([]byte, error)
 GetDashboard(client *Goperset, tokens ClientToken, params GetDashboardParams) ([]byte, error)
 GetDashboardInfo(client *Goperset, tokens ClientToken, params DashboardInfoParams) ([]byte, error)

 // Dataset
 CreateDataset(client *Goperset, tokens ClientToken, payload DatasetPayload) ([]byte, error)
 
 // Chart
 CreateChart(client *Goperset, tokens ClientToken, payload DatasetPayload) ([]byte, error)
}

Unit Testing

SUPERSET_BASE_PATH=https://superset.domain.net go test client_test.go -v

goperset's People

Contributors

justmike1 avatar

Stargazers

Francisco Oliveira avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

devinsburke

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.