Сreate a note using Phoenix

NOTE
Before creating a note, make sure that your Phoenix interpreter is configured as described in the Add a custom interpreter to a group article.
  1. In the Zeppelin web UI, click the Create new note list item or click the main menu item Notebook → Create new note.

    Adding a new note
    Adding a new note
    Adding a new note
    Adding a new note
  2. In the opened dialog, enter the note name and select the default interpreter that will be used in cases when the interpreter type is not specified explicitly. Notice that you can create different folders for your notes. Then, click Create.

    Describing a new note
    Describing a new note
    Describing a new note
    Describing a new note
  3. In the opened window, click the Interpreter binding icon to view the available interpreters.

    Switch to binding interpreters
    Switch to binding interpreters
    Switch to binding interpreters
    Switch to binding interpreters
  4. Verify that the interpreters %jdbc and %phoenix are selected in the opened list, select them otherwise. Click Save.

    NOTE
    You can use only one interpreter, however this section shows working with both of them.
    Binding necessary interpreters
    Binding necessary interpreters
    Binding necessary interpreters
    Binding necessary interpreters
  5. First, use the %jdbc interpreter with the settings marked with the phoenix_ prefix. Enter the following code in the first paragraph of your note. This query returns the number of books grouped by their first publication year.

    %jdbc(phoenix)
    SELECT
      PUBLIC_YEAR as "Year",
      (PUBLIC_YEAR + 99) / 100 as "Century",
      COUNT(*) as "Count"
    FROM BEST_BOOKS
    GROUP BY PUBLIC_YEAR
    NOTE
    This query uses the BEST_BOOKS table. Its creation is described in Bulk loading in Phoenix. If you did not create this table, you can run any other query on your Phoenix tables.
  6. To run the code, click Run this paragraph.

    Running the code
    Running the code
    Running the code
    Running the code
  7. View the query results in the table form.

    Results table
    Results table
    Results table
    Results table
    TIP

    You can also use other result visualization types. To do this, click the icon that corresponds to the specified view mode, expand the settings pane, and distribute output fields of your query between available axes. Use drag-and-drop method for this purpose.

    Bar chart with results
    Bar chart with results
    Bar chart with results
    Bar chart with results
    Available result visualization types
    A pie chart
    A pie chart
    A pie chart
    A pie chart
    An area chart
    An area chart
    An area chart
    An area chart
    A line chart
    A line chart
    A line chart
    A line chart
    A scatter chart
    A scatter chart
    A scatter chart
    A scatter chart
  8. Create the second note paragraph to use the %phoenix interpreter. You can use the paragraph that is automatically created after successful running of the first paragraph. Or you can add a new paragraph by clicking the Add Paragraph button that becomes visible on hover.

    Adding a new note paragraph
    Adding a new note paragraph
    Adding a new note paragraph
    Adding a new note paragraph
  9. Enter the following code in the second paragraph and run it. This query returns the rows count from the BEST_BOOKS table.

    %phoenix
    SELECT COUNT(*)
    FROM BEST_BOOKS
    Running the code
    Running the code
    Running the code
    Running the code
Found a mistake? Seleсt text and press Ctrl+Enter to report it