{"id":19767513,"url":"https://github.com/sql-machine-learning/gomaxcompute","last_synced_at":"2025-04-30T15:33:24.668Z","repository":{"id":46996383,"uuid":"181499219","full_name":"sql-machine-learning/gomaxcompute","owner":"sql-machine-learning","description":"A Go driver for MaxCompute.","archived":false,"fork":false,"pushed_at":"2021-09-18T08:16:09.000Z","size":59,"stargazers_count":41,"open_issues_count":6,"forks_count":11,"subscribers_count":13,"default_branch":"develop","last_synced_at":"2024-06-18T15:29:32.875Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sql-machine-learning.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-15T14:02:39.000Z","updated_at":"2024-06-18T15:29:32.875Z","dependencies_parsed_at":"2022-09-01T10:31:22.176Z","dependency_job_id":null,"html_url":"https://github.com/sql-machine-learning/gomaxcompute","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sql-machine-learning%2Fgomaxcompute","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sql-machine-learning%2Fgomaxcompute/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sql-machine-learning%2Fgomaxcompute/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sql-machine-learning%2Fgomaxcompute/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sql-machine-learning","download_url":"https://codeload.github.com/sql-machine-learning/gomaxcompute/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224218848,"owners_count":17275463,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T04:30:01.996Z","updated_at":"2024-11-12T04:30:02.559Z","avatar_url":"https://github.com/sql-machine-learning.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MaxCompute Go Driver\n\n[![Build Status](https://travis-ci.org/sql-machine-learning/gomaxcompute.svg?branch=develop)](https://travis-ci.org/sql-machine-learning/gomaxcompute) [![GoDoc](https://godoc.org/github.com/sql-machine-learning/gomaxcompute?status.svg)](https://godoc.org/github.com/sql-machine-learning/gomaxcompute) [![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](LICENSE)\n\n\n[MaxCompute](https://www.alibabacloud.com/product/maxcompute), also known as ODPS, is a distributed storage service and SQL engine provided by [Alibaba Cloud](https://www.alibabacloud.com/). This repository contains a Go [SQLDriver](https://github.com/golang/go/wiki/SQLDrivers) 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.\n\nThis project is in its early stage. Your issues and pull requests are very welcome!\n\n\n## What This Is and Isn't\n\nThis project is a driver that helps Go's standard database API talking to MaxCompute server. It has the following features:\n \n- In pure Go. Not a wrapper of any C/C++ library.\n- Connect to MaxCompute through its [HTTP interface](http://repo.aliyun.com/api-doc/).\n- Improve I/O throughput using MaxCompute's [tunnel service](https://www.alibabacloud.com/help/doc-detail/27833.htm).\n\nAlibaba Cloud open sourced some client SDKs of MaxCompute:\n\n- Java: https://github.com/aliyun/aliyun-odps-java-sdk\n- Python: https://github.com/aliyun/aliyun-odps-python-sdk\n\nThis project is not an SDK.\n\nAlibaba Cloud also provides ODBC/JDBC drivers:\n\n- https://github.com/aliyun/aliyun-odps-jdbc\n\nThis project is a Go's `database/sql` driver.\n\n\n## How to Use\n\nPlease make sure you have Go 1.6 or high release. \n\nYou can clone the source code by running the following command.\n\n```go\ngo get -u sqlflow.org/gomaxcompute\n```\n\nHere is a simple example:\n\n```go\npackage main\n\nimport (\n    \"database/sql\"\n    \"sqlflow.org/gomaxcompute\"\n)\n\nfunc assertNoError(e error) {\n    if e != nil {\n        panic(e)\n    }\n}\n\nfunc main() {\n    config := gomaxcompute.Config{\n        AccessID:  \"\u003caccess_id\u003e\",\n        AccessKey: \"\u003caccess_key\u003e\",\n        Endpoint:  \"\u003cend_point\u003e\",\n        Project:   \"\u003cproject_name\u003e\"}\n    db, e := sql.Open(\"maxcompute\", config.FormatDSN())\n    assertNoError(e)\n    defer db.Close()\n\n    const sql = `SELECT\n                    cast('1'                   AS BIGINT)  AS a,\n                    cast(TRUE                  AS BOOLEAN) AS b,\n                    cast('hi'                  AS STRING)  AS c,\n                    cast('3.14'                AS DOUBLE)  AS d,\n                    cast('2017-11-11 03:12:11' AS DATETIME) AS e,\n                    cast('100.01' AS DECIMAL)  AS f;`\n    rows, e := db.Query(sql)\n    assertNoError(e)\n    defer rows.Close()\n\n    for rows.Next() {\n        // do your stuff\n    }\n}\n```\n\nPlease be aware that to connect to a MaxCompute database, the user needs to provide \n\n1. the access ID\n1. the access key\n1. the endpoint pointing to the MaxCompute service\n1. a project, which is something similar to a database in MySQL.\n\n## Acknowledgement\n\nOur 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.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsql-machine-learning%2Fgomaxcompute","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsql-machine-learning%2Fgomaxcompute","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsql-machine-learning%2Fgomaxcompute/lists"}