Skip to content

Commit

Permalink
Merge pull request #60 from fivetran/bugfix/redshift_empty_tables
Browse files Browse the repository at this point in the history
add limit 1 for redshift
  • Loading branch information
fivetran-reneeli authored Jan 13, 2025
2 parents 89c0de9 + d54c90b commit 237654d
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 16 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# dbt_zendesk_source v0.15.0

## Under the Hood
- (Affects Redshift only) Updates the `union_zendesk_connections` macro to use a limit 1 instead of limit 0 for empty tables.
- When a table is empty, Redshift ignores explicit data casts and will materialize every column as a `varchar`. Redshift users may experience errors in downstream transformations as a consequence.
- For each staging model, if the source table is not found, the package will create a empty table with 0 rows for non-Redshift warehouses and a table with 1 all-`null` row for Redshift destinations. The 1 row will ensure that Redshift will respect the package's datatype casts.

## Documentation Update
- Moved badges at top of the README below the H1 header to be consistent with popular README formats.

# dbt_zendesk_source v0.14.2
[PR #59](https://github.com/fivetran/dbt_zendesk_source/pull/59) includes the following updates:

Expand All @@ -12,7 +22,7 @@

## Documentation Updates
- Added enabled config variables to `brand`, `organization` and `organization_tag` in the `src_zendesk.yml` models.
- [Updated README](https://github.com/fivetran/dbt_zendesk_source?tab=readme-ov-file#step-4-enabledisable-models-for-non-existent-sources) with instructions on how to disable `brand` and `organization` sources.
- [Updated README](https://github.com/fivetran/dbt_zendesk_source?tab=readme-ov-file#step-4-enabledisable-models-for-non-existent-sources) with instructions on how to disable `brand` and `organization` sources.

# dbt_zendesk_source v0.14.1

Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<p align="center">
# Zendesk Support Source dbt Package ([Docs](https://fivetran.github.io/dbt_zendesk_source/))

<p align="left">
<a alt="License"
href="https://github.com/fivetran/dbt_zendesk_source/blob/main/LICENSE">
<img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" /></a>
Expand All @@ -13,7 +15,6 @@
<img src="https://img.shields.io/badge/Fivetran_Quickstart_Compatible%3F-yes-green.svg" /></a>
</p>

# Zendesk Support Source dbt Package ([Docs](https://fivetran.github.io/dbt_zendesk_source/))
## What does this dbt package do?
<!--section="zendesk_source_model"-->
- Materializes [Zendesk Support staging tables](https://fivetran.github.io/dbt_github_source/#!/overview/zendesk_source/models/?g_v=1) which leverage data in the format described by [this ERD](https://fivetran.com/docs/applications/zendesk#schemainformation). These staging tables clean, test, and prepare your Zendesk Support data from [Fivetran's connector](https://fivetran.com/docs/applications/zendesk) for analysis by doing the following:
Expand Down Expand Up @@ -44,7 +45,7 @@ Include the following zendesk_source package version in your `packages.yml` file
```yaml
packages:
- package: fivetran/zendesk_source
version: [">=0.14.0", "<0.15.0"]
version: [">=0.15.0", "<0.16.0"]
```
### Step 3: Define database and schema variables
#### Option A: Single connector
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.14.2'
version: '0.15.0'
require-dbt-version: [">=1.3.0", "<2.0.0"]

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.

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: zendesk_source_integrations_tests_5
schema: zendesk_source_integrations_tests_7
threads: 8
bigquery:
type: bigquery
method: service-account-json
project: 'dbt-package-testing'
schema: zendesk_source_integrations_tests_5
schema: zendesk_source_integrations_tests_7
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: zendesk_source_integrations_tests_5
schema: zendesk_source_integrations_tests_7
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: zendesk_source_integrations_tests_5
schema: zendesk_source_integrations_tests_7
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: zendesk_source_integrations_tests_5
schema: zendesk_source_integrations_tests_7
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,13 +1,13 @@
config-version: 2

name: 'zendesk_source_integration_tests'
version: '0.14.2'
version: '0.15.0'

profile: 'integration_tests'

vars:

zendesk_schema: zendesk_source_integrations_tests_5
zendesk_schema: zendesk_source_integrations_tests_7
zendesk_source:
zendesk_organization_identifier: "organization_data"
zendesk_schedule_identifier: "schedule_data"
Expand Down
4 changes: 2 additions & 2 deletions macros/union/union_zendesk_connections.sql
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
{% endif -%}
select
cast(null as {{ dbt.type_string() }}) as _dbt_source_relation
limit 0
limit {{ '0' if target.type != 'redshift' else '1' }}
{%- endif -%}

{% else %}
Expand All @@ -63,7 +63,7 @@

select
cast(null as {{ dbt.type_string() }}) as _dbt_source_relation
limit 0
limit {{ '0' if target.type != 'redshift' else '1' }}
{%- endif -%}
{% endif -%}

Expand Down

0 comments on commit 237654d

Please sign in to comment.