Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Qubole Data Service Python SDK

Build Status

A Python module that provides the tools you need to authenticate with, and use the Qubole Data Service API.


From PyPI

The SDK is available on PyPI.

$ pip install qds-sdk

From source

  • Get the source code:

  • Run the following command (may need to do this as root):

    $ python install
  • Alternatively, if you use virtualenv, you can do this:

    $ cd qds-sdk-py
    $ virtualenv venv
    $ source venv/bin/activate
    $ python install

This should place a command line utility somewhere in your path

$ which

CLI allows running Hive, Hadoop, Pig, Presto and Shell commands against QDS. Users can run commands synchronously - or submit a command and check its status.

$ -h  # will print detailed usage


  1. run a hive query and print the results

    $ --token 'xxyyzz' hivecmd run --query "show tables"
    $ --token 'xxyyzz' hivecmd run --script_location /tmp/myquery
    $ --token 'xxyyzz' hivecmd run --script_location s3://my-qubole-location/myquery
  2. pass in api token from bash environment variable

    $ export QDS_API_TOKEN=xxyyzz
  3. run the example hadoop command

    $ hadoopcmd run streaming -files 's3n://paid-qubole/HadoopAPIExamples/WordCountPython/,s3n://paid-qubole/HadoopAPIExamples/WordCountPython/' -mapper -reducer -numReduceTasks 1 -input 's3n://paid-qubole/default-datasets/gutenberg' -output 's3n://'
  4. check the status of command # 12345678

    $ hivecmd check 12345678
    {"status": "done", ... }
  5. If you are hitting api_url other than, then you can pass it in command line as --url or set in as env variable

    $ --token 'xxyyzz' --url https://<env> hivecmd ...
    $ export QDS_API_URL=https://<env>


An example Python application needs to do the following:

  1. Set the api_token and api_url (if api_url other than

    from qds_sdk.qubole import Qubole
    # or
    Qubole.configure(api_token='ksbdvcwdkjn123423', api_url='https://<env>')
  2. Use the Command classes defined in to execute commands. To run Hive Command:

    from qds_sdk.commands import *
    hc=HiveCommand.create(query='show tables')
    print "Id: %s, Status: %s" % (str(, hc.status)

example/ contains a Hadoop Streaming example

Reporting Bugs and Contributing Code

  • Want to report a bug or request a feature? Please open an issue.
  • Want to contribute? Fork the project and create a pull request with your changes against unreleased branch.