# DuckDB

[DuckDB](https://duckdb.org) is an in-process embedded analytical database optimized for fast queries, ease of use, and embedding efficient analytics inside existing applications. It's the SQLite for analytics, but with a stronger focus on data analytics, aggregation, and Online Analytical Processing (OLAP) queries. Tigris dynamically distributes your data based on access patterns and handles lots of small files efficiently, enabling additional performance gains while using DuckDB.

If you want a full SQL lakehouse on top of Tigris — with tables, transactions, snapshots, and time travel rather than ad-hoc queries against files in a bucket — see the [DuckLake guide](/docs/quickstarts/ducklake/.md). [DuckLake](https://github.com/duckdb/ducklake) stores data as Parquet files in your bucket and metadata in a separate SQL database, so you get an open lakehouse without the file-based-catalog complexity of Iceberg or Delta.

## Prerequisites[​](#prerequisites "Direct link to Prerequisites")

Make sure you have the following information from your Tigris account:

* Tigris **Access Key ID**
* Tigris **Secret Access Key**
* Tigris **Endpoint** (e.g., `https://t3.storage.dev`)
* Tigris **Bucket Name**

If you don't yet have access credentials, follow the steps in the [Access Key guide](/docs/iam/manage-access-key/.md#create-an-access-key) to create one.

## Configure DuckDB to use Tigris[​](#configure-duckdb-to-use-tigris "Direct link to Configure DuckDB to use Tigris")

Open the DuckDB command line in your terminal:

```
$ duckdb

v1.2.2 7c039464e4

Enter ".help" for usage hints.

Connected to a transient in-memory database.

Use ".open FILENAME" to reopen on a persistent database.

D
```

Create a new secret with the `CREATE SECRET` command:

```
CREATE OR REPLACE SECRET tigris

  (      TYPE  s3

  ,  PROVIDER  config

  ,    KEY_ID  'tid_access_key_id'

  ,    SECRET  'tsec_secret_access_key'

  ,    REGION  'auto'

  ,  ENDPOINT  't3.storage.dev'

  , URL_STYLE  'vhost'

  );
```

## Query files in DuckDB[​](#query-files-in-duckdb "Direct link to Query files in DuckDB")

Once you're in, you can query files in your bucket like you would normally, just open them with the `s3://<bucketname>` prefix. For example, you can import the data from the [LinkedIn Data Jobs Dataset](https://www.kaggle.com/datasets/joykimaiyo18/linkedin-data-jobs-dataset) by creating a local table like this:

```
CREATE TABLE IF NOT EXISTS jobs

  ( id               INT64  NOT NULL

  , title            TEXT   NOT NULL

  , company          TEXT   NOT NULL

  , "location"       TEXT   NOT NULL

  , link             TEXT   NOT NULL

  , source           TEXT   NOT NULL

  , date_posted      DATE   NOT NULL

  , work_type        TEXT   NOT NULL

  , employment_type  TEXT   NOT NULL

  , "description"    TEXT   NOT NULL

  );
```

And then importing the data from Tigris:

```
INSERT INTO jobs

SELECT * FROM

  READ_CSV

    ( 's3://xe-duckdb/clean_jobs.csv'

    , header = true

    , columns =

      {              'id': 'INT64'

      ,           'title': 'TEXT'

      ,         'company': 'TEXT'

      ,        'location': 'TEXT'

      ,            'link': 'TEXT'

      ,          'source': 'TEXT'

      ,     'date_posted': 'DATE'

      ,       'work_type': 'TEXT'

      , 'employment_type': 'TEXT'

      ,     'description': 'TEXT'

      }

    );
```

Now you can query it like normal:

```
SELECT

  *

FROM

  jobs

WHERE

  location LIKE 'Seattle%';
```

## Further reading[​](#further-reading "Direct link to Further reading")

* [DuckLake on Tigris](/docs/quickstarts/ducklake/.md) — build a SQL lakehouse on Tigris with tables, transactions, and snapshots instead of ad-hoc queries against files.
* [Get your data ducks in a row with DuckLake](https://www.tigrisdata.com/blog/ducklake/) — why DuckLake matters, with a longer walkthrough.
* [Data Time Travel with DuckLake and Tigris](https://www.tigrisdata.com/blog/ducklake-time-travel/) — using DuckLake snapshots to roll back changes and fork timelines.
* [Fending off scrapers with Tigris and DuckDB](https://www.tigrisdata.com/blog/anubis/) — analyzing honeypot logs in Tigris with DuckDB.
* [Fifty agents for the price of one bucket](https://www.tigrisdata.com/blog/fifty-agents-one-bucket/) — using DuckDB alongside LanceDB for agent memory and SQL analytics over a single Lance file.
