DuckHTTP is a minimal HTTP proxy server for DuckDB in 50 lines of YAML.
docker compose up --build
http://localhost:3000/"SELECT 'world' AS hello;"
Try Firefox
as it is very lenient on URL inputs and renders JSON responses nicely.
wget -qO- http://localhost:3000/"SELECT 'world' AS hello;"
curl "http://localhost:3000/%22SELECT%20%27world%27%20AS%20hello%3B%22"
- Dependencies:
docker compose
- Container: The image build process downloads DuckDB and the HTTP server.
- HTTP Server:
bento
(also compatible toconnect
/benthos
) - DuckDB Client API: The CLI is used via the
subprocess
processor. - Default Port:
3000
- Endpoint: The query is placed in the URL right after the domain and wrapped in double quotes of a HTTP
GET
request. - Responses: A response in JSON and consists on the top level out of an array with each element corresponding to a SQL statement that has a return value,
SQL statements without a return value will not appear:
SELECT 1;
returns[[{"1":1}]]
ANALYZE; SELECT 1;
returns[[{"1":1}]]
SELECT 1; SELECT 2;
returns[[{"1":1}],[{"2":2}]]
ANALYZE;
returns[]
- Some HTTP Clients may need to URL-encode the query.
- Earlier
compose
versions cannot handle inline Dockerfiles. In this case copy the content of thedockerfile_inline
property into a file namesDockerfile
and make double dollars into single dollar. bento
is used instead ofbenthos
as it provides pre-build binaries.- After an error in a query the subsequent query can contain results from the previous query.