Git Product home page Git Product logo

gohive's Introduction

gohive

克隆自 https://github.com/derekgr/hivething
更改了TCLIService, 在inf/目录下,并修改了相应的调用。支持Hive1.2+版本
支持thrift 0.11版本

Usage

package main

import (
	"fmt"

	"github.com/dazheng/gohive"
)

func main() {
	//	conn, err := gohive.Connect("127.0.0.1:10000", gohive.DefaultOptions) // 无用户名、密码
	conn, err := gohive.ConnectWithUser("127.0.0.1:10000", "username", "password", gohive.DefaultOptions) // 需要用户名、密码
	if err != nil {
		fmt.Errorf("Connect error %v", err)
	}

	_, err = conn.Exec("create table if not exists t(c1 int)")
	_, err = conn.Exec(" insert into default.t values(1), (2)")
	if err != nil {
		fmt.Errorf("Connection.Exec error: %v", err)
	}
	rs, err := conn.Query("select c1 from t limit 10")
	if err != nil {
		fmt.Errorf("Connection.Query error: %v", err)
	}
	var c1 int
	for rs.Next() {
		rs.Scan(&c1)
		fmt.Println(c1)
	}
	conn.Close()
}

gohive's People

Contributors

dazheng avatar linyongzuo avatar

Watchers

James Cloos avatar  avatar  avatar

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.