项目作者: lenchv

项目描述 :
Driver for connection to Apache Hive via Thrift API
高级语言: JavaScript
项目地址: git://github.com/lenchv/hive-driver.git
创建时间: 2020-01-05T12:18:27Z
项目社区:https://github.com/lenchv/hive-driver

开源协议:MIT License

下载


Hive Driver

npm
test
coverage

Description

Hive Driver is a Java Script driver for connection to Apache Hive via Thrift API.

This driver can connect with SASL authentication mechanisms (such as LDAP, PLAIN, Kerberos) using both HTTP and TCP transport.

Installation

  1. npm i hive-driver

If you’d like to use Kerberos, you have to install and build the kerberos module on your own

  1. npm i kerberos

Usage

examples/usage.js

  1. const hive = require('hive-driver');
  2. const { TCLIService, TCLIService_types } = hive.thrift;
  3. const client = new hive.HiveClient(
  4. TCLIService,
  5. TCLIService_types
  6. );
  7. client.connect(
  8. {
  9. host: 'localhost',
  10. port: 10000
  11. },
  12. new hive.connections.TcpConnection(),
  13. new hive.auth.NoSaslAuthentication()
  14. ).then(async client => {
  15. const session = await client.openSession({
  16. client_protocol: TCLIService_types.TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V10
  17. });
  18. const response = await session.getInfo(
  19. TCLIService_types.TGetInfoType.CLI_DBMS_VER
  20. );
  21. console.log(response.getValue());
  22. await session.close();
  23. }).catch(error => {
  24. console.log(error);
  25. });

For more details see: Getting Started

Test

Unit tests:

  1. npm run test

e2e tests:

  1. npm run e2e

NOTICE

e2e tests use dockerized Hive instance, for more details see: .docker

Contributing

See CONTRIBUTING.md

Issues

If you find some issues, feel free to create an issue or send a pull request.

License

MIT License

Copyright (c) 2020 Volodymyr Liench