Skip to main content

Pure Python WebHDFS client

Project description

Because the world needs yet another way to talk to HDFS from Python.

Usage

This library provides a Python client for WebHDFS. NameNode HA is supported if you pass in both NameNodes. Any failed operation will raise some subclass of HdfsException.

from pyhdfs import HdfsClient
client = HdfsClient(hosts='namenode1.example.com:50070,namenode2.example.com:50070')
print(client.list_status('/'))

You can also pass the hostname as part of the URI:

from pyhdfs import HdfsClient
client = HdfsClient()
print(client.list_status('//namenode1.example.com:50070;namenode2.example.com:50070/'))

The methods and return values generally map directly to WebHDFS endpoints. The client also provides convenience methods that mimic Python os methods and HDFS CLI commands (e.g. walk and copy_to_local).

pyhdfs logs all HDFS actions at the INFO level, so turning on INFO level logging will give you a debug record for your application.

For more information, see the full API docs.

Installing

pip install pyhdfs

You’ll need Python 2.7 or Python 3.

Development testing

First get an environment with HDFS. The Cloudera QuickStart VM works fine for this. (Note that the VM only comes with Python 2.6, so you might want to use your host and forward port 50070.)

WARNING: The tests create and delete hdfs://localhost/tmp/pyhdfs_test.

Python 3:

virtualenv3 --no-site-packages env3
source env3/bin/activate
pip3 install -e .
pip3 install -r dev_requirements.txt
py.test

And again for Python 2 (after deactivate):

virtualenv2 --no-site-packages env2
source env2/bin/activate
pip2 install -e .
pip2 install -r dev_requirements.txt
py.test

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyHDFS-0.1.1.tar.gz (10.8 kB view details)

Uploaded Source

File details

Details for the file PyHDFS-0.1.1.tar.gz.

File metadata

  • Download URL: PyHDFS-0.1.1.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for PyHDFS-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c1e435b64dd4e046a984a9408f7ebb1f4499182c9bb063aa76b1d73c818fbb0e
MD5 94632312ac489ef8aa8d28f935fb587e
BLAKE2b-256 63d7ee567570af5e98a6dae8328c2779bbeda3a2972babe2310effad98a004e2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page