Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new hub env var section #6059

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions website/docs/docs/build/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ While all environment variables are encrypted at rest in dbt Cloud, dbt Cloud ha

dbt Cloud has a number of pre-defined variables built in. Variables are set automatically and cannot be changed.

**dbt Cloud IDE details**
#### dbt Cloud IDE details

The following environment variable is set automatically for the dbt Cloud IDE:

Expand All @@ -109,13 +109,13 @@ The following environment variable is set automatically for the dbt Cloud IDE:

Use case — This is useful in cases where you want to dynamically use the Git branch name as a prefix for a [development schema](/docs/build/custom-schemas) ( `{{ env_var ('DBT_CLOUD_GIT_BRANCH') }}` ).

**dbt Cloud context**
#### dbt Cloud context

The following environment variables are set automatically for deployment runs:

- `DBT_ENV`: This key is reserved for the dbt Cloud application and will always resolve to 'prod'

**Run details**
#### Run details
- `DBT_CLOUD_PROJECT_ID`: The ID of the dbt Cloud Project for this run
- `DBT_CLOUD_JOB_ID`: The ID of the dbt Cloud Job for this run
- `DBT_CLOUD_RUN_ID`: The ID of this particular run
Expand All @@ -124,7 +124,7 @@ The following environment variables are set automatically for deployment runs:
- `DBT_CLOUD_ENVIRONMENT_ID`: The ID of the environment for this run
- `DBT_CLOUD_ACCOUNT_ID`: The ID of the dbt Cloud account for this run

**Git details**
#### Git details

_The following variables are currently only available for GitHub, GitLab, and Azure DevOps PR builds triggered via a webhook_

Expand Down Expand Up @@ -186,3 +186,9 @@ select *,

from users_aggregated
```

### The DBT_PACKAGE_HUB_URL environment variable

import PackageHubEnvVar from '/snippets/_dbt-package-hub-env-var.md';

<PackageHubEnvVar/>
7 changes: 6 additions & 1 deletion website/docs/docs/build/packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Where possible, we recommend installing packages via dbt Hub, since this allows

In comparison, other package installation methods are unable to handle the duplicate dbt-utils package.

Advanced users can choose to host an internal version of the package hub based on [this repository](https://github.com/dbt-labs/hub.getdbt.com) and setting the `DBT_PACKAGE_HUB_URL` environment variable.
Advanced users can choose to host an internal version of the package hub based on [this repository](https://github.com/dbt-labs/hub.getdbt.com) and set the `DBT_PACKAGE_HUB_URL` environment variable. Refer to [Using the `DBT_PACKAGE_HUB_URL` environment variable](#using-the-dbt_package_hub_url-environment-variable) for more information.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hiya @mirnawong1

I'm not sure if it's something I'm doing but the link is working for me.

Kind Regards
Natalie

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh shoot! great catch!

mirnawong1 marked this conversation as resolved.
Show resolved Hide resolved

#### Prerelease versions

Expand Down Expand Up @@ -405,3 +405,8 @@ packages:

</File>

### The DBT_PACKAGE_HUB_URL environment variable

import PackageHubEnvVar from '/snippets/_dbt-package-hub-env-var.md';

<PackageHubEnvVar/>
22 changes: 22 additions & 0 deletions website/snippets/_dbt-package-hub-env-var.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
If you're hosting an internal version of the [dbt Labs hosted package hub](https://hub.getdbt.com/), you can set the [`DBT_PACKAGE_HUB_URL`](https://github.com/dbt-labs/dbt-core/blob/main/core/dbt/clients/registry.py#L23) environment variable to point to your instance of the dbt package hub. This allows you to install packages from your self-hosted version.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should i add this at the end: "This allows you to install packages from your self-hosted version and not the public hub version.."


It provides organizations with the flexibility, control, and security when managing dbt packages:

- Host internal dbt packages for organizational use &mdash; Useful for sharing sensitive or proprietary data models, macros, or other items across the organization.
- Manage custom versions of public dbt packages &mdash; Useful for maintaining a fork of a public package with customizations or bug fixes.
mirnawong1 marked this conversation as resolved.
Show resolved Hide resolved
- Operate in secure, regulated, or air-gapped environments &mdash; Useful for organizations that require strict control over the software they use.
mirnawong1 marked this conversation as resolved.
Show resolved Hide resolved
- Gain control over package updates and dependencies &mdash; Useful for organizations that need to manage dependencies and updates carefully.
mirnawong1 marked this conversation as resolved.
Show resolved Hide resolved

To set the `DBT_PACKAGE_HUB_URL` environment variable:

1. [Set the environment variable](/docs/build/environment-variables#setting-and-overriding-environment-variables) to the URL of your package hub.
<Lightbox src="/img/docs/building-a-dbt-project/set-env-var.jpg" title="Set up the 'DBT_PACKAGE_HUB_URL' environment variable in the Environment settings page."/>
2. Configure the `packages.yml` file with the usual package name and version:

```yaml
packages:
- package: santi_corp/package_name
version: [">=0.7.0", "<0.8.0"]
```

3. Run `dbt deps` to install the packages from your self-hosted package hub.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading