Skip to content

A minimal HTTP proxy server for DuckDB in 50 lines of YAML.

License

Notifications You must be signed in to change notification settings

gramian/duckhttp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DuckHTTP

DuckHTTP is a minimal HTTP proxy server for DuckDB in 50 lines of YAML.

Getting Started

1. Build and start the DuckHTTP service

docker compose up --build

2a. Send query via browser

http://localhost:3000/"SELECT 'world' AS hello;"

Try Firefox as it is very lenient on URL inputs and renders JSON responses nicely.

2b. Send query via terminal

wget -qO- http://localhost:3000/"SELECT 'world' AS hello;"
curl "http://localhost:3000/%22SELECT%20%27world%27%20AS%20hello%3B%22"

Details

  • Dependencies: docker compose
  • Container: The image build process downloads DuckDB and the HTTP server.
  • HTTP Server: bento (also compatible to connect/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 []

Known Issues

  • Some HTTP Clients may need to URL-encode the query.
  • Earlier compose versions cannot handle inline Dockerfiles. In this case copy the content of the dockerfile_inline property into a file names Dockerfile and make double dollars into single dollar.
  • bento is used instead of benthos as it provides pre-build binaries.
  • After an error in a query the subsequent query can contain results from the previous query.

About

A minimal HTTP proxy server for DuckDB in 50 lines of YAML.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages