Return-Path: X-Original-To: apmail-zeppelin-commits-archive@minotaur.apache.org Delivered-To: apmail-zeppelin-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8C94E18F11 for ; Mon, 24 Aug 2015 03:06:39 +0000 (UTC) Received: (qmail 51226 invoked by uid 500); 24 Aug 2015 03:06:39 -0000 Delivered-To: apmail-zeppelin-commits-archive@zeppelin.apache.org Received: (qmail 51179 invoked by uid 500); 24 Aug 2015 03:06:39 -0000 Mailing-List: contact commits-help@zeppelin.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zeppelin.incubator.apache.org Delivered-To: mailing list commits@zeppelin.incubator.apache.org Received: (qmail 51168 invoked by uid 99); 24 Aug 2015 03:06:39 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Aug 2015 03:06:39 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id F16D2ED1DB for ; Mon, 24 Aug 2015 03:06:38 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.426 X-Spam-Level: X-Spam-Status: No, score=-0.426 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-1.227, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id RIrxMYTUJtUT for ; Mon, 24 Aug 2015 03:06:24 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with SMTP id 1A00042B59 for ; Mon, 24 Aug 2015 03:06:24 +0000 (UTC) Received: (qmail 50738 invoked by uid 99); 24 Aug 2015 03:06:23 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Aug 2015 03:06:23 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id 8E11EAC0250 for ; Mon, 24 Aug 2015 03:06:23 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1697303 - in /incubator/zeppelin/site/docs: index.html interpreter/postgresql.html Date: Mon, 24 Aug 2015 03:06:23 -0000 To: commits@zeppelin.incubator.apache.org From: moon@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150824030623.8E11EAC0250@hades.apache.org> Author: moon Date: Mon Aug 24 03:06:23 2015 New Revision: 1697303 URL: http://svn.apache.org/r1697303 Log: Add PostgreSQL Interpreters Documentation to gh-pages https://issues.apache.org/jira/browse/ZEPPELIN-252 Added: incubator/zeppelin/site/docs/interpreter/postgresql.html Modified: incubator/zeppelin/site/docs/index.html Modified: incubator/zeppelin/site/docs/index.html URL: http://svn.apache.org/viewvc/incubator/zeppelin/site/docs/index.html?rev=1697303&r1=1697302&r2=1697303&view=diff ============================================================================== --- incubator/zeppelin/site/docs/index.html (original) +++ incubator/zeppelin/site/docs/index.html Mon Aug 24 03:06:23 2015 @@ -148,6 +148,10 @@ + + + + @@ -241,6 +245,10 @@ + + + +
  • Download
  • @@ -317,6 +325,8 @@
  • sh
  • spark
  • tajo
  • +
  • geode
  • +
  • postgresql, hawq
  • Display System

    Added: incubator/zeppelin/site/docs/interpreter/postgresql.html URL: http://svn.apache.org/viewvc/incubator/zeppelin/site/docs/interpreter/postgresql.html?rev=1697303&view=auto ============================================================================== --- incubator/zeppelin/site/docs/interpreter/postgresql.html (added) +++ incubator/zeppelin/site/docs/interpreter/postgresql.html Mon Aug 24 03:06:23 2015 @@ -0,0 +1,475 @@ + + + + + + PostgreSQL and HAWQ Interpreter + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + +
    +
    +

    PostgreSQL, HAWQ Interpreter for Apache Zeppelin

    + +


    + + + + + + + + + + + +
    NameClassDescription
    %psql.sqlPostgreSqlInterpreterProvides SQL environment for Postgresql, HAWQ and Greenplum

    + +


    +zeppelin-view

    + +

    This interpreter seamlessly supports the following SQL data processing engines:

    + + + +

    This Video Tutorial illustrates some of the features provided by the Postgresql Interpreter.

    + +

    Create Interpreter

    + +

    By default Zeppelin creates one PSQL instance. You can remove it or create new instances.

    + +

    Multiple PSQL instances can be created, each configured to the same or different backend databases. But over time a Notebook can have only one PSQL interpreter instance bound. That means you can not connect to different databases in the same Notebook. This is a known Zeppelin limitation.

    + +

    To create new PSQL instance open the Interprter section and click the +Create button. Pick a Name of your choice and from the Interpreter drop-down select psql. Then follow the configuration instructions and Save the new instance.

    + +
    +

    Note: The Name of the instance is used only to distinct the instances while binding them to the Notebook. The Name is irrelevant inside the Notebook. In the Notebook you must use %psql.sql tag.

    +
    + +

    Bind to Notebook

    + +

    In the Notebook click on the settings icon in the top right corner. The select/deselect the interpreters to be bound with the Notebook.

    + +

    Configuration

    + +

    You can modify the configuration of the PSQL from the Interpreter section. The PSQL interpreter expenses the following properties:

    + +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    Property NameDescriptionDefault Value
    postgresql.urlJDBC URL to connect to jdbc:postgresql://localhost:5432
    postgresql.userJDBC user namegpadmin
    postgresql.passwordJDBC password
    postgresql.driver.nameJDBC driver name. In this version the driver name is fixed and should not be changedorg.postgresql.Driver
    postgresql.max.resultMax number of SQL result to display to prevent the browser overload1000

    + +

    How to use

    +
    Tip: Use (CTRL + .) for SQL auto-completion.
    +
    +

    DDL and SQL commands

    + +

    Start the paragraphs with the full %psql.sql prefix tag! The short notation: %psql would still be able run the queries but the syntax highlighting and the auto-completions will be disabled.

    + +

    You can use the standard CREATE / DROP / INSERT commands to create or modify the data model:

    +
    %psql.sql
    +drop table if exists mytable;
    +create table mytable (i int);
    +insert into mytable select generate_series(1, 100);
    +
    +

    Then in a separate paragraph run the query.

    +
    %psql.sql
    +select * from mytable;
    +
    +
    +

    Note: You can have multiple queries in the same paragraph but only the result from the first is displayed. [1], [2].

    +
    + +

    For example, this will execute both queries but only the count result will be displayed. If you revert the order of the queries the mytable content will be shown instead.

    +
    %psql.sql
    +select count(*) from mytable;
    +select * from mytable;
    +
    +

    PSQL command line tools

    + +

    Use the Shell Interpreter (%sh) to access the command line PSQL interactively:

    +
    %sh
    +psql -h phd3.localdomain -U gpadmin -p 5432 <<EOF
    + \dn  
    + \q
    +EOF
    +
    +

    This will produce output like this:

    +
            Name        |  Owner  
    +--------------------+---------
    + hawq_toolkit       | gpadmin
    + information_schema | gpadmin
    + madlib             | gpadmin
    + pg_catalog         | gpadmin
    + pg_toast           | gpadmin
    + public             | gpadmin
    + retail_demo        | gpadmin
    +
    +

    Apply Zeppelin Dynamic Forms

    + +

    You can leverage Zepplein Dynamic Form inside your queries. You can use both the text input and select form parametrization features

    +
    %psql.sql
    +SELECT ${group_by}, count(*) as count 
    +FROM retail_demo.order_lineitems_pxf 
    +GROUP BY ${group_by=product_id,product_id|product_name|customer_id|store_id} 
    +ORDER BY count ${order=DESC,DESC|ASC} 
    +LIMIT ${limit=10};
    +
    +

    Example HAWQ PXF/HDFS Tables

    + +

    Create HAWQ external table that read data from tab-separated-value data in HDFS.

    +
    %psql.sql
    +CREATE EXTERNAL TABLE retail_demo.payment_methods_pxf (
    +  payment_method_id smallint,
    +  payment_method_code character varying(20)
    +) LOCATION ('pxf://${NAME_NODE_HOST}:50070/retail_demo/payment_methods.tsv.gz?profile=HdfsTextSimple') FORMAT 'TEXT' (DELIMITER = E'\t');
    +
    +

    And retrieve content

    +
    %psql.sql
    +seelect * from retail_demo.payment_methods_pxf
    +
    +

    Auto-completion

    + +

    The PSQL Interpreter provides a basic auto-completion functionality. On (Ctrl+.) it list the most relevant suggesntions in a pop-up window. In addition to the SQL keyword the interpter provides suggestions for the Schema, Table, Column names as well.

    + +
    +
    + + +
    +
    + +
    +
    + + + + + + + +