<commit_before># td-fdw

Multicorn based PostgreSQL Foreign Data Wrapper for Treasure Data. 
It makes your Treasure Data dataset appear as foreign tables in your PostgreSQL database.

## Installation
Install [Multicorn](http://multicorn.org/#installation) and build this FDW

    $ pgxn install multicorn
    $ cd td_fdw
    $ sudo pip install --upgrade .
      or
    $ python setup.py sdist
    $ sudo python setup.py install

## Setup
Connect to your PostgreSQL and create an extension and foreign server

    CREATE EXTENSION multicorn;
    
    CREATE SERVER td_server FOREIGN DATA WRAPPER multicorn
    OPTIONS (
        wrapper 'tdfdw.tdfdw.TreasureDataFdw'
    );

## Usage
Specify your API key, database, query engine type ('presto' or 'hive') in CREATE FOREIGN TABLE statement. You can specify either your table name or query for Treasure Data directly.

    CREATE FOREIGN TABLE sample_datasets (
        "user" integer,
        host varchar,
        path varchar,<commit_msg>Add `sudo pip install td-fdw` in README.md<commit_after># td-fdw

Multicorn based PostgreSQL Foreign Data Wrapper for Treasure Data. 
It makes your Treasure Data dataset appear as foreign tables in your PostgreSQL database.

## Installation
Install [Multicorn](http://multicorn.org/#installation) and build this FDW

    $ pgxn install multicorn
    $ sudo pip install td-fdw
        or
    $ git clone https://github.com/komamitsu/td-fdw.git
    $ cd td-fdw
    $ sudo pip install --upgrade .

## Setup
Connect to your PostgreSQL and create an extension and foreign server

    CREATE EXTENSION multicorn;
    
    CREATE SERVER td_server FOREIGN DATA WRAPPER multicorn
    OPTIONS (
        wrapper 'tdfdw.tdfdw.TreasureDataFdw'
    );

## Usage
Specify your API key, database, query engine type ('presto' or 'hive') in CREATE FOREIGN TABLE statement. You can specify either your table name or query for Treasure Data directly.

    CREATE FOREIGN TABLE sample_datasets (
        "user" integer,
        host varchar,
        path varchar,
{'fraction_non_alphanumeric': 0.0621301775147929, 'fraction_numerical': 0.0, 'mean_word_length': 3.2095435684647304, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1902269', 'n_tokens_mistral': 628, 'n_tokens_neox': 571, 'n_words': 233}