Skip to main content

Data Sources

Evidence supports connecting to a database, or local data files.

Connect your data

To connect your local development environment to a database:

  1. Run your evidence project with npm run dev
  2. Navigate to localhost:3000/settings
  3. Select your database and enter your credentials

Evidence will save your credentials locally, and run a test query to confirm that it can connect.

Supported data sources

Evidence supports:

We're adding new connectors regularly. Create a GitHub issue or send us a message in Slack if you'd like to use Evidence with a database that isn't currently supported.

Local Data Files

In Evidence, you can query local CSV files directly in SQL.

Get started by selecting the CSV connector on the Settings page in your project.

How to Query a CSV File

Inside your Evidence Project

Evidence looks for CSV files stored in a sources folder in the root of your Evidence project. You can then query them using this syntax:

select * from 'sources/myfile.csv'

Absolute Filepaths

You can pass in an absolute filepath:

select * from 'Users/myname/Downloads/myfile.csv'

Relative Filepaths

Paths are relative to two files deep in your Evidence project. For example, to query a CSV in the root of an Evidence project, you would use this syntax:

select * from '../../myfile.csv'

SQL Syntax for Querying CSVs

Evidence uses DuckDB to run SQL against a CSVs. For query syntax, see the DuckDB docs.

Parsing Headers

When parsing headers in CSV files, the read_csv_auto helper function provided by DuckDB can be helpful.

select * from read_csv_auto('source/myfile.csv', HEADER=TRUE);

In addition to the HEADER argument, this function can also accept changes to the delimiter (DELIM), quotes (QUOTE), and more.

Additional information about CSV helper functions can be found in the DuckDB docs.

Troubleshooting

If you need help with connecting to your data, please feel free to send us a message in Slack.