Skip to content

Commit b105508

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/main'
2 parents 22b8e99 + f7fbeb3 commit b105508

File tree

1 file changed

+68
-1
lines changed

1 file changed

+68
-1
lines changed

docs/README.md

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,70 @@
1+
<img src="https://github.com/user-attachments/assets/46a5c546-7e9b-42c7-87f4-bc8defe674e0" width=250 />
2+
13
# DuckDB HTTP Client Extension
4+
This very experimental extension spawns an HTTP Client from within DuckDB resolving GET/POST requests.<br>
5+
6+
> Experimental: USE AT YOUR OWN RISK!
7+
8+
### GET
9+
```sql
10+
D SET autoinstall_known_extensions=1; SET autoload_known_extensions=1;
11+
D WITH __input AS (
12+
SELECT
13+
http_get(
14+
'https://earth-search.aws.element84.com/v0/search')
15+
AS data
16+
),
17+
__features AS (
18+
SELECT
19+
unnest( from_json((data::JSON)->'features', '["json"]') )
20+
AS features
21+
FROM
22+
__input
23+
)
24+
SELECT
25+
features->>'id' AS id,
26+
features->'properties'->>'sentinel:product_id' AS product_id,
27+
concat(
28+
'T',
29+
features->'properties'->>'sentinel:utm_zone',
30+
features->'properties'->>'sentinel:latitude_band',
31+
features->'properties'->>'sentinel:grid_square'
32+
) AS grid_id,
33+
ST_GeomFromGeoJSON(features->'geometry') AS geom
34+
FROM
35+
__features
36+
;
37+
┌──────────────────────┬──────────────────────┬─────────┬──────────────────────────────────────────────────────────────────────────────────┐
38+
│ id │ product_id │ grid_id │ geom │
39+
varcharvarcharvarchar │ geometry │
40+
├──────────────────────┼──────────────────────┼─────────┼──────────────────────────────────────────────────────────────────────────────────┤
41+
│ S2B_55GDP_20241003… │ S2B_MSIL2A_2024100… │ T55GDP │ POLYGON ((146.7963024570636 -42.53859799130381, 145.7818492341335 -42.53284395… │
42+
│ S2B_55HEC_20241003… │ S2B_MSIL2A_2024100… │ T55HEC │ POLYGON ((146.9997932100229 -34.429312828654396, 146.9997955899612 -33.4390429… │
43+
│ S2B_55JHN_20241003… │ S2B_MSIL2A_2024100… │ T55JHN │ POLYGON ((149.9810192714723 -25.374826158099584, 149.9573295859729 -24.3845516… │
44+
│ S2B_15MWT_20230506… │ S2B_MSIL2A_2023050… │ T15MWT │ POLYGON ((-92.01266261624052 -2.357695714729873, -92.0560908879947 -2.35076658… │
45+
│ S2B_16PBT_20230506… │ S2B_MSIL2A_2023050… │ T16PBT │ POLYGON ((-88.74518736203468 11.690012668805194, -88.9516536515512 11.72635252… │
46+
│ S2B_16PCT_20230506… │ S2B_MSIL2A_2023050… │ T16PCT │ POLYGON ((-87.82703591176752 11.483638069337541, -88.8349824533826 11.70734355… │
47+
│ S2B_15PZP_20230506… │ S2B_MSIL2A_2023050… │ T15PZP │ POLYGON ((-89.24113885498912 11.784951995968179, -89.38831685490888 11.8080246… │
48+
│ S2B_16PET_20230506… │ S2B_MSIL2A_2023050… │ T16PET │ POLYGON ((-87.00017408768262 11.277451946475995, -87.00017438483464 11.7600349… │
49+
│ S2B_16PBU_20230506… │ S2B_MSIL2A_2023050… │ T16PBU │ POLYGON ((-88.74518962519173 11.690373971442378, -89.62017907866615 11.8466519… │
50+
│ S2B_16PDU_20230506… │ S2B_MSIL2A_2023050… │ T16PDU │ POLYGON ((-87.91783982214183 11.670141095427311, -87.92096676562824 12.5828090… │
51+
├──────────────────────┴──────────────────────┴─────────┴──────────────────────────────────────────────────────────────────────────────────┤
52+
10 rows 4 columns │
53+
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
54+
```
55+
56+
### POST (WIP)
57+
```sql
58+
D SELECT
59+
http_post(
60+
'https://some.server',
61+
headers => MAP {
62+
'Content-Type': 'application/json',
63+
}::VARCHAR,
64+
params => MAP {
65+
'limit': 1
66+
}::VARCHAR
67+
)
68+
AS data;
69+
```
270

3-
Experimental HTTP Client Community Extension

0 commit comments

Comments
 (0)