GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - sql-machine-learning/gomaxcompute: A Go driver for MaxCompute.

BranchesTags
Open more actions menu

Latest commit

 

History

35 Commits
35 Commits

Folders and files

NameName
Last commit message
Last commit date
.gitignore
.gitignore
 
 
.golangci.yml
.golangci.yml
 
 
.pre-commit-config.yaml
.pre-commit-config.yaml
 
 
.travis.yml
.travis.yml
 
 
README.md
README.md
 
 
client.go
client.go
 
 
connection.go
connection.go
 
 
connection_test.go
connection_test.go
 
 
driver.go
driver.go
 
 
driver_test.go
driver_test.go
 
 
dsn.go
dsn.go
 
 
dsn_test.go
dsn_test.go
 
 
errors.go
errors.go
 
 
errors_test.go
errors_test.go
 
 
go.mod
go.mod
 
 
go.sum
go.sum
 
 
index.html
index.html
 
 
instance.go
instance.go
 
 
instance_test.go
instance_test.go
 
 
job.go
job.go
 
 
job_test.go
job_test.go
 
 
log.go
log.go
 
 
result.go
result.go
 
 
rows.go
rows.go
 
 
rows_test.go
rows_test.go
 
 
task.go
task.go
 
 
task_test.go
task_test.go
 
 
tunnel.go
tunnel.go
 
 

Repository files navigation

MaxCompute Go Driver

Build Status GoDoc License

MaxCompute, also known as ODPS, is a distributed storage service and SQL engine provided by Alibaba Cloud. This repository contains a Go SQLDriver of MaxCompute. If you are going to write a Go program that calls the standard library database/sql to access MaxCompute databases, you could use this driver.

This project is in its early stage. Your issues and pull requests are very welcome!

What This Is and Isn't

This project is a driver that helps Go's standard database API talking to MaxCompute server. It has the following features:

  • In pure Go. Not a wrapper of any C/C++ library.
  • Connect to MaxCompute through its HTTP interface.
  • Improve I/O throughput using MaxCompute's tunnel service.

Alibaba Cloud open sourced some client SDKs of MaxCompute:

  • Java: https://github.com/aliyun/aliyun-odps-java-sdk
  • Python: https://github.com/aliyun/aliyun-odps-python-sdk

This project is not an SDK.

Alibaba Cloud also provides ODBC/JDBC drivers:

  • https://github.com/aliyun/aliyun-odps-jdbc

This project is a Go's database/sql driver.

How to Use

Please make sure you have Go 1.6 or high release.

You can clone the source code by running the following command.

go get -u sqlflow.org/gomaxcompute

Here is a simple example:

package main

import (
    "database/sql"
    "sqlflow.org/gomaxcompute"
)

func assertNoError(e error) {
    if e != nil {
        panic(e)
    }
}

func main() {
    config := gomaxcompute.Config{
        AccessID:  "<access_id>",
        AccessKey: "<access_key>",
        Endpoint:  "<end_point>",
        Project:   "<project_name>"}
    db, e := sql.Open("maxcompute", config.FormatDSN())
    assertNoError(e)
    defer db.Close()

    const sql = `SELECT
                    cast('1'                   AS BIGINT)  AS a,
                    cast(TRUE                  AS BOOLEAN) AS b,
                    cast('hi'                  AS STRING)  AS c,
                    cast('3.14'                AS DOUBLE)  AS d,
                    cast('2017-11-11 03:12:11' AS DATETIME) AS e,
                    cast('100.01' AS DECIMAL)  AS f;`
    rows, e := db.Query(sql)
    assertNoError(e)
    defer rows.Close()

    for rows.Next() {
        // do your stuff
    }
}

Please be aware that to connect to a MaxCompute database, the user needs to provide

  1. the access ID
  2. the access key
  3. the endpoint pointing to the MaxCompute service
  4. a project, which is something similar to a database in MySQL.

Acknowledgement

Our respect and thanks to Ruohang Feng, who wrote a Go SDK for MaxCompute when he worked in Alibaba, for his warm help that enabled this project.

About

A Go driver for MaxCompute.

Resources

Readme
Activity
Custom properties

Stars

44 stars

Watchers

11 watching

Forks

10 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.