How to configure sources

The sources files must be inside the queries/ folder.

To know how the source hierarchy works, please, visit How to configure sources.

Configuration

To use CSV files directly within a Latitude project, we use the DuckDB adapter. Make sure to configure the connection through DuckDB by following these steps:

1

Create the source `.yaml` file within the `queries` folder if you haven't already

/queries/source.yml

2

Add the following code for your DuckDB connection

type: duckdb
3

Done, now you can test your connection

Add your files

Simply add your CSV files anywhere in the queries directory. You can also create subdirectories to organize your files.

Test connection

To test the connection you can:

  1. Create a query .sql in the queries directory that points to the CSV file in the FROM clause using the read_csv_auto() DuckDB function. Here’s an example:
SELECT *
FROM read_csv_auto('queries/file.csv')
  1. Use the command line to run latitude run query_file_name where query_file_name is the name of your .sql file. This will display the results in your terminal. See the section Running queries to learn more about how to query your data.