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 support for setting database and schema via environment variable #34

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
## Contributors
- [stumelius](https://github.com/stumelius) ([#32](https://github.com/fivetran/dbt_zendesk_source/pull/32))

# dbt_zendesk_source v0.8.2

# Features
- Added the ability to set source database and schema using environment variables.
# dbt_zendesk_source v0.8.0

## 🚨 Breaking Changes 🚨:
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ vars:
zendesk_database: your_destination_name
zendesk_schema: your_schema_name
```

If you cannot hard-code your database or schema, you can provide the names of environment variables that contain these values:

```yml
vars:
zendesk_database_env_var: your_destination_name
zendesk_schema_env_var: your_schema_name
```

If `_env_var` values are set, they will be used before falling back to hard-coded `var` values.

## Step 4: Disable models for non-existent sources
This package takes into consideration that not every Zendesk account utilizes the `schedule`, `domain_name`, `user_tag`, `organization_tag`, or `ticket_form_history` features, and allows you to disable the corresponding functionality. By default, all variables' values are assumed to be `true`. Add variables for only the tables you want to disable:
```yml
Expand Down
2 changes: 1 addition & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
config-version: 2
name: 'zendesk_source'
version: '0.8.1'
version: '0.8.2'
require-dbt-version: [">=1.3.0", "<2.0.0"]
models:
zendesk_source:
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
config-version: 2

name: 'zendesk_source_integration_tests'
version: '0.8.1'
version: '0.8.2'

profile: 'integration_tests'

Expand Down
4 changes: 2 additions & 2 deletions models/src_zendesk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ version: 2

sources:
- name: zendesk
schema: "{{var ('zendesk_schema', 'zendesk')}}"
database: "{% if target.type != 'spark'%}{{ var('zendesk_database', target.database) }}{% endif %}"
schema: "{{env_var(var('zendesk_schema_env_var', ''), '') or var('zendesk_schema', 'zendesk')}}"
database: "{% if target.type != 'spark'%}{{env_var(var('zendesk_database_env_var', ''), '') or var('zendesk_database', target.database) }}{% endif %}"
loader: fivetran
loaded_at_field: _fivetran_synced

Expand Down