How to connect to CSV files
The sources files must be inside the queries/
folder.
To know how the source hierarchy works, please, visit How to configure sources.
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:
Create the source `.yaml` file within the `queries` folder if you haven't already
/queries/source.yml
Add the following code for your DuckDB connection
Done, now you can test your connection
Simply add your CSV files anywhere in the queries
directory. You can also create subdirectories to organize your files.
To test the connection you can:
.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: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.