Quickstart
This guide shows how to run Scratch Data locally, connect it to your database, and stream data to and from your database.
Run Scratch Data
Download the latest version of Scratch Data for your platform:
Then run the command:
Congratulations! You now have a local instance of Scratch ready to accept data. By default, this sets up a local database (DuckDB).
Read and Write Data
Now that we have Scratch running, let's insert some data:
curl -X POST "http://localhost:8080/api/data/insert/events?api_key=local" \
--data '{"user": "alice", "event": "click"}'
Notice how we never created a table? Scratch Data does this automatically. By sending data, the software automatically creates an "events" table with "user" and "event" columns.
We can query just as easily:
curl -G "http://localhost:8080/api/data/query" \
--data-urlencode "api_key=local" \
--data-urlencode "query=select * from events"
This will output the following:
Summary
That's it! With this quickstart, you've been able to download and run Scratch Data, connect an analytics database (in this case, a local DuckDB file), and use REST to stream data in and out.
The rest of the documentation will describe how to connect other databases, along with other configuration options for the server.