С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.

    note phoenix 01 dark
    Adding a new note
    note phoenix 01 light
    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.

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

    note phoenix 03 dark
    Interpreters binding
    note phoenix 03 light
    Interpreters binding
  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.
    note phoenix 04 dark
    Binding necessary interpreters
    note phoenix 04 light
    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.

    note phoenix 05 dark
    Running the code
    note phoenix 05 light
    Running the code
  7. View the query results in the table form.

    note phoenix 06 dark
    Results table
    note phoenix 06 light
    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.

    note phoenix 07 dark
    Bar chart with results
    note phoenix 07 light
    Bar chart with results
    Available result visualization types
    note phoenix 08 dark
    A pie chart
    note phoenix 08 light
    A pie chart
    note phoenix 09 dark
    An area chart
    note phoenix 09 light
    An area chart
    note phoenix 10 dark
    A line chart
    note phoenix 10 light
    A line chart
    note phoenix 11 dark
    A scatter chart
    note phoenix 11 light
    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.

    note phoenix 13 dark
    Adding a new note paragraph
    note phoenix 13 light
    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
    note phoenix 12 dark
    Running the code
    note phoenix 12 light
    Running the code
Found a mistake? Seleсt text and press Ctrl+Enter to report it