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

Feature/click uri deprecation #69

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
# dbt_linkedin_source v0.10.0
[PR #69](https://github.com/fivetran/dbt_linkedin_source/pull/69) includes the following updates:

## Breaking Changes
- The `click_uri_type` field has been added to the `stg_linkedin_ads__creative_history` model. This field allows users to differentiate which click uri type (`text_ad` or `spotlight`) is being used to populate the results of the `click_uri` field.
- Please be aware this field only supports `text_ad` or `spotlight` click uri types. If you are interested in this package supporting more click uri ad types, please let us know in this [Feature Request](https://github.com/fivetran/dbt_linkedin_source/issues/70).

## Bug Fixes
- The `click_uri` field has been adjusted to populate the results following a coalesce on the `text_ad_landing_page`, `spotlight_landing_page`, or `click_uri` fields.
- This change is in response to a [LinkedIn Ads API](https://learn.microsoft.com/en-us/linkedin/marketing/community-management/contentapi-migration-guide?view=li-lms-2024-05#adcreativesv2-api-creatives-api) and [Fivetran LinkedIn Ads connector update](https://fivetran.com/docs/connectors/applications/linkedin-ads/changelog#january2024) which moved `click_uri` data to either the `text_ad_landing_page` or `spotlight_landing_page` fields depending on the creative type.
- Updated the `is_latest_version` window function in the following models to exclude the `source_relation` field from the partition statement when `linkedin_ads_union_schemas` or `linkedin_ads_union_databases` variables are empty. Also, modified it to skip the window function if the upstream table is empty, using the new `result_if_table_exists()` and `is_table_empty()` macros. This change addresses Redshift's issue with partitioning by constant expressions.
- `stg_linkedin_ads__account_history`
- `stg_linkedin_ads__campaign_group_history`
- `stg_linkedin_ads__campaign_history`
- `stg_linkedin_ads__creative_history`

## Under the Hood
- Updates to the `linkedin_creative_history_data` seed file to include the following new fields to ensure accurate data validation tests:
- `text_ad_landing_page`
- `spotlight_landing_page`

fivetran-joemarkiewicz marked this conversation as resolved.
Show resolved Hide resolved
# dbt_linkedin_source v0.9.0
[PR #67](https://github.com/fivetran/dbt_linkedin_source/pull/67) includes the following updates:

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ If you are **not** using the [Linkedin transformation package](https://github.c
# packages.yml
packages:
- package: fivetran/linkedin_source
version: [">=0.9.0", "<0.10.0"]
version: [">=0.10.0", "<0.11.0"]
```

### Step 3: Define database and schema variables
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: 'linkedin_source'
version: '0.9.0'
version: '0.10.0'
config-version: 2
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.

16 changes: 8 additions & 8 deletions docs/index.html

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.

2 changes: 1 addition & 1 deletion integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'linkedin_source_integration_tests'
version: '0.9.0'
version: '0.10.0'
profile: 'integration_tests'
config-version: 2

Expand Down
202 changes: 101 additions & 101 deletions integration_tests/seeds/linkedin_creative_history_data.csv
Original file line number Diff line number Diff line change
@@ -1,101 +1,101 @@
id,campaign_id,intended_status,click_uri,last_modified_at,created_time
125339904,174942134,,,,2021-03-08 23:42:20
186286604,202434464,,,,2022-09-16 02:46:54
54106906,131454616,,,,2018-05-18 01:04:02
54106976,131454826,,,,2018-05-18 01:09:08
54299976,131580446,,,,2018-05-24 00:38:47
54300176,131580546,,,,2018-05-24 00:47:40
82332766,148633856,,,,2020-03-20 18:55:40
82460426,148711996,,,,2020-03-24 17:56:49
102541764,162464924,,,,2020-05-08 09:34:15
102694624,162557074,,,,2020-05-12 14:08:40
107943663,165867684,,,,2020-07-22 19:28:31
110663234,167276694,,,,2020-09-10 18:08:57
44900356,125600246,,,,2017-06-08 21:46:06
44900356,125600246,,,,2017-06-08 21:46:06
44900356,125600246,,,,2017-06-08 21:46:06
44900356,125600246,,,,2017-06-08 21:46:06
44900336,125600246,,,,2017-06-08 21:46:06
44900336,125600246,,,,2017-06-08 21:46:06
44900336,125600246,,,,2017-06-08 21:46:06
44900336,125600246,,,,2017-06-08 21:46:06
44900366,125600246,,,,2017-06-08 21:46:06
44900366,125600246,,,,2017-06-08 21:46:06
44900366,125600246,,,,2017-06-08 21:46:06
44900366,125600246,,,,2017-06-08 21:46:06
44900346,125600246,,,,2017-06-08 21:46:06
44900346,125600246,,,,2017-06-08 21:46:06
44900346,125600246,,,,2017-06-08 21:46:06
44900346,125600246,,,,2017-06-08 21:46:06
55220334,133160324,,,,2017-08-04 22:45:09
55220334,133160324,,,,2017-08-04 22:45:09
44901856,125599426,,,,2017-06-08 22:29:09
55220334,133160324,,,,2017-08-04 22:45:09
44901856,125599426,,,,2017-06-08 22:29:09
44901856,125599426,,,,2017-06-08 22:29:09
44901866,125599426,,,,2017-06-08 22:29:09
44901866,125599426,,,,2017-06-08 22:29:09
44901866,125599426,,,,2017-06-08 22:29:09
55220324,133160324,,,,2017-08-04 22:45:09
55220324,133160324,,,,2017-08-04 22:45:09
55220324,133160324,,,,2017-08-04 22:45:09
44901876,125599426,,,,2017-06-08 22:29:09
55220314,133160324,,,,2017-08-04 22:45:09
44901876,125599426,,,,2017-06-08 22:29:09
55220314,133160324,,,,2017-08-04 22:45:09
55220314,133160324,,,,2017-08-04 22:45:09
44901876,125599426,,,,2017-06-08 22:29:09
44901876,125599426,,,,2017-06-08 22:29:09
55220314,133160324,,,,2017-08-04 22:45:09
55220304,133160324,,,,2017-08-04 22:45:09
44901886,125599426,,,,2017-06-08 22:29:09
44901886,125599426,,,,2017-06-08 22:29:09
44901886,125599426,,,,2017-06-08 22:29:09
55220304,133160324,,,,2017-08-04 22:45:09
55220304,133160324,,,,2017-08-04 22:45:09
55220304,133160324,,,,2017-08-04 22:45:09
44901886,125599426,,,,2017-06-08 22:29:09
48046336,127624356,,,,2017-10-10 16:49:38
48046326,127624356,,,,2017-10-10 16:49:38
48046346,127624356,,,,2017-10-10 16:49:38
50036216,128806186,,,,2017-12-22 17:38:12
50035816,128806016,,,,2017-12-22 17:27:45
50036226,128806186,,,,2017-12-22 17:38:12
50035806,128806016,,,,2017-12-22 17:27:45
56166306,132822186,,,,2018-07-25 15:04:05
56166306,132822186,,,,2018-07-25 15:04:05
56166306,132822186,,,,2018-07-25 15:04:05
56237466,132870856,,,,2018-07-28 18:48:26
56237376,132866546,,,,2018-07-28 18:38:10
57434376,133672706,,,,2018-09-06 16:59:15
57527536,133728466,,,,2018-09-10 17:52:28
57542836,133736786,,,,2018-09-10 23:16:13
57675346,133822116,,,,2018-09-13 17:59:19
58503736,134383046,,,,2018-10-08 17:49:29
58503856,134383176,,,,2018-10-08 17:54:17
59428846,134988516,,,,2018-10-31 17:30:40
60400066,135583676,,,,2018-11-21 17:08:53
61088626,136022286,,,,2018-12-10 18:01:42
61884186,136508426,,,,2019-01-08 17:27:32
61885366,136509566,,,,2019-01-08 17:57:44
62024726,136598756,,,,2019-01-11 21:00:57
62257986,136746346,,,,2019-01-17 19:19:05
63506906,137527956,,,,2019-02-20 17:23:30
63556186,137559956,,,,2019-02-21 17:46:17
64024086,137824786,,,,2019-03-04 19:12:56
66558706,139304236,,,,2019-04-29 17:20:56
66559306,139304466,,,,2019-04-29 17:32:14
66980846,139548496,,,,2019-05-08 17:34:16
67039296,139581266,,,,2019-05-09 15:19:05
67131396,139619466,,,,2019-05-10 16:05:30
67495816,139812856,,,,2019-05-17 14:50:20
68192386,140203726,,,,2019-06-03 19:34:54
68197356,140206956,,,,2019-06-03 20:59:46
68755776,140506806,,,,2019-06-14 17:17:18
69108056,140715576,,,,2019-06-21 18:33:19
69775776,141092076,,,,2019-07-08 15:16:08
69775486,141091746,,,,2019-07-08 15:13:19
69776656,141092526,,,,2019-07-08 15:24:18
69777076,141092656,,,,2019-07-08 15:29:15
70247496,141360566,,,,2019-07-18 15:40:03
70668196,141360566,,,,2019-07-29 18:33:05
id,campaign_id,intended_status,click_uri,last_modified_at,created_time,text_ad_landing_page,spotlight_landing_page
125339904,174942134,,,,2021-03-08 23:42:20,,"http://www.linkedin.com"
186286604,202434464,,,,2022-09-16 02:46:54,,"http://www.linkedin.com"
54106906,131454616,,,,2018-05-18 01:04:02,,"http://www.linkedin.com"
54106976,131454826,,,,2018-05-18 01:09:08,,"http://www.linkedin.com"
54299976,131580446,,,,2018-05-24 00:38:47,,"http://www.linkedin.com"
54300176,131580546,,,,2018-05-24 00:47:40,,"http://www.linkedin.com"
82332766,148633856,,,,2020-03-20 18:55:40,,"http://www.linkedin.com"
82460426,148711996,,,,2020-03-24 17:56:49,,"http://www.linkedin.com"
102541764,162464924,,,,2020-05-08 09:34:15,,"http://www.linkedin.com"
102694624,162557074,,,,2020-05-12 14:08:40,,"http://www.linkedin.com"
107943663,165867684,,,,2020-07-22 19:28:31,,"http://www.linkedin.com"
110663234,167276694,,,,2020-09-10 18:08:57,,"http://www.linkedin.com"
44900356,125600246,,,,2017-06-08 21:46:06,,"http://www.linkedin.com"
44900356,125600246,,,,2017-06-08 21:46:06,,"http://www.linkedin.com"
44900356,125600246,,,,2017-06-08 21:46:06,,"http://www.linkedin.com"
44900356,125600246,,,,2017-06-08 21:46:06,,"http://www.linkedin.com"
44900336,125600246,,,,2017-06-08 21:46:06,,"http://www.linkedin.com"
44900336,125600246,,,,2017-06-08 21:46:06,,"http://www.linkedin.com"
44900336,125600246,,,,2017-06-08 21:46:06,,"http://www.linkedin.com"
44900336,125600246,,,,2017-06-08 21:46:06,,"http://www.linkedin.com"
44900366,125600246,,,,2017-06-08 21:46:06,,"http://www.linkedin.com"
44900366,125600246,,,,2017-06-08 21:46:06,,"http://www.linkedin.com"
44900366,125600246,,,,2017-06-08 21:46:06,,"http://www.linkedin.com"
44900366,125600246,,,,2017-06-08 21:46:06,,"http://www.linkedin.com"
44900346,125600246,,,,2017-06-08 21:46:06,,"http://www.linkedin.com"
44900346,125600246,,,,2017-06-08 21:46:06,,"http://www.linkedin.com"
44900346,125600246,,,,2017-06-08 21:46:06,,"http://www.linkedin.com"
44900346,125600246,,,,2017-06-08 21:46:06,,"http://www.linkedin.com"
55220334,133160324,,,,2017-08-04 22:45:09,,"http://www.linkedin.com"
55220334,133160324,,,,2017-08-04 22:45:09,,"http://www.linkedin.com"
44901856,125599426,,,,2017-06-08 22:29:09,,"http://www.linkedin.com"
55220334,133160324,,,,2017-08-04 22:45:09,,"http://www.linkedin.com"
44901856,125599426,,,,2017-06-08 22:29:09,,"http://www.linkedin.com"
44901856,125599426,,,,2017-06-08 22:29:09,,"http://www.linkedin.com"
44901866,125599426,,,,2017-06-08 22:29:09,"http://www.google.com",
44901866,125599426,,,,2017-06-08 22:29:09,"http://www.google.com",
44901866,125599426,,,,2017-06-08 22:29:09,"http://www.google.com",
55220324,133160324,,,,2017-08-04 22:45:09,"http://www.google.com",
55220324,133160324,,,,2017-08-04 22:45:09,"http://www.google.com",
55220324,133160324,,,,2017-08-04 22:45:09,"http://www.google.com",
44901876,125599426,,,,2017-06-08 22:29:09,"http://www.google.com",
55220314,133160324,,,,2017-08-04 22:45:09,"http://www.google.com",
44901876,125599426,,,,2017-06-08 22:29:09,"http://www.google.com",
55220314,133160324,,,,2017-08-04 22:45:09,"http://www.google.com",
55220314,133160324,,,,2017-08-04 22:45:09,"http://www.google.com",
44901876,125599426,,,,2017-06-08 22:29:09,"http://www.google.com",
44901876,125599426,,,,2017-06-08 22:29:09,"http://www.google.com",
55220314,133160324,,,,2017-08-04 22:45:09,"http://www.google.com",
55220304,133160324,,,,2017-08-04 22:45:09,"http://www.google.com",
44901886,125599426,,,,2017-06-08 22:29:09,"http://www.google.com",
44901886,125599426,,,,2017-06-08 22:29:09,"http://www.google.com",
44901886,125599426,,,,2017-06-08 22:29:09,"http://www.google.com",
55220304,133160324,,,,2017-08-04 22:45:09,"http://www.google.com",
55220304,133160324,,,,2017-08-04 22:45:09,"http://www.google.com",
55220304,133160324,,,,2017-08-04 22:45:09,"http://www.google.com",
44901886,125599426,,,,2017-06-08 22:29:09,"http://www.google.com",
48046336,127624356,,,,2017-10-10 16:49:38,"http://www.google.com",
48046326,127624356,,,,2017-10-10 16:49:38,"http://www.google.com",
48046346,127624356,,,,2017-10-10 16:49:38,"http://www.google.com",
50036216,128806186,,,,2017-12-22 17:38:12,"http://www.google.com",
50035816,128806016,,,,2017-12-22 17:27:45,"http://www.google.com",
50036226,128806186,,,,2017-12-22 17:38:12,"http://www.google.com",
50035806,128806016,,,,2017-12-22 17:27:45,"http://www.google.com",
56166306,132822186,,,,2018-07-25 15:04:05,"http://www.google.com",
56166306,132822186,,,,2018-07-25 15:04:05,"http://www.google.com",
56166306,132822186,,,,2018-07-25 15:04:05,"http://www.google.com",
56237466,132870856,,,,2018-07-28 18:48:26,"http://www.google.com",
56237376,132866546,,,,2018-07-28 18:38:10,"http://www.google.com",
57434376,133672706,,,,2018-09-06 16:59:15,"http://www.google.com",
57527536,133728466,,,,2018-09-10 17:52:28,"http://www.google.com",
57542836,133736786,,,,2018-09-10 23:16:13,"http://www.google.com",
57675346,133822116,,"http://www.github.com",,2018-09-13 17:59:19,,
58503736,134383046,,"http://www.github.com",,2018-10-08 17:49:29,,
58503856,134383176,,"http://www.github.com",,2018-10-08 17:54:17,,
59428846,134988516,,"http://www.github.com",,2018-10-31 17:30:40,,
60400066,135583676,,"http://www.github.com",,2018-11-21 17:08:53,,
61088626,136022286,,"http://www.github.com",,2018-12-10 18:01:42,,
61884186,136508426,,"http://www.github.com",,2019-01-08 17:27:32,,
61885366,136509566,,"http://www.github.com",,2019-01-08 17:57:44,,
62024726,136598756,,"http://www.github.com",,2019-01-11 21:00:57,,
62257986,136746346,,"http://www.github.com",,2019-01-17 19:19:05,,
63506906,137527956,,"http://www.github.com",,2019-02-20 17:23:30,,
63556186,137559956,,"http://www.github.com",,2019-02-21 17:46:17,,
64024086,137824786,,"http://www.github.com",,2019-03-04 19:12:56,,
66558706,139304236,,"http://www.github.com",,2019-04-29 17:20:56,,
66559306,139304466,,"http://www.github.com",,2019-04-29 17:32:14,,
66980846,139548496,,"http://www.github.com",,2019-05-08 17:34:16,,
67039296,139581266,,"http://www.github.com",,2019-05-09 15:19:05,,
67131396,139619466,,"http://www.github.com",,2019-05-10 16:05:30,,
67495816,139812856,,"http://www.github.com",,2019-05-17 14:50:20,,
68192386,140203726,,"http://www.github.com",,2019-06-03 19:34:54,,
68197356,140206956,,"http://www.github.com",,2019-06-03 20:59:46,,
68755776,140506806,,"http://www.github.com",,2019-06-14 17:17:18,,
69108056,140715576,,"http://www.github.com",,2019-06-21 18:33:19,,
69775776,141092076,,"http://www.github.com",,2019-07-08 15:16:08,,
69775486,141091746,,"http://www.github.com",,2019-07-08 15:13:19,,
69776656,141092526,,"http://www.github.com",,2019-07-08 15:24:18,,
69777076,141092656,,"http://www.github.com",,2019-07-08 15:29:15,,
70247496,141360566,,"http://www.github.com",,2019-07-18 15:40:03,,
70668196,141360566,,"http://www.github.com",,2019-07-29 18:33:05,,
2 changes: 2 additions & 0 deletions macros/get_creative_history_columns.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
{"name": "last_modified_at", "datatype": dbt.type_timestamp()},
{"name": "intended_status", "datatype": dbt.type_string()},
{"name": "status", "datatype": dbt.type_string()},
{"name": "text_ad_landing_page", "datatype": dbt.type_string()},
{"name": "spotlight_landing_page", "datatype": dbt.type_string()}
] %}

{{ return(columns) }}
Expand Down
17 changes: 17 additions & 0 deletions macros/is_table_empty.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{%- macro is_table_empty(table_name) -%}

{{ adapter.dispatch('is_table_empty', 'linkedin_source') (table_name) }}

{%- endmacro %}

{%- macro default__is_table_empty(table_name) -%}
{%- if execute and flags.WHICH in ('run', 'build') %}
{% set row_count_query %}
select 1 from {{ table_name }} limit 1
{% endset %}
{% set results = run_query(row_count_query) %}
{% if results.rows | length == 0 %}
{{ return("empty") }}
{% endif %}
{% endif -%}
{%- endmacro -%}
14 changes: 14 additions & 0 deletions macros/result_if_table_exists.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{%- macro result_if_table_exists(table_ref, result_statement, if_empty=1) -%}

{{ adapter.dispatch('result_if_table_exists', 'linkedin_source') (table_ref, result_statement, if_empty=1) }}

{%- endmacro -%}

{%- macro default__result_if_table_exists(table_ref, result_statement, if_empty=1) -%}
{%- set is_empty_result = linkedin_source.is_table_empty(table_ref) -%}
{%- if is_empty_result == "empty" %}
{{ if_empty }}
{%- else %}
{{ result_statement }}
{%- endif %}
{%- endmacro %}
10 changes: 7 additions & 3 deletions models/src_linkedin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,13 @@ sources:
description: The ID of the campaign the creative belongs to.

- name: click_uri
description: |
Required when creative type is TEXT_AD. Maximum character limit of 500 after URL encoding all special characters.
Limit does not include the "https://" prefix.
description: Deprecated url field. Please refer to the text_ad_landing_page and spotlight_landing_page fields for relevant landing page information.

- name: text_ad_landing_page
description: The URL where the member should be redirected to, on clicking the text ad.

- name: spotlight_landing_page
description: The URL where the member should be redirected to, on clicking the spotlight ad.

- name: intended_status
description: |
Expand Down
7 changes: 4 additions & 3 deletions models/stg_linkedin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,10 @@ models:
CANCELED - Creative is permanently canceled.

- name: click_uri
description: |
Required when creative type is TEXT_AD. Maximum character limit of 500 after URL encoding all special characters.
Limit does not include the "https://" prefix.
description: The URL where the member should be redirected to, on clicking the text ad or spotlight ad.

- name: click_uri_type
description: Will either be `text_ad`, `spotlight`, or `null` to indicate the origin of the click_uri.
fivetran-joemarkiewicz marked this conversation as resolved.
Show resolved Hide resolved

- name: base_url
description: The base URL of the ad, extracted from the `click_uri`.
Expand Down
6 changes: 5 additions & 1 deletion models/stg_linkedin_ads__account_history.sql
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ with base as (
type,
cast(last_modified_time as {{ dbt.type_timestamp() }}) as last_modified_at,
cast(created_time as {{ dbt.type_timestamp() }}) as created_at,
row_number() over (partition by source_relation, id order by last_modified_time desc) = 1 as is_latest_version
{{ linkedin_source.result_if_table_exists(
table_ref=ref('stg_linkedin_ads__account_history_tmp'),
result_statement='row_number() over (partition by id' ~ (', source_relation' if var('linkedin_ads_union_schemas', []) or var('linkedin_ads_union_databases', []) | length > 1) ~ ' order by last_modified_time desc)',
if_empty=1
)}} = 1 as is_latest_version

from macro

Expand Down
6 changes: 5 additions & 1 deletion models/stg_linkedin_ads__campaign_group_history.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ with base as (
cast(run_schedule_end as {{ dbt.type_timestamp() }}) as run_schedule_end_at,
cast(last_modified_time as {{ dbt.type_timestamp() }}) as last_modified_at,
cast(created_time as {{ dbt.type_timestamp() }}) as created_at,
row_number() over (partition by source_relation, id order by last_modified_time desc) = 1 as is_latest_version
{{ linkedin_source.result_if_table_exists(
table_ref=ref('stg_linkedin_ads__campaign_group_history_tmp'),
result_statement='row_number() over (partition by id' ~ (', source_relation' if var('linkedin_ads_union_schemas', []) or var('linkedin_ads_union_databases', []) | length > 1) ~ ' order by last_modified_time desc)',
if_empty=1
)}} = 1 as is_latest_version

from macro

Expand Down
6 changes: 5 additions & 1 deletion models/stg_linkedin_ads__campaign_history.sql
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ with base as (
cast(run_schedule_end as {{ dbt.type_timestamp() }}) as run_schedule_end_at,
cast(last_modified_time as {{ dbt.type_timestamp() }}) as last_modified_at,
cast(created_time as {{ dbt.type_timestamp() }}) as created_at,
row_number() over (partition by source_relation, id order by last_modified_time desc) = 1 as is_latest_version
{{ linkedin_source.result_if_table_exists(
table_ref=ref('stg_linkedin_ads__campaign_history_tmp'),
result_statement='row_number() over (partition by id' ~ (', source_relation' if var('linkedin_ads_union_schemas', []) or var('linkedin_ads_union_databases', []) | length > 1) ~ ' order by last_modified_time desc)',
if_empty=1
)}} = 1 as is_latest_version

from macro

Expand Down
Loading