Tutorial: Load files with SQL-based ingestion

    This tutorial demonstrates how to generate a query that references externally hosted data using the Connect external data wizard.

    The following example uses EXTERN to query a JSON file located at https://druid.apache.org/data/wikipedia.json.gz.

    Although you can manually create a query in the UI, you can use Druid to generate a base query for you that you can modify to meet your requirements.

    To generate a query from external data, do the following:

    1. In the Query view of the web console, click Connect external data.

    2. On the Parse screen, you can perform additional actions before you load the data into Druid:

      • Expand a row to see what data it corresponds to from the source.
      • Customize how Druid handles the data by selecting the Input format and its related options, such as adding JSON parser features for JSON files.
    3. When you’re ready, click Done. You’re returned to the Query view where you can see the starter query that will insert the data from the external source into a table named .

      Show the query

    4. Optionally, select Preview to review the data before you ingest it. A preview runs the query without the REPLACE INTO clause and with an added LIMIT. You can see the general shape of the data before you commit to inserting it. The LIMITs make the query run faster but can cause incomplete results.

    5. Click Run to launch your query. The query returns information including its duration and the number of rows inserted into the table.

    You can query the table after the ingestion completes. For example, you can analyze the data in the table to produce a list of top channels:

    With the EXTERN function, you could run the same query on the external data directly without ingesting it first:

    Show the query

    Further reading