---
sidebar_position: 5
title: Tigris
description: Query files from Tigris globally distributed object storage using MotherDuck.
---

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import CloudExecutionCallout from "./_cloud-execution-callout.mdx";

With MotherDuck, you can access files in a private Tigris bucket. Tigris is a globally distributed S3-compatible object storage service that provides low latency anywhere in the world.

## Tigris requirements

To get started using Tigris with MotherDuck, you need to:

1. Create a new bucket at [storage.new](https://storage.new) if you don't have one
2. Create an access keypair for that bucket at [storage.new/accesskey](https://storage.new/accesskey)
3. Configure MotherDuck to use Tigris
4. Query files in Tigris

When creating a bucket, you can select from different storage tiers:
- Standard (default) - Best for general use cases
- Infrequent Access - Cheaper than Standard, but charges per gigabyte of retrieval
- Instant Retrieval Archive - For long-term storage with urgent access needs
- Archive - For long-term storage where retrieval time is not critical

## Configure Tigris credentials

### Create a SECRET object

:::note
If you are using multiple secrets, the `SCOPE` parameter will make sure MotherDuck knows which one to use. You can validate which secret to use with [`which_secret`](https://duckdb.org/docs/stable/configuration/secrets_manager).

As an example, see below:

```sql
FROM which_secret('s3://my-other-bucket/file.parquet', 's3');
```

:::

<Tabs>
<TabItem value="sql" label="SQL">

```sql
CREATE OR REPLACE PERSISTENT 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',
    SCOPE 's3://my_bucket'
);

-- test Tigris credentials
SELECT count(*) FROM 's3://<bucket>/<file>';
```

</TabItem>
<TabItem value="python" label="Python">

```python
import duckdb

con = duckdb.connect('md:')
con.sql("""
    CREATE OR REPLACE PERSISTENT 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',
        SCOPE 's3://my_bucket'
    )
""")

# test Tigris
con.sql("SELECT count(*) FROM 's3://<bucket>/<file>'").show()
```

</TabItem>
<TabItem value="ui" label="UI">

Adding Tigris secrets through the UI is not supported. Please add them using SQL statements.

</TabItem>
</Tabs>

### Delete a SECRET object

<Tabs>
<TabItem value="sql" label="SQL">

```sql
DROP SECRET tigris;
```

</TabItem>
</Tabs>

### Tigris credentials as **temporary** secrets

You can also create temporary secrets that are not persisted across sessions:

```sql
CREATE OR REPLACE SECRET (
    TYPE s3,
    PROVIDER config,
    KEY_ID 'tid_access_key_id',
    SECRET 'tsec_secret_access_key',
    REGION 'auto',
    ENDPOINT 't3.storage.dev',
    URL_STYLE 'vhost'
);
```

:::note
Local/In-memory secrets are not persisted across sessions.
:::

<CloudExecutionCallout provider="Tigris" />

