Skip to content
Merged
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
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
# dbt_intercom v1.7.0

[PR #84](https://github.com/fivetran/dbt_intercom/pull/84) includes the following updates:
[PR #84](https://github.com/fivetran/dbt_intercom/pull/84) and [PR #85](https://github.com/fivetran/dbt_intercom/pull/85) includes the following updates:

## Schema/Data Change
**2 total changes • 1 possible breaking change**

| Data Model(s) | Change type | Old | New | Notes |
| ------------- | ----------- | --- | --- | ----- |
| **(Breaking)** `stg_intercom__tag`, `stg_intercom__company_tag_history`, `stg_intercom__contact_tag_history`, `stg_intercom__conversation_tag_history` | Changed data type | integer | string | Casts `tag_id` as a string so joins succeed regardless of source type. |
| `stg_intercom__company_history`, `stg_intercom__company_tag_history`, `stg_intercom__contact_company_history` | explicit data type cast | source data type | string | Casts `company_id` as a string for consistent join keys. |

## Bug Fix
- Resolves a `Database Error` in `intercom__company_enhanced` (and other tag-joined models) caused by mismatched `tag_id` data types. The fix casts all ID join keys to string in staging. See the Schema/Data Change table above.

## Under the Hood
- Migrates the `union_connections`, `apply_source_relation`, and `partition_by_source_relation` macros to the `dbt_fivetran_utils` package.
- Adds the `fivetran_using_source_casing` variable for case-sensitive destination support. When enabled, downstream transformations respect source casing to ensure consistent results. See the [Additional Configurations](https://github.com/fivetran/dbt_intercom/#source-casing-for-case-sensitive-destinations) section of the README for details.


# dbt_intercom v1.6.1

[PR #82](https://github.com/fivetran/dbt_intercom/pull/82) includes the following updates:
Expand Down
2 changes: 1 addition & 1 deletion macros/staging/get_company_tag_history_columns.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{"name": "_fivetran_synced", "datatype": dbt.type_string()},
{"name": "company_id", "datatype": dbt.type_string()},
{"name": "company_updated_at", "datatype": dbt.type_timestamp()},
{"name": "tag_id", "datatype": dbt.type_int()}
{"name": "tag_id", "datatype": dbt.type_string()}
] %}

{{ return(columns) }}
Expand Down
2 changes: 1 addition & 1 deletion macros/staging/get_contact_tag_history_columns.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{"name": "_fivetran_end", "datatype": dbt.type_timestamp()},
{"name": "contact_id", "datatype": dbt.type_string()},
{"name": "contact_updated_at", "datatype": dbt.type_timestamp()},
{"name": "tag_id", "datatype": dbt.type_int()}
{"name": "tag_id", "datatype": dbt.type_string()}
] %}

{{ return(columns) }}
Expand Down
2 changes: 1 addition & 1 deletion macros/staging/get_conversation_tag_history_columns.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{"name": "_fivetran_end", "datatype": dbt.type_timestamp()},
{"name": "conversation_id", "datatype": dbt.type_int()},
{"name": "conversation_updated_at", "datatype": dbt.type_timestamp()},
{"name": "tag_id", "datatype": dbt.type_int()}
{"name": "tag_id", "datatype": dbt.type_string()}
] %}

{{ return(columns) }}
Expand Down
2 changes: 1 addition & 1 deletion macros/staging/get_tag_columns.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% set columns = [
{"name": "_fivetran_deleted", "datatype": "boolean"},
{"name": "_fivetran_synced", "datatype": dbt.type_timestamp()},
{"name": "id", "datatype": dbt.type_int()},
{"name": "id", "datatype": dbt.type_string()},
{"name": "name", "datatype": dbt.type_string()}
] %}

Expand Down
2 changes: 1 addition & 1 deletion models/staging/stg_intercom__company_history.sql
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final as (

select
source_relation,
id as company_id,
cast(id as {{ dbt.type_string() }}) as company_id,
name as company_name,
website,
industry,
Expand Down
4 changes: 2 additions & 2 deletions models/staging/stg_intercom__company_tag_history.sql
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ final as (

select
source_relation,
company_id,
cast(company_id as {{ dbt.type_string() }}) as company_id,
cast(company_updated_at as {{ dbt.type_timestamp() }}) as company_updated_at,
tag_id,
cast(tag_id as {{ dbt.type_string() }}) as tag_id,
_fivetran_active,
cast(_fivetran_start as {{ dbt.type_timestamp() }}) as _fivetran_start,
cast(_fivetran_end as {{ dbt.type_timestamp() }}) as _fivetran_end
Expand Down
2 changes: 1 addition & 1 deletion models/staging/stg_intercom__contact_company_history.sql
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final as (

select
source_relation,
company_id,
cast(company_id as {{ dbt.type_string() }}) as company_id,
contact_id,
cast(contact_updated_at as {{ dbt.type_timestamp() }}) as contact_updated_at,
_fivetran_active,
Expand Down
2 changes: 1 addition & 1 deletion models/staging/stg_intercom__contact_tag_history.sql
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ final as (
source_relation,
contact_id,
cast(contact_updated_at as {{ dbt.type_timestamp() }}) as contact_updated_at,
tag_id,
cast(tag_id as {{ dbt.type_string() }}) as tag_id,
_fivetran_active,
cast(_fivetran_start as {{ dbt.type_timestamp() }}) as _fivetran_start,
cast(_fivetran_end as {{ dbt.type_timestamp() }}) as _fivetran_end
Expand Down
2 changes: 1 addition & 1 deletion models/staging/stg_intercom__conversation_tag_history.sql
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final as (
select
source_relation,
conversation_id,
tag_id,
cast(tag_id as {{ dbt.type_string() }}) as tag_id,
_fivetran_active,
cast(_fivetran_start as {{ dbt.type_timestamp() }}) as _fivetran_start,
cast(_fivetran_end as {{ dbt.type_timestamp() }}) as _fivetran_end
Expand Down
2 changes: 1 addition & 1 deletion models/staging/stg_intercom__tag.sql
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final as (

select
source_relation,
id as tag_id,
cast(id as {{ dbt.type_string() }}) as tag_id,
trim(name) as name,
_fivetran_deleted
from fields
Expand Down