Skip to main content
This endpoint is only available on the Pro plan.
Execute SQL queries against the oleander lake using DuckDB. All queries automatically capture lineage metadata for complete observability.
query
string
required
The SQL query to execute. Supports all DuckDB SQL syntax.
autoSaveByHash
boolean
default:"false"
Automatically save query results to a table based on the query hash. If a table with the same hash exists, returns cached results instead of re-executing.

Example Request

curl -X POST https://oleander.dev/api/v1/warehouse/query \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "WITH\n  src AS (\n    SELECT\n      *\n    FROM\n      read_json (\n        \"https://api.tvmaze.com/search/shows?q=breaking+bad\",\n        auto_detect = TRUE\n      )\n  )\nSELECT\n  src -> \"show\" ->> \"name\" AS show_name,\n  src -> \"show\" ->> \"premiered\" AS premiered,\n  src -> \"show\" -> \"rating\" ->> \"average\" AS rating,\n  src -> \"show\" -> \"network\" ->> \"name\" AS network_name\nFROM\n  src;",
    "autoSaveByHash": false
  }'

Example Response

{
  "success": true,
  "results": {
    "columns": [
      "show_name",
      "premiered",
      "rating",
      "network_name"
    ],
    "column_types": [
      "VARCHAR",
      "VARCHAR",
      "VARCHAR",
      "VARCHAR"
    ],
    "rows": [
      [
        "Breaking Bad",
        "2008-01-20",
        "9.2",
        "AMC"
      ],
      [
        "Breaking Bad: Original Minisodes",
        "2009-02-17",
        "7.0",
        "AMC"
      ]
    ]
  },
  "row_count": 9,
  "execution_time": "991ms",
  "query": "WITH\n  src AS (\n    SELECT\n      *\n    FROM\n      read_json (\n        'https://api.tvmaze.com/search/shows?q=breaking+bad',\n        auto_detect = TRUE\n      )\n  )\nSELECT\n  src -> 'show' ->> 'name' AS show_name,\n  src -> 'show' ->> 'premiered' AS premiered,\n  src -> 'show' -> 'rating' ->> 'average' AS rating,\n  src -> 'show' -> 'network' ->> 'name' AS network_name\nFROM\n  src;",
  "explainResult": {
    "success": true,
    "results": {
      "columns": [
        "explain_key",
        "explain_value"
      ],
      "column_types": [
        "VARCHAR",
        "VARCHAR"
      ],
      "rows": [
        [
          "physical_plan",
          "[{\"name\": \"PROJECTION\", ...}]"
        ]
      ]
    },
    "row_count": 1,
    "execution_time": "638ms"
  },
  "job": {
    "namespace": "oleander.lake",
    "name": "query_12b7fb65e8718d3d"
  }
}