HTTP client extension for DuckDB with GET/POST/PUT/PATCH/DELETE and byte-range requests
Maintainer(s):
onnimonni
Installing and Loading
INSTALL http_request FROM community;
LOAD http_request;
Example
-- Simple GET request
SELECT http_get('https://example.com/');
-- Access response fields
SELECT
r.status,
r.content_type,
r.content_length,
r.cookies[1].name as first_cookie
FROM (SELECT http_get('https://example.com/') as r);
-- GET with custom headers
SELECT http_get('https://httpbin.org/get', headers := {'Accept': 'application/json'}).body;
-- Byte-range request for partial content
SELECT http_get(
'https://example.com/largefile.gz',
{'Range': byte_range(0, 1024)}
);
About http_request
HTTP client extension providing scalar and table functions for making HTTP requests.
Features:
- All HTTP methods: GET, HEAD, POST, PUT, PATCH, DELETE
- Parallel execution: requests within a chunk run concurrently
- Custom headers via STRUCT parameter
- Query parameters via STRUCT
- Byte-range requests with helper function
- Auto-decompression of gzip/zstd responses
- Form-encoded POST with http_post_form()
- Multipart/form-data uploads with http_post_multipart()
- Parsed Set-Cookie headers into structured cookies array
- Convenience fields: content_type, content_length
- Respects duckdb http and proxy settings
- Configurable concurrency via http_max_concurrency setting (default: 32)
Uses DuckDB's built-in httplib for HTTP connections.
Added Functions
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| byte_range | scalar | NULL | NULL | |
| http_delete | scalar | NULL | NULL | |
| http_delete | table | NULL | NULL | |
| http_get | scalar | NULL | NULL | |
| http_get | table | NULL | NULL | |
| http_head | scalar | NULL | NULL | |
| http_head | table | NULL | NULL | |
| http_patch | scalar | NULL | NULL | |
| http_patch | table | NULL | NULL | |
| http_post | scalar | NULL | NULL | |
| http_post | table | NULL | NULL | |
| http_post_form | scalar | NULL | NULL | |
| http_post_form | table | NULL | NULL | |
| http_post_multipart | scalar | NULL | NULL | |
| http_post_multipart | table | NULL | NULL | |
| http_put | scalar | NULL | NULL | |
| http_put | table | NULL | NULL | |
| http_range_header | scalar | NULL | NULL |
Added Settings
| name | description | input_type | scope | aliases |
|---|---|---|---|---|
| http_max_concurrency | Maximum number of concurrent HTTP requests per scalar function call (default: 32) | UBIGINT | GLOBAL | [] |