diff --git a/integration_tests/dbt_project.yml b/integration_tests/dbt_project.yml index 848a163..8e9422d 100644 --- a/integration_tests/dbt_project.yml +++ b/integration_tests/dbt_project.yml @@ -44,63 +44,125 @@ seeds: last_activity_date: timestamp last_referenced_date: timestamp last_viewed_date: timestamp + account_number: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" annual_revenue: float billing_latitude: float billing_longitude: float + parent_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + product_code: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + shipping_city: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + shipping_country: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + shipping_country_code: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + shipping_postal_code: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + shipping_state: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + shipping_state_code: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + shipping_street: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" shipping_latitude: float shipping_longitude: float sf_opportunity_data: +column_types: + amount: float + campaign_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" close_date: timestamp + converted_account_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + converted_contact_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + converted_opportunity_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + created_by_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" created_date: timestamp + individual_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" last_activity_date: timestamp + last_modified_by_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" last_referenced_date: timestamp last_viewed_date: timestamp - amount: float + master_record_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + mobile_phone: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + next_step: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + owner_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + phone: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + postal_code: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" probability: float + state_code: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + synced_quote_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" sf_user_data: +column_types: + account_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + company_name: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + contact_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + country_code: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + individual_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" last_login_date: timestamp last_referenced_date: timestamp last_viewed_date: timestamp - offline_trial_expiration_date: timestamp latitude: float longitude: float + manager_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + offline_trial_expiration_date: timestamp + postal_code: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + profile_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + state_code: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + user_role_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" sf_contact_data: +column_types: birthdate: timestamp created_date: timestamp email_bounced_date: timestamp + home_phone: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + individual_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + is_deleted: boolean last_activity_date: timestamp last_curequest_date: timestamp last_cuupdate_date: timestamp last_modified_date: timestamp last_referenced_date: timestamp last_viewed_date: timestamp + mailing_postal_code: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + master_record_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + mobile_phone: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + reports_to_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" system_modstamp: timestamp - is_deleted: boolean sf_lead_data: +column_types: converted_date: timestamp + converted_opportunity_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + country_code: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" created_date: timestamp email_bounced_date: timestamp + email_bounced_reason: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + individual_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" last_activity_date: timestamp last_modified_date: timestamp last_referenced_date: timestamp last_viewed_date: timestamp + lead_source: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + master_record_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + mobile_phone: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + owner_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + phone: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + postal_code: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + state_code: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" system_modstamp: timestamp is_deleted: boolean sf_task_data: +column_types: + account_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" activity_date: timestamp + call_disposition: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + call_object: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + call_type: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" completed_date_time: timestamp + created_by_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" created_date: timestamp + is_deleted: boolean + last_modified_by_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" last_modified_date: timestamp + owner_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + record_type_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" recurrence_end_date_only: timestamp recurrence_start_date_only: timestamp reminder_date_time: timestamp system_modstamp: timestamp - is_deleted: boolean + what_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + who_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" sf_event_data: +column_types: activity_date: timestamp @@ -108,6 +170,7 @@ seeds: created_date: timestamp end_date: timestamp end_date_time: timestamp + group_event_type: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" last_modified_date : timestamp recurrence_2_pattern_start_date : timestamp recurrence_end_date_only: timestamp @@ -118,32 +181,69 @@ seeds: is_deleted: boolean sf_product_2_data: +column_types: + created_by_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" created_date: timestamp + display_url: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + external_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + is_deleted: boolean + last_modified_by_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" last_modified_date: timestamp last_referenced_date: timestamp last_viewed_date: timestamp + product_code: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + quantity_installment_period: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + quantity_schedule_type: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + quantity_unit_of_measure: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + record_type_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + revenue_installment_period: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + revenue_schedule_type: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" system_modstamp: timestamp - is_deleted: boolean sf_order_data: +column_types: + account_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + activated_by_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" activated_date: timestamp + billing_country_code: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + billing_state_code: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + contract_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + created_by_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" created_date: timestamp effective_date: timestamp end_date: timestamp + is_deleted: boolean + last_modified_by_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" last_modified_date: timestamp last_referenced_date: timestamp last_viewed_date: timestamp + opportunity_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + order_number: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + original_order_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + owner_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + pricebook_2_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + shipping_country_code: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + shipping_postal_code: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + shipping_state_code: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" system_modstamp: timestamp - is_deleted: boolean sf_opportunity_line_item_data: +column_types: + campaign_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + created_by_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" created_date: timestamp + has_quantity_schedule: boolean + has_revenue_schedule: boolean + has_schedule: boolean + is_deleted: boolean + last_modified_by_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" last_modified_date: timestamp last_referenced_date: timestamp last_viewed_date: timestamp + opportunity_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" + product_2_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" service_date: timestamp system_modstamp: timestamp - is_deleted: boolean + sf_user_role_data: + +column_types: + parent_role_id: "{{ 'string' if target.name in ['bigquery','spark', 'databricks'] else 'varchar' }}" sf_account_history_data: +column_types: @@ -154,7 +254,7 @@ seeds: is_deleted: boolean sf_contact_history_data: +column_types: - birthdate: timestamp + birthdate: timestamp last_activity_date: timestamp last_modified_date: timestamp last_viewed_date: timestamp diff --git a/macros/coalesce_w_renamed_col.sql b/macros/coalesce_w_renamed_col.sql new file mode 100644 index 0000000..eab3562 --- /dev/null +++ b/macros/coalesce_w_renamed_col.sql @@ -0,0 +1,8 @@ +{% macro coalesce_w_renamed_col(original_column_name, datatype=dbt.type_string(), alias=original_column_name, renamed_column_name=original_column_name.replace('_', '')) %} +{# This macro accomodates Fivetran connectors that keep the original salesforce field naming conventions without underscores #} + +coalesce(cast({{ renamed_column_name }} as {{ datatype }}), + cast({{ original_column_name }} as {{ datatype }})) + as {{ alias }} + +{%- endmacro %} \ No newline at end of file diff --git a/macros/get_account_columns.sql b/macros/get_account_columns.sql index a61bc0e..ae1764f 100644 --- a/macros/get_account_columns.sql +++ b/macros/get_account_columns.sql @@ -3,38 +3,63 @@ {% set columns = [ {"name": "_fivetran_synced", "datatype": dbt.type_timestamp()}, - {"name": "_fivetran_active", "datatype": "boolean"}, + {"name": "_fivetran_active", "datatype": dbt.type_boolean()}, {"name": "account_number", "datatype": dbt.type_string()}, + {"name": "accountnumber", "datatype": dbt.type_string()}, {"name": "account_source", "datatype": dbt.type_string()}, + {"name": "accountsource", "datatype": dbt.type_string()}, {"name": "annual_revenue", "datatype": dbt.type_float()}, + {"name": "annualrevenue", "datatype": dbt.type_float()}, {"name": "billing_city", "datatype": dbt.type_string()}, + {"name": "billingcity", "datatype": dbt.type_string()}, {"name": "billing_country", "datatype": dbt.type_string()}, + {"name": "billingcountry", "datatype": dbt.type_string()}, {"name": "billing_postal_code", "datatype": dbt.type_string()}, + {"name": "billingpostalcode", "datatype": dbt.type_string()}, {"name": "billing_state", "datatype": dbt.type_string()}, + {"name": "billingstate", "datatype": dbt.type_string()}, {"name": "billing_state_code", "datatype": dbt.type_string()}, + {"name": "billingstatecode", "datatype": dbt.type_string()}, {"name": "billing_street", "datatype": dbt.type_string()}, + {"name": "billingstreet", "datatype": dbt.type_string()}, {"name": "description", "datatype": dbt.type_string()}, {"name": "id", "datatype": dbt.type_string()}, {"name": "industry", "datatype": dbt.type_string()}, - {"name": "is_deleted", "datatype": "boolean"}, + {"name": "is_deleted", "datatype": dbt.type_boolean()}, + {"name": "isdeleted", "datatype": dbt.type_boolean()}, {"name": "last_activity_date", "datatype": dbt.type_timestamp()}, + {"name": "lastactivitydate", "datatype": dbt.type_timestamp()}, {"name": "last_referenced_date", "datatype": dbt.type_timestamp()}, + {"name": "lastreferenceddate", "datatype": dbt.type_timestamp()}, {"name": "last_viewed_date", "datatype": dbt.type_timestamp()}, + {"name": "lastvieweddate", "datatype": dbt.type_timestamp()}, {"name": "master_record_id", "datatype": dbt.type_string()}, + {"name": "masterrecordid", "datatype": dbt.type_string()}, {"name": "name", "datatype": dbt.type_string()}, {"name": "number_of_employees", "datatype": dbt.type_int()}, + {"name": "numberofemployees", "datatype": dbt.type_int()}, {"name": "owner_id", "datatype": dbt.type_string()}, + {"name": "ownerid", "datatype": dbt.type_string()}, {"name": "ownership", "datatype": dbt.type_string()}, {"name": "parent_id", "datatype": dbt.type_string()}, + {"name": "parentid", "datatype": dbt.type_string()}, {"name": "rating", "datatype": dbt.type_string()}, {"name": "record_type_id", "datatype": dbt.type_string()}, + {"name": "recordtypeid", "datatype": dbt.type_string()}, {"name": "shipping_city", "datatype": dbt.type_string()}, + {"name": "shippingcity", "datatype": dbt.type_string()}, {"name": "shipping_country", "datatype": dbt.type_string()}, + {"name": "shippingcountry", "datatype": dbt.type_string()}, {"name": "shipping_country_code", "datatype": dbt.type_string()}, + {"name": "shippingcountrycode", "datatype": dbt.type_string()}, {"name": "shipping_postal_code", "datatype": dbt.type_string()}, + {"name": "shippingpostalcode", "datatype": dbt.type_string()}, {"name": "shipping_state", "datatype": dbt.type_string()}, + {"name": "shippingstate", "datatype": dbt.type_string()}, {"name": "shipping_state_code", "datatype": dbt.type_string()}, + {"name": "shippingstatecode", "datatype": dbt.type_string()}, {"name": "shipping_street", "datatype": dbt.type_string()}, + {"name": "shippingstreet", "datatype": dbt.type_string()}, {"name": "type", "datatype": dbt.type_string()}, {"name": "website", "datatype": dbt.type_string()} ] %} diff --git a/macros/get_contact_columns.sql b/macros/get_contact_columns.sql index 3185589..cebc3df 100644 --- a/macros/get_contact_columns.sql +++ b/macros/get_contact_columns.sql @@ -2,37 +2,60 @@ {% set columns = [ {"name": "_fivetran_synced", "datatype": dbt.type_timestamp()}, - {"name": "_fivetran_active", "datatype": "boolean"}, + {"name": "_fivetran_active", "datatype": dbt.type_boolean()}, {"name": "account_id", "datatype": dbt.type_string()}, + {"name": "accountid", "datatype": dbt.type_string()}, {"name": "department", "datatype": dbt.type_string()}, {"name": "description", "datatype": dbt.type_string()}, {"name": "email", "datatype": dbt.type_string()}, {"name": "first_name", "datatype": dbt.type_string()}, + {"name": "firstname", "datatype": dbt.type_string()}, {"name": "home_phone", "datatype": dbt.type_string()}, + {"name": "homephone", "datatype": dbt.type_string()}, {"name": "id", "datatype": dbt.type_string()}, {"name": "individual_id", "datatype": dbt.type_string()}, - {"name": "is_deleted", "datatype": "boolean"}, + {"name": "individualid", "datatype": dbt.type_string()}, + {"name": "is_deleted", "datatype": dbt.type_boolean()}, + {"name": "isdeleted", "datatype": dbt.type_boolean()}, {"name": "last_activity_date", "datatype": dbt.type_timestamp()}, + {"name": "lastactivitydate", "datatype": dbt.type_timestamp()}, {"name": "last_modified_by_id", "datatype": dbt.type_string()}, + {"name": "lastmodifiedbyid", "datatype": dbt.type_string()}, {"name": "last_modified_date", "datatype": dbt.type_timestamp()}, + {"name": "lastmodifieddate", "datatype": dbt.type_timestamp()}, {"name": "last_name", "datatype": dbt.type_string()}, + {"name": "lastname", "datatype": dbt.type_string()}, {"name": "last_referenced_date", "datatype": dbt.type_timestamp()}, + {"name": "lastreferenceddate", "datatype": dbt.type_timestamp()}, {"name": "last_viewed_date", "datatype": dbt.type_timestamp()}, + {"name": "lastvieweddate", "datatype": dbt.type_timestamp()}, {"name": "lead_source", "datatype": dbt.type_string()}, + {"name": "leadsource", "datatype": dbt.type_string()}, {"name": "mailing_city", "datatype": dbt.type_string()}, + {"name": "mailingcity", "datatype": dbt.type_string()}, {"name": "mailing_country", "datatype": dbt.type_string()}, + {"name": "mailingcountry", "datatype": dbt.type_string()}, {"name": "mailing_country_code", "datatype": dbt.type_string()}, + {"name": "mailingcountrycode", "datatype": dbt.type_string()}, {"name": "mailing_postal_code", "datatype": dbt.type_string()}, + {"name": "mailingpostalcode", "datatype": dbt.type_string()}, {"name": "mailing_state", "datatype": dbt.type_string()}, + {"name": "mailingstate", "datatype": dbt.type_string()}, {"name": "mailing_state_code", "datatype": dbt.type_string()}, + {"name": "mailingstatecode", "datatype": dbt.type_string()}, {"name": "mailing_street", "datatype": dbt.type_string()}, + {"name": "mailingstreet", "datatype": dbt.type_string()}, {"name": "master_record_id", "datatype": dbt.type_string()}, + {"name": "masterrecordid", "datatype": dbt.type_string()}, {"name": "mobile_phone", "datatype": dbt.type_string()}, + {"name": "mobilephone", "datatype": dbt.type_string()}, {"name": "name", "datatype": dbt.type_string()}, {"name": "owner_id", "datatype": dbt.type_string()}, + {"name": "ownerid", "datatype": dbt.type_string()}, {"name": "phone", "datatype": dbt.type_string()}, {"name": "reports_to_id", "datatype": dbt.type_string()}, - {"name": "title", "datatype": dbt.type_string()}, + {"name": "reportstoid", "datatype": dbt.type_string()}, + {"name": "title", "datatype": dbt.type_string()} ] %} {{ fivetran_utils.add_pass_through_columns(columns, var('salesforce__contact_pass_through_columns')) }} diff --git a/macros/get_event_columns.sql b/macros/get_event_columns.sql index e1d2573..b809b4e 100644 --- a/macros/get_event_columns.sql +++ b/macros/get_event_columns.sql @@ -2,34 +2,56 @@ {% set columns = [ {"name": "_fivetran_synced", "datatype": dbt.type_timestamp()}, - {"name": "_fivetran_active", "datatype": "boolean"}, + {"name": "_fivetran_active", "datatype": dbt.type_boolean()}, {"name": "account_id", "datatype": dbt.type_string()}, + {"name": "accountid", "datatype": dbt.type_string()}, {"name": "activity_date", "datatype": dbt.type_timestamp()}, + {"name": "activitydate", "datatype": dbt.type_timestamp()}, {"name": "activity_date_time", "datatype": dbt.type_timestamp()}, + {"name": "activitydatetime", "datatype": dbt.type_timestamp()}, {"name": "created_by_id", "datatype": dbt.type_string()}, + {"name": "createdbyid", "datatype": dbt.type_string()}, {"name": "created_date", "datatype": dbt.type_timestamp()}, + {"name": "createddate", "datatype": dbt.type_timestamp()}, {"name": "description", "datatype": dbt.type_string()}, {"name": "end_date", "datatype": dbt.type_timestamp()}, + {"name": "enddate", "datatype": dbt.type_timestamp()}, {"name": "end_date_time", "datatype": dbt.type_timestamp()}, + {"name": "enddatetime", "datatype": dbt.type_timestamp()}, {"name": "event_subtype", "datatype": dbt.type_string()}, + {"name": "eventsubtype", "datatype": dbt.type_string()}, {"name": "group_event_type", "datatype": dbt.type_string()}, + {"name": "groupeventtype", "datatype": dbt.type_string()}, {"name": "id", "datatype": dbt.type_string()}, - {"name": "is_archived", "datatype": "boolean"}, - {"name": "is_child", "datatype": "boolean"}, - {"name": "is_deleted", "datatype": "boolean"}, - {"name": "is_group_event", "datatype": "boolean"}, - {"name": "is_recurrence", "datatype": "boolean"}, + {"name": "is_archived", "datatype": dbt.type_boolean()}, + {"name": "isarchived", "datatype": dbt.type_boolean()}, + {"name": "is_child", "datatype": dbt.type_boolean()}, + {"name": "ischild", "datatype": dbt.type_boolean()}, + {"name": "is_deleted", "datatype": dbt.type_boolean()}, + {"name": "isdeleted", "datatype": dbt.type_boolean()}, + {"name": "is_group_event", "datatype": dbt.type_boolean()}, + {"name": "isgroupevent", "datatype": dbt.type_boolean()}, + {"name": "is_recurrence", "datatype": dbt.type_boolean()}, + {"name": "isrecurrence", "datatype": dbt.type_boolean()}, {"name": "last_modified_by_id", "datatype": dbt.type_string()}, + {"name": "lastmodifiedbyid", "datatype": dbt.type_string()}, {"name": "last_modified_date", "datatype": dbt.type_timestamp()}, + {"name": "lastmodifieddate", "datatype": dbt.type_timestamp()}, {"name": "location", "datatype": dbt.type_string()}, {"name": "owner_id", "datatype": dbt.type_string()}, + {"name": "ownerid", "datatype": dbt.type_string()}, {"name": "start_date_time", "datatype": dbt.type_timestamp()}, + {"name": "startdatetime", "datatype": dbt.type_timestamp()}, {"name": "subject", "datatype": dbt.type_string()}, {"name": "type", "datatype": dbt.type_string()}, {"name": "what_count", "datatype": dbt.type_int()}, + {"name": "whatcount", "datatype": dbt.type_int()}, {"name": "what_id", "datatype": dbt.type_string()}, + {"name": "whatid", "datatype": dbt.type_string()}, {"name": "who_count", "datatype": dbt.type_int()}, - {"name": "who_id", "datatype": dbt.type_string()} + {"name": "whocount", "datatype": dbt.type_int()}, + {"name": "who_id", "datatype": dbt.type_string()}, + {"name": "whoid", "datatype": dbt.type_string()} ] %} {{ fivetran_utils.add_pass_through_columns(columns, var('salesforce__event_pass_through_columns')) }} diff --git a/macros/get_lead_columns.sql b/macros/get_lead_columns.sql index ef8f556..3de0c02 100644 --- a/macros/get_lead_columns.sql +++ b/macros/get_lead_columns.sql @@ -2,50 +2,79 @@ {% set columns = [ {"name": "_fivetran_synced", "datatype": dbt.type_timestamp()}, - {"name": "_fivetran_active", "datatype": "boolean"}, + {"name": "_fivetran_active", "datatype": dbt.type_boolean()}, {"name": "annual_revenue", "datatype": dbt.type_float()}, + {"name": "annualrevenue", "datatype": dbt.type_float()}, {"name": "city", "datatype": dbt.type_string()}, {"name": "company", "datatype": dbt.type_string()}, {"name": "converted_account_id", "datatype": dbt.type_string()}, + {"name": "convertedaccountid", "datatype": dbt.type_string()}, {"name": "converted_contact_id", "datatype": dbt.type_string()}, + {"name": "convertedcontactid", "datatype": dbt.type_string()}, {"name": "converted_date", "datatype": dbt.type_timestamp()}, + {"name": "converteddate", "datatype": dbt.type_timestamp()}, {"name": "converted_opportunity_id", "datatype": dbt.type_string()}, + {"name": "convertedopportunityid", "datatype": dbt.type_string()}, {"name": "country", "datatype": dbt.type_string()}, {"name": "country_code", "datatype": dbt.type_string()}, + {"name": "countrycode", "datatype": dbt.type_string()}, {"name": "created_by_id", "datatype": dbt.type_string()}, + {"name": "createdbyid", "datatype": dbt.type_string()}, {"name": "created_date", "datatype": dbt.type_timestamp()}, + {"name": "createddate", "datatype": dbt.type_timestamp()}, {"name": "description", "datatype": dbt.type_string()}, {"name": "email", "datatype": dbt.type_string()}, {"name": "email_bounced_date", "datatype": dbt.type_timestamp()}, + {"name": "emailbounceddate", "datatype": dbt.type_timestamp()}, {"name": "email_bounced_reason", "datatype": dbt.type_string()}, + {"name": "emailbouncedreason", "datatype": dbt.type_string()}, {"name": "first_name", "datatype": dbt.type_string()}, - {"name": "has_opted_out_of_email", "datatype": "boolean"}, + {"name": "firstname", "datatype": dbt.type_string()}, + {"name": "has_opted_out_of_email", "datatype": dbt.type_boolean()}, + {"name": "hasoptedoutofemail", "datatype": dbt.type_boolean()}, {"name": "id", "datatype": dbt.type_string()}, {"name": "individual_id", "datatype": dbt.type_string()}, + {"name": "individualid", "datatype": dbt.type_string()}, {"name": "industry", "datatype": dbt.type_string()}, - {"name": "is_converted", "datatype": "boolean"}, - {"name": "is_deleted", "datatype": "boolean"}, - {"name": "is_unread_by_owner", "datatype": "boolean"}, + {"name": "is_converted", "datatype": dbt.type_boolean()}, + {"name": "isconverted", "datatype": dbt.type_boolean()}, + {"name": "is_deleted", "datatype": dbt.type_boolean()}, + {"name": "isdeleted", "datatype": dbt.type_boolean()}, + {"name": "is_unread_by_owner", "datatype": dbt.type_boolean()}, + {"name": "isunreadbyowner", "datatype": dbt.type_boolean()}, {"name": "last_activity_date", "datatype": dbt.type_timestamp()}, + {"name": "lastactivitydate", "datatype": dbt.type_timestamp()}, {"name": "last_modified_by_id", "datatype": dbt.type_string()}, + {"name": "lastmodifiedbyid", "datatype": dbt.type_string()}, {"name": "last_modified_date", "datatype": dbt.type_timestamp()}, + {"name": "lastmodifieddate", "datatype": dbt.type_timestamp()}, {"name": "last_name", "datatype": dbt.type_string()}, + {"name": "lastname", "datatype": dbt.type_string()}, {"name": "last_referenced_date", "datatype": dbt.type_timestamp()}, + {"name": "lastreferenceddate", "datatype": dbt.type_timestamp()}, {"name": "last_viewed_date", "datatype": dbt.type_timestamp()}, + {"name": "lastvieweddate", "datatype": dbt.type_timestamp()}, {"name": "lead_source", "datatype": dbt.type_string()}, + {"name": "leadsource", "datatype": dbt.type_string()}, {"name": "master_record_id", "datatype": dbt.type_string()}, + {"name": "masterrecordid", "datatype": dbt.type_string()}, {"name": "mobile_phone", "datatype": dbt.type_string()}, + {"name": "mobilephone", "datatype": dbt.type_string()}, {"name": "name", "datatype": dbt.type_string()}, {"name": "number_of_employees", "datatype": dbt.type_int()}, + {"name": "numberofemployees", "datatype": dbt.type_int()}, {"name": "owner_id", "datatype": dbt.type_string()}, + {"name": "ownerid", "datatype": dbt.type_string()}, {"name": "phone", "datatype": dbt.type_string()}, {"name": "postal_code", "datatype": dbt.type_string()}, + {"name": "postalcode", "datatype": dbt.type_string()}, {"name": "state", "datatype": dbt.type_string()}, {"name": "state_code", "datatype": dbt.type_string()}, + {"name": "statecode", "datatype": dbt.type_string()}, {"name": "status", "datatype": dbt.type_string()}, {"name": "street", "datatype": dbt.type_string()}, {"name": "title", "datatype": dbt.type_string()}, - {"name": "website", "datatype": dbt.type_string()}, + {"name": "website", "datatype": dbt.type_string()} ] %} {{ fivetran_utils.add_pass_through_columns(columns, var('salesforce__lead_pass_through_columns')) }} diff --git a/macros/get_opportunity_columns.sql b/macros/get_opportunity_columns.sql index cb107e4..aa51a3d 100644 --- a/macros/get_opportunity_columns.sql +++ b/macros/get_opportunity_columns.sql @@ -3,38 +3,62 @@ {% set columns = [ {"name": "_fivetran_synced", "datatype": dbt.type_timestamp()}, - {"name": "_fivetran_active", "datatype": "boolean"}, + {"name": "_fivetran_active", "datatype": dbt.type_boolean()}, {"name": "account_id", "datatype": dbt.type_string()}, + {"name": "accountid", "datatype": dbt.type_string()}, {"name": "amount", "datatype": dbt.type_float()}, {"name": "campaign_id", "datatype": dbt.type_string()}, + {"name": "campaignid", "datatype": dbt.type_string()}, {"name": "close_date", "datatype": dbt.type_timestamp()}, + {"name": "closedate", "datatype": dbt.type_timestamp()}, {"name": "created_date", "datatype": dbt.type_timestamp()}, + {"name": "createddate", "datatype": dbt.type_timestamp()}, {"name": "description", "datatype": dbt.type_string()}, {"name": "expected_revenue", "datatype": dbt.type_numeric()}, + {"name": "expectedrevenue", "datatype": dbt.type_numeric()}, {"name": "fiscal", "datatype": dbt.type_string()}, {"name": "fiscal_quarter", "datatype": dbt.type_int()}, + {"name": "fiscalquarter", "datatype": dbt.type_int()}, {"name": "fiscal_year", "datatype": dbt.type_int()}, + {"name": "fiscalyear", "datatype": dbt.type_int()}, {"name": "forecast_category", "datatype": dbt.type_string()}, + {"name": "forecastcategory", "datatype": dbt.type_string()}, {"name": "forecast_category_name", "datatype": dbt.type_string()}, - {"name": "has_open_activity", "datatype": "boolean"}, - {"name": "has_opportunity_line_item", "datatype": "boolean"}, - {"name": "has_overdue_task", "datatype": "boolean"}, + {"name": "forecastcategoryname", "datatype": dbt.type_string()}, + {"name": "has_open_activity", "datatype": dbt.type_boolean()}, + {"name": "hasopenactivity", "datatype": dbt.type_boolean()}, + {"name": "has_opportunity_line_item", "datatype": dbt.type_boolean()}, + {"name": "hasopportunitylineitem", "datatype": dbt.type_boolean()}, + {"name": "has_overdue_task", "datatype": dbt.type_boolean()}, + {"name": "hasoverduetask", "datatype": dbt.type_boolean()}, {"name": "id", "datatype": dbt.type_string()}, - {"name": "is_closed", "datatype": "boolean"}, - {"name": "is_deleted", "datatype": "boolean"}, - {"name": "is_won", "datatype": "boolean"}, + {"name": "is_closed", "datatype": dbt.type_boolean()}, + {"name": "isclosed", "datatype": dbt.type_boolean()}, + {"name": "is_deleted", "datatype": dbt.type_boolean()}, + {"name": "isdeleted", "datatype": dbt.type_boolean()}, + {"name": "is_won", "datatype": dbt.type_boolean()}, + {"name": "iswon", "datatype": dbt.type_boolean()}, {"name": "last_activity_date", "datatype": dbt.type_timestamp()}, + {"name": "lastactivitydate", "datatype": dbt.type_timestamp()}, {"name": "last_referenced_date", "datatype": dbt.type_timestamp()}, + {"name": "lastreferenceddate", "datatype": dbt.type_timestamp()}, {"name": "last_viewed_date", "datatype": dbt.type_timestamp()}, + {"name": "lastvieweddate", "datatype": dbt.type_timestamp()}, {"name": "lead_source", "datatype": dbt.type_string()}, + {"name": "leadsource", "datatype": dbt.type_string()}, {"name": "name", "datatype": dbt.type_string()}, {"name": "next_step", "datatype": dbt.type_string()}, + {"name": "nextstep", "datatype": dbt.type_string()}, {"name": "owner_id", "datatype": dbt.type_string()}, + {"name": "ownerid", "datatype": dbt.type_string()}, {"name": "probability", "datatype": dbt.type_float()}, {"name": "record_type_id", "datatype": dbt.type_string()}, + {"name": "recordtypeid", "datatype": dbt.type_string()}, {"name": "stage_name", "datatype": dbt.type_string()}, + {"name": "stagename", "datatype": dbt.type_string()}, {"name": "synced_quote_id", "datatype": dbt.type_string()}, - {"name": "type", "datatype": dbt.type_string()}, + {"name": "syncedquoteid", "datatype": dbt.type_string()}, + {"name": "type", "datatype": dbt.type_string()} ] %} {{ fivetran_utils.add_pass_through_columns(columns, var('salesforce__opportunity_pass_through_columns')) }} diff --git a/macros/get_opportunity_line_item_columns.sql b/macros/get_opportunity_line_item_columns.sql index 5b26f44..e42dd3e 100644 --- a/macros/get_opportunity_line_item_columns.sql +++ b/macros/get_opportunity_line_item_columns.sql @@ -2,31 +2,50 @@ {% set columns = [ {"name": "_fivetran_synced", "datatype": dbt.type_timestamp()}, - {"name": "_fivetran_active", "datatype": "boolean"}, + {"name": "_fivetran_active", "datatype": dbt.type_boolean()}, {"name": "created_by_id", "datatype": dbt.type_string()}, + {"name": "createdbyid", "datatype": dbt.type_string()}, {"name": "created_date", "datatype": dbt.type_timestamp()}, + {"name": "createddate", "datatype": dbt.type_timestamp()}, {"name": "description", "datatype": dbt.type_string()}, {"name": "discount", "datatype": dbt.type_float()}, - {"name": "has_quantity_schedule", "datatype": "boolean"}, - {"name": "has_revenue_schedule", "datatype": "boolean"}, - {"name": "has_schedule", "datatype": "boolean"}, + {"name": "has_quantity_schedule", "datatype": dbt.type_boolean()}, + {"name": "hasquantityschedule", "datatype": dbt.type_boolean()}, + {"name": "has_revenue_schedule", "datatype": dbt.type_boolean()}, + {"name": "hasrevenueschedule", "datatype": dbt.type_boolean()}, + {"name": "has_schedule", "datatype": dbt.type_boolean()}, + {"name": "hasschedule", "datatype": dbt.type_boolean()}, {"name": "id", "datatype": dbt.type_string()}, - {"name": "is_deleted", "datatype": "boolean"}, + {"name": "is_deleted", "datatype": dbt.type_boolean()}, + {"name": "isdeleted", "datatype": dbt.type_boolean()}, {"name": "last_modified_by_id", "datatype": dbt.type_string()}, + {"name": "lastmodifiedbyid", "datatype": dbt.type_string()}, {"name": "last_modified_date", "datatype": dbt.type_timestamp()}, + {"name": "lastmodifieddate", "datatype": dbt.type_timestamp()}, {"name": "last_referenced_date", "datatype": dbt.type_timestamp()}, + {"name": "lastreferenceddate", "datatype": dbt.type_timestamp()}, {"name": "last_viewed_date", "datatype": dbt.type_timestamp()}, + {"name": "lastvieweddate", "datatype": dbt.type_timestamp()}, {"name": "list_price", "datatype": dbt.type_float()}, + {"name": "listprice", "datatype": dbt.type_float()}, {"name": "name", "datatype": dbt.type_string()}, {"name": "opportunity_id", "datatype": dbt.type_string()}, + {"name": "opportunityid", "datatype": dbt.type_string()}, {"name": "pricebook_entry_id", "datatype": dbt.type_string()}, + {"name": "pricebookentryid", "datatype": dbt.type_string()}, {"name": "product_2_id", "datatype": dbt.type_string()}, + {"name": "product2id", "datatype": dbt.type_string()}, {"name": "product_code", "datatype": dbt.type_string()}, + {"name": "productcode", "datatype": dbt.type_string()}, {"name": "quantity", "datatype": dbt.type_float()}, {"name": "service_date", "datatype": dbt.type_timestamp()}, + {"name": "servicedate", "datatype": dbt.type_timestamp()}, {"name": "sort_order", "datatype": dbt.type_int()}, + {"name": "sortorder", "datatype": dbt.type_int()}, {"name": "total_price", "datatype": dbt.type_float()}, - {"name": "unit_price", "datatype": dbt.type_float()} + {"name": "totalprice", "datatype": dbt.type_float()}, + {"name": "unit_price", "datatype": dbt.type_float()}, + {"name": "unitprice", "datatype": dbt.type_float()} ] %} {{ fivetran_utils.add_pass_through_columns(columns, var('salesforce__opportunity_line_item_pass_through_columns')) }} diff --git a/macros/get_order_columns.sql b/macros/get_order_columns.sql index 96f857a..39d3d16 100644 --- a/macros/get_order_columns.sql +++ b/macros/get_order_columns.sql @@ -2,43 +2,75 @@ {% set columns = [ {"name": "_fivetran_synced", "datatype": dbt.type_timestamp()}, - {"name": "_fivetran_active", "datatype": "boolean"}, + {"name": "_fivetran_active", "datatype": dbt.type_boolean()}, {"name": "account_id", "datatype": dbt.type_string()}, + {"name": "accountid", "datatype": dbt.type_string()}, {"name": "activated_by_id", "datatype": dbt.type_string()}, + {"name": "activatedbyid", "datatype": dbt.type_string()}, {"name": "activated_date", "datatype": dbt.type_timestamp()}, + {"name": "activateddate", "datatype": dbt.type_timestamp()}, {"name": "billing_city", "datatype": dbt.type_string()}, + {"name": "billingcity", "datatype": dbt.type_string()}, {"name": "billing_country", "datatype": dbt.type_string()}, + {"name": "billingcountry", "datatype": dbt.type_string()}, {"name": "billing_country_code", "datatype": dbt.type_string()}, + {"name": "billingcountrycode", "datatype": dbt.type_string()}, {"name": "billing_postal_code", "datatype": dbt.type_string()}, + {"name": "billingpostalcode", "datatype": dbt.type_string()}, {"name": "billing_state", "datatype": dbt.type_string()}, + {"name": "billingstate", "datatype": dbt.type_string()}, {"name": "billing_state_code", "datatype": dbt.type_string()}, + {"name": "billingstatecode", "datatype": dbt.type_string()}, {"name": "billing_street", "datatype": dbt.type_string()}, + {"name": "billingstreet", "datatype": dbt.type_string()}, {"name": "contract_id", "datatype": dbt.type_string()}, + {"name": "contractid", "datatype": dbt.type_string()}, {"name": "created_by_id", "datatype": dbt.type_string()}, + {"name": "createdbyid", "datatype": dbt.type_string()}, {"name": "created_date", "datatype": dbt.type_timestamp()}, + {"name": "createddate", "datatype": dbt.type_timestamp()}, {"name": "description", "datatype": dbt.type_string()}, {"name": "end_date", "datatype": dbt.type_timestamp()}, + {"name": "enddate", "datatype": dbt.type_timestamp()}, {"name": "id", "datatype": dbt.type_string()}, - {"name": "is_deleted", "datatype": "boolean"}, + {"name": "is_deleted", "datatype": dbt.type_boolean()}, + {"name": "isdeleted", "datatype": dbt.type_boolean()}, {"name": "last_modified_by_id", "datatype": dbt.type_string()}, + {"name": "lastmodifiedbyid", "datatype": dbt.type_string()}, {"name": "last_modified_date", "datatype": dbt.type_timestamp()}, + {"name": "lastmodifieddate", "datatype": dbt.type_timestamp()}, {"name": "last_referenced_date", "datatype": dbt.type_timestamp()}, + {"name": "lastreferenceddate", "datatype": dbt.type_timestamp()}, {"name": "last_viewed_date", "datatype": dbt.type_timestamp()}, + {"name": "lastvieweddate", "datatype": dbt.type_timestamp()}, {"name": "opportunity_id", "datatype": dbt.type_string()}, + {"name": "opportunityid", "datatype": dbt.type_string()}, {"name": "order_number", "datatype": dbt.type_string()}, + {"name": "ordernumber", "datatype": dbt.type_string()}, {"name": "original_order_id", "datatype": dbt.type_string()}, + {"name": "originalorderid", "datatype": dbt.type_string()}, {"name": "owner_id", "datatype": dbt.type_string()}, + {"name": "ownerid", "datatype": dbt.type_string()}, {"name": "pricebook_2_id", "datatype": dbt.type_string()}, + {"name": "pricebook2id", "datatype": dbt.type_string()}, {"name": "shipping_city", "datatype": dbt.type_string()}, + {"name": "shippingcity", "datatype": dbt.type_string()}, {"name": "shipping_country", "datatype": dbt.type_string()}, + {"name": "shippingcountry", "datatype": dbt.type_string()}, {"name": "shipping_country_code", "datatype": dbt.type_string()}, + {"name": "shippingcountrycode", "datatype": dbt.type_string()}, {"name": "shipping_postal_code", "datatype": dbt.type_string()}, + {"name": "shippingpostalcode", "datatype": dbt.type_string()}, {"name": "shipping_state", "datatype": dbt.type_string()}, + {"name": "shippingstate", "datatype": dbt.type_string()}, {"name": "shipping_state_code", "datatype": dbt.type_string()}, + {"name": "shippingstatecode", "datatype": dbt.type_string()}, {"name": "shipping_street", "datatype": dbt.type_string()}, + {"name": "shippingstreet", "datatype": dbt.type_string()}, {"name": "status", "datatype": dbt.type_string()}, {"name": "total_amount", "datatype": dbt.type_float()}, - {"name": "type", "datatype": dbt.type_string()}, + {"name": "totalamount", "datatype": dbt.type_float()}, + {"name": "type", "datatype": dbt.type_string()} ] %} {{ fivetran_utils.add_pass_through_columns(columns, var('salesforce__order_pass_through_columns')) }} diff --git a/macros/get_product_2_columns.sql b/macros/get_product_2_columns.sql index 3fcb77b..fda435f 100644 --- a/macros/get_product_2_columns.sql +++ b/macros/get_product_2_columns.sql @@ -2,31 +2,51 @@ {% set columns = [ {"name": "_fivetran_synced", "datatype": dbt.type_timestamp()}, - {"name": "_fivetran_active", "datatype": "boolean"}, + {"name": "_fivetran_active", "datatype": dbt.type_boolean()}, {"name": "created_by_id", "datatype": dbt.type_string()}, + {"name": "createdbyid", "datatype": dbt.type_string()}, {"name": "created_date", "datatype": dbt.type_timestamp()}, + {"name": "createddate", "datatype": dbt.type_timestamp()}, {"name": "description", "datatype": dbt.type_string()}, {"name": "display_url", "datatype": dbt.type_string()}, + {"name": "displayurl", "datatype": dbt.type_string()}, {"name": "external_id", "datatype": dbt.type_string()}, + {"name": "externalid", "datatype": dbt.type_string()}, {"name": "family", "datatype": dbt.type_string()}, {"name": "id", "datatype": dbt.type_string()}, - {"name": "is_active", "datatype": "boolean"}, - {"name": "is_archived", "datatype": "boolean"}, - {"name": "is_deleted", "datatype": "boolean"}, + {"name": "is_active", "datatype": dbt.type_boolean()}, + {"name": "isactive", "datatype": dbt.type_boolean()}, + {"name": "is_archived", "datatype": dbt.type_boolean()}, + {"name": "isarchived", "datatype": dbt.type_boolean()}, + {"name": "is_deleted", "datatype": dbt.type_boolean()}, + {"name": "isdeleted", "datatype": dbt.type_boolean()}, {"name": "last_modified_by_id", "datatype": dbt.type_string()}, + {"name": "lastmodifiedbyid", "datatype": dbt.type_string()}, {"name": "last_modified_date", "datatype": dbt.type_timestamp()}, + {"name": "lastmodifieddate", "datatype": dbt.type_timestamp()}, {"name": "last_referenced_date", "datatype": dbt.type_timestamp()}, + {"name": "lastreferenceddate", "datatype": dbt.type_timestamp()}, {"name": "last_viewed_date", "datatype": dbt.type_timestamp()}, + {"name": "lastvieweddate", "datatype": dbt.type_timestamp()}, {"name": "name", "datatype": dbt.type_string()}, {"name": "number_of_quantity_installments", "datatype": dbt.type_int()}, + {"name": "numberofquantityinstallments", "datatype": dbt.type_int()}, {"name": "number_of_revenue_installments", "datatype": dbt.type_int()}, + {"name": "numberofrevenueinstallments", "datatype": dbt.type_int()}, {"name": "product_code", "datatype": dbt.type_string()}, + {"name": "productcode", "datatype": dbt.type_string()}, {"name": "quantity_installment_period", "datatype": dbt.type_string()}, + {"name": "quantityinstallmentperiod", "datatype": dbt.type_string()}, {"name": "quantity_schedule_type", "datatype": dbt.type_string()}, + {"name": "quantityscheduletype", "datatype": dbt.type_string()}, {"name": "quantity_unit_of_measure", "datatype": dbt.type_string()}, + {"name": "quantityunitofmeasure", "datatype": dbt.type_string()}, {"name": "record_type_id", "datatype": dbt.type_string()}, + {"name": "recordtypeid", "datatype": dbt.type_string()}, {"name": "revenue_installment_period", "datatype": dbt.type_string()}, + {"name": "revenueinstallmentperiod", "datatype": dbt.type_string()}, {"name": "revenue_schedule_type", "datatype": dbt.type_string()}, + {"name": "revenuescheduletype", "datatype": dbt.type_string()} ] %} {{ fivetran_utils.add_pass_through_columns(columns, var('salesforce__product_2_pass_through_columns')) }} diff --git a/macros/get_task_columns.sql b/macros/get_task_columns.sql index d062e6c..d2666a7 100644 --- a/macros/get_task_columns.sql +++ b/macros/get_task_columns.sql @@ -2,35 +2,57 @@ {% set columns = [ {"name": "_fivetran_synced", "datatype": dbt.type_timestamp()}, - {"name": "_fivetran_active", "datatype": "boolean"}, + {"name": "_fivetran_active", "datatype": dbt.type_boolean()}, {"name": "account_id", "datatype": dbt.type_string()}, + {"name": "accountid", "datatype": dbt.type_string()}, {"name": "activity_date", "datatype": dbt.type_timestamp()}, + {"name": "activitydate", "datatype": dbt.type_timestamp()}, {"name": "call_disposition", "datatype": dbt.type_string()}, + {"name": "calldisposition", "datatype": dbt.type_string()}, {"name": "call_duration_in_seconds", "datatype": dbt.type_int()}, + {"name": "calldurationinseconds", "datatype": dbt.type_int()}, {"name": "call_object", "datatype": dbt.type_string()}, + {"name": "callobject", "datatype": dbt.type_string()}, {"name": "call_type", "datatype": dbt.type_string()}, + {"name": "calltype", "datatype": dbt.type_string()}, {"name": "completed_date_time", "datatype": dbt.type_timestamp()}, + {"name": "completeddatetime", "datatype": dbt.type_timestamp()}, {"name": "created_by_id", "datatype": dbt.type_string()}, + {"name": "createdbyid", "datatype": dbt.type_string()}, {"name": "created_date", "datatype": dbt.type_timestamp()}, + {"name": "createddate", "datatype": dbt.type_timestamp()}, {"name": "description", "datatype": dbt.type_string()}, {"name": "id", "datatype": dbt.type_string()}, - {"name": "is_archived", "datatype": "boolean"}, - {"name": "is_closed", "datatype": "boolean"}, - {"name": "is_deleted", "datatype": "boolean"}, - {"name": "is_high_priority", "datatype": "boolean"}, + {"name": "is_archived", "datatype": dbt.type_boolean()}, + {"name": "isarchived", "datatype": dbt.type_boolean()}, + {"name": "is_closed", "datatype": dbt.type_boolean()}, + {"name": "isclosed", "datatype": dbt.type_boolean()}, + {"name": "is_deleted", "datatype": dbt.type_boolean()}, + {"name": "isdeleted", "datatype": dbt.type_boolean()}, + {"name": "is_high_priority", "datatype": dbt.type_boolean()}, + {"name": "ishighpriority", "datatype": dbt.type_boolean()}, {"name": "last_modified_by_id", "datatype": dbt.type_string()}, + {"name": "lastmodifiedbyid", "datatype": dbt.type_string()}, {"name": "last_modified_date", "datatype": dbt.type_timestamp()}, + {"name": "lastmodifieddate", "datatype": dbt.type_timestamp()}, {"name": "owner_id", "datatype": dbt.type_string()}, + {"name": "ownerid", "datatype": dbt.type_string()}, {"name": "priority", "datatype": dbt.type_string()}, {"name": "record_type_id", "datatype": dbt.type_string()}, + {"name": "recordtypeid", "datatype": dbt.type_string()}, {"name": "status", "datatype": dbt.type_string()}, {"name": "subject", "datatype": dbt.type_string()}, {"name": "task_subtype", "datatype": dbt.type_string()}, + {"name": "tasksubtype", "datatype": dbt.type_string()}, {"name": "type", "datatype": dbt.type_string()}, {"name": "what_count", "datatype": dbt.type_int()}, + {"name": "whatcount", "datatype": dbt.type_int()}, {"name": "what_id", "datatype": dbt.type_string()}, + {"name": "whatid", "datatype": dbt.type_string()}, {"name": "who_count", "datatype": dbt.type_int()}, - {"name": "who_id", "datatype": dbt.type_string()} + {"name": "whocount", "datatype": dbt.type_int()}, + {"name": "who_id", "datatype": dbt.type_string()}, + {"name": "whoid", "datatype": dbt.type_string()} ] %} {{ fivetran_utils.add_pass_through_columns(columns, var('salesforce__task_pass_through_columns')) }} diff --git a/macros/get_user_columns.sql b/macros/get_user_columns.sql index 25e4858..ab99b7a 100644 --- a/macros/get_user_columns.sql +++ b/macros/get_user_columns.sql @@ -1,37 +1,54 @@ {% macro get_user_columns() %} {% set columns = [ - {"name": "_fivetran_deleted", "datatype": "boolean"}, - {"name": "_fivetran_active", "datatype": "boolean"}, + {"name": "_fivetran_deleted", "datatype": dbt.type_boolean()}, + {"name": "_fivetran_active", "datatype": dbt.type_boolean()}, {"name": "_fivetran_synced", "datatype": dbt.type_timestamp()}, {"name": "account_id", "datatype": dbt.type_string()}, + {"name": "accountid", "datatype": dbt.type_string()}, {"name": "alias", "datatype": dbt.type_string()}, {"name": "city", "datatype": dbt.type_string()}, {"name": "company_name", "datatype": dbt.type_string()}, + {"name": "companyname", "datatype": dbt.type_string()}, {"name": "contact_id", "datatype": dbt.type_string()}, + {"name": "contactid", "datatype": dbt.type_string()}, {"name": "country", "datatype": dbt.type_string()}, {"name": "country_code", "datatype": dbt.type_string()}, + {"name": "countrycode", "datatype": dbt.type_string()}, {"name": "department", "datatype": dbt.type_string()}, {"name": "email", "datatype": dbt.type_string()}, {"name": "first_name", "datatype": dbt.type_string()}, + {"name": "firstname", "datatype": dbt.type_string()}, {"name": "id", "datatype": dbt.type_string()}, {"name": "individual_id", "datatype": dbt.type_string()}, - {"name": "is_active", "datatype": "boolean"}, + {"name": "individualid", "datatype": dbt.type_string()}, + {"name": "is_active", "datatype": dbt.type_boolean()}, + {"name": "isactive", "datatype": dbt.type_boolean()}, {"name": "last_login_date", "datatype": dbt.type_timestamp()}, + {"name": "lastlogindate", "datatype": dbt.type_timestamp()}, {"name": "last_name", "datatype": dbt.type_string()}, + {"name": "lastname", "datatype": dbt.type_string()}, {"name": "last_referenced_date", "datatype": dbt.type_timestamp()}, + {"name": "lastreferenceddate", "datatype": dbt.type_timestamp()}, {"name": "last_viewed_date", "datatype": dbt.type_timestamp()}, + {"name": "lastvieweddate", "datatype": dbt.type_timestamp()}, {"name": "manager_id", "datatype": dbt.type_string()}, + {"name": "managerid", "datatype": dbt.type_string()}, {"name": "name", "datatype": dbt.type_string()}, {"name": "postal_code", "datatype": dbt.type_string()}, + {"name": "postalcode", "datatype": dbt.type_string()}, {"name": "profile_id", "datatype": dbt.type_string()}, + {"name": "profileid", "datatype": dbt.type_string()}, {"name": "state", "datatype": dbt.type_string()}, {"name": "state_code", "datatype": dbt.type_string()}, + {"name": "statecode", "datatype": dbt.type_string()}, {"name": "street", "datatype": dbt.type_string()}, {"name": "title", "datatype": dbt.type_string()}, {"name": "user_role_id", "datatype": dbt.type_string()}, + {"name": "userroleid", "datatype": dbt.type_string()}, {"name": "user_type", "datatype": dbt.type_string()}, - {"name": "username", "datatype": dbt.type_string()}, + {"name": "usertype", "datatype": dbt.type_string()}, + {"name": "username", "datatype": dbt.type_string()} ] %} {{ fivetran_utils.add_pass_through_columns(columns, var('salesforce__user_pass_through_columns')) }} diff --git a/macros/get_user_role_columns.sql b/macros/get_user_role_columns.sql index 31ffe96..e392538 100644 --- a/macros/get_user_role_columns.sql +++ b/macros/get_user_role_columns.sql @@ -1,15 +1,19 @@ {% macro get_user_role_columns() %} {% set columns = [ - {"name": "_fivetran_deleted", "datatype": "boolean"}, - {"name": "_fivetran_active", "datatype": "boolean"}, + {"name": "_fivetran_deleted", "datatype": dbt.type_boolean()}, + {"name": "_fivetran_active", "datatype": dbt.type_boolean()}, {"name": "_fivetran_synced", "datatype": dbt.type_timestamp()}, {"name": "developer_name", "datatype": dbt.type_string()}, + {"name": "developername", "datatype": dbt.type_string()}, {"name": "id", "datatype": dbt.type_string()}, {"name": "name", "datatype": dbt.type_string()}, {"name": "opportunity_access_for_account_owner", "datatype": dbt.type_string()}, + {"name": "opportunityaccessforaccountowner", "datatype": dbt.type_string()}, {"name": "parent_role_id", "datatype": dbt.type_string()}, - {"name": "rollup_description", "datatype": dbt.type_string()} + {"name": "parentroleid", "datatype": dbt.type_string()}, + {"name": "rollup_description", "datatype": dbt.type_string()}, + {"name": "rollupdescription", "datatype": dbt.type_string()} ] %} {{ fivetran_utils.add_pass_through_columns(columns, var('salesforce__user_role_pass_through_columns')) }} diff --git a/models/salesforce/stg_salesforce__account.sql b/models/salesforce/stg_salesforce__account.sql index a796894..ad3eec9 100644 --- a/models/salesforce/stg_salesforce__account.sql +++ b/models/salesforce/stg_salesforce__account.sql @@ -16,37 +16,37 @@ final as ( select cast(_fivetran_synced as {{ dbt.type_timestamp() }}) as _fivetran_synced, - account_number, - account_source, - cast(annual_revenue as {{ dbt.type_numeric() }}) as annual_revenue, - billing_city, - billing_country, - billing_postal_code, - billing_state, - billing_state_code, - billing_street, + {{ coalesce_w_renamed_col('account_number') }}, + {{ coalesce_w_renamed_col('account_source') }}, + {{ coalesce_w_renamed_col('annual_revenue', datatype=dbt.type_numeric()) }}, + {{ coalesce_w_renamed_col('billing_city') }}, + {{ coalesce_w_renamed_col('billing_country') }}, + {{ coalesce_w_renamed_col('billing_postal_code') }}, + {{ coalesce_w_renamed_col('billing_state') }}, + {{ coalesce_w_renamed_col('billing_state_code') }}, + {{ coalesce_w_renamed_col('billing_street') }}, description as account_description, id as account_id, industry, - is_deleted, - cast(last_activity_date as {{ dbt.type_timestamp() }}) as last_activity_date, - cast(last_referenced_date as {{ dbt.type_timestamp() }}) as last_referenced_date, - cast(last_viewed_date as {{ dbt.type_timestamp() }}) as last_viewed_date, - master_record_id, + {{ coalesce_w_renamed_col('is_deleted', datatype=dbt.type_boolean()) }}, + {{ coalesce_w_renamed_col('last_activity_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('last_referenced_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('last_viewed_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('master_record_id') }}, name as account_name, - number_of_employees, - owner_id, + {{ coalesce_w_renamed_col('number_of_employees', datatype=dbt.type_int()) }}, + {{ coalesce_w_renamed_col('owner_id') }}, ownership, - parent_id, + {{ coalesce_w_renamed_col('parent_id') }}, rating, - record_type_id, - shipping_city, - shipping_country, - shipping_country_code, - shipping_postal_code, - shipping_state, - shipping_state_code, - shipping_street, + {{ coalesce_w_renamed_col('record_type_id') }}, + {{ coalesce_w_renamed_col('shipping_city') }}, + {{ coalesce_w_renamed_col('shipping_country') }}, + {{ coalesce_w_renamed_col('shipping_country_code') }}, + {{ coalesce_w_renamed_col('shipping_postal_code') }}, + {{ coalesce_w_renamed_col('shipping_state') }}, + {{ coalesce_w_renamed_col('shipping_state_code') }}, + {{ coalesce_w_renamed_col('shipping_street') }}, type, website diff --git a/models/salesforce/stg_salesforce__contact.sql b/models/salesforce/stg_salesforce__contact.sql index c48a335..e710e32 100644 --- a/models/salesforce/stg_salesforce__contact.sql +++ b/models/salesforce/stg_salesforce__contact.sql @@ -17,34 +17,34 @@ final as ( select cast(_fivetran_synced as {{ dbt.type_timestamp() }}) as _fivetran_synced, id as contact_id, - account_id, + {{ coalesce_w_renamed_col('account_id') }}, department, description as contact_description, email, - first_name, - home_phone, - individual_id, - is_deleted, - cast(last_activity_date as {{ dbt.type_timestamp() }}) as last_activity_date, - last_modified_by_id, - last_modified_date, - last_name, - last_referenced_date, - cast(last_viewed_date as {{ dbt.type_timestamp() }}) as last_viewed_date, - lead_source, - mailing_city, - mailing_country, - mailing_country_code, - mailing_postal_code, - mailing_state, - mailing_state_code, - mailing_street, - master_record_id, - mobile_phone, + {{ coalesce_w_renamed_col('first_name') }}, + {{ coalesce_w_renamed_col('home_phone') }}, + {{ coalesce_w_renamed_col('individual_id') }}, + {{ coalesce_w_renamed_col('is_deleted', datatype=dbt.type_boolean()) }}, + {{ coalesce_w_renamed_col('last_activity_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('last_modified_by_id') }}, + {{ coalesce_w_renamed_col('last_modified_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('last_name') }}, + {{ coalesce_w_renamed_col('last_referenced_date') }}, + {{ coalesce_w_renamed_col('last_viewed_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('lead_source') }}, + {{ coalesce_w_renamed_col('mailing_city') }}, + {{ coalesce_w_renamed_col('mailing_country') }}, + {{ coalesce_w_renamed_col('mailing_country_code') }}, + {{ coalesce_w_renamed_col('mailing_postal_code') }}, + {{ coalesce_w_renamed_col('mailing_state') }}, + {{ coalesce_w_renamed_col('mailing_state_code') }}, + {{ coalesce_w_renamed_col('mailing_street') }}, + {{ coalesce_w_renamed_col('master_record_id') }}, + {{ coalesce_w_renamed_col('mobile_phone') }}, name as contact_name, - owner_id, + {{ coalesce_w_renamed_col('owner_id') }}, phone, - reports_to_id, + {{ coalesce_w_renamed_col('reports_to_id') }}, title {{ fivetran_utils.fill_pass_through_columns('salesforce__contact_pass_through_columns') }} diff --git a/models/salesforce/stg_salesforce__event.sql b/models/salesforce/stg_salesforce__event.sql index 2ca794e..a9e1065 100644 --- a/models/salesforce/stg_salesforce__event.sql +++ b/models/salesforce/stg_salesforce__event.sql @@ -19,32 +19,32 @@ final as ( select cast(_fivetran_synced as {{ dbt.type_timestamp() }}) as _fivetran_synced, id as event_id, - account_id, - cast(activity_date as {{ dbt.type_timestamp() }}) as activity_date, - cast(activity_date_time as {{ dbt.type_timestamp() }}) as activity_date_time, - created_by_id, - cast(created_date as {{ dbt.type_timestamp() }}) as created_date, + {{ coalesce_w_renamed_col('account_id') }}, + {{ coalesce_w_renamed_col('activity_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('activity_date_time', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('created_by_id') }}, + {{ coalesce_w_renamed_col('created_date', datatype=dbt.type_timestamp()) }}, description as event_description, - cast(end_date as {{ dbt.type_timestamp() }}) as end_date, - cast(end_date_time as {{ dbt.type_timestamp() }}) as end_date_time, - event_subtype, - group_event_type, - is_archived, - is_child, - is_deleted, - is_group_event, - is_recurrence, - last_modified_by_id, - cast(last_modified_date as {{ dbt.type_timestamp() }}) as last_modified_date, + {{ coalesce_w_renamed_col('end_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('end_date_time', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('event_subtype') }}, + {{ coalesce_w_renamed_col('group_event_type') }}, + {{ coalesce_w_renamed_col('is_archived', datatype=dbt.type_boolean()) }}, + {{ coalesce_w_renamed_col('is_child', datatype=dbt.type_boolean()) }}, + {{ coalesce_w_renamed_col('is_deleted', datatype=dbt.type_boolean()) }}, + {{ coalesce_w_renamed_col('is_group_event', datatype=dbt.type_boolean()) }}, + {{ coalesce_w_renamed_col('is_recurrence', datatype=dbt.type_boolean()) }}, + {{ coalesce_w_renamed_col('last_modified_by_id') }}, + {{ coalesce_w_renamed_col('last_modified_date', datatype=dbt.type_timestamp()) }}, location, - owner_id, - cast(start_date_time as {{ dbt.type_timestamp() }}) as start_date_time, + {{ coalesce_w_renamed_col('owner_id') }}, + {{ coalesce_w_renamed_col('start_date_time', datatype=dbt.type_timestamp()) }}, subject, type, - what_count, - what_id, - who_count, - who_id + {{ coalesce_w_renamed_col('what_count', datatype=dbt.type_int()) }}, + {{ coalesce_w_renamed_col('what_id') }}, + {{ coalesce_w_renamed_col('who_count', datatype=dbt.type_int()) }}, + {{ coalesce_w_renamed_col('who_id') }} {{ fivetran_utils.fill_pass_through_columns('salesforce__event_pass_through_columns') }} diff --git a/models/salesforce/stg_salesforce__lead.sql b/models/salesforce/stg_salesforce__lead.sql index 0f97da0..1275fd2 100644 --- a/models/salesforce/stg_salesforce__lead.sql +++ b/models/salesforce/stg_salesforce__lead.sql @@ -19,44 +19,44 @@ final as ( select cast(_fivetran_synced as {{ dbt.type_timestamp() }}) as _fivetran_synced, id as lead_id, - annual_revenue, + {{ coalesce_w_renamed_col('annual_revenue', datatype=dbt.type_float()) }}, city, company, - converted_account_id, - converted_contact_id, - cast(converted_date as {{ dbt.type_timestamp() }}) as converted_date, - converted_opportunity_id, + {{ coalesce_w_renamed_col('converted_account_id') }}, + {{ coalesce_w_renamed_col('converted_contact_id') }}, + {{ coalesce_w_renamed_col('converted_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('converted_opportunity_id') }}, country, - country_code, - created_by_id, - cast(created_date as {{ dbt.type_timestamp() }}) as created_date, + {{ coalesce_w_renamed_col('country_code') }}, + {{ coalesce_w_renamed_col('created_by_id') }}, + {{ coalesce_w_renamed_col('created_date', datatype=dbt.type_timestamp()) }}, description as lead_description, email, - cast(email_bounced_date as {{ dbt.type_timestamp() }}) as email_bounced_date, - email_bounced_reason, - first_name, - has_opted_out_of_email, - individual_id, + {{ coalesce_w_renamed_col('email_bounced_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('email_bounced_reason') }}, + {{ coalesce_w_renamed_col('first_name') }}, + {{ coalesce_w_renamed_col('has_opted_out_of_email', datatype=dbt.type_boolean()) }}, + {{ coalesce_w_renamed_col('individual_id') }}, industry, - is_converted, - is_deleted, - is_unread_by_owner, - cast(last_activity_date as {{ dbt.type_timestamp() }}) as last_activity_date, - last_modified_by_id, - cast(last_modified_date as {{ dbt.type_timestamp() }}) as last_modified_date, - last_name, - cast(last_referenced_date as {{ dbt.type_timestamp() }}) as last_referenced_date, - cast(last_viewed_date as {{ dbt.type_timestamp() }}) as last_viewed_date, - lead_source, - master_record_id, - mobile_phone, + {{ coalesce_w_renamed_col('is_converted', datatype=dbt.type_boolean()) }}, + {{ coalesce_w_renamed_col('is_deleted', datatype=dbt.type_boolean()) }}, + {{ coalesce_w_renamed_col('is_unread_by_owner', datatype=dbt.type_boolean()) }}, + {{ coalesce_w_renamed_col('last_activity_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('last_modified_by_id') }}, + {{ coalesce_w_renamed_col('last_modified_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('last_name') }}, + {{ coalesce_w_renamed_col('last_referenced_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('last_viewed_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('lead_source') }}, + {{ coalesce_w_renamed_col('master_record_id') }}, + {{ coalesce_w_renamed_col('mobile_phone') }}, name as lead_name, - number_of_employees, - owner_id, + {{ coalesce_w_renamed_col('number_of_employees', datatype=dbt.type_int()) }}, + {{ coalesce_w_renamed_col('owner_id') }}, phone, - postal_code, + {{ coalesce_w_renamed_col('postal_code') }}, state, - state_code, + {{ coalesce_w_renamed_col('state_code') }}, status, street, title, diff --git a/models/salesforce/stg_salesforce__opportunity.sql b/models/salesforce/stg_salesforce__opportunity.sql index e2a87f2..4f50535 100644 --- a/models/salesforce/stg_salesforce__opportunity.sql +++ b/models/salesforce/stg_salesforce__opportunity.sql @@ -16,36 +16,36 @@ final as ( select cast(_fivetran_synced as {{ dbt.type_timestamp() }}) as _fivetran_synced, - account_id, + {{ coalesce_w_renamed_col('account_id') }}, cast(amount as {{ dbt.type_numeric() }}) as amount, - campaign_id, - cast(close_date as {{ dbt.type_timestamp() }}) as close_date, - cast(created_date as {{ dbt.type_timestamp() }}) as created_date, + {{ coalesce_w_renamed_col('campaign_id') }}, + {{ coalesce_w_renamed_col('close_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('created_date', datatype=dbt.type_timestamp()) }}, description as opportunity_description, - cast(expected_revenue as {{ dbt.type_numeric() }}) as expected_revenue, + {{ coalesce_w_renamed_col('expected_revenue', datatype=dbt.type_numeric()) }}, fiscal, - fiscal_quarter, - fiscal_year, - forecast_category, - forecast_category_name, - has_open_activity, - has_opportunity_line_item, - has_overdue_task, + {{ coalesce_w_renamed_col('fiscal_quarter', datatype=dbt.type_int()) }}, + {{ coalesce_w_renamed_col('fiscal_year', datatype=dbt.type_int()) }}, + {{ coalesce_w_renamed_col('forecast_category') }}, + {{ coalesce_w_renamed_col('forecast_category_name') }}, + {{ coalesce_w_renamed_col('has_open_activity', datatype=dbt.type_boolean()) }}, + {{ coalesce_w_renamed_col('has_opportunity_line_item', datatype=dbt.type_boolean()) }}, + {{ coalesce_w_renamed_col('has_overdue_task', datatype=dbt.type_boolean()) }}, id as opportunity_id, - is_closed, - is_deleted, - is_won, - cast(last_activity_date as {{ dbt.type_timestamp() }}) as last_activity_date, - cast(last_referenced_date as {{ dbt.type_timestamp() }}) as last_referenced_date, - cast(last_viewed_date as {{ dbt.type_timestamp() }}) as last_viewed_date, - lead_source, + {{ coalesce_w_renamed_col('is_closed', datatype=dbt.type_boolean()) }}, + {{ coalesce_w_renamed_col('is_deleted', datatype=dbt.type_boolean()) }}, + {{ coalesce_w_renamed_col('is_won', datatype=dbt.type_boolean()) }}, + {{ coalesce_w_renamed_col('last_activity_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('last_referenced_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('last_viewed_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('lead_source') }}, name as opportunity_name, - next_step, - owner_id, + {{ coalesce_w_renamed_col('next_step') }}, + {{ coalesce_w_renamed_col('owner_id') }}, probability, - record_type_id, - stage_name, - synced_quote_id, + {{ coalesce_w_renamed_col('record_type_id') }}, + {{ coalesce_w_renamed_col('stage_name') }}, + {{ coalesce_w_renamed_col('synced_quote_id') }}, type {{ fivetran_utils.fill_pass_through_columns('salesforce__opportunity_pass_through_columns') }} diff --git a/models/salesforce/stg_salesforce__opportunity_line_item.sql b/models/salesforce/stg_salesforce__opportunity_line_item.sql index 10ce16e..351f242 100644 --- a/models/salesforce/stg_salesforce__opportunity_line_item.sql +++ b/models/salesforce/stg_salesforce__opportunity_line_item.sql @@ -19,29 +19,29 @@ final as ( select cast(_fivetran_synced as {{ dbt.type_timestamp() }}) as _fivetran_synced, id as opportunity_line_item_id, - created_by_id, - cast(created_date as {{ dbt.type_timestamp() }}) as created_date, + {{ coalesce_w_renamed_col('created_by_id') }}, + {{ coalesce_w_renamed_col('created_date', datatype=dbt.type_timestamp()) }}, description as opportunity_line_item_description, discount, - has_quantity_schedule, - has_revenue_schedule, - has_schedule, - is_deleted, - last_modified_by_id, - cast(last_modified_date as {{ dbt.type_timestamp() }}) as last_modified_date, - cast(last_referenced_date as {{ dbt.type_timestamp() }}) as last_referenced_date, - cast(last_viewed_date as {{ dbt.type_timestamp() }}) as last_viewed_date, - list_price, + {{ coalesce_w_renamed_col('has_quantity_schedule', datatype=dbt.type_boolean()) }}, + {{ coalesce_w_renamed_col('has_revenue_schedule', datatype=dbt.type_boolean()) }}, + {{ coalesce_w_renamed_col('has_schedule', datatype=dbt.type_boolean()) }}, + {{ coalesce_w_renamed_col('is_deleted', datatype=dbt.type_boolean()) }}, + {{ coalesce_w_renamed_col('last_modified_by_id') }}, + {{ coalesce_w_renamed_col('last_modified_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('last_referenced_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('last_viewed_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('list_price', datatype=dbt.type_numeric()) }}, name as opportunity_line_item_name, - opportunity_id, - pricebook_entry_id, - product_2_id, - product_code, + {{ coalesce_w_renamed_col('opportunity_id') }}, + {{ coalesce_w_renamed_col('pricebook_entry_id') }}, + {{ coalesce_w_renamed_col('product_2_id') }}, + {{ coalesce_w_renamed_col('product_code') }}, quantity, - cast(service_date as {{ dbt.type_timestamp() }}) as service_date, - sort_order, - total_price, - unit_price + {{ coalesce_w_renamed_col('service_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('sort_order', datatype=dbt.type_int()) }}, + {{ coalesce_w_renamed_col('total_price', datatype=dbt.type_numeric()) }}, + {{ coalesce_w_renamed_col('unit_price', datatype=dbt.type_numeric()) }} {{ fivetran_utils.fill_pass_through_columns('salesforce__opportunity_line_item_pass_through_columns') }} diff --git a/models/salesforce/stg_salesforce__order.sql b/models/salesforce/stg_salesforce__order.sql index 63564d0..0709dcf 100644 --- a/models/salesforce/stg_salesforce__order.sql +++ b/models/salesforce/stg_salesforce__order.sql @@ -19,40 +19,40 @@ final as ( select cast(_fivetran_synced as {{ dbt.type_timestamp() }}) as _fivetran_synced, id as order_id, - account_id, - activated_by_id, - cast(activated_date as {{ dbt.type_timestamp() }}) as activated_date, - billing_city, - billing_country, - billing_country_code, - billing_postal_code, - billing_state, - billing_state_code, - billing_street, - contract_id, - created_by_id, - created_date, + {{ coalesce_w_renamed_col('account_id') }}, + {{ coalesce_w_renamed_col('activated_by_id') }}, + {{ coalesce_w_renamed_col('activated_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('billing_city') }}, + {{ coalesce_w_renamed_col('billing_country') }}, + {{ coalesce_w_renamed_col('billing_country_code') }}, + {{ coalesce_w_renamed_col('billing_postal_code') }}, + {{ coalesce_w_renamed_col('billing_state') }}, + {{ coalesce_w_renamed_col('billing_state_code') }}, + {{ coalesce_w_renamed_col('billing_street') }}, + {{ coalesce_w_renamed_col('contract_id') }}, + {{ coalesce_w_renamed_col('created_by_id') }}, + {{ coalesce_w_renamed_col('created_date', datatype=dbt.type_timestamp()) }}, description as order_description, - cast(end_date as {{ dbt.type_timestamp() }}) as end_date, - is_deleted, - last_modified_by_id, - cast(last_modified_date as {{ dbt.type_timestamp() }}) as last_modified_date, - cast(last_referenced_date as {{ dbt.type_timestamp() }}) as last_referenced_date, - cast(last_viewed_date as {{ dbt.type_timestamp() }}) as last_viewed_date, - opportunity_id, - order_number, - original_order_id, - owner_id, - pricebook_2_id, - shipping_city, - shipping_country, - shipping_country_code, - shipping_postal_code, - shipping_state, - shipping_state_code, - shipping_street, + {{ coalesce_w_renamed_col('end_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('is_deleted', datatype=dbt.type_boolean()) }}, + {{ coalesce_w_renamed_col('last_modified_by_id') }}, + {{ coalesce_w_renamed_col('last_modified_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('last_referenced_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('last_viewed_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('opportunity_id') }}, + {{ coalesce_w_renamed_col('order_number') }}, + {{ coalesce_w_renamed_col('original_order_id') }}, + {{ coalesce_w_renamed_col('owner_id') }}, + {{ coalesce_w_renamed_col('pricebook_2_id') }}, + {{ coalesce_w_renamed_col('shipping_city') }}, + {{ coalesce_w_renamed_col('shipping_country') }}, + {{ coalesce_w_renamed_col('shipping_country_code') }}, + {{ coalesce_w_renamed_col('shipping_postal_code') }}, + {{ coalesce_w_renamed_col('shipping_state') }}, + {{ coalesce_w_renamed_col('shipping_state_code') }}, + {{ coalesce_w_renamed_col('shipping_street') }}, status, - total_amount, + {{ coalesce_w_renamed_col('total_amount', datatype=dbt.type_numeric()) }}, type {{ fivetran_utils.fill_pass_through_columns('salesforce__order_pass_through_columns') }} diff --git a/models/salesforce/stg_salesforce__product_2.sql b/models/salesforce/stg_salesforce__product_2.sql index c99aa90..dc3d347 100644 --- a/models/salesforce/stg_salesforce__product_2.sql +++ b/models/salesforce/stg_salesforce__product_2.sql @@ -19,29 +19,29 @@ final as ( select cast(_fivetran_synced as {{ dbt.type_timestamp() }}) as _fivetran_synced, id as product_2_id, - created_by_id, - cast(created_date as {{ dbt.type_timestamp() }}) as created_date, + {{ coalesce_w_renamed_col('created_by_id') }}, + {{ coalesce_w_renamed_col('created_date', datatype=dbt.type_timestamp()) }}, description as product_2_description, - display_url, - external_id, + {{ coalesce_w_renamed_col('display_url') }}, + {{ coalesce_w_renamed_col('external_id') }}, family, - is_active, - is_archived, - is_deleted, - last_modified_by_id, - cast(last_modified_date as {{ dbt.type_timestamp() }}) as last_modified_date, - cast(last_referenced_date as {{ dbt.type_timestamp() }}) as last_referenced_date, - cast(last_viewed_date as {{ dbt.type_timestamp() }}) as last_viewed_date, + {{ coalesce_w_renamed_col('is_active', datatype=dbt.type_boolean()) }}, + {{ coalesce_w_renamed_col('is_archived', datatype=dbt.type_boolean()) }}, + {{ coalesce_w_renamed_col('is_deleted', datatype=dbt.type_boolean()) }}, + {{ coalesce_w_renamed_col('last_modified_by_id') }}, + {{ coalesce_w_renamed_col('last_modified_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('last_referenced_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('last_viewed_date', datatype=dbt.type_timestamp()) }}, name as product_2_name, - number_of_quantity_installments, - number_of_revenue_installments, - product_code, - quantity_installment_period, - quantity_schedule_type, - quantity_unit_of_measure, - record_type_id, - revenue_installment_period, - revenue_schedule_type + {{ coalesce_w_renamed_col('number_of_quantity_installments', datatype=dbt.type_int()) }}, + {{ coalesce_w_renamed_col('number_of_revenue_installments', datatype=dbt.type_int()) }}, + {{ coalesce_w_renamed_col('product_code') }}, + {{ coalesce_w_renamed_col('quantity_installment_period') }}, + {{ coalesce_w_renamed_col('quantity_schedule_type') }}, + {{ coalesce_w_renamed_col('quantity_unit_of_measure') }}, + {{ coalesce_w_renamed_col('record_type_id') }}, + {{ coalesce_w_renamed_col('revenue_installment_period') }}, + {{ coalesce_w_renamed_col('revenue_schedule_type') }} {{ fivetran_utils.fill_pass_through_columns('salesforce__product_2_pass_through_columns') }} diff --git a/models/salesforce/stg_salesforce__task.sql b/models/salesforce/stg_salesforce__task.sql index cf7654b..553d8ba 100644 --- a/models/salesforce/stg_salesforce__task.sql +++ b/models/salesforce/stg_salesforce__task.sql @@ -19,33 +19,33 @@ final as ( select cast(_fivetran_synced as {{ dbt.type_timestamp() }}) as _fivetran_synced, id as task_id, - account_id, - cast(activity_date as {{ dbt.type_timestamp() }}) as activity_date, - call_disposition, - call_duration_in_seconds, - call_object, - call_type, - cast(completed_date_time as {{ dbt.type_timestamp() }}) as completed_date_time, - created_by_id, - cast(created_date as {{ dbt.type_timestamp() }}) as created_date, + {{ coalesce_w_renamed_col('account_id') }}, + {{ coalesce_w_renamed_col('activity_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('call_disposition') }}, + {{ coalesce_w_renamed_col('call_duration_in_seconds', datatype=dbt.type_int()) }}, + {{ coalesce_w_renamed_col('call_object') }}, + {{ coalesce_w_renamed_col('call_type') }}, + {{ coalesce_w_renamed_col('completed_date_time', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('created_by_id') }}, + {{ coalesce_w_renamed_col('created_date', datatype=dbt.type_timestamp()) }}, description as task_description, - is_archived, - is_closed, - is_deleted, - is_high_priority, - last_modified_by_id, - cast(last_modified_date as {{ dbt.type_timestamp() }}) as last_modified_date, - owner_id, + {{ coalesce_w_renamed_col('is_archived', datatype=dbt.type_boolean()) }}, + {{ coalesce_w_renamed_col('is_closed', datatype=dbt.type_boolean()) }}, + {{ coalesce_w_renamed_col('is_deleted', datatype=dbt.type_boolean()) }}, + {{ coalesce_w_renamed_col('is_high_priority', datatype=dbt.type_boolean()) }}, + {{ coalesce_w_renamed_col('last_modified_by_id') }}, + {{ coalesce_w_renamed_col('last_modified_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('owner_id') }}, priority, - record_type_id, + {{ coalesce_w_renamed_col('record_type_id') }}, status, subject, - task_subtype, + {{ coalesce_w_renamed_col('task_subtype') }}, type, - what_count, - what_id, - who_count, - who_id + {{ coalesce_w_renamed_col('what_count', datatype=dbt.type_int()) }}, + {{ coalesce_w_renamed_col('what_id') }}, + {{ coalesce_w_renamed_col('who_count', datatype=dbt.type_int()) }}, + {{ coalesce_w_renamed_col('who_id') }} {{ fivetran_utils.fill_pass_through_columns('salesforce__task_pass_through_columns') }} diff --git a/models/salesforce/stg_salesforce__user.sql b/models/salesforce/stg_salesforce__user.sql index 6ea6346..18eb695 100644 --- a/models/salesforce/stg_salesforce__user.sql +++ b/models/salesforce/stg_salesforce__user.sql @@ -18,33 +18,33 @@ final as ( select _fivetran_deleted, cast(_fivetran_synced as {{ dbt.type_timestamp() }}) as _fivetran_synced, - account_id, + {{ coalesce_w_renamed_col('account_id') }}, alias, city, - company_name, - contact_id, + {{ coalesce_w_renamed_col('company_name') }}, + {{ coalesce_w_renamed_col('contact_id') }}, country, - country_code, + {{ coalesce_w_renamed_col('country_code') }}, department, email, - first_name, + {{ coalesce_w_renamed_col('first_name') }}, id as user_id, - individual_id, - is_active, - cast(last_login_date as {{ dbt.type_timestamp() }}) as last_login_date, - last_name, - cast(last_referenced_date as {{ dbt.type_timestamp() }}) as last_referenced_date, - cast(last_viewed_date as {{ dbt.type_timestamp() }}) as last_viewed_date, - manager_id, + {{ coalesce_w_renamed_col('individual_id') }}, + {{ coalesce_w_renamed_col('is_active', datatype=dbt.type_boolean()) }}, + {{ coalesce_w_renamed_col('last_login_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('last_name') }}, + {{ coalesce_w_renamed_col('last_referenced_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('last_viewed_date', datatype=dbt.type_timestamp()) }}, + {{ coalesce_w_renamed_col('manager_id') }}, name as user_name, - postal_code, - profile_id, + {{ coalesce_w_renamed_col('postal_code') }}, + {{ coalesce_w_renamed_col('profile_id') }}, state, - state_code, + {{ coalesce_w_renamed_col('state_code') }}, street, title, - user_role_id, - user_type, + {{ coalesce_w_renamed_col('user_role_id') }}, + {{ coalesce_w_renamed_col('user_type') }}, username {{ fivetran_utils.fill_pass_through_columns('salesforce__user_pass_through_columns') }} diff --git a/models/salesforce/stg_salesforce__user_role.sql b/models/salesforce/stg_salesforce__user_role.sql index ee4eaf6..4b31e52 100644 --- a/models/salesforce/stg_salesforce__user_role.sql +++ b/models/salesforce/stg_salesforce__user_role.sql @@ -20,12 +20,12 @@ final as ( select _fivetran_deleted, cast(_fivetran_synced as {{ dbt.type_timestamp() }}) as _fivetran_synced, - developer_name, + {{ coalesce_w_renamed_col('developer_name') }}, id as user_role_id, name as user_role_name, - opportunity_access_for_account_owner, - parent_role_id, - rollup_description + {{ coalesce_w_renamed_col('opportunity_access_for_account_owner') }}, + {{ coalesce_w_renamed_col('parent_role_id') }}, + {{ coalesce_w_renamed_col('rollup_description') }} {{ fivetran_utils.fill_pass_through_columns('salesforce__user_role_pass_through_columns') }}