Published Apr 2024

Cookbook recipes to get up and running with Spice.ai quickly 馃殌
spice add spiceai/cookbook-grafana-datasource-recipespice connect spiceai/cookbook-grafana-datasource-recipedependencies:
- spiceai/cookbook-grafana-datasource-recipetaxi trips in s3
version: v1
kind: Spicepod
name: grafana
datasets:
- from: s3://spiceai-demo-datasets/taxi_trips/2024/
name: taxi_trips
description: taxi trips in s3
params:
file_format: parquet
acceleration:
enabled: true
refresh_mode: full
Works with v1.0+
This recipe will show how to configure a Grafana dashboard to use Spice as the data source using the Infinity (opens in a new tab) plugin.
This recipe requires Docker (opens in a new tab) and Docker Compose (opens in a new tab) to be installed.
Install spice (opens in a new tab) locally so you can run the Spice runtime on your machine.
Clone the spiceai/cookbook repository and navigate to the grafana-datasource directory:
git clone https://github.com/spiceai/cookbook.git
cd cookbook/grafana-datasource
In one terminal, run the Spice runtime locally from this directory:
spice run
Spice will load the datasets defined in spicepod.yaml and listen on localhost:8090.
Open a second terminal and run the following command to start Grafana in Docker:
make
Open Grafana in your browser at http://localhost:3000 (opens in a new tab).
Log in with the default credentials admin/admin, skip the password change prompt.

Navigate to Administation -> Plugins and data -> Plugins.
Select "State: All", and search for "Infinity". Install and click on "Add new data source".

Leave the default values and click on "Save & Test".

Click on "Build a dashboard" and add a new visualization. Select "Infinity" from the list of data sources.
Change "Method" to "POST" and "URL" to http://localhost:8090/v1/sql.
Add SQL query in body, using "Raw" mode:
SELECT to_timestamp(tpep_dropoff_datetime), fare_amount FROM public.taxi_trips LIMIT 100
Add the header Accept: application/json as well.
Set visualization to Table

Press Ctrl+C in the terminal running spice run to stop the Spice runtime.
To stop and remove the Docker containers/volumes that were created, run:
make clean
Published Apr 2024
Published Sep 2024
Published Sep 2024
Published Sep 2024