Using datasets

Last updated: August 8, 2022

Using datasets in apps.

Using datasets

For typical apps on Slight, the starting point is data. A good place to find suitable data is our dataset catalog. Let's assume we like trees, so we put that in the search bar:

Datasets catalog with the term 'trees' in the search bar, and two resulting datasets. One is NYC Street Trees: Census 2015 and the other is the same but from 1995.

Clicking the link to the first brings us to the page for the dataset NYC Street Trees: Census 2015. After reading the docs, seeing what columns are available to us and looking at the data preview, we'll assume we're happy that this is a good source of data for an interesting app. It may be useful to keep this page open as a reference. If a dataset already has apps using it, those can be great inspiration for an app.

Getting the dataset ID

To use this dataset in an app, we need its ID. Here, this is bigquery-public-data/nyc_trees_census_2015. We have a few ways to get this. One is that it's the last parts of the URL, after /datasets/. Another is that it's underneath the description of the dataset, up top, where we can click to copy it to the clipboard:

Top view of the dataset page for the NYC Street Trees: Census 2015 dataset. The ID, under the description, has just been clicked, showing a tooltip saying 'Copied'

Referencing the dataset, and the Create App tab

A nice way to get started with an app from a dataset is by opening up the "Create App" tab. For the tree dataset, it'll tell us that the primary way to use this dataset in an app is to reference it as {{ @bigquery-public-data/nyc_trees_census_2015 }} where you'd normally put a table name in a query, giving us the following pseudo-SQL snippet:

Loading...

Then it links to our documentation page on writing queries for more details on referring to datasets. Another nice option is to click one of the buttons further down, as seen here:

The 'Create App' tab for the NYC Street Trees: Census 2015 dataset. Visible are the buttons 'Start with all columns' and 'Start with a simple variable'

E.g. "Start with a simple variable" opens up the "New App" page with a simple query that selects all of the variables from this table.

Seeing this in action

See our app creation tutorial for a full journey creating an app from the above dataset. To see the result, here's an app using this dataset.