Skip to main content

HS2Client

This project aims to be an up to date Python client to interact with Hive Server 2 using the Thrift protocol.

The project is heavily inspired by PyHive up to the point that part of the code has been snatched from there. See Differences for more.

Installation

Install it with pip install hs2client or directly from source

python setup.py install

Usage

Using it from Python is simple:

from hs2client.hs2client import HS2Client

client = HS2Client(host='127.0.0.1', username='user', port=10000, auth='NONE')

with client as connection, connection.cursor() as cursor:
    cursor.arraysize = 10
    cursor.execute('select * from table')
    for row in cursor:
        print(row)

Regenerate the Python thrift library

The hs2client.py is just a thin wrapper around the generated Python code to interact with Hive Server 2 through the Thrift protocol.

To regenerate the code using a newer version of the .thrift files, you can use generate.py (note: you need to have thrift installed, see here)

python generate.py --help

Usage: generate.py [OPTIONS]

Options:
  --hive_server2_url TEXT The URL where the TCLIService.thrift file can be downloaded
  --package TEXT          The package where the client should be placed
  --subpackage TEXT       The subpackage where the client should be placed
  --help                  Show this message and exit.

Otherwise the defaults will be used.

Differences with PyHive

  • This pakcage lacks the sqlalchemy and the presto part;

  • The main class, HS2Client inherits from TCLIService.Client, making certain things handier;

  • In cases where authentication is NONE, the username is set to mr.who to avoid issues with the latest Hive Server 2 versions;

  • Thrift 0.11 has been used to generate the Python files;

  • The generate.py file allows to easily update the files generated from the thrift specs.

Metadata

Release files for hs2client 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hs2client 0.1.1
File Size Uploaded
hs2client-0.1.1.tar.gz 30.4 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for hs2client 0.1.1
File Interpreter ABI Platform
hs2client-0.1.1-py3.6.egg Legacy Egg format - - Details
hs2client-0.1.1-py3-none-any.whl Python 3 none any Details
hs2client-0.1.1-py2.7.egg Legacy Egg format - - Details

Total release size: 227.4 kB

Release files / hs2client-0.1.1.tar.gz

Download URL hs2client-0.1.1.tar.gz
Size 30.4 kB
Tags Source
SHA-256 checksum
How to use checksums
45407ae190e60141b5d9bc10a0253de4650aa6f2652506ec3ef895e583294925
BLAKE2b-256 checksum
How to use checksums
08cdb844f0f87dddf23b9a814adf5ebe02873883118a6c3eb1c1794a0823aacd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / hs2client-0.1.1-py3.6.egg

Download URL hs2client-0.1.1-py3.6.egg
Size 84.3 kB
Tags Egg
SHA-256 checksum
How to use checksums
4f1a3ab1d98865962b78e29c977d8c0baa2b90a14e4998bb0d9fd08df86f3968
BLAKE2b-256 checksum
How to use checksums
fc035b2cf6f6a0fad38a7b7024789e0b990766c7292f1072f7c8f48b2927cc1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / hs2client-0.1.1-py3-none-any.whl

Download URL hs2client-0.1.1-py3-none-any.whl
Size 32.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4ad7c7b114de14cd80bfdab20bbeb5dcc73dd5f15f70d04117e4f1fdbf9c49e8
BLAKE2b-256 checksum
How to use checksums
6275f8679994d859fbbb1f8dc3703e5967b22ad5200ea9594faad153afd63b58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / hs2client-0.1.1-py2.7.egg

Download URL hs2client-0.1.1-py2.7.egg
Size 80.3 kB
Tags Egg
SHA-256 checksum
How to use checksums
b9195b71a7eddcd336326049376b3b34e5d2a3cdeab5064bcee7399c0cf455d9
BLAKE2b-256 checksum
How to use checksums
0ca0015883ffa4e3c0b9673560e2aca579338208bf4e06b59e12e1d461bd183e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.1 This release

4 release files

0.1.0

4 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page