---
title: "Reading files in DuckDB"
description: "DuckDB can read CSV, Parquet, JSON, and other file formats directly with SQL table functions, whether the files are local, remote over HTTP/S3, or matched in bulk with a glob pattern."
canonical: "https://motherduck.com/glossary/reading-files-in-duckdb/"
related:
  - title: "Querying Files in Amazon S3 | MotherDuck Docs"
    url: "https://motherduck.com/docs/key-tasks/cloud-storage/querying-s3-files/"
  - title: "Analyze JSON Data Using SQL and DuckDB"
    url: "https://motherduck.com/blog/analyze-json-data-using-sql/"
  - title: "File Formats | MotherDuck Docs"
    url: "https://motherduck.com/docs/integrations/file-formats/"
---

# Reading files in DuckDB

> DuckDB can read CSV, Parquet, JSON, and other file formats directly with SQL table functions, whether the files are local, remote over HTTP/S3, or matched in bulk with a glob pattern.

## Overview

One of DuckDB's core strengths is querying files directly as tables without a separate load or import step. Table functions like `read_csv`, `read_parquet`, and `read_json` (along with format-inferring shortcuts) let you point SQL at a file path — local or remote — and query it immediately.

```sql
SELECT * FROM read_csv('events.csv');
SELECT * FROM read_parquet('orders.parquet');
SELECT * FROM read_json('logs.json');

-- DuckDB also infers the reader from a bare path in some contexts
SELECT * FROM 'orders.parquet';
```

<glossary-callout guide="duckdb-book-brief" />

## Reading many files at once

Any of these functions accept a glob pattern or a list of paths to treat multiple files as one logical table:

```sql
SELECT * FROM read_parquet('data/*.parquet');
SELECT * FROM read_csv(['jan.csv', 'feb.csv', 'mar.csv']);
```

Passing `union_by_name := true` to `read_parquet` or `read_csv` lets DuckDB reconcile files whose columns don't appear in the same order (or aren't all present), aligning them by column name instead of position.

## Reading remote files

With the `httpfs` extension loaded, the same functions work against HTTP(S) URLs and S3-compatible, Azure, or GCS object storage paths, using credentials configured via `CREATE SECRET`:

```sql
SELECT * FROM read_parquet('s3://my-bucket/data/*.parquet');
```

## Format-specific options

Each reader function accepts format-specific parameters — for example, `read_csv` supports `delim`, `header`, `columns` (to specify types explicitly), and `sample_size` (controls how much data is scanned for type inference), while `read_parquet` supports `hive_partitioning` to recognize `key=value` directory structures as columns. `SUMMARIZE SELECT * FROM read_parquet('orders.parquet')` is a quick way to get summary statistics for every column in a file without writing your own aggregation query.

## Why it matters

Because these are ordinary SQL table functions, they can be filtered, joined, and aggregated in the same query, and results can be materialized into a table with `CREATE TABLE AS SELECT` — turning "reading a file" and "querying data" into the same operation.
