In an initial attempt at using ducksql queries with the pre-release, I attempted to run using the image from ghcr, like this:
docker run --rm -p "12321:12321" -v $(pwd)/duck.yaml:/data/duck.yaml ghcr.io/proofrock/ws4sql:latest -c /data/duck.yaml
However, I probably got something wrong because I got this complaint:
exec /ws4sql: no such file or directory
I used the following duck.yaml file, intending to use an in-memory database:
database:
type: DUCKDB
inMemory: true
id: duckserve
# disableWALMode: true
readOnly: false
auth:
mode: HTTP
byCredentials:
- user: ducky
password: duckz
readOnly: false
#corsOrigin: https://myownsite.com
storedStatements:
- id: Q0
sql: |
select 42
- id: Q1
sql: |
select range(10) as a, 'one-to-ten' as b
- id: Q2
sql: >
from read_csv_auto('https://csvbase.com/kinder/list-of-user-agents')
- id: Q3
sql: |
from read_json_auto('https://api.openalex.org/works/W4388315306')
- id: Q4
sql: |
install tpch; load tpch; call tpch_queries()
initStatements:
- load json
I attempted another way, getting the binary into a another local container, like so:
FROM ghcr.io/proofrock/ws4sql:latest AS build
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
wget \
curl
COPY --from=build /ws4sql /usr/local/bin
RUN chmod +x /usr/local/bin/ws4sql
EXPOSE 12321
VOLUME /data
WORKDIR /data
ENTRYPOINT ["ws4sql"]
CMD ["--help"]
After building the ws4sql container locally and starting the service with docker run -it --rm -v $(pwd)/duck.yaml:/data/duck.yaml -p "12321:12321" ws4sql -db duck.yaml I could issue requests like
curl -s -X POST \
--user ducky:duckz \
--header 'Content-Type: application/json' \
--data '{"transaction": [{"query": "#Q1" }]}' \
http://localhost:12321/duckserve
It worked nicely for queries 0, 1, 2 in that .yaml file!
In an initial attempt at using ducksql queries with the pre-release, I attempted to run using the image from ghcr, like this:
However, I probably got something wrong because I got this complaint:
exec /ws4sql: no such file or directoryI used the following
duck.yamlfile, intending to use an in-memory database:I attempted another way, getting the binary into a another local container, like so:
After building the ws4sql container locally and starting the service with
docker run -it --rm -v $(pwd)/duck.yaml:/data/duck.yaml -p "12321:12321" ws4sql -db duck.yamlI could issue requests likecurl -s -X POST \ --user ducky:duckz \ --header 'Content-Type: application/json' \ --data '{"transaction": [{"query": "#Q1" }]}' \ http://localhost:12321/duckserveIt worked nicely for queries 0, 1, 2 in that .yaml file!