---
title: "Csv@2"
description: "Csv@2 — CSV files loaded into an in-memory DuckDB database, full SQL, no driver needed"
url: "https://docs.justcat.it/reference/data-sources/providers/csv-2/"
---
# Csv@2


## Connects to

CSV files. CAT loads each file into a table of an in-memory DuckDB database — once for each executing thread (by default once only) — and the queries run against those tables. The data is removed from memory after all tests are evaluated.

## Example


**Properties**



Name
: FinancialData

Provider
: Csv@2

Technology
: Csv

Connection string
: DataToTest\Invoices.csv





**YAML**


```yaml
Data sources:
- Name: FinancialData
  Provider: Csv@2
  Technology: Csv
  Connection string: DataToTest\Invoices.csv
```




Each file becomes a table named `"<data source name>"."<file name without extension>"` — here `"FinancialData"."Invoices"`.

## Connection string

A path, or a list of paths, to CSV files — any of:

* an absolute path to a CSV file;
* a relative path to a CSV file — resolved against the directory of the `.cat.yaml` project file;
* an absolute or relative path with the wildcard `*` — allowed only in the file name, no recursion into subdirectories;
* several of the above, separated by commas.


**Properties**



Name
: My CSV data

Provider
: Csv@2

Technology
: Csv

Connection string
: ```
  DataToTest\*.csv,
  D:\Export\Financial\Invoices-2024.csv
  ```





**YAML**


```yaml
Data sources:
- Name: My CSV data
  Provider: Csv@2
  Technology: Csv
  Connection string: >
     DataToTest\*.csv,
     D:\Export\Financial\Invoices-2024.csv
```




Every file that matches is loaded into a separate table; the files are **not** combined into one. If `DataToTest` holds `Summary-2023.csv` and `Summary-2024.csv`, a query can combine them itself:

```sql
SELECT * FROM "My CSV data"."Summary-2023"
UNION ALL
SELECT * FROM "My CSV data"."Summary-2024"
```

## Settings

| Setting | Default | Meaning |
|---|---|---|
| `Settings` | `auto_detect = true` | Options for DuckDB's CSV reader, written as one comma-separated list — delimiter, header row, compression, quoting, types … Every option of <a href="https://duckdb.org/docs/data/csv/overview.html#parameters" target="_blank">DuckDB `read_csv`</a> is accepted; CAT hands the string over as it is. |


**Properties**



Name
: FinancialData

Provider
: Csv@2

Technology
: Csv

Connection string
: DataToTest\Invoices.csv

Settings
: delim = '|', header = true, compression = 'gzip'





**YAML**


```yaml
Data sources:
- Name: FinancialData
  Provider: Csv@2
  Technology: Csv
  Connection string: DataToTest\Invoices.csv
  Settings: delim = '|', header = true, compression = 'gzip'
```




## Query

One SQL statement in DuckDB's dialect against the loaded tables — table names are `"<data source name>"."<file name without extension>"`, quoted when they contain spaces or a hyphen. Because the data sits in a database, the whole language is available: joins, grouping, CTEs, window functions, functions for dates, strings and numbers. What that looks like in practice — `SELECT`, joins and set operations, expressions, functions — is in [Query CSV and Excel data with DuckDB SQL](https://docs.justcat.it/how-to-guides/data-platforms/query-csv-and-excel-with-duckdb-sql/ "Query CSV and Excel data with DuckDB SQL"); the full reference is the <a href="https://duckdb.org/docs/stable/sql/introduction" target="_blank">DuckDB SQL documentation</a>.

## Prerequisites

DuckDB ships with CAT; Windows and Linux alike. Two things must be in place on the machine:

### Microsoft Visual C++ Redistributable (Windows)

A very common prerequisite used by much other software, so it is probably already installed. To verify or install it, go to <a href="https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170#latest-microsoft-visual-c-redistributable-version" target="_blank">Latest Microsoft Visual C++ Redistributable Version</a> and download and install the "X64" version:

![Microsoft Visual C++ Redistributable web download link](visual-cpp-redistributable.png)

If the installer shows a dialog with "Repair", "Uninstall" and "Close" buttons, just close it — the prerequisite is already there. Otherwise install it (next, next, next…).

### Internet connection

DuckDB loads its extensions from <a href="http://extensions.duckdb.org" target="_blank">http://extensions.duckdb.org</a>. The URL has to be reachable — connect to the Internet and white-list it if needed. If you need to test CSV data offline, file a request using the "Get Help" button on the right of this site.

## Limitations

* `Csv@2` cannot serve lists of test or data source definitions; `Csv@1` can.
* Needs access to `extensions.duckdb.org` at start — see Prerequisites.

## Serving test and data source definitions

`Csv@2` cannot serve lists of definitions; use [Csv@1](https://docs.justcat.it/reference/data-sources/providers/csv-1/ "Csv@1") for that.

## Related

* [Technologies](https://docs.justcat.it/reference/data-sources/technologies/ "Technologies") — CSV file and the provider behind it.
* [Csv@1](https://docs.justcat.it/reference/data-sources/providers/csv-1/ "Csv@1") — the simple CSV reader that also serves definition lists.
* [Excel@2](https://docs.justcat.it/reference/data-sources/providers/excel-2/ "Excel@2") — the same DuckDB engine over workbooks.
* [Query CSV and Excel data with DuckDB SQL](https://docs.justcat.it/how-to-guides/data-platforms/query-csv-and-excel-with-duckdb-sql/ "Query CSV and Excel data with DuckDB SQL") — the SQL you can write against the loaded tables, by example.

