Creating a simple data app
sources
directory.
For this guide, we’ll use the CSV that comes with the sample project, but you can replace that with any other CSV or connect to a live database following these instructions.
Go ahead and download the sample CSV and save it in the queries
directory as source.csv
.
Cmd + S
or Ctrl + S
to save the filesample.sql
in the queries
directory and write the following query:
source.csv
file using the DuckDB adapter that’s configured by default in the source.yml
file.
Next, let’s create a secondary query to aggregate some data. Create a new file named sample_agg.sql
in the queries
directory and write the following query:
ref
function is used to interpolate the sample.sql
query, and use its results as the input for this query. Latitude allows you to chain queries together very easily, find out more about this in the queries reference.
To check that your queries are working as expected, you can run them locally using the latitude run
command. For example:
/queries/sample_agg.sql
query once and display the results in your terminal.
Learn more about latitude run
in the CLI reference.
index.html
file in your text editor and replace the content with the following:
http://localhost:3000
and you should see a working data app with a line chart displaying the number of titles released over time and a table with the raw data.