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/');
-- GET with custom headers
SELECT http_get('https://httpbin.org/get', headers := {'Accept': 'application/json'}).body;
-- POST with custom body
SELECT http_post('https://httpbin.org/get', params := {'limit': 10});
-- 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
- 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()
- Respects duckdb http and proxy settings
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_put | scalar | NULL | NULL | |
| http_put | table | NULL | NULL | |
| http_range_header | scalar | NULL | NULL |