> ## Documentation Index
> Fetch the complete documentation index at: https://docs.paradime.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Admin client: warehouse connections

> Test, create, update, list and delete the warehouse connections of Bolt, agent, Code IDE and Radar environments from Python with paradime.admin.connections.

`paradime.admin.connections` manages a workspace's data warehouse connections. For the GraphQL operations, see [Warehouse connections](https://docs.paradime.io/developers/graphql-api/admin-api/warehouse-connections).

> [!NOTE]
>
> **Prerequisites**
>
> * These operations are part of the Enterprise plan. On other plans, they raise `AdminPlanUpgradeRequiredException`.
> * Your API key needs the **Warehouse connections admin** capability group. To read a connection's `environment`, the key also needs **Environment admin**.
> * The admin client of the `paradime-io` package. See [Admin client](https://docs.paradime.io/developers/python-sdk/modules/admin/index).

The examples on this page use this client:

```python theme={"system"}
from paradime import Paradime

paradime = Paradime(api_endpoint="API_ENDPOINT", api_secret="prdm_cmp_...", workspace_uid="WORKSPACE_UID")
```

## Connection scopes

Every method takes a `scope` (`ConnectionScope`) that says who uses the connection:

| Scope | Used by | `environment_slug` |
| - | - | - |
| `SCHEDULER` | A Bolt environment | Required |
| `AGENT` | A DinoAI agent environment | Required |
| `DEVELOPMENT_SHARED` | The Code IDE: the part of the development connection that every user shares | Leave it out |
| `COST` | Radar cost tracking. Its `connection_id` is always `default`. | Leave it out |

A connection is keyed by scope, environment and `connection_id`. Without a `connection_id`, the key uses `default`.

> [!NOTE]
>
> A `DEVELOPMENT_SHARED` connection holds only what the workspace shares, such as the Snowflake account and the authentication method. Each user enters their own credentials and schema in their IDE onboarding. The API refuses per-user fields with `AdminValidationFailedException`. See [Per-user fields](#per-user-fields).

## List connections

Iterates over the workspace's warehouse connections, ordered by environment slug and connection id. Secrets show only as set or not set.

**scope** `Optional[ConnectionScope]` (default: None)

Only connections of this scope.

**environment\_slug** `Optional[str]` (default: None)

Only this environment's connections.

**workspace\_uid** `Optional[str]` (default: None)

The workspace to read, for a company API key.

**page\_size** `int` (default: 100)

How many connections to read per request, at most 500.

**Returns** `Iterator[WarehouseConnection]`

The connections, read one page at a time.

```python theme={"system"}
for connection in paradime.admin.connections.list():
    print(connection.scope, connection.environment_slug, connection.connection_id, connection.type)
```

## Test a connection

Opens a connection with these settings and saves nothing. Secrets you leave out come from the saved connection. A `DEVELOPMENT_SHARED` connection holds no user's credentials, so the API refuses to test one.

**adapter** `ConnectionAdapter` *required*

The warehouse settings: one adapter's input, such as `SnowflakeConnectionInput`, or a `WarehouseAdapterInput`. See [Adapter inputs](#adapter-inputs).

**scope** `ConnectionScope` *required*

`SCHEDULER`, `AGENT`, `DEVELOPMENT_SHARED` or `COST`.

**environment\_slug** `Optional[str]` (default: None)

The environment's slug, for `SCHEDULER` and `AGENT`. Leave it out for `DEVELOPMENT_SHARED` and `COST`.

**connection\_id** `Optional[str]` (default: None)

The connection's id in its environment. `default` when left out.

**name** `Optional[str]` (default: None)

A name for the connection.

**target\_name** `Optional[str]` (default: None)

The dbt™ target name that runs see.

**threads** `Optional[int]` (default: None)

How many threads dbt™ runs with.

**workspace\_uid** `Optional[str]` (default: None)

The workspace to use, for a company API key.

**Returns** `WarehouseConnectionTestResult`

The warehouse type that the connection opened (`type`) and when (`tested_at`). A warehouse that refuses the connection raises `AdminConnectionTestFailedException`.

```python theme={"system"}
import os

from paradime.apis.admin.connections.types import ConnectionScope, SnowflakeConnectionInput

result = paradime.admin.connections.test(
    SnowflakeConnectionInput(
        account="acme-xy12345",
        role="TRANSFORMER",
        database="ANALYTICS",
        warehouse="TRANSFORMING",
        schema_name="DBT_PROD",
        username="PARADIME_BOLT",
        use_key_pair_auth=True,
        private_key=os.environ["SNOWFLAKE_PRIVATE_KEY"],
    ),
    scope=ConnectionScope.SCHEDULER,
    environment_slug="BOLT_ENVIRONMENT_SLUG",
    name="Snowflake production",
    target_name="prod",
    threads=8,
)
print(result.type, result.tested_at)
```

## Create a connection

Tests a new connection, then saves it. A warehouse that refuses the connection raises `AdminConnectionTestFailedException`, and nothing is saved. Sending the same input again returns the stored connection and changes nothing. A connection that exists with other settings raises `AdminConflictException`: change it with [`update`](#update-a-connection).

Saving a connection redeploys the workspace's Bolt schedules. A `COST` connection also starts Radar's cost sync. A `DEVELOPMENT_SHARED` connection is saved without a test, and it rewrites every user's dbt™ profile.

**adapter** `ConnectionAdapter` *required*

The warehouse settings. See [Adapter inputs](#adapter-inputs).

**scope** `ConnectionScope` *required*

`SCHEDULER`, `AGENT`, `DEVELOPMENT_SHARED` or `COST`.

**environment\_slug** `Optional[str]` (default: None)

The environment's slug, for `SCHEDULER` and `AGENT`. Leave it out for `DEVELOPMENT_SHARED` and `COST`.

**connection\_id** `Optional[str]` (default: None)

The connection's id. `default` when left out.

**name** `Optional[str]` (default: None)

The connection's name. Required, except for `COST`, which doesn't use it.

**target\_name** `Optional[str]` (default: None)

The dbt™ target name. Required, except for `COST`, which doesn't use it.

**threads** `Optional[int]` (default: None)

How many threads dbt™ runs with. Required for `SCHEDULER` and `AGENT`. `COST` and `DEVELOPMENT_SHARED` don't use it.

**workspace\_uid** `Optional[str]` (default: None)

The workspace to change, for a company API key.

**Returns** `WarehouseConnection`

The new connection, or the identical one that was stored.

```python theme={"system"}
import os

from paradime.apis.admin.connections.types import ConnectionScope, SnowflakeConnectionInput

connection = paradime.admin.connections.create(
    SnowflakeConnectionInput(
        account="acme-xy12345",
        role="TRANSFORMER",
        database="ANALYTICS",
        warehouse="TRANSFORMING",
        schema_name="DBT_PROD",
        username="PARADIME_BOLT",
        use_key_pair_auth=True,
        private_key=os.environ["SNOWFLAKE_PRIVATE_KEY"],
    ),
    scope=ConnectionScope.SCHEDULER,
    environment_slug="BOLT_ENVIRONMENT_SLUG",
    name="Snowflake production",
    target_name="prod",
    threads=8,
)
print(connection.connection_id, connection.settings.has_private_key)
```

To set the shared part of the Code IDE connection, send only workspace-level fields:

```python theme={"system"}
from paradime.apis.admin.connections.types import ConnectionScope, SnowflakeConnectionInput

paradime.admin.connections.create(
    SnowflakeConnectionInput(account="acme-xy12345", use_key_pair_auth=True),
    scope=ConnectionScope.DEVELOPMENT_SHARED,
    name="Snowflake development",
    target_name="dev",
)
```

## Update a connection

Tests a connection's new settings, then saves them. `adapter` replaces the warehouse settings. A secret, `name`, `target_name` or `threads` that you leave out keeps its stored value. Sending the same input again changes nothing. A connection that doesn't exist raises `AdminNotFoundException`. A warehouse that refuses the connection raises `AdminConnectionTestFailedException`, and the stored connection stays.

Takes the same arguments as [`create`](#create-a-connection).

**Returns** `WarehouseConnection`

The updated connection.

```python theme={"system"}
from paradime.apis.admin.connections.types import ConnectionScope, SnowflakeConnectionInput

# Move the connection to another warehouse; the stored private key stays
paradime.admin.connections.update(
    SnowflakeConnectionInput(
        account="acme-xy12345",
        role="TRANSFORMER",
        database="ANALYTICS",
        warehouse="TRANSFORMING_L",
        schema_name="DBT_PROD",
        username="PARADIME_BOLT",
        use_key_pair_auth=True,
    ),
    scope=ConnectionScope.SCHEDULER,
    environment_slug="BOLT_ENVIRONMENT_SLUG",
)
```

## Delete a connection

Deletes a connection. Deleting it again is not an error. An environment's default connection can't be deleted while the environment has other connections.

**scope** `ConnectionScope` *required*

`SCHEDULER`, `AGENT`, `DEVELOPMENT_SHARED` or `COST`.

**environment\_slug** `Optional[str]` (default: None)

The environment's slug, for `SCHEDULER` and `AGENT`.

**connection\_id** `Optional[str]` (default: None)

The connection's id. `default` when left out.

**workspace\_uid** `Optional[str]` (default: None)

The workspace to change, for a company API key.

**Returns** `str`

The id of the deleted connection.

```python theme={"system"}
from paradime.apis.admin.connections.types import ConnectionScope

paradime.admin.connections.delete(
    scope=ConnectionScope.SCHEDULER,
    environment_slug="BOLT_ENVIRONMENT_SLUG",
    connection_id="backup",
)
```

## Set the default connection

Makes a connection its environment's default.

**connection\_id** `str` *required*

The connection's id in its environment.

**scope** `ConnectionScope` *required*

`SCHEDULER`, `AGENT`, `DEVELOPMENT_SHARED` or `COST`.

**environment\_slug** `Optional[str]` (default: None)

The environment's slug, for `SCHEDULER` and `AGENT`.

**workspace\_uid** `Optional[str]` (default: None)

The workspace to change, for a company API key.

**Returns** `WarehouseConnection`

The connection, now the default.

```python theme={"system"}
from paradime.apis.admin.connections.types import ConnectionScope

paradime.admin.connections.set_default(
    "backup", scope=ConnectionScope.SCHEDULER, environment_slug="BOLT_ENVIRONMENT_SLUG"
)
```

## Adapter inputs

Pass one adapter's input, or a `WarehouseAdapterInput` with exactly one adapter set. Import them from `paradime.apis.admin.connections.types`. Every field is optional in Python; the API says which ones a connection needs. Text fields take strings only, so pass a port as `"5439"`, not `5439`.

| Input | `WarehouseAdapterInput` field | Settings | Secrets |
| - | - | - | - |
| `SnowflakeConnectionInput` | `snowflake` | `account`, `role`, `database`, `warehouse`, `schema_name`, `username`, `use_key_pair_auth`, `use_sso`, `client_id` | `password`, `private_key`, `private_key_passphrase`, `client_secret`, `profile` |
| `BigQueryConnectionInput` | `bigquery` | `connection_type` (`OAUTH` or `SERVICE_ACCOUNT`), `location`, `dataset_name`, `execution_project`, `project_id`, `client_id`, `cost_gcs_bucket_name`, `cost_project_ids` | `service_account_json`, `client_secret`, `profile` |
| `DatabricksConnectionInput` | `databricks` | `host`, `http_path`, `catalog`, `schema_name` | `token`, `profile` |
| `RedshiftConnectionInput` | `redshift` | `host_name`, `port`, `database`, `schema_name`, `username` | `password`, `profile` |
| `DuckDbConnectionInput` | `duckdb` | `connection_type` (`MOTHERDUCK` or `DUCKDB`), `schema_name` | `profile` |
| `FireboltConnectionInput` | `firebolt` | `host_name`, `account_name`, `database`, `engine_name`, `schema_name`, `username` | `password`, `profile` |
| `ProfileConnectionInput` | `profile_connection` | `warehouse_type` (`TRINO`, `SQL_SERVER`, `CLICKHOUSE` or `FABRIC`), `schema_name` | `profile` |

`schema_name` is sent to the API as `schema`. `ProfileConnectionInput` sets up a warehouse from a dbt™ profile; the API accepts it only for the four warehouse types above.

### Per-user fields

A `DEVELOPMENT_SHARED` connection refuses these fields, because each user sets them in their own IDE onboarding:

| Adapter | Per-user fields |
| - | - |
| Snowflake | `role`, `database`, `warehouse`, `schema_name`, `username`, `password`, `private_key`, `private_key_passphrase`, `profile` |
| BigQuery | `dataset_name`, `profile` |
| Databricks | `schema_name`, `token`, `profile` |
| Redshift | `database`, `schema_name`, `username`, `password`, `profile` |
| DuckDB | `schema_name`, `profile` |
| Firebolt | `account_name`, `database`, `engine_name`, `schema_name`, `username`, `password`, `profile` |
| Profile | `schema_name` |

## Types

**WarehouseConnection** `model`

**fields**

**scope** `ConnectionScope`

Who uses the connection.

**environment** `Optional[EnvironmentLink]`

The environment, with its `slug` and `name`. `None` for workspace-level scopes, and for a key without **Environment admin**.

**environment\_slug** `Optional[str]`

The environment's slug. A shortcut for `environment.slug`.

**connection\_id** `str`

The connection's id in its environment.

**type** `WarehouseType`

The warehouse: `SNOWFLAKE`, `BIGQUERY`, `DATABRICKS`, `REDSHIFT`, `DUCKDB`, `FIREBOLT`, `TRINO`, `SQL_SERVER`, `CLICKHOUSE` or `FABRIC`.

**is\_default** `Optional[bool]`

Whether it's the environment's default connection.

**name** `Optional[str]`

The connection's name.

**target\_name** `Optional[str]`

The dbt™ target name.

**threads** `Optional[int]`

How many threads dbt™ runs with.

**updated\_at** `Optional[datetime]`

When the connection last changed.

**settings** `Optional[model]`

The warehouse settings without secrets, as `SnowflakeConnectionSettings`, `BigQueryConnectionSettings`, `DatabricksConnectionSettings`, `RedshiftConnectionSettings`, `DuckDbConnectionSettings`, `FireboltConnectionSettings` or `ProfileConnectionSettings`. Each has the adapter's settings, plus a `has_<secret>` flag for each secret, for example `has_private_key`.

**WarehouseConnectionTestResult** `model`

**fields**

**type** `WarehouseType`

The warehouse that the connection opened.

**tested\_at** `datetime`

When the test ran.


## Related topics

- [Admin client](https://docs.paradime.io/developers/python-sdk/modules/admin/index.md)
- [Admin client: setup status](https://docs.paradime.io/developers/python-sdk/modules/admin/setup-status.md)
- [Admin client: environments](https://docs.paradime.io/developers/python-sdk/modules/admin/environments.md)
- [Administration API: Warehouse connections](https://docs.paradime.io/developers/graphql-api/admin-api/warehouse-connections.md)
- [For Admins](https://docs.paradime.io/start-here/quickstart/for-admins.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.