Description
Add a --url (alias -u) flag to fetch data directly from HTTP/HTTPS URLs without requiring curl.
# Fetch CSV directly from URL
sql-pipe --url https://example.com/data.csv 'SELECT * FROM t'
# Fetch JSON from API
sql-pipe --url "https://api.github.com/repos/owner/repo/issues" -I json 'SELECT * FROM t'
# With custom headers
sql-pipe --url https://api.example.com/data.json -H "Authorization: Bearer token" 'SELECT * FROM t'
Motivation
The README already shows 6+ examples using curl | sql-pipe. Baking HTTP fetching into sql-pipe eliminates the curl dependency (especially beneficial for Windows users), reduces pipe ceremony, and enables automatic format detection via Content-Type response headers.
Acceptance Criteria
Implementation Notes
- Zig 0.16 has
std.http.Client — no external HTTP library needed
- TLS certificate handling is the main challenge across platforms
- Can be combined with
-I for explicit format override
- Consider caching downloaded content to disk for large files (future enhancement)
- Estimated effort: 1 day
Description
Add a
--url(alias-u) flag to fetch data directly from HTTP/HTTPS URLs without requiringcurl.Motivation
The README already shows 6+ examples using
curl | sql-pipe. Baking HTTP fetching into sql-pipe eliminates thecurldependency (especially beneficial for Windows users), reduces pipe ceremony, and enables automatic format detection viaContent-Typeresponse headers.Acceptance Criteria
--url <url>(alias-u) flag is parsed inargs.zigstd.http.ClientContent-Typeheader (fallback to URL extension)-H/--headerflag for custom HTTP headers (e.g., Authorization)--timeoutflag for request timeout (default: 30s)/etc/ssl/certson Linux)Implementation Notes
std.http.Client— no external HTTP library needed-Ifor explicit format override