Skip to main content

A simple CLI to switch between dbt Cloud projects and hosts.

Project description

dbt-switch

A simple CLI to switch between dbt Cloud projects and hosts.

Usage

# Switch to a specific project and host
dbt-switch --proj proj_2 --host default

# Switch only the project (host stays the same)
dbt-switch --proj proj_1

# Switch only the host (project stays the same)
dbt-switch --host default

# See all available options
dbt-switch --list

Example

Given a dbt_cloud.yml file like this:

# dbt_cloud.yml
version: "1"
context:
  active-host: "cloud.getdbt.com" # default
  # active-host: "[identifier].us[#].dbt.com" # custom

  active-project: "123456" # proj_1
  # active-project: "234567" # proj_2
  # active-project: "345678" # proj_3

You can see the available options with dbt-switch --list:

$ dbt-switch --list

Available options in /Users/jairus.martinez/.dbt/dbt_cloud.yml:

active-hosts:
  - default (active): cloud.getdbt.com
  - custom (inactive): [identifier].us[#].dbt.com

active-projects:
  - proj_1 (active): 123456
  - proj_2 (inactive): 234567
  - proj_3 (inactive): 345678

The script identifies options by their comment (e.g., # proj_1). If a comment is not present, it will use the value of the property itself (e.g., the project ID or host URL).

Switch to the custom host and the proj_3 project:

$ dbt-switch --host custom --proj proj_3

✓ Deactivated active-host: default
✓ Activated active-host: custom
✅ Successfully updated dbt_cloud.yml
✓ Deactivated active-project: proj_1
✓ Activated active-project: proj_3
✅ Successfully updated dbt_cloud.yml

The dbt_cloud.yml file will be updated to:

# dbt_cloud.yml
version: "1"
context:
  # active-host: "cloud.getdbt.com" # default
  active-host: "[identifier].us[#].dbt.com" # custom

  # active-project: "123456" # proj_1
  # active-project: "234567" # proj_2
  active-project: "345678" # proj_3

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dbt_switch-0.1.2.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dbt_switch-0.1.2-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file dbt_switch-0.1.2.tar.gz.

File metadata

  • Download URL: dbt_switch-0.1.2.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.15

File hashes

Hashes for dbt_switch-0.1.2.tar.gz
Algorithm Hash digest
SHA256 8ae5d82dd8663f39cf80b95521227c7771adb596aec157858c84e7931d8c5245
MD5 1fc59c4d717a8ba18dbdc2954ff787ea
BLAKE2b-256 00876bb35595cd62a7fd24cb74f695a0aba4317b615fdf2cd272e465604173ef

See more details on using hashes here.

File details

Details for the file dbt_switch-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: dbt_switch-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.15

File hashes

Hashes for dbt_switch-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3f849bb8661b2d6e7a498820861988f41d95d168e85d06aff89cae5e9addf6e6
MD5 bb13a0df61612034abced0e193e6450c
BLAKE2b-256 10311d68fd7b042691cb6a82da7c6c21f9a0b2a64b193c9c1d2e2c5388905793

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page