Works with v1.0+
This recipe will show how to configure a Grafana dashboard to use Spice as the data source using the Infinity plugin.
This recipe requires Docker and Docker Compose to be installed.
Install spice 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-datasourceIn one terminal, run the Spice runtime locally from this directory:
spice runSpice 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.
-
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".

-
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/jsonas 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

