http_client

DuckDB-HTTP-Client-Erweiterung

Maintainer: lmangani, ahuarte47, Okabintaro, rustyconover

Installation und Laden

INSTALL http_client FROM community;
LOAD http_client;

Beispiel

-- GET Request Example w/ JSON Parsing
WITH __input AS (
SELECT
http_get(
'https://httpbin.org/delay/0',
headers => MAP {
'accept': 'application/json',
},
params => MAP {
'limit': 1
}
) AS res
),
__response AS (
SELECT
(res->>'status')::INT AS status,
(res->>'reason') AS reason,
unnest( from_json(((res->>'body')::JSON)->'headers', '{"Host": "VARCHAR"}') ) AS features
FROM
__input
)
SELECT
__response.status,
__response.reason,
__response.Host AS host
FROM
__response
;
┌────────┬─────────┬─────────────┐
status │ reason │ host │
│ int32 │ varcharvarchar
├────────┼─────────┼─────────────┤
200 │ OK │ httpbin.org
└────────┴─────────┴─────────────┘
-- POST Request Example w/ Headers and Parameters
WITH __input AS (
SELECT
http_post(
'https://httpbin.org/delay/0',
headers => MAP {
'accept': 'application/json',
},
params => MAP {
'limit': 1
}
) AS res
),
__response AS (
SELECT
(res->>'status')::INT AS status,
(res->>'reason') AS reason,
unnest( from_json(((res->>'body')::JSON)->'headers', '{"Host": "VARCHAR"}') ) AS features
FROM
__input
)
SELECT
__response.status,
__response.reason,
__response.Host AS host,
FROM
__response
;
┌────────┬─────────┬─────────────┐
status │ reason │ host │
│ int32 │ varcharvarchar
├────────┼─────────┼─────────────┤
200 │ OK │ httpbin.org
└────────┴─────────┴─────────────┘

Über http_client

Die HTTP-Client-Erweiterung ist experimentell; die Verwendung erfolgt auf eigene Gefahr!

Hinzugefügte Funktionen

function_name function_type description comment examples
http_get scalar NULL NULL
http_head scalar NULL NULL
http_post scalar NULL NULL
http_post_form scalar NULL NULL

Überladene Funktionen

Diese Erweiterung fügt keine Funktionsüberladungen hinzu.

Hinzugefügte Typen

Diese Erweiterung fügt keine Typen hinzu.

Hinzugefügte Einstellungen

Diese Erweiterung fügt keine Einstellungen hinzu.