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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# dbt_facebook_ads v1.4.2
[PR #67](https://github.com/fivetran/dbt_facebook_ads/pull/67) includes the following updates:

## Bug Fix
- Fixes PostgreSQL compatibility issue in `get_url_tags_query()` macro where `jsonb` columns were incorrectly processed using `json_array_elements()` instead of `jsonb_array_elements()`, causing database errors when `url_tags` column is stored as `jsonb` datatype.

# dbt_facebook_ads v1.4.1
[PR #65](https://github.com/fivetran/dbt_facebook_ads/pull/65) includes the following updates:

Expand Down
2 changes: 1 addition & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'facebook_ads'
version: '1.4.1'
version: '1.4.2'
config-version: 2
require-dbt-version: [">=1.3.0", "<3.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.

4 changes: 2 additions & 2 deletions integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'facebook_ads_integration_tests'
version: '1.4.1'
version: '1.4.2'
profile: 'integration_tests'
config-version: 2

Expand Down Expand Up @@ -96,7 +96,7 @@ seeds:
# Load as VARCHAR first, then convert to native JSON type in a post-hook.
# This is necessary for testing native JSON datatypes with seed data.
+post-hook:
- "alter table {{ this }} add column url_tags {{ 'super' if target.type == 'redshift' else 'variant' if target.type == 'snowflake' else 'json' }} {{ 'default null' if target.type != 'bigquery' }}"
- "alter table {{ this }} add column url_tags {{ 'super' if target.type == 'redshift' else 'variant' if target.type == 'snowflake' else 'jsonb' if target.type == 'postgres' else 'json' }} {{ 'default null' if target.type != 'bigquery' }}"
- "update {{ this }} set url_tags = {{ 'json_parse(url_tags_string)' if target.type == 'redshift' else 'url_tags_string::jsonb' if target.type == 'postgres' else 'parse_json(url_tags_string)' }} {{ 'where url_tags_string is not null' if target.type == 'bigquery' }}"
facebook_ads_basic_ad_data:
+column_types:
Expand Down
2 changes: 1 addition & 1 deletion macros/get_url_tag_query.sql
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Database-specific implementations:
from required_fields

{%- if is_native_json %}
cross join lateral json_array_elements(url_tags) as url_tag_element
cross join lateral {{ url_tags_datatype }}_array_elements(url_tags) as url_tag_element -- use json_array_elements or jsonb_array_elements based on datatype
{%- else %}
cross join lateral json_array_elements(replace(trim(url_tags::text, '"'),'\\','')::json) as url_tag_element
{%- endif %}
Expand Down