Sources
CSV files
How to connect to CSV files
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
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:
- Create a query
.sql
in thequeries
directory that points to the CSV file in theFROM
clause using theread_csv_auto()
DuckDB function. Here’s an example:
- Use the command line to run
latitude run query_file_name
wherequery_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.