Skip to content
Python
Latest commit 2381306 Nov 6, 2012 YoungwooKim Minor fixes
Failed to load latest commit information.
.gitignore Initial commit Apr 9, 2012
README first commit Apr 9, 2012
README.md Update README.md Aug 17, 2012
hivefdw.py Minor fixes Nov 6, 2012
setup.py Bump up version to 0.0.2 Apr 30, 2012

README.md

Hive FDW for PostgreSQL

This Python module implements the multicorn.ForeignDataWrapper interface to allow you to create foreign tables in PostgreSQL 9.1+ that query to tables in Apache Hive.

Pre-requisites

Installation

  1. Install Multicorn
  2. Install hive-thrift-py
  3. Build the FDW module:

    $ cd hive-fdw-for-postgresql
    $ python setup.py sdist
    $ sudo python setup.py install
    

    or, with easy_install:

    $ cd hive-fdw-for-postgresql
    $ sudo easy_install .
    
  4. In the PostgreSQL client, create an extension and foreign server:

    CREATE EXTENSION multicorn;
    
    CREATE SERVER multicorn_hive FOREIGN DATA WRAPPER multicorn
    OPTIONS (
        wrapper 'hivefdw.HiveForeignDataWrapper'
    );
    

Examples

  1. User can executes simple selects on a remote Hive table:

    CREATE FOREIGN TABLE hive (
        a varchar,
        b varchar,
        c varchar,
        d varchar
    ) SERVER multicorn_hive OPTIONS (
        host 'tb081',
        port '10000',
        table 'test'
    );
    
    SELECT * FROM hive;
    
  2. Also user can executes selects using a Hive query:

    CREATE FOREIGN TABLE hive_query (
        x varchar,
        y varchar,
        z varchar
    ) SERVER multicorn_hive OPTIONS (
        host 'tb081',
        port '10000',
        query 'SELECT x,y,z from src'
    );
    
    SELECT * from hive_query;
    
Something went wrong with that request. Please try again.