Tutorial: Convert an ingestion spec for SQL-based ingestion

    If you’re already ingesting data with native batch ingestion, you can use the to convert the ingestion spec to a SQL query that the multi-stage query task engine can use to ingest data.

    This tutorial demonstrates how to convert the ingestion spec to a query task in the web console.

    To convert the ingestion spec to a query task, do the following:

    1. Click the ellipsis icon and select Convert ingestion spec to SQL.

    2. In the Ingestion spec to covert window, insert your ingestion spec. You can use your own spec or the sample ingestion spec provided in the tutorial. The sample spec uses data hosted at and loads it into a table named wikipedia:

      Show the spec

    3. Show the query

      1. -- This SQL query was auto generated from an ingestion spec
      2. REPLACE INTO wikipedia OVERWRITE ALL
      3. WITH source AS (SELECT * FROM TABLE(
      4. EXTERN(
      5. '{"type":"http","uris":["https://druid.apache.org/data/wikipedia.json.gz"]}',
      6. '{"type":"json"}',
      7. '[{"name":"timestamp","type":"string"},{"name":"isRobot","type":"string"},{"name":"channel","type":"string"},{"name":"flags","type":"string"},{"name":"isUnpatrolled","type":"string"},{"name":"page","type":"string"},{"name":"diffUrl","type":"string"},{"name":"added","type":"long"},{"name":"comment","type":"string"},{"name":"commentLength","type":"long"},{"name":"isNew","type":"string"},{"name":"isMinor","type":"string"},{"name":"delta","type":"long"},{"name":"isAnonymous","type":"string"},{"name":"user","type":"string"},{"name":"deltaBucket","type":"long"},{"name":"deleted","type":"long"},{"name":"namespace","type":"string"},{"name":"cityName","type":"string"},{"name":"countryName","type":"string"},{"name":"regionIsoCode","type":"string"},{"name":"metroCode","type":"string"},{"name":"countryIsoCode","type":"string"},{"name":"regionName","type":"string"}]'
      8. )
      9. ))
      10. "isRobot",
      11. "channel",
      12. "flags",
      13. "isUnpatrolled",
      14. "page",
      15. "diffUrl",
      16. "added",
      17. "comment",
      18. "commentLength",
      19. "isNew",
      20. "isMinor",
      21. "user",
      22. "deltaBucket",
      23. "deleted",
      24. "namespace",
      25. "cityName",
      26. "countryName",
      27. "regionIsoCode",
      28. "metroCode",
      29. "countryIsoCode",
      30. "regionName"
      31. PARTITIONED BY DAY
    4. Review the generated SQL query to make sure it matches your requirements and does what you expect.