Skip to content

Commit

Permalink
Usage record enable config (#13)
Browse files Browse the repository at this point in the history
* only usage_record enable disable config

* docs

* try removing config

* nvm add it back

* try new schema

* doc updates

* Update CHANGELOG.md

Co-authored-by: Avinash Kunnath <[email protected]>

* update readme format

* Delete package-lock.yml

* Update .gitignore

---------

Co-authored-by: Avinash Kunnath <[email protected]>
Co-authored-by: fivetran-catfritz <[email protected]>
  • Loading branch information
3 people authored Dec 2, 2024
1 parent cf6d1cf commit 577d4dc
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .buildkite/scripts/run_models.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dbt deps
dbt seed --target "$db" --full-refresh
dbt run --target "$db" --full-refresh
dbt test --target "$db"
dbt run --vars '{using_twilio_call: false, using_twilio_messaging_service: false}' --target "$db" --full-refresh
dbt run --vars '{using_twilio_call: false, using_twilio_messaging_service: false, using_twilio_usage_record: false}' --target "$db" --full-refresh
dbt test --target "$db"

dbt run-operation fivetran_utils.drop_schemas_automation --target "$db"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
target/
dbt_packages/
logs/
package-lock.yml
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# dbt_twilio_source v0.4.0

[PR #13](https://github.com/fivetran/dbt_twilio_source/pull/13) includes the following updates:

## Features
- Added the ability to disable the `USAGE_RECORD` source table and its downstream fields via variable `using_twilio_usage_record` (default `true`). Refer to the [README](https://github.com/fivetran/dbt_twilio_source?tab=readme-ov-file#step-4-enablingdisabling-models) for more details.

# dbt_twilio_source v0.3.0

## 🚨 Breaking Changes 🚨
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<p align="center">
# Twilio Source dbt Package ([docs](https://fivetran.github.io/dbt_twilio_source/))

<p align="left">
<a alt="License"
href="https://github.com/fivetran/dbt_twilio_source/blob/main/LICENSE">
<img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" /></a>
Expand All @@ -10,7 +12,6 @@
<img src="https://img.shields.io/badge/Contributions-welcome-blueviolet" /></a>
</p>

# Twilio Source dbt Package ([docs](https://fivetran.github.io/dbt_twilio_source/))
## What does this dbt package do?

- Materializes [Twilio staging tables](https://fivetran.github.io/dbt_twilio_source/#!/overview/twilio_source/models/?g_v=1&g_e=seeds) which leverage data in the format described by [this ERD](https://fivetran.com/docs/applications/twilio#schemainformation). These staging tables clean, test, and prepare your Twilio data from [Fivetran's connector](https://fivetran.com/docs/applications/twilio) for analysis by doing the following:
Expand Down Expand Up @@ -44,7 +45,7 @@ Include the following Twilio package version in your `packages.yml` file.
```yaml
packages:
- package: fivetran/twilio_source
version: [">=0.3.0", "<0.4.0"]
version: [">=0.4.0", "<0.5.0"]
```

### Step 3: Define database and schema variables
Expand All @@ -66,6 +67,7 @@ By default, all variables are assumed to be `true`.
vars:
using_twilio_call: False # Disable this if not using call
using_twilio_messaging_service: False # Disable this if not using messaging_service
using_twilio_usage_record: False # Disable this if not using usage_record
```

### (Optional) Step 5: Additional configurations
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 @@

name: 'twilio_source'
version: '0.3.0'
version: '0.4.0'
config-version: 2

models:
Expand Down
2 changes: 1 addition & 1 deletion docs/catalog.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/manifest.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion docs/run_results.json

This file was deleted.

10 changes: 5 additions & 5 deletions integration_tests/ci/sample.profiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ integration_tests:
pass: "{{ env_var('CI_REDSHIFT_DBT_PASS') }}"
dbname: "{{ env_var('CI_REDSHIFT_DBT_DBNAME') }}"
port: 5439
schema: twilio_source_integration_tests_5
schema: twilio_source_integration_tests_6
threads: 8
bigquery:
type: bigquery
method: service-account-json
project: 'dbt-package-testing'
schema: twilio_source_integration_tests_5
schema: twilio_source_integration_tests_6
threads: 8
keyfile_json: "{{ env_var('GCLOUD_SERVICE_KEY') | as_native }}"
snowflake:
Expand All @@ -33,7 +33,7 @@ integration_tests:
role: "{{ env_var('CI_SNOWFLAKE_DBT_ROLE') }}"
database: "{{ env_var('CI_SNOWFLAKE_DBT_DATABASE') }}"
warehouse: "{{ env_var('CI_SNOWFLAKE_DBT_WAREHOUSE') }}"
schema: twilio_source_integration_tests_5
schema: twilio_source_integration_tests_6
threads: 8
postgres:
type: postgres
Expand All @@ -42,13 +42,13 @@ integration_tests:
pass: "{{ env_var('CI_POSTGRES_DBT_PASS') }}"
dbname: "{{ env_var('CI_POSTGRES_DBT_DBNAME') }}"
port: 5432
schema: twilio_source_integration_tests_5
schema: twilio_source_integration_tests_6
threads: 8
databricks:
catalog: "{{ env_var('CI_DATABRICKS_DBT_CATALOG') }}"
host: "{{ env_var('CI_DATABRICKS_DBT_HOST') }}"
http_path: "{{ env_var('CI_DATABRICKS_DBT_HTTP_PATH') }}"
schema: twilio_source_integration_tests_5
schema: twilio_source_integration_tests_6
threads: 2
token: "{{ env_var('CI_DATABRICKS_DBT_TOKEN') }}"
type: databricks
4 changes: 2 additions & 2 deletions integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
config-version: 2
name: 'twilio_source_integration_tests'
version: '0.3.0'
version: '0.4.0'
profile: 'integration_tests'

vars:
twilio_source:
twilio_schema: twilio_source_integration_tests_5
twilio_schema: twilio_source_integration_tests_6
twilio_account_history_identifier: "twilio_account_history_data"
twilio_address_identifier: "twilio_address_data"
twilio_incoming_phone_number_identifier: "twilio_incoming_phone_number_data"
Expand Down
2 changes: 2 additions & 0 deletions models/src_twilio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,8 @@ sources:
freshness:
warn_after: {count: 72, period: hour}
error_after: {count: 168, period: hour}
config:
enabled: "{{ var('using_twilio_usage_record', true) }}"
columns:
- name: _fivetran_synced
description: Timestamp of when fivetran synced a record.
Expand Down
2 changes: 2 additions & 0 deletions models/stg_twilio__usage_record.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{ config(enabled=var('using_twilio_usage_record', True)) }}

with base as (

select *
Expand Down
2 changes: 2 additions & 0 deletions models/tmp/stg_twilio__usage_record_tmp.sql
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
{{ config(enabled=var('using_twilio_usage_record', True)) }}

select {{ dbt_utils.star(source('twilio', 'usage_record')) }}
from {{ var('usage_record') }}

0 comments on commit 577d4dc

Please sign in to comment.