druid/docs/tutorials/tutorial-jupyter-index.md

4.4 KiB

id title sidebar_label
tutorial-jupyter-index Jupyter Notebook tutorials Jupyter Notebook tutorials

You can try out the Druid APIs using the Jupyter Notebook-based tutorials. These tutorials provide snippets of Python code that you can use to run calls against the Druid API to complete the tutorial.

Prerequisites

The simplest way to get started is to use Docker. In this case, you only need to set up Docker Desktop. For more information, see Docker for Jupyter Notebook tutorials.

Otherwise, you can install the prerequisites on your own. Here's what you need:

  • An available Druid instance.
  • Python 3.7 or later
  • JupyterLab (recommended) or Jupyter Notebook running on a non-default port. By default, Druid and Jupyter both try to use port 8888, so start Jupyter on a different port.
  • The requests Python package
  • The druidapi Python package

For setup instructions, see Tutorial setup without using Docker. Individual tutorials may require additional Python packages, such as for visualization or streaming ingestion.

Python API for Druid

The druidapi Python package is a REST API for Druid. One of the notebooks shows how to use the Druid REST API. The others focus on other topics and use a simple set of Python wrappers around the underlying REST API. The wrappers reside in the druidapi package within the notebooks directory. While the package can be used in any Python program, the key purpose, at present, is to support these notebooks. See Introduction to the Druid Python API for an overview of the Python API.

The druidapi package is already installed in the custom Jupyter Docker container for Druid tutorials.

Tutorials

The notebooks are located in the apache/druid repo. You can either clone the repo or download the notebooks you want individually.

The links that follow are the raw GitHub URLs, so you can use them to download the notebook directly, such as with wget, or manually through your web browser. Note that if you save the file from your web browser, make sure to remove the .txt extension.