-
Notifications
You must be signed in to change notification settings - Fork 25
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/connector name update #132
Changes from 5 commits
725d2d9
c1295fa
c85f4cc
f439cf3
971b3ea
add07b6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
connector_id,destination_id,free_type,measured_date,schema_name,sync_type,table_name,updated_at,_fivetran_synced,incremental_rows | ||
this_connector,ups_trampoline,PAID,2022-01-31 00:00:00,this_connector,UNKNOWN,my_table,2022-09-01 6:12:13,2022-11-09 20:09:26,46 | ||
this_connector,ups_trampoline,PAID,2022-02-22 00:00:00,that_connector,UNKNOWN,drop_table,2022-05-22 8:29:22,2022-11-07 20:10:24,1 | ||
this_connector,television_trace,PAID,2022-03-01 00:00:00,that_connector,UNKNOWN,drop_table,2022-03-01 21:52:24,2022-11-07 20:10:15,8 | ||
this_connector,television_trace,PAID,2022-03-04 00:00:00,that_connector,UNKNOWN,drop_table,2022-03-04 16:19:05,2022-11-07 20:10:16,1 | ||
this_connector,television_trace,PAID,2022-07-29 00:00:00,that_connector,UNKNOWN,drop_table,2022-07-29 23:05:17,2022-11-07 20:10:33,4 | ||
this_connector,television_trace,PAID,2022-05-14 00:00:00,that_connector,UNKNOWN,drop_table,2022-05-14 11:07:37,2022-11-07 20:10:24,1 | ||
this_connector,television_trace,PAID,2021-09-19 00:00:00,that_connector,UNKNOWN,drop_table,2021-09-19 12:11:38,2022-11-07 20:09:55,0 | ||
that_connector,television_trace,PAID,2022-06-08 00:00:00,that_connector,UNKNOWN,drop_table,2022-06-08 21:29:07,2022-11-07 20:10:25,2 | ||
that_connector,television_trace,PAID,2022-03-05 00:00:00,that_connector,UNKNOWN,drop_table,2022-03-05 10:55:00,2022-11-07 20:10:16,1 | ||
that_connector,television_trace,PAID,2022-07-01 00:00:00,that_connector,UNKNOWN,drop_table,2022-07-01 21:56:37,2022-11-07 20:10:30,1 | ||
connector_name,connector_id,destination_id,free_type,measured_date,schema_name,sync_type,table_name,updated_at,_fivetran_synced,incremental_rows | ||
this_connector,,ups_trampoline,PAID,2022-01-31 00:00:00,this_connector,UNKNOWN,my_table,2022-09-01 6:12:13,2022-11-09 20:09:26,46 | ||
this_connector,,ups_trampoline,PAID,2022-02-22 00:00:00,that_connector,UNKNOWN,drop_table,2022-05-22 8:29:22,2022-11-07 20:10:24,1 | ||
,this_connector,television_trace,PAID,2022-03-01 00:00:00,that_connector,UNKNOWN,drop_table,2022-03-01 21:52:24,2022-11-07 20:10:15,8 | ||
this_connector,,television_trace,PAID,2022-03-04 00:00:00,that_connector,UNKNOWN,drop_table,2022-03-04 16:19:05,2022-11-07 20:10:16,1 | ||
this_connector,,television_trace,PAID,2022-07-29 00:00:00,that_connector,UNKNOWN,drop_table,2022-07-29 23:05:17,2022-11-07 20:10:33,4 | ||
this_connector,,television_trace,PAID,2022-05-14 00:00:00,that_connector,UNKNOWN,drop_table,2022-05-14 11:07:37,2022-11-07 20:10:24,1 | ||
this_connector,,television_trace,PAID,2021-09-19 00:00:00,that_connector,UNKNOWN,drop_table,2021-09-19 12:11:38,2022-11-07 20:09:55,0 | ||
this_connector,,television_trace,PAID,2022-06-08 00:00:00,that_connector,UNKNOWN,drop_table,2022-06-08 21:29:07,2022-11-07 20:10:25,2 | ||
,this_connector,television_trace,PAID,2022-03-05 00:00:00,that_connector,UNKNOWN,drop_table,2022-03-05 10:55:00,2022-11-07 20:10:16,1 | ||
this_connector,,television_trace,PAID,2022-07-01 00:00:00,that_connector,UNKNOWN,drop_table,2022-07-01 21:56:37,2022-11-07 20:10:30,1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{% macro get_incremental_mar_columns() %} | ||
|
||
{% set columns = [ | ||
{"name": "_fivetran_synced", "datatype": dbt.type_timestamp()}, | ||
{"name": "connector_id", "datatype": dbt.type_string()}, | ||
{"name": "connector_name", "datatype": dbt.type_string()}, | ||
{"name": "destination_id", "datatype": dbt.type_string()}, | ||
{"name": "free_type", "datatype": dbt.type_string()}, | ||
{"name": "measured_date", "datatype": dbt.type_timestamp()}, | ||
{"name": "schema_name", "datatype": dbt.type_string()}, | ||
{"name": "sync_type", "datatype": dbt.type_string()}, | ||
{"name": "table_name", "datatype": dbt.type_string()}, | ||
{"name": "incremental_rows", "datatype": dbt.type_int()}, | ||
{"name": "updated_at", "datatype": dbt.type_timestamp()} | ||
] %} | ||
|
||
{{ return(columns) }} | ||
|
||
{% endmacro %} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,9 @@ sources: | |
Each measurement is calculated cumulatively for the month and includes all types of mar (paid, free, etc.) | ||
columns: | ||
- name: connector_id | ||
description: The *name* of the connector being measured. Note - this is erroneously named and will be fixed soon by Fivetran. | ||
description: The *name* of the connector being measured. This may still be present in older Fivetran Platform connectors. However, all connectors setup after July 2024 will not have this field as it has been replaced with connector_name. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we still call out that it's misnamed so that people don't assume There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I think that would be a good callout to still mention. Just updated the documentation and regen'd the docs. |
||
- name: connector_name | ||
description: The name of the connector being measured. | ||
- name: destination_id | ||
description: Foreign key referencing the `destination` whose table is being measured. | ||
- name: free_type | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,24 @@ | ||
with base as ( | ||
|
||
select * | ||
from {{ var('incremental_mar') }} | ||
from {{ ref('stg_fivetran_platform__incremental_mar_tmp') }} | ||
), | ||
|
||
fields as ( | ||
select | ||
{{ | ||
fivetran_utils.fill_staging_columns( | ||
source_columns=adapter.get_columns_in_relation(ref('stg_fivetran_platform__incremental_mar_tmp')), | ||
staging_columns=get_incremental_mar_columns() | ||
) | ||
}} | ||
from base | ||
), | ||
|
||
final as ( | ||
|
||
select | ||
connector_id as connector_name, | ||
coalesce(connector_name, connector_id) as connector_name, | ||
destination_id, | ||
free_type, | ||
cast(measured_date as {{ dbt.type_timestamp() }}) as measured_date, | ||
|
@@ -17,8 +28,8 @@ fields as ( | |
updated_at, | ||
_fivetran_synced, | ||
incremental_rows | ||
from base | ||
from fields | ||
) | ||
|
||
select * | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This query is still pulling from the result of the
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great catch, it seems this wasn't an issue because the fill_staging_columns macro has the connector_name regardless and therefore wasn't erroring out. Thanks for catching this and just updated. |
||
from fields | ||
from final |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
select * | ||
from {{ var('incremental_mar') }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth calling out the seed changes to
incremental_mar
for validating that the data comes through properly.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing, added.