From 5dbfb652d16808afa4faf33ae13cf3f923aaa95c Mon Sep 17 00:00:00 2001 From: fivetran-reneeli Date: Mon, 18 Jul 2022 11:08:24 +0200 Subject: [PATCH 01/41] github --- .github/ISSUE_TEMPLATE/bug-report.yml | 88 ++++++++++++++++++++++ .github/ISSUE_TEMPLATE/bug_report.md | 62 --------------- .github/ISSUE_TEMPLATE/feature-request.yml | 46 +++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 32 -------- .github/config.yml | 19 +++++ 5 files changed, 153 insertions(+), 94 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug-report.yml delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature-request.yml delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/config.yml diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml new file mode 100644 index 0000000..17c2c54 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -0,0 +1,88 @@ +name: šŸž Bug +description: Report a bug or an issue you've found within the dbt package +title: "[Bug] " +labels: ["bug", "triage"] +body: + - type: markdown + attributes: + value: | + Thanks for using the Fivetran dbt package and for taking the time to fill out this bug report. Your contributions help improve this package for the entire community of users! + - type: checkboxes + attributes: + label: Is there an existing issue for this? + description: Please search to see if an issue already exists for the bug you encountered. + options: + - label: I have searched the existing issues + required: true + - type: textarea + attributes: + label: Describe the issue + description: A concise description of the problem you're experiencing. Also, please provide the steps to reproduce the issue if applicable. + validations: + required: true + - type: textarea + id: logs + attributes: + label: Relevant error log or model output + description: | + If applicable, provide the relevant error log or describe the problematic model output. + render: shell + validations: + required: false + - type: textarea + attributes: + label: Expected behavior + description: A concise description of what you expected to happen. + validations: + required: true + - type: textarea + attributes: + label: dbt Project configurations + description: Please provide the variables and any other project specific configurations from your `dbt_project.yml`. + validations: + required: true + - type: textarea + attributes: + label: Package versions + description: Please provide the contents of your `packages.yml`. + validations: + required: true + - type: dropdown + id: database + attributes: + label: What database are you using dbt with? + multiple: true + options: + - postgres + - redshift + - snowflake + - bigquery + - databricks + - other (mention it in "Additional Context") + validations: + required: true + - type: textarea + attributes: + label: dbt Version + description: Run `dbt --version` in your CLI or dbt cloud environment and copy the contents. Additionally, if you are using Fivetran dbt Transformations, provide the contents of the `dbtVersion` configuration in your `deployment.yml`. + validations: + required: true + - type: textarea + attributes: + label: Additional Context + description: | + Links? References? Anything that will give us more context about the issue you are encountering! + + Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in. + validations: + required: false + - type: checkboxes + id: pr + attributes: + label: Are you willing to open a PR to help address this issue? + description: Our team will assess this issue and let you know if we will add it to a future sprint. However, if you would like to expedite the solution, we encourage you to contribute to the package via a PR. Our team will then work with you to approve and merge your contributions as soon as possible. + options: + - label: Yes. + - label: Yes, but I will need assistance and will schedule time during our [office hours](https://calendly.com/fivetran-solutions-team/fivetran-solutions-team-office-hours) for guidance + - label: No. + required: false \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index c36e4fe..0000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: BUG - [your bug title here] -labels: bug -assignees: '' - ---- - -**Are you a current Fivetran customer?** -<!--- Please tell us your name, title and company --> - - -**Describe the bug** -<!--- A clear and concise description of what the bug is. --> - -**Steps to reproduce** -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**Expected behavior** -<!--- A clear and concise description of what you expected to happen. --> - -**Project variables configuration** -<!--- Copy and paste the contents of your `dbt_project.yml` file below. --> -```yml -copy dbt_project.yml here -``` - -**Package Version** -<!---Copy and paste the contents of your `packages.yml` file below.--> -```yml -copy packages.yml here -``` - -**Warehouse** -<!--- Which warehouse you are running dbt and this package against. --> -<!--- To check a warehouse remove the space and insert an x in the box (eg. [x] Bigquery). --> -- [ ] BigQuery -- [ ] Redshift -- [ ] Snowflake -- [ ] Postgres -- [ ] Databricks -- [ ] Other (provide details below) - -**Additional context** -<!--- Add any other context about the problem here. --> - -**Screenshots** -<!--- If applicable, add screenshots to help explain your problem. --> - -**Please indicate the level of urgency** -<!--- Is this impacting your reporting of a critical dashboard? Are you just testing this for the first time? Provide us context so that we can prioritize accordingly. --> - -**Are you interested in contributing to this package?** -<!--- Our packages are all open-source and we welcome contributions from the community! Are you interested in helping us fix this bug? --> -- [ ] Yes, I can do this and open a PR for your review. -- [ ] Possibly, but I'm not quite sure how to do this. I'd be happy to do a live coding session with someone to get this fixed. -- [ ] No, I'd prefer if someone else fixed this. I don't have the time and/or don't know what the root cause of the problem is. - diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml new file mode 100644 index 0000000..4701911 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.yml @@ -0,0 +1,46 @@ +name: šŸŽ‰ Feature +description: Suggest a new feature for the Fivetran dbt package +title: "[Feature] <title>" +labels: ["enhancement"] +body: + - type: markdown + attributes: + value: | + Thanks for using the Fivetran dbt package and for taking the time to fill out this feature request. Your contributions help improve this package for the entire community of users! + - type: checkboxes + attributes: + label: Is there an existing feature request for this? + description: Please search to see if an issue already exists for the feature you would like. + options: + - label: I have searched the existing issues + required: true + - type: textarea + attributes: + label: Describe the Feature + description: A clear and concise description of what you want to happen and why you want the new feature. + validations: + required: true + - type: textarea + attributes: + label: Describe alternatives you've considered + description: | + A clear and concise description of any alternative solutions or features you've considered. + validations: + required: false + - type: checkboxes + id: contributing + attributes: + label: Are you interested in contributing this feature? + description: Our team will assess this feature and let you know if we will add it to a future sprint. However, if you would like to expedite the feature, we encourage you to contribute to the package via a PR. Our team will then work with you to approve and merge your contributions as soon as possible. + options: + - label: Yes. + - label: Yes, but I will need assistance and will schedule time during your [office hours](https://calendly.com/fivetran-solutions-team/fivetran-solutions-team-office-hours) for guidance. + - label: No. + required: false + - type: textarea + attributes: + label: Anything else? + description: | + Links? References? Anything that will give us more context about the feature you are suggesting! + validations: + required: false \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index ad1df3f..0000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: FEATURE - [your feature request title here] -labels: enhancement -assignees: '' - ---- - -**Are you a Fivetran customer?** -<!--- Please tell us your name, title and company --> - -**Is your feature request related to a problem? Please describe.** -<!--- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] --> - -**Describe the solution you'd like** -<!--- A clear and concise description of what you want to happen. --> - -**Describe alternatives you've considered** -<!--- A clear and concise description of any alternative solutions or features you've considered. --> - -**Additional context** -<!--- Add any other context or screenshots about the feature request here. --> - -**Please indicate the level of urgency and business impact of this request** -<!--- Is this impacting your reporting of a critical dashboard? What problem would implementing this feature request solve? Provide us context so that we can prioritize accordingly. --> - -**Are you interested in contributing to this package?** -<!--- Our packages are all open-source and we welcome contributions from the community! Are you interested in helping us implement this feature? --> -- [ ] Yes, I can do this and open a PR for your review. -- [ ] Possibly, but I'm not quite sure how to do this. I'd be happy to do a live coding session with someone to get this work implemented. -- [ ] No, I'd prefer if someone else did this. I don't have the time and/or don't know how to incorporate the changes necessary. diff --git a/.github/config.yml b/.github/config.yml new file mode 100644 index 0000000..44c11b0 --- /dev/null +++ b/.github/config.yml @@ -0,0 +1,19 @@ +contact_links: + - name: Provide feedback to our dbt package team + url: https://www.surveymonkey.com/r/DQ7K7WW + about: Fill out our survey form to provide valuable feedback to the Fivetran team developing and maintaining the dbt packages. + - name: Request a new dbt package + url: https://www.surveymonkey.com/r/DQ7K7WW + about: The dbt package team at Fivetran is always taking requests for future dbt packages. Request one that you would like using our feedback form! + - name: Ask a question during our office hours + url: https://calendly.com/fivetran-solutions-team/fivetran-solutions-team-office-hours + about: Schedule time during the external office hours block with the Fivetran Analytics Engineering team for support + - name: Fivetran connector question + url: https://support.fivetran.com/hc + about: Have a question about your connector? Check out the Fivetran support portal for more details. + - name: What is dbt + url: https://docs.getdbt.com/docs/introduction + about: Check out the dbt docs for all dbt related information + - name: Hang out in dbt Slack + url: https://www.getdbt.com/community/ + about: Have a question or just want to chat with fellow data friends, join dbt Slack and hangout in the tools-fivetran channel with us! \ No newline at end of file From 994b27687a0b4f9db35b3372af39ff0366c2ab65 Mon Sep 17 00:00:00 2001 From: fivetran-reneeli <renee.li@fivetran.com> Date: Mon, 18 Jul 2022 11:08:45 +0200 Subject: [PATCH 02/41] versioning, identifier var --- dbt_project.yml | 2 +- integration_tests/dbt_project.yml | 19 ++++++++----------- models/src_tiktok_ads.yml | 13 ++++++++++--- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/dbt_project.yml b/dbt_project.yml index 0a69a13..211980a 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -1,5 +1,5 @@ name: 'tiktok_ads_source' -version: '0.1.0' +version: '0.2.0' config-version: 2 require-dbt-version: [">=1.0.0", "<2.0.0"] diff --git a/integration_tests/dbt_project.yml b/integration_tests/dbt_project.yml index 54c9ffa..2f680e3 100644 --- a/integration_tests/dbt_project.yml +++ b/integration_tests/dbt_project.yml @@ -1,20 +1,17 @@ name: 'tiktok_ads_source_integration_tests' -version: '0.1.0' +version: '0.2.0' profile: 'integration_tests' config-version: 2 vars: tiktok_ads_source: - ad_group_history: "{{ ref('tiktok_adgroup_history_data') }}" - ad_history: "{{ ref('tiktok_ad_history_data') }}" - advertiser: "{{ ref('tiktok_advertiser_data') }}" - campaign_history: "{{ ref('tiktok_campaign_history_data') }}" - ad_report_daily: "{{ ref('tiktok_ad_report_daily_data') }}" - ad_report_hourly: "{{ ref('tiktok_ad_report_hourly_data') }}" - ad_group_daily: "{{ ref('tiktok_adgroup_report_daily_data') }}" - ad_group_hourly: "{{ ref('tiktok_adgroup_report_hourly_data') }}" - campaign_report_daily: "{{ ref('tiktok_campaign_report_daily_data') }}" - campaign_report_hourly: "{{ ref('tiktok_campaign_report_hourly_data') }}" + tiktok_ads__ad_group_history_identifier: "tiktok_adgroup_history_data" + tiktok_ads__ad_history_identifier: "tiktok_ad_history_data" + tiktok_ads__advertiser_identifier: "tiktok_advertiser_data" + tiktok_ads__campaign_history_identifier: "tiktok_campaign_history_data" + tiktok_ads__ad_report_hourly_identifier: "tiktok_ad_report_hourly_data" + tiktok_ads__ad_group_hourly_identifier: "tiktok_adgroup_report_hourly_data" + tiktok_ads__campaign_report_hourly_identifier: "tiktok_campaign_report_hourly_data" seeds: diff --git a/models/src_tiktok_ads.yml b/models/src_tiktok_ads.yml index 5ac0c9d..0787e6f 100644 --- a/models/src_tiktok_ads.yml +++ b/models/src_tiktok_ads.yml @@ -10,6 +10,7 @@ sources: tables: - name: advertiser + identifier: "{{ var('tiktok_ads__advertiser_identifier', 'advertiser') }}" description: Each record represents data for one advertiser. columns: - name: id @@ -60,6 +61,7 @@ sources: description: Timestamp of when Fivetran synced a record. - name: campaign_history + identifier: "{{ var('tiktok_ads__campaign_history_identifier', 'campaign_history') }}" description: Each record represents a version of a TikTok campaign. columns: - name: campaign_id @@ -90,7 +92,8 @@ sources: description: Split Test variables. Optional values; TARGETING, BIDDING_OPTIMIZATION , CREATIVE. - - name: adgroup_history + - name: adgroup_history + identifier: "{{ var('tiktok_ads__ad_group_history_identifier', 'adgroup_history') }}" description: Each record represents a version of a TikTok ad group. columns: - name: adgroup_id @@ -242,7 +245,8 @@ sources: description: Whether users can download your video ads on TikTok(cannot be updated once created). - - name: ad_history + - name: ad_history + identifier: "{{ var('tiktok_ads__ad_history_identifier', 'ad_history') }}" description: Each record represents a version of a TikTok ad. columns: - name: ad_id @@ -297,6 +301,7 @@ sources: description: The video ID. - name: ad_report_hourly + identifier: "{{ var('tiktok_ads__ad_report_hourly_identifier', 'ad_report_hourly') }}" description: Each record represents data for each ad for each hour. columns: - name: ad_id @@ -415,6 +420,7 @@ sources: - name: campaign_report_hourly + identifier: "{{ var('tiktok_ads__campaign_report_hourly_identifier', 'campaign_report_hourly') }}" description: Each record represents data for each campaign for each hour. columns: - name: campaign_id @@ -442,7 +448,7 @@ sources: - name: result description: > The number of times your ad achieved an outcome, based on the optimization goal - you selected. As one campaign may have a number of different optimization goals, + you selected. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the results. (The total count is calculated based on the time each ad impression occurred.) - name: video_views_p_50 @@ -535,6 +541,7 @@ sources: - name: adgroup_report_hourly + identifier: "{{ var('tiktok_ads__ad_group_report_hourly_identifier', 'adgroup_report_hourly') }}" description: Each record represents data for each ad group for each hour. columns: - name: adgroup_id From a41c9d7f5b23c9b73162098b0f36df44e1f3905b Mon Sep 17 00:00:00 2001 From: fivetran-reneeli <renee.li@fivetran.com> Date: Mon, 18 Jul 2022 11:08:58 +0200 Subject: [PATCH 03/41] timestamp s --- models/stg_tiktok_ads__ad_group_history.sql | 4 ++-- models/stg_tiktok_ads__ad_group_report_hourly.sql | 2 +- models/stg_tiktok_ads__ad_history.sql | 4 ++-- models/stg_tiktok_ads__ad_report_hourly.sql | 2 +- models/stg_tiktok_ads__advertiser.sql | 2 +- models/stg_tiktok_ads__campaign_history.sql | 4 ++-- models/stg_tiktok_ads__campaign_report_hourly.sql | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/models/stg_tiktok_ads__ad_group_history.sql b/models/stg_tiktok_ads__ad_group_history.sql index 24755f2..4f7426a 100644 --- a/models/stg_tiktok_ads__ad_group_history.sql +++ b/models/stg_tiktok_ads__ad_group_history.sql @@ -23,7 +23,7 @@ final as ( select adgroup_id as ad_group_id, - updated_at, + cast(updated_at as {{ dbt_utils.type_timestamp() }}) as updated_at, advertiser_id, campaign_id, action_days, @@ -40,7 +40,7 @@ final as ( gender, languages, landing_page_url, - _fivetran_synced + cast(_fivetran_synced as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced from fields ), diff --git a/models/stg_tiktok_ads__ad_group_report_hourly.sql b/models/stg_tiktok_ads__ad_group_report_hourly.sql index 5c50349..c5847e9 100644 --- a/models/stg_tiktok_ads__ad_group_report_hourly.sql +++ b/models/stg_tiktok_ads__ad_group_report_hourly.sql @@ -23,7 +23,7 @@ final as ( select adgroup_id as ad_group_id, - _fivetran_synced, + cast(_fivetran_synced as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced, stat_time_hour, cpc, cpm, diff --git a/models/stg_tiktok_ads__ad_history.sql b/models/stg_tiktok_ads__ad_history.sql index b2dea57..846c037 100644 --- a/models/stg_tiktok_ads__ad_history.sql +++ b/models/stg_tiktok_ads__ad_history.sql @@ -23,7 +23,7 @@ final as ( select ad_id, - updated_at, + cast(updated_at as {{ dbt_utils.type_timestamp() }}) as updated_at, adgroup_id as ad_group_id, advertiser_id, campaign_id, @@ -42,7 +42,7 @@ final as ( {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_term') }} as utm_term, landing_page_url, video_id, - _fivetran_synced + cast(_fivetran_synced as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced, from fields ), diff --git a/models/stg_tiktok_ads__ad_report_hourly.sql b/models/stg_tiktok_ads__ad_report_hourly.sql index 9d1bdf4..9953caa 100644 --- a/models/stg_tiktok_ads__ad_report_hourly.sql +++ b/models/stg_tiktok_ads__ad_report_hourly.sql @@ -23,7 +23,7 @@ final as ( select ad_id, - _fivetran_synced, + cast(_fivetran_synced as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced, stat_time_hour, cpc, cpm, diff --git a/models/stg_tiktok_ads__advertiser.sql b/models/stg_tiktok_ads__advertiser.sql index 0c2d449..08188d2 100644 --- a/models/stg_tiktok_ads__advertiser.sql +++ b/models/stg_tiktok_ads__advertiser.sql @@ -37,7 +37,7 @@ final as ( phone_number, telephone, timezone, - _fivetran_synced + cast(_fivetran_synced as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced from fields ) diff --git a/models/stg_tiktok_ads__campaign_history.sql b/models/stg_tiktok_ads__campaign_history.sql index e7d6fa6..cbfefb0 100644 --- a/models/stg_tiktok_ads__campaign_history.sql +++ b/models/stg_tiktok_ads__campaign_history.sql @@ -23,12 +23,12 @@ final as ( select campaign_id, - updated_at, + cast(updated_at as {{ dbt_utils.type_timestamp() }}) as updated_at, advertiser_id, campaign_name, campaign_type, split_test_variable, - _fivetran_synced + cast(_fivetran_synced as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced from fields diff --git a/models/stg_tiktok_ads__campaign_report_hourly.sql b/models/stg_tiktok_ads__campaign_report_hourly.sql index b354960..b1aeb7b 100644 --- a/models/stg_tiktok_ads__campaign_report_hourly.sql +++ b/models/stg_tiktok_ads__campaign_report_hourly.sql @@ -23,7 +23,7 @@ final as ( select campaign_id, - _fivetran_synced, + cast(_fivetran_synced as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced, stat_time_hour, cpc, cpm, From e69bc8b83c873b39c2d4eb459d66d2936823cd44 Mon Sep 17 00:00:00 2001 From: fivetran-reneeli <renee.li@fivetran.com> Date: Tue, 19 Jul 2022 17:51:38 +0200 Subject: [PATCH 04/41] update advertiser name --- models/stg_tiktok_ads__advertiser.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/stg_tiktok_ads__advertiser.sql b/models/stg_tiktok_ads__advertiser.sql index 08188d2..17cbdd8 100644 --- a/models/stg_tiktok_ads__advertiser.sql +++ b/models/stg_tiktok_ads__advertiser.sql @@ -33,7 +33,7 @@ final as ( email, industry, language, - name, + name as advertiser_name, phone_number, telephone, timezone, From c226881681f2cf5a62952341ae784d1d39abb03e Mon Sep 17 00:00:00 2001 From: fivetran-reneeli <renee.li@fivetran.com> Date: Tue, 19 Jul 2022 17:51:52 +0200 Subject: [PATCH 05/41] update advertiser name yml --- models/stg_tiktok_ads.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/stg_tiktok_ads.yml b/models/stg_tiktok_ads.yml index 530faa3..16d0eb2 100644 --- a/models/stg_tiktok_ads.yml +++ b/models/stg_tiktok_ads.yml @@ -37,7 +37,7 @@ models: description: License number - name: license_url description: License preview address, the link is valid for an hour by default. - - name: name + - name: advertiser_name description: Advertiser name - name: phone_number description: Contact mobile number, desensitised data From 6ce221990357a19d9ea2008b63d0120ab3a56c76 Mon Sep 17 00:00:00 2001 From: fivetran-reneeli <renee.li@fivetran.com> Date: Wed, 20 Jul 2022 18:30:09 +0200 Subject: [PATCH 06/41] readme --- README.md | 130 +++++++++++++++++++++++++++++------------------------- 1 file changed, 70 insertions(+), 60 deletions(-) diff --git a/README.md b/README.md index d7d84b6..60dea96 100644 --- a/README.md +++ b/README.md @@ -1,48 +1,50 @@ -[![Apache License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) -# TikTok Ads Source - -This package models TikTok Ads data from [Fivetran's connector](https://fivetran.com/docs/applications/tiktok-ads/). It uses data in the format described by [this ERD](https://fivetran.com/docs/applications/tiktok-ads#schemainformation). - -This package enriches your Fivetran data by doing the following: - -* Adds descriptions to tables and columns that are synced using Fivetran -* Adds column-level testing where applicable. For example, all primary keys are tested for uniqueness and non-null values. -* Models staging tables, which will be used in our transform package - -## Models - -This package contains staging models, designed to work simultaneously with our [TikTok Ads transform package](https://github.com/fivetran/dbt_tiktok_ads) and our [multi-platform Ad Reporting package](https://github.com/fivetran/dbt_ad_reporting). The staging models: - -* Name columns consistently across all packages: - * Boolean fields are prefixed with `is_` or `has_` - * Timestamps are appended with `_at` - * ID primary keys are prefixed with the name of the table. For example, the advertiser table's ID column is renamed `advertiser_id`. - -## Installation Instructions -Check [dbt Hub](https://hub.getdbt.com/) for the latest installation instructions, or [read the dbt docs](https://docs.getdbt.com/docs/package-management) for more information on installing packages. - -Include in your `packages.yml` - +<p align="center"> + <a alt="License" + href="https://github.com/fivetran/dbt_tiktok_source/blob/main/LICENSE"> + <img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" /></a> + <a alt="dbt-core"> + <img src="https://img.shields.io/badge/dbt_Coreā„¢_version->=1.0.0_<2.0.0-orange.svg" /></a> + <a alt="Maintained?"> + <img src="https://img.shields.io/badge/Maintained%3F-yes-green.svg" /></a> + <a alt="PRs"> + <img src="https://img.shields.io/badge/Contributions-welcome-blueviolet" /></a> +</p> + +# Tiktok Ads Source dbt Package ([Docs](https://fivetran.github.io/dbt_tiktok_source/)) +# šŸ“£ What does this dbt package do? +- Materializes [Tiktok staging tables](https://fivetran.github.io/dbt_tiktok_ads_source/#!/overview/tiktok_ads_source/models/?g_v=1) which leverage data in the format described by [this ERD](https://fivetran.com/docs/applications/tiktok_ads/#schemainformation). These staging tables clean, test, and prepare your Tiktok data from [Fivetran's connector](https://fivetran.com/docs/applications/tiktok_ads) for analysis by doing the following: + - Name columns for consistency across all packages and for easier analysis + - Adds freshness tests to source data + - Adds column-level testing where applicable. For example, all primary keys are tested for uniqueness and non-null values. +- Generates a comprehensive data dictionary of your Tiktok data through the [dbt docs site](https://fivetran.github.io/dbt_tiktok_ads_source/). +- These tables are designed to work simultaneously with our [Tiktok Ads transformation package](https://github.com/fivetran/dbt_tiktok_ads). + + +# šŸŽÆ How do I use the dbt package? +## Step 1: Prerequisites +To use this dbt package, you must have the following: +- At least one Fivetran Tiktok Ads connector syncing data into your destination. +- A **BigQuery**, **Snowflake**, **Redshift**, **PostgreSQL**, or **Databricks** destination. + +## Step 2: Install the package +Include the following tiktok_source package version in your `packages.yml` file. +> TIP: Check [dbt Hub](https://hub.getdbt.com/) for the latest installation instructions or [read the dbt docs](https://docs.getdbt.com/docs/package-management) for more information on installing packages. ```yaml packages: - package: fivetran/tiktok_ads_source - version: [">=0.1.0", "<0.2.0"] + version: [">=0.2.0", "<0.3.0"] ``` -## Configuration -By default, this package will look for your TikTok Ads data in the `tiktok_ads` schema of your [target database](https://docs.getdbt.com/docs/running-a-dbt-project/using-the-command-line-interface/configure-your-profile). If this is not where your TikTok Ads data is, please add the following configuration to your `dbt_project.yml` file: +## Step 3: Define database and schema variables +By default, this package runs using your destination and the `tiktok_ads` schema. If this is not where your Tiktok Ads data is (for example, if your Tiktok schema is named `tiktok_ads_fivetran`), add the following configuration to your root `dbt_project.yml` file: ```yml -# dbt_project.yml - -... -config-version: 2 - vars: - tiktok_ads_database: your_database_name - tiktok_ads_schema: your_schema_name + tiktok_ads_database: your_destination_name + tiktok_ads_schema: your_schema_name ``` +## (Optional) Step 5: Additional configurations ### Changing the Build Schema By default, this package will build the TikTok Ads staging models within a schema titled (<target_schema> + `_stg_tiktok_ads`) in your target database. If this is not where you would like your TikTok Ads staging data to be written to, add the following configuration to your `dbt_project.yml` file: @@ -54,37 +56,45 @@ models: tiktok_ads_source: +schema: my_new_schema_name # leave blank for just the target_schema ``` -## Database Support -This package has been tested on BigQuery, Snowflake, Redshift, Postgres, and Databricks. - -### Databricks Dispatch Configuration +### Change the source table references +If an individual source table has a different name than the package expects, add the table name as it appears in your destination to the respective variable: +> IMPORTANT: See this project's [`dbt_project.yml`](https://github.com/fivetran/dbt_tiktok_ads_source/blob/main/dbt_project.yml) variable declarations to see the expected names. + +```yml +vars: + tiktok_ads_<default_source_table_name>_identifier: your_table_name +``` -dbt `v0.20.0` introduced a new project-level dispatch configuration that enables an "override" setting for all dispatched macros. If you are using a Databricks destination with this package, you will need to add the following (or a variation of the following) dispatch configuration within your `dbt_project.yml`. This is required in order for the package to accurately search for macros within the `dbt-labs/spark_utils` and then the `dbt-labs/dbt_utils` packages, respectively. +## (Optional) Step 6: Orchestrate your models with Fivetran Transformations for dbt Coreā„¢ +<details><summary>Expand to view details</summary> +<br> + +Fivetran offers the ability for you to orchestrate your dbt project through [Fivetran Transformations for dbt Coreā„¢](https://fivetran.com/docs/transformations/dbt). Learn how to set up your project for orchestration through Fivetran in our [Transformations for dbt Coreā„¢ setup guides](https://fivetran.com/docs/transformations/dbt#setupguide). +</details> + +# šŸ” Does this package have dependencies? +This dbt package is dependent on the following dbt packages. Please be aware that these dependencies are installed by default within this package. For more information on the following packages, refer to the [dbt hub](https://hub.getdbt.com/) site. +> IMPORTANT: If you have any of these dependent packages in your own `packages.yml` file, we highly recommend that you remove them from your root `packages.yml` to avoid package version conflicts. ```yml -# dbt_project.yml +packages: + - package: fivetran/fivetran_utils + version: [">=0.3.0", "<0.4.0"] -dispatch: - - macro_namespace: dbt_utils - search_order: ['spark_utils', 'dbt_utils'] + - package: dbt-labs/dbt_utils + version: [">=0.8.0", "<0.9.0"] ``` + +# šŸ™Œ How is this package maintained and can I contribute? +## Package Maintenance +The Fivetran team maintaining this package _only_ maintains the latest version of the package. We highly recommend that you stay consistent with the [latest version](https://hub.getdbt.com/fivetran/tiktok_ads_source/latest/) of the package and refer to the [CHANGELOG](https://github.com/fivetran/dbt_tiktok_ads_source/blob/main/CHANGELOG.md) and release notes for more information on changes across versions. ## Contributions +A small team of analytics engineers at Fivetran develops these dbt packages. However, the packages are made better by community contributions! -Additional contributions to this package are very welcome! Please create issues -or open PRs against `main`. Check out -[this Discourse post](https://discourse.getdbt.com/t/contributing-to-a-dbt-package/657) -on the best workflow for contributing to a package. +We highly encourage and welcome contributions to this package. Check out [this dbt Discourse article](https://discourse.getdbt.com/t/contributing-to-a-dbt-package/657) to learn how to contribute to a dbt package! -## Resources: -- Provide [feedback](https://www.surveymonkey.com/r/DQ7K7WW) on our existing dbt packages or what you'd like to see next -- Have questions or feedback, or need help? Book a time during our office hours [using Calendly](https://calendly.com/fivetran-solutions-team/fivetran-solutions-team-office-hours) or email us at solutions@fivetran.com. -- Find all of Fivetran's pre-built dbt packages in our [dbt hub](https://hub.getdbt.com/fivetran/) -- Learn how to orchestrate your models with [Fivetran Transformations for dbt Coreā„¢](https://fivetran.com/docs/transformations/dbt) -- Learn more about Fivetran overall [in our docs](https://fivetran.com/docs) -- Check out [Fivetran's blog](https://fivetran.com/blog) -- Learn more about dbt [in the dbt docs](https://docs.getdbt.com/docs/introduction) -- Check out [Discourse](https://discourse.getdbt.com/) for commonly asked questions and answers -- Join the [chat](http://slack.getdbt.com/) on Slack for live discussions and support -- Find [dbt events](https://events.getdbt.com) near you -- Check out [the dbt blog](https://blog.getdbt.com/) for the latest news on dbt's development and best practices +# šŸŖ Are there any resources available? +- If you have questions or want to reach out for help, please refer to the [GitHub Issue](https://github.com/fivetran/dbt_tiktok_ads_source/issues/new/choose) section to find the right avenue of support for you. +- If you would like to provide feedback to the dbt package team at Fivetran or would like to request a new dbt package, fill out our [Feedback Form](https://www.surveymonkey.com/r/DQ7K7WW). +- Have questions or want to just say hi? Book a time during our office hours [on Calendly](https://calendly.com/fivetran-solutions-team/fivetran-solutions-team-office-hours) or email us at solutions@fivetran.com. \ No newline at end of file From dd4bc189b43e3b2d84757e8303fe35cb8d52c362 Mon Sep 17 00:00:00 2001 From: fivetran-reneeli <renee.li@fivetran.com> Date: Wed, 20 Jul 2022 19:18:15 +0200 Subject: [PATCH 07/41] fix integration schema name --- integration_tests/dbt_project.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/integration_tests/dbt_project.yml b/integration_tests/dbt_project.yml index 2f680e3..3e06044 100644 --- a/integration_tests/dbt_project.yml +++ b/integration_tests/dbt_project.yml @@ -5,6 +5,7 @@ config-version: 2 vars: tiktok_ads_source: + tiktok_ads_schema: tiktok_ads_source_integration_tests tiktok_ads__ad_group_history_identifier: "tiktok_adgroup_history_data" tiktok_ads__ad_history_identifier: "tiktok_ad_history_data" tiktok_ads__advertiser_identifier: "tiktok_advertiser_data" From eae76fe944b0dcd325d8bcc5da1ed283d627f9a4 Mon Sep 17 00:00:00 2001 From: fivetran-reneeli <renee.li@fivetran.com> Date: Wed, 20 Jul 2022 19:18:25 +0200 Subject: [PATCH 08/41] add passthru metrics --- models/stg_tiktok_ads__ad_group_report_hourly.sql | 4 ++++ models/stg_tiktok_ads__ad_report_hourly.sql | 4 ++++ models/stg_tiktok_ads__campaign_report_hourly.sql | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/models/stg_tiktok_ads__ad_group_report_hourly.sql b/models/stg_tiktok_ads__ad_group_report_hourly.sql index c5847e9..ced1ab2 100644 --- a/models/stg_tiktok_ads__ad_group_report_hourly.sql +++ b/models/stg_tiktok_ads__ad_group_report_hourly.sql @@ -48,6 +48,10 @@ final as ( video_views_p_75, average_video_play, average_video_play_per_user + + {% for metric in var('tiktok_ads__ad_group_hourly_passthrough_metrics', []) %} + , {{ metric }} + {% endfor %} from fields ) diff --git a/models/stg_tiktok_ads__ad_report_hourly.sql b/models/stg_tiktok_ads__ad_report_hourly.sql index 9953caa..2d0a539 100644 --- a/models/stg_tiktok_ads__ad_report_hourly.sql +++ b/models/stg_tiktok_ads__ad_report_hourly.sql @@ -48,6 +48,10 @@ final as ( video_views_p_75, average_video_play, average_video_play_per_user + + {% for metric in var('tiktok_ads__ad_hourly_passthrough_metrics', []) %} + , {{ metric }} + {% endfor %} from fields ) diff --git a/models/stg_tiktok_ads__campaign_report_hourly.sql b/models/stg_tiktok_ads__campaign_report_hourly.sql index b1aeb7b..4058d42 100644 --- a/models/stg_tiktok_ads__campaign_report_hourly.sql +++ b/models/stg_tiktok_ads__campaign_report_hourly.sql @@ -48,6 +48,10 @@ final as ( video_views_p_75, average_video_play, average_video_play_per_user + + {% for metric in var('tiktok_ads__campaign_hourly_passthrough_metrics', []) %} + , {{ metric }} + {% endfor %} from fields ) From 9331d397735bd78b9109cddc551f225ed3db6c64 Mon Sep 17 00:00:00 2001 From: fivetran-reneeli <renee.li@fivetran.com> Date: Wed, 20 Jul 2022 19:26:03 +0200 Subject: [PATCH 09/41] fix adgroup identifer --- integration_tests/dbt_project.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration_tests/dbt_project.yml b/integration_tests/dbt_project.yml index 3e06044..75d2dfa 100644 --- a/integration_tests/dbt_project.yml +++ b/integration_tests/dbt_project.yml @@ -11,7 +11,7 @@ vars: tiktok_ads__advertiser_identifier: "tiktok_advertiser_data" tiktok_ads__campaign_history_identifier: "tiktok_campaign_history_data" tiktok_ads__ad_report_hourly_identifier: "tiktok_ad_report_hourly_data" - tiktok_ads__ad_group_hourly_identifier: "tiktok_adgroup_report_hourly_data" + tiktok_ads__ad_group_report_hourly_identifier: "tiktok_adgroup_report_hourly_data" tiktok_ads__campaign_report_hourly_identifier: "tiktok_campaign_report_hourly_data" From c0c0b79381f6c3972954d7483c4959ce7c300f39 Mon Sep 17 00:00:00 2001 From: fivetran-reneeli <renee.li@fivetran.com> Date: Wed, 20 Jul 2022 19:29:04 +0200 Subject: [PATCH 10/41] fix --- models/stg_tiktok_ads__ad_history.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/stg_tiktok_ads__ad_history.sql b/models/stg_tiktok_ads__ad_history.sql index 846c037..03b17cd 100644 --- a/models/stg_tiktok_ads__ad_history.sql +++ b/models/stg_tiktok_ads__ad_history.sql @@ -42,7 +42,7 @@ final as ( {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_term') }} as utm_term, landing_page_url, video_id, - cast(_fivetran_synced as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced, + cast(_fivetran_synced as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced from fields ), From c45bd7302c7225306f3608485912223c582aa880 Mon Sep 17 00:00:00 2001 From: fivetran-reneeli <renee.li@fivetran.com> Date: Wed, 20 Jul 2022 21:19:14 +0200 Subject: [PATCH 11/41] readme updates --- README.md | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 60dea96..ca0a809 100644 --- a/README.md +++ b/README.md @@ -10,13 +10,13 @@ <img src="https://img.shields.io/badge/Contributions-welcome-blueviolet" /></a> </p> -# Tiktok Ads Source dbt Package ([Docs](https://fivetran.github.io/dbt_tiktok_source/)) +# Tiktok Ads Source dbt Package ([Docs](https://fivetran.github.io/dbt_tiktok_ads_source/)) # šŸ“£ What does this dbt package do? -- Materializes [Tiktok staging tables](https://fivetran.github.io/dbt_tiktok_ads_source/#!/overview/tiktok_ads_source/models/?g_v=1) which leverage data in the format described by [this ERD](https://fivetran.com/docs/applications/tiktok_ads/#schemainformation). These staging tables clean, test, and prepare your Tiktok data from [Fivetran's connector](https://fivetran.com/docs/applications/tiktok_ads) for analysis by doing the following: +- Materializes [Tiktok Ads staging tables](https://fivetran.github.io/dbt_tiktok_ads_source/#!/overview/tiktok_ads_source/models/?g_v=1) which leverage data in the format described by [this ERD](https://fivetran.com/docs/applications/tiktok_ads/#schemainformation). These staging tables clean, test, and prepare your Tiktok Ads data from [Fivetran's connector](https://fivetran.com/docs/applications/tiktok_ads) for analysis by doing the following: - Name columns for consistency across all packages and for easier analysis - Adds freshness tests to source data - Adds column-level testing where applicable. For example, all primary keys are tested for uniqueness and non-null values. -- Generates a comprehensive data dictionary of your Tiktok data through the [dbt docs site](https://fivetran.github.io/dbt_tiktok_ads_source/). +- Generates a comprehensive data dictionary of your Tiktok Ads data through the [dbt docs site](https://fivetran.github.io/dbt_tiktok_ads_source/). - These tables are designed to work simultaneously with our [Tiktok Ads transformation package](https://github.com/fivetran/dbt_tiktok_ads). @@ -27,7 +27,7 @@ To use this dbt package, you must have the following: - A **BigQuery**, **Snowflake**, **Redshift**, **PostgreSQL**, or **Databricks** destination. ## Step 2: Install the package -Include the following tiktok_source package version in your `packages.yml` file. +Include the following tiktok_ads_source package version in your `packages.yml` file. > TIP: Check [dbt Hub](https://hub.getdbt.com/) for the latest installation instructions or [read the dbt docs](https://docs.getdbt.com/docs/package-management) for more information on installing packages. ```yaml packages: @@ -44,7 +44,7 @@ vars: tiktok_ads_schema: your_schema_name ``` -## (Optional) Step 5: Additional configurations +## (Optional) Step 4: Additional configurations ### Changing the Build Schema By default, this package will build the TikTok Ads staging models within a schema titled (<target_schema> + `_stg_tiktok_ads`) in your target database. If this is not where you would like your TikTok Ads staging data to be written to, add the following configuration to your `dbt_project.yml` file: @@ -66,13 +66,9 @@ vars: tiktok_ads_<default_source_table_name>_identifier: your_table_name ``` -## (Optional) Step 6: Orchestrate your models with Fivetran Transformations for dbt Coreā„¢ -<details><summary>Expand to view details</summary> -<br> - +## (Optional) Step 5: Orchestrate your models with Fivetran Transformations for dbt Coreā„¢ Fivetran offers the ability for you to orchestrate your dbt project through [Fivetran Transformations for dbt Coreā„¢](https://fivetran.com/docs/transformations/dbt). Learn how to set up your project for orchestration through Fivetran in our [Transformations for dbt Coreā„¢ setup guides](https://fivetran.com/docs/transformations/dbt#setupguide). -</details> - + # šŸ” Does this package have dependencies? This dbt package is dependent on the following dbt packages. Please be aware that these dependencies are installed by default within this package. For more information on the following packages, refer to the [dbt hub](https://hub.getdbt.com/) site. > IMPORTANT: If you have any of these dependent packages in your own `packages.yml` file, we highly recommend that you remove them from your root `packages.yml` to avoid package version conflicts. From 19211b734af2c5d5b1ac67a93738291e53a8f819 Mon Sep 17 00:00:00 2001 From: fivetran-reneeli <renee.li@fivetran.com> Date: Wed, 20 Jul 2022 21:39:26 +0200 Subject: [PATCH 12/41] add null tests --- models/stg_tiktok_ads.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/models/stg_tiktok_ads.yml b/models/stg_tiktok_ads.yml index 16d0eb2..f6bdce7 100644 --- a/models/stg_tiktok_ads.yml +++ b/models/stg_tiktok_ads.yml @@ -188,7 +188,7 @@ models: - name: is_most_recent_record description: Whether record is the most recent one for this particular grain. - + - name: stg_tiktok_ads__ad_report_hourly description: Each record represents data for each ad for each hour. tests: @@ -199,8 +199,12 @@ models: columns: - name: ad_id description: Ad id + tests: + - not_null - name: stat_time_hour description: Hour of activity + tests: + - not_null - name: cost_per_conversion description: > The average amount of money you've spent on a conversion. @@ -261,7 +265,7 @@ models: - name: _fivetran_synced description: Timestamp of when Fivetran synced a record. - + - name: stg_tiktok_ads__ad_group_report_hourly description: Each record represents data for each ad group for each hour. tests: @@ -276,6 +280,8 @@ models: - not_null - name: stat_time_hour description: Hour of activity + tests: + - not_null - name: cost_per_conversion description: > The average amount of money you've spent on a conversion. @@ -351,6 +357,8 @@ models: - not_null - name: stat_time_hour description: Hour of activity + tests: + - not_null - name: cost_per_conversion description: > The average amount of money you've spent on a conversion. From ed1e81891aa13ebc98de2e5724a7cc8e0d83053c Mon Sep 17 00:00:00 2001 From: fivetran-reneeli <renee.li@fivetran.com> Date: Thu, 21 Jul 2022 21:00:46 +0200 Subject: [PATCH 13/41] add pass thru metrics to field cte --- models/stg_tiktok_ads__ad_group_report_hourly.sql | 4 ++++ models/stg_tiktok_ads__ad_report_hourly.sql | 4 ++++ models/stg_tiktok_ads__campaign_report_hourly.sql | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/models/stg_tiktok_ads__ad_group_report_hourly.sql b/models/stg_tiktok_ads__ad_group_report_hourly.sql index ced1ab2..f0d1579 100644 --- a/models/stg_tiktok_ads__ad_group_report_hourly.sql +++ b/models/stg_tiktok_ads__ad_group_report_hourly.sql @@ -14,6 +14,10 @@ fields as ( staging_columns=get_ad_group_report_hourly_columns() ) }} + + {% for metric in var('tiktok_ads__ad_group_hourly_passthrough_metrics', []) %} + , {{ metric }} + {% endfor %} from base diff --git a/models/stg_tiktok_ads__ad_report_hourly.sql b/models/stg_tiktok_ads__ad_report_hourly.sql index 2d0a539..22d4ee9 100644 --- a/models/stg_tiktok_ads__ad_report_hourly.sql +++ b/models/stg_tiktok_ads__ad_report_hourly.sql @@ -14,6 +14,10 @@ fields as ( staging_columns=get_ad_report_hourly_columns() ) }} + + {% for metric in var('tiktok_ads__ad_hourly_passthrough_metrics', []) %} + , {{ metric }} + {% endfor %} from base diff --git a/models/stg_tiktok_ads__campaign_report_hourly.sql b/models/stg_tiktok_ads__campaign_report_hourly.sql index 4058d42..f0135d4 100644 --- a/models/stg_tiktok_ads__campaign_report_hourly.sql +++ b/models/stg_tiktok_ads__campaign_report_hourly.sql @@ -14,6 +14,10 @@ fields as ( staging_columns=get_campaign_report_hourly_columns() ) }} + + {% for metric in var('tiktok_ads__campaign_hourly_passthrough_metrics', []) %} + , {{ metric }} + {% endfor %} from base From 8e146741b27cbe3cc062f098712ee824ad78e8c7 Mon Sep 17 00:00:00 2001 From: fivetran-reneeli <renee.li@fivetran.com> Date: Thu, 21 Jul 2022 21:16:43 +0200 Subject: [PATCH 14/41] clean up macros --- macros/get_ad_group_history_columns.sql | 50 +------------------ macros/get_ad_group_report_hourly_columns.sql | 15 ------ macros/get_ad_history_columns.sql | 16 +----- macros/get_ad_report_hourly_columns.sql | 15 ------ macros/get_advertiser_columns.sql | 7 --- macros/get_campaign_history_columns.sql | 6 --- macros/get_campaign_report_hourly_columns.sql | 18 +------ 7 files changed, 4 insertions(+), 123 deletions(-) diff --git a/macros/get_ad_group_history_columns.sql b/macros/get_ad_group_history_columns.sql index 904ebd9..ba7862d 100644 --- a/macros/get_ad_group_history_columns.sql +++ b/macros/get_ad_group_history_columns.sql @@ -6,66 +6,18 @@ {"name": "adgroup_id", "datatype": dbt_utils.type_numeric()}, {"name": "adgroup_name", "datatype": dbt_utils.type_string()}, {"name": "advertiser_id", "datatype": dbt_utils.type_numeric()}, - {"name": "android_osv", "datatype": dbt_utils.type_string()}, - {"name": "app_download_url", "datatype": dbt_utils.type_string()}, - {"name": "app_id", "datatype": dbt_utils.type_numeric()}, - {"name": "app_name", "datatype": dbt_utils.type_string()}, - {"name": "app_type", "datatype": dbt_utils.type_string()}, {"name": "audience_type", "datatype": dbt_utils.type_string()}, - {"name": "bid", "datatype": dbt_utils.type_float()}, - {"name": "bid_type", "datatype": dbt_utils.type_string()}, - {"name": "billing_event", "datatype": dbt_utils.type_string()}, {"name": "budget", "datatype": dbt_utils.type_float()}, - {"name": "budget_mode", "datatype": dbt_utils.type_string()}, {"name": "campaign_id", "datatype": dbt_utils.type_numeric()}, {"name": "category", "datatype": dbt_utils.type_numeric()}, - {"name": "click_tracking_url", "datatype": dbt_utils.type_string()}, - {"name": "conversion_bid", "datatype": dbt_utils.type_float()}, - {"name": "cpv_video_duration", "datatype": dbt_utils.type_string()}, - {"name": "create_time", "datatype": dbt_utils.type_timestamp()}, - {"name": "creative_material_mode", "datatype": dbt_utils.type_string()}, - {"name": "dayparting", "datatype": dbt_utils.type_string()}, - {"name": "deep_bid_type", "datatype": dbt_utils.type_string()}, - {"name": "deep_cpabid", "datatype": dbt_utils.type_float()}, - {"name": "deep_external_action", "datatype": dbt_utils.type_string()}, {"name": "display_name", "datatype": dbt_utils.type_string()}, - {"name": "enable_inventory_filter", "datatype": "boolean"}, - {"name": "external_action", "datatype": dbt_utils.type_string()}, - {"name": "fallback_type", "datatype": dbt_utils.type_string()}, {"name": "frequency", "datatype": dbt_utils.type_numeric()}, {"name": "frequency_schedule", "datatype": dbt_utils.type_numeric()}, {"name": "gender", "datatype": dbt_utils.type_string()}, - {"name": "impression_tracking_url", "datatype": dbt_utils.type_string()}, - {"name": "ios_osv", "datatype": dbt_utils.type_string()}, - {"name": "is_comment_disable", "datatype": dbt_utils.type_numeric()}, - {"name": "is_hfss", "datatype": "boolean"}, - {"name": "is_new_structure", "datatype": "boolean"}, {"name": "landing_page_url", "datatype": dbt_utils.type_string()}, - {"name": "open_url", "datatype": dbt_utils.type_string()}, - {"name": "open_url_type", "datatype": dbt_utils.type_string()}, - {"name": "opt_status", "datatype": dbt_utils.type_string()}, - {"name": "optimize_goal", "datatype": dbt_utils.type_string()}, - {"name": "pacing", "datatype": dbt_utils.type_string()}, - {"name": "package", "datatype": dbt_utils.type_string()}, - {"name": "pixel_id", "datatype": dbt_utils.type_numeric()}, - {"name": "placement_type", "datatype": dbt_utils.type_string()}, - {"name": "profile_image", "datatype": dbt_utils.type_string()}, - {"name": "schedule_end_time", "datatype": dbt_utils.type_timestamp()}, - {"name": "schedule_start_time", "datatype": dbt_utils.type_timestamp()}, - {"name": "schedule_type", "datatype": dbt_utils.type_string()}, - {"name": "skip_learning_phase", "datatype": dbt_utils.type_numeric()}, - {"name": "statistic_type", "datatype": dbt_utils.type_string()}, - {"name": "status", "datatype": dbt_utils.type_string()}, {"name": "updated_at", "datatype": dbt_utils.type_timestamp()}, - {"name": "video_download", "datatype": dbt_utils.type_string()}, - {"name": "audience", "datatype": dbt_utils.type_string()}, - {"name": "excluded_audience", "datatype": dbt_utils.type_string()}, - {"name": "location", "datatype": dbt_utils.type_string()}, - {"name": "interest_category_v_2", "datatype": dbt_utils.type_string()}, - {"name": "pangle_block_app_list_id", "datatype": dbt_utils.type_string()}, + {"name": "interest_category_v_2", "datatype": dbt_utils.type_string()},)}, {"name": "action_categories", "datatype": dbt_utils.type_string()}, - {"name": "placement", "datatype": dbt_utils.type_string()}, - {"name": "keywords", "datatype": dbt_utils.type_string()}, {"name": "age", "datatype": dbt_utils.type_string()}, {"name": "languages", "datatype": dbt_utils.type_string()} diff --git a/macros/get_ad_group_report_hourly_columns.sql b/macros/get_ad_group_report_hourly_columns.sql index 0694210..21c486c 100644 --- a/macros/get_ad_group_report_hourly_columns.sql +++ b/macros/get_ad_group_report_hourly_columns.sql @@ -9,10 +9,7 @@ {"name": "comments", "datatype": dbt_utils.type_numeric()}, {"name": "conversion", "datatype": dbt_utils.type_numeric()}, {"name": "conversion_rate", "datatype": dbt_utils.type_float()}, - {"name": "cost_per_1000_reached", "datatype": dbt_utils.type_float()}, {"name": "cost_per_conversion", "datatype": dbt_utils.type_float()}, - {"name": "cost_per_result", "datatype": dbt_utils.type_float()}, - {"name": "cost_per_secondary_goal_result", "datatype": dbt_utils.type_string()}, {"name": "cpc", "datatype": dbt_utils.type_float()}, {"name": "cpm", "datatype": dbt_utils.type_float()}, {"name": "ctr", "datatype": dbt_utils.type_float()}, @@ -20,23 +17,11 @@ {"name": "impressions", "datatype": dbt_utils.type_numeric()}, {"name": "likes", "datatype": dbt_utils.type_numeric()}, {"name": "profile_visits", "datatype": dbt_utils.type_numeric()}, - {"name": "profile_visits_rate", "datatype": dbt_utils.type_float()}, {"name": "reach", "datatype": dbt_utils.type_numeric()}, - {"name": "real_time_conversion", "datatype": dbt_utils.type_numeric()}, - {"name": "real_time_conversion_rate", "datatype": dbt_utils.type_float()}, - {"name": "real_time_cost_per_conversion", "datatype": dbt_utils.type_float()}, - {"name": "real_time_cost_per_result", "datatype": dbt_utils.type_float()}, - {"name": "real_time_result", "datatype": dbt_utils.type_numeric()}, - {"name": "real_time_result_rate", "datatype": dbt_utils.type_float()}, - {"name": "result", "datatype": dbt_utils.type_numeric()}, - {"name": "result_rate", "datatype": dbt_utils.type_float()}, - {"name": "secondary_goal_result", "datatype": dbt_utils.type_string()}, - {"name": "secondary_goal_result_rate", "datatype": dbt_utils.type_string()}, {"name": "shares", "datatype": dbt_utils.type_numeric()}, {"name": "spend", "datatype": dbt_utils.type_float()}, {"name": "stat_time_hour", "datatype": dbt_utils.type_timestamp()}, {"name": "video_play_actions", "datatype": dbt_utils.type_numeric()}, - {"name": "video_views_p_100", "datatype": dbt_utils.type_numeric()}, {"name": "video_views_p_25", "datatype": dbt_utils.type_numeric()}, {"name": "video_views_p_50", "datatype": dbt_utils.type_numeric()}, {"name": "video_views_p_75", "datatype": dbt_utils.type_numeric()}, diff --git a/macros/get_ad_history_columns.sql b/macros/get_ad_history_columns.sql index 7ba03b3..47fa90f 100644 --- a/macros/get_ad_history_columns.sql +++ b/macros/get_ad_history_columns.sql @@ -4,28 +4,14 @@ {"name": "_fivetran_synced", "datatype": dbt_utils.type_timestamp()}, {"name": "ad_id", "datatype": dbt_utils.type_numeric()}, {"name": "ad_name", "datatype": dbt_utils.type_string()}, - {"name": "ad_text", "datatype": dbt_utils.type_string()}, {"name": "adgroup_id", "datatype": dbt_utils.type_numeric()}, {"name": "advertiser_id", "datatype": dbt_utils.type_numeric()}, - {"name": "app_name", "datatype": dbt_utils.type_string()}, {"name": "call_to_action", "datatype": dbt_utils.type_string()}, {"name": "campaign_id", "datatype": dbt_utils.type_numeric()}, {"name": "click_tracking_url", "datatype": dbt_utils.type_string()}, - {"name": "create_time", "datatype": dbt_utils.type_timestamp()}, - {"name": "display_name", "datatype": dbt_utils.type_string()}, {"name": "impression_tracking_url", "datatype": dbt_utils.type_string()}, - {"name": "is_aco", "datatype": "boolean"}, - {"name": "is_creative_authorized", "datatype": "boolean"}, - {"name": "is_new_structure", "datatype": "boolean"}, {"name": "landing_page_url", "datatype": dbt_utils.type_string()}, - {"name": "open_url", "datatype": dbt_utils.type_string()}, - {"name": "opt_status", "datatype": dbt_utils.type_string()}, - {"name": "playable_url", "datatype": dbt_utils.type_string()}, - {"name": "profile_image", "datatype": dbt_utils.type_string()}, - {"name": "status", "datatype": dbt_utils.type_string()}, - {"name": "updated_at", "datatype": dbt_utils.type_timestamp()}, - {"name": "video_id", "datatype": dbt_utils.type_string()}, - {"name": "image_ids", "datatype": dbt_utils.type_string()} + {"name": "updated_at", "datatype": dbt_utils.type_timestamp()} ] %} diff --git a/macros/get_ad_report_hourly_columns.sql b/macros/get_ad_report_hourly_columns.sql index f11afdd..94a115b 100644 --- a/macros/get_ad_report_hourly_columns.sql +++ b/macros/get_ad_report_hourly_columns.sql @@ -9,10 +9,7 @@ {"name": "comments", "datatype": dbt_utils.type_numeric()}, {"name": "conversion", "datatype": dbt_utils.type_numeric()}, {"name": "conversion_rate", "datatype": dbt_utils.type_float()}, - {"name": "cost_per_1000_reached", "datatype": dbt_utils.type_float()}, {"name": "cost_per_conversion", "datatype": dbt_utils.type_float()}, - {"name": "cost_per_result", "datatype": dbt_utils.type_float()}, - {"name": "cost_per_secondary_goal_result", "datatype": dbt_utils.type_string()}, {"name": "cpc", "datatype": dbt_utils.type_float()}, {"name": "cpm", "datatype": dbt_utils.type_float()}, {"name": "ctr", "datatype": dbt_utils.type_float()}, @@ -20,23 +17,11 @@ {"name": "impressions", "datatype": dbt_utils.type_numeric()}, {"name": "likes", "datatype": dbt_utils.type_numeric()}, {"name": "profile_visits", "datatype": dbt_utils.type_numeric()}, - {"name": "profile_visits_rate", "datatype": dbt_utils.type_float()}, {"name": "reach", "datatype": dbt_utils.type_numeric()}, - {"name": "real_time_conversion", "datatype": dbt_utils.type_numeric()}, - {"name": "real_time_conversion_rate", "datatype": dbt_utils.type_float()}, - {"name": "real_time_cost_per_conversion", "datatype": dbt_utils.type_float()}, - {"name": "real_time_cost_per_result", "datatype": dbt_utils.type_float()}, - {"name": "real_time_result", "datatype": dbt_utils.type_numeric()}, - {"name": "real_time_result_rate", "datatype": dbt_utils.type_float()}, - {"name": "result", "datatype": dbt_utils.type_numeric()}, - {"name": "result_rate", "datatype": dbt_utils.type_float()}, - {"name": "secondary_goal_result", "datatype": dbt_utils.type_string()}, - {"name": "secondary_goal_result_rate", "datatype": dbt_utils.type_string()}, {"name": "shares", "datatype": dbt_utils.type_numeric()}, {"name": "spend", "datatype": dbt_utils.type_float()}, {"name": "stat_time_hour", "datatype": dbt_utils.type_timestamp()}, {"name": "video_play_actions", "datatype": dbt_utils.type_numeric()}, - {"name": "video_views_p_100", "datatype": dbt_utils.type_numeric()}, {"name": "video_views_p_25", "datatype": dbt_utils.type_numeric()}, {"name": "video_views_p_50", "datatype": dbt_utils.type_numeric()}, {"name": "video_views_p_75", "datatype": dbt_utils.type_numeric()}, diff --git a/macros/get_advertiser_columns.sql b/macros/get_advertiser_columns.sql index 9e082dd..bbaf597 100644 --- a/macros/get_advertiser_columns.sql +++ b/macros/get_advertiser_columns.sql @@ -7,21 +7,14 @@ {"name": "company", "datatype": dbt_utils.type_string()}, {"name": "contacter", "datatype": dbt_utils.type_string()}, {"name": "country", "datatype": dbt_utils.type_string()}, - {"name": "create_time", "datatype": dbt_utils.type_timestamp()}, {"name": "currency", "datatype": dbt_utils.type_string()}, {"name": "description", "datatype": dbt_utils.type_string()}, {"name": "email", "datatype": dbt_utils.type_string()}, {"name": "id", "datatype": dbt_utils.type_numeric()}, {"name": "industry", "datatype": dbt_utils.type_string()}, {"name": "language", "datatype": dbt_utils.type_string()}, - {"name": "license_no", "datatype": dbt_utils.type_string()}, - {"name": "license_url", "datatype": dbt_utils.type_string()}, {"name": "name", "datatype": dbt_utils.type_string()}, {"name": "phone_number", "datatype": dbt_utils.type_string()}, - {"name": "promotion_area", "datatype": dbt_utils.type_string()}, - {"name": "reason", "datatype": dbt_utils.type_string()}, - {"name": "role", "datatype": dbt_utils.type_string()}, - {"name": "status", "datatype": dbt_utils.type_string()}, {"name": "telephone", "datatype": dbt_utils.type_string()}, {"name": "timezone", "datatype": dbt_utils.type_string()} ] %} diff --git a/macros/get_campaign_history_columns.sql b/macros/get_campaign_history_columns.sql index 5e47ebf..e3a1298 100644 --- a/macros/get_campaign_history_columns.sql +++ b/macros/get_campaign_history_columns.sql @@ -3,15 +3,9 @@ {% set columns = [ {"name": "_fivetran_synced", "datatype": dbt_utils.type_timestamp()}, {"name": "advertiser_id", "datatype": dbt_utils.type_numeric()}, - {"name": "budget", "datatype": dbt_utils.type_float()}, - {"name": "budget_mode", "datatype": dbt_utils.type_string()}, {"name": "campaign_id", "datatype": dbt_utils.type_numeric()}, {"name": "campaign_name", "datatype": dbt_utils.type_string()}, {"name": "campaign_type", "datatype": dbt_utils.type_string()}, - {"name": "create_time", "datatype": dbt_utils.type_timestamp()}, - {"name": "is_new_structure", "datatype": dbt_utils.type_string()}, - {"name": "objective_type", "datatype": dbt_utils.type_string()}, - {"name": "opt_status", "datatype": dbt_utils.type_string()}, {"name": "split_test_variable", "datatype": dbt_utils.type_string()}, {"name": "updated_at", "datatype": dbt_utils.type_timestamp()} ] %} diff --git a/macros/get_campaign_report_hourly_columns.sql b/macros/get_campaign_report_hourly_columns.sql index b69d230..c432b34 100644 --- a/macros/get_campaign_report_hourly_columns.sql +++ b/macros/get_campaign_report_hourly_columns.sql @@ -1,18 +1,16 @@ {% macro get_campaign_report_hourly_columns() %} {% set columns = [ + {"name": "campaign_id", "datatype": dbt_utils.type_numeric()}, {"name": "_fivetran_synced", "datatype": dbt_utils.type_timestamp()}, + {"name": "ad_id", "datatype": dbt_utils.type_numeric()}, {"name": "average_video_play", "datatype": dbt_utils.type_float()}, {"name": "average_video_play_per_user", "datatype": dbt_utils.type_float()}, - {"name": "campaign_id", "datatype": dbt_utils.type_numeric()}, {"name": "clicks", "datatype": dbt_utils.type_numeric()}, {"name": "comments", "datatype": dbt_utils.type_numeric()}, {"name": "conversion", "datatype": dbt_utils.type_numeric()}, {"name": "conversion_rate", "datatype": dbt_utils.type_float()}, - {"name": "cost_per_1000_reached", "datatype": dbt_utils.type_float()}, {"name": "cost_per_conversion", "datatype": dbt_utils.type_float()}, - {"name": "cost_per_result", "datatype": dbt_utils.type_float()}, - {"name": "cost_per_secondary_goal_result", "datatype": dbt_utils.type_string()}, {"name": "cpc", "datatype": dbt_utils.type_float()}, {"name": "cpm", "datatype": dbt_utils.type_float()}, {"name": "ctr", "datatype": dbt_utils.type_float()}, @@ -20,23 +18,11 @@ {"name": "impressions", "datatype": dbt_utils.type_numeric()}, {"name": "likes", "datatype": dbt_utils.type_numeric()}, {"name": "profile_visits", "datatype": dbt_utils.type_numeric()}, - {"name": "profile_visits_rate", "datatype": dbt_utils.type_float()}, {"name": "reach", "datatype": dbt_utils.type_numeric()}, - {"name": "real_time_conversion", "datatype": dbt_utils.type_numeric()}, - {"name": "real_time_conversion_rate", "datatype": dbt_utils.type_float()}, - {"name": "real_time_cost_per_conversion", "datatype": dbt_utils.type_float()}, - {"name": "real_time_cost_per_result", "datatype": dbt_utils.type_float()}, - {"name": "real_time_result", "datatype": dbt_utils.type_numeric()}, - {"name": "real_time_result_rate", "datatype": dbt_utils.type_float()}, - {"name": "result", "datatype": dbt_utils.type_numeric()}, - {"name": "result_rate", "datatype": dbt_utils.type_float()}, - {"name": "secondary_goal_result", "datatype": dbt_utils.type_string()}, - {"name": "secondary_goal_result_rate", "datatype": dbt_utils.type_string()}, {"name": "shares", "datatype": dbt_utils.type_numeric()}, {"name": "spend", "datatype": dbt_utils.type_float()}, {"name": "stat_time_hour", "datatype": dbt_utils.type_timestamp()}, {"name": "video_play_actions", "datatype": dbt_utils.type_numeric()}, - {"name": "video_views_p_100", "datatype": dbt_utils.type_numeric()}, {"name": "video_views_p_25", "datatype": dbt_utils.type_numeric()}, {"name": "video_views_p_50", "datatype": dbt_utils.type_numeric()}, {"name": "video_views_p_75", "datatype": dbt_utils.type_numeric()}, From cc03f02de51fffa0f480b2be0a7b72a2c0eaf79a Mon Sep 17 00:00:00 2001 From: fivetran-reneeli <renee.li@fivetran.com> Date: Thu, 21 Jul 2022 21:17:01 +0200 Subject: [PATCH 15/41] rm video id --- models/stg_tiktok_ads.yml | 2 -- models/stg_tiktok_ads__ad_history.sql | 1 - 2 files changed, 3 deletions(-) diff --git a/models/stg_tiktok_ads.yml b/models/stg_tiktok_ads.yml index f6bdce7..5a319a9 100644 --- a/models/stg_tiktok_ads.yml +++ b/models/stg_tiktok_ads.yml @@ -153,8 +153,6 @@ models: description: The utm_content parameter of the ad, extracted from the `landing_page_url`. - name: utm_term description: The utm_term parameter of the ad, extracted from the `landing_page_url`. - - name: video_id - description: The video ID. - name: _fivetran_synced description: Timestamp of when Fivetran synced a record. - name: is_most_recent_record diff --git a/models/stg_tiktok_ads__ad_history.sql b/models/stg_tiktok_ads__ad_history.sql index 03b17cd..7f484a0 100644 --- a/models/stg_tiktok_ads__ad_history.sql +++ b/models/stg_tiktok_ads__ad_history.sql @@ -41,7 +41,6 @@ final as ( {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_content') }} as utm_content, {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_term') }} as utm_term, landing_page_url, - video_id, cast(_fivetran_synced as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced from fields From 3a4ebd47afe19504d75124dda324ea37beddc5c6 Mon Sep 17 00:00:00 2001 From: fivetran-reneeli <renee.li@fivetran.com> Date: Thu, 21 Jul 2022 21:33:51 +0200 Subject: [PATCH 16/41] fix --- macros/get_ad_group_history_columns.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/get_ad_group_history_columns.sql b/macros/get_ad_group_history_columns.sql index ba7862d..4ae1909 100644 --- a/macros/get_ad_group_history_columns.sql +++ b/macros/get_ad_group_history_columns.sql @@ -16,7 +16,7 @@ {"name": "gender", "datatype": dbt_utils.type_string()}, {"name": "landing_page_url", "datatype": dbt_utils.type_string()}, {"name": "updated_at", "datatype": dbt_utils.type_timestamp()}, - {"name": "interest_category_v_2", "datatype": dbt_utils.type_string()},)}, + {"name": "interest_category_v_2", "datatype": dbt_utils.type_string()}, {"name": "action_categories", "datatype": dbt_utils.type_string()}, {"name": "age", "datatype": dbt_utils.type_string()}, {"name": "languages", "datatype": dbt_utils.type_string()} From 05c544b8dd4f549bf98c7cd351c43f07d6f1f8b5 Mon Sep 17 00:00:00 2001 From: fivetran-reneeli <renee.li@fivetran.com> Date: Thu, 21 Jul 2022 21:35:03 +0200 Subject: [PATCH 17/41] try new schema --- integration_tests/ci/sample.profiles.yml | 10 +++++----- integration_tests/dbt_project.yml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/integration_tests/ci/sample.profiles.yml b/integration_tests/ci/sample.profiles.yml index adb9551..920b933 100644 --- a/integration_tests/ci/sample.profiles.yml +++ b/integration_tests/ci/sample.profiles.yml @@ -16,14 +16,14 @@ integration_tests: pass: "{{ env_var('CI_REDSHIFT_DBT_PASS') }}" dbname: "{{ env_var('CI_REDSHIFT_DBT_DBNAME') }}" port: 5439 - schema: tiktok_ads_source_integration_tests + schema: tiktok_ads_source_integration_tests_1 threads: 8 bigquery: type: bigquery method: service-account keyfile: "{{ env_var('GCLOUD_SERVICE_KEY_PATH') }}" project: 'dbt-package-testing' - schema: tiktok_ads_source_integration_tests + schema: tiktok_ads_source_integration_tests_1 threads: 8 snowflake: type: snowflake @@ -33,12 +33,12 @@ integration_tests: role: "{{ env_var('CI_SNOWFLAKE_DBT_ROLE') }}" database: "{{ env_var('CI_SNOWFLAKE_DBT_DATABASE') }}" warehouse: "{{ env_var('CI_SNOWFLAKE_DBT_WAREHOUSE') }}" - schema: tiktok_ads_source_integration_tests + schema: tiktok_ads_source_integration_tests_1 threads: 8 spark: type: spark method: http - schema: tiktok_ads_source_integration_tests + schema: tiktok_ads_source_integration_tests_1 host: "{{ env_var('CI_SPARK_DBT_HOST') }}" organization: "{{ env_var('CI_SPARK_DBT_ORGANIZATION') }}" token: "{{ env_var('CI_SPARK_DBT_TOKEN') }}" @@ -54,7 +54,7 @@ integration_tests: password: "{{ env_var('CI_POSTGRES_DBT_PASS') }}" port: 5432 dbname: "{{ env_var('CI_POSTGRES_DBT_DATABASE') }}" - schema: tiktok_ads_source_integration_tests + schema: tiktok_ads_source_integration_tests_1 threads: 8 keepalives_idle: 0 sslmode: prefer \ No newline at end of file diff --git a/integration_tests/dbt_project.yml b/integration_tests/dbt_project.yml index 75d2dfa..a819cc3 100644 --- a/integration_tests/dbt_project.yml +++ b/integration_tests/dbt_project.yml @@ -5,7 +5,7 @@ config-version: 2 vars: tiktok_ads_source: - tiktok_ads_schema: tiktok_ads_source_integration_tests + tiktok_ads_schema: tiktok_ads_source_integration_tests_1 tiktok_ads__ad_group_history_identifier: "tiktok_adgroup_history_data" tiktok_ads__ad_history_identifier: "tiktok_ad_history_data" tiktok_ads__advertiser_identifier: "tiktok_advertiser_data" From 7952c047f01859f7a98874d1942b43fc195043de Mon Sep 17 00:00:00 2001 From: fivetran-reneeli <renee.li@fivetran.com> Date: Thu, 21 Jul 2022 23:06:10 +0200 Subject: [PATCH 18/41] update fields --- models/stg_tiktok_ads.yml | 2 -- models/stg_tiktok_ads__ad_history.sql | 1 - 2 files changed, 3 deletions(-) diff --git a/models/stg_tiktok_ads.yml b/models/stg_tiktok_ads.yml index 5a319a9..37e4e1e 100644 --- a/models/stg_tiktok_ads.yml +++ b/models/stg_tiktok_ads.yml @@ -129,8 +129,6 @@ models: description: Campaign ID - name: ad_name description: Ad Name. - - name: ad_text - description: The ad text. - name: call_to_action description: Call to action values. - name: click_tracking_url diff --git a/models/stg_tiktok_ads__ad_history.sql b/models/stg_tiktok_ads__ad_history.sql index 7f484a0..d629674 100644 --- a/models/stg_tiktok_ads__ad_history.sql +++ b/models/stg_tiktok_ads__ad_history.sql @@ -28,7 +28,6 @@ final as ( advertiser_id, campaign_id, ad_name, - ad_text, call_to_action, click_tracking_url, impression_tracking_url, From eafe03240ce9fd5668c8d735debd30c8e2188d03 Mon Sep 17 00:00:00 2001 From: fivetran-reneeli <renee.li@fivetran.com> Date: Thu, 21 Jul 2022 23:17:11 +0200 Subject: [PATCH 19/41] clean timezone fields --- docs/catalog.json | 1 - docs/index.html | 102 ------------------ docs/manifest.json | 1 - docs/run_results.json | 1 - .../seeds/tiktok_ad_history_data.csv | 8 +- .../seeds/tiktok_ad_report_hourly_data.csv | 8 +- .../seeds/tiktok_adgroup_history_data.csv | 8 +- .../tiktok_adgroup_report_hourly_data.csv | 8 +- .../seeds/tiktok_advertiser_data.csv | 4 +- .../seeds/tiktok_campaign_history_data.csv | 8 +- .../tiktok_campaign_report_hourly_data.csv | 8 +- 11 files changed, 26 insertions(+), 131 deletions(-) delete mode 100644 docs/catalog.json delete mode 100644 docs/index.html delete mode 100644 docs/manifest.json delete mode 100644 docs/run_results.json diff --git a/docs/catalog.json b/docs/catalog.json deleted file mode 100644 index fec32d7..0000000 --- a/docs/catalog.json +++ /dev/null @@ -1 +0,0 @@ -{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/catalog/v1.json", "dbt_version": "1.0.0", "generated_at": "2022-01-06T18:49:32.398214Z", "invocation_id": "8ad2e9d0-66fc-47f9-abe0-fe38c6948257", "env": {}}, "nodes": {"model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp": {"metadata": {"type": "VIEW", "schema": "DBT_TIKTOK_ADS_STG_TIKTOK_ADS", "name": "STG_TIKTOK_ADS__ADVERTISER_TMP", "database": "FIVETRAN_DBT_TESTING", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ID": {"type": "NUMBER", "index": 1, "name": "ID", "comment": null}, "NAME": {"type": "TEXT", "index": 2, "name": "NAME", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 3, "name": "ADDRESS", "comment": null}, "COMPANY": {"type": "TEXT", "index": 4, "name": "COMPANY", "comment": null}, "CONTACTER": {"type": "TEXT", "index": 5, "name": "CONTACTER", "comment": null}, "COUNTRY": {"type": "TEXT", "index": 6, "name": "COUNTRY", "comment": null}, "CURRENCY": {"type": "TEXT", "index": 7, "name": "CURRENCY", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 8, "name": "DESCRIPTION", "comment": null}, "EMAIL": {"type": "TEXT", "index": 9, "name": "EMAIL", "comment": null}, "INDUSTRY": {"type": "TEXT", "index": 10, "name": "INDUSTRY", "comment": null}, "LICENSE_NO": {"type": "TEXT", "index": 11, "name": "LICENSE_NO", "comment": null}, "LICENSE_URL": {"type": "TEXT", "index": 12, "name": "LICENSE_URL", "comment": null}, "PROMOTION_AREA": {"type": "TEXT", "index": 13, "name": "PROMOTION_AREA", "comment": null}, "REASON": {"type": "TEXT", "index": 14, "name": "REASON", "comment": null}, "ROLE": {"type": "TEXT", "index": 15, "name": "ROLE", "comment": null}, "STATUS": {"type": "TEXT", "index": 16, "name": "STATUS", "comment": null}, "TELEPHONE": {"type": "TEXT", "index": 17, "name": "TELEPHONE", "comment": null}, "TIMEZONE": {"type": "TEXT", "index": 18, "name": "TIMEZONE", "comment": null}, "BALANCE": {"type": "FLOAT", "index": 19, "name": "BALANCE", "comment": null}, "CREATE_TIME": {"type": "TIMESTAMP_TZ", "index": 20, "name": "CREATE_TIME", "comment": null}, "LANGUAGE": {"type": "TEXT", "index": 21, "name": "LANGUAGE", "comment": null}, "PHONE_NUMBER": {"type": "TEXT", "index": 22, "name": "PHONE_NUMBER", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_TZ", "index": 23, "name": "_FIVETRAN_SYNCED", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp"}, "model.tiktok_ads_source.stg_tiktok_ads__advertiser": {"metadata": {"type": "BASE TABLE", "schema": "DBT_TIKTOK_ADS_STG_TIKTOK_ADS", "name": "STG_TIKTOK_ADS__ADVERTISER", "database": "FIVETRAN_DBT_TESTING", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ADVERTISER_ID": {"type": "NUMBER", "index": 1, "name": "ADVERTISER_ID", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 2, "name": "ADDRESS", "comment": null}, "BALANCE": {"type": "FLOAT", "index": 3, "name": "BALANCE", "comment": null}, "COMPANY": {"type": "TEXT", "index": 4, "name": "COMPANY", "comment": null}, "CONTACTER": {"type": "TEXT", "index": 5, "name": "CONTACTER", "comment": null}, "COUNTRY": {"type": "TEXT", "index": 6, "name": "COUNTRY", "comment": null}, "CURRENCY": {"type": "TEXT", "index": 7, "name": "CURRENCY", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 8, "name": "DESCRIPTION", "comment": null}, "EMAIL": {"type": "TEXT", "index": 9, "name": "EMAIL", "comment": null}, "INDUSTRY": {"type": "TEXT", "index": 10, "name": "INDUSTRY", "comment": null}, "LANGUAGE": {"type": "TEXT", "index": 11, "name": "LANGUAGE", "comment": null}, "NAME": {"type": "TEXT", "index": 12, "name": "NAME", "comment": null}, "PHONE_NUMBER": {"type": "TEXT", "index": 13, "name": "PHONE_NUMBER", "comment": null}, "TELEPHONE": {"type": "TEXT", "index": 14, "name": "TELEPHONE", "comment": null}, "TIMEZONE": {"type": "TEXT", "index": 15, "name": "TIMEZONE", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_TZ", "index": 16, "name": "_FIVETRAN_SYNCED", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 2.0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2022-01-06 18:37UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 5632.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser"}, "model.tiktok_ads.tiktok_ads__ad_adapter": {"metadata": {"type": "BASE TABLE", "schema": "DBT_TIKTOK_ADS_TIKTOK_ADS", "name": "TIKTOK_ADS__AD_ADAPTER", "database": "FIVETRAN_DBT_TESTING", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATE_DAY": {"type": "DATE", "index": 1, "name": "DATE_DAY", "comment": null}, "ADVERTISER_ID": {"type": "NUMBER", "index": 2, "name": "ADVERTISER_ID", "comment": null}, "ADVERTISER_NAME": {"type": "TEXT", "index": 3, "name": "ADVERTISER_NAME", "comment": null}, "CAMPAIGN_ID": {"type": "NUMBER", "index": 4, "name": "CAMPAIGN_ID", "comment": null}, "CAMPAIGN_NAME": {"type": "TEXT", "index": 5, "name": "CAMPAIGN_NAME", "comment": null}, "AD_GROUP_ID": {"type": "NUMBER", "index": 6, "name": "AD_GROUP_ID", "comment": null}, "AD_GROUP_NAME": {"type": "TEXT", "index": 7, "name": "AD_GROUP_NAME", "comment": null}, "AD_ID": {"type": "NUMBER", "index": 8, "name": "AD_ID", "comment": null}, "AD_NAME": {"type": "TEXT", "index": 9, "name": "AD_NAME", "comment": null}, "BASE_URL": {"type": "TEXT", "index": 10, "name": "BASE_URL", "comment": null}, "URL_HOST": {"type": "TEXT", "index": 11, "name": "URL_HOST", "comment": null}, "URL_PATH": {"type": "TEXT", "index": 12, "name": "URL_PATH", "comment": null}, "UTM_SOURCE": {"type": "TEXT", "index": 13, "name": "UTM_SOURCE", "comment": null}, "UTM_MEDIUM": {"type": "TEXT", "index": 14, "name": "UTM_MEDIUM", "comment": null}, "UTM_CAMPAIGN": {"type": "TEXT", "index": 15, "name": "UTM_CAMPAIGN", "comment": null}, "UTM_CONTENT": {"type": "TEXT", "index": 16, "name": "UTM_CONTENT", "comment": null}, "UTM_TERM": {"type": "TEXT", "index": 17, "name": "UTM_TERM", "comment": null}, "SPEND": {"type": "FLOAT", "index": 18, "name": "SPEND", "comment": null}, "CLICKS": {"type": "NUMBER", "index": 19, "name": "CLICKS", "comment": null}, "IMPRESSIONS": {"type": "NUMBER", "index": 20, "name": "IMPRESSIONS", "comment": null}, "REACH": {"type": "NUMBER", "index": 21, "name": "REACH", "comment": null}, "CONVERSION": {"type": "NUMBER", "index": 22, "name": "CONVERSION", "comment": null}, "LIKES": {"type": "NUMBER", "index": 23, "name": "LIKES", "comment": null}, "COMMENTS": {"type": "NUMBER", "index": 24, "name": "COMMENTS", "comment": null}, "SHARES": {"type": "NUMBER", "index": 25, "name": "SHARES", "comment": null}, "PROFILE_VISITS": {"type": "NUMBER", "index": 26, "name": "PROFILE_VISITS", "comment": null}, "FOLLOWS": {"type": "NUMBER", "index": 27, "name": "FOLLOWS", "comment": null}, "VIDEO_WATCHED_2_S": {"type": "NUMBER", "index": 28, "name": "VIDEO_WATCHED_2_S", "comment": null}, "VIDEO_WATCHED_6_S": {"type": "NUMBER", "index": 29, "name": "VIDEO_WATCHED_6_S", "comment": null}, "VIDEO_VIEWS_P_25": {"type": "NUMBER", "index": 30, "name": "VIDEO_VIEWS_P_25", "comment": null}, "VIDEO_VIEWS_P_50": {"type": "NUMBER", "index": 31, "name": "VIDEO_VIEWS_P_50", "comment": null}, "VIDEO_VIEWS_P_75": {"type": "NUMBER", "index": 32, "name": "VIDEO_VIEWS_P_75", "comment": null}, "DAILY_CPC": {"type": "FLOAT", "index": 33, "name": "DAILY_CPC", "comment": null}, "DAILY_CPM": {"type": "FLOAT", "index": 34, "name": "DAILY_CPM", "comment": null}, "DAILY_CTR": {"type": "NUMBER", "index": 35, "name": "DAILY_CTR", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 17439.0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2022-01-06 18:37UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1326592.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads.tiktok_ads__ad_adapter"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp": {"metadata": {"type": "VIEW", "schema": "DBT_TIKTOK_ADS_STG_TIKTOK_ADS", "name": "STG_TIKTOK_ADS__AD_GROUP_REPORT_HOURLY_TMP", "database": "FIVETRAN_DBT_TESTING", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ADGROUP_ID": {"type": "NUMBER", "index": 1, "name": "ADGROUP_ID", "comment": null}, "STAT_TIME_HOUR": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "STAT_TIME_HOUR", "comment": null}, "COST_PER_CONVERSION": {"type": "FLOAT", "index": 3, "name": "COST_PER_CONVERSION", "comment": null}, "REAL_TIME_CONVERSION": {"type": "NUMBER", "index": 4, "name": "REAL_TIME_CONVERSION", "comment": null}, "CPC": {"type": "FLOAT", "index": 5, "name": "CPC", "comment": null}, "VIDEO_PLAY_ACTIONS": {"type": "NUMBER", "index": 6, "name": "VIDEO_PLAY_ACTIONS", "comment": null}, "CONVERSION_RATE": {"type": "FLOAT", "index": 7, "name": "CONVERSION_RATE", "comment": null}, "VIDEO_VIEWS_P_75": {"type": "NUMBER", "index": 8, "name": "VIDEO_VIEWS_P_75", "comment": null}, "RESULT": {"type": "NUMBER", "index": 9, "name": "RESULT", "comment": null}, "VIDEO_VIEWS_P_50": {"type": "NUMBER", "index": 10, "name": "VIDEO_VIEWS_P_50", "comment": null}, "IMPRESSIONS": {"type": "NUMBER", "index": 11, "name": "IMPRESSIONS", "comment": null}, "COMMENTS": {"type": "NUMBER", "index": 12, "name": "COMMENTS", "comment": null}, "REAL_TIME_COST_PER_RESULT": {"type": "FLOAT", "index": 13, "name": "REAL_TIME_COST_PER_RESULT", "comment": null}, "CONVERSION": {"type": "NUMBER", "index": 14, "name": "CONVERSION", "comment": null}, "REAL_TIME_RESULT": {"type": "NUMBER", "index": 15, "name": "REAL_TIME_RESULT", "comment": null}, "VIDEO_VIEWS_P_100": {"type": "NUMBER", "index": 16, "name": "VIDEO_VIEWS_P_100", "comment": null}, "SHARES": {"type": "NUMBER", "index": 17, "name": "SHARES", "comment": null}, "REAL_TIME_CONVERSION_RATE": {"type": "FLOAT", "index": 18, "name": "REAL_TIME_CONVERSION_RATE", "comment": null}, "COST_PER_SECONDARY_GOAL_RESULT": {"type": "TEXT", "index": 19, "name": "COST_PER_SECONDARY_GOAL_RESULT", "comment": null}, "SECONDARY_GOAL_RESULT_RATE": {"type": "TEXT", "index": 20, "name": "SECONDARY_GOAL_RESULT_RATE", "comment": null}, "CLICKS": {"type": "NUMBER", "index": 21, "name": "CLICKS", "comment": null}, "COST_PER_1000_REACHED": {"type": "FLOAT", "index": 22, "name": "COST_PER_1000_REACHED", "comment": null}, "VIDEO_VIEWS_P_25": {"type": "NUMBER", "index": 23, "name": "VIDEO_VIEWS_P_25", "comment": null}, "REACH": {"type": "NUMBER", "index": 24, "name": "REACH", "comment": null}, "REAL_TIME_COST_PER_CONVERSION": {"type": "FLOAT", "index": 25, "name": "REAL_TIME_COST_PER_CONVERSION", "comment": null}, "PROFILE_VISITS_RATE": {"type": "FLOAT", "index": 26, "name": "PROFILE_VISITS_RATE", "comment": null}, "AVERAGE_VIDEO_PLAY": {"type": "FLOAT", "index": 27, "name": "AVERAGE_VIDEO_PLAY", "comment": null}, "PROFILE_VISITS": {"type": "NUMBER", "index": 28, "name": "PROFILE_VISITS", "comment": null}, "CPM": {"type": "FLOAT", "index": 29, "name": "CPM", "comment": null}, "CTR": {"type": "FLOAT", "index": 30, "name": "CTR", "comment": null}, "VIDEO_WATCHED_2_S": {"type": "NUMBER", "index": 31, "name": "VIDEO_WATCHED_2_S", "comment": null}, "FOLLOWS": {"type": "NUMBER", "index": 32, "name": "FOLLOWS", "comment": null}, "RESULT_RATE": {"type": "FLOAT", "index": 33, "name": "RESULT_RATE", "comment": null}, "VIDEO_WATCHED_6_S": {"type": "NUMBER", "index": 34, "name": "VIDEO_WATCHED_6_S", "comment": null}, "SECONDARY_GOAL_RESULT": {"type": "TEXT", "index": 35, "name": "SECONDARY_GOAL_RESULT", "comment": null}, "COST_PER_RESULT": {"type": "FLOAT", "index": 36, "name": "COST_PER_RESULT", "comment": null}, "AVERAGE_VIDEO_PLAY_PER_USER": {"type": "FLOAT", "index": 37, "name": "AVERAGE_VIDEO_PLAY_PER_USER", "comment": null}, "REAL_TIME_RESULT_RATE": {"type": "FLOAT", "index": 38, "name": "REAL_TIME_RESULT_RATE", "comment": null}, "SPEND": {"type": "FLOAT", "index": 39, "name": "SPEND", "comment": null}, "LIKES": {"type": "NUMBER", "index": 40, "name": "LIKES", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_TZ", "index": 41, "name": "_FIVETRAN_SYNCED", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly": {"metadata": {"type": "BASE TABLE", "schema": "DBT_TIKTOK_ADS_STG_TIKTOK_ADS", "name": "STG_TIKTOK_ADS__AD_GROUP_REPORT_HOURLY", "database": "FIVETRAN_DBT_TESTING", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"AD_GROUP_ID": {"type": "NUMBER", "index": 1, "name": "AD_GROUP_ID", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_TZ", "index": 2, "name": "_FIVETRAN_SYNCED", "comment": null}, "STAT_TIME_HOUR": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "STAT_TIME_HOUR", "comment": null}, "CPC": {"type": "FLOAT", "index": 4, "name": "CPC", "comment": null}, "CPM": {"type": "FLOAT", "index": 5, "name": "CPM", "comment": null}, "CTR": {"type": "FLOAT", "index": 6, "name": "CTR", "comment": null}, "IMPRESSIONS": {"type": "NUMBER", "index": 7, "name": "IMPRESSIONS", "comment": null}, "CLICKS": {"type": "NUMBER", "index": 8, "name": "CLICKS", "comment": null}, "SPEND": {"type": "FLOAT", "index": 9, "name": "SPEND", "comment": null}, "REACH": {"type": "NUMBER", "index": 10, "name": "REACH", "comment": null}, "CONVERSION": {"type": "NUMBER", "index": 11, "name": "CONVERSION", "comment": null}, "COST_PER_CONVERSION": {"type": "FLOAT", "index": 12, "name": "COST_PER_CONVERSION", "comment": null}, "CONVERSION_RATE": {"type": "FLOAT", "index": 13, "name": "CONVERSION_RATE", "comment": null}, "LIKES": {"type": "NUMBER", "index": 14, "name": "LIKES", "comment": null}, "COMMENTS": {"type": "NUMBER", "index": 15, "name": "COMMENTS", "comment": null}, "SHARES": {"type": "NUMBER", "index": 16, "name": "SHARES", "comment": null}, "PROFILE_VISITS": {"type": "NUMBER", "index": 17, "name": "PROFILE_VISITS", "comment": null}, "FOLLOWS": {"type": "NUMBER", "index": 18, "name": "FOLLOWS", "comment": null}, "VIDEO_PLAY_ACTIONS": {"type": "NUMBER", "index": 19, "name": "VIDEO_PLAY_ACTIONS", "comment": null}, "VIDEO_WATCHED_2_S": {"type": "NUMBER", "index": 20, "name": "VIDEO_WATCHED_2_S", "comment": null}, "VIDEO_WATCHED_6_S": {"type": "NUMBER", "index": 21, "name": "VIDEO_WATCHED_6_S", "comment": null}, "VIDEO_VIEWS_P_25": {"type": "NUMBER", "index": 22, "name": "VIDEO_VIEWS_P_25", "comment": null}, "VIDEO_VIEWS_P_50": {"type": "NUMBER", "index": 23, "name": "VIDEO_VIEWS_P_50", "comment": null}, "VIDEO_VIEWS_P_75": {"type": "NUMBER", "index": 24, "name": "VIDEO_VIEWS_P_75", "comment": null}, "AVERAGE_VIDEO_PLAY": {"type": "FLOAT", "index": 25, "name": "AVERAGE_VIDEO_PLAY", "comment": null}, "AVERAGE_VIDEO_PLAY_PER_USER": {"type": "FLOAT", "index": 26, "name": "AVERAGE_VIDEO_PLAY_PER_USER", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 33949.0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2022-01-06 18:37UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1437184.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"}, "model.tiktok_ads.tiktok_ads__ad_group_report": {"metadata": {"type": "BASE TABLE", "schema": "DBT_TIKTOK_ADS_TIKTOK_ADS", "name": "TIKTOK_ADS__AD_GROUP_REPORT", "database": "FIVETRAN_DBT_TESTING", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATE_DAY": {"type": "DATE", "index": 1, "name": "DATE_DAY", "comment": null}, "AD_GROUP_ID": {"type": "NUMBER", "index": 2, "name": "AD_GROUP_ID", "comment": null}, "ADVERTISER_ID": {"type": "NUMBER", "index": 3, "name": "ADVERTISER_ID", "comment": null}, "CAMPAIGN_ID": {"type": "NUMBER", "index": 4, "name": "CAMPAIGN_ID", "comment": null}, "CAMPAIGN_NAME": {"type": "TEXT", "index": 5, "name": "CAMPAIGN_NAME", "comment": null}, "ACTION_CATEGORIES": {"type": "VARIANT", "index": 6, "name": "ACTION_CATEGORIES", "comment": null}, "GENDER": {"type": "TEXT", "index": 7, "name": "GENDER", "comment": null}, "AUDIENCE_TYPE": {"type": "TEXT", "index": 8, "name": "AUDIENCE_TYPE", "comment": null}, "BUDGET": {"type": "FLOAT", "index": 9, "name": "BUDGET", "comment": null}, "AGE": {"type": "VARIANT", "index": 10, "name": "AGE", "comment": null}, "LANGUAGES": {"type": "VARIANT", "index": 11, "name": "LANGUAGES", "comment": null}, "INTEREST_CATEGORY": {"type": "VARIANT", "index": 12, "name": "INTEREST_CATEGORY", "comment": null}, "IMPRESSIONS": {"type": "NUMBER", "index": 13, "name": "IMPRESSIONS", "comment": null}, "CLICKS": {"type": "NUMBER", "index": 14, "name": "CLICKS", "comment": null}, "SPEND": {"type": "FLOAT", "index": 15, "name": "SPEND", "comment": null}, "REACH": {"type": "NUMBER", "index": 16, "name": "REACH", "comment": null}, "CONVERSION": {"type": "NUMBER", "index": 17, "name": "CONVERSION", "comment": null}, "LIKES": {"type": "NUMBER", "index": 18, "name": "LIKES", "comment": null}, "COMMENTS": {"type": "NUMBER", "index": 19, "name": "COMMENTS", "comment": null}, "SHARES": {"type": "NUMBER", "index": 20, "name": "SHARES", "comment": null}, "PROFILE_VISITS": {"type": "NUMBER", "index": 21, "name": "PROFILE_VISITS", "comment": null}, "FOLLOWS": {"type": "NUMBER", "index": 22, "name": "FOLLOWS", "comment": null}, "VIDEO_WATCHED_2_S": {"type": "NUMBER", "index": 23, "name": "VIDEO_WATCHED_2_S", "comment": null}, "VIDEO_WATCHED_6_S": {"type": "NUMBER", "index": 24, "name": "VIDEO_WATCHED_6_S", "comment": null}, "VIDEO_VIEWS_P_25": {"type": "NUMBER", "index": 25, "name": "VIDEO_VIEWS_P_25", "comment": null}, "VIDEO_VIEWS_P_50": {"type": "NUMBER", "index": 26, "name": "VIDEO_VIEWS_P_50", "comment": null}, "VIDEO_VIEWS_P_75": {"type": "NUMBER", "index": 27, "name": "VIDEO_VIEWS_P_75", "comment": null}, "DAILY_CPC": {"type": "FLOAT", "index": 28, "name": "DAILY_CPC", "comment": null}, "DAILY_CPM": {"type": "FLOAT", "index": 29, "name": "DAILY_CPM", "comment": null}, "DAILY_CTR": {"type": "NUMBER", "index": 30, "name": "DAILY_CTR", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 1234.0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2022-01-06 18:37UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 192512.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads.tiktok_ads__ad_group_report"}, "model.tiktok_ads.tiktok_ads__campaign_report": {"metadata": {"type": "BASE TABLE", "schema": "DBT_TIKTOK_ADS_TIKTOK_ADS", "name": "TIKTOK_ADS__CAMPAIGN_REPORT", "database": "FIVETRAN_DBT_TESTING", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"DATE_DAY": {"type": "DATE", "index": 1, "name": "DATE_DAY", "comment": null}, "CAMPAIGN_ID": {"type": "NUMBER", "index": 2, "name": "CAMPAIGN_ID", "comment": null}, "CAMPAIGN_NAME": {"type": "TEXT", "index": 3, "name": "CAMPAIGN_NAME", "comment": null}, "ADVERTISER_ID": {"type": "NUMBER", "index": 4, "name": "ADVERTISER_ID", "comment": null}, "IMPRESSIONS": {"type": "NUMBER", "index": 5, "name": "IMPRESSIONS", "comment": null}, "CLICKS": {"type": "NUMBER", "index": 6, "name": "CLICKS", "comment": null}, "SPEND": {"type": "FLOAT", "index": 7, "name": "SPEND", "comment": null}, "REACH": {"type": "NUMBER", "index": 8, "name": "REACH", "comment": null}, "CONVERSION": {"type": "NUMBER", "index": 9, "name": "CONVERSION", "comment": null}, "LIKES": {"type": "NUMBER", "index": 10, "name": "LIKES", "comment": null}, "COMMENTS": {"type": "NUMBER", "index": 11, "name": "COMMENTS", "comment": null}, "SHARES": {"type": "NUMBER", "index": 12, "name": "SHARES", "comment": null}, "PROFILE_VISITS": {"type": "NUMBER", "index": 13, "name": "PROFILE_VISITS", "comment": null}, "FOLLOWS": {"type": "NUMBER", "index": 14, "name": "FOLLOWS", "comment": null}, "VIDEO_WATCHED_2_S": {"type": "NUMBER", "index": 15, "name": "VIDEO_WATCHED_2_S", "comment": null}, "VIDEO_WATCHED_6_S": {"type": "NUMBER", "index": 16, "name": "VIDEO_WATCHED_6_S", "comment": null}, "VIDEO_VIEWS_P_25": {"type": "NUMBER", "index": 17, "name": "VIDEO_VIEWS_P_25", "comment": null}, "VIDEO_VIEWS_P_50": {"type": "NUMBER", "index": 18, "name": "VIDEO_VIEWS_P_50", "comment": null}, "VIDEO_VIEWS_P_75": {"type": "NUMBER", "index": 19, "name": "VIDEO_VIEWS_P_75", "comment": null}, "DAILY_CPC": {"type": "FLOAT", "index": 20, "name": "DAILY_CPC", "comment": null}, "DAILY_CPM": {"type": "FLOAT", "index": 21, "name": "DAILY_CPM", "comment": null}, "DAILY_CTR": {"type": "NUMBER", "index": 22, "name": "DAILY_CTR", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 639.0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2022-01-06 18:37UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 96256.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads.tiktok_ads__campaign_report"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp": {"metadata": {"type": "VIEW", "schema": "DBT_TIKTOK_ADS_STG_TIKTOK_ADS", "name": "STG_TIKTOK_ADS__AD_GROUP_HISTORY_TMP", "database": "FIVETRAN_DBT_TESTING", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"ADGROUP_ID": {"type": "NUMBER", "index": 1, "name": "ADGROUP_ID", "comment": null}, "UPDATED_AT": {"type": "TIMESTAMP_TZ", "index": 2, "name": "UPDATED_AT", "comment": null}, "ADVERTISER_ID": {"type": "NUMBER", "index": 3, "name": "ADVERTISER_ID", "comment": null}, "CAMPAIGN_ID": {"type": "NUMBER", "index": 4, "name": "CAMPAIGN_ID", "comment": null}, "CREATE_TIME": {"type": "TIMESTAMP_TZ", "index": 5, "name": "CREATE_TIME", "comment": null}, "ADGROUP_NAME": {"type": "TEXT", "index": 6, "name": "ADGROUP_NAME", "comment": null}, "PLACEMENT_TYPE": {"type": "TEXT", "index": 7, "name": "PLACEMENT_TYPE", "comment": null}, "PROFILE_IMAGE": {"type": "TEXT", "index": 8, "name": "PROFILE_IMAGE", "comment": null}, "LANDING_PAGE_URL": {"type": "TEXT", "index": 9, "name": "LANDING_PAGE_URL", "comment": null}, "DISPLAY_NAME": {"type": "TEXT", "index": 10, "name": "DISPLAY_NAME", "comment": null}, "APP_TYPE": {"type": "TEXT", "index": 11, "name": "APP_TYPE", "comment": null}, "APP_DOWNLOAD_URL": {"type": "TEXT", "index": 12, "name": "APP_DOWNLOAD_URL", "comment": null}, "APP_NAME": {"type": "TEXT", "index": 13, "name": "APP_NAME", "comment": null}, "EXTERNAL_ACTION": {"type": "TEXT", "index": 14, "name": "EXTERNAL_ACTION", "comment": null}, "DEEP_EXTERNAL_ACTION": {"type": "TEXT", "index": 15, "name": "DEEP_EXTERNAL_ACTION", "comment": null}, "CREATIVE_MATERIAL_MODE": {"type": "TEXT", "index": 16, "name": "CREATIVE_MATERIAL_MODE", "comment": null}, "AUDIENCE_TYPE": {"type": "TEXT", "index": 17, "name": "AUDIENCE_TYPE", "comment": null}, "GENDER": {"type": "TEXT", "index": 18, "name": "GENDER", "comment": null}, "ANDROID_OSV": {"type": "TEXT", "index": 19, "name": "ANDROID_OSV", "comment": null}, "IOS_OSV": {"type": "TEXT", "index": 20, "name": "IOS_OSV", "comment": null}, "BUDGET_MODE": {"type": "TEXT", "index": 21, "name": "BUDGET_MODE", "comment": null}, "SCHEDULE_TYPE": {"type": "TEXT", "index": 22, "name": "SCHEDULE_TYPE", "comment": null}, "DAYPARTING": {"type": "TEXT", "index": 23, "name": "DAYPARTING", "comment": null}, "OPTIMIZE_GOAL": {"type": "TEXT", "index": 24, "name": "OPTIMIZE_GOAL", "comment": null}, "CPV_VIDEO_DURATION": {"type": "TEXT", "index": 25, "name": "CPV_VIDEO_DURATION", "comment": null}, "PACING": {"type": "TEXT", "index": 26, "name": "PACING", "comment": null}, "BILLING_EVENT": {"type": "TEXT", "index": 27, "name": "BILLING_EVENT", "comment": null}, "BID_TYPE": {"type": "TEXT", "index": 28, "name": "BID_TYPE", "comment": null}, "DEEP_BID_TYPE": {"type": "TEXT", "index": 29, "name": "DEEP_BID_TYPE", "comment": null}, "IMPRESSION_TRACKING_URL": {"type": "TEXT", "index": 30, "name": "IMPRESSION_TRACKING_URL", "comment": null}, "CLICK_TRACKING_URL": {"type": "TEXT", "index": 31, "name": "CLICK_TRACKING_URL", "comment": null}, "STATUS": {"type": "TEXT", "index": 32, "name": "STATUS", "comment": null}, "OPT_STATUS": {"type": "TEXT", "index": 33, "name": "OPT_STATUS", "comment": null}, "STATISTIC_TYPE": {"type": "TEXT", "index": 34, "name": "STATISTIC_TYPE", "comment": null}, "VIDEO_DOWNLOAD": {"type": "TEXT", "index": 35, "name": "VIDEO_DOWNLOAD", "comment": null}, "OPEN_URL": {"type": "TEXT", "index": 36, "name": "OPEN_URL", "comment": null}, "OPEN_URL_TYPE": {"type": "TEXT", "index": 37, "name": "OPEN_URL_TYPE", "comment": null}, "FALLBACK_TYPE": {"type": "TEXT", "index": 38, "name": "FALLBACK_TYPE", "comment": null}, "BUDGET": {"type": "FLOAT", "index": 39, "name": "BUDGET", "comment": null}, "BID": {"type": "FLOAT", "index": 40, "name": "BID", "comment": null}, "CONVERSION_BID": {"type": "FLOAT", "index": 41, "name": "CONVERSION_BID", "comment": null}, "DEEP_CPABID": {"type": "FLOAT", "index": 42, "name": "DEEP_CPABID", "comment": null}, "SCHEDULE_START_TIME": {"type": "TIMESTAMP_TZ", "index": 43, "name": "SCHEDULE_START_TIME", "comment": null}, "SCHEDULE_END_TIME": {"type": "TIMESTAMP_TZ", "index": 44, "name": "SCHEDULE_END_TIME", "comment": null}, "APP_ID": {"type": "NUMBER", "index": 45, "name": "APP_ID", "comment": null}, "PIXEL_ID": {"type": "NUMBER", "index": 46, "name": "PIXEL_ID", "comment": null}, "ENABLE_INVENTORY_FILTER": {"type": "BOOLEAN", "index": 47, "name": "ENABLE_INVENTORY_FILTER", "comment": null}, "IS_HFSS": {"type": "BOOLEAN", "index": 48, "name": "IS_HFSS", "comment": null}, "IS_NEW_STRUCTURE": {"type": "BOOLEAN", "index": 49, "name": "IS_NEW_STRUCTURE", "comment": null}, "CATEGORY": {"type": "NUMBER", "index": 50, "name": "CATEGORY", "comment": null}, "IS_COMMENT_DISABLE": {"type": "NUMBER", "index": 51, "name": "IS_COMMENT_DISABLE", "comment": null}, "SKIP_LEARNING_PHASE": {"type": "NUMBER", "index": 52, "name": "SKIP_LEARNING_PHASE", "comment": null}, "FREQUENCY": {"type": "NUMBER", "index": 53, "name": "FREQUENCY", "comment": null}, "FREQUENCY_SCHEDULE": {"type": "NUMBER", "index": 54, "name": "FREQUENCY_SCHEDULE", "comment": null}, "ACTION_DAYS": {"type": "NUMBER", "index": 55, "name": "ACTION_DAYS", "comment": null}, "AUDIENCE": {"type": "VARIANT", "index": 56, "name": "AUDIENCE", "comment": null}, "EXCLUDED_AUDIENCE": {"type": "VARIANT", "index": 57, "name": "EXCLUDED_AUDIENCE", "comment": null}, "LOCATION": {"type": "VARIANT", "index": 58, "name": "LOCATION", "comment": null}, "INTEREST_CATEGORY_V_2": {"type": "VARIANT", "index": 59, "name": "INTEREST_CATEGORY_V_2", "comment": null}, "PANGLE_BLOCK_APP_LIST_ID": {"type": "VARIANT", "index": 60, "name": "PANGLE_BLOCK_APP_LIST_ID", "comment": null}, "ACTION_CATEGORIES": {"type": "VARIANT", "index": 61, "name": "ACTION_CATEGORIES", "comment": null}, "PLACEMENT": {"type": "VARIANT", "index": 62, "name": "PLACEMENT", "comment": null}, "KEYWORDS": {"type": "VARIANT", "index": 63, "name": "KEYWORDS", "comment": null}, "AGE": {"type": "VARIANT", "index": 64, "name": "AGE", "comment": null}, "LANGUAGES": {"type": "VARIANT", "index": 65, "name": "LANGUAGES", "comment": null}, "OPERATION_SYSTEM": {"type": "VARIANT", "index": 66, "name": "OPERATION_SYSTEM", "comment": null}, "CONNECTION_TYPE": {"type": "VARIANT", "index": 67, "name": "CONNECTION_TYPE", "comment": null}, "CARRIERS": {"type": "VARIANT", "index": 68, "name": "CARRIERS", "comment": null}, "VIDEO_ACTIONS": {"type": "VARIANT", "index": 69, "name": "VIDEO_ACTIONS", "comment": null}, "PACKAGE": {"type": "TEXT", "index": 70, "name": "PACKAGE", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_TZ", "index": 71, "name": "_FIVETRAN_SYNCED", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history": {"metadata": {"type": "BASE TABLE", "schema": "DBT_TIKTOK_ADS_STG_TIKTOK_ADS", "name": "STG_TIKTOK_ADS__AD_GROUP_HISTORY", "database": "FIVETRAN_DBT_TESTING", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"AD_GROUP_ID": {"type": "NUMBER", "index": 1, "name": "AD_GROUP_ID", "comment": null}, "UPDATED_AT": {"type": "TIMESTAMP_TZ", "index": 2, "name": "UPDATED_AT", "comment": null}, "ADVERTISER_ID": {"type": "NUMBER", "index": 3, "name": "ADVERTISER_ID", "comment": null}, "CAMPAIGN_ID": {"type": "NUMBER", "index": 4, "name": "CAMPAIGN_ID", "comment": null}, "ACTION_DAYS": {"type": "NUMBER", "index": 5, "name": "ACTION_DAYS", "comment": null}, "ACTION_CATEGORIES": {"type": "VARIANT", "index": 6, "name": "ACTION_CATEGORIES", "comment": null}, "AD_GROUP_NAME": {"type": "TEXT", "index": 7, "name": "AD_GROUP_NAME", "comment": null}, "AGE": {"type": "VARIANT", "index": 8, "name": "AGE", "comment": null}, "AUDIENCE_TYPE": {"type": "TEXT", "index": 9, "name": "AUDIENCE_TYPE", "comment": null}, "BUDGET": {"type": "FLOAT", "index": 10, "name": "BUDGET", "comment": null}, "CATEGORY": {"type": "NUMBER", "index": 11, "name": "CATEGORY", "comment": null}, "DISPLAY_NAME": {"type": "TEXT", "index": 12, "name": "DISPLAY_NAME", "comment": null}, "INTEREST_CATEGORY": {"type": "VARIANT", "index": 13, "name": "INTEREST_CATEGORY", "comment": null}, "FREQUENCY": {"type": "NUMBER", "index": 14, "name": "FREQUENCY", "comment": null}, "FREQUENCY_SCHEDULE": {"type": "NUMBER", "index": 15, "name": "FREQUENCY_SCHEDULE", "comment": null}, "GENDER": {"type": "TEXT", "index": 16, "name": "GENDER", "comment": null}, "LANGUAGES": {"type": "VARIANT", "index": 17, "name": "LANGUAGES", "comment": null}, "LANDING_PAGE_URL": {"type": "TEXT", "index": 18, "name": "LANDING_PAGE_URL", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_TZ", "index": 19, "name": "_FIVETRAN_SYNCED", "comment": null}, "IS_MOST_RECENT_RECORD": {"type": "BOOLEAN", "index": 20, "name": "IS_MOST_RECENT_RECORD", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 2265.0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2022-01-06 18:37UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 67072.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp": {"metadata": {"type": "VIEW", "schema": "DBT_TIKTOK_ADS_STG_TIKTOK_ADS", "name": "STG_TIKTOK_ADS__AD_HISTORY_TMP", "database": "FIVETRAN_DBT_TESTING", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"AD_ID": {"type": "NUMBER", "index": 1, "name": "AD_ID", "comment": null}, "UPDATED_AT": {"type": "TIMESTAMP_TZ", "index": 2, "name": "UPDATED_AT", "comment": null}, "ADVERTISER_ID": {"type": "NUMBER", "index": 3, "name": "ADVERTISER_ID", "comment": null}, "ADGROUP_ID": {"type": "NUMBER", "index": 4, "name": "ADGROUP_ID", "comment": null}, "CAMPAIGN_ID": {"type": "NUMBER", "index": 5, "name": "CAMPAIGN_ID", "comment": null}, "CREATE_TIME": {"type": "TIMESTAMP_TZ", "index": 6, "name": "CREATE_TIME", "comment": null}, "AD_NAME": {"type": "TEXT", "index": 7, "name": "AD_NAME", "comment": null}, "CALL_TO_ACTION": {"type": "TEXT", "index": 8, "name": "CALL_TO_ACTION", "comment": null}, "STATUS": {"type": "TEXT", "index": 9, "name": "STATUS", "comment": null}, "OPT_STATUS": {"type": "TEXT", "index": 10, "name": "OPT_STATUS", "comment": null}, "AD_TEXT": {"type": "TEXT", "index": 11, "name": "AD_TEXT", "comment": null}, "VIDEO_ID": {"type": "TEXT", "index": 12, "name": "VIDEO_ID", "comment": null}, "APP_NAME": {"type": "TEXT", "index": 13, "name": "APP_NAME", "comment": null}, "OPEN_URL": {"type": "TEXT", "index": 14, "name": "OPEN_URL", "comment": null}, "LANDING_PAGE_URL": {"type": "TEXT", "index": 15, "name": "LANDING_PAGE_URL", "comment": null}, "DISPLAY_NAME": {"type": "TEXT", "index": 16, "name": "DISPLAY_NAME", "comment": null}, "PROFILE_IMAGE": {"type": "TEXT", "index": 17, "name": "PROFILE_IMAGE", "comment": null}, "IMPRESSION_TRACKING_URL": {"type": "TEXT", "index": 18, "name": "IMPRESSION_TRACKING_URL", "comment": null}, "CLICK_TRACKING_URL": {"type": "TEXT", "index": 19, "name": "CLICK_TRACKING_URL", "comment": null}, "PLAYABLE_URL": {"type": "TEXT", "index": 20, "name": "PLAYABLE_URL", "comment": null}, "IS_ACO": {"type": "BOOLEAN", "index": 21, "name": "IS_ACO", "comment": null}, "IS_CREATIVE_AUTHORIZED": {"type": "BOOLEAN", "index": 22, "name": "IS_CREATIVE_AUTHORIZED", "comment": null}, "IS_NEW_STRUCTURE": {"type": "BOOLEAN", "index": 23, "name": "IS_NEW_STRUCTURE", "comment": null}, "IMAGE_IDS": {"type": "VARIANT", "index": 24, "name": "IMAGE_IDS", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_TZ", "index": 25, "name": "_FIVETRAN_SYNCED", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_history": {"metadata": {"type": "BASE TABLE", "schema": "DBT_TIKTOK_ADS_STG_TIKTOK_ADS", "name": "STG_TIKTOK_ADS__AD_HISTORY", "database": "FIVETRAN_DBT_TESTING", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"AD_ID": {"type": "NUMBER", "index": 1, "name": "AD_ID", "comment": null}, "UPDATED_AT": {"type": "TIMESTAMP_TZ", "index": 2, "name": "UPDATED_AT", "comment": null}, "AD_GROUP_ID": {"type": "NUMBER", "index": 3, "name": "AD_GROUP_ID", "comment": null}, "ADVERTISER_ID": {"type": "NUMBER", "index": 4, "name": "ADVERTISER_ID", "comment": null}, "CAMPAIGN_ID": {"type": "NUMBER", "index": 5, "name": "CAMPAIGN_ID", "comment": null}, "AD_NAME": {"type": "TEXT", "index": 6, "name": "AD_NAME", "comment": null}, "AD_TEXT": {"type": "TEXT", "index": 7, "name": "AD_TEXT", "comment": null}, "CALL_TO_ACTION": {"type": "TEXT", "index": 8, "name": "CALL_TO_ACTION", "comment": null}, "CLICK_TRACKING_URL": {"type": "TEXT", "index": 9, "name": "CLICK_TRACKING_URL", "comment": null}, "IMPRESSION_TRACKING_URL": {"type": "TEXT", "index": 10, "name": "IMPRESSION_TRACKING_URL", "comment": null}, "BASE_URL": {"type": "TEXT", "index": 11, "name": "BASE_URL", "comment": null}, "URL_HOST": {"type": "TEXT", "index": 12, "name": "URL_HOST", "comment": null}, "URL_PATH": {"type": "TEXT", "index": 13, "name": "URL_PATH", "comment": null}, "UTM_SOURCE": {"type": "TEXT", "index": 14, "name": "UTM_SOURCE", "comment": null}, "UTM_MEDIUM": {"type": "TEXT", "index": 15, "name": "UTM_MEDIUM", "comment": null}, "UTM_CAMPAIGN": {"type": "TEXT", "index": 16, "name": "UTM_CAMPAIGN", "comment": null}, "UTM_CONTENT": {"type": "TEXT", "index": 17, "name": "UTM_CONTENT", "comment": null}, "UTM_TERM": {"type": "TEXT", "index": 18, "name": "UTM_TERM", "comment": null}, "LANDING_PAGE_URL": {"type": "TEXT", "index": 19, "name": "LANDING_PAGE_URL", "comment": null}, "VIDEO_ID": {"type": "TEXT", "index": 20, "name": "VIDEO_ID", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_TZ", "index": 21, "name": "_FIVETRAN_SYNCED", "comment": null}, "IS_MOST_RECENT_RECORD": {"type": "BOOLEAN", "index": 22, "name": "IS_MOST_RECENT_RECORD", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 24809.0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2022-01-06 18:37UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 923648.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history"}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp": {"metadata": {"type": "VIEW", "schema": "DBT_TIKTOK_ADS_STG_TIKTOK_ADS", "name": "STG_TIKTOK_ADS__CAMPAIGN_REPORT_HOURLY_TMP", "database": "FIVETRAN_DBT_TESTING", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CAMPAIGN_ID": {"type": "NUMBER", "index": 1, "name": "CAMPAIGN_ID", "comment": null}, "STAT_TIME_HOUR": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "STAT_TIME_HOUR", "comment": null}, "COST_PER_CONVERSION": {"type": "FLOAT", "index": 3, "name": "COST_PER_CONVERSION", "comment": null}, "REAL_TIME_CONVERSION": {"type": "NUMBER", "index": 4, "name": "REAL_TIME_CONVERSION", "comment": null}, "CPC": {"type": "FLOAT", "index": 5, "name": "CPC", "comment": null}, "VIDEO_PLAY_ACTIONS": {"type": "NUMBER", "index": 6, "name": "VIDEO_PLAY_ACTIONS", "comment": null}, "CONVERSION_RATE": {"type": "FLOAT", "index": 7, "name": "CONVERSION_RATE", "comment": null}, "VIDEO_VIEWS_P_75": {"type": "NUMBER", "index": 8, "name": "VIDEO_VIEWS_P_75", "comment": null}, "RESULT": {"type": "NUMBER", "index": 9, "name": "RESULT", "comment": null}, "VIDEO_VIEWS_P_50": {"type": "NUMBER", "index": 10, "name": "VIDEO_VIEWS_P_50", "comment": null}, "IMPRESSIONS": {"type": "NUMBER", "index": 11, "name": "IMPRESSIONS", "comment": null}, "COMMENTS": {"type": "NUMBER", "index": 12, "name": "COMMENTS", "comment": null}, "REAL_TIME_COST_PER_RESULT": {"type": "FLOAT", "index": 13, "name": "REAL_TIME_COST_PER_RESULT", "comment": null}, "CONVERSION": {"type": "NUMBER", "index": 14, "name": "CONVERSION", "comment": null}, "REAL_TIME_RESULT": {"type": "NUMBER", "index": 15, "name": "REAL_TIME_RESULT", "comment": null}, "VIDEO_VIEWS_P_100": {"type": "NUMBER", "index": 16, "name": "VIDEO_VIEWS_P_100", "comment": null}, "SHARES": {"type": "NUMBER", "index": 17, "name": "SHARES", "comment": null}, "REAL_TIME_CONVERSION_RATE": {"type": "FLOAT", "index": 18, "name": "REAL_TIME_CONVERSION_RATE", "comment": null}, "COST_PER_SECONDARY_GOAL_RESULT": {"type": "TEXT", "index": 19, "name": "COST_PER_SECONDARY_GOAL_RESULT", "comment": null}, "SECONDARY_GOAL_RESULT_RATE": {"type": "TEXT", "index": 20, "name": "SECONDARY_GOAL_RESULT_RATE", "comment": null}, "CLICKS": {"type": "NUMBER", "index": 21, "name": "CLICKS", "comment": null}, "COST_PER_1000_REACHED": {"type": "FLOAT", "index": 22, "name": "COST_PER_1000_REACHED", "comment": null}, "VIDEO_VIEWS_P_25": {"type": "NUMBER", "index": 23, "name": "VIDEO_VIEWS_P_25", "comment": null}, "REACH": {"type": "NUMBER", "index": 24, "name": "REACH", "comment": null}, "REAL_TIME_COST_PER_CONVERSION": {"type": "FLOAT", "index": 25, "name": "REAL_TIME_COST_PER_CONVERSION", "comment": null}, "PROFILE_VISITS_RATE": {"type": "FLOAT", "index": 26, "name": "PROFILE_VISITS_RATE", "comment": null}, "AVERAGE_VIDEO_PLAY": {"type": "FLOAT", "index": 27, "name": "AVERAGE_VIDEO_PLAY", "comment": null}, "PROFILE_VISITS": {"type": "NUMBER", "index": 28, "name": "PROFILE_VISITS", "comment": null}, "CPM": {"type": "FLOAT", "index": 29, "name": "CPM", "comment": null}, "CTR": {"type": "FLOAT", "index": 30, "name": "CTR", "comment": null}, "VIDEO_WATCHED_2_S": {"type": "NUMBER", "index": 31, "name": "VIDEO_WATCHED_2_S", "comment": null}, "FOLLOWS": {"type": "NUMBER", "index": 32, "name": "FOLLOWS", "comment": null}, "RESULT_RATE": {"type": "FLOAT", "index": 33, "name": "RESULT_RATE", "comment": null}, "VIDEO_WATCHED_6_S": {"type": "NUMBER", "index": 34, "name": "VIDEO_WATCHED_6_S", "comment": null}, "SECONDARY_GOAL_RESULT": {"type": "TEXT", "index": 35, "name": "SECONDARY_GOAL_RESULT", "comment": null}, "COST_PER_RESULT": {"type": "FLOAT", "index": 36, "name": "COST_PER_RESULT", "comment": null}, "AVERAGE_VIDEO_PLAY_PER_USER": {"type": "FLOAT", "index": 37, "name": "AVERAGE_VIDEO_PLAY_PER_USER", "comment": null}, "REAL_TIME_RESULT_RATE": {"type": "FLOAT", "index": 38, "name": "REAL_TIME_RESULT_RATE", "comment": null}, "SPEND": {"type": "FLOAT", "index": 39, "name": "SPEND", "comment": null}, "LIKES": {"type": "NUMBER", "index": 40, "name": "LIKES", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_TZ", "index": 41, "name": "_FIVETRAN_SYNCED", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp"}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly": {"metadata": {"type": "BASE TABLE", "schema": "DBT_TIKTOK_ADS_STG_TIKTOK_ADS", "name": "STG_TIKTOK_ADS__CAMPAIGN_REPORT_HOURLY", "database": "FIVETRAN_DBT_TESTING", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CAMPAIGN_ID": {"type": "NUMBER", "index": 1, "name": "CAMPAIGN_ID", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_TZ", "index": 2, "name": "_FIVETRAN_SYNCED", "comment": null}, "STAT_TIME_HOUR": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "STAT_TIME_HOUR", "comment": null}, "CPC": {"type": "FLOAT", "index": 4, "name": "CPC", "comment": null}, "CPM": {"type": "FLOAT", "index": 5, "name": "CPM", "comment": null}, "CTR": {"type": "FLOAT", "index": 6, "name": "CTR", "comment": null}, "IMPRESSIONS": {"type": "NUMBER", "index": 7, "name": "IMPRESSIONS", "comment": null}, "CLICKS": {"type": "NUMBER", "index": 8, "name": "CLICKS", "comment": null}, "SPEND": {"type": "FLOAT", "index": 9, "name": "SPEND", "comment": null}, "REACH": {"type": "NUMBER", "index": 10, "name": "REACH", "comment": null}, "CONVERSION": {"type": "NUMBER", "index": 11, "name": "CONVERSION", "comment": null}, "COST_PER_CONVERSION": {"type": "FLOAT", "index": 12, "name": "COST_PER_CONVERSION", "comment": null}, "CONVERSION_RATE": {"type": "FLOAT", "index": 13, "name": "CONVERSION_RATE", "comment": null}, "LIKES": {"type": "NUMBER", "index": 14, "name": "LIKES", "comment": null}, "COMMENTS": {"type": "NUMBER", "index": 15, "name": "COMMENTS", "comment": null}, "SHARES": {"type": "NUMBER", "index": 16, "name": "SHARES", "comment": null}, "PROFILE_VISITS": {"type": "NUMBER", "index": 17, "name": "PROFILE_VISITS", "comment": null}, "FOLLOWS": {"type": "NUMBER", "index": 18, "name": "FOLLOWS", "comment": null}, "VIDEO_PLAY_ACTIONS": {"type": "NUMBER", "index": 19, "name": "VIDEO_PLAY_ACTIONS", "comment": null}, "VIDEO_WATCHED_2_S": {"type": "NUMBER", "index": 20, "name": "VIDEO_WATCHED_2_S", "comment": null}, "VIDEO_WATCHED_6_S": {"type": "NUMBER", "index": 21, "name": "VIDEO_WATCHED_6_S", "comment": null}, "VIDEO_VIEWS_P_25": {"type": "NUMBER", "index": 22, "name": "VIDEO_VIEWS_P_25", "comment": null}, "VIDEO_VIEWS_P_50": {"type": "NUMBER", "index": 23, "name": "VIDEO_VIEWS_P_50", "comment": null}, "VIDEO_VIEWS_P_75": {"type": "NUMBER", "index": 24, "name": "VIDEO_VIEWS_P_75", "comment": null}, "AVERAGE_VIDEO_PLAY": {"type": "FLOAT", "index": 25, "name": "AVERAGE_VIDEO_PLAY", "comment": null}, "AVERAGE_VIDEO_PLAY_PER_USER": {"type": "FLOAT", "index": 26, "name": "AVERAGE_VIDEO_PLAY_PER_USER", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 14302.0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2022-01-06 18:37UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 735744.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly": {"metadata": {"type": "BASE TABLE", "schema": "DBT_TIKTOK_ADS_STG_TIKTOK_ADS", "name": "STG_TIKTOK_ADS__AD_REPORT_HOURLY", "database": "FIVETRAN_DBT_TESTING", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"AD_ID": {"type": "NUMBER", "index": 1, "name": "AD_ID", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_TZ", "index": 2, "name": "_FIVETRAN_SYNCED", "comment": null}, "STAT_TIME_HOUR": {"type": "TIMESTAMP_NTZ", "index": 3, "name": "STAT_TIME_HOUR", "comment": null}, "CPC": {"type": "FLOAT", "index": 4, "name": "CPC", "comment": null}, "CPM": {"type": "FLOAT", "index": 5, "name": "CPM", "comment": null}, "CTR": {"type": "FLOAT", "index": 6, "name": "CTR", "comment": null}, "IMPRESSIONS": {"type": "NUMBER", "index": 7, "name": "IMPRESSIONS", "comment": null}, "CLICKS": {"type": "NUMBER", "index": 8, "name": "CLICKS", "comment": null}, "SPEND": {"type": "FLOAT", "index": 9, "name": "SPEND", "comment": null}, "REACH": {"type": "NUMBER", "index": 10, "name": "REACH", "comment": null}, "CONVERSION": {"type": "NUMBER", "index": 11, "name": "CONVERSION", "comment": null}, "COST_PER_CONVERSION": {"type": "FLOAT", "index": 12, "name": "COST_PER_CONVERSION", "comment": null}, "CONVERSION_RATE": {"type": "FLOAT", "index": 13, "name": "CONVERSION_RATE", "comment": null}, "LIKES": {"type": "NUMBER", "index": 14, "name": "LIKES", "comment": null}, "COMMENTS": {"type": "NUMBER", "index": 15, "name": "COMMENTS", "comment": null}, "SHARES": {"type": "NUMBER", "index": 16, "name": "SHARES", "comment": null}, "PROFILE_VISITS": {"type": "NUMBER", "index": 17, "name": "PROFILE_VISITS", "comment": null}, "FOLLOWS": {"type": "NUMBER", "index": 18, "name": "FOLLOWS", "comment": null}, "VIDEO_PLAY_ACTIONS": {"type": "NUMBER", "index": 19, "name": "VIDEO_PLAY_ACTIONS", "comment": null}, "VIDEO_WATCHED_2_S": {"type": "NUMBER", "index": 20, "name": "VIDEO_WATCHED_2_S", "comment": null}, "VIDEO_WATCHED_6_S": {"type": "NUMBER", "index": 21, "name": "VIDEO_WATCHED_6_S", "comment": null}, "VIDEO_VIEWS_P_25": {"type": "NUMBER", "index": 22, "name": "VIDEO_VIEWS_P_25", "comment": null}, "VIDEO_VIEWS_P_50": {"type": "NUMBER", "index": 23, "name": "VIDEO_VIEWS_P_50", "comment": null}, "VIDEO_VIEWS_P_75": {"type": "NUMBER", "index": 24, "name": "VIDEO_VIEWS_P_75", "comment": null}, "AVERAGE_VIDEO_PLAY": {"type": "FLOAT", "index": 25, "name": "AVERAGE_VIDEO_PLAY", "comment": null}, "AVERAGE_VIDEO_PLAY_PER_USER": {"type": "FLOAT", "index": 26, "name": "AVERAGE_VIDEO_PLAY_PER_USER", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 326781.0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2022-01-06 18:37UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 11990016.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"}, "model.tiktok_ads.int_tiktok_ads__most_recent_ad": {"metadata": {"type": "BASE TABLE", "schema": "DBT_TIKTOK_ADS_TIKTOK_ADS", "name": "INT_TIKTOK_ADS__MOST_RECENT_AD", "database": "FIVETRAN_DBT_TESTING", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"AD_ID": {"type": "NUMBER", "index": 1, "name": "AD_ID", "comment": null}, "UPDATED_AT": {"type": "TIMESTAMP_TZ", "index": 2, "name": "UPDATED_AT", "comment": null}, "AD_GROUP_ID": {"type": "NUMBER", "index": 3, "name": "AD_GROUP_ID", "comment": null}, "ADVERTISER_ID": {"type": "NUMBER", "index": 4, "name": "ADVERTISER_ID", "comment": null}, "CAMPAIGN_ID": {"type": "NUMBER", "index": 5, "name": "CAMPAIGN_ID", "comment": null}, "AD_NAME": {"type": "TEXT", "index": 6, "name": "AD_NAME", "comment": null}, "AD_TEXT": {"type": "TEXT", "index": 7, "name": "AD_TEXT", "comment": null}, "CALL_TO_ACTION": {"type": "TEXT", "index": 8, "name": "CALL_TO_ACTION", "comment": null}, "CLICK_TRACKING_URL": {"type": "TEXT", "index": 9, "name": "CLICK_TRACKING_URL", "comment": null}, "IMPRESSION_TRACKING_URL": {"type": "TEXT", "index": 10, "name": "IMPRESSION_TRACKING_URL", "comment": null}, "BASE_URL": {"type": "TEXT", "index": 11, "name": "BASE_URL", "comment": null}, "URL_HOST": {"type": "TEXT", "index": 12, "name": "URL_HOST", "comment": null}, "URL_PATH": {"type": "TEXT", "index": 13, "name": "URL_PATH", "comment": null}, "UTM_SOURCE": {"type": "TEXT", "index": 14, "name": "UTM_SOURCE", "comment": null}, "UTM_MEDIUM": {"type": "TEXT", "index": 15, "name": "UTM_MEDIUM", "comment": null}, "UTM_CAMPAIGN": {"type": "TEXT", "index": 16, "name": "UTM_CAMPAIGN", "comment": null}, "UTM_CONTENT": {"type": "TEXT", "index": 17, "name": "UTM_CONTENT", "comment": null}, "UTM_TERM": {"type": "TEXT", "index": 18, "name": "UTM_TERM", "comment": null}, "LANDING_PAGE_URL": {"type": "TEXT", "index": 19, "name": "LANDING_PAGE_URL", "comment": null}, "VIDEO_ID": {"type": "TEXT", "index": 20, "name": "VIDEO_ID", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_TZ", "index": 21, "name": "_FIVETRAN_SYNCED", "comment": null}, "IS_MOST_RECENT_RECORD": {"type": "BOOLEAN", "index": 22, "name": "IS_MOST_RECENT_RECORD", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 3443.0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2021-12-13 23:08UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 191488.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad"}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_history": {"metadata": {"type": "BASE TABLE", "schema": "DBT_TIKTOK_ADS_STG_TIKTOK_ADS", "name": "STG_TIKTOK_ADS__CAMPAIGN_HISTORY", "database": "FIVETRAN_DBT_TESTING", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CAMPAIGN_ID": {"type": "NUMBER", "index": 1, "name": "CAMPAIGN_ID", "comment": null}, "UPDATED_AT": {"type": "TIMESTAMP_TZ", "index": 2, "name": "UPDATED_AT", "comment": null}, "ADVERTISER_ID": {"type": "NUMBER", "index": 3, "name": "ADVERTISER_ID", "comment": null}, "CAMPAIGN_NAME": {"type": "TEXT", "index": 4, "name": "CAMPAIGN_NAME", "comment": null}, "CAMPAIGN_TYPE": {"type": "TEXT", "index": 5, "name": "CAMPAIGN_TYPE", "comment": null}, "SPLIT_TEST_VARIABLE": {"type": "TEXT", "index": 6, "name": "SPLIT_TEST_VARIABLE", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_TZ", "index": 7, "name": "_FIVETRAN_SYNCED", "comment": null}, "IS_MOST_RECENT_RECORD": {"type": "BOOLEAN", "index": 8, "name": "IS_MOST_RECENT_RECORD", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 334.0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2022-01-06 18:37UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 9728.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history"}, "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group": {"metadata": {"type": "BASE TABLE", "schema": "DBT_TIKTOK_ADS_TIKTOK_ADS", "name": "INT_TIKTOK_ADS__MOST_RECENT_AD_GROUP", "database": "FIVETRAN_DBT_TESTING", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"AD_GROUP_ID": {"type": "NUMBER", "index": 1, "name": "AD_GROUP_ID", "comment": null}, "UPDATED_AT": {"type": "TIMESTAMP_TZ", "index": 2, "name": "UPDATED_AT", "comment": null}, "ADVERTISER_ID": {"type": "NUMBER", "index": 3, "name": "ADVERTISER_ID", "comment": null}, "CAMPAIGN_ID": {"type": "NUMBER", "index": 4, "name": "CAMPAIGN_ID", "comment": null}, "ACTION_DAYS": {"type": "NUMBER", "index": 5, "name": "ACTION_DAYS", "comment": null}, "AD_GROUP_NAME": {"type": "TEXT", "index": 6, "name": "AD_GROUP_NAME", "comment": null}, "AUDIENCE_TYPE": {"type": "TEXT", "index": 7, "name": "AUDIENCE_TYPE", "comment": null}, "CATEGORY": {"type": "NUMBER", "index": 8, "name": "CATEGORY", "comment": null}, "DISPLAY_NAME": {"type": "TEXT", "index": 9, "name": "DISPLAY_NAME", "comment": null}, "FREQUENCY": {"type": "NUMBER", "index": 10, "name": "FREQUENCY", "comment": null}, "FREQUENCY_SCHEDULE": {"type": "NUMBER", "index": 11, "name": "FREQUENCY_SCHEDULE", "comment": null}, "GENDER": {"type": "TEXT", "index": 12, "name": "GENDER", "comment": null}, "LANDING_PAGE_URL": {"type": "TEXT", "index": 13, "name": "LANDING_PAGE_URL", "comment": null}, "VIDEO_DOWNLOAD": {"type": "TEXT", "index": 14, "name": "VIDEO_DOWNLOAD", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_TZ", "index": 15, "name": "_FIVETRAN_SYNCED", "comment": null}, "IS_MOST_RECENT_RECORD": {"type": "BOOLEAN", "index": 16, "name": "IS_MOST_RECENT_RECORD", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 45.0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2021-12-13 23:08UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 6656.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp": {"metadata": {"type": "VIEW", "schema": "DBT_TIKTOK_ADS_STG_TIKTOK_ADS", "name": "STG_TIKTOK_ADS__AD_REPORT_HOURLY_TMP", "database": "FIVETRAN_DBT_TESTING", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"AD_ID": {"type": "NUMBER", "index": 1, "name": "AD_ID", "comment": null}, "STAT_TIME_HOUR": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "STAT_TIME_HOUR", "comment": null}, "COST_PER_CONVERSION": {"type": "FLOAT", "index": 3, "name": "COST_PER_CONVERSION", "comment": null}, "REAL_TIME_CONVERSION": {"type": "NUMBER", "index": 4, "name": "REAL_TIME_CONVERSION", "comment": null}, "CPC": {"type": "FLOAT", "index": 5, "name": "CPC", "comment": null}, "VIDEO_PLAY_ACTIONS": {"type": "NUMBER", "index": 6, "name": "VIDEO_PLAY_ACTIONS", "comment": null}, "CONVERSION_RATE": {"type": "FLOAT", "index": 7, "name": "CONVERSION_RATE", "comment": null}, "VIDEO_VIEWS_P_75": {"type": "NUMBER", "index": 8, "name": "VIDEO_VIEWS_P_75", "comment": null}, "RESULT": {"type": "NUMBER", "index": 9, "name": "RESULT", "comment": null}, "VIDEO_VIEWS_P_50": {"type": "NUMBER", "index": 10, "name": "VIDEO_VIEWS_P_50", "comment": null}, "IMPRESSIONS": {"type": "NUMBER", "index": 11, "name": "IMPRESSIONS", "comment": null}, "COMMENTS": {"type": "NUMBER", "index": 12, "name": "COMMENTS", "comment": null}, "REAL_TIME_COST_PER_RESULT": {"type": "FLOAT", "index": 13, "name": "REAL_TIME_COST_PER_RESULT", "comment": null}, "CONVERSION": {"type": "NUMBER", "index": 14, "name": "CONVERSION", "comment": null}, "REAL_TIME_RESULT": {"type": "NUMBER", "index": 15, "name": "REAL_TIME_RESULT", "comment": null}, "VIDEO_VIEWS_P_100": {"type": "NUMBER", "index": 16, "name": "VIDEO_VIEWS_P_100", "comment": null}, "SHARES": {"type": "NUMBER", "index": 17, "name": "SHARES", "comment": null}, "REAL_TIME_CONVERSION_RATE": {"type": "FLOAT", "index": 18, "name": "REAL_TIME_CONVERSION_RATE", "comment": null}, "COST_PER_SECONDARY_GOAL_RESULT": {"type": "TEXT", "index": 19, "name": "COST_PER_SECONDARY_GOAL_RESULT", "comment": null}, "SECONDARY_GOAL_RESULT_RATE": {"type": "TEXT", "index": 20, "name": "SECONDARY_GOAL_RESULT_RATE", "comment": null}, "CLICKS": {"type": "NUMBER", "index": 21, "name": "CLICKS", "comment": null}, "COST_PER_1000_REACHED": {"type": "FLOAT", "index": 22, "name": "COST_PER_1000_REACHED", "comment": null}, "VIDEO_VIEWS_P_25": {"type": "NUMBER", "index": 23, "name": "VIDEO_VIEWS_P_25", "comment": null}, "REACH": {"type": "NUMBER", "index": 24, "name": "REACH", "comment": null}, "REAL_TIME_COST_PER_CONVERSION": {"type": "FLOAT", "index": 25, "name": "REAL_TIME_COST_PER_CONVERSION", "comment": null}, "PROFILE_VISITS_RATE": {"type": "FLOAT", "index": 26, "name": "PROFILE_VISITS_RATE", "comment": null}, "AVERAGE_VIDEO_PLAY": {"type": "FLOAT", "index": 27, "name": "AVERAGE_VIDEO_PLAY", "comment": null}, "PROFILE_VISITS": {"type": "NUMBER", "index": 28, "name": "PROFILE_VISITS", "comment": null}, "CPM": {"type": "FLOAT", "index": 29, "name": "CPM", "comment": null}, "CTR": {"type": "FLOAT", "index": 30, "name": "CTR", "comment": null}, "VIDEO_WATCHED_2_S": {"type": "NUMBER", "index": 31, "name": "VIDEO_WATCHED_2_S", "comment": null}, "FOLLOWS": {"type": "NUMBER", "index": 32, "name": "FOLLOWS", "comment": null}, "RESULT_RATE": {"type": "FLOAT", "index": 33, "name": "RESULT_RATE", "comment": null}, "VIDEO_WATCHED_6_S": {"type": "NUMBER", "index": 34, "name": "VIDEO_WATCHED_6_S", "comment": null}, "SECONDARY_GOAL_RESULT": {"type": "TEXT", "index": 35, "name": "SECONDARY_GOAL_RESULT", "comment": null}, "COST_PER_RESULT": {"type": "FLOAT", "index": 36, "name": "COST_PER_RESULT", "comment": null}, "AVERAGE_VIDEO_PLAY_PER_USER": {"type": "FLOAT", "index": 37, "name": "AVERAGE_VIDEO_PLAY_PER_USER", "comment": null}, "REAL_TIME_RESULT_RATE": {"type": "FLOAT", "index": 38, "name": "REAL_TIME_RESULT_RATE", "comment": null}, "SPEND": {"type": "FLOAT", "index": 39, "name": "SPEND", "comment": null}, "LIKES": {"type": "NUMBER", "index": 40, "name": "LIKES", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_TZ", "index": 41, "name": "_FIVETRAN_SYNCED", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp"}, "model.tiktok_ads.int_tiktok_ads__most_recent_campaign": {"metadata": {"type": "BASE TABLE", "schema": "DBT_TIKTOK_ADS_TIKTOK_ADS", "name": "INT_TIKTOK_ADS__MOST_RECENT_CAMPAIGN", "database": "FIVETRAN_DBT_TESTING", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CAMPAIGN_ID": {"type": "NUMBER", "index": 1, "name": "CAMPAIGN_ID", "comment": null}, "UPDATED_AT": {"type": "TIMESTAMP_TZ", "index": 2, "name": "UPDATED_AT", "comment": null}, "ADVERTISER_ID": {"type": "NUMBER", "index": 3, "name": "ADVERTISER_ID", "comment": null}, "CAMPAIGN_NAME": {"type": "TEXT", "index": 4, "name": "CAMPAIGN_NAME", "comment": null}, "CAMPAIGN_TYPE": {"type": "TEXT", "index": 5, "name": "CAMPAIGN_TYPE", "comment": null}, "SPLIT_TEST_VARIABLE": {"type": "TEXT", "index": 6, "name": "SPLIT_TEST_VARIABLE", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_TZ", "index": 7, "name": "_FIVETRAN_SYNCED", "comment": null}, "IS_MOST_RECENT_RECORD": {"type": "BOOLEAN", "index": 8, "name": "IS_MOST_RECENT_RECORD", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 12.0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2021-12-13 23:08UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 3584.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads.int_tiktok_ads__most_recent_campaign"}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp": {"metadata": {"type": "VIEW", "schema": "DBT_TIKTOK_ADS_STG_TIKTOK_ADS", "name": "STG_TIKTOK_ADS__CAMPAIGN_HISTORY_TMP", "database": "FIVETRAN_DBT_TESTING", "comment": null, "owner": "ACCOUNTADMIN"}, "columns": {"CAMPAIGN_ID": {"type": "NUMBER", "index": 1, "name": "CAMPAIGN_ID", "comment": null}, "UPDATED_AT": {"type": "TIMESTAMP_TZ", "index": 2, "name": "UPDATED_AT", "comment": null}, "ADVERTISER_ID": {"type": "NUMBER", "index": 3, "name": "ADVERTISER_ID", "comment": null}, "CAMPAIGN_NAME": {"type": "TEXT", "index": 4, "name": "CAMPAIGN_NAME", "comment": null}, "CAMPAIGN_TYPE": {"type": "TEXT", "index": 5, "name": "CAMPAIGN_TYPE", "comment": null}, "BUDGET": {"type": "FLOAT", "index": 6, "name": "BUDGET", "comment": null}, "BUDGET_MODE": {"type": "TEXT", "index": 7, "name": "BUDGET_MODE", "comment": null}, "OPT_STATUS": {"type": "TEXT", "index": 8, "name": "OPT_STATUS", "comment": null}, "OBJECTIVE_TYPE": {"type": "TEXT", "index": 9, "name": "OBJECTIVE_TYPE", "comment": null}, "IS_NEW_STRUCTURE": {"type": "TEXT", "index": 10, "name": "IS_NEW_STRUCTURE", "comment": null}, "SPLIT_TEST_VARIABLE": {"type": "TEXT", "index": 11, "name": "SPLIT_TEST_VARIABLE", "comment": null}, "CREATE_TIME": {"type": "TIMESTAMP_TZ", "index": 12, "name": "CREATE_TIME", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_TZ", "index": 13, "name": "_FIVETRAN_SYNCED", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp"}}, "sources": {"source.tiktok_ads_source.tiktok_ads.advertiser": {"metadata": {"type": "BASE TABLE", "schema": "TIKTOK_ADS", "name": "ADVERTISER", "database": "MB_TIKTOK_ADS", "comment": null, "owner": null}, "columns": {"ID": {"type": "NUMBER", "index": 1, "name": "ID", "comment": null}, "NAME": {"type": "TEXT", "index": 2, "name": "NAME", "comment": null}, "ADDRESS": {"type": "TEXT", "index": 3, "name": "ADDRESS", "comment": null}, "COMPANY": {"type": "TEXT", "index": 4, "name": "COMPANY", "comment": null}, "CONTACTER": {"type": "TEXT", "index": 5, "name": "CONTACTER", "comment": null}, "COUNTRY": {"type": "TEXT", "index": 6, "name": "COUNTRY", "comment": null}, "CURRENCY": {"type": "TEXT", "index": 7, "name": "CURRENCY", "comment": null}, "DESCRIPTION": {"type": "TEXT", "index": 8, "name": "DESCRIPTION", "comment": null}, "EMAIL": {"type": "TEXT", "index": 9, "name": "EMAIL", "comment": null}, "INDUSTRY": {"type": "TEXT", "index": 10, "name": "INDUSTRY", "comment": null}, "LICENSE_NO": {"type": "TEXT", "index": 11, "name": "LICENSE_NO", "comment": null}, "LICENSE_URL": {"type": "TEXT", "index": 12, "name": "LICENSE_URL", "comment": null}, "PROMOTION_AREA": {"type": "TEXT", "index": 13, "name": "PROMOTION_AREA", "comment": null}, "REASON": {"type": "TEXT", "index": 14, "name": "REASON", "comment": null}, "ROLE": {"type": "TEXT", "index": 15, "name": "ROLE", "comment": null}, "STATUS": {"type": "TEXT", "index": 16, "name": "STATUS", "comment": null}, "TELEPHONE": {"type": "TEXT", "index": 17, "name": "TELEPHONE", "comment": null}, "TIMEZONE": {"type": "TEXT", "index": 18, "name": "TIMEZONE", "comment": null}, "BALANCE": {"type": "FLOAT", "index": 19, "name": "BALANCE", "comment": null}, "CREATE_TIME": {"type": "TIMESTAMP_TZ", "index": 20, "name": "CREATE_TIME", "comment": null}, "LANGUAGE": {"type": "TEXT", "index": 21, "name": "LANGUAGE", "comment": null}, "PHONE_NUMBER": {"type": "TEXT", "index": 22, "name": "PHONE_NUMBER", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_TZ", "index": 23, "name": "_FIVETRAN_SYNCED", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 2.0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2021-09-15 16:03UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 7680.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.tiktok_ads_source.tiktok_ads.advertiser"}, "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly": {"metadata": {"type": "BASE TABLE", "schema": "TIKTOK_ADS", "name": "ADGROUP_REPORT_HOURLY", "database": "MB_TIKTOK_ADS", "comment": null, "owner": null}, "columns": {"ADGROUP_ID": {"type": "NUMBER", "index": 1, "name": "ADGROUP_ID", "comment": null}, "STAT_TIME_HOUR": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "STAT_TIME_HOUR", "comment": null}, "COST_PER_CONVERSION": {"type": "FLOAT", "index": 3, "name": "COST_PER_CONVERSION", "comment": null}, "REAL_TIME_CONVERSION": {"type": "NUMBER", "index": 4, "name": "REAL_TIME_CONVERSION", "comment": null}, "CPC": {"type": "FLOAT", "index": 5, "name": "CPC", "comment": null}, "VIDEO_PLAY_ACTIONS": {"type": "NUMBER", "index": 6, "name": "VIDEO_PLAY_ACTIONS", "comment": null}, "CONVERSION_RATE": {"type": "FLOAT", "index": 7, "name": "CONVERSION_RATE", "comment": null}, "VIDEO_VIEWS_P_75": {"type": "NUMBER", "index": 8, "name": "VIDEO_VIEWS_P_75", "comment": null}, "RESULT": {"type": "NUMBER", "index": 9, "name": "RESULT", "comment": null}, "VIDEO_VIEWS_P_50": {"type": "NUMBER", "index": 10, "name": "VIDEO_VIEWS_P_50", "comment": null}, "IMPRESSIONS": {"type": "NUMBER", "index": 11, "name": "IMPRESSIONS", "comment": null}, "COMMENTS": {"type": "NUMBER", "index": 12, "name": "COMMENTS", "comment": null}, "REAL_TIME_COST_PER_RESULT": {"type": "FLOAT", "index": 13, "name": "REAL_TIME_COST_PER_RESULT", "comment": null}, "CONVERSION": {"type": "NUMBER", "index": 14, "name": "CONVERSION", "comment": null}, "REAL_TIME_RESULT": {"type": "NUMBER", "index": 15, "name": "REAL_TIME_RESULT", "comment": null}, "VIDEO_VIEWS_P_100": {"type": "NUMBER", "index": 16, "name": "VIDEO_VIEWS_P_100", "comment": null}, "SHARES": {"type": "NUMBER", "index": 17, "name": "SHARES", "comment": null}, "REAL_TIME_CONVERSION_RATE": {"type": "FLOAT", "index": 18, "name": "REAL_TIME_CONVERSION_RATE", "comment": null}, "COST_PER_SECONDARY_GOAL_RESULT": {"type": "TEXT", "index": 19, "name": "COST_PER_SECONDARY_GOAL_RESULT", "comment": null}, "SECONDARY_GOAL_RESULT_RATE": {"type": "TEXT", "index": 20, "name": "SECONDARY_GOAL_RESULT_RATE", "comment": null}, "CLICKS": {"type": "NUMBER", "index": 21, "name": "CLICKS", "comment": null}, "COST_PER_1000_REACHED": {"type": "FLOAT", "index": 22, "name": "COST_PER_1000_REACHED", "comment": null}, "VIDEO_VIEWS_P_25": {"type": "NUMBER", "index": 23, "name": "VIDEO_VIEWS_P_25", "comment": null}, "REACH": {"type": "NUMBER", "index": 24, "name": "REACH", "comment": null}, "REAL_TIME_COST_PER_CONVERSION": {"type": "FLOAT", "index": 25, "name": "REAL_TIME_COST_PER_CONVERSION", "comment": null}, "PROFILE_VISITS_RATE": {"type": "FLOAT", "index": 26, "name": "PROFILE_VISITS_RATE", "comment": null}, "AVERAGE_VIDEO_PLAY": {"type": "FLOAT", "index": 27, "name": "AVERAGE_VIDEO_PLAY", "comment": null}, "PROFILE_VISITS": {"type": "NUMBER", "index": 28, "name": "PROFILE_VISITS", "comment": null}, "CPM": {"type": "FLOAT", "index": 29, "name": "CPM", "comment": null}, "CTR": {"type": "FLOAT", "index": 30, "name": "CTR", "comment": null}, "VIDEO_WATCHED_2_S": {"type": "NUMBER", "index": 31, "name": "VIDEO_WATCHED_2_S", "comment": null}, "FOLLOWS": {"type": "NUMBER", "index": 32, "name": "FOLLOWS", "comment": null}, "RESULT_RATE": {"type": "FLOAT", "index": 33, "name": "RESULT_RATE", "comment": null}, "VIDEO_WATCHED_6_S": {"type": "NUMBER", "index": 34, "name": "VIDEO_WATCHED_6_S", "comment": null}, "SECONDARY_GOAL_RESULT": {"type": "TEXT", "index": 35, "name": "SECONDARY_GOAL_RESULT", "comment": null}, "COST_PER_RESULT": {"type": "FLOAT", "index": 36, "name": "COST_PER_RESULT", "comment": null}, "AVERAGE_VIDEO_PLAY_PER_USER": {"type": "FLOAT", "index": 37, "name": "AVERAGE_VIDEO_PLAY_PER_USER", "comment": null}, "REAL_TIME_RESULT_RATE": {"type": "FLOAT", "index": 38, "name": "REAL_TIME_RESULT_RATE", "comment": null}, "SPEND": {"type": "FLOAT", "index": 39, "name": "SPEND", "comment": null}, "LIKES": {"type": "NUMBER", "index": 40, "name": "LIKES", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_TZ", "index": 41, "name": "_FIVETRAN_SYNCED", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 33949.0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2021-09-15 16:02UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 2539008.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly"}, "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly": {"metadata": {"type": "BASE TABLE", "schema": "TIKTOK_ADS", "name": "CAMPAIGN_REPORT_HOURLY", "database": "MB_TIKTOK_ADS", "comment": null, "owner": null}, "columns": {"CAMPAIGN_ID": {"type": "NUMBER", "index": 1, "name": "CAMPAIGN_ID", "comment": null}, "STAT_TIME_HOUR": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "STAT_TIME_HOUR", "comment": null}, "COST_PER_CONVERSION": {"type": "FLOAT", "index": 3, "name": "COST_PER_CONVERSION", "comment": null}, "REAL_TIME_CONVERSION": {"type": "NUMBER", "index": 4, "name": "REAL_TIME_CONVERSION", "comment": null}, "CPC": {"type": "FLOAT", "index": 5, "name": "CPC", "comment": null}, "VIDEO_PLAY_ACTIONS": {"type": "NUMBER", "index": 6, "name": "VIDEO_PLAY_ACTIONS", "comment": null}, "CONVERSION_RATE": {"type": "FLOAT", "index": 7, "name": "CONVERSION_RATE", "comment": null}, "VIDEO_VIEWS_P_75": {"type": "NUMBER", "index": 8, "name": "VIDEO_VIEWS_P_75", "comment": null}, "RESULT": {"type": "NUMBER", "index": 9, "name": "RESULT", "comment": null}, "VIDEO_VIEWS_P_50": {"type": "NUMBER", "index": 10, "name": "VIDEO_VIEWS_P_50", "comment": null}, "IMPRESSIONS": {"type": "NUMBER", "index": 11, "name": "IMPRESSIONS", "comment": null}, "COMMENTS": {"type": "NUMBER", "index": 12, "name": "COMMENTS", "comment": null}, "REAL_TIME_COST_PER_RESULT": {"type": "FLOAT", "index": 13, "name": "REAL_TIME_COST_PER_RESULT", "comment": null}, "CONVERSION": {"type": "NUMBER", "index": 14, "name": "CONVERSION", "comment": null}, "REAL_TIME_RESULT": {"type": "NUMBER", "index": 15, "name": "REAL_TIME_RESULT", "comment": null}, "VIDEO_VIEWS_P_100": {"type": "NUMBER", "index": 16, "name": "VIDEO_VIEWS_P_100", "comment": null}, "SHARES": {"type": "NUMBER", "index": 17, "name": "SHARES", "comment": null}, "REAL_TIME_CONVERSION_RATE": {"type": "FLOAT", "index": 18, "name": "REAL_TIME_CONVERSION_RATE", "comment": null}, "COST_PER_SECONDARY_GOAL_RESULT": {"type": "TEXT", "index": 19, "name": "COST_PER_SECONDARY_GOAL_RESULT", "comment": null}, "SECONDARY_GOAL_RESULT_RATE": {"type": "TEXT", "index": 20, "name": "SECONDARY_GOAL_RESULT_RATE", "comment": null}, "CLICKS": {"type": "NUMBER", "index": 21, "name": "CLICKS", "comment": null}, "COST_PER_1000_REACHED": {"type": "FLOAT", "index": 22, "name": "COST_PER_1000_REACHED", "comment": null}, "VIDEO_VIEWS_P_25": {"type": "NUMBER", "index": 23, "name": "VIDEO_VIEWS_P_25", "comment": null}, "REACH": {"type": "NUMBER", "index": 24, "name": "REACH", "comment": null}, "REAL_TIME_COST_PER_CONVERSION": {"type": "FLOAT", "index": 25, "name": "REAL_TIME_COST_PER_CONVERSION", "comment": null}, "PROFILE_VISITS_RATE": {"type": "FLOAT", "index": 26, "name": "PROFILE_VISITS_RATE", "comment": null}, "AVERAGE_VIDEO_PLAY": {"type": "FLOAT", "index": 27, "name": "AVERAGE_VIDEO_PLAY", "comment": null}, "PROFILE_VISITS": {"type": "NUMBER", "index": 28, "name": "PROFILE_VISITS", "comment": null}, "CPM": {"type": "FLOAT", "index": 29, "name": "CPM", "comment": null}, "CTR": {"type": "FLOAT", "index": 30, "name": "CTR", "comment": null}, "VIDEO_WATCHED_2_S": {"type": "NUMBER", "index": 31, "name": "VIDEO_WATCHED_2_S", "comment": null}, "FOLLOWS": {"type": "NUMBER", "index": 32, "name": "FOLLOWS", "comment": null}, "RESULT_RATE": {"type": "FLOAT", "index": 33, "name": "RESULT_RATE", "comment": null}, "VIDEO_WATCHED_6_S": {"type": "NUMBER", "index": 34, "name": "VIDEO_WATCHED_6_S", "comment": null}, "SECONDARY_GOAL_RESULT": {"type": "TEXT", "index": 35, "name": "SECONDARY_GOAL_RESULT", "comment": null}, "COST_PER_RESULT": {"type": "FLOAT", "index": 36, "name": "COST_PER_RESULT", "comment": null}, "AVERAGE_VIDEO_PLAY_PER_USER": {"type": "FLOAT", "index": 37, "name": "AVERAGE_VIDEO_PLAY_PER_USER", "comment": null}, "REAL_TIME_RESULT_RATE": {"type": "FLOAT", "index": 38, "name": "REAL_TIME_RESULT_RATE", "comment": null}, "SPEND": {"type": "FLOAT", "index": 39, "name": "SPEND", "comment": null}, "LIKES": {"type": "NUMBER", "index": 40, "name": "LIKES", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_TZ", "index": 41, "name": "_FIVETRAN_SYNCED", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 14302.0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2021-09-15 16:02UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1323008.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly"}, "source.tiktok_ads_source.tiktok_ads.adgroup_history": {"metadata": {"type": "BASE TABLE", "schema": "TIKTOK_ADS", "name": "ADGROUP_HISTORY", "database": "MB_TIKTOK_ADS", "comment": null, "owner": null}, "columns": {"ADGROUP_ID": {"type": "NUMBER", "index": 1, "name": "ADGROUP_ID", "comment": null}, "UPDATED_AT": {"type": "TIMESTAMP_TZ", "index": 2, "name": "UPDATED_AT", "comment": null}, "ADVERTISER_ID": {"type": "NUMBER", "index": 3, "name": "ADVERTISER_ID", "comment": null}, "CAMPAIGN_ID": {"type": "NUMBER", "index": 4, "name": "CAMPAIGN_ID", "comment": null}, "CREATE_TIME": {"type": "TIMESTAMP_TZ", "index": 5, "name": "CREATE_TIME", "comment": null}, "ADGROUP_NAME": {"type": "TEXT", "index": 6, "name": "ADGROUP_NAME", "comment": null}, "PLACEMENT_TYPE": {"type": "TEXT", "index": 7, "name": "PLACEMENT_TYPE", "comment": null}, "PROFILE_IMAGE": {"type": "TEXT", "index": 8, "name": "PROFILE_IMAGE", "comment": null}, "LANDING_PAGE_URL": {"type": "TEXT", "index": 9, "name": "LANDING_PAGE_URL", "comment": null}, "DISPLAY_NAME": {"type": "TEXT", "index": 10, "name": "DISPLAY_NAME", "comment": null}, "APP_TYPE": {"type": "TEXT", "index": 11, "name": "APP_TYPE", "comment": null}, "APP_DOWNLOAD_URL": {"type": "TEXT", "index": 12, "name": "APP_DOWNLOAD_URL", "comment": null}, "APP_NAME": {"type": "TEXT", "index": 13, "name": "APP_NAME", "comment": null}, "EXTERNAL_ACTION": {"type": "TEXT", "index": 14, "name": "EXTERNAL_ACTION", "comment": null}, "DEEP_EXTERNAL_ACTION": {"type": "TEXT", "index": 15, "name": "DEEP_EXTERNAL_ACTION", "comment": null}, "CREATIVE_MATERIAL_MODE": {"type": "TEXT", "index": 16, "name": "CREATIVE_MATERIAL_MODE", "comment": null}, "AUDIENCE_TYPE": {"type": "TEXT", "index": 17, "name": "AUDIENCE_TYPE", "comment": null}, "GENDER": {"type": "TEXT", "index": 18, "name": "GENDER", "comment": null}, "ANDROID_OSV": {"type": "TEXT", "index": 19, "name": "ANDROID_OSV", "comment": null}, "IOS_OSV": {"type": "TEXT", "index": 20, "name": "IOS_OSV", "comment": null}, "BUDGET_MODE": {"type": "TEXT", "index": 21, "name": "BUDGET_MODE", "comment": null}, "SCHEDULE_TYPE": {"type": "TEXT", "index": 22, "name": "SCHEDULE_TYPE", "comment": null}, "DAYPARTING": {"type": "TEXT", "index": 23, "name": "DAYPARTING", "comment": null}, "OPTIMIZE_GOAL": {"type": "TEXT", "index": 24, "name": "OPTIMIZE_GOAL", "comment": null}, "CPV_VIDEO_DURATION": {"type": "TEXT", "index": 25, "name": "CPV_VIDEO_DURATION", "comment": null}, "PACING": {"type": "TEXT", "index": 26, "name": "PACING", "comment": null}, "BILLING_EVENT": {"type": "TEXT", "index": 27, "name": "BILLING_EVENT", "comment": null}, "BID_TYPE": {"type": "TEXT", "index": 28, "name": "BID_TYPE", "comment": null}, "DEEP_BID_TYPE": {"type": "TEXT", "index": 29, "name": "DEEP_BID_TYPE", "comment": null}, "IMPRESSION_TRACKING_URL": {"type": "TEXT", "index": 30, "name": "IMPRESSION_TRACKING_URL", "comment": null}, "CLICK_TRACKING_URL": {"type": "TEXT", "index": 31, "name": "CLICK_TRACKING_URL", "comment": null}, "STATUS": {"type": "TEXT", "index": 32, "name": "STATUS", "comment": null}, "OPT_STATUS": {"type": "TEXT", "index": 33, "name": "OPT_STATUS", "comment": null}, "STATISTIC_TYPE": {"type": "TEXT", "index": 34, "name": "STATISTIC_TYPE", "comment": null}, "VIDEO_DOWNLOAD": {"type": "TEXT", "index": 35, "name": "VIDEO_DOWNLOAD", "comment": null}, "OPEN_URL": {"type": "TEXT", "index": 36, "name": "OPEN_URL", "comment": null}, "OPEN_URL_TYPE": {"type": "TEXT", "index": 37, "name": "OPEN_URL_TYPE", "comment": null}, "FALLBACK_TYPE": {"type": "TEXT", "index": 38, "name": "FALLBACK_TYPE", "comment": null}, "BUDGET": {"type": "FLOAT", "index": 39, "name": "BUDGET", "comment": null}, "BID": {"type": "FLOAT", "index": 40, "name": "BID", "comment": null}, "CONVERSION_BID": {"type": "FLOAT", "index": 41, "name": "CONVERSION_BID", "comment": null}, "DEEP_CPABID": {"type": "FLOAT", "index": 42, "name": "DEEP_CPABID", "comment": null}, "SCHEDULE_START_TIME": {"type": "TIMESTAMP_TZ", "index": 43, "name": "SCHEDULE_START_TIME", "comment": null}, "SCHEDULE_END_TIME": {"type": "TIMESTAMP_TZ", "index": 44, "name": "SCHEDULE_END_TIME", "comment": null}, "APP_ID": {"type": "NUMBER", "index": 45, "name": "APP_ID", "comment": null}, "PIXEL_ID": {"type": "NUMBER", "index": 46, "name": "PIXEL_ID", "comment": null}, "ENABLE_INVENTORY_FILTER": {"type": "BOOLEAN", "index": 47, "name": "ENABLE_INVENTORY_FILTER", "comment": null}, "IS_HFSS": {"type": "BOOLEAN", "index": 48, "name": "IS_HFSS", "comment": null}, "IS_NEW_STRUCTURE": {"type": "BOOLEAN", "index": 49, "name": "IS_NEW_STRUCTURE", "comment": null}, "CATEGORY": {"type": "NUMBER", "index": 50, "name": "CATEGORY", "comment": null}, "IS_COMMENT_DISABLE": {"type": "NUMBER", "index": 51, "name": "IS_COMMENT_DISABLE", "comment": null}, "SKIP_LEARNING_PHASE": {"type": "NUMBER", "index": 52, "name": "SKIP_LEARNING_PHASE", "comment": null}, "FREQUENCY": {"type": "NUMBER", "index": 53, "name": "FREQUENCY", "comment": null}, "FREQUENCY_SCHEDULE": {"type": "NUMBER", "index": 54, "name": "FREQUENCY_SCHEDULE", "comment": null}, "ACTION_DAYS": {"type": "NUMBER", "index": 55, "name": "ACTION_DAYS", "comment": null}, "AUDIENCE": {"type": "VARIANT", "index": 56, "name": "AUDIENCE", "comment": null}, "EXCLUDED_AUDIENCE": {"type": "VARIANT", "index": 57, "name": "EXCLUDED_AUDIENCE", "comment": null}, "LOCATION": {"type": "VARIANT", "index": 58, "name": "LOCATION", "comment": null}, "INTEREST_CATEGORY_V_2": {"type": "VARIANT", "index": 59, "name": "INTEREST_CATEGORY_V_2", "comment": null}, "PANGLE_BLOCK_APP_LIST_ID": {"type": "VARIANT", "index": 60, "name": "PANGLE_BLOCK_APP_LIST_ID", "comment": null}, "ACTION_CATEGORIES": {"type": "VARIANT", "index": 61, "name": "ACTION_CATEGORIES", "comment": null}, "PLACEMENT": {"type": "VARIANT", "index": 62, "name": "PLACEMENT", "comment": null}, "KEYWORDS": {"type": "VARIANT", "index": 63, "name": "KEYWORDS", "comment": null}, "AGE": {"type": "VARIANT", "index": 64, "name": "AGE", "comment": null}, "LANGUAGES": {"type": "VARIANT", "index": 65, "name": "LANGUAGES", "comment": null}, "OPERATION_SYSTEM": {"type": "VARIANT", "index": 66, "name": "OPERATION_SYSTEM", "comment": null}, "CONNECTION_TYPE": {"type": "VARIANT", "index": 67, "name": "CONNECTION_TYPE", "comment": null}, "CARRIERS": {"type": "VARIANT", "index": 68, "name": "CARRIERS", "comment": null}, "VIDEO_ACTIONS": {"type": "VARIANT", "index": 69, "name": "VIDEO_ACTIONS", "comment": null}, "PACKAGE": {"type": "TEXT", "index": 70, "name": "PACKAGE", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_TZ", "index": 71, "name": "_FIVETRAN_SYNCED", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 2265.0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2021-09-15 16:03UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 141824.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.tiktok_ads_source.tiktok_ads.adgroup_history"}, "source.tiktok_ads_source.tiktok_ads.campaign_history": {"metadata": {"type": "BASE TABLE", "schema": "TIKTOK_ADS", "name": "CAMPAIGN_HISTORY", "database": "MB_TIKTOK_ADS", "comment": null, "owner": null}, "columns": {"CAMPAIGN_ID": {"type": "NUMBER", "index": 1, "name": "CAMPAIGN_ID", "comment": null}, "UPDATED_AT": {"type": "TIMESTAMP_TZ", "index": 2, "name": "UPDATED_AT", "comment": null}, "ADVERTISER_ID": {"type": "NUMBER", "index": 3, "name": "ADVERTISER_ID", "comment": null}, "CAMPAIGN_NAME": {"type": "TEXT", "index": 4, "name": "CAMPAIGN_NAME", "comment": null}, "CAMPAIGN_TYPE": {"type": "TEXT", "index": 5, "name": "CAMPAIGN_TYPE", "comment": null}, "BUDGET": {"type": "FLOAT", "index": 6, "name": "BUDGET", "comment": null}, "BUDGET_MODE": {"type": "TEXT", "index": 7, "name": "BUDGET_MODE", "comment": null}, "OPT_STATUS": {"type": "TEXT", "index": 8, "name": "OPT_STATUS", "comment": null}, "OBJECTIVE_TYPE": {"type": "TEXT", "index": 9, "name": "OBJECTIVE_TYPE", "comment": null}, "IS_NEW_STRUCTURE": {"type": "TEXT", "index": 10, "name": "IS_NEW_STRUCTURE", "comment": null}, "SPLIT_TEST_VARIABLE": {"type": "TEXT", "index": 11, "name": "SPLIT_TEST_VARIABLE", "comment": null}, "CREATE_TIME": {"type": "TIMESTAMP_TZ", "index": 12, "name": "CREATE_TIME", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_TZ", "index": 13, "name": "_FIVETRAN_SYNCED", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 334.0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2021-09-15 16:03UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 13824.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.tiktok_ads_source.tiktok_ads.campaign_history"}, "source.tiktok_ads_source.tiktok_ads.ad_history": {"metadata": {"type": "BASE TABLE", "schema": "TIKTOK_ADS", "name": "AD_HISTORY", "database": "MB_TIKTOK_ADS", "comment": null, "owner": null}, "columns": {"AD_ID": {"type": "NUMBER", "index": 1, "name": "AD_ID", "comment": null}, "UPDATED_AT": {"type": "TIMESTAMP_TZ", "index": 2, "name": "UPDATED_AT", "comment": null}, "ADVERTISER_ID": {"type": "NUMBER", "index": 3, "name": "ADVERTISER_ID", "comment": null}, "ADGROUP_ID": {"type": "NUMBER", "index": 4, "name": "ADGROUP_ID", "comment": null}, "CAMPAIGN_ID": {"type": "NUMBER", "index": 5, "name": "CAMPAIGN_ID", "comment": null}, "CREATE_TIME": {"type": "TIMESTAMP_TZ", "index": 6, "name": "CREATE_TIME", "comment": null}, "AD_NAME": {"type": "TEXT", "index": 7, "name": "AD_NAME", "comment": null}, "CALL_TO_ACTION": {"type": "TEXT", "index": 8, "name": "CALL_TO_ACTION", "comment": null}, "STATUS": {"type": "TEXT", "index": 9, "name": "STATUS", "comment": null}, "OPT_STATUS": {"type": "TEXT", "index": 10, "name": "OPT_STATUS", "comment": null}, "AD_TEXT": {"type": "TEXT", "index": 11, "name": "AD_TEXT", "comment": null}, "VIDEO_ID": {"type": "TEXT", "index": 12, "name": "VIDEO_ID", "comment": null}, "APP_NAME": {"type": "TEXT", "index": 13, "name": "APP_NAME", "comment": null}, "OPEN_URL": {"type": "TEXT", "index": 14, "name": "OPEN_URL", "comment": null}, "LANDING_PAGE_URL": {"type": "TEXT", "index": 15, "name": "LANDING_PAGE_URL", "comment": null}, "DISPLAY_NAME": {"type": "TEXT", "index": 16, "name": "DISPLAY_NAME", "comment": null}, "PROFILE_IMAGE": {"type": "TEXT", "index": 17, "name": "PROFILE_IMAGE", "comment": null}, "IMPRESSION_TRACKING_URL": {"type": "TEXT", "index": 18, "name": "IMPRESSION_TRACKING_URL", "comment": null}, "CLICK_TRACKING_URL": {"type": "TEXT", "index": 19, "name": "CLICK_TRACKING_URL", "comment": null}, "PLAYABLE_URL": {"type": "TEXT", "index": 20, "name": "PLAYABLE_URL", "comment": null}, "IS_ACO": {"type": "BOOLEAN", "index": 21, "name": "IS_ACO", "comment": null}, "IS_CREATIVE_AUTHORIZED": {"type": "BOOLEAN", "index": 22, "name": "IS_CREATIVE_AUTHORIZED", "comment": null}, "IS_NEW_STRUCTURE": {"type": "BOOLEAN", "index": 23, "name": "IS_NEW_STRUCTURE", "comment": null}, "IMAGE_IDS": {"type": "VARIANT", "index": 24, "name": "IMAGE_IDS", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_TZ", "index": 25, "name": "_FIVETRAN_SYNCED", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 24809.0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2021-09-15 16:02UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 1277952.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.tiktok_ads_source.tiktok_ads.ad_history"}, "source.tiktok_ads_source.tiktok_ads.ad_report_hourly": {"metadata": {"type": "BASE TABLE", "schema": "TIKTOK_ADS", "name": "AD_REPORT_HOURLY", "database": "MB_TIKTOK_ADS", "comment": null, "owner": null}, "columns": {"AD_ID": {"type": "NUMBER", "index": 1, "name": "AD_ID", "comment": null}, "STAT_TIME_HOUR": {"type": "TIMESTAMP_NTZ", "index": 2, "name": "STAT_TIME_HOUR", "comment": null}, "COST_PER_CONVERSION": {"type": "FLOAT", "index": 3, "name": "COST_PER_CONVERSION", "comment": null}, "REAL_TIME_CONVERSION": {"type": "NUMBER", "index": 4, "name": "REAL_TIME_CONVERSION", "comment": null}, "CPC": {"type": "FLOAT", "index": 5, "name": "CPC", "comment": null}, "VIDEO_PLAY_ACTIONS": {"type": "NUMBER", "index": 6, "name": "VIDEO_PLAY_ACTIONS", "comment": null}, "CONVERSION_RATE": {"type": "FLOAT", "index": 7, "name": "CONVERSION_RATE", "comment": null}, "VIDEO_VIEWS_P_75": {"type": "NUMBER", "index": 8, "name": "VIDEO_VIEWS_P_75", "comment": null}, "RESULT": {"type": "NUMBER", "index": 9, "name": "RESULT", "comment": null}, "VIDEO_VIEWS_P_50": {"type": "NUMBER", "index": 10, "name": "VIDEO_VIEWS_P_50", "comment": null}, "IMPRESSIONS": {"type": "NUMBER", "index": 11, "name": "IMPRESSIONS", "comment": null}, "COMMENTS": {"type": "NUMBER", "index": 12, "name": "COMMENTS", "comment": null}, "REAL_TIME_COST_PER_RESULT": {"type": "FLOAT", "index": 13, "name": "REAL_TIME_COST_PER_RESULT", "comment": null}, "CONVERSION": {"type": "NUMBER", "index": 14, "name": "CONVERSION", "comment": null}, "REAL_TIME_RESULT": {"type": "NUMBER", "index": 15, "name": "REAL_TIME_RESULT", "comment": null}, "VIDEO_VIEWS_P_100": {"type": "NUMBER", "index": 16, "name": "VIDEO_VIEWS_P_100", "comment": null}, "SHARES": {"type": "NUMBER", "index": 17, "name": "SHARES", "comment": null}, "REAL_TIME_CONVERSION_RATE": {"type": "FLOAT", "index": 18, "name": "REAL_TIME_CONVERSION_RATE", "comment": null}, "COST_PER_SECONDARY_GOAL_RESULT": {"type": "TEXT", "index": 19, "name": "COST_PER_SECONDARY_GOAL_RESULT", "comment": null}, "SECONDARY_GOAL_RESULT_RATE": {"type": "TEXT", "index": 20, "name": "SECONDARY_GOAL_RESULT_RATE", "comment": null}, "CLICKS": {"type": "NUMBER", "index": 21, "name": "CLICKS", "comment": null}, "COST_PER_1000_REACHED": {"type": "FLOAT", "index": 22, "name": "COST_PER_1000_REACHED", "comment": null}, "VIDEO_VIEWS_P_25": {"type": "NUMBER", "index": 23, "name": "VIDEO_VIEWS_P_25", "comment": null}, "REACH": {"type": "NUMBER", "index": 24, "name": "REACH", "comment": null}, "REAL_TIME_COST_PER_CONVERSION": {"type": "FLOAT", "index": 25, "name": "REAL_TIME_COST_PER_CONVERSION", "comment": null}, "PROFILE_VISITS_RATE": {"type": "FLOAT", "index": 26, "name": "PROFILE_VISITS_RATE", "comment": null}, "AVERAGE_VIDEO_PLAY": {"type": "FLOAT", "index": 27, "name": "AVERAGE_VIDEO_PLAY", "comment": null}, "PROFILE_VISITS": {"type": "NUMBER", "index": 28, "name": "PROFILE_VISITS", "comment": null}, "CPM": {"type": "FLOAT", "index": 29, "name": "CPM", "comment": null}, "CTR": {"type": "FLOAT", "index": 30, "name": "CTR", "comment": null}, "VIDEO_WATCHED_2_S": {"type": "NUMBER", "index": 31, "name": "VIDEO_WATCHED_2_S", "comment": null}, "FOLLOWS": {"type": "NUMBER", "index": 32, "name": "FOLLOWS", "comment": null}, "RESULT_RATE": {"type": "FLOAT", "index": 33, "name": "RESULT_RATE", "comment": null}, "VIDEO_WATCHED_6_S": {"type": "NUMBER", "index": 34, "name": "VIDEO_WATCHED_6_S", "comment": null}, "SECONDARY_GOAL_RESULT": {"type": "TEXT", "index": 35, "name": "SECONDARY_GOAL_RESULT", "comment": null}, "COST_PER_RESULT": {"type": "FLOAT", "index": 36, "name": "COST_PER_RESULT", "comment": null}, "AVERAGE_VIDEO_PLAY_PER_USER": {"type": "FLOAT", "index": 37, "name": "AVERAGE_VIDEO_PLAY_PER_USER", "comment": null}, "REAL_TIME_RESULT_RATE": {"type": "FLOAT", "index": 38, "name": "REAL_TIME_RESULT_RATE", "comment": null}, "SPEND": {"type": "FLOAT", "index": 39, "name": "SPEND", "comment": null}, "LIKES": {"type": "NUMBER", "index": 40, "name": "LIKES", "comment": null}, "_FIVETRAN_SYNCED": {"type": "TIMESTAMP_TZ", "index": 41, "name": "_FIVETRAN_SYNCED", "comment": null}}, "stats": {"row_count": {"id": "row_count", "label": "Row Count", "value": 326781.0, "include": true, "description": "An approximate count of rows in this table"}, "last_modified": {"id": "last_modified", "label": "Last Modified", "value": "2021-09-15 16:02UTC", "include": true, "description": "The timestamp for last update/change"}, "bytes": {"id": "bytes", "label": "Approximate Size", "value": 17682432.0, "include": true, "description": "Approximate size of the table as reported by Snowflake"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.tiktok_ads_source.tiktok_ads.ad_report_hourly"}}, "errors": null} \ No newline at end of file diff --git a/docs/index.html b/docs/index.html deleted file mode 100644 index fa8b08b..0000000 --- a/docs/index.html +++ /dev/null @@ -1,102 +0,0 @@ -<!DOCTYPE html> -<html dir="ltr" lang="en-US" ng-app='dbt' class='no-flash video supports no-touchevents formvalidation webgl no-cssgridlegacy cssgrid cssfilters objectfit object-fit click landscape videoautoplay loaded'> - <head> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1, initial-scale=1" /> - - <title>dbt Docs - - - - - - - - - - - - - - - - - -
icons
-
- - diff --git a/docs/manifest.json b/docs/manifest.json deleted file mode 100644 index 33d11ee..0000000 --- a/docs/manifest.json +++ /dev/null @@ -1 +0,0 @@ -{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v4.json", "dbt_version": "1.0.0", "generated_at": "2022-01-06T18:49:21.428104Z", "invocation_id": "8ad2e9d0-66fc-47f9-abe0-fe38c6948257", "env": {}, "project_id": "faebc42304447d4427374f806679ecb5", "user_id": "e607f749-4294-4b15-833b-0ae4a87d4d24", "send_anonymous_usage_stats": true, "adapter_type": "snowflake"}, "nodes": {"model.tiktok_ads.tiktok_ads__ad_adapter": {"raw_sql": "with hourly as (\n \n select *\n from {{ var('ad_report_hourly') }}\n\n), campaigns as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_campaign') }}\n\n), advertiser as (\n\n select *\n from {{ var('advertiser') }}\n\n), ad_groups as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_ad_group') }}\n\n), ads as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_ad') }}\n\n), joined as (\n\n select \n cast(hourly.stat_time_hour as date) as date_day,\n advertiser.advertiser_id,\n advertiser.name as advertiser_name,\n campaigns.campaign_id,\n campaigns.campaign_name,\n ad_groups.ad_group_id,\n ad_groups.ad_group_name,\n ads.ad_id,\n ads.ad_name,\n ads.base_url,\n ads.url_host,\n ads.url_path,\n ads.utm_source,\n ads.utm_medium,\n ads.utm_campaign,\n ads.utm_content,\n ads.utm_term,\n sum(hourly.spend) as spend,\n sum(hourly.clicks) as clicks,\n sum(hourly.impressions) as impressions,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s, \n sum(hourly.video_watched_6_s) as video_watched_6_s, \n sum(hourly.video_views_p_25) as video_views_p_25, \n sum(hourly.video_views_p_50) as video_views_p_50,\n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n from hourly\n left join ads\n on hourly.ad_id = ads.ad_id\n left join ad_groups \n on ads.ad_group_id = ad_groups.ad_group_id\n left join campaigns\n on ads.campaign_id = campaigns.campaign_id\n left join advertiser\n on campaigns.advertiser_id = advertiser.advertiser_id\n {{ dbt_utils.group_by(17) }}\n \n\n\n)\n\nselect *\nfrom joined", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.group_by"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "model.tiktok_ads_source.stg_tiktok_ads__advertiser", "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "model.tiktok_ads.int_tiktok_ads__most_recent_ad"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_tiktok_ads", "fqn": ["tiktok_ads", "tiktok_ads__ad_adapter"], "unique_id": "model.tiktok_ads.tiktok_ads__ad_adapter", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "tiktok_ads__ad_adapter.sql", "original_file_path": "models/tiktok_ads__ad_adapter.sql", "name": "tiktok_ads__ad_adapter", "alias": "tiktok_ads__ad_adapter", "checksum": {"name": "sha256", "checksum": "dc14a4bb785472ace34d4745dcac503005800ae51f1c1731dfdf4d486d663afa"}, "tags": [], "refs": [["stg_tiktok_ads__ad_report_hourly"], ["int_tiktok_ads__most_recent_campaign"], ["stg_tiktok_ads__advertiser"], ["int_tiktok_ads__most_recent_ad_group"], ["int_tiktok_ads__most_recent_ad"]], "sources": [], "description": "Each record in this table represents the daily performance of ads at the ad level and URL level.", "columns": {"date_day": {"name": "date_day", "description": "Day of record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_id": {"name": "ad_id", "description": "Ad ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_name": {"name": "ad_name", "description": "Ad name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_name": {"name": "advertiser_name", "description": "Advertiser name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "Ad group ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "Ad group name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "base_url": {"name": "base_url", "description": "The base URL of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_host": {"name": "url_host", "description": "The URL host of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_path": {"name": "url_path", "description": "The URL path of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_source": {"name": "utm_source", "description": "The utm_source parameter of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_medium": {"name": "utm_medium", "description": "The utm_medium parameter of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_campaign": {"name": "utm_campaign", "description": "The utm_campaign parameter of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_content": {"name": "utm_content", "description": "The utm_content parameter of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_term": {"name": "utm_term", "description": "The utm_term parameter of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The amount of spend that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of follows that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpc": {"name": "daily_cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpm": {"name": "daily_cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_ctr": {"name": "daily_ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads__ad_adapter.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "table"}, "created_at": 1641494963.10164, "compiled_sql": "with __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__campaign_history\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n), __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_group_history\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n), __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_history\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n),hourly as (\n \n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_report_hourly\n\n), campaigns as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_campaign\n\n), advertiser as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__advertiser\n\n), ad_groups as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_ad_group\n\n), ads as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_ad\n\n), joined as (\n\n select \n cast(hourly.stat_time_hour as date) as date_day,\n advertiser.advertiser_id,\n advertiser.name as advertiser_name,\n campaigns.campaign_id,\n campaigns.campaign_name,\n ad_groups.ad_group_id,\n ad_groups.ad_group_name,\n ads.ad_id,\n ads.ad_name,\n ads.base_url,\n ads.url_host,\n ads.url_path,\n ads.utm_source,\n ads.utm_medium,\n ads.utm_campaign,\n ads.utm_content,\n ads.utm_term,\n sum(hourly.spend) as spend,\n sum(hourly.clicks) as clicks,\n sum(hourly.impressions) as impressions,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s, \n sum(hourly.video_watched_6_s) as video_watched_6_s, \n sum(hourly.video_views_p_25) as video_views_p_25, \n sum(hourly.video_views_p_50) as video_views_p_50,\n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n from hourly\n left join ads\n on hourly.ad_id = ads.ad_id\n left join ad_groups \n on ads.ad_group_id = ad_groups.ad_group_id\n left join campaigns\n on ads.campaign_id = campaigns.campaign_id\n left join advertiser\n on campaigns.advertiser_id = advertiser.advertiser_id\n group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17\n \n\n\n)\n\nselect *\nfrom joined", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "sql": " __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__campaign_history\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}, {"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_group_history\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}, {"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_history\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": "FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_tiktok_ads.tiktok_ads__ad_adapter"}, "model.tiktok_ads.tiktok_ads__ad_group_report": {"raw_sql": "with adapter as (\n\n select *\n from {{ ref('tiktok_ads__ad_adapter') }}\n\n), ad_groups as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_ad_group') }}\n\n), aggregated as (\n\n select\n adapter.date_day,\n adapter.ad_group_id,\n adapter.advertiser_id,\n adapter.campaign_id,\n adapter.campaign_name,\n ad_groups.action_categories,\n ad_groups.gender, \n ad_groups.audience_type,\n ad_groups.budget,\n ad_groups.age, \n ad_groups.languages, \n ad_groups.interest_category,\n sum(adapter.impressions) as impressions,\n sum(adapter.clicks) as clicks,\n sum(adapter.spend) as spend,\n sum(adapter.reach) as reach,\n sum(adapter.conversion) as conversion,\n sum(adapter.likes) as likes,\n sum(adapter.comments) as comments,\n sum(adapter.shares) as shares,\n sum(adapter.profile_visits) as profile_visits,\n sum(adapter.follows) as follows,\n sum(adapter.video_watched_2_s) as video_watched_2_s,\n sum(adapter.video_watched_6_s) as video_watched_6_s,\n sum(adapter.video_views_p_25) as video_views_p_25,\n sum(adapter.video_views_p_50) as video_views_p_50, \n sum(adapter.video_views_p_75) as video_views_p_75,\n sum(adapter.spend)/nullif(sum(adapter.clicks),0) as daily_cpc,\n (sum(adapter.spend)/nullif(sum(adapter.impressions),0))*1000 as daily_cpm,\n (sum(adapter.clicks)/nullif(sum(adapter.impressions),0))*100 as daily_ctr\n\n from adapter\n left join ad_groups \n on adapter.ad_group_id = ad_groups.ad_group_id\n\n {{ dbt_utils.group_by(12) }}\n\n)\n\nselect *\nfrom aggregated", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.group_by"], "nodes": ["model.tiktok_ads.tiktok_ads__ad_adapter", "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_tiktok_ads", "fqn": ["tiktok_ads", "tiktok_ads__ad_group_report"], "unique_id": "model.tiktok_ads.tiktok_ads__ad_group_report", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "tiktok_ads__ad_group_report.sql", "original_file_path": "models/tiktok_ads__ad_group_report.sql", "name": "tiktok_ads__ad_group_report", "alias": "tiktok_ads__ad_group_report", "checksum": {"name": "sha256", "checksum": "079e3ae186dae4c652c1a3a9d1abf967de4acba29ffe4f277631f7b5e917c6ac"}, "tags": [], "refs": [["tiktok_ads__ad_adapter"], ["int_tiktok_ads__most_recent_ad_group"]], "sources": [], "description": "Each record in this table represents the daily performance of ads at the ad group level.", "columns": {"date_day": {"name": "date_day", "description": "Day of record", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of impressions that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The amount of spend that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of follows that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpc": {"name": "daily_cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpm": {"name": "daily_cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_ctr": {"name": "daily_ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_categories": {"name": "action_categories", "description": "IDs of the action categories (behaviors) that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience_type": {"name": "audience_type", "description": "Audience Type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget": {"name": "budget", "description": "Ad budget. Returns 0.0 when Campaign Budget Optimization (budget_optimize_switch) is on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "age": {"name": "age", "description": "Age groups you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "languages": {"name": "languages", "description": "Codes of the languages that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "interest_category": {"name": "interest_category", "description": "Interest classification. If the interest is specified, users that do not meet interest target will be excluded during delivery.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads__ad_group_report.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "table"}, "created_at": 1641494963.112263, "compiled_sql": "with __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_group_history\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n),adapter as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_tiktok_ads.tiktok_ads__ad_adapter\n\n), ad_groups as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_ad_group\n\n), aggregated as (\n\n select\n adapter.date_day,\n adapter.ad_group_id,\n adapter.advertiser_id,\n adapter.campaign_id,\n adapter.campaign_name,\n ad_groups.action_categories,\n ad_groups.gender, \n ad_groups.audience_type,\n ad_groups.budget,\n ad_groups.age, \n ad_groups.languages, \n ad_groups.interest_category,\n sum(adapter.impressions) as impressions,\n sum(adapter.clicks) as clicks,\n sum(adapter.spend) as spend,\n sum(adapter.reach) as reach,\n sum(adapter.conversion) as conversion,\n sum(adapter.likes) as likes,\n sum(adapter.comments) as comments,\n sum(adapter.shares) as shares,\n sum(adapter.profile_visits) as profile_visits,\n sum(adapter.follows) as follows,\n sum(adapter.video_watched_2_s) as video_watched_2_s,\n sum(adapter.video_watched_6_s) as video_watched_6_s,\n sum(adapter.video_views_p_25) as video_views_p_25,\n sum(adapter.video_views_p_50) as video_views_p_50, \n sum(adapter.video_views_p_75) as video_views_p_75,\n sum(adapter.spend)/nullif(sum(adapter.clicks),0) as daily_cpc,\n (sum(adapter.spend)/nullif(sum(adapter.impressions),0))*1000 as daily_cpm,\n (sum(adapter.clicks)/nullif(sum(adapter.impressions),0))*100 as daily_ctr\n\n from adapter\n left join ad_groups \n on adapter.ad_group_id = ad_groups.ad_group_id\n\n group by 1,2,3,4,5,6,7,8,9,10,11,12\n\n)\n\nselect *\nfrom aggregated", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_group_history\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": "FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_tiktok_ads.tiktok_ads__ad_group_report"}, "model.tiktok_ads.tiktok_ads__campaign_report": {"raw_sql": "with adapter as (\n\n select *\n from {{ ref('tiktok_ads__ad_adapter') }}\n \n), aggregated as (\n\n select\n adapter.date_day,\n adapter.campaign_id,\n adapter.campaign_name,\n adapter.advertiser_id,\n sum(adapter.impressions) as impressions,\n sum(adapter.clicks) as clicks,\n sum(adapter.spend) as spend,\n sum(adapter.reach) as reach,\n sum(adapter.conversion) as conversion,\n sum(adapter.likes) as likes,\n sum(adapter.comments) as comments,\n sum(adapter.shares) as shares,\n sum(adapter.profile_visits) as profile_visits,\n sum(adapter.follows) as follows,\n sum(adapter.video_watched_2_s) as video_watched_2_s,\n sum(adapter.video_watched_6_s) as video_watched_6_s,\n sum(adapter.video_views_p_25) as video_views_p_25,\n sum(adapter.video_views_p_50) as video_views_p_50, \n sum(adapter.video_views_p_75) as video_views_p_75,\n sum(adapter.spend)/nullif(sum(adapter.clicks),0) as daily_cpc,\n (sum(adapter.spend)/nullif(sum(adapter.impressions),0))*1000 as daily_cpm,\n (sum(adapter.clicks)/nullif(sum(adapter.impressions),0))*100 as daily_ctr\n\n from adapter\n\n {{ dbt_utils.group_by(4) }}\n\n)\n\nselect *\nfrom aggregated", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.group_by"], "nodes": ["model.tiktok_ads.tiktok_ads__ad_adapter"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_tiktok_ads", "fqn": ["tiktok_ads", "tiktok_ads__campaign_report"], "unique_id": "model.tiktok_ads.tiktok_ads__campaign_report", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "tiktok_ads__campaign_report.sql", "original_file_path": "models/tiktok_ads__campaign_report.sql", "name": "tiktok_ads__campaign_report", "alias": "tiktok_ads__campaign_report", "checksum": {"name": "sha256", "checksum": "5aeba81d9aaebbd3a5b84e95392c08bf9bd975a27311e1c401c20aff626d1f99"}, "tags": [], "refs": [["tiktok_ads__ad_adapter"]], "sources": [], "description": "Each record in this table represents the daily performance at the campaign level.", "columns": {"date_day": {"name": "date_day", "description": "Day of record", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of impressions that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The amount of spend that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of follows that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpc": {"name": "daily_cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpm": {"name": "daily_cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_daily_ctr": {"name": "daily_daily_ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads__campaign_report.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "table"}, "created_at": 1641494963.119791, "compiled_sql": "with adapter as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_tiktok_ads.tiktok_ads__ad_adapter\n \n), aggregated as (\n\n select\n adapter.date_day,\n adapter.campaign_id,\n adapter.campaign_name,\n adapter.advertiser_id,\n sum(adapter.impressions) as impressions,\n sum(adapter.clicks) as clicks,\n sum(adapter.spend) as spend,\n sum(adapter.reach) as reach,\n sum(adapter.conversion) as conversion,\n sum(adapter.likes) as likes,\n sum(adapter.comments) as comments,\n sum(adapter.shares) as shares,\n sum(adapter.profile_visits) as profile_visits,\n sum(adapter.follows) as follows,\n sum(adapter.video_watched_2_s) as video_watched_2_s,\n sum(adapter.video_watched_6_s) as video_watched_6_s,\n sum(adapter.video_views_p_25) as video_views_p_25,\n sum(adapter.video_views_p_50) as video_views_p_50, \n sum(adapter.video_views_p_75) as video_views_p_75,\n sum(adapter.spend)/nullif(sum(adapter.clicks),0) as daily_cpc,\n (sum(adapter.spend)/nullif(sum(adapter.impressions),0))*1000 as daily_cpm,\n (sum(adapter.clicks)/nullif(sum(adapter.impressions),0))*100 as daily_ctr\n\n from adapter\n\n group by 1,2,3,4\n\n)\n\nselect *\nfrom aggregated", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_tiktok_ads.tiktok_ads__campaign_report"}, "model.tiktok_ads.int_tiktok_ads__most_recent_campaign": {"raw_sql": "with base as (\n\n select *\n from {{ var('campaign_history') }}\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "ephemeral", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_tiktok_ads", "fqn": ["tiktok_ads", "intermediate", "int_tiktok_ads__most_recent_campaign"], "unique_id": "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "intermediate/int_tiktok_ads__most_recent_campaign.sql", "original_file_path": "models/intermediate/int_tiktok_ads__most_recent_campaign.sql", "name": "int_tiktok_ads__most_recent_campaign", "alias": "int_tiktok_ads__most_recent_campaign", "checksum": {"name": "sha256", "checksum": "6c395cfec3d0d6060d64883569154a087d790db7a438b72cea679e96e4fdd220"}, "tags": [], "refs": [["stg_tiktok_ads__campaign_history"]], "sources": [], "description": "Each record in this table represents the most recent data for each campaign.", "columns": {"campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_type": {"name": "campaign_type", "description": "Campaign Type, indicates the campaign is a regular campaign or iOS 14 campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "split_test_variable": {"name": "split_test_variable", "description": "Split Test variables. Optional values; TARGETING, BIDDING_OPTIMIZATION , CREATIVE.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/intermediate/intermediate.yml", "compiled_path": "target/compiled/tiktok_ads/models/intermediate/int_tiktok_ads__most_recent_campaign.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "ephemeral"}, "created_at": 1641494963.165007, "compiled_sql": "with base as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__campaign_history\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null}, "model.tiktok_ads.int_tiktok_ads__most_recent_ad": {"raw_sql": "with base as (\n\n select *\n from {{ var('ad_history') }}\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "ephemeral", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_tiktok_ads", "fqn": ["tiktok_ads", "intermediate", "int_tiktok_ads__most_recent_ad"], "unique_id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "intermediate/int_tiktok_ads__most_recent_ad.sql", "original_file_path": "models/intermediate/int_tiktok_ads__most_recent_ad.sql", "name": "int_tiktok_ads__most_recent_ad", "alias": "int_tiktok_ads__most_recent_ad", "checksum": {"name": "sha256", "checksum": "418d75ad47295f6fe67385f0c94e018602e4028dc4cf52a28e9f7006121ad7d7"}, "tags": [], "refs": [["stg_tiktok_ads__ad_history"]], "sources": [], "description": "Each record in this table represents the most recent data for each ad.", "columns": {"ad_id": {"name": "ad_id", "description": "Ad ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "base_url": {"name": "base_url", "description": "The base URL of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_name": {"name": "ad_name", "description": "Ad Name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_text": {"name": "ad_text", "description": "The ad text.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "call_to_action": {"name": "call_to_action", "description": "Call to action values.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "click_tracking_url": {"name": "click_tracking_url", "description": "Click monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impression_tracking_url": {"name": "impression_tracking_url", "description": "Display monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_host": {"name": "url_host", "description": "The URL host of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_path": {"name": "url_path", "description": "The URL path of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_source": {"name": "utm_source", "description": "The utm_source parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_medium": {"name": "utm_medium", "description": "The utm_medium parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_campaign": {"name": "utm_campaign", "description": "The utm_campaign parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_content": {"name": "utm_content", "description": "The utm_content parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_term": {"name": "utm_term", "description": "The utm_term parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_id": {"name": "video_id", "description": "The video ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/intermediate/intermediate.yml", "compiled_path": "target/compiled/tiktok_ads/models/intermediate/int_tiktok_ads__most_recent_ad.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "ephemeral"}, "created_at": 1641494963.1619258, "compiled_sql": "with base as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_history\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null}, "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group": {"raw_sql": "with base as (\n\n select *\n from {{ var('ad_group_history') }}\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "ephemeral", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_tiktok_ads", "fqn": ["tiktok_ads", "intermediate", "int_tiktok_ads__most_recent_ad_group"], "unique_id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "intermediate/int_tiktok_ads__most_recent_ad_group.sql", "original_file_path": "models/intermediate/int_tiktok_ads__most_recent_ad_group.sql", "name": "int_tiktok_ads__most_recent_ad_group", "alias": "int_tiktok_ads__most_recent_ad_group", "checksum": {"name": "sha256", "checksum": "a1d9693e48ac9773013bd17c70506c937b917254481075d677d7e989e9665358"}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_history"]], "sources": [], "description": "Each record in this table represents the most recent data for each ad group.", "columns": {"ad_group_id": {"name": "ad_group_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The Ad group's campaign ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_days": {"name": "action_days", "description": "Action days", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "Ad group name. Character limit is 512 and cannot contain emoji.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "age": {"name": "age", "description": "Age groups you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience_type": {"name": "audience_type", "description": "Audience Type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "category": {"name": "category", "description": "Ad group category.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "display_name": {"name": "display_name", "description": "Display name of ad group.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency": {"name": "frequency", "description": "frequency, together with frequency_schedule, controls how often people see your ad (only available for REACH ads). For example, frequency = 2 frequency_schedule = 3 means \"show ads no more than twice every 3 day\".\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency_schedule": {"name": "frequency_schedule", "description": "frequency, together with frequency, controls how often people see your ad (only available for REACH ads).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_download": {"name": "video_download", "description": "Whether the video is allowed to be downloaded.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "languages": {"name": "languages", "description": "Codes of the languages that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/intermediate/intermediate.yml", "compiled_path": "target/compiled/tiktok_ads/models/intermediate/int_tiktok_ads__most_recent_ad_group.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "ephemeral"}, "created_at": 1641494963.154113, "compiled_sql": "with base as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_group_history\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__campaign_report_hourly_tmp') }}\n\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__campaign_report_hourly_tmp')),\n staging_columns=get_campaign_report_hourly_columns()\n )\n }}\n\n from base\n\n), \n\nfinal as (\n\n select \n campaign_id, \n _fivetran_synced,\n stat_time_hour, \n cpc, \n cpm, \n ctr, \n impressions, \n clicks, \n spend, \n reach, \n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n from fields\n\n)\n\nselect * from final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_campaign_report_hourly_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__campaign_report_hourly"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__campaign_report_hourly.sql", "original_file_path": "models/stg_tiktok_ads__campaign_report_hourly.sql", "name": "stg_tiktok_ads__campaign_report_hourly", "alias": "stg_tiktok_ads__campaign_report_hourly", "checksum": {"name": "sha256", "checksum": "9f3a04dc48c7f659a074560e3fc118607d68acbd2fa86480448e63bae7fb1f07"}, "tags": [], "refs": [["stg_tiktok_ads__campaign_report_hourly_tmp"], ["stg_tiktok_ads__campaign_report_hourly_tmp"]], "sources": [], "description": "Each record represent data for each campaign for each hour.", "columns": {"campaign_id": {"name": "campaign_id", "description": "Campaign id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time per user your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__campaign_report_hourly.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1641494963.3704178, "compiled_sql": "with base as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__campaign_report_hourly_tmp\n\n), \n\nfields as (\n\n select\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n average_video_play\n \n as \n \n average_video_play\n \n, \n \n \n average_video_play_per_user\n \n as \n \n average_video_play_per_user\n \n, \n \n \n campaign_id\n \n as \n \n campaign_id\n \n, \n \n \n clicks\n \n as \n \n clicks\n \n, \n \n \n comments\n \n as \n \n comments\n \n, \n \n \n conversion\n \n as \n \n conversion\n \n, \n \n \n conversion_rate\n \n as \n \n conversion_rate\n \n, \n \n \n cost_per_1000_reached\n \n as \n \n cost_per_1000_reached\n \n, \n \n \n cost_per_conversion\n \n as \n \n cost_per_conversion\n \n, \n \n \n cost_per_result\n \n as \n \n cost_per_result\n \n, \n \n \n cost_per_secondary_goal_result\n \n as \n \n cost_per_secondary_goal_result\n \n, \n \n \n cpc\n \n as \n \n cpc\n \n, \n \n \n cpm\n \n as \n \n cpm\n \n, \n \n \n ctr\n \n as \n \n ctr\n \n, \n \n \n follows\n \n as \n \n follows\n \n, \n \n \n impressions\n \n as \n \n impressions\n \n, \n \n \n likes\n \n as \n \n likes\n \n, \n \n \n profile_visits\n \n as \n \n profile_visits\n \n, \n \n \n profile_visits_rate\n \n as \n \n profile_visits_rate\n \n, \n \n \n reach\n \n as \n \n reach\n \n, \n \n \n real_time_conversion\n \n as \n \n real_time_conversion\n \n, \n \n \n real_time_conversion_rate\n \n as \n \n real_time_conversion_rate\n \n, \n \n \n real_time_cost_per_conversion\n \n as \n \n real_time_cost_per_conversion\n \n, \n \n \n real_time_cost_per_result\n \n as \n \n real_time_cost_per_result\n \n, \n \n \n real_time_result\n \n as \n \n real_time_result\n \n, \n \n \n real_time_result_rate\n \n as \n \n real_time_result_rate\n \n, \n \n \n result\n \n as \n \n result\n \n, \n \n \n result_rate\n \n as \n \n result_rate\n \n, \n \n \n secondary_goal_result\n \n as \n \n secondary_goal_result\n \n, \n \n \n secondary_goal_result_rate\n \n as \n \n secondary_goal_result_rate\n \n, \n \n \n shares\n \n as \n \n shares\n \n, \n \n \n spend\n \n as \n \n spend\n \n, \n \n \n stat_time_hour\n \n as \n \n stat_time_hour\n \n, \n \n \n video_play_actions\n \n as \n \n video_play_actions\n \n, \n \n \n video_views_p_100\n \n as \n \n video_views_p_100\n \n, \n \n \n video_views_p_25\n \n as \n \n video_views_p_25\n \n, \n \n \n video_views_p_50\n \n as \n \n video_views_p_50\n \n, \n \n \n video_views_p_75\n \n as \n \n video_views_p_75\n \n, \n \n \n video_watched_2_s\n \n as \n \n video_watched_2_s\n \n, \n \n \n video_watched_6_s\n \n as \n \n video_watched_6_s\n \n\n\n\n\n from base\n\n), \n\nfinal as (\n\n select \n campaign_id, \n _fivetran_synced,\n stat_time_hour, \n cpc, \n cpm, \n ctr, \n impressions, \n clicks, \n spend, \n reach, \n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n from fields\n\n)\n\nselect * from final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__campaign_report_hourly"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__ad_group_report_hourly_tmp') }}\n\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__ad_group_report_hourly_tmp')),\n staging_columns=get_ad_group_report_hourly_columns()\n )\n }}\n\n from base\n\n), \n\nfinal as (\n\n select \n adgroup_id as ad_group_id, \n _fivetran_synced,\n stat_time_hour, \n cpc, \n cpm, \n ctr, \n impressions, \n clicks, \n spend, \n reach, \n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n from fields\n\n) \n\nselect * from final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_ad_group_report_hourly_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__ad_group_report_hourly"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__ad_group_report_hourly.sql", "original_file_path": "models/stg_tiktok_ads__ad_group_report_hourly.sql", "name": "stg_tiktok_ads__ad_group_report_hourly", "alias": "stg_tiktok_ads__ad_group_report_hourly", "checksum": {"name": "sha256", "checksum": "c9c99be3105eaeff47940f04552da2b83c6c0e238f90e250030d80f4daa31483"}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_report_hourly_tmp"], ["stg_tiktok_ads__ad_group_report_hourly_tmp"]], "sources": [], "description": "Each record represents data for each ad group for each hour.", "columns": {"ad_group_id": {"name": "ad_group_id", "description": "Ad group id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time per user your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__ad_group_report_hourly.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1641494963.32393, "compiled_sql": "with base as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_group_report_hourly_tmp\n\n), \n\nfields as (\n\n select\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n adgroup_id\n \n as \n \n adgroup_id\n \n, \n \n \n average_video_play\n \n as \n \n average_video_play\n \n, \n \n \n average_video_play_per_user\n \n as \n \n average_video_play_per_user\n \n, \n \n \n clicks\n \n as \n \n clicks\n \n, \n \n \n comments\n \n as \n \n comments\n \n, \n \n \n conversion\n \n as \n \n conversion\n \n, \n \n \n conversion_rate\n \n as \n \n conversion_rate\n \n, \n \n \n cost_per_1000_reached\n \n as \n \n cost_per_1000_reached\n \n, \n \n \n cost_per_conversion\n \n as \n \n cost_per_conversion\n \n, \n \n \n cost_per_result\n \n as \n \n cost_per_result\n \n, \n \n \n cost_per_secondary_goal_result\n \n as \n \n cost_per_secondary_goal_result\n \n, \n \n \n cpc\n \n as \n \n cpc\n \n, \n \n \n cpm\n \n as \n \n cpm\n \n, \n \n \n ctr\n \n as \n \n ctr\n \n, \n \n \n follows\n \n as \n \n follows\n \n, \n \n \n impressions\n \n as \n \n impressions\n \n, \n \n \n likes\n \n as \n \n likes\n \n, \n \n \n profile_visits\n \n as \n \n profile_visits\n \n, \n \n \n profile_visits_rate\n \n as \n \n profile_visits_rate\n \n, \n \n \n reach\n \n as \n \n reach\n \n, \n \n \n real_time_conversion\n \n as \n \n real_time_conversion\n \n, \n \n \n real_time_conversion_rate\n \n as \n \n real_time_conversion_rate\n \n, \n \n \n real_time_cost_per_conversion\n \n as \n \n real_time_cost_per_conversion\n \n, \n \n \n real_time_cost_per_result\n \n as \n \n real_time_cost_per_result\n \n, \n \n \n real_time_result\n \n as \n \n real_time_result\n \n, \n \n \n real_time_result_rate\n \n as \n \n real_time_result_rate\n \n, \n \n \n result\n \n as \n \n result\n \n, \n \n \n result_rate\n \n as \n \n result_rate\n \n, \n \n \n secondary_goal_result\n \n as \n \n secondary_goal_result\n \n, \n \n \n secondary_goal_result_rate\n \n as \n \n secondary_goal_result_rate\n \n, \n \n \n shares\n \n as \n \n shares\n \n, \n \n \n spend\n \n as \n \n spend\n \n, \n \n \n stat_time_hour\n \n as \n \n stat_time_hour\n \n, \n \n \n video_play_actions\n \n as \n \n video_play_actions\n \n, \n \n \n video_views_p_100\n \n as \n \n video_views_p_100\n \n, \n \n \n video_views_p_25\n \n as \n \n video_views_p_25\n \n, \n \n \n video_views_p_50\n \n as \n \n video_views_p_50\n \n, \n \n \n video_views_p_75\n \n as \n \n video_views_p_75\n \n, \n \n \n video_watched_2_s\n \n as \n \n video_watched_2_s\n \n, \n \n \n video_watched_6_s\n \n as \n \n video_watched_6_s\n \n\n\n\n\n from base\n\n), \n\nfinal as (\n\n select \n adgroup_id as ad_group_id, \n _fivetran_synced,\n stat_time_hour, \n cpc, \n cpm, \n ctr, \n impressions, \n clicks, \n spend, \n reach, \n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n from fields\n\n) \n\nselect * from final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_group_report_hourly"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__ad_group_history_tmp') }}\n\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__ad_group_history_tmp')),\n staging_columns=get_ad_group_history_columns()\n )\n }}\n\n from base\n\n), \n\nfinal as (\n\n select \n adgroup_id as ad_group_id,\n updated_at,\n advertiser_id,\n campaign_id,\n action_days,\n action_categories,\n adgroup_name as ad_group_name,\n age,\n audience_type,\n budget,\n category,\n display_name,\n interest_category_v_2 as interest_category,\n frequency,\n frequency_schedule,\n gender,\n languages, \n landing_page_url,\n _fivetran_synced\n from fields\n\n), \n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by ad_group_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n\n)\n\nselect * from most_recent", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_ad_group_history_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__ad_group_history"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__ad_group_history.sql", "original_file_path": "models/stg_tiktok_ads__ad_group_history.sql", "name": "stg_tiktok_ads__ad_group_history", "alias": "stg_tiktok_ads__ad_group_history", "checksum": {"name": "sha256", "checksum": "fec58c41aa34a9db325a85b70bb4c4b3bccedced9975d51d1f4e857b8894ae50"}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_history_tmp"], ["stg_tiktok_ads__ad_group_history_tmp"]], "sources": [], "description": "Each record represents data for each ad group.", "columns": {"ad_group_id": {"name": "ad_group_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_categories": {"name": "action_categories", "description": "IDs of the action categories (behaviors) that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The Ad group's campaign ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_days": {"name": "action_days", "description": "Action days", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "Ad group name. Character limit is 512 and cannot contain emoji.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "age": {"name": "age", "description": "Age groups you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience_type": {"name": "audience_type", "description": "Audience Type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget": {"name": "budget", "description": "Ad budget. Returns 0.0 when Campaign Budget Optimization (budget_optimize_switch) is on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "category": {"name": "category", "description": "Ad group category.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "display_name": {"name": "display_name", "description": "Display name of ad group.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "interest_category": {"name": "interest_category", "description": "Interest classification. If the interest is specified, users that do not meet interest target will be excluded during delivery.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency": {"name": "frequency", "description": "frequency, together with frequency_schedule, controls how often people see your ad (only available for REACH ads). For example, frequency = 2 frequency_schedule = 3 means \"show ads no more than twice every 3 day\".\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency_schedule": {"name": "frequency_schedule", "description": "frequency, together with frequency, controls how often people see your ad (only available for REACH ads).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "languages": {"name": "languages", "description": "Codes of the languages that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__ad_group_history.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1641494963.295321, "compiled_sql": "with base as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_group_history_tmp\n\n), \n\nfields as (\n\n select\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n action_days\n \n as \n \n action_days\n \n, \n \n \n adgroup_id\n \n as \n \n adgroup_id\n \n, \n \n \n adgroup_name\n \n as \n \n adgroup_name\n \n, \n \n \n advertiser_id\n \n as \n \n advertiser_id\n \n, \n \n \n android_osv\n \n as \n \n android_osv\n \n, \n \n \n app_download_url\n \n as \n \n app_download_url\n \n, \n \n \n app_id\n \n as \n \n app_id\n \n, \n \n \n app_name\n \n as \n \n app_name\n \n, \n \n \n app_type\n \n as \n \n app_type\n \n, \n \n \n audience_type\n \n as \n \n audience_type\n \n, \n \n \n bid\n \n as \n \n bid\n \n, \n \n \n bid_type\n \n as \n \n bid_type\n \n, \n \n \n billing_event\n \n as \n \n billing_event\n \n, \n \n \n budget\n \n as \n \n budget\n \n, \n \n \n budget_mode\n \n as \n \n budget_mode\n \n, \n \n \n campaign_id\n \n as \n \n campaign_id\n \n, \n \n \n category\n \n as \n \n category\n \n, \n \n \n click_tracking_url\n \n as \n \n click_tracking_url\n \n, \n \n \n conversion_bid\n \n as \n \n conversion_bid\n \n, \n \n \n cpv_video_duration\n \n as \n \n cpv_video_duration\n \n, \n \n \n create_time\n \n as \n \n create_time\n \n, \n \n \n creative_material_mode\n \n as \n \n creative_material_mode\n \n, \n \n \n dayparting\n \n as \n \n dayparting\n \n, \n \n \n deep_bid_type\n \n as \n \n deep_bid_type\n \n, \n \n \n deep_cpabid\n \n as \n \n deep_cpabid\n \n, \n \n \n deep_external_action\n \n as \n \n deep_external_action\n \n, \n \n \n display_name\n \n as \n \n display_name\n \n, \n \n \n enable_inventory_filter\n \n as \n \n enable_inventory_filter\n \n, \n \n \n external_action\n \n as \n \n external_action\n \n, \n \n \n fallback_type\n \n as \n \n fallback_type\n \n, \n \n \n frequency\n \n as \n \n frequency\n \n, \n \n \n frequency_schedule\n \n as \n \n frequency_schedule\n \n, \n \n \n gender\n \n as \n \n gender\n \n, \n \n \n impression_tracking_url\n \n as \n \n impression_tracking_url\n \n, \n \n \n ios_osv\n \n as \n \n ios_osv\n \n, \n \n \n is_comment_disable\n \n as \n \n is_comment_disable\n \n, \n \n \n is_hfss\n \n as \n \n is_hfss\n \n, \n \n \n is_new_structure\n \n as \n \n is_new_structure\n \n, \n \n \n landing_page_url\n \n as \n \n landing_page_url\n \n, \n \n \n open_url\n \n as \n \n open_url\n \n, \n \n \n open_url_type\n \n as \n \n open_url_type\n \n, \n \n \n opt_status\n \n as \n \n opt_status\n \n, \n \n \n optimize_goal\n \n as \n \n optimize_goal\n \n, \n \n \n pacing\n \n as \n \n pacing\n \n, \n \n \n package\n \n as \n \n package\n \n, \n \n \n pixel_id\n \n as \n \n pixel_id\n \n, \n \n \n placement_type\n \n as \n \n placement_type\n \n, \n \n \n profile_image\n \n as \n \n profile_image\n \n, \n \n \n schedule_end_time\n \n as \n \n schedule_end_time\n \n, \n \n \n schedule_start_time\n \n as \n \n schedule_start_time\n \n, \n \n \n schedule_type\n \n as \n \n schedule_type\n \n, \n \n \n skip_learning_phase\n \n as \n \n skip_learning_phase\n \n, \n \n \n statistic_type\n \n as \n \n statistic_type\n \n, \n \n \n status\n \n as \n \n status\n \n, \n \n \n updated_at\n \n as \n \n updated_at\n \n, \n \n \n video_download\n \n as \n \n video_download\n \n, \n \n \n audience\n \n as \n \n audience\n \n, \n \n \n excluded_audience\n \n as \n \n excluded_audience\n \n, \n \n \n location\n \n as \n \n location\n \n, \n \n \n interest_category_v_2\n \n as \n \n interest_category_v_2\n \n, \n \n \n pangle_block_app_list_id\n \n as \n \n pangle_block_app_list_id\n \n, \n \n \n action_categories\n \n as \n \n action_categories\n \n, \n \n \n placement\n \n as \n \n placement\n \n, \n \n \n keywords\n \n as \n \n keywords\n \n, \n \n \n age\n \n as \n \n age\n \n, \n \n \n languages\n \n as \n \n languages\n \n\n\n\n\n from base\n\n), \n\nfinal as (\n\n select \n adgroup_id as ad_group_id,\n updated_at,\n advertiser_id,\n campaign_id,\n action_days,\n action_categories,\n adgroup_name as ad_group_name,\n age,\n audience_type,\n budget,\n category,\n display_name,\n interest_category_v_2 as interest_category,\n frequency,\n frequency_schedule,\n gender,\n languages, \n landing_page_url,\n _fivetran_synced\n from fields\n\n), \n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by ad_group_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n\n)\n\nselect * from most_recent", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_group_history"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__ad_report_hourly_tmp') }}\n\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__ad_report_hourly_tmp')),\n staging_columns=get_ad_report_hourly_columns()\n )\n }}\n\n from base\n\n), \n\nfinal as (\n\n select \n ad_id, \n _fivetran_synced,\n stat_time_hour, \n cpc, \n cpm, \n ctr, \n impressions, \n clicks, \n spend, \n reach, \n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n from fields\n\n)\n\nselect * from final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_ad_report_hourly_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__ad_report_hourly"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__ad_report_hourly.sql", "original_file_path": "models/stg_tiktok_ads__ad_report_hourly.sql", "name": "stg_tiktok_ads__ad_report_hourly", "alias": "stg_tiktok_ads__ad_report_hourly", "checksum": {"name": "sha256", "checksum": "82f448fb9abd66a79b6a316fe415293e9071e3e69f9efc3263f17aa94e597a8e"}, "tags": [], "refs": [["stg_tiktok_ads__ad_report_hourly_tmp"], ["stg_tiktok_ads__ad_report_hourly_tmp"]], "sources": [], "description": "Each record represents data for each ad for each hour.", "columns": {"ad_id": {"name": "ad_id", "description": "Ad id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time per user your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__ad_report_hourly.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1641494963.3143392, "compiled_sql": "with base as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_report_hourly_tmp\n\n), \n\nfields as (\n\n select\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n ad_id\n \n as \n \n ad_id\n \n, \n \n \n average_video_play\n \n as \n \n average_video_play\n \n, \n \n \n average_video_play_per_user\n \n as \n \n average_video_play_per_user\n \n, \n \n \n clicks\n \n as \n \n clicks\n \n, \n \n \n comments\n \n as \n \n comments\n \n, \n \n \n conversion\n \n as \n \n conversion\n \n, \n \n \n conversion_rate\n \n as \n \n conversion_rate\n \n, \n \n \n cost_per_1000_reached\n \n as \n \n cost_per_1000_reached\n \n, \n \n \n cost_per_conversion\n \n as \n \n cost_per_conversion\n \n, \n \n \n cost_per_result\n \n as \n \n cost_per_result\n \n, \n \n \n cost_per_secondary_goal_result\n \n as \n \n cost_per_secondary_goal_result\n \n, \n \n \n cpc\n \n as \n \n cpc\n \n, \n \n \n cpm\n \n as \n \n cpm\n \n, \n \n \n ctr\n \n as \n \n ctr\n \n, \n \n \n follows\n \n as \n \n follows\n \n, \n \n \n impressions\n \n as \n \n impressions\n \n, \n \n \n likes\n \n as \n \n likes\n \n, \n \n \n profile_visits\n \n as \n \n profile_visits\n \n, \n \n \n profile_visits_rate\n \n as \n \n profile_visits_rate\n \n, \n \n \n reach\n \n as \n \n reach\n \n, \n \n \n real_time_conversion\n \n as \n \n real_time_conversion\n \n, \n \n \n real_time_conversion_rate\n \n as \n \n real_time_conversion_rate\n \n, \n \n \n real_time_cost_per_conversion\n \n as \n \n real_time_cost_per_conversion\n \n, \n \n \n real_time_cost_per_result\n \n as \n \n real_time_cost_per_result\n \n, \n \n \n real_time_result\n \n as \n \n real_time_result\n \n, \n \n \n real_time_result_rate\n \n as \n \n real_time_result_rate\n \n, \n \n \n result\n \n as \n \n result\n \n, \n \n \n result_rate\n \n as \n \n result_rate\n \n, \n \n \n secondary_goal_result\n \n as \n \n secondary_goal_result\n \n, \n \n \n secondary_goal_result_rate\n \n as \n \n secondary_goal_result_rate\n \n, \n \n \n shares\n \n as \n \n shares\n \n, \n \n \n spend\n \n as \n \n spend\n \n, \n \n \n stat_time_hour\n \n as \n \n stat_time_hour\n \n, \n \n \n video_play_actions\n \n as \n \n video_play_actions\n \n, \n \n \n video_views_p_100\n \n as \n \n video_views_p_100\n \n, \n \n \n video_views_p_25\n \n as \n \n video_views_p_25\n \n, \n \n \n video_views_p_50\n \n as \n \n video_views_p_50\n \n, \n \n \n video_views_p_75\n \n as \n \n video_views_p_75\n \n, \n \n \n video_watched_2_s\n \n as \n \n video_watched_2_s\n \n, \n \n \n video_watched_6_s\n \n as \n \n video_watched_6_s\n \n\n\n\n\n from base\n\n), \n\nfinal as (\n\n select \n ad_id, \n _fivetran_synced,\n stat_time_hour, \n cpc, \n cpm, \n ctr, \n impressions, \n clicks, \n spend, \n reach, \n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n from fields\n\n)\n\nselect * from final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_report_hourly"}, "model.tiktok_ads_source.stg_tiktok_ads__advertiser": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__advertiser_tmp') }}\n\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__advertiser_tmp')),\n staging_columns=get_advertiser_columns()\n )\n }}\n\n from base\n\n), \n\nfinal as (\n\n select \n id as advertiser_id, \n address, \n balance, \n company, \n contacter, \n country, \n currency, \n description, \n email, \n industry, \n language,\n name, \n phone_number, \n telephone, \n timezone,\n _fivetran_synced\n from fields\n\n)\n\nselect * from final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_advertiser_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp", "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__advertiser"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__advertiser.sql", "original_file_path": "models/stg_tiktok_ads__advertiser.sql", "name": "stg_tiktok_ads__advertiser", "alias": "stg_tiktok_ads__advertiser", "checksum": {"name": "sha256", "checksum": "d08aa841b6e9c3caafbeda3d434b2f2a28cfe7125af96ec7cdcbf5e058b77bba"}, "tags": [], "refs": [["stg_tiktok_ads__advertiser_tmp"], ["stg_tiktok_ads__advertiser_tmp"]], "sources": [], "description": "Each record represents data for each advertiser.", "columns": {"advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "address": {"name": "address", "description": "Advertiser address information", "meta": {}, "data_type": null, "quote": null, "tags": []}, "balance": {"name": "balance", "description": "Account available balance", "meta": {}, "data_type": null, "quote": null, "tags": []}, "company": {"name": "company", "description": "Advertiser's company name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "contacter": {"name": "contacter", "description": "Contact Person", "meta": {}, "data_type": null, "quote": null, "tags": []}, "country": {"name": "country", "description": "The advertiser's country", "meta": {}, "data_type": null, "quote": null, "tags": []}, "create_time": {"name": "create_time", "description": "Advertiser's create time", "meta": {}, "data_type": null, "quote": null, "tags": []}, "currency": {"name": "currency", "description": "Type of currency used by advertisers", "meta": {}, "data_type": null, "quote": null, "tags": []}, "description": {"name": "description", "description": "Brand description, i.e. promotional content", "meta": {}, "data_type": null, "quote": null, "tags": []}, "email": {"name": "email", "description": "Advertiser contact email, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "industry": {"name": "industry", "description": "Advertiser industry category", "meta": {}, "data_type": null, "quote": null, "tags": []}, "language": {"name": "language", "description": "Language used by advertisers", "meta": {}, "data_type": null, "quote": null, "tags": []}, "license_no": {"name": "license_no", "description": "License number", "meta": {}, "data_type": null, "quote": null, "tags": []}, "license_url": {"name": "license_url", "description": "License preview address, the link is valid for an hour by default.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "Advertiser name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "phone_number": {"name": "phone_number", "description": "Contact mobile number, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "telephone": {"name": "telephone", "description": "Fixed phone number, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "timezone": {"name": "timezone", "description": "Ad account time zone including GMT offset", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__advertiser.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1641494963.288278, "compiled_sql": "with base as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__advertiser_tmp\n\n), \n\nfields as (\n\n select\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n address\n \n as \n \n address\n \n, \n \n \n balance\n \n as \n \n balance\n \n, \n \n \n company\n \n as \n \n company\n \n, \n \n \n contacter\n \n as \n \n contacter\n \n, \n \n \n country\n \n as \n \n country\n \n, \n \n \n create_time\n \n as \n \n create_time\n \n, \n \n \n currency\n \n as \n \n currency\n \n, \n \n \n description\n \n as \n \n description\n \n, \n \n \n email\n \n as \n \n email\n \n, \n \n \n id\n \n as \n \n id\n \n, \n \n \n industry\n \n as \n \n industry\n \n, \n \n \n language\n \n as \n \n language\n \n, \n \n \n license_no\n \n as \n \n license_no\n \n, \n \n \n license_url\n \n as \n \n license_url\n \n, \n \n \n name\n \n as \n \n name\n \n, \n \n \n phone_number\n \n as \n \n phone_number\n \n, \n \n \n promotion_area\n \n as \n \n promotion_area\n \n, \n \n \n reason\n \n as \n \n reason\n \n, \n \n \n role\n \n as \n \n role\n \n, \n \n \n status\n \n as \n \n status\n \n, \n \n \n telephone\n \n as \n \n telephone\n \n, \n \n \n timezone\n \n as \n \n timezone\n \n\n\n\n\n from base\n\n), \n\nfinal as (\n\n select \n id as advertiser_id, \n address, \n balance, \n company, \n contacter, \n country, \n currency, \n description, \n email, \n industry, \n language,\n name, \n phone_number, \n telephone, \n timezone,\n _fivetran_synced\n from fields\n\n)\n\nselect * from final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__advertiser"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_history": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__ad_history_tmp') }}\n\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__ad_history_tmp')),\n staging_columns=get_ad_history_columns()\n )\n }}\n\n from base\n\n), \n\nfinal as (\n\n select \n ad_id,\n updated_at,\n adgroup_id as ad_group_id,\n advertiser_id,\n campaign_id,\n ad_name,\n ad_text,\n call_to_action,\n click_tracking_url,\n impression_tracking_url,\n {{ dbt_utils.split_part('landing_page_url', \"'?'\", 1) }} as base_url,\n {{ dbt_utils.get_url_host('landing_page_url') }} as url_host,\n '/' || {{ dbt_utils.get_url_path('landing_page_url') }} as url_path,\n {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_source') }} as utm_source,\n {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_medium') }} as utm_medium,\n {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_campaign') }} as utm_campaign,\n {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_content') }} as utm_content,\n {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_term') }} as utm_term,\n landing_page_url,\n video_id,\n _fivetran_synced\n from fields\n\n), \n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by ad_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n\n)\n\nselect * from most_recent", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_ad_history_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.split_part", "macro.dbt_utils.get_url_host", "macro.dbt_utils.get_url_path", "macro.dbt_utils.get_url_parameter"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__ad_history"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__ad_history.sql", "original_file_path": "models/stg_tiktok_ads__ad_history.sql", "name": "stg_tiktok_ads__ad_history", "alias": "stg_tiktok_ads__ad_history", "checksum": {"name": "sha256", "checksum": "36dbbea796f81ff945ef25646a72206fa1dad9457d517f898636cca44c3b670b"}, "tags": [], "refs": [["stg_tiktok_ads__ad_history_tmp"], ["stg_tiktok_ads__ad_history_tmp"]], "sources": [], "description": "Each record represents data for each ad.", "columns": {"ad_id": {"name": "ad_id", "description": "Ad ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "base_url": {"name": "base_url", "description": "The base URL of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_name": {"name": "ad_name", "description": "Ad Name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_text": {"name": "ad_text", "description": "The ad text.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "call_to_action": {"name": "call_to_action", "description": "Call to action values.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "click_tracking_url": {"name": "click_tracking_url", "description": "Click monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impression_tracking_url": {"name": "impression_tracking_url", "description": "Display monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_host": {"name": "url_host", "description": "The URL host of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_path": {"name": "url_path", "description": "The URL path of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_source": {"name": "utm_source", "description": "The utm_source parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_medium": {"name": "utm_medium", "description": "The utm_medium parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_campaign": {"name": "utm_campaign", "description": "The utm_campaign parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_content": {"name": "utm_content", "description": "The utm_content parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_term": {"name": "utm_term", "description": "The utm_term parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_id": {"name": "video_id", "description": "The video ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__ad_history.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1641494963.3025, "compiled_sql": "with base as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_history_tmp\n\n), \n\nfields as (\n\n select\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n ad_id\n \n as \n \n ad_id\n \n, \n \n \n ad_name\n \n as \n \n ad_name\n \n, \n \n \n ad_text\n \n as \n \n ad_text\n \n, \n \n \n adgroup_id\n \n as \n \n adgroup_id\n \n, \n \n \n advertiser_id\n \n as \n \n advertiser_id\n \n, \n \n \n app_name\n \n as \n \n app_name\n \n, \n \n \n call_to_action\n \n as \n \n call_to_action\n \n, \n \n \n campaign_id\n \n as \n \n campaign_id\n \n, \n \n \n click_tracking_url\n \n as \n \n click_tracking_url\n \n, \n \n \n create_time\n \n as \n \n create_time\n \n, \n \n \n display_name\n \n as \n \n display_name\n \n, \n \n \n impression_tracking_url\n \n as \n \n impression_tracking_url\n \n, \n \n \n is_aco\n \n as \n \n is_aco\n \n, \n \n \n is_creative_authorized\n \n as \n \n is_creative_authorized\n \n, \n \n \n is_new_structure\n \n as \n \n is_new_structure\n \n, \n \n \n landing_page_url\n \n as \n \n landing_page_url\n \n, \n \n \n open_url\n \n as \n \n open_url\n \n, \n \n \n opt_status\n \n as \n \n opt_status\n \n, \n \n \n playable_url\n \n as \n \n playable_url\n \n, \n \n \n profile_image\n \n as \n \n profile_image\n \n, \n \n \n status\n \n as \n \n status\n \n, \n \n \n updated_at\n \n as \n \n updated_at\n \n, \n \n \n video_id\n \n as \n \n video_id\n \n, \n \n \n image_ids\n \n as \n \n image_ids\n \n\n\n\n\n from base\n\n), \n\nfinal as (\n\n select \n ad_id,\n updated_at,\n adgroup_id as ad_group_id,\n advertiser_id,\n campaign_id,\n ad_name,\n ad_text,\n call_to_action,\n click_tracking_url,\n impression_tracking_url,\n \n\n split_part(\n landing_page_url,\n '?',\n 1\n )\n\n as base_url,\n \n try_cast(\n\n split_part(\n \n\n split_part(\n \n\n replace(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'android-app://',\n ''\n )\n \n\n,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n '/',\n 1\n )\n\n,\n '?',\n 1\n )\n\n as \n varchar\n)\n as url_host,\n '/' || \n try_cast(\n\n split_part(\n \n\n case when \n \n length(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n\n )-coalesce(\n nullif(\n\n position(\n '/' in \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n\n ), 0),\n \n\n position(\n '?' in \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n\n ) - 1\n ) = 0 \n then ''\n else \n right(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n \n \n length(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n\n )-coalesce(\n nullif(\n\n position(\n '/' in \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n\n ), 0),\n \n\n position(\n '?' in \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n\n ) - 1\n )\n )\n end,\n '?',\n 1\n )\n\n as \n varchar\n)\n as url_path,\n nullif(\n\n split_part(\n \n\n split_part(\n landing_page_url,\n 'utm_source=',\n 2\n )\n\n,\n '&',\n 1\n )\n\n,'') as utm_source,\n nullif(\n\n split_part(\n \n\n split_part(\n landing_page_url,\n 'utm_medium=',\n 2\n )\n\n,\n '&',\n 1\n )\n\n,'') as utm_medium,\n nullif(\n\n split_part(\n \n\n split_part(\n landing_page_url,\n 'utm_campaign=',\n 2\n )\n\n,\n '&',\n 1\n )\n\n,'') as utm_campaign,\n nullif(\n\n split_part(\n \n\n split_part(\n landing_page_url,\n 'utm_content=',\n 2\n )\n\n,\n '&',\n 1\n )\n\n,'') as utm_content,\n nullif(\n\n split_part(\n \n\n split_part(\n landing_page_url,\n 'utm_term=',\n 2\n )\n\n,\n '&',\n 1\n )\n\n,'') as utm_term,\n landing_page_url,\n video_id,\n _fivetran_synced\n from fields\n\n), \n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by ad_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n\n)\n\nselect * from most_recent", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_history"}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_history": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__campaign_history_tmp') }}\n\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__campaign_history_tmp')),\n staging_columns=get_campaign_history_columns()\n )\n }}\n \n from base\n\n), \n\nfinal as (\n\n select \n campaign_id, \n updated_at, \n advertiser_id, \n campaign_name, \n campaign_type, \n split_test_variable,\n _fivetran_synced\n\n from fields\n\n), \n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by campaign_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n\n)\n\nselect * from most_recent", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_campaign_history_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__campaign_history"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__campaign_history.sql", "original_file_path": "models/stg_tiktok_ads__campaign_history.sql", "name": "stg_tiktok_ads__campaign_history", "alias": "stg_tiktok_ads__campaign_history", "checksum": {"name": "sha256", "checksum": "2685bb5e20197c818e6ff099ebc82f5ec5e30add421f8f6e4406985ffd05252e"}, "tags": [], "refs": [["stg_tiktok_ads__campaign_history_tmp"], ["stg_tiktok_ads__campaign_history_tmp"]], "sources": [], "description": "Each record represents data for each campaign.", "columns": {"campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_type": {"name": "campaign_type", "description": "Campaign Type, indicates the campaign is a regular campaign or iOS 14 campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "split_test_variable": {"name": "split_test_variable", "description": "Split Test variables. Optional values; TARGETING, BIDDING_OPTIMIZATION , CREATIVE.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__campaign_history.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1641494963.305564, "compiled_sql": "with base as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__campaign_history_tmp\n\n), \n\nfields as (\n\n select\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n advertiser_id\n \n as \n \n advertiser_id\n \n, \n \n \n budget\n \n as \n \n budget\n \n, \n \n \n budget_mode\n \n as \n \n budget_mode\n \n, \n \n \n campaign_id\n \n as \n \n campaign_id\n \n, \n \n \n campaign_name\n \n as \n \n campaign_name\n \n, \n \n \n campaign_type\n \n as \n \n campaign_type\n \n, \n \n \n create_time\n \n as \n \n create_time\n \n, \n \n \n is_new_structure\n \n as \n \n is_new_structure\n \n, \n \n \n objective_type\n \n as \n \n objective_type\n \n, \n \n \n opt_status\n \n as \n \n opt_status\n \n, \n \n \n split_test_variable\n \n as \n \n split_test_variable\n \n, \n \n \n updated_at\n \n as \n \n updated_at\n \n\n\n\n \n from base\n\n), \n\nfinal as (\n\n select \n campaign_id, \n updated_at, \n advertiser_id, \n campaign_name, \n campaign_type, \n split_test_variable,\n _fivetran_synced\n\n from fields\n\n), \n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by campaign_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n\n)\n\nselect * from most_recent", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__campaign_history"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp": {"raw_sql": "select *\nfrom {{ var('ad_report_hourly') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.tiktok_ads_source.tiktok_ads.ad_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__ad_report_hourly_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__ad_report_hourly_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__ad_report_hourly_tmp.sql", "name": "stg_tiktok_ads__ad_report_hourly_tmp", "alias": "stg_tiktok_ads__ad_report_hourly_tmp", "checksum": {"name": "sha256", "checksum": "a487182a6ea56715aff4fb53a16e8e185223097096f8b06c53beeaf354bffb3f"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "ad_report_hourly"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_report_hourly_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1641494963.043583, "compiled_sql": "select *\nfrom MB_TIKTOK_ADS.TIKTOK_ADS.ad_report_hourly", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_report_hourly_tmp"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp": {"raw_sql": "select *\nfrom {{ var('ad_history') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.tiktok_ads_source.tiktok_ads.ad_history"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__ad_history_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__ad_history_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__ad_history_tmp.sql", "name": "stg_tiktok_ads__ad_history_tmp", "alias": "stg_tiktok_ads__ad_history_tmp", "checksum": {"name": "sha256", "checksum": "a57ca2d986b3dbad7d2bbd8b0a0dd7c992c25bc5cda65daee19e3541f40b6890"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "ad_history"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_history_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1641494963.0503821, "compiled_sql": "select *\nfrom MB_TIKTOK_ADS.TIKTOK_ADS.ad_history", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_history_tmp"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp": {"raw_sql": "select *\nfrom {{ var('ad_group_history') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.tiktok_ads_source.tiktok_ads.adgroup_history"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__ad_group_history_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__ad_group_history_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__ad_group_history_tmp.sql", "name": "stg_tiktok_ads__ad_group_history_tmp", "alias": "stg_tiktok_ads__ad_group_history_tmp", "checksum": {"name": "sha256", "checksum": "b3d1b8772b0465ed063cfa1f77cb9384475c21fa4ac9f970065e3da5c327ad1a"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "adgroup_history"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_group_history_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1641494963.055097, "compiled_sql": "select *\nfrom MB_TIKTOK_ADS.TIKTOK_ADS.adgroup_history", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_group_history_tmp"}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp": {"raw_sql": "select *\nfrom {{ var('campaign_report_hourly') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.tiktok_ads_source.tiktok_ads.campaign_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__campaign_report_hourly_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__campaign_report_hourly_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__campaign_report_hourly_tmp.sql", "name": "stg_tiktok_ads__campaign_report_hourly_tmp", "alias": "stg_tiktok_ads__campaign_report_hourly_tmp", "checksum": {"name": "sha256", "checksum": "198e8d143514167295dfe352776c5050850cb7bc60e46b122a6a0a0da08a14ce"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "campaign_report_hourly"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__campaign_report_hourly_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1641494963.059669, "compiled_sql": "select *\nfrom MB_TIKTOK_ADS.TIKTOK_ADS.campaign_report_hourly", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__campaign_report_hourly_tmp"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp": {"raw_sql": "select *\nfrom {{ var('ad_group_hourly') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__ad_group_report_hourly_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__ad_group_report_hourly_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__ad_group_report_hourly_tmp.sql", "name": "stg_tiktok_ads__ad_group_report_hourly_tmp", "alias": "stg_tiktok_ads__ad_group_report_hourly_tmp", "checksum": {"name": "sha256", "checksum": "187c3f6f290dd9846646843a108714a51fff1700c838c4c7e58852db64a1edfd"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "adgroup_report_hourly"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_group_report_hourly_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1641494963.064565, "compiled_sql": "select *\nfrom MB_TIKTOK_ADS.TIKTOK_ADS.adgroup_report_hourly", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_group_report_hourly_tmp"}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp": {"raw_sql": "select *\nfrom {{ var('campaign_history') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.tiktok_ads_source.tiktok_ads.campaign_history"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__campaign_history_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__campaign_history_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__campaign_history_tmp.sql", "name": "stg_tiktok_ads__campaign_history_tmp", "alias": "stg_tiktok_ads__campaign_history_tmp", "checksum": {"name": "sha256", "checksum": "d695c134485444137d663f41732085a5cfa81de49f3ec2676e9f8e58f1c62c02"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "campaign_history"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__campaign_history_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1641494963.0696409, "compiled_sql": "select *\nfrom MB_TIKTOK_ADS.TIKTOK_ADS.campaign_history", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__campaign_history_tmp"}, "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp": {"raw_sql": "select *\nfrom {{ var('advertiser') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.tiktok_ads_source.tiktok_ads.advertiser"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__advertiser_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__advertiser_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__advertiser_tmp.sql", "name": "stg_tiktok_ads__advertiser_tmp", "alias": "stg_tiktok_ads__advertiser_tmp", "checksum": {"name": "sha256", "checksum": "2806a63477df7962ac6a4476e3e514a47ae56470e95f490e88b58696a99c2fcf"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "advertiser"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__advertiser_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1641494963.074822, "compiled_sql": "select *\nfrom MB_TIKTOK_ADS.TIKTOK_ADS.advertiser", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__advertiser_tmp"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_adapter_ad_id__date_day.c70f86f560": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_9db65ce81760c299942d65ab5e7e6d4e\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_id", "date_day"], "model": "{{ get_where_subquery(ref('tiktok_ads__ad_adapter')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__ad_adapter"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_9db65ce81760c299942d65ab5e7e6d4e", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_dbt_test__audit", "fqn": ["tiktok_ads", "dbt_utils_unique_combination_of_columns_tiktok_ads__ad_adapter_ad_id__date_day"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_adapter_ad_id__date_day.c70f86f560", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_9db65ce81760c299942d65ab5e7e6d4e.sql", "original_file_path": "models/tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_tiktok_ads__ad_adapter_ad_id__date_day", "alias": "dbt_utils_unique_combination_o_9db65ce81760c299942d65ab5e7e6d4e", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__ad_adapter"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/dbt_utils_unique_combination_o_9db65ce81760c299942d65ab5e7e6d4e.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_9db65ce81760c299942d65ab5e7e6d4e"}, "created_at": 1641494963.127171, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n ad_id, date_day\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_tiktok_ads.tiktok_ads__ad_adapter\n group by ad_id, date_day\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.tiktok_ads__ad_adapter"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day.2eb4c2ff6d": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_72fdc194de3164f205583879773e492a\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_group_id", "date_day"], "model": "{{ get_where_subquery(ref('tiktok_ads__ad_group_report')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__ad_group_report"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_72fdc194de3164f205583879773e492a", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_dbt_test__audit", "fqn": ["tiktok_ads", "dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day.2eb4c2ff6d", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_72fdc194de3164f205583879773e492a.sql", "original_file_path": "models/tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day", "alias": "dbt_utils_unique_combination_o_72fdc194de3164f205583879773e492a", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__ad_group_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/dbt_utils_unique_combination_o_72fdc194de3164f205583879773e492a.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_72fdc194de3164f205583879773e492a"}, "created_at": 1641494963.139424, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n ad_group_id, date_day\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_tiktok_ads.tiktok_ads__ad_group_report\n group by ad_group_id, date_day\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.tiktok_ads__ad_group_report"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day.cc5f756c69": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_48804305b042fff8fc9179671c157c13\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["campaign_id", "date_day"], "model": "{{ get_where_subquery(ref('tiktok_ads__campaign_report')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__campaign_report"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_48804305b042fff8fc9179671c157c13", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_dbt_test__audit", "fqn": ["tiktok_ads", "dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day.cc5f756c69", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_48804305b042fff8fc9179671c157c13.sql", "original_file_path": "models/tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day", "alias": "dbt_utils_unique_combination_o_48804305b042fff8fc9179671c157c13", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__campaign_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/dbt_utils_unique_combination_o_48804305b042fff8fc9179671c157c13.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_48804305b042fff8fc9179671c157c13"}, "created_at": 1641494963.143913, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n campaign_id, date_day\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_tiktok_ads.tiktok_ads__campaign_report\n group by campaign_id, date_day\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.tiktok_ads__campaign_report"}, "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.fcb8c561bc": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_group_id", "model": "{{ get_where_subquery(ref('int_tiktok_ads__most_recent_ad_group')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad_group"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_dbt_test__audit", "fqn": ["tiktok_ads", "intermediate", "not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id"], "unique_id": "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.fcb8c561bc", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.sql", "original_file_path": "models/intermediate/intermediate.yml", "name": "not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id", "alias": "not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["int_tiktok_ads__most_recent_ad_group"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/intermediate/intermediate.yml/not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1641494963.16583, "compiled_sql": "\n \n \n\nwith __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_group_history\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)select *\nfrom __dbt__cte__int_tiktok_ads__most_recent_ad_group\nwhere ad_group_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_group_history\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": null, "column_name": "ad_group_id", "file_key_name": "models.int_tiktok_ads__most_recent_ad_group"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at.e2e9914076": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_7aae7967f01788b5ccce56d37f64c75b\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_group_id", "updated_at"], "model": "{{ get_where_subquery(ref('int_tiktok_ads__most_recent_ad_group')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad_group"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_7aae7967f01788b5ccce56d37f64c75b", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_dbt_test__audit", "fqn": ["tiktok_ads", "intermediate", "dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at.e2e9914076", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_7aae7967f01788b5ccce56d37f64c75b.sql", "original_file_path": "models/intermediate/intermediate.yml", "name": "dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at", "alias": "dbt_utils_unique_combination_o_7aae7967f01788b5ccce56d37f64c75b", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["int_tiktok_ads__most_recent_ad_group"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/intermediate/intermediate.yml/dbt_utils_unique_combination_o_7aae7967f01788b5ccce56d37f64c75b.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_7aae7967f01788b5ccce56d37f64c75b"}, "created_at": 1641494963.167509, "compiled_sql": "\n\n\n\n\n\nwith __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_group_history\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n),validation_errors as (\n\n select\n ad_group_id, updated_at\n from __dbt__cte__int_tiktok_ads__most_recent_ad_group\n group by ad_group_id, updated_at\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_group_history\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": null, "column_name": null, "file_key_name": "models.int_tiktok_ads__most_recent_ad_group"}, "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_ad_id.14e9c145ca": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_id", "model": "{{ get_where_subquery(ref('int_tiktok_ads__most_recent_ad')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_dbt_test__audit", "fqn": ["tiktok_ads", "intermediate", "not_null_int_tiktok_ads__most_recent_ad_ad_id"], "unique_id": "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_ad_id.14e9c145ca", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_int_tiktok_ads__most_recent_ad_ad_id.sql", "original_file_path": "models/intermediate/intermediate.yml", "name": "not_null_int_tiktok_ads__most_recent_ad_ad_id", "alias": "not_null_int_tiktok_ads__most_recent_ad_ad_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["int_tiktok_ads__most_recent_ad"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/intermediate/intermediate.yml/not_null_int_tiktok_ads__most_recent_ad_ad_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1641494963.172527, "compiled_sql": "\n \n \n\nwith __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_history\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)select *\nfrom __dbt__cte__int_tiktok_ads__most_recent_ad\nwhere ad_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_history\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": null, "column_name": "ad_id", "file_key_name": "models.int_tiktok_ads__most_recent_ad"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at.f58d824f65": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_82db7b1c335645aabf3916a22992c42a\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_id", "updated_at"], "model": "{{ get_where_subquery(ref('int_tiktok_ads__most_recent_ad')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_82db7b1c335645aabf3916a22992c42a", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_dbt_test__audit", "fqn": ["tiktok_ads", "intermediate", "dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at.f58d824f65", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_82db7b1c335645aabf3916a22992c42a.sql", "original_file_path": "models/intermediate/intermediate.yml", "name": "dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at", "alias": "dbt_utils_unique_combination_o_82db7b1c335645aabf3916a22992c42a", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["int_tiktok_ads__most_recent_ad"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/intermediate/intermediate.yml/dbt_utils_unique_combination_o_82db7b1c335645aabf3916a22992c42a.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_82db7b1c335645aabf3916a22992c42a"}, "created_at": 1641494963.1743948, "compiled_sql": "\n\n\n\n\n\nwith __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_history\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n),validation_errors as (\n\n select\n ad_id, updated_at\n from __dbt__cte__int_tiktok_ads__most_recent_ad\n group by ad_id, updated_at\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_history\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": null, "column_name": null, "file_key_name": "models.int_tiktok_ads__most_recent_ad"}, "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_campaign_campaign_id.8cefa8981c": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "campaign_id", "model": "{{ get_where_subquery(ref('int_tiktok_ads__most_recent_campaign')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.int_tiktok_ads__most_recent_campaign"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_dbt_test__audit", "fqn": ["tiktok_ads", "intermediate", "not_null_int_tiktok_ads__most_recent_campaign_campaign_id"], "unique_id": "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_campaign_campaign_id.8cefa8981c", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_int_tiktok_ads__most_recent_campaign_campaign_id.sql", "original_file_path": "models/intermediate/intermediate.yml", "name": "not_null_int_tiktok_ads__most_recent_campaign_campaign_id", "alias": "not_null_int_tiktok_ads__most_recent_campaign_campaign_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["int_tiktok_ads__most_recent_campaign"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/intermediate/intermediate.yml/not_null_int_tiktok_ads__most_recent_campaign_campaign_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1641494963.1786911, "compiled_sql": "\n \n \n\nwith __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__campaign_history\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)select *\nfrom __dbt__cte__int_tiktok_ads__most_recent_campaign\nwhere campaign_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "sql": " __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__campaign_history\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": null, "column_name": "campaign_id", "file_key_name": "models.int_tiktok_ads__most_recent_campaign"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at.39077adf71": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_8456719f1ebbe11b109db2e39e0239ce\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["campaign_id", "updated_at"], "model": "{{ get_where_subquery(ref('int_tiktok_ads__most_recent_campaign')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.int_tiktok_ads__most_recent_campaign"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_8456719f1ebbe11b109db2e39e0239ce", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_dbt_test__audit", "fqn": ["tiktok_ads", "intermediate", "dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at.39077adf71", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_8456719f1ebbe11b109db2e39e0239ce.sql", "original_file_path": "models/intermediate/intermediate.yml", "name": "dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at", "alias": "dbt_utils_unique_combination_o_8456719f1ebbe11b109db2e39e0239ce", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["int_tiktok_ads__most_recent_campaign"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/intermediate/intermediate.yml/dbt_utils_unique_combination_o_8456719f1ebbe11b109db2e39e0239ce.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_8456719f1ebbe11b109db2e39e0239ce"}, "created_at": 1641494963.180662, "compiled_sql": "\n\n\n\n\n\nwith __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__campaign_history\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n),validation_errors as (\n\n select\n campaign_id, updated_at\n from __dbt__cte__int_tiktok_ads__most_recent_campaign\n group by campaign_id, updated_at\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "sql": " __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__campaign_history\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": null, "column_name": null, "file_key_name": "models.int_tiktok_ads__most_recent_campaign"}, "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66": {"raw_sql": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "unique", "kwargs": {"column_name": "advertiser_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__advertiser')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_dbt_test__audit", "fqn": ["tiktok_ads_source", "unique_stg_tiktok_ads__advertiser_advertiser_id"], "unique_id": "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "unique_stg_tiktok_ads__advertiser_advertiser_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "unique_stg_tiktok_ads__advertiser_advertiser_id", "alias": "unique_stg_tiktok_ads__advertiser_advertiser_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__advertiser"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/unique_stg_tiktok_ads__advertiser_advertiser_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1641494963.3718421, "compiled_sql": "\n \n \n\nselect\n advertiser_id as unique_field,\n count(*) as n_records\n\nfrom FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__advertiser\nwhere advertiser_id is not null\ngroup by advertiser_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "advertiser_id", "file_key_name": "models.stg_tiktok_ads__advertiser"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "advertiser_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__advertiser')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__advertiser_advertiser_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__advertiser_advertiser_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__advertiser_advertiser_id", "alias": "not_null_stg_tiktok_ads__advertiser_advertiser_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__advertiser"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__advertiser_advertiser_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1641494963.3744462, "compiled_sql": "\n \n \n\nselect *\nfrom FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__advertiser\nwhere advertiser_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "advertiser_id", "file_key_name": "models.stg_tiktok_ads__advertiser"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_group_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_group_history')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__ad_group_history_ad_group_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__ad_group_history_ad_group_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__ad_group_history_ad_group_id", "alias": "not_null_stg_tiktok_ads__ad_group_history_ad_group_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__ad_group_history_ad_group_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1641494963.37691, "compiled_sql": "\n \n \n\nselect *\nfrom FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_group_history\nwhere ad_group_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ad_group_id", "file_key_name": "models.stg_tiktok_ads__ad_group_history"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_group_id", "updated_at"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_group_history')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at", "alias": "dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8"}, "created_at": 1641494963.379584, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n ad_group_id, updated_at\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_group_history\n group by ad_group_id, updated_at\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.stg_tiktok_ads__ad_group_history"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_history')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__ad_history_ad_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__ad_history_ad_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__ad_history_ad_id", "alias": "not_null_stg_tiktok_ads__ad_history_ad_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__ad_history_ad_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1641494963.385997, "compiled_sql": "\n \n \n\nselect *\nfrom FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_history\nwhere ad_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ad_id", "file_key_name": "models.stg_tiktok_ads__ad_history"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_id", "updated_at"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_history')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at", "alias": "dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f"}, "created_at": 1641494963.3886878, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n ad_id, updated_at\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_history\n group by ad_id, updated_at\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.stg_tiktok_ads__ad_history"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "campaign_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__campaign_history')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__campaign_history_campaign_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__campaign_history_campaign_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__campaign_history_campaign_id", "alias": "not_null_stg_tiktok_ads__campaign_history_campaign_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__campaign_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__campaign_history_campaign_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1641494963.394699, "compiled_sql": "\n \n \n\nselect *\nfrom FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__campaign_history\nwhere campaign_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "campaign_id", "file_key_name": "models.stg_tiktok_ads__campaign_history"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["campaign_id", "updated_at"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__campaign_history')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at", "alias": "dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__campaign_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000"}, "created_at": 1641494963.3970292, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n campaign_id, updated_at\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__campaign_history\n group by campaign_id, updated_at\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.stg_tiktok_ads__campaign_history"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_id", "stat_time_hour"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_report_hourly')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour", "alias": "dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc"}, "created_at": 1641494963.4022489, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n ad_id, stat_time_hour\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_report_hourly\n group by ad_id, stat_time_hour\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.stg_tiktok_ads__ad_report_hourly"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_group_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_group_report_hourly')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id", "alias": "not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1641494963.4079082, "compiled_sql": "\n \n \n\nselect *\nfrom FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_group_report_hourly\nwhere ad_group_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ad_group_id", "file_key_name": "models.stg_tiktok_ads__ad_group_report_hourly"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_group_id", "stat_time_hour"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_group_report_hourly')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour", "alias": "dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60"}, "created_at": 1641494963.410182, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n ad_group_id, stat_time_hour\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__ad_group_report_hourly\n group by ad_group_id, stat_time_hour\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.stg_tiktok_ads__ad_group_report_hourly"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "campaign_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__campaign_report_hourly')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id", "alias": "not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__campaign_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1641494963.415447, "compiled_sql": "\n \n \n\nselect *\nfrom FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__campaign_report_hourly\nwhere campaign_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "campaign_id", "file_key_name": "models.stg_tiktok_ads__campaign_report_hourly"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["campaign_id", "stat_time_hour"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__campaign_report_hourly')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "FIVETRAN_DBT_TESTING", "schema": "DBT_TIKTOK_ADS_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour", "alias": "dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__campaign_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16"}, "created_at": 1641494963.417697, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n campaign_id, stat_time_hour\n from FIVETRAN_DBT_TESTING.DBT_TIKTOK_ADS_stg_tiktok_ads.stg_tiktok_ads__campaign_report_hourly\n group by campaign_id, stat_time_hour\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.stg_tiktok_ads__campaign_report_hourly"}}, "sources": {"source.tiktok_ads_source.tiktok_ads.advertiser": {"fqn": ["tiktok_ads_source", "tiktok_ads", "advertiser"], "database": "MB_TIKTOK_ADS", "schema": "TIKTOK_ADS", "unique_id": "source.tiktok_ads_source.tiktok_ads.advertiser", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "advertiser", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "advertiser", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents data for one advertiser.", "columns": {"id": {"name": "id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "address": {"name": "address", "description": "Advertiser address information", "meta": {}, "data_type": null, "quote": null, "tags": []}, "balance": {"name": "balance", "description": "Account available balance", "meta": {}, "data_type": null, "quote": null, "tags": []}, "company": {"name": "company", "description": "Advertiser's company name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "contacter": {"name": "contacter", "description": "Contact Person", "meta": {}, "data_type": null, "quote": null, "tags": []}, "country": {"name": "country", "description": "The advertiser's country", "meta": {}, "data_type": null, "quote": null, "tags": []}, "create_time": {"name": "create_time", "description": "Advertiser's create time", "meta": {}, "data_type": null, "quote": null, "tags": []}, "currency": {"name": "currency", "description": "Type of currency used by advertisers", "meta": {}, "data_type": null, "quote": null, "tags": []}, "description": {"name": "description", "description": "Brand description, i.e. promotional content", "meta": {}, "data_type": null, "quote": null, "tags": []}, "email": {"name": "email", "description": "Advertiser contact email, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "industry": {"name": "industry", "description": "Advertiser industry category", "meta": {}, "data_type": null, "quote": null, "tags": []}, "language": {"name": "language", "description": "Language used by advertisers", "meta": {}, "data_type": null, "quote": null, "tags": []}, "license_no": {"name": "license_no", "description": "License number", "meta": {}, "data_type": null, "quote": null, "tags": []}, "license_url": {"name": "license_url", "description": "License preview address, the link is valid for an hour by default.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "Advertiser name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "phone_number": {"name": "phone_number", "description": "Contact mobile number, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "promotion_area": {"name": "promotion_area", "description": "Operation area", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reason": {"name": "reason", "description": "Reason for rejection", "meta": {}, "data_type": null, "quote": null, "tags": []}, "role": {"name": "role", "description": "Advertiser role", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Advertiser status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "telephone": {"name": "telephone", "description": "Fixed phone number, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "timezone": {"name": "timezone", "description": "Ad account time zone including GMT offset", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "MB_TIKTOK_ADS.TIKTOK_ADS.advertiser", "created_at": 1641494963.4221592}, "source.tiktok_ads_source.tiktok_ads.campaign_history": {"fqn": ["tiktok_ads_source", "tiktok_ads", "campaign_history"], "database": "MB_TIKTOK_ADS", "schema": "TIKTOK_ADS", "unique_id": "source.tiktok_ads_source.tiktok_ads.campaign_history", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "campaign_history", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "campaign_history", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents a version of a TikTok campaign.", "columns": {"campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget": {"name": "budget", "description": "Campaign budget", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget_mode": {"name": "budget_mode", "description": "Budget type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_type": {"name": "campaign_type", "description": "Campaign Type, indicates the campaign is a regular campaign or iOS 14 campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "create_time": {"name": "create_time", "description": "Time at which the campaign was created.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_new_structure": {"name": "is_new_structure", "description": "Whether the campaign is a new structure (for the same campaign, the structure of campaign, adgroups and ads are the same)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "objective_type": {"name": "objective_type", "description": "Advertising objective.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "opt_status": {"name": "opt_status", "description": "Operation status.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Campaign status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "split_test_variable": {"name": "split_test_variable", "description": "Split Test variables. Optional values; TARGETING, BIDDING_OPTIMIZATION , CREATIVE.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "MB_TIKTOK_ADS.TIKTOK_ADS.campaign_history", "created_at": 1641494963.422365}, "source.tiktok_ads_source.tiktok_ads.adgroup_history": {"fqn": ["tiktok_ads_source", "tiktok_ads", "adgroup_history"], "database": "MB_TIKTOK_ADS", "schema": "TIKTOK_ADS", "unique_id": "source.tiktok_ads_source.tiktok_ads.adgroup_history", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "adgroup_history", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "adgroup_history", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents a version of a TikTok ad group.", "columns": {"adgroup_id": {"name": "adgroup_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The Ad group's campaign ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_categories": {"name": "action_categories", "description": "IDs of the action categories (behaviors) that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_days": {"name": "action_days", "description": "The number of days of the time period to include action from.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "adgroup_name": {"name": "adgroup_name", "description": "Ad group name. Character limit is 512 and cannot contain emoji.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "age": {"name": "age", "description": "Age groups you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "android_osv": {"name": "android_osv", "description": "Minimum Android version.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "app_download_url": {"name": "app_download_url", "description": "App download link", "meta": {}, "data_type": null, "quote": null, "tags": []}, "app_id": {"name": "app_id", "description": "The Application id of the promoted app", "meta": {}, "data_type": null, "quote": null, "tags": []}, "app_name": {"name": "app_name", "description": "App name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "app_type": {"name": "app_type", "description": "App type.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience": {"name": "audience", "description": "A list of audience IDs.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience_type": {"name": "audience_type", "description": "Audience Type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "bid": {"name": "bid", "description": "CPC, CPM bidding, oCPM learning bidding", "meta": {}, "data_type": null, "quote": null, "tags": []}, "bid_type": {"name": "bid_type", "description": "Bidding Strategy", "meta": {}, "data_type": null, "quote": null, "tags": []}, "billing_event": {"name": "billing_event", "description": "Bid method.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget": {"name": "budget", "description": "Ad budget. Returns 0.0 when Campaign Budget Optimization (budget_optimize_switch) is on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget_mode": {"name": "budget_mode", "description": "Budget mode. This field will be ignored when Campaign Budget Optimization (budget_optimize_switch) is enabled.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "carriers": {"name": "carriers", "description": "Carriers that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "category": {"name": "category", "description": "Ad group category.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "click_tracking_url": {"name": "click_tracking_url", "description": "Click monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "connection_type": {"name": "connection_type", "description": "Device connection types that you want to target. Default; unlimited.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_bid": {"name": "conversion_bid", "description": "oCPM conversion bid", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpv_video_duration": {"name": "cpv_video_duration", "description": "Video playback duration, required if optimize_goal is VIDEO_VIEW. Allowed values; SIX_SECONDS (video playback 6s), TWO_SECONDS (video playback 2s)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "creative_material_mode": {"name": "creative_material_mode", "description": "Creative delivery mode.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "dayparting": {"name": "dayparting", "description": "Ad delivery period, the default is always and the format is 48 * 7 character string, represented by 0 or 1. > That is, with half an hour as the minimum granularity, a day (24 hours) is divided by the minimum granularity(30 mins) from Monday to Sunday. Resulting in a 48*7 format.0 represents not to be delivered, 1 represents delivery. no transmission, full transmission 0, full transmission 1 all represent full time delivery", "meta": {}, "data_type": null, "quote": null, "tags": []}, "deep_bid_type": {"name": "deep_bid_type", "description": "Bidding strategy for in-app events.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "deep_cpabid": {"name": "deep_cpabid", "description": "Deep bid", "meta": {}, "data_type": null, "quote": null, "tags": []}, "deep_external_action": {"name": "deep_external_action", "description": "Deep conversion event.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "display_name": {"name": "display_name", "description": "Display name of ad group.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "enable_inventory_filter": {"name": "enable_inventory_filter", "description": "Inventory filtering (Unsafe videos will not be displayed).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "excluded_audience": {"name": "excluded_audience", "description": "A list of audience ID to be excluded.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "external_action": {"name": "external_action", "description": "Conversion event for the ad group. It is required when the promoted object is an app with tracking urls, or when pixel_id is specified.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "fallback_type": {"name": "fallback_type", "description": "Fallback Type. If the audience do not have the app installed, you can have them fall back to install the app, or to view a specific web page. Not applicable for Deferred Deeplink. Allowed values; APP_INSTALL, WEBSITE, UNSET. If website is chosen, you need to specify the url via landing_page_url field.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency": {"name": "frequency", "description": "frequency, together with frequency_schedule, controls how often people see your ad (only available for REACH ads). For example, frequency = 2 frequency_schedule = 3 means \"show ads no more than twice every 3 day\".\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency_schedule": {"name": "frequency_schedule", "description": "frequency, together with frequency, controls how often people see your ad (only available for REACH ads).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impression_tracking_url": {"name": "impression_tracking_url", "description": "Display monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "interest_category_v2": {"name": "interest_category_v2", "description": "Interest classification. If the interest is specified, users that do not meet interest target will be excluded during delivery.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ios_osv": {"name": "ios_osv", "description": "Minimum iOS version.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_comment_disable": {"name": "is_comment_disable", "description": "Whether to allow comments on your ads on TikTok, Vigo, Helo.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_hfss": {"name": "is_hfss", "description": "Whether the promoted content is HFSS foods (foods that are high in fat, salt, or sugar).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_new_structure": {"name": "is_new_structure", "description": "Whether the campaign is a new structure.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "keywords": {"name": "keywords", "description": "Keywords used.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "languages": {"name": "languages", "description": "Codes of the languages that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "location": {"name": "location", "description": "IDs of the locations that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "open_url": {"name": "open_url", "description": "The specific location where you want your audience to go if they have your app installed.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "open_url_type": {"name": "open_url_type", "description": "The open URL type.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "operation_system": {"name": "operation_system", "description": "Device operating systems that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "opt_status": {"name": "opt_status", "description": "Operation status.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "optimize_goal": {"name": "optimize_goal", "description": "Optimization goal.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "pacing": {"name": "pacing", "description": "You can choose between PACING_MODE_SMOOTH and PACING_MODE_FAST. For PACING_MODE_SMOOTH, the budget is allocated evenly within the scheduled time. PACING_MODE_FAST would consume budget and produce results as soon as possible. \n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "package": {"name": "package", "description": "Package name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "pangle_block_app_list_id": {"name": "pangle_block_app_list_id", "description": "Pangle app block list ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "pixel_id": {"name": "pixel_id", "description": "Pixel ID. Only application for landing pages.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "placement": {"name": "placement", "description": "The apps where you want to deliver your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "placement_type": {"name": "placement_type", "description": "Placement type.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_image": {"name": "profile_image", "description": "Avatar URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "schedule_end_time": {"name": "schedule_end_time", "description": "Ad delivery end time (UTC+0). Format should be YYYY-MM-DD HH:MM:SS", "meta": {}, "data_type": null, "quote": null, "tags": []}, "schedule_start_time": {"name": "schedule_start_time", "description": "Ad delivery start time (UTC+0). Format should be YYYY-MM-DD HH:MM:SS", "meta": {}, "data_type": null, "quote": null, "tags": []}, "schedule_type": {"name": "schedule_type", "description": "The schedule type, which can be either SCHEDULE_START_END or SCHEDULE_FROM_NOW.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "skip_learning_phase": {"name": "skip_learning_phase", "description": "Whether to skip the learning stage.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "statistic_type": {"name": "statistic_type", "description": "conversion bid statistic type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Ad group status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_actions": {"name": "video_actions", "description": "Number of video actions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_download": {"name": "video_download", "description": "Whether users can download your video ads on TikTok(cannot be updated once created).", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "MB_TIKTOK_ADS.TIKTOK_ADS.adgroup_history", "created_at": 1641494963.422668}, "source.tiktok_ads_source.tiktok_ads.ad_history": {"fqn": ["tiktok_ads_source", "tiktok_ads", "ad_history"], "database": "MB_TIKTOK_ADS", "schema": "TIKTOK_ADS", "unique_id": "source.tiktok_ads_source.tiktok_ads.ad_history", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "ad_history", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "ad_history", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents a version of a TikTok ad.", "columns": {"ad_id": {"name": "ad_id", "description": "Ad ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "adgroup_id": {"name": "adgroup_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_name": {"name": "ad_name", "description": "Ad Name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_text": {"name": "ad_text", "description": "The ad text.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "app_name": {"name": "app_name", "description": "The display name of app download ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "call_to_action": {"name": "call_to_action", "description": "Call to action values.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "click_tracking_url": {"name": "click_tracking_url", "description": "Click monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "create_time": {"name": "create_time", "description": "Time at which the ad was created.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "display_name": {"name": "display_name", "description": "The display name of landing page or pure exposure ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "image_ids": {"name": "image_ids", "description": "A list of image IDs.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impression_tracking_url": {"name": "impression_tracking_url", "description": "Display monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_aco": {"name": "is_aco", "description": "Whether the ad is an automated ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_creative_authorized": {"name": "is_creative_authorized", "description": "Whether you grant displaying some of your ads in our TikTok For Business Creative Center. Only valid for non-US advertisers, the default value is false.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_new_structure": {"name": "is_new_structure", "description": "Whether the campaign is a new structure.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "open_url": {"name": "open_url", "description": "The specific location where you want your audience to go if they have your app installed.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "opt_status": {"name": "opt_status", "description": "Operation status.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "playable_url": {"name": "playable_url", "description": "Playable material url.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_image": {"name": "profile_image", "description": "Avatar URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Ad status.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_id": {"name": "video_id", "description": "The video ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "MB_TIKTOK_ADS.TIKTOK_ADS.ad_history", "created_at": 1641494963.422879}, "source.tiktok_ads_source.tiktok_ads.ad_report_hourly": {"fqn": ["tiktok_ads_source", "tiktok_ads", "ad_report_hourly"], "database": "MB_TIKTOK_ADS", "schema": "TIKTOK_ADS", "unique_id": "source.tiktok_ads_source.tiktok_ads.ad_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "ad_report_hourly", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "ad_report_hourly", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents data for each ad for each hour.", "columns": {"ad_id": {"name": "ad_id", "description": "Ad id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion": {"name": "real_time_conversion", "description": "The number of times your ad achieved an outcome, based on the objective and settings you selected. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result": {"name": "result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the results. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_result": {"name": "real_time_cost_per_result", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now, please go to the ad group section to view the cost per Result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result": {"name": "real_time_result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As a campaign may have different optimization goals, the total number of result is not supported in campaign section now , Please go to the ad group section to view the result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_view_p_100": {"name": "video_view_p_100", "description": "The number of times your video was played at 100% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion_rate": {"name": "real_time_conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_secondary_goal_result": {"name": "cost_per_secondary_goal_result", "description": "The average cost for each secondary goal result from your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result_rate": {"name": "secondary_goal_result_rate", "description": "The percentage of secondary goal results you achieved out of all of the installs of your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. The total count is calculated based on the time each ad impression occurred.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_conversion": {"name": "real_time_cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result_rate": {"name": "result_rate", "description": "The percentage of results you achieved out of all of the views/clicks on your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the result rate. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result": {"name": "secondary_goal_result", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_result": {"name": "cost_per_result", "description": "The average cost for each result from your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the cost per result. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time your video was played per person, including any time spent replaying the video. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result_rate": {"name": "real_time_result_rate", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now ,Please go to the ad group section to view the Result Rate. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "MB_TIKTOK_ADS.TIKTOK_ADS.ad_report_hourly", "created_at": 1641494963.423119}, "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly": {"fqn": ["tiktok_ads_source", "tiktok_ads", "campaign_report_hourly"], "database": "MB_TIKTOK_ADS", "schema": "TIKTOK_ADS", "unique_id": "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "campaign_report_hourly", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "campaign_report_hourly", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents data for each campaign for each hour.", "columns": {"campaign_id": {"name": "campaign_id", "description": "Campaign id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion": {"name": "real_time_conversion", "description": "The number of times your ad achieved an outcome, based on the objective and settings you selected. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result": {"name": "result", "description": "The number of times your ad achieved an outcome, based on the optimization goal \n you selected. As one campaign may have a number of different optimization goals, \nthis statistic is not supported for campaigns. Please go to ad groups or ads to view the results. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_result": {"name": "real_time_cost_per_result", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now, please go to the ad group section to view the cost per Result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result": {"name": "real_time_result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As a campaign may have different optimization goals, the total number of result is not supported in campaign section now , Please go to the ad group section to view the result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_view_p_100": {"name": "video_view_p_100", "description": "The number of times your video was played at 100% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion_rate": {"name": "real_time_conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_secondary_goal_result": {"name": "cost_per_secondary_goal_result", "description": "The average cost for each secondary goal result from your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result_rate": {"name": "secondary_goal_result_rate", "description": "The percentage of secondary goal results you achieved out of all of the installs of your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. The total count is calculated based on the time each ad impression occurred.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_conversion": {"name": "real_time_cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result_rate": {"name": "result_rate", "description": "The percentage of results you achieved out of all of the views/clicks on your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the result rate. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result": {"name": "secondary_goal_result", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_result": {"name": "cost_per_result", "description": "The average cost for each result from your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the cost per result. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time your video was played per person, including any time spent replaying the video. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result_rate": {"name": "real_time_result_rate", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now ,Please go to the ad group section to view the Result Rate. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "MB_TIKTOK_ADS.TIKTOK_ADS.campaign_report_hourly", "created_at": 1641494963.4233558}, "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly": {"fqn": ["tiktok_ads_source", "tiktok_ads", "adgroup_report_hourly"], "database": "MB_TIKTOK_ADS", "schema": "TIKTOK_ADS", "unique_id": "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "adgroup_report_hourly", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "adgroup_report_hourly", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents data for each ad group for each hour.", "columns": {"adgroup_id": {"name": "adgroup_id", "description": "Ad group id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion": {"name": "real_time_conversion", "description": "The number of times your ad achieved an outcome, based on the objective and settings you selected. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result": {"name": "result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the results. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_result": {"name": "real_time_cost_per_result", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now, please go to the ad group section to view the cost per Result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result": {"name": "real_time_result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As a campaign may have different optimization goals, the total number of result is not supported in campaign section now , Please go to the ad group section to view the result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_view_p_100": {"name": "video_view_p_100", "description": "The number of times your video was played at 100% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion_rate": {"name": "real_time_conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_secondary_goal_result": {"name": "cost_per_secondary_goal_result", "description": "The average cost for each secondary goal result from your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result_rate": {"name": "secondary_goal_result_rate", "description": "The percentage of secondary goal results you achieved out of all of the installs of your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. The total count is calculated based on the time each ad impression occurred.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_conversion": {"name": "real_time_cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result_rate": {"name": "result_rate", "description": "The percentage of results you achieved out of all of the views/clicks on your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the result rate. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result": {"name": "secondary_goal_result", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_result": {"name": "cost_per_result", "description": "The average cost for each result from your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the cost per result. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time your video was played per person, including any time spent replaying the video. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result_rate": {"name": "real_time_result_rate", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now ,Please go to the ad group section to view the Result Rate. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "MB_TIKTOK_ADS.TIKTOK_ADS.adgroup_report_hourly", "created_at": 1641494963.423848}}, "macros": {"macro.dbt_snowflake.snowflake__get_catalog": {"unique_id": "macro.dbt_snowflake.snowflake__get_catalog", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "name": "snowflake__get_catalog", "macro_sql": "{% macro snowflake__get_catalog(information_schema, schemas) -%}\n {% set query %}\n with tables as (\n\n select\n table_catalog as \"table_database\",\n table_schema as \"table_schema\",\n table_name as \"table_name\",\n table_type as \"table_type\",\n comment as \"table_comment\",\n\n -- note: this is the _role_ that owns the table\n table_owner as \"table_owner\",\n\n 'Clustering Key' as \"stats:clustering_key:label\",\n clustering_key as \"stats:clustering_key:value\",\n 'The key used to cluster this table' as \"stats:clustering_key:description\",\n (clustering_key is not null) as \"stats:clustering_key:include\",\n\n 'Row Count' as \"stats:row_count:label\",\n row_count as \"stats:row_count:value\",\n 'An approximate count of rows in this table' as \"stats:row_count:description\",\n (row_count is not null) as \"stats:row_count:include\",\n\n 'Approximate Size' as \"stats:bytes:label\",\n bytes as \"stats:bytes:value\",\n 'Approximate size of the table as reported by Snowflake' as \"stats:bytes:description\",\n (bytes is not null) as \"stats:bytes:include\",\n\n 'Last Modified' as \"stats:last_modified:label\",\n to_varchar(convert_timezone('UTC', last_altered), 'yyyy-mm-dd HH24:MI'||'UTC') as \"stats:last_modified:value\",\n 'The timestamp for last update/change' as \"stats:last_modified:description\",\n (last_altered is not null and table_type='BASE TABLE') as \"stats:last_modified:include\"\n\n from {{ information_schema }}.tables\n\n ),\n\n columns as (\n\n select\n table_catalog as \"table_database\",\n table_schema as \"table_schema\",\n table_name as \"table_name\",\n\n column_name as \"column_name\",\n ordinal_position as \"column_index\",\n data_type as \"column_type\",\n comment as \"column_comment\"\n\n from {{ information_schema }}.columns\n )\n\n select *\n from tables\n join columns using (\"table_database\", \"table_schema\", \"table_name\")\n where (\n {%- for schema in schemas -%}\n upper(\"table_schema\") = upper('{{ schema }}'){%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n )\n order by \"column_index\"\n {%- endset -%}\n\n {{ return(run_query(query)) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.58659}, "macro.dbt_snowflake.snowflake__create_table_as": {"unique_id": "macro.dbt_snowflake.snowflake__create_table_as", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__create_table_as", "macro_sql": "{% macro snowflake__create_table_as(temporary, relation, sql) -%}\n {%- set transient = config.get('transient', default=true) -%}\n {%- set cluster_by_keys = config.get('cluster_by', default=none) -%}\n {%- set enable_automatic_clustering = config.get('automatic_clustering', default=false) -%}\n {%- set copy_grants = config.get('copy_grants', default=false) -%}\n\n {%- if cluster_by_keys is not none and cluster_by_keys is string -%}\n {%- set cluster_by_keys = [cluster_by_keys] -%}\n {%- endif -%}\n {%- if cluster_by_keys is not none -%}\n {%- set cluster_by_string = cluster_by_keys|join(\", \")-%}\n {% else %}\n {%- set cluster_by_string = none -%}\n {%- endif -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n\n create or replace {% if temporary -%}\n temporary\n {%- elif transient -%}\n transient\n {%- endif %} table {{ relation }} {% if copy_grants and not temporary -%} copy grants {%- endif %} as\n (\n {%- if cluster_by_string is not none -%}\n select * from(\n {{ sql }}\n ) order by ({{ cluster_by_string }})\n {%- else -%}\n {{ sql }}\n {%- endif %}\n );\n {% if cluster_by_string is not none and not temporary -%}\n alter table {{relation}} cluster by ({{cluster_by_string}});\n {%- endif -%}\n {% if enable_automatic_clustering and cluster_by_string is not none and not temporary -%}\n alter table {{relation}} resume recluster;\n {%- endif -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.6116202}, "macro.dbt_snowflake.get_column_comment_sql": {"unique_id": "macro.dbt_snowflake.get_column_comment_sql", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "get_column_comment_sql", "macro_sql": "{% macro get_column_comment_sql(column_name, column_dict) %}\n {{ adapter.quote(column_name) if column_dict[column_name]['quote'] else column_name }} COMMENT $${{ column_dict[column_name]['description'] | replace('$', '[$]') }}$$\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.612534}, "macro.dbt_snowflake.get_persist_docs_column_list": {"unique_id": "macro.dbt_snowflake.get_persist_docs_column_list", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "get_persist_docs_column_list", "macro_sql": "{% macro get_persist_docs_column_list(model_columns, query_columns) %}\n(\n {% for column_name in query_columns %}\n {% if (column_name|upper in model_columns) or (column_name in model_columns) %}\n {{ get_column_comment_sql(column_name, model_columns) }}\n {% else %}\n {{column_name}}\n {% endif %}\n {{ \", \" if not loop.last else \"\" }}\n {% endfor %}\n)\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.get_column_comment_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.613724}, "macro.dbt_snowflake.snowflake__create_view_as": {"unique_id": "macro.dbt_snowflake.snowflake__create_view_as", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__create_view_as", "macro_sql": "{% macro snowflake__create_view_as(relation, sql) -%}\n {%- set secure = config.get('secure', default=false) -%}\n {%- set copy_grants = config.get('copy_grants', default=false) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n create or replace {% if secure -%}\n secure\n {%- endif %} view {{ relation }} \n {% if config.persist_column_docs() -%}\n {% set model_columns = model.columns %}\n {% set query_columns = get_columns_in_query(sql) %}\n {{ get_persist_docs_column_list(model_columns, query_columns) }}\n \n {%- endif %}\n {% if copy_grants -%} copy grants {%- endif %} as (\n {{ sql }}\n );\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_columns_in_query", "macro.dbt_snowflake.get_persist_docs_column_list"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.615744}, "macro.dbt_snowflake.snowflake__get_columns_in_relation": {"unique_id": "macro.dbt_snowflake.snowflake__get_columns_in_relation", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__get_columns_in_relation", "macro_sql": "{% macro snowflake__get_columns_in_relation(relation) -%}\n {%- set sql -%}\n describe table {{ relation }}\n {%- endset -%}\n {%- set result = run_query(sql) -%}\n\n {% set maximum = 10000 %}\n {% if (result | length) >= maximum %}\n {% set msg %}\n Too many columns in relation {{ relation }}! dbt can only get\n information about relations with fewer than {{ maximum }} columns.\n {% endset %}\n {% do exceptions.raise_compiler_error(msg) %}\n {% endif %}\n\n {% set columns = [] %}\n {% for row in result %}\n {% do columns.append(api.Column.from_description(row['name'], row['type'])) %}\n {% endfor %}\n {% do return(columns) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.617829}, "macro.dbt_snowflake.snowflake__list_schemas": {"unique_id": "macro.dbt_snowflake.snowflake__list_schemas", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__list_schemas", "macro_sql": "{% macro snowflake__list_schemas(database) -%}\n {# 10k limit from here: https://docs.snowflake.net/manuals/sql-reference/sql/show-schemas.html#usage-notes #}\n {% set maximum = 10000 %}\n {% set sql -%}\n show terse schemas in database {{ database }}\n limit {{ maximum }}\n {%- endset %}\n {% set result = run_query(sql) %}\n {% if (result | length) >= maximum %}\n {% set msg %}\n Too many schemas in database {{ database }}! dbt can only get\n information about databases with fewer than {{ maximum }} schemas.\n {% endset %}\n {% do exceptions.raise_compiler_error(msg) %}\n {% endif %}\n {{ return(result) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.619324}, "macro.dbt_snowflake.snowflake__list_relations_without_caching": {"unique_id": "macro.dbt_snowflake.snowflake__list_relations_without_caching", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__list_relations_without_caching", "macro_sql": "{% macro snowflake__list_relations_without_caching(schema_relation) %}\n {%- set sql -%}\n show terse objects in {{ schema_relation }}\n {%- endset -%}\n\n {%- set result = run_query(sql) -%}\n {% set maximum = 10000 %}\n {% if (result | length) >= maximum %}\n {% set msg %}\n Too many schemas in schema {{ schema_relation }}! dbt can only get\n information about schemas with fewer than {{ maximum }} objects.\n {% endset %}\n {% do exceptions.raise_compiler_error(msg) %}\n {% endif %}\n {%- do return(result) -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.620693}, "macro.dbt_snowflake.snowflake__check_schema_exists": {"unique_id": "macro.dbt_snowflake.snowflake__check_schema_exists", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__check_schema_exists", "macro_sql": "{% macro snowflake__check_schema_exists(information_schema, schema) -%}\n {% call statement('check_schema_exists', fetch_result=True) -%}\n select count(*)\n from {{ information_schema }}.schemata\n where upper(schema_name) = upper('{{ schema }}')\n and upper(catalog_name) = upper('{{ information_schema.database }}')\n {%- endcall %}\n {{ return(load_result('check_schema_exists').table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.62155}, "macro.dbt_snowflake.snowflake__current_timestamp": {"unique_id": "macro.dbt_snowflake.snowflake__current_timestamp", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__current_timestamp", "macro_sql": "{% macro snowflake__current_timestamp() -%}\n convert_timezone('UTC', current_timestamp())\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.6217651}, "macro.dbt_snowflake.snowflake__snapshot_string_as_time": {"unique_id": "macro.dbt_snowflake.snowflake__snapshot_string_as_time", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__snapshot_string_as_time", "macro_sql": "{% macro snowflake__snapshot_string_as_time(timestamp) -%}\n {%- set result = \"to_timestamp_ntz('\" ~ timestamp ~ \"')\" -%}\n {{ return(result) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.6222432}, "macro.dbt_snowflake.snowflake__snapshot_get_time": {"unique_id": "macro.dbt_snowflake.snowflake__snapshot_get_time", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__snapshot_get_time", "macro_sql": "{% macro snowflake__snapshot_get_time() -%}\n to_timestamp_ntz({{ current_timestamp() }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.6225321}, "macro.dbt_snowflake.snowflake__rename_relation": {"unique_id": "macro.dbt_snowflake.snowflake__rename_relation", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__rename_relation", "macro_sql": "{% macro snowflake__rename_relation(from_relation, to_relation) -%}\n {% call statement('rename_relation') -%}\n alter table {{ from_relation }} rename to {{ to_relation }}\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.623054}, "macro.dbt_snowflake.snowflake__alter_column_type": {"unique_id": "macro.dbt_snowflake.snowflake__alter_column_type", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__alter_column_type", "macro_sql": "{% macro snowflake__alter_column_type(relation, column_name, new_column_type) -%}\n {% call statement('alter_column_type') %}\n alter table {{ relation }} alter {{ adapter.quote(column_name) }} set data type {{ new_column_type }};\n {% endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.623714}, "macro.dbt_snowflake.snowflake__alter_relation_comment": {"unique_id": "macro.dbt_snowflake.snowflake__alter_relation_comment", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__alter_relation_comment", "macro_sql": "{% macro snowflake__alter_relation_comment(relation, relation_comment) -%}\n comment on {{ relation.type }} {{ relation }} IS $${{ relation_comment | replace('$', '[$]') }}$$;\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.6242611}, "macro.dbt_snowflake.snowflake__alter_column_comment": {"unique_id": "macro.dbt_snowflake.snowflake__alter_column_comment", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__alter_column_comment", "macro_sql": "{% macro snowflake__alter_column_comment(relation, column_dict) -%}\n {% set existing_columns = adapter.get_columns_in_relation(relation) | map(attribute=\"name\") | list %}\n alter {{ relation.type }} {{ relation }} alter\n {% for column_name in column_dict if (column_name in existing_columns) or (column_name|upper in existing_columns) %}\n {{ get_column_comment_sql(column_name, column_dict) }} {{ ',' if not loop.last else ';' }}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.get_column_comment_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.625719}, "macro.dbt_snowflake.get_current_query_tag": {"unique_id": "macro.dbt_snowflake.get_current_query_tag", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "get_current_query_tag", "macro_sql": "{% macro get_current_query_tag() -%}\n {{ return(run_query(\"show parameters like 'query_tag' in session\").rows[0]['value']) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.6261928}, "macro.dbt_snowflake.set_query_tag": {"unique_id": "macro.dbt_snowflake.set_query_tag", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "set_query_tag", "macro_sql": "{% macro set_query_tag() -%}\n {% set new_query_tag = config.get('query_tag') %}\n {% if new_query_tag %}\n {% set original_query_tag = get_current_query_tag() %}\n {{ log(\"Setting query_tag to '\" ~ new_query_tag ~ \"'. Will reset to '\" ~ original_query_tag ~ \"' after materialization.\") }}\n {% do run_query(\"alter session set query_tag = '{}'\".format(new_query_tag)) %}\n {{ return(original_query_tag)}}\n {% endif %}\n {{ return(none)}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.get_current_query_tag", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.627497}, "macro.dbt_snowflake.unset_query_tag": {"unique_id": "macro.dbt_snowflake.unset_query_tag", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "unset_query_tag", "macro_sql": "{% macro unset_query_tag(original_query_tag) -%}\n {% set new_query_tag = config.get('query_tag') %}\n {% if new_query_tag %}\n {% if original_query_tag %}\n {{ log(\"Resetting query_tag to '\" ~ original_query_tag ~ \"'.\") }}\n {% do run_query(\"alter session set query_tag = '{}'\".format(original_query_tag)) %}\n {% else %}\n {{ log(\"No original query_tag, unsetting parameter.\") }}\n {% do run_query(\"alter session unset query_tag\") %}\n {% endif %}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.6288068}, "macro.dbt_snowflake.snowflake__alter_relation_add_remove_columns": {"unique_id": "macro.dbt_snowflake.snowflake__alter_relation_add_remove_columns", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__alter_relation_add_remove_columns", "macro_sql": "{% macro snowflake__alter_relation_add_remove_columns(relation, add_columns, remove_columns) %}\n \n {% if add_columns %}\n \n {% set sql -%}\n alter {{ relation.type }} {{ relation }} add column\n {% for column in add_columns %}\n {{ column.name }} {{ column.data_type }}{{ ',' if not loop.last }}\n {% endfor %}\n {%- endset -%}\n\n {% do run_query(sql) %}\n\n {% endif %}\n\n {% if remove_columns %}\n \n {% set sql -%}\n alter {{ relation.type }} {{ relation }} drop column\n {% for column in remove_columns %}\n {{ column.name }}{{ ',' if not loop.last }}\n {% endfor %}\n {%- endset -%}\n \n {% do run_query(sql) %}\n \n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.630784}, "macro.dbt_snowflake.snowflake_dml_explicit_transaction": {"unique_id": "macro.dbt_snowflake.snowflake_dml_explicit_transaction", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake_dml_explicit_transaction", "macro_sql": "{% macro snowflake_dml_explicit_transaction(dml) %}\n {#\n Use this macro to wrap all INSERT, MERGE, UPDATE, DELETE, and TRUNCATE \n statements before passing them into run_query(), or calling in the 'main' statement\n of a materialization\n #}\n {% set dml_transaction -%}\n begin;\n {{ dml }};\n commit;\n {%- endset %}\n \n {% do return(dml_transaction) %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.631348}, "macro.dbt_snowflake.snowflake__truncate_relation": {"unique_id": "macro.dbt_snowflake.snowflake__truncate_relation", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "snowflake__truncate_relation", "macro_sql": "{% macro snowflake__truncate_relation(relation) -%}\n {% set truncate_dml %}\n truncate table {{ relation }}\n {% endset %}\n {% call statement('truncate_relation') -%}\n {{ snowflake_dml_explicit_transaction(truncate_dml) }}\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_snowflake.snowflake_dml_explicit_transaction"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.631983}, "macro.dbt_snowflake.snowflake__get_merge_sql": {"unique_id": "macro.dbt_snowflake.snowflake__get_merge_sql", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/materializations/merge.sql", "original_file_path": "macros/materializations/merge.sql", "name": "snowflake__get_merge_sql", "macro_sql": "{% macro snowflake__get_merge_sql(target, source_sql, unique_key, dest_columns, predicates) -%}\n\n {#\n Workaround for Snowflake not being happy with a merge on a constant-false predicate.\n When no unique_key is provided, this macro will do a regular insert. If a unique_key\n is provided, then this macro will do a proper merge instead.\n #}\n\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute='name')) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {%- set dml -%}\n {%- if unique_key is none -%}\n\n {{ sql_header if sql_header is not none }}\n\n insert into {{ target }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ source_sql }}\n )\n\n {%- else -%}\n\n {{ default__get_merge_sql(target, source_sql, unique_key, dest_columns, predicates) }}\n\n {%- endif -%}\n {%- endset -%}\n \n {% do return(snowflake_dml_explicit_transaction(dml)) %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_quoted_csv", "macro.dbt.default__get_merge_sql", "macro.dbt_snowflake.snowflake_dml_explicit_transaction"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.634818}, "macro.dbt_snowflake.snowflake__get_delete_insert_merge_sql": {"unique_id": "macro.dbt_snowflake.snowflake__get_delete_insert_merge_sql", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/materializations/merge.sql", "original_file_path": "macros/materializations/merge.sql", "name": "snowflake__get_delete_insert_merge_sql", "macro_sql": "{% macro snowflake__get_delete_insert_merge_sql(target, source, unique_key, dest_columns) %}\n {% set dml = default__get_delete_insert_merge_sql(target, source, unique_key, dest_columns) %}\n {% do return(snowflake_dml_explicit_transaction(dml)) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_delete_insert_merge_sql", "macro.dbt_snowflake.snowflake_dml_explicit_transaction"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.635539}, "macro.dbt_snowflake.snowflake__snapshot_merge_sql": {"unique_id": "macro.dbt_snowflake.snowflake__snapshot_merge_sql", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/materializations/merge.sql", "original_file_path": "macros/materializations/merge.sql", "name": "snowflake__snapshot_merge_sql", "macro_sql": "{% macro snowflake__snapshot_merge_sql(target, source, insert_cols) %}\n {% set dml = default__snapshot_merge_sql(target, source, insert_cols) %}\n {% do return(snowflake_dml_explicit_transaction(dml)) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__snapshot_merge_sql", "macro.dbt_snowflake.snowflake_dml_explicit_transaction"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.63617}, "macro.dbt_snowflake.snowflake__load_csv_rows": {"unique_id": "macro.dbt_snowflake.snowflake__load_csv_rows", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "name": "snowflake__load_csv_rows", "macro_sql": "{% macro snowflake__load_csv_rows(model, agate_table) %}\n {% set batch_size = get_batch_size() %}\n {% set cols_sql = get_seed_column_quoted_csv(model, agate_table.column_names) %}\n {% set bindings = [] %}\n\n {% set statements = [] %}\n\n {% for chunk in agate_table.rows | batch(batch_size) %}\n {% set bindings = [] %}\n\n {% for row in chunk %}\n {% do bindings.extend(row) %}\n {% endfor %}\n\n {% set sql %}\n insert into {{ this.render() }} ({{ cols_sql }}) values\n {% for row in chunk -%}\n ({%- for column in agate_table.column_names -%}\n %s\n {%- if not loop.last%},{%- endif %}\n {%- endfor -%})\n {%- if not loop.last%},{%- endif %}\n {%- endfor %}\n {% endset %}\n\n {% do adapter.add_query('BEGIN', auto_begin=False) %}\n {% do adapter.add_query(sql, bindings=bindings, abridge_sql_log=True) %}\n {% do adapter.add_query('COMMIT', auto_begin=False) %}\n\n {% if loop.index0 == 0 %}\n {% do statements.append(sql) %}\n {% endif %}\n {% endfor %}\n\n {# Return SQL so we can render it out into the compiled files #}\n {{ return(statements[0]) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_batch_size", "macro.dbt.get_seed_column_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.640651}, "macro.dbt_snowflake.materialization_seed_snowflake": {"unique_id": "macro.dbt_snowflake.materialization_seed_snowflake", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "name": "materialization_seed_snowflake", "macro_sql": "{% materialization seed, adapter='snowflake' %}\n {% set original_query_tag = set_query_tag() %}\n\n {% set relations = materialization_seed_default() %}\n\n {% do unset_query_tag(original_query_tag) %}\n\n {{ return(relations) }}\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt.materialization_seed_default", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.6412811}, "macro.dbt_snowflake.materialization_view_snowflake": {"unique_id": "macro.dbt_snowflake.materialization_view_snowflake", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/materializations/view.sql", "original_file_path": "macros/materializations/view.sql", "name": "materialization_view_snowflake", "macro_sql": "{% materialization view, adapter='snowflake' -%}\n\n {% set original_query_tag = set_query_tag() %}\n {% set to_return = create_or_replace_view() %}\n\n {% set target_relation = this.incorporate(type='view') %}\n {% do persist_docs(target_relation, model, for_columns=false) %}\n\n {% do return(to_return) %}\n\n {% do unset_query_tag(original_query_tag) %}\n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt.create_or_replace_view", "macro.dbt.persist_docs", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.642517}, "macro.dbt_snowflake.materialization_table_snowflake": {"unique_id": "macro.dbt_snowflake.materialization_table_snowflake", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "name": "materialization_table_snowflake", "macro_sql": "{% materialization table, adapter='snowflake' %}\n\n {% set original_query_tag = set_query_tag() %}\n\n {%- set identifier = model['alias'] -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier,\n schema=schema,\n database=database, type='table') -%}\n\n {{ run_hooks(pre_hooks) }}\n\n {#-- Drop the relation if it was a view to \"convert\" it in a table. This may lead to\n -- downtime, but it should be a relatively infrequent occurrence #}\n {% if old_relation is not none and not old_relation.is_table %}\n {{ log(\"Dropping relation \" ~ old_relation ~ \" because it is of type \" ~ old_relation.type) }}\n {{ drop_relation_if_exists(old_relation) }}\n {% endif %}\n\n --build model\n {% call statement('main') -%}\n {{ create_table_as(false, target_relation, sql) }}\n {%- endcall %}\n\n {{ run_hooks(post_hooks) }}\n\n {% do persist_docs(target_relation, model) %}\n\n {% do unset_query_tag(original_query_tag) %}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt.run_hooks", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt.persist_docs", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.645392}, "macro.dbt_snowflake.dbt_snowflake_validate_get_incremental_strategy": {"unique_id": "macro.dbt_snowflake.dbt_snowflake_validate_get_incremental_strategy", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "name": "dbt_snowflake_validate_get_incremental_strategy", "macro_sql": "{% macro dbt_snowflake_validate_get_incremental_strategy(config) %}\n {#-- Find and validate the incremental strategy #}\n {%- set strategy = config.get(\"incremental_strategy\", default=\"merge\") -%}\n\n {% set invalid_strategy_msg -%}\n Invalid incremental strategy provided: {{ strategy }}\n Expected one of: 'merge', 'delete+insert'\n {%- endset %}\n {% if strategy not in ['merge', 'delete+insert'] %}\n {% do exceptions.raise_compiler_error(invalid_strategy_msg) %}\n {% endif %}\n\n {% do return(strategy) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.648151}, "macro.dbt_snowflake.dbt_snowflake_get_incremental_sql": {"unique_id": "macro.dbt_snowflake.dbt_snowflake_get_incremental_sql", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "name": "dbt_snowflake_get_incremental_sql", "macro_sql": "{% macro dbt_snowflake_get_incremental_sql(strategy, tmp_relation, target_relation, unique_key, dest_columns) %}\n {% if strategy == 'merge' %}\n {% do return(get_merge_sql(target_relation, tmp_relation, unique_key, dest_columns)) %}\n {% elif strategy == 'delete+insert' %}\n {% do return(get_delete_insert_merge_sql(target_relation, tmp_relation, unique_key, dest_columns)) %}\n {% else %}\n {% do exceptions.raise_compiler_error('invalid strategy: ' ~ strategy) %}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_merge_sql", "macro.dbt.get_delete_insert_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.6493068}, "macro.dbt_snowflake.materialization_incremental_snowflake": {"unique_id": "macro.dbt_snowflake.materialization_incremental_snowflake", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "name": "materialization_incremental_snowflake", "macro_sql": "{% materialization incremental, adapter='snowflake' -%}\n \n {% set original_query_tag = set_query_tag() %}\n\n {%- set unique_key = config.get('unique_key') -%}\n {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n {% set target_relation = this %}\n {% set existing_relation = load_relation(this) %}\n {% set tmp_relation = make_temp_relation(this) %}\n\n {#-- Validate early so we don't run SQL if the strategy is invalid --#}\n {% set strategy = dbt_snowflake_validate_get_incremental_strategy(config) -%}\n {% set on_schema_change = incremental_validate_on_schema_change(config.get('on_schema_change'), default='ignore') %}\n\n {{ run_hooks(pre_hooks) }}\n\n {% if existing_relation is none %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n \n {% elif existing_relation.is_view %}\n {#-- Can't overwrite a view with a table - we must drop --#}\n {{ log(\"Dropping relation \" ~ target_relation ~ \" because it is a view and this model is a table.\") }}\n {% do adapter.drop_relation(existing_relation) %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n \n {% elif full_refresh_mode %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n \n {% else %}\n {% do run_query(create_table_as(True, tmp_relation, sql)) %}\n {% do adapter.expand_target_column_types(\n from_relation=tmp_relation,\n to_relation=target_relation) %}\n {#-- Process schema changes. Returns dict of changes if successful. Use source columns for upserting/merging --#}\n {% set dest_columns = process_schema_changes(on_schema_change, tmp_relation, existing_relation) %}\n {% if not dest_columns %}\n {% set dest_columns = adapter.get_columns_in_relation(existing_relation) %}\n {% endif %}\n {% set build_sql = dbt_snowflake_get_incremental_sql(strategy, tmp_relation, target_relation, unique_key, dest_columns) %}\n \n {% endif %}\n\n {%- call statement('main') -%}\n {{ build_sql }}\n {%- endcall -%}\n\n {{ run_hooks(post_hooks) }}\n\n {% set target_relation = target_relation.incorporate(type='table') %}\n {% do persist_docs(target_relation, model) %}\n\n {% do unset_query_tag(original_query_tag) %}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt.should_full_refresh", "macro.dbt.load_relation", "macro.dbt.make_temp_relation", "macro.dbt_snowflake.dbt_snowflake_validate_get_incremental_strategy", "macro.dbt.incremental_validate_on_schema_change", "macro.dbt.run_hooks", "macro.dbt.create_table_as", "macro.dbt.run_query", "macro.dbt.process_schema_changes", "macro.dbt_snowflake.dbt_snowflake_get_incremental_sql", "macro.dbt.statement", "macro.dbt.persist_docs", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.6537652}, "macro.dbt_snowflake.materialization_snapshot_snowflake": {"unique_id": "macro.dbt_snowflake.materialization_snapshot_snowflake", "package_name": "dbt_snowflake", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/snowflake", "path": "macros/materializations/snapshot.sql", "original_file_path": "macros/materializations/snapshot.sql", "name": "materialization_snapshot_snowflake", "macro_sql": "{% materialization snapshot, adapter='snowflake' %}\n {% set original_query_tag = set_query_tag() %}\n\n {% set relations = materialization_snapshot_default() %}\n\n {% do unset_query_tag(original_query_tag) %}\n\n {{ return(relations) }}\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.set_query_tag", "macro.dbt.materialization_snapshot_default", "macro.dbt_snowflake.unset_query_tag"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.654649}, "macro.dbt.run_hooks": {"unique_id": "macro.dbt.run_hooks", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "run_hooks", "macro_sql": "{% macro run_hooks(hooks, inside_transaction=True) %}\n {% for hook in hooks | selectattr('transaction', 'equalto', inside_transaction) %}\n {% if not inside_transaction and loop.first %}\n {% call statement(auto_begin=inside_transaction) %}\n commit;\n {% endcall %}\n {% endif %}\n {% set rendered = render(hook.get('sql')) | trim %}\n {% if (rendered | length) > 0 %}\n {% call statement(auto_begin=inside_transaction) %}\n {{ rendered }}\n {% endcall %}\n {% endif %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.656986}, "macro.dbt.make_hook_config": {"unique_id": "macro.dbt.make_hook_config", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "make_hook_config", "macro_sql": "{% macro make_hook_config(sql, inside_transaction) %}\n {{ tojson({\"sql\": sql, \"transaction\": inside_transaction}) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.657418}, "macro.dbt.before_begin": {"unique_id": "macro.dbt.before_begin", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "before_begin", "macro_sql": "{% macro before_begin(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.657734}, "macro.dbt.in_transaction": {"unique_id": "macro.dbt.in_transaction", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "in_transaction", "macro_sql": "{% macro in_transaction(sql) %}\n {{ make_hook_config(sql, inside_transaction=True) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.658048}, "macro.dbt.after_commit": {"unique_id": "macro.dbt.after_commit", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "after_commit", "macro_sql": "{% macro after_commit(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.65836}, "macro.dbt.set_sql_header": {"unique_id": "macro.dbt.set_sql_header", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "name": "set_sql_header", "macro_sql": "{% macro set_sql_header(config) -%}\n {{ config.set('sql_header', caller()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.6591702}, "macro.dbt.should_full_refresh": {"unique_id": "macro.dbt.should_full_refresh", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "name": "should_full_refresh", "macro_sql": "{% macro should_full_refresh() %}\n {% set config_full_refresh = config.get('full_refresh') %}\n {% if config_full_refresh is none %}\n {% set config_full_refresh = flags.FULL_REFRESH %}\n {% endif %}\n {% do return(config_full_refresh) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.659935}, "macro.dbt.should_store_failures": {"unique_id": "macro.dbt.should_store_failures", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "name": "should_store_failures", "macro_sql": "{% macro should_store_failures() %}\n {% set config_store_failures = config.get('store_failures') %}\n {% if config_store_failures is none %}\n {% set config_store_failures = flags.STORE_FAILURES %}\n {% endif %}\n {% do return(config_store_failures) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.6606}, "macro.dbt.snapshot_merge_sql": {"unique_id": "macro.dbt.snapshot_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshots/snapshot_merge.sql", "name": "snapshot_merge_sql", "macro_sql": "{% macro snapshot_merge_sql(target, source, insert_cols) -%}\n {{ adapter.dispatch('snapshot_merge_sql', 'dbt')(target, source, insert_cols) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__snapshot_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.661515}, "macro.dbt.default__snapshot_merge_sql": {"unique_id": "macro.dbt.default__snapshot_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshots/snapshot_merge.sql", "name": "default__snapshot_merge_sql", "macro_sql": "{% macro default__snapshot_merge_sql(target, source, insert_cols) -%}\n {%- set insert_cols_csv = insert_cols | join(', ') -%}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on DBT_INTERNAL_SOURCE.dbt_scd_id = DBT_INTERNAL_DEST.dbt_scd_id\n\n when matched\n and DBT_INTERNAL_DEST.dbt_valid_to is null\n and DBT_INTERNAL_SOURCE.dbt_change_type in ('update', 'delete')\n then update\n set dbt_valid_to = DBT_INTERNAL_SOURCE.dbt_valid_to\n\n when not matched\n and DBT_INTERNAL_SOURCE.dbt_change_type = 'insert'\n then insert ({{ insert_cols_csv }})\n values ({{ insert_cols_csv }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.6621}, "macro.dbt.strategy_dispatch": {"unique_id": "macro.dbt.strategy_dispatch", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "strategy_dispatch", "macro_sql": "{% macro strategy_dispatch(name) -%}\n{% set original_name = name %}\n {% if '.' in name %}\n {% set package_name, name = name.split(\".\", 1) %}\n {% else %}\n {% set package_name = none %}\n {% endif %}\n\n {% if package_name is none %}\n {% set package_context = context %}\n {% elif package_name in context %}\n {% set package_context = context[package_name] %}\n {% else %}\n {% set error_msg %}\n Could not find package '{{package_name}}', called with '{{original_name}}'\n {% endset %}\n {{ exceptions.raise_compiler_error(error_msg | trim) }}\n {% endif %}\n\n {%- set search_name = 'snapshot_' ~ name ~ '_strategy' -%}\n\n {% if search_name not in package_context %}\n {% set error_msg %}\n The specified strategy macro '{{name}}' was not found in package '{{ package_name }}'\n {% endset %}\n {{ exceptions.raise_compiler_error(error_msg | trim) }}\n {% endif %}\n {{ return(package_context[search_name]) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.667943}, "macro.dbt.snapshot_hash_arguments": {"unique_id": "macro.dbt.snapshot_hash_arguments", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_hash_arguments", "macro_sql": "{% macro snapshot_hash_arguments(args) -%}\n {{ adapter.dispatch('snapshot_hash_arguments', 'dbt')(args) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.668305}, "macro.dbt.default__snapshot_hash_arguments": {"unique_id": "macro.dbt.default__snapshot_hash_arguments", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "default__snapshot_hash_arguments", "macro_sql": "{% macro default__snapshot_hash_arguments(args) -%}\n md5({%- for arg in args -%}\n coalesce(cast({{ arg }} as varchar ), '')\n {% if not loop.last %} || '|' || {% endif %}\n {%- endfor -%})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.668788}, "macro.dbt.snapshot_get_time": {"unique_id": "macro.dbt.snapshot_get_time", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_get_time", "macro_sql": "{% macro snapshot_get_time() -%}\n {{ adapter.dispatch('snapshot_get_time', 'dbt')() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.6691}, "macro.dbt.default__snapshot_get_time": {"unique_id": "macro.dbt.default__snapshot_get_time", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "default__snapshot_get_time", "macro_sql": "{% macro default__snapshot_get_time() -%}\n {{ current_timestamp() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.669324}, "macro.dbt.snapshot_timestamp_strategy": {"unique_id": "macro.dbt.snapshot_timestamp_strategy", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_timestamp_strategy", "macro_sql": "{% macro snapshot_timestamp_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n {% set primary_key = config['unique_key'] %}\n {% set updated_at = config['updated_at'] %}\n {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n\n {#/*\n The snapshot relation might not have an {{ updated_at }} value if the\n snapshot strategy is changed from `check` to `timestamp`. We\n should use a dbt-created column for the comparison in the snapshot\n table instead of assuming that the user-supplied {{ updated_at }}\n will be present in the historical data.\n\n See https://github.com/dbt-labs/dbt-core/issues/2350\n */ #}\n {% set row_changed_expr -%}\n ({{ snapshotted_rel }}.dbt_valid_from < {{ current_rel }}.{{ updated_at }})\n {%- endset %}\n\n {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n {% do return({\n \"unique_key\": primary_key,\n \"updated_at\": updated_at,\n \"row_changed\": row_changed_expr,\n \"scd_id\": scd_id_expr,\n \"invalidate_hard_deletes\": invalidate_hard_deletes\n }) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.670882}, "macro.dbt.snapshot_string_as_time": {"unique_id": "macro.dbt.snapshot_string_as_time", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_string_as_time", "macro_sql": "{% macro snapshot_string_as_time(timestamp) -%}\n {{ adapter.dispatch('snapshot_string_as_time', 'dbt')(timestamp) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__snapshot_string_as_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.671349}, "macro.dbt.default__snapshot_string_as_time": {"unique_id": "macro.dbt.default__snapshot_string_as_time", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "default__snapshot_string_as_time", "macro_sql": "{% macro default__snapshot_string_as_time(timestamp) %}\n {% do exceptions.raise_not_implemented(\n 'snapshot_string_as_time macro not implemented for adapter '+adapter.type()\n ) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.671723}, "macro.dbt.snapshot_check_all_get_existing_columns": {"unique_id": "macro.dbt.snapshot_check_all_get_existing_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_check_all_get_existing_columns", "macro_sql": "{% macro snapshot_check_all_get_existing_columns(node, target_exists) -%}\n {%- set query_columns = get_columns_in_query(node['compiled_sql']) -%}\n {%- if not target_exists -%}\n {# no table yet -> return whatever the query does #}\n {{ return([false, query_columns]) }}\n {%- endif -%}\n {# handle any schema changes #}\n {%- set target_table = node.get('alias', node.get('name')) -%}\n {%- set target_relation = adapter.get_relation(database=node.database, schema=node.schema, identifier=target_table) -%}\n {%- set existing_cols = get_columns_in_query('select * from ' ~ target_relation) -%}\n {%- set ns = namespace() -%} {# handle for-loop scoping with a namespace #}\n {%- set ns.column_added = false -%}\n\n {%- set intersection = [] -%}\n {%- for col in query_columns -%}\n {%- if col in existing_cols -%}\n {%- do intersection.append(col) -%}\n {%- else -%}\n {% set ns.column_added = true %}\n {%- endif -%}\n {%- endfor -%}\n {{ return([ns.column_added, intersection]) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.673886}, "macro.dbt.snapshot_check_strategy": {"unique_id": "macro.dbt.snapshot_check_strategy", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_check_strategy", "macro_sql": "{% macro snapshot_check_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n {% set check_cols_config = config['check_cols'] %}\n {% set primary_key = config['unique_key'] %}\n {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n \n {% set select_current_time -%}\n select {{ snapshot_get_time() }} as snapshot_start\n {%- endset %}\n\n {#-- don't access the column by name, to avoid dealing with casing issues on snowflake #}\n {%- set now = run_query(select_current_time)[0][0] -%}\n {% if now is none or now is undefined -%}\n {%- do exceptions.raise_compiler_error('Could not get a snapshot start time from the database') -%}\n {%- endif %}\n {% set updated_at = config.get('updated_at', snapshot_string_as_time(now)) %}\n\n {% set column_added = false %}\n\n {% if check_cols_config == 'all' %}\n {% set column_added, check_cols = snapshot_check_all_get_existing_columns(node, target_exists) %}\n {% elif check_cols_config is iterable and (check_cols_config | length) > 0 %}\n {% set check_cols = check_cols_config %}\n {% else %}\n {% do exceptions.raise_compiler_error(\"Invalid value for 'check_cols': \" ~ check_cols_config) %}\n {% endif %}\n\n {%- set row_changed_expr -%}\n (\n {%- if column_added -%}\n TRUE\n {%- else -%}\n {%- for col in check_cols -%}\n {{ snapshotted_rel }}.{{ col }} != {{ current_rel }}.{{ col }}\n or\n (\n (({{ snapshotted_rel }}.{{ col }} is null) and not ({{ current_rel }}.{{ col }} is null))\n or\n ((not {{ snapshotted_rel }}.{{ col }} is null) and ({{ current_rel }}.{{ col }} is null))\n )\n {%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n {%- endif -%}\n )\n {%- endset %}\n\n {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n {% do return({\n \"unique_key\": primary_key,\n \"updated_at\": updated_at,\n \"row_changed\": row_changed_expr,\n \"scd_id\": scd_id_expr,\n \"invalidate_hard_deletes\": invalidate_hard_deletes\n }) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.snapshot_get_time", "macro.dbt.run_query", "macro.dbt.snapshot_string_as_time", "macro.dbt.snapshot_check_all_get_existing_columns", "macro.dbt.snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.6779258}, "macro.dbt.create_columns": {"unique_id": "macro.dbt.create_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "create_columns", "macro_sql": "{% macro create_columns(relation, columns) %}\n {{ adapter.dispatch('create_columns', 'dbt')(relation, columns) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__create_columns"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.6827788}, "macro.dbt.default__create_columns": {"unique_id": "macro.dbt.default__create_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "default__create_columns", "macro_sql": "{% macro default__create_columns(relation, columns) %}\n {% for column in columns %}\n {% call statement() %}\n alter table {{ relation }} add column \"{{ column.name }}\" {{ column.data_type }};\n {% endcall %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.683404}, "macro.dbt.post_snapshot": {"unique_id": "macro.dbt.post_snapshot", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "post_snapshot", "macro_sql": "{% macro post_snapshot(staging_relation) %}\n {{ adapter.dispatch('post_snapshot', 'dbt')(staging_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.683771}, "macro.dbt.default__post_snapshot": {"unique_id": "macro.dbt.default__post_snapshot", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "default__post_snapshot", "macro_sql": "{% macro default__post_snapshot(staging_relation) %}\n {# no-op #}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.68397}, "macro.dbt.snapshot_staging_table": {"unique_id": "macro.dbt.snapshot_staging_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "snapshot_staging_table", "macro_sql": "{% macro snapshot_staging_table(strategy, source_sql, target_relation) -%}\n {{ adapter.dispatch('snapshot_staging_table', 'dbt')(strategy, source_sql, target_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__snapshot_staging_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.684421}, "macro.dbt.default__snapshot_staging_table": {"unique_id": "macro.dbt.default__snapshot_staging_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "default__snapshot_staging_table", "macro_sql": "{% macro default__snapshot_staging_table(strategy, source_sql, target_relation) -%}\n\n with snapshot_query as (\n\n {{ source_sql }}\n\n ),\n\n snapshotted_data as (\n\n select *,\n {{ strategy.unique_key }} as dbt_unique_key\n\n from {{ target_relation }}\n where dbt_valid_to is null\n\n ),\n\n insertions_source_data as (\n\n select\n *,\n {{ strategy.unique_key }} as dbt_unique_key,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to,\n {{ strategy.scd_id }} as dbt_scd_id\n\n from snapshot_query\n ),\n\n updates_source_data as (\n\n select\n *,\n {{ strategy.unique_key }} as dbt_unique_key,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n {{ strategy.updated_at }} as dbt_valid_to\n\n from snapshot_query\n ),\n\n {%- if strategy.invalidate_hard_deletes %}\n\n deletes_source_data as (\n\n select \n *,\n {{ strategy.unique_key }} as dbt_unique_key\n from snapshot_query\n ),\n {% endif %}\n\n insertions as (\n\n select\n 'insert' as dbt_change_type,\n source_data.*\n\n from insertions_source_data as source_data\n left outer join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where snapshotted_data.dbt_unique_key is null\n or (\n snapshotted_data.dbt_unique_key is not null\n and (\n {{ strategy.row_changed }}\n )\n )\n\n ),\n\n updates as (\n\n select\n 'update' as dbt_change_type,\n source_data.*,\n snapshotted_data.dbt_scd_id\n\n from updates_source_data as source_data\n join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where (\n {{ strategy.row_changed }}\n )\n )\n\n {%- if strategy.invalidate_hard_deletes -%}\n ,\n\n deletes as (\n \n select\n 'delete' as dbt_change_type,\n source_data.*,\n {{ snapshot_get_time() }} as dbt_valid_from,\n {{ snapshot_get_time() }} as dbt_updated_at,\n {{ snapshot_get_time() }} as dbt_valid_to,\n snapshotted_data.dbt_scd_id\n \n from snapshotted_data\n left join deletes_source_data as source_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where source_data.dbt_unique_key is null\n )\n {%- endif %}\n\n select * from insertions\n union all\n select * from updates\n {%- if strategy.invalidate_hard_deletes %}\n union all\n select * from deletes\n {%- endif %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.6862679}, "macro.dbt.build_snapshot_table": {"unique_id": "macro.dbt.build_snapshot_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "build_snapshot_table", "macro_sql": "{% macro build_snapshot_table(strategy, sql) -%}\n {{ adapter.dispatch('build_snapshot_table', 'dbt')(strategy, sql) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__build_snapshot_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.686681}, "macro.dbt.default__build_snapshot_table": {"unique_id": "macro.dbt.default__build_snapshot_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "default__build_snapshot_table", "macro_sql": "{% macro default__build_snapshot_table(strategy, sql) %}\n\n select *,\n {{ strategy.scd_id }} as dbt_scd_id,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to\n from (\n {{ sql }}\n ) sbq\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.687237}, "macro.dbt.build_snapshot_staging_table": {"unique_id": "macro.dbt.build_snapshot_staging_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "build_snapshot_staging_table", "macro_sql": "{% macro build_snapshot_staging_table(strategy, sql, target_relation) %}\n {% set tmp_relation = make_temp_relation(target_relation) %}\n\n {% set select = snapshot_staging_table(strategy, sql, target_relation) %}\n\n {% call statement('build_snapshot_staging_relation') %}\n {{ create_table_as(True, tmp_relation, select) }}\n {% endcall %}\n\n {% do return(tmp_relation) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_temp_relation", "macro.dbt.snapshot_staging_table", "macro.dbt.statement", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.68818}, "macro.dbt.materialization_snapshot_default": {"unique_id": "macro.dbt.materialization_snapshot_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/snapshot.sql", "original_file_path": "macros/materializations/snapshots/snapshot.sql", "name": "materialization_snapshot_default", "macro_sql": "{% materialization snapshot, default %}\n {%- set config = model['config'] -%}\n\n {%- set target_table = model.get('alias', model.get('name')) -%}\n\n {%- set strategy_name = config.get('strategy') -%}\n {%- set unique_key = config.get('unique_key') %}\n\n {% if not adapter.check_schema_exists(model.database, model.schema) %}\n {% do create_schema(model.database, model.schema) %}\n {% endif %}\n\n {% set target_relation_exists, target_relation = get_or_create_relation(\n database=model.database,\n schema=model.schema,\n identifier=target_table,\n type='table') -%}\n\n {%- if not target_relation.is_table -%}\n {% do exceptions.relation_wrong_type(target_relation, 'table') %}\n {%- endif -%}\n\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set strategy_macro = strategy_dispatch(strategy_name) %}\n {% set strategy = strategy_macro(model, \"snapshotted_data\", \"source_data\", config, target_relation_exists) %}\n\n {% if not target_relation_exists %}\n\n {% set build_sql = build_snapshot_table(strategy, model['compiled_sql']) %}\n {% set final_sql = create_table_as(False, target_relation, build_sql) %}\n\n {% else %}\n\n {{ adapter.valid_snapshot_target(target_relation) }}\n\n {% set staging_table = build_snapshot_staging_table(strategy, sql, target_relation) %}\n\n -- this may no-op if the database does not require column expansion\n {% do adapter.expand_target_column_types(from_relation=staging_table,\n to_relation=target_relation) %}\n\n {% set missing_columns = adapter.get_missing_columns(staging_table, target_relation)\n | rejectattr('name', 'equalto', 'dbt_change_type')\n | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n | rejectattr('name', 'equalto', 'dbt_unique_key')\n | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n | list %}\n\n {% do create_columns(target_relation, missing_columns) %}\n\n {% set source_columns = adapter.get_columns_in_relation(staging_table)\n | rejectattr('name', 'equalto', 'dbt_change_type')\n | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n | rejectattr('name', 'equalto', 'dbt_unique_key')\n | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n | list %}\n\n {% set quoted_source_columns = [] %}\n {% for column in source_columns %}\n {% do quoted_source_columns.append(adapter.quote(column.name)) %}\n {% endfor %}\n\n {% set final_sql = snapshot_merge_sql(\n target = target_relation,\n source = staging_table,\n insert_cols = quoted_source_columns\n )\n %}\n\n {% endif %}\n\n {% call statement('main') %}\n {{ final_sql }}\n {% endcall %}\n\n {% do persist_docs(target_relation, model) %}\n\n {% if not target_relation_exists %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {% if staging_table is defined %}\n {% do post_snapshot(staging_table) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_schema", "macro.dbt.get_or_create_relation", "macro.dbt.run_hooks", "macro.dbt.strategy_dispatch", "macro.dbt.build_snapshot_table", "macro.dbt.create_table_as", "macro.dbt.build_snapshot_staging_table", "macro.dbt.create_columns", "macro.dbt.snapshot_merge_sql", "macro.dbt.statement", "macro.dbt.persist_docs", "macro.dbt.create_indexes", "macro.dbt.post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.6990862}, "macro.dbt.materialization_test_default": {"unique_id": "macro.dbt.materialization_test_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/test.sql", "original_file_path": "macros/materializations/tests/test.sql", "name": "materialization_test_default", "macro_sql": "{%- materialization test, default -%}\n\n {% set relations = [] %}\n\n {% if should_store_failures() %}\n\n {% set identifier = model['alias'] %}\n {% set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n {% set target_relation = api.Relation.create(\n identifier=identifier, schema=schema, database=database, type='table') -%} %}\n \n {% if old_relation %}\n {% do adapter.drop_relation(old_relation) %}\n {% endif %}\n \n {% call statement(auto_begin=True) %}\n {{ create_table_as(False, target_relation, sql) }}\n {% endcall %}\n \n {% do relations.append(target_relation) %}\n \n {% set main_sql %}\n select *\n from {{ target_relation }}\n {% endset %}\n \n {{ adapter.commit() }}\n \n {% else %}\n\n {% set main_sql = sql %}\n \n {% endif %}\n\n {% set limit = config.get('limit') %}\n {% set fail_calc = config.get('fail_calc') %}\n {% set warn_if = config.get('warn_if') %}\n {% set error_if = config.get('error_if') %}\n\n {% call statement('main', fetch_result=True) -%}\n\n {{ get_test_sql(main_sql, fail_calc, warn_if, error_if, limit)}}\n\n {%- endcall %}\n \n {{ return({'relations': relations}) }}\n\n{%- endmaterialization -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.should_store_failures", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt.get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.7032561}, "macro.dbt.get_test_sql": {"unique_id": "macro.dbt.get_test_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/helpers.sql", "original_file_path": "macros/materializations/tests/helpers.sql", "name": "get_test_sql", "macro_sql": "{% macro get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n {{ adapter.dispatch('get_test_sql', 'dbt')(main_sql, fail_calc, warn_if, error_if, limit) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.704303}, "macro.dbt.default__get_test_sql": {"unique_id": "macro.dbt.default__get_test_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/helpers.sql", "original_file_path": "macros/materializations/tests/helpers.sql", "name": "default__get_test_sql", "macro_sql": "{% macro default__get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n select\n {{ fail_calc }} as failures,\n {{ fail_calc }} {{ warn_if }} as should_warn,\n {{ fail_calc }} {{ error_if }} as should_error\n from (\n {{ main_sql }}\n {{ \"limit \" ~ limit if limit != none }}\n ) dbt_internal_test\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.705049}, "macro.dbt.get_where_subquery": {"unique_id": "macro.dbt.get_where_subquery", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/where_subquery.sql", "original_file_path": "macros/materializations/tests/where_subquery.sql", "name": "get_where_subquery", "macro_sql": "{% macro get_where_subquery(relation) -%}\n {% do return(adapter.dispatch('get_where_subquery', 'dbt')(relation)) %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_where_subquery"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.705879}, "macro.dbt.default__get_where_subquery": {"unique_id": "macro.dbt.default__get_where_subquery", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/where_subquery.sql", "original_file_path": "macros/materializations/tests/where_subquery.sql", "name": "default__get_where_subquery", "macro_sql": "{% macro default__get_where_subquery(relation) -%}\n {% set where = config.get('where', '') %}\n {% if where %}\n {%- set filtered -%}\n (select * from {{ relation }} where {{ where }}) dbt_subquery\n {%- endset -%}\n {% do return(filtered) %}\n {%- else -%}\n {% do return(relation) %}\n {%- endif -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.706709}, "macro.dbt.get_quoted_csv": {"unique_id": "macro.dbt.get_quoted_csv", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "name": "get_quoted_csv", "macro_sql": "{% macro get_quoted_csv(column_names) %}\n \n {% set quoted = [] %}\n {% for col in column_names -%}\n {%- do quoted.append(adapter.quote(col)) -%}\n {%- endfor %}\n\n {%- set dest_cols_csv = quoted | join(', ') -%}\n {{ return(dest_cols_csv) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.708321}, "macro.dbt.diff_columns": {"unique_id": "macro.dbt.diff_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "name": "diff_columns", "macro_sql": "{% macro diff_columns(source_columns, target_columns) %}\n\n {% set result = [] %}\n {% set source_names = source_columns | map(attribute = 'column') | list %}\n {% set target_names = target_columns | map(attribute = 'column') | list %}\n \n {# --check whether the name attribute exists in the target - this does not perform a data type check #}\n {% for sc in source_columns %}\n {% if sc.name not in target_names %}\n {{ result.append(sc) }}\n {% endif %}\n {% endfor %}\n \n {{ return(result) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.709514}, "macro.dbt.diff_column_data_types": {"unique_id": "macro.dbt.diff_column_data_types", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "name": "diff_column_data_types", "macro_sql": "{% macro diff_column_data_types(source_columns, target_columns) %}\n \n {% set result = [] %}\n {% for sc in source_columns %}\n {% set tc = target_columns | selectattr(\"name\", \"equalto\", sc.name) | list | first %}\n {% if tc %}\n {% if sc.data_type != tc.data_type %}\n {{ result.append( { 'column_name': tc.name, 'new_type': sc.data_type } ) }} \n {% endif %}\n {% endif %}\n {% endfor %}\n\n {{ return(result) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.7108421}, "macro.dbt.get_merge_sql": {"unique_id": "macro.dbt.get_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "get_merge_sql", "macro_sql": "{% macro get_merge_sql(target, source, unique_key, dest_columns, predicates=none) -%}\n {{ adapter.dispatch('get_merge_sql', 'dbt')(target, source, unique_key, dest_columns, predicates) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.7152169}, "macro.dbt.default__get_merge_sql": {"unique_id": "macro.dbt.default__get_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "default__get_merge_sql", "macro_sql": "{% macro default__get_merge_sql(target, source, unique_key, dest_columns, predicates) -%}\n {%- set predicates = [] if predicates is none else [] + predicates -%}\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n {%- set update_columns = config.get('merge_update_columns', default = dest_columns | map(attribute=\"quoted\") | list) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {% if unique_key %}\n {% set unique_key_match %}\n DBT_INTERNAL_SOURCE.{{ unique_key }} = DBT_INTERNAL_DEST.{{ unique_key }}\n {% endset %}\n {% do predicates.append(unique_key_match) %}\n {% else %}\n {% do predicates.append('FALSE') %}\n {% endif %}\n\n {{ sql_header if sql_header is not none }}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on {{ predicates | join(' and ') }}\n\n {% if unique_key %}\n when matched then update set\n {% for column_name in update_columns -%}\n {{ column_name }} = DBT_INTERNAL_SOURCE.{{ column_name }}\n {%- if not loop.last %}, {%- endif %}\n {%- endfor %}\n {% endif %}\n\n when not matched then insert\n ({{ dest_cols_csv }})\n values\n ({{ dest_cols_csv }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.717737}, "macro.dbt.get_delete_insert_merge_sql": {"unique_id": "macro.dbt.get_delete_insert_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "get_delete_insert_merge_sql", "macro_sql": "{% macro get_delete_insert_merge_sql(target, source, unique_key, dest_columns) -%}\n {{ adapter.dispatch('get_delete_insert_merge_sql', 'dbt')(target, source, unique_key, dest_columns) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_delete_insert_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.718247}, "macro.dbt.default__get_delete_insert_merge_sql": {"unique_id": "macro.dbt.default__get_delete_insert_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "default__get_delete_insert_merge_sql", "macro_sql": "{% macro default__get_delete_insert_merge_sql(target, source, unique_key, dest_columns) -%}\n\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n {% if unique_key is not none %}\n delete from {{ target }}\n where ({{ unique_key }}) in (\n select ({{ unique_key }})\n from {{ source }}\n );\n {% endif %}\n\n insert into {{ target }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ source }}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.719182}, "macro.dbt.get_insert_overwrite_merge_sql": {"unique_id": "macro.dbt.get_insert_overwrite_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "get_insert_overwrite_merge_sql", "macro_sql": "{% macro get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header=false) -%}\n {{ adapter.dispatch('get_insert_overwrite_merge_sql', 'dbt')(target, source, dest_columns, predicates, include_sql_header) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_insert_overwrite_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.719754}, "macro.dbt.default__get_insert_overwrite_merge_sql": {"unique_id": "macro.dbt.default__get_insert_overwrite_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "default__get_insert_overwrite_merge_sql", "macro_sql": "{% macro default__get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header) -%}\n {%- set predicates = [] if predicates is none else [] + predicates -%}\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none and include_sql_header }}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on FALSE\n\n when not matched by source\n {% if predicates %} and {{ predicates | join(' and ') }} {% endif %}\n then delete\n\n when not matched then insert\n ({{ dest_cols_csv }})\n values\n ({{ dest_cols_csv }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.721118}, "macro.dbt.is_incremental": {"unique_id": "macro.dbt.is_incremental", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/is_incremental.sql", "original_file_path": "macros/materializations/models/incremental/is_incremental.sql", "name": "is_incremental", "macro_sql": "{% macro is_incremental() %}\n {#-- do not run introspective queries in parsing #}\n {% if not execute %}\n {{ return(False) }}\n {% else %}\n {% set relation = adapter.get_relation(this.database, this.schema, this.table) %}\n {{ return(relation is not none\n and relation.type == 'table'\n and model.config.materialized == 'incremental'\n and not should_full_refresh()) }}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.should_full_refresh"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.7225401}, "macro.dbt.materialization_incremental_default": {"unique_id": "macro.dbt.materialization_incremental_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/incremental.sql", "original_file_path": "macros/materializations/models/incremental/incremental.sql", "name": "materialization_incremental_default", "macro_sql": "{% materialization incremental, default -%}\n\n {% set unique_key = config.get('unique_key') %}\n\n {% set target_relation = this.incorporate(type='table') %}\n {% set existing_relation = load_relation(this) %}\n {% set tmp_relation = make_temp_relation(target_relation) %}\n {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n {% set on_schema_change = incremental_validate_on_schema_change(config.get('on_schema_change'), default='ignore') %}\n\n {% set tmp_identifier = model['name'] + '__dbt_tmp' %}\n {% set backup_identifier = model['name'] + \"__dbt_backup\" %}\n\n -- the intermediate_ and backup_ relations should not already exist in the database; get_relation\n -- will return None in that case. Otherwise, we get a relation that we can drop\n -- later, before we try to use this name for the current operation. This has to happen before\n -- BEGIN, in a separate transaction\n {% set preexisting_intermediate_relation = adapter.get_relation(identifier=tmp_identifier, \n schema=schema,\n database=database) %} \n {% set preexisting_backup_relation = adapter.get_relation(identifier=backup_identifier,\n schema=schema,\n database=database) %}\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set to_drop = [] %}\n\n {# -- first check whether we want to full refresh for source view or config reasons #}\n {% set trigger_full_refresh = (full_refresh_mode or existing_relation.is_view) %}\n\n {% if existing_relation is none %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n{% elif trigger_full_refresh %}\n {#-- Make sure the backup doesn't exist so we don't encounter issues with the rename below #}\n {% set tmp_identifier = model['name'] + '__dbt_tmp' %}\n {% set backup_identifier = model['name'] + '__dbt_backup' %}\n {% set intermediate_relation = existing_relation.incorporate(path={\"identifier\": tmp_identifier}) %}\n {% set backup_relation = existing_relation.incorporate(path={\"identifier\": backup_identifier}) %}\n\n {% set build_sql = create_table_as(False, intermediate_relation, sql) %}\n {% set need_swap = true %}\n {% do to_drop.append(backup_relation) %}\n {% else %}\n {% do run_query(create_table_as(True, tmp_relation, sql)) %}\n {% do adapter.expand_target_column_types(\n from_relation=tmp_relation,\n to_relation=target_relation) %}\n {#-- Process schema changes. Returns dict of changes if successful. Use source columns for upserting/merging --#}\n {% set dest_columns = process_schema_changes(on_schema_change, tmp_relation, existing_relation) %}\n {% if not dest_columns %}\n {% set dest_columns = adapter.get_columns_in_relation(existing_relation) %}\n {% endif %}\n {% set build_sql = get_delete_insert_merge_sql(target_relation, tmp_relation, unique_key, dest_columns) %}\n \n {% endif %}\n\n {% call statement(\"main\") %}\n {{ build_sql }}\n {% endcall %}\n\n {% if need_swap %} \n {% do adapter.rename_relation(target_relation, backup_relation) %} \n {% do adapter.rename_relation(intermediate_relation, target_relation) %} \n {% endif %}\n\n {% do persist_docs(target_relation, model) %}\n\n {% if existing_relation is none or existing_relation.is_view or should_full_refresh() %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {% do adapter.commit() %}\n\n {% for rel in to_drop %}\n {% do adapter.drop_relation(rel) %}\n {% endfor %}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.load_relation", "macro.dbt.make_temp_relation", "macro.dbt.should_full_refresh", "macro.dbt.incremental_validate_on_schema_change", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.create_table_as", "macro.dbt.run_query", "macro.dbt.process_schema_changes", "macro.dbt.get_delete_insert_merge_sql", "macro.dbt.statement", "macro.dbt.persist_docs", "macro.dbt.create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.732165}, "macro.dbt.incremental_validate_on_schema_change": {"unique_id": "macro.dbt.incremental_validate_on_schema_change", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "name": "incremental_validate_on_schema_change", "macro_sql": "{% macro incremental_validate_on_schema_change(on_schema_change, default='ignore') %}\n \n {% if on_schema_change not in ['sync_all_columns', 'append_new_columns', 'fail', 'ignore'] %}\n \n {% set log_message = 'Invalid value for on_schema_change (%s) specified. Setting default value of %s.' % (on_schema_change, default) %}\n {% do log(log_message) %}\n \n {{ return(default) }}\n\n {% else %}\n\n {{ return(on_schema_change) }}\n \n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.739562}, "macro.dbt.check_for_schema_changes": {"unique_id": "macro.dbt.check_for_schema_changes", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "name": "check_for_schema_changes", "macro_sql": "{% macro check_for_schema_changes(source_relation, target_relation) %}\n \n {% set schema_changed = False %}\n \n {%- set source_columns = adapter.get_columns_in_relation(source_relation) -%}\n {%- set target_columns = adapter.get_columns_in_relation(target_relation) -%}\n {%- set source_not_in_target = diff_columns(source_columns, target_columns) -%}\n {%- set target_not_in_source = diff_columns(target_columns, source_columns) -%}\n\n {% set new_target_types = diff_column_data_types(source_columns, target_columns) %}\n\n {% if source_not_in_target != [] %}\n {% set schema_changed = True %}\n {% elif target_not_in_source != [] or new_target_types != [] %}\n {% set schema_changed = True %}\n {% elif new_target_types != [] %}\n {% set schema_changed = True %}\n {% endif %}\n \n {% set changes_dict = {\n 'schema_changed': schema_changed,\n 'source_not_in_target': source_not_in_target,\n 'target_not_in_source': target_not_in_source,\n 'source_columns': source_columns,\n 'target_columns': target_columns,\n 'new_target_types': new_target_types\n } %}\n\n {% set msg %}\n In {{ target_relation }}:\n Schema changed: {{ schema_changed }}\n Source columns not in target: {{ source_not_in_target }}\n Target columns not in source: {{ target_not_in_source }}\n New column types: {{ new_target_types }}\n {% endset %}\n \n {% do log(msg) %}\n\n {{ return(changes_dict) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.diff_columns", "macro.dbt.diff_column_data_types"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.742211}, "macro.dbt.sync_column_schemas": {"unique_id": "macro.dbt.sync_column_schemas", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "name": "sync_column_schemas", "macro_sql": "{% macro sync_column_schemas(on_schema_change, target_relation, schema_changes_dict) %}\n \n {%- set add_to_target_arr = schema_changes_dict['source_not_in_target'] -%}\n\n {%- if on_schema_change == 'append_new_columns'-%}\n {%- if add_to_target_arr | length > 0 -%}\n {%- do alter_relation_add_remove_columns(target_relation, add_to_target_arr, none) -%}\n {%- endif -%}\n \n {% elif on_schema_change == 'sync_all_columns' %}\n {%- set remove_from_target_arr = schema_changes_dict['target_not_in_source'] -%}\n {%- set new_target_types = schema_changes_dict['new_target_types'] -%}\n \n {% if add_to_target_arr | length > 0 or remove_from_target_arr | length > 0 %} \n {%- do alter_relation_add_remove_columns(target_relation, add_to_target_arr, remove_from_target_arr) -%}\n {% endif %}\n\n {% if new_target_types != [] %}\n {% for ntt in new_target_types %}\n {% set column_name = ntt['column_name'] %}\n {% set new_type = ntt['new_type'] %}\n {% do alter_column_type(target_relation, column_name, new_type) %}\n {% endfor %}\n {% endif %}\n \n {% endif %}\n\n {% set schema_change_message %}\n In {{ target_relation }}:\n Schema change approach: {{ on_schema_change }}\n Columns added: {{ add_to_target_arr }}\n Columns removed: {{ remove_from_target_arr }}\n Data types changed: {{ new_target_types }}\n {% endset %}\n \n {% do log(schema_change_message) %}\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.alter_relation_add_remove_columns", "macro.dbt.alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.744809}, "macro.dbt.process_schema_changes": {"unique_id": "macro.dbt.process_schema_changes", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "name": "process_schema_changes", "macro_sql": "{% macro process_schema_changes(on_schema_change, source_relation, target_relation) %}\n \n {% if on_schema_change == 'ignore' %}\n\n {{ return({}) }}\n\n {% else %}\n \n {% set schema_changes_dict = check_for_schema_changes(source_relation, target_relation) %}\n \n {% if schema_changes_dict['schema_changed'] %}\n \n {% if on_schema_change == 'fail' %}\n \n {% set fail_msg %}\n The source and target schemas on this incremental model are out of sync!\n They can be reconciled in several ways: \n - set the `on_schema_change` config to either append_new_columns or sync_all_columns, depending on your situation.\n - Re-run the incremental model with `full_refresh: True` to update the target schema.\n - update the schema manually and re-run the process.\n {% endset %}\n \n {% do exceptions.raise_compiler_error(fail_msg) %}\n \n {# -- unless we ignore, run the sync operation per the config #}\n {% else %}\n \n {% do sync_column_schemas(on_schema_change, target_relation, schema_changes_dict) %}\n \n {% endif %}\n \n {% endif %}\n\n {{ return(schema_changes_dict['source_columns']) }}\n \n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.check_for_schema_changes", "macro.dbt.sync_column_schemas"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.746426}, "macro.dbt.materialization_table_default": {"unique_id": "macro.dbt.materialization_table_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/table.sql", "original_file_path": "macros/materializations/models/table/table.sql", "name": "materialization_table_default", "macro_sql": "{% materialization table, default %}\n {%- set identifier = model['alias'] -%}\n {%- set tmp_identifier = model['name'] + '__dbt_tmp' -%}\n {%- set backup_identifier = model['name'] + '__dbt_backup' -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier,\n schema=schema,\n database=database,\n type='table') -%}\n {%- set intermediate_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema,\n database=database,\n type='table') -%}\n -- the intermediate_relation should not already exist in the database; get_relation\n -- will return None in that case. Otherwise, we get a relation that we can drop\n -- later, before we try to use this name for the current operation\n {%- set preexisting_intermediate_relation = adapter.get_relation(identifier=tmp_identifier, \n schema=schema,\n database=database) -%}\n /*\n See ../view/view.sql for more information about this relation.\n */\n {%- set backup_relation_type = 'table' if old_relation is none else old_relation.type -%}\n {%- set backup_relation = api.Relation.create(identifier=backup_identifier,\n schema=schema,\n database=database,\n type=backup_relation_type) -%}\n -- as above, the backup_relation should not already exist\n {%- set preexisting_backup_relation = adapter.get_relation(identifier=backup_identifier,\n schema=schema,\n database=database) -%}\n\n\n -- drop the temp relations if they exist already in the database\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% call statement('main') -%}\n {{ get_create_table_as_sql(False, intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n {% if old_relation is not none %}\n {{ adapter.rename_relation(old_relation, backup_relation) }}\n {% endif %}\n\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {% do create_indexes(target_relation) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {% do persist_docs(target_relation, model) %}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n -- finally, drop the existing/backup relation after the commit\n {{ drop_relation_if_exists(backup_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.get_create_table_as_sql", "macro.dbt.create_indexes", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.753275}, "macro.dbt.get_create_table_as_sql": {"unique_id": "macro.dbt.get_create_table_as_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.sql", "name": "get_create_table_as_sql", "macro_sql": "{% macro get_create_table_as_sql(temporary, relation, sql) -%}\n {{ adapter.dispatch('get_create_table_as_sql', 'dbt')(temporary, relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_create_table_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.7543318}, "macro.dbt.default__get_create_table_as_sql": {"unique_id": "macro.dbt.default__get_create_table_as_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.sql", "name": "default__get_create_table_as_sql", "macro_sql": "{% macro default__get_create_table_as_sql(temporary, relation, sql) -%}\n {{ return(create_table_as(temporary, relation, sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.7547379}, "macro.dbt.create_table_as": {"unique_id": "macro.dbt.create_table_as", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.sql", "name": "create_table_as", "macro_sql": "{% macro create_table_as(temporary, relation, sql) -%}\n {{ adapter.dispatch('create_table_as', 'dbt')(temporary, relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.755185}, "macro.dbt.default__create_table_as": {"unique_id": "macro.dbt.default__create_table_as", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.sql", "name": "default__create_table_as", "macro_sql": "{% macro default__create_table_as(temporary, relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n \n {{ sql_header if sql_header is not none }}\n \n create {% if temporary: -%}temporary{%- endif %} table\n {{ relation.include(database=(not temporary), schema=(not temporary)) }}\n as (\n {{ sql }}\n );\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.7560709}, "macro.dbt.materialization_view_default": {"unique_id": "macro.dbt.materialization_view_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/view.sql", "original_file_path": "macros/materializations/models/view/view.sql", "name": "materialization_view_default", "macro_sql": "{%- materialization view, default -%}\n\n {%- set identifier = model['alias'] -%}\n {%- set tmp_identifier = model['name'] + '__dbt_tmp' -%}\n {%- set backup_identifier = model['name'] + '__dbt_backup' -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier, schema=schema, database=database,\n type='view') -%}\n {%- set intermediate_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema, database=database, type='view') -%}\n -- the intermediate_relation should not already exist in the database; get_relation\n -- will return None in that case. Otherwise, we get a relation that we can drop\n -- later, before we try to use this name for the current operation\n {%- set preexisting_intermediate_relation = adapter.get_relation(identifier=tmp_identifier, \n schema=schema,\n database=database) -%}\n /*\n This relation (probably) doesn't exist yet. If it does exist, it's a leftover from\n a previous run, and we're going to try to drop it immediately. At the end of this\n materialization, we're going to rename the \"old_relation\" to this identifier,\n and then we're going to drop it. In order to make sure we run the correct one of:\n - drop view ...\n - drop table ...\n\n We need to set the type of this relation to be the type of the old_relation, if it exists,\n or else \"view\" as a sane default if it does not. Note that if the old_relation does not\n exist, then there is nothing to move out of the way and subsequentally drop. In that case,\n this relation will be effectively unused.\n */\n {%- set backup_relation_type = 'view' if old_relation is none else old_relation.type -%}\n {%- set backup_relation = api.Relation.create(identifier=backup_identifier,\n schema=schema, database=database,\n type=backup_relation_type) -%}\n -- as above, the backup_relation should not already exist\n {%- set preexisting_backup_relation = adapter.get_relation(identifier=backup_identifier,\n schema=schema,\n database=database) -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- drop the temp relations if they exist already in the database\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% call statement('main') -%}\n {{ create_view_as(intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n -- move the existing view out of the way\n {% if old_relation is not none %}\n {{ adapter.rename_relation(old_relation, backup_relation) }}\n {% endif %}\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {{ drop_relation_if_exists(backup_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt.create_view_as", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.762573}, "macro.dbt.handle_existing_table": {"unique_id": "macro.dbt.handle_existing_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/helpers.sql", "original_file_path": "macros/materializations/models/view/helpers.sql", "name": "handle_existing_table", "macro_sql": "{% macro handle_existing_table(full_refresh, old_relation) %}\n {{ adapter.dispatch('handle_existing_table', 'dbt')(full_refresh, old_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__handle_existing_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.763297}, "macro.dbt.default__handle_existing_table": {"unique_id": "macro.dbt.default__handle_existing_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/helpers.sql", "original_file_path": "macros/materializations/models/view/helpers.sql", "name": "default__handle_existing_table", "macro_sql": "{% macro default__handle_existing_table(full_refresh, old_relation) %}\n {{ log(\"Dropping relation \" ~ old_relation ~ \" because it is of type \" ~ old_relation.type) }}\n {{ adapter.drop_relation(old_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.7637818}, "macro.dbt.create_or_replace_view": {"unique_id": "macro.dbt.create_or_replace_view", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_or_replace_view.sql", "original_file_path": "macros/materializations/models/view/create_or_replace_view.sql", "name": "create_or_replace_view", "macro_sql": "{% macro create_or_replace_view() %}\n {%- set identifier = model['alias'] -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {%- set target_relation = api.Relation.create(\n identifier=identifier, schema=schema, database=database,\n type='view') -%}\n\n {{ run_hooks(pre_hooks) }}\n\n -- If there's a table with the same name and we weren't told to full refresh,\n -- that's an error. If we were told to full refresh, drop it. This behavior differs\n -- for Snowflake and BigQuery, so multiple dispatch is used.\n {%- if old_relation is not none and old_relation.is_table -%}\n {{ handle_existing_table(should_full_refresh(), old_relation) }}\n {%- endif -%}\n\n -- build model\n {% call statement('main') -%}\n {{ get_create_view_as_sql(target_relation, sql) }}\n {%- endcall %}\n\n {{ run_hooks(post_hooks) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.handle_existing_table", "macro.dbt.should_full_refresh", "macro.dbt.statement", "macro.dbt.get_create_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.7662542}, "macro.dbt.get_create_view_as_sql": {"unique_id": "macro.dbt.get_create_view_as_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.sql", "name": "get_create_view_as_sql", "macro_sql": "{% macro get_create_view_as_sql(relation, sql) -%}\n {{ adapter.dispatch('get_create_view_as_sql', 'dbt')(relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_create_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.767075}, "macro.dbt.default__get_create_view_as_sql": {"unique_id": "macro.dbt.default__get_create_view_as_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.sql", "name": "default__get_create_view_as_sql", "macro_sql": "{% macro default__get_create_view_as_sql(relation, sql) -%}\n {{ return(create_view_as(relation, sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.767435}, "macro.dbt.create_view_as": {"unique_id": "macro.dbt.create_view_as", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.sql", "name": "create_view_as", "macro_sql": "{% macro create_view_as(relation, sql) -%}\n {{ adapter.dispatch('create_view_as', 'dbt')(relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.767835}, "macro.dbt.default__create_view_as": {"unique_id": "macro.dbt.default__create_view_as", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.sql", "name": "default__create_view_as", "macro_sql": "{% macro default__create_view_as(relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n create view {{ relation }} as (\n {{ sql }}\n );\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.768403}, "macro.dbt.materialization_seed_default": {"unique_id": "macro.dbt.materialization_seed_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/seed.sql", "original_file_path": "macros/materializations/seeds/seed.sql", "name": "materialization_seed_default", "macro_sql": "{% materialization seed, default %}\n\n {%- set identifier = model['alias'] -%}\n {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n\n {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {%- set agate_table = load_agate_table() -%}\n {%- do store_result('agate_table', response='OK', agate_table=agate_table) -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% set create_table_sql = \"\" %}\n {% if exists_as_view %}\n {{ exceptions.raise_compiler_error(\"Cannot seed to '{}', it is a view\".format(old_relation)) }}\n {% elif exists_as_table %}\n {% set create_table_sql = reset_csv_table(model, full_refresh_mode, old_relation, agate_table) %}\n {% else %}\n {% set create_table_sql = create_csv_table(model, agate_table) %}\n {% endif %}\n\n {% set code = 'CREATE' if full_refresh_mode else 'INSERT' %}\n {% set rows_affected = (agate_table.rows | length) %}\n {% set sql = load_csv_rows(model, agate_table) %}\n\n {% call noop_statement('main', code ~ ' ' ~ rows_affected, code, rows_affected) %}\n {{ create_table_sql }};\n -- dbt seed --\n {{ sql }}\n {% endcall %}\n\n {% set target_relation = this.incorporate(type='table') %}\n {% do persist_docs(target_relation, model) %}\n\n {% if full_refresh_mode or not exists_as_table %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.run_hooks", "macro.dbt.reset_csv_table", "macro.dbt.create_csv_table", "macro.dbt.load_csv_rows", "macro.dbt.noop_statement", "macro.dbt.persist_docs", "macro.dbt.create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.774236}, "macro.dbt.create_csv_table": {"unique_id": "macro.dbt.create_csv_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "create_csv_table", "macro_sql": "{% macro create_csv_table(model, agate_table) -%}\n {{ adapter.dispatch('create_csv_table', 'dbt')(model, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.780393}, "macro.dbt.default__create_csv_table": {"unique_id": "macro.dbt.default__create_csv_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__create_csv_table", "macro_sql": "{% macro default__create_csv_table(model, agate_table) %}\n {%- set column_override = model['config'].get('column_types', {}) -%}\n {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n\n {% set sql %}\n create table {{ this.render() }} (\n {%- for col_name in agate_table.column_names -%}\n {%- set inferred_type = adapter.convert_type(agate_table, loop.index0) -%}\n {%- set type = column_override.get(col_name, inferred_type) -%}\n {%- set column_name = (col_name | string) -%}\n {{ adapter.quote_seed_column(column_name, quote_seed_column) }} {{ type }} {%- if not loop.last -%}, {%- endif -%}\n {%- endfor -%}\n )\n {% endset %}\n\n {% call statement('_') -%}\n {{ sql }}\n {%- endcall %}\n\n {{ return(sql) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.7823439}, "macro.dbt.reset_csv_table": {"unique_id": "macro.dbt.reset_csv_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "reset_csv_table", "macro_sql": "{% macro reset_csv_table(model, full_refresh, old_relation, agate_table) -%}\n {{ adapter.dispatch('reset_csv_table', 'dbt')(model, full_refresh, old_relation, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__reset_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.782845}, "macro.dbt.default__reset_csv_table": {"unique_id": "macro.dbt.default__reset_csv_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__reset_csv_table", "macro_sql": "{% macro default__reset_csv_table(model, full_refresh, old_relation, agate_table) %}\n {% set sql = \"\" %}\n {% if full_refresh %}\n {{ adapter.drop_relation(old_relation) }}\n {% set sql = create_csv_table(model, agate_table) %}\n {% else %}\n {{ adapter.truncate_relation(old_relation) }}\n {% set sql = \"truncate table \" ~ old_relation %}\n {% endif %}\n\n {{ return(sql) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.783901}, "macro.dbt.get_binding_char": {"unique_id": "macro.dbt.get_binding_char", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "get_binding_char", "macro_sql": "{% macro get_binding_char() -%}\n {{ adapter.dispatch('get_binding_char', 'dbt')() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_binding_char"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.784218}, "macro.dbt.default__get_binding_char": {"unique_id": "macro.dbt.default__get_binding_char", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__get_binding_char", "macro_sql": "{% macro default__get_binding_char() %}\n {{ return('%s') }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.7844748}, "macro.dbt.get_batch_size": {"unique_id": "macro.dbt.get_batch_size", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "get_batch_size", "macro_sql": "{% macro get_batch_size() -%}\n {{ return(adapter.dispatch('get_batch_size', 'dbt')()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_batch_size"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.784822}, "macro.dbt.default__get_batch_size": {"unique_id": "macro.dbt.default__get_batch_size", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__get_batch_size", "macro_sql": "{% macro default__get_batch_size() %}\n {{ return(10000) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.785076}, "macro.dbt.get_seed_column_quoted_csv": {"unique_id": "macro.dbt.get_seed_column_quoted_csv", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "get_seed_column_quoted_csv", "macro_sql": "{% macro get_seed_column_quoted_csv(model, column_names) %}\n {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n {% set quoted = [] %}\n {% for col in column_names -%}\n {%- do quoted.append(adapter.quote_seed_column(col, quote_seed_column)) -%}\n {%- endfor %}\n\n {%- set dest_cols_csv = quoted | join(', ') -%}\n {{ return(dest_cols_csv) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.7861068}, "macro.dbt.load_csv_rows": {"unique_id": "macro.dbt.load_csv_rows", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "load_csv_rows", "macro_sql": "{% macro load_csv_rows(model, agate_table) -%}\n {{ adapter.dispatch('load_csv_rows', 'dbt')(model, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__load_csv_rows"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.78651}, "macro.dbt.default__load_csv_rows": {"unique_id": "macro.dbt.default__load_csv_rows", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__load_csv_rows", "macro_sql": "{% macro default__load_csv_rows(model, agate_table) %}\n\n {% set batch_size = get_batch_size() %}\n\n {% set cols_sql = get_seed_column_quoted_csv(model, agate_table.column_names) %}\n {% set bindings = [] %}\n\n {% set statements = [] %}\n\n {% for chunk in agate_table.rows | batch(batch_size) %}\n {% set bindings = [] %}\n\n {% for row in chunk %}\n {% do bindings.extend(row) %}\n {% endfor %}\n\n {% set sql %}\n insert into {{ this.render() }} ({{ cols_sql }}) values\n {% for row in chunk -%}\n ({%- for column in agate_table.column_names -%}\n {{ get_binding_char() }}\n {%- if not loop.last%},{%- endif %}\n {%- endfor -%})\n {%- if not loop.last%},{%- endif %}\n {%- endfor %}\n {% endset %}\n\n {% do adapter.add_query(sql, bindings=bindings, abridge_sql_log=True) %}\n\n {% if loop.index0 == 0 %}\n {% do statements.append(sql) %}\n {% endif %}\n {% endfor %}\n\n {# Return SQL so we can render it out into the compiled files #}\n {{ return(statements[0]) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_batch_size", "macro.dbt.get_seed_column_quoted_csv", "macro.dbt.get_binding_char"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.7891479}, "macro.dbt.generate_alias_name": {"unique_id": "macro.dbt.generate_alias_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_alias.sql", "original_file_path": "macros/get_custom_name/get_custom_alias.sql", "name": "generate_alias_name", "macro_sql": "{% macro generate_alias_name(custom_alias_name=none, node=none) -%}\n {% do return(adapter.dispatch('generate_alias_name', 'dbt')(custom_alias_name, node)) %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__generate_alias_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.790022}, "macro.dbt.default__generate_alias_name": {"unique_id": "macro.dbt.default__generate_alias_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_alias.sql", "original_file_path": "macros/get_custom_name/get_custom_alias.sql", "name": "default__generate_alias_name", "macro_sql": "{% macro default__generate_alias_name(custom_alias_name=none, node=none) -%}\n\n {%- if custom_alias_name is none -%}\n\n {{ node.name }}\n\n {%- else -%}\n\n {{ custom_alias_name | trim }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.7905211}, "macro.dbt.generate_schema_name": {"unique_id": "macro.dbt.generate_schema_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "name": "generate_schema_name", "macro_sql": "{% macro generate_schema_name(custom_schema_name=none, node=none) -%}\n {{ return(adapter.dispatch('generate_schema_name', 'dbt')(custom_schema_name, node)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__generate_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.791585}, "macro.dbt.default__generate_schema_name": {"unique_id": "macro.dbt.default__generate_schema_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "name": "default__generate_schema_name", "macro_sql": "{% macro default__generate_schema_name(custom_schema_name, node) -%}\n\n {%- set default_schema = target.schema -%}\n {%- if custom_schema_name is none -%}\n\n {{ default_schema }}\n\n {%- else -%}\n\n {{ default_schema }}_{{ custom_schema_name | trim }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.792158}, "macro.dbt.generate_schema_name_for_env": {"unique_id": "macro.dbt.generate_schema_name_for_env", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "name": "generate_schema_name_for_env", "macro_sql": "{% macro generate_schema_name_for_env(custom_schema_name, node) -%}\n\n {%- set default_schema = target.schema -%}\n {%- if target.name == 'prod' and custom_schema_name is not none -%}\n\n {{ custom_schema_name | trim }}\n\n {%- else -%}\n\n {{ default_schema }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.792771}, "macro.dbt.generate_database_name": {"unique_id": "macro.dbt.generate_database_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_database.sql", "original_file_path": "macros/get_custom_name/get_custom_database.sql", "name": "generate_database_name", "macro_sql": "{% macro generate_database_name(custom_database_name=none, node=none) -%}\n {% do return(adapter.dispatch('generate_database_name', 'dbt')(custom_database_name, node)) %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__generate_database_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.793652}, "macro.dbt.default__generate_database_name": {"unique_id": "macro.dbt.default__generate_database_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_database.sql", "original_file_path": "macros/get_custom_name/get_custom_database.sql", "name": "default__generate_database_name", "macro_sql": "{% macro default__generate_database_name(custom_database_name=none, node=none) -%}\n {%- set default_database = target.database -%}\n {%- if custom_database_name is none -%}\n\n {{ default_database }}\n\n {%- else -%}\n\n {{ custom_database_name }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.7942872}, "macro.dbt.default__test_relationships": {"unique_id": "macro.dbt.default__test_relationships", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/generic_test_sql/relationships.sql", "original_file_path": "macros/generic_test_sql/relationships.sql", "name": "default__test_relationships", "macro_sql": "{% macro default__test_relationships(model, column_name, to, field) %}\n\nwith child as (\n select {{ column_name }} as from_field\n from {{ model }}\n where {{ column_name }} is not null\n),\n\nparent as (\n select {{ field }} as to_field\n from {{ to }}\n)\n\nselect\n from_field\n\nfrom child\nleft join parent\n on child.from_field = parent.to_field\n\nwhere parent.to_field is null\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.795084}, "macro.dbt.default__test_not_null": {"unique_id": "macro.dbt.default__test_not_null", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/generic_test_sql/not_null.sql", "original_file_path": "macros/generic_test_sql/not_null.sql", "name": "default__test_not_null", "macro_sql": "{% macro default__test_not_null(model, column_name) %}\n\nselect *\nfrom {{ model }}\nwhere {{ column_name }} is null\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.795586}, "macro.dbt.default__test_unique": {"unique_id": "macro.dbt.default__test_unique", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/generic_test_sql/unique.sql", "original_file_path": "macros/generic_test_sql/unique.sql", "name": "default__test_unique", "macro_sql": "{% macro default__test_unique(model, column_name) %}\n\nselect\n {{ column_name }} as unique_field,\n count(*) as n_records\n\nfrom {{ model }}\nwhere {{ column_name }} is not null\ngroup by {{ column_name }}\nhaving count(*) > 1\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.796215}, "macro.dbt.default__test_accepted_values": {"unique_id": "macro.dbt.default__test_accepted_values", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/generic_test_sql/accepted_values.sql", "original_file_path": "macros/generic_test_sql/accepted_values.sql", "name": "default__test_accepted_values", "macro_sql": "{% macro default__test_accepted_values(model, column_name, values, quote=True) %}\n\nwith all_values as (\n\n select\n {{ column_name }} as value_field,\n count(*) as n_records\n\n from {{ model }}\n group by {{ column_name }}\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n {% for value in values -%}\n {% if quote -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {%- endfor %}\n)\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.797587}, "macro.dbt.statement": {"unique_id": "macro.dbt.statement", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "name": "statement", "macro_sql": "{% macro statement(name=None, fetch_result=False, auto_begin=True) -%}\n {%- if execute: -%}\n {%- set sql = caller() -%}\n\n {%- if name == 'main' -%}\n {{ log('Writing runtime SQL for node \"{}\"'.format(model['unique_id'])) }}\n {{ write(sql) }}\n {%- endif -%}\n\n {%- set res, table = adapter.execute(sql, auto_begin=auto_begin, fetch=fetch_result) -%}\n {%- if name is not none -%}\n {{ store_result(name, response=res, agate_table=table) }}\n {%- endif -%}\n\n {%- endif -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.799814}, "macro.dbt.noop_statement": {"unique_id": "macro.dbt.noop_statement", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "name": "noop_statement", "macro_sql": "{% macro noop_statement(name=None, message=None, code=None, rows_affected=None, res=None) -%}\n {%- set sql = caller() -%}\n\n {%- if name == 'main' -%}\n {{ log('Writing runtime SQL for node \"{}\"'.format(model['unique_id'])) }}\n {{ write(sql) }}\n {%- endif -%}\n\n {%- if name is not none -%}\n {{ store_raw_result(name, message=message, code=code, rows_affected=rows_affected, agate_table=res) }}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.801049}, "macro.dbt.run_query": {"unique_id": "macro.dbt.run_query", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "name": "run_query", "macro_sql": "{% macro run_query(sql) %}\n {% call statement(\"run_query_statement\", fetch_result=true, auto_begin=false) %}\n {{ sql }}\n {% endcall %}\n\n {% do return(load_result(\"run_query_statement\").table) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.80169}, "macro.dbt.convert_datetime": {"unique_id": "macro.dbt.convert_datetime", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "convert_datetime", "macro_sql": "{% macro convert_datetime(date_str, date_fmt) %}\n\n {% set error_msg -%}\n The provided partition date '{{ date_str }}' does not match the expected format '{{ date_fmt }}'\n {%- endset %}\n\n {% set res = try_or_compiler_error(error_msg, modules.datetime.datetime.strptime, date_str.strip(), date_fmt) %}\n {{ return(res) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.804731}, "macro.dbt.dates_in_range": {"unique_id": "macro.dbt.dates_in_range", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "dates_in_range", "macro_sql": "{% macro dates_in_range(start_date_str, end_date_str=none, in_fmt=\"%Y%m%d\", out_fmt=\"%Y%m%d\") %}\n {% set end_date_str = start_date_str if end_date_str is none else end_date_str %}\n\n {% set start_date = convert_datetime(start_date_str, in_fmt) %}\n {% set end_date = convert_datetime(end_date_str, in_fmt) %}\n\n {% set day_count = (end_date - start_date).days %}\n {% if day_count < 0 %}\n {% set msg -%}\n Partiton start date is after the end date ({{ start_date }}, {{ end_date }})\n {%- endset %}\n\n {{ exceptions.raise_compiler_error(msg, model) }}\n {% endif %}\n\n {% set date_list = [] %}\n {% for i in range(0, day_count + 1) %}\n {% set the_date = (modules.datetime.timedelta(days=i) + start_date) %}\n {% if not out_fmt %}\n {% set _ = date_list.append(the_date) %}\n {% else %}\n {% set _ = date_list.append(the_date.strftime(out_fmt)) %}\n {% endif %}\n {% endfor %}\n\n {{ return(date_list) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.convert_datetime"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.807302}, "macro.dbt.partition_range": {"unique_id": "macro.dbt.partition_range", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "partition_range", "macro_sql": "{% macro partition_range(raw_partition_date, date_fmt='%Y%m%d') %}\n {% set partition_range = (raw_partition_date | string).split(\",\") %}\n\n {% if (partition_range | length) == 1 %}\n {% set start_date = partition_range[0] %}\n {% set end_date = none %}\n {% elif (partition_range | length) == 2 %}\n {% set start_date = partition_range[0] %}\n {% set end_date = partition_range[1] %}\n {% else %}\n {{ exceptions.raise_compiler_error(\"Invalid partition time. Expected format: {Start Date}[,{End Date}]. Got: \" ~ raw_partition_date) }}\n {% endif %}\n\n {{ return(dates_in_range(start_date, end_date, in_fmt=date_fmt)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.dates_in_range"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.808973}, "macro.dbt.py_current_timestring": {"unique_id": "macro.dbt.py_current_timestring", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "py_current_timestring", "macro_sql": "{% macro py_current_timestring() %}\n {% set dt = modules.datetime.datetime.now() %}\n {% do return(dt.strftime(\"%Y%m%d%H%M%S%f\")) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.809474}, "macro.dbt.create_schema": {"unique_id": "macro.dbt.create_schema", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "name": "create_schema", "macro_sql": "{% macro create_schema(relation) -%}\n {{ adapter.dispatch('create_schema', 'dbt')(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__create_schema"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.810305}, "macro.dbt.default__create_schema": {"unique_id": "macro.dbt.default__create_schema", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "name": "default__create_schema", "macro_sql": "{% macro default__create_schema(relation) -%}\n {%- call statement('create_schema') -%}\n create schema if not exists {{ relation.without_identifier() }}\n {% endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.810713}, "macro.dbt.drop_schema": {"unique_id": "macro.dbt.drop_schema", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "name": "drop_schema", "macro_sql": "{% macro drop_schema(relation) -%}\n {{ adapter.dispatch('drop_schema', 'dbt')(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__drop_schema"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.811069}, "macro.dbt.default__drop_schema": {"unique_id": "macro.dbt.default__drop_schema", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "name": "default__drop_schema", "macro_sql": "{% macro default__drop_schema(relation) -%}\n {%- call statement('drop_schema') -%}\n drop schema if exists {{ relation.without_identifier() }} cascade\n {% endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.811471}, "macro.dbt.get_create_index_sql": {"unique_id": "macro.dbt.get_create_index_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "name": "get_create_index_sql", "macro_sql": "{% macro get_create_index_sql(relation, index_dict) -%}\n {{ return(adapter.dispatch('get_create_index_sql', 'dbt')(relation, index_dict)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_create_index_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8124359}, "macro.dbt.default__get_create_index_sql": {"unique_id": "macro.dbt.default__get_create_index_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "name": "default__get_create_index_sql", "macro_sql": "{% macro default__get_create_index_sql(relation, index_dict) -%}\n {% do return(None) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.81274}, "macro.dbt.create_indexes": {"unique_id": "macro.dbt.create_indexes", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "name": "create_indexes", "macro_sql": "{% macro create_indexes(relation) -%}\n {{ adapter.dispatch('create_indexes', 'dbt')(relation) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8130891}, "macro.dbt.default__create_indexes": {"unique_id": "macro.dbt.default__create_indexes", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "name": "default__create_indexes", "macro_sql": "{% macro default__create_indexes(relation) -%}\n {%- set _indexes = config.get('indexes', default=[]) -%}\n\n {% for _index_dict in _indexes %}\n {% set create_index_sql = get_create_index_sql(relation, _index_dict) %}\n {% if create_index_sql %}\n {% do run_query(create_index_sql) %}\n {% endif %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_create_index_sql", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.813958}, "macro.dbt.make_temp_relation": {"unique_id": "macro.dbt.make_temp_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "make_temp_relation", "macro_sql": "{% macro make_temp_relation(base_relation, suffix='__dbt_tmp') %}\n {{ return(adapter.dispatch('make_temp_relation', 'dbt')(base_relation, suffix))}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__make_temp_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.816601}, "macro.dbt.default__make_temp_relation": {"unique_id": "macro.dbt.default__make_temp_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__make_temp_relation", "macro_sql": "{% macro default__make_temp_relation(base_relation, suffix) %}\n {% set tmp_identifier = base_relation.identifier ~ suffix %}\n {% set tmp_relation = base_relation.incorporate(\n path={\"identifier\": tmp_identifier}) -%}\n\n {% do return(tmp_relation) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.81726}, "macro.dbt.drop_relation": {"unique_id": "macro.dbt.drop_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "drop_relation", "macro_sql": "{% macro drop_relation(relation) -%}\n {{ return(adapter.dispatch('drop_relation', 'dbt')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__drop_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.817663}, "macro.dbt.default__drop_relation": {"unique_id": "macro.dbt.default__drop_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__drop_relation", "macro_sql": "{% macro default__drop_relation(relation) -%}\n {% call statement('drop_relation', auto_begin=False) -%}\n drop {{ relation.type }} if exists {{ relation }} cascade\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.818132}, "macro.dbt.truncate_relation": {"unique_id": "macro.dbt.truncate_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "truncate_relation", "macro_sql": "{% macro truncate_relation(relation) -%}\n {{ return(adapter.dispatch('truncate_relation', 'dbt')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__truncate_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8185291}, "macro.dbt.default__truncate_relation": {"unique_id": "macro.dbt.default__truncate_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__truncate_relation", "macro_sql": "{% macro default__truncate_relation(relation) -%}\n {% call statement('truncate_relation') -%}\n truncate table {{ relation }}\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.818887}, "macro.dbt.rename_relation": {"unique_id": "macro.dbt.rename_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "rename_relation", "macro_sql": "{% macro rename_relation(from_relation, to_relation) -%}\n {{ return(adapter.dispatch('rename_relation', 'dbt')(from_relation, to_relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__rename_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.819474}, "macro.dbt.default__rename_relation": {"unique_id": "macro.dbt.default__rename_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__rename_relation", "macro_sql": "{% macro default__rename_relation(from_relation, to_relation) -%}\n {% set target_name = adapter.quote_as_configured(to_relation.identifier, 'identifier') %}\n {% call statement('rename_relation') -%}\n alter table {{ from_relation }} rename to {{ target_name }}\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.820101}, "macro.dbt.get_or_create_relation": {"unique_id": "macro.dbt.get_or_create_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "get_or_create_relation", "macro_sql": "{% macro get_or_create_relation(database, schema, identifier, type) -%}\n {{ return(adapter.dispatch('get_or_create_relation', 'dbt')(database, schema, identifier, type)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_or_create_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8206458}, "macro.dbt.default__get_or_create_relation": {"unique_id": "macro.dbt.default__get_or_create_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__get_or_create_relation", "macro_sql": "{% macro default__get_or_create_relation(database, schema, identifier, type) %}\n {%- set target_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n\n {% if target_relation %}\n {% do return([true, target_relation]) %}\n {% endif %}\n\n {%- set new_relation = api.Relation.create(\n database=database,\n schema=schema,\n identifier=identifier,\n type=type\n ) -%}\n {% do return([false, new_relation]) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8218298}, "macro.dbt.load_relation": {"unique_id": "macro.dbt.load_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "load_relation", "macro_sql": "{% macro load_relation(relation) %}\n {% do return(adapter.get_relation(\n database=relation.database,\n schema=relation.schema,\n identifier=relation.identifier\n )) -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8223228}, "macro.dbt.drop_relation_if_exists": {"unique_id": "macro.dbt.drop_relation_if_exists", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "drop_relation_if_exists", "macro_sql": "{% macro drop_relation_if_exists(relation) %}\n {% if relation is not none %}\n {{ adapter.drop_relation(relation) }}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.822751}, "macro.dbt.current_timestamp": {"unique_id": "macro.dbt.current_timestamp", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "name": "current_timestamp", "macro_sql": "{% macro current_timestamp() -%}\n {{ adapter.dispatch('current_timestamp', 'dbt')() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.823683}, "macro.dbt.default__current_timestamp": {"unique_id": "macro.dbt.default__current_timestamp", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "name": "default__current_timestamp", "macro_sql": "{% macro default__current_timestamp() -%}\n {{ exceptions.raise_not_implemented(\n 'current_timestamp macro not implemented for adapter '+adapter.type()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.824011}, "macro.dbt.collect_freshness": {"unique_id": "macro.dbt.collect_freshness", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "name": "collect_freshness", "macro_sql": "{% macro collect_freshness(source, loaded_at_field, filter) %}\n {{ return(adapter.dispatch('collect_freshness', 'dbt')(source, loaded_at_field, filter))}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__collect_freshness"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.824512}, "macro.dbt.default__collect_freshness": {"unique_id": "macro.dbt.default__collect_freshness", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "name": "default__collect_freshness", "macro_sql": "{% macro default__collect_freshness(source, loaded_at_field, filter) %}\n {% call statement('collect_freshness', fetch_result=True, auto_begin=False) -%}\n select\n max({{ loaded_at_field }}) as max_loaded_at,\n {{ current_timestamp() }} as snapshotted_at\n from {{ source }}\n {% if filter %}\n where {{ filter }}\n {% endif %}\n {% endcall %}\n {{ return(load_result('collect_freshness').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8254359}, "macro.dbt.alter_column_comment": {"unique_id": "macro.dbt.alter_column_comment", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "alter_column_comment", "macro_sql": "{% macro alter_column_comment(relation, column_dict) -%}\n {{ return(adapter.dispatch('alter_column_comment', 'dbt')(relation, column_dict)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.826781}, "macro.dbt.default__alter_column_comment": {"unique_id": "macro.dbt.default__alter_column_comment", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "default__alter_column_comment", "macro_sql": "{% macro default__alter_column_comment(relation, column_dict) -%}\n {{ exceptions.raise_not_implemented(\n 'alter_column_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.827148}, "macro.dbt.alter_relation_comment": {"unique_id": "macro.dbt.alter_relation_comment", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "alter_relation_comment", "macro_sql": "{% macro alter_relation_comment(relation, relation_comment) -%}\n {{ return(adapter.dispatch('alter_relation_comment', 'dbt')(relation, relation_comment)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__alter_relation_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.82766}, "macro.dbt.default__alter_relation_comment": {"unique_id": "macro.dbt.default__alter_relation_comment", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "default__alter_relation_comment", "macro_sql": "{% macro default__alter_relation_comment(relation, relation_comment) -%}\n {{ exceptions.raise_not_implemented(\n 'alter_relation_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.828084}, "macro.dbt.persist_docs": {"unique_id": "macro.dbt.persist_docs", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "persist_docs", "macro_sql": "{% macro persist_docs(relation, model, for_relation=true, for_columns=true) -%}\n {{ return(adapter.dispatch('persist_docs', 'dbt')(relation, model, for_relation, for_columns)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.828667}, "macro.dbt.default__persist_docs": {"unique_id": "macro.dbt.default__persist_docs", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "default__persist_docs", "macro_sql": "{% macro default__persist_docs(relation, model, for_relation, for_columns) -%}\n {% if for_relation and config.persist_relation_docs() and model.description %}\n {% do run_query(alter_relation_comment(relation, model.description)) %}\n {% endif %}\n\n {% if for_columns and config.persist_column_docs() and model.columns %}\n {% do run_query(alter_column_comment(relation, model.columns)) %}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query", "macro.dbt.alter_relation_comment", "macro.dbt.alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.829765}, "macro.dbt.get_catalog": {"unique_id": "macro.dbt.get_catalog", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "get_catalog", "macro_sql": "{% macro get_catalog(information_schema, schemas) -%}\n {{ return(adapter.dispatch('get_catalog', 'dbt')(information_schema, schemas)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_catalog"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.832154}, "macro.dbt.default__get_catalog": {"unique_id": "macro.dbt.default__get_catalog", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__get_catalog", "macro_sql": "{% macro default__get_catalog(information_schema, schemas) -%}\n\n {% set typename = adapter.type() %}\n {% set msg -%}\n get_catalog not implemented for {{ typename }}\n {%- endset %}\n\n {{ exceptions.raise_compiler_error(msg) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8327198}, "macro.dbt.information_schema_name": {"unique_id": "macro.dbt.information_schema_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "information_schema_name", "macro_sql": "{% macro information_schema_name(database) %}\n {{ return(adapter.dispatch('information_schema_name', 'dbt')(database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__information_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.833129}, "macro.dbt.default__information_schema_name": {"unique_id": "macro.dbt.default__information_schema_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__information_schema_name", "macro_sql": "{% macro default__information_schema_name(database) -%}\n {%- if database -%}\n {{ database }}.INFORMATION_SCHEMA\n {%- else -%}\n INFORMATION_SCHEMA\n {%- endif -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.833471}, "macro.dbt.list_schemas": {"unique_id": "macro.dbt.list_schemas", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "list_schemas", "macro_sql": "{% macro list_schemas(database) -%}\n {{ return(adapter.dispatch('list_schemas', 'dbt')(database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__list_schemas"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.833866}, "macro.dbt.default__list_schemas": {"unique_id": "macro.dbt.default__list_schemas", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__list_schemas", "macro_sql": "{% macro default__list_schemas(database) -%}\n {% set sql %}\n select distinct schema_name\n from {{ information_schema_name(database) }}.SCHEMATA\n where catalog_name ilike '{{ database }}'\n {% endset %}\n {{ return(run_query(sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.information_schema_name", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.834402}, "macro.dbt.check_schema_exists": {"unique_id": "macro.dbt.check_schema_exists", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "check_schema_exists", "macro_sql": "{% macro check_schema_exists(information_schema, schema) -%}\n {{ return(adapter.dispatch('check_schema_exists', 'dbt')(information_schema, schema)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__check_schema_exists"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8348439}, "macro.dbt.default__check_schema_exists": {"unique_id": "macro.dbt.default__check_schema_exists", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__check_schema_exists", "macro_sql": "{% macro default__check_schema_exists(information_schema, schema) -%}\n {% set sql -%}\n select count(*)\n from {{ information_schema.replace(information_schema_view='SCHEMATA') }}\n where catalog_name='{{ information_schema.database }}'\n and schema_name='{{ schema }}'\n {%- endset %}\n {{ return(run_query(sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.replace", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8356218}, "macro.dbt.list_relations_without_caching": {"unique_id": "macro.dbt.list_relations_without_caching", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "list_relations_without_caching", "macro_sql": "{% macro list_relations_without_caching(schema_relation) %}\n {{ return(adapter.dispatch('list_relations_without_caching', 'dbt')(schema_relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__list_relations_without_caching"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.83603}, "macro.dbt.default__list_relations_without_caching": {"unique_id": "macro.dbt.default__list_relations_without_caching", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__list_relations_without_caching", "macro_sql": "{% macro default__list_relations_without_caching(schema_relation) %}\n {{ exceptions.raise_not_implemented(\n 'list_relations_without_caching macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.836382}, "macro.dbt.get_columns_in_relation": {"unique_id": "macro.dbt.get_columns_in_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "get_columns_in_relation", "macro_sql": "{% macro get_columns_in_relation(relation) -%}\n {{ return(adapter.dispatch('get_columns_in_relation', 'dbt')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__get_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.83917}, "macro.dbt.default__get_columns_in_relation": {"unique_id": "macro.dbt.default__get_columns_in_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "default__get_columns_in_relation", "macro_sql": "{% macro default__get_columns_in_relation(relation) -%}\n {{ exceptions.raise_not_implemented(\n 'get_columns_in_relation macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.839552}, "macro.dbt.sql_convert_columns_in_relation": {"unique_id": "macro.dbt.sql_convert_columns_in_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "sql_convert_columns_in_relation", "macro_sql": "{% macro sql_convert_columns_in_relation(table) -%}\n {% set columns = [] %}\n {% for row in table %}\n {% do columns.append(api.Column(*row)) %}\n {% endfor %}\n {{ return(columns) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.840226}, "macro.dbt.get_columns_in_query": {"unique_id": "macro.dbt.get_columns_in_query", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "get_columns_in_query", "macro_sql": "{% macro get_columns_in_query(select_sql) -%}\n {{ return(adapter.dispatch('get_columns_in_query', 'dbt')(select_sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.84063}, "macro.dbt.default__get_columns_in_query": {"unique_id": "macro.dbt.default__get_columns_in_query", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "default__get_columns_in_query", "macro_sql": "{% macro default__get_columns_in_query(select_sql) %}\n {% call statement('get_columns_in_query', fetch_result=True, auto_begin=False) -%}\n select * from (\n {{ select_sql }}\n ) as __dbt_sbq\n where false\n limit 0\n {% endcall %}\n\n {{ return(load_result('get_columns_in_query').table.columns | map(attribute='name') | list) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.841363}, "macro.dbt.alter_column_type": {"unique_id": "macro.dbt.alter_column_type", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "alter_column_type", "macro_sql": "{% macro alter_column_type(relation, column_name, new_column_type) -%}\n {{ return(adapter.dispatch('alter_column_type', 'dbt')(relation, column_name, new_column_type)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8419719}, "macro.dbt.default__alter_column_type": {"unique_id": "macro.dbt.default__alter_column_type", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "default__alter_column_type", "macro_sql": "{% macro default__alter_column_type(relation, column_name, new_column_type) -%}\n {#\n 1. Create a new column (w/ temp name and correct type)\n 2. Copy data over to it\n 3. Drop the existing column (cascade!)\n 4. Rename the new column to existing column\n #}\n {%- set tmp_column = column_name + \"__dbt_alter\" -%}\n\n {% call statement('alter_column_type') %}\n alter table {{ relation }} add column {{ adapter.quote(tmp_column) }} {{ new_column_type }};\n update {{ relation }} set {{ adapter.quote(tmp_column) }} = {{ adapter.quote(column_name) }};\n alter table {{ relation }} drop column {{ adapter.quote(column_name) }} cascade;\n alter table {{ relation }} rename column {{ adapter.quote(tmp_column) }} to {{ adapter.quote(column_name) }}\n {% endcall %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.843286}, "macro.dbt.alter_relation_add_remove_columns": {"unique_id": "macro.dbt.alter_relation_add_remove_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "alter_relation_add_remove_columns", "macro_sql": "{% macro alter_relation_add_remove_columns(relation, add_columns = none, remove_columns = none) -%}\n {{ return(adapter.dispatch('alter_relation_add_remove_columns', 'dbt')(relation, add_columns, remove_columns)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_snowflake.snowflake__alter_relation_add_remove_columns"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.843841}, "macro.dbt.default__alter_relation_add_remove_columns": {"unique_id": "macro.dbt.default__alter_relation_add_remove_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "default__alter_relation_add_remove_columns", "macro_sql": "{% macro default__alter_relation_add_remove_columns(relation, add_columns, remove_columns) %}\n \n {% if add_columns is none %}\n {% set add_columns = [] %}\n {% endif %}\n {% if remove_columns is none %}\n {% set remove_columns = [] %}\n {% endif %}\n \n {% set sql -%}\n \n alter {{ relation.type }} {{ relation }}\n \n {% for column in add_columns %}\n add column {{ column.name }} {{ column.data_type }}{{ ',' if not loop.last }}\n {% endfor %}{{ ',' if add_columns and remove_columns }}\n \n {% for column in remove_columns %}\n drop column {{ column.name }}{{ ',' if not loop.last }}\n {% endfor %}\n \n {%- endset -%}\n\n {% do run_query(sql) %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.845542}, "macro.dbt.test_unique": {"unique_id": "macro.dbt.test_unique", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "name": "test_unique", "macro_sql": "{% test unique(model, column_name) %}\n {% set macro = adapter.dispatch('test_unique', 'dbt') %}\n {{ macro(model, column_name) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__test_unique"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.846615}, "macro.dbt.test_not_null": {"unique_id": "macro.dbt.test_not_null", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "name": "test_not_null", "macro_sql": "{% test not_null(model, column_name) %}\n {% set macro = adapter.dispatch('test_not_null', 'dbt') %}\n {{ macro(model, column_name) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__test_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.847127}, "macro.dbt.test_accepted_values": {"unique_id": "macro.dbt.test_accepted_values", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "name": "test_accepted_values", "macro_sql": "{% test accepted_values(model, column_name, values, quote=True) %}\n {% set macro = adapter.dispatch('test_accepted_values', 'dbt') %}\n {{ macro(model, column_name, values, quote) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__test_accepted_values"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8477619}, "macro.dbt.test_relationships": {"unique_id": "macro.dbt.test_relationships", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "name": "test_relationships", "macro_sql": "{% test relationships(model, column_name, to, field) %}\n {% set macro = adapter.dispatch('test_relationships', 'dbt') %}\n {{ macro(model, column_name, to, field) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__test_relationships"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.848366}, "macro.dbt_utils.except": {"unique_id": "macro.dbt_utils.except", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/except.sql", "original_file_path": "macros/cross_db_utils/except.sql", "name": "except", "macro_sql": "{% macro except() %}\n {{ return(adapter.dispatch('except', 'dbt_utils')()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__except"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.849011}, "macro.dbt_utils.default__except": {"unique_id": "macro.dbt_utils.default__except", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/except.sql", "original_file_path": "macros/cross_db_utils/except.sql", "name": "default__except", "macro_sql": "{% macro default__except() %}\n\n except\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.849181}, "macro.dbt_utils.bigquery__except": {"unique_id": "macro.dbt_utils.bigquery__except", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/except.sql", "original_file_path": "macros/cross_db_utils/except.sql", "name": "bigquery__except", "macro_sql": "{% macro bigquery__except() %}\n\n except distinct\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.849345}, "macro.dbt_utils.replace": {"unique_id": "macro.dbt_utils.replace", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/replace.sql", "original_file_path": "macros/cross_db_utils/replace.sql", "name": "replace", "macro_sql": "{% macro replace(field, old_chars, new_chars) -%}\n {{ return(adapter.dispatch('replace', 'dbt_utils') (field, old_chars, new_chars)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__replace"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.850132}, "macro.dbt_utils.default__replace": {"unique_id": "macro.dbt_utils.default__replace", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/replace.sql", "original_file_path": "macros/cross_db_utils/replace.sql", "name": "default__replace", "macro_sql": "{% macro default__replace(field, old_chars, new_chars) %}\n\n replace(\n {{ field }},\n {{ old_chars }},\n {{ new_chars }}\n )\n \n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.850538}, "macro.dbt_utils.concat": {"unique_id": "macro.dbt_utils.concat", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/concat.sql", "original_file_path": "macros/cross_db_utils/concat.sql", "name": "concat", "macro_sql": "{% macro concat(fields) -%}\n {{ return(adapter.dispatch('concat', 'dbt_utils')(fields)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__concat"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.851176}, "macro.dbt_utils.default__concat": {"unique_id": "macro.dbt_utils.default__concat", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/concat.sql", "original_file_path": "macros/cross_db_utils/concat.sql", "name": "default__concat", "macro_sql": "{% macro default__concat(fields) -%}\n {{ fields|join(' || ') }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.851457}, "macro.dbt_utils.type_string": {"unique_id": "macro.dbt_utils.type_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_string", "macro_sql": "\n\n{%- macro type_string() -%}\n {{ return(adapter.dispatch('type_string', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.snowflake__type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.852748}, "macro.dbt_utils.default__type_string": {"unique_id": "macro.dbt_utils.default__type_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_string", "macro_sql": "{% macro default__type_string() %}\n string\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.853025}, "macro.dbt_utils.redshift__type_string": {"unique_id": "macro.dbt_utils.redshift__type_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "redshift__type_string", "macro_sql": "\n\n{%- macro redshift__type_string() -%}\n varchar\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.853191}, "macro.dbt_utils.postgres__type_string": {"unique_id": "macro.dbt_utils.postgres__type_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "postgres__type_string", "macro_sql": "{% macro postgres__type_string() %}\n varchar\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8533518}, "macro.dbt_utils.snowflake__type_string": {"unique_id": "macro.dbt_utils.snowflake__type_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "snowflake__type_string", "macro_sql": "{% macro snowflake__type_string() %}\n varchar\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8535109}, "macro.dbt_utils.type_timestamp": {"unique_id": "macro.dbt_utils.type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_timestamp", "macro_sql": "\n\n{%- macro type_timestamp() -%}\n {{ return(adapter.dispatch('type_timestamp', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.snowflake__type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.853863}, "macro.dbt_utils.default__type_timestamp": {"unique_id": "macro.dbt_utils.default__type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_timestamp", "macro_sql": "{% macro default__type_timestamp() %}\n timestamp\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.854031}, "macro.dbt_utils.snowflake__type_timestamp": {"unique_id": "macro.dbt_utils.snowflake__type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "snowflake__type_timestamp", "macro_sql": "{% macro snowflake__type_timestamp() %}\n timestamp_ntz\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.854193}, "macro.dbt_utils.type_float": {"unique_id": "macro.dbt_utils.type_float", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_float", "macro_sql": "\n\n{%- macro type_float() -%}\n {{ return(adapter.dispatch('type_float', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__type_float"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.854542}, "macro.dbt_utils.default__type_float": {"unique_id": "macro.dbt_utils.default__type_float", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_float", "macro_sql": "{% macro default__type_float() %}\n float\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.854707}, "macro.dbt_utils.bigquery__type_float": {"unique_id": "macro.dbt_utils.bigquery__type_float", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_float", "macro_sql": "{% macro bigquery__type_float() %}\n float64\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.854869}, "macro.dbt_utils.type_numeric": {"unique_id": "macro.dbt_utils.type_numeric", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_numeric", "macro_sql": "\n\n{%- macro type_numeric() -%}\n {{ return(adapter.dispatch('type_numeric', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.85522}, "macro.dbt_utils.default__type_numeric": {"unique_id": "macro.dbt_utils.default__type_numeric", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_numeric", "macro_sql": "{% macro default__type_numeric() %}\n numeric(28, 6)\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.855385}, "macro.dbt_utils.bigquery__type_numeric": {"unique_id": "macro.dbt_utils.bigquery__type_numeric", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_numeric", "macro_sql": "{% macro bigquery__type_numeric() %}\n numeric\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.855545}, "macro.dbt_utils.type_bigint": {"unique_id": "macro.dbt_utils.type_bigint", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_bigint", "macro_sql": "\n\n{%- macro type_bigint() -%}\n {{ return(adapter.dispatch('type_bigint', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.855892}, "macro.dbt_utils.default__type_bigint": {"unique_id": "macro.dbt_utils.default__type_bigint", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_bigint", "macro_sql": "{% macro default__type_bigint() %}\n bigint\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.856054}, "macro.dbt_utils.bigquery__type_bigint": {"unique_id": "macro.dbt_utils.bigquery__type_bigint", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_bigint", "macro_sql": "{% macro bigquery__type_bigint() %}\n int64\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.856214}, "macro.dbt_utils.type_int": {"unique_id": "macro.dbt_utils.type_int", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_int", "macro_sql": "\n\n{%- macro type_int() -%}\n {{ return(adapter.dispatch('type_int', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__type_int"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.856559}, "macro.dbt_utils.default__type_int": {"unique_id": "macro.dbt_utils.default__type_int", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_int", "macro_sql": "{% macro default__type_int() %}\n int\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.856724}, "macro.dbt_utils.bigquery__type_int": {"unique_id": "macro.dbt_utils.bigquery__type_int", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_int", "macro_sql": "{% macro bigquery__type_int() %}\n int64\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.856883}, "macro.dbt_utils._is_relation": {"unique_id": "macro.dbt_utils._is_relation", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/_is_relation.sql", "original_file_path": "macros/cross_db_utils/_is_relation.sql", "name": "_is_relation", "macro_sql": "{% macro _is_relation(obj, macro) %}\n {%- if not (obj is mapping and obj.get('metadata', {}).get('type', '').endswith('Relation')) -%}\n {%- do exceptions.raise_compiler_error(\"Macro \" ~ macro ~ \" expected a Relation but received the value: \" ~ obj) -%}\n {%- endif -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.857928}, "macro.dbt_utils.length": {"unique_id": "macro.dbt_utils.length", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/length.sql", "original_file_path": "macros/cross_db_utils/length.sql", "name": "length", "macro_sql": "{% macro length(expression) -%}\n {{ return(adapter.dispatch('length', 'dbt_utils') (expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__length"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8586502}, "macro.dbt_utils.default__length": {"unique_id": "macro.dbt_utils.default__length", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/length.sql", "original_file_path": "macros/cross_db_utils/length.sql", "name": "default__length", "macro_sql": "{% macro default__length(expression) %}\n \n length(\n {{ expression }}\n )\n \n{%- endmacro -%}\n\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.858887}, "macro.dbt_utils.redshift__length": {"unique_id": "macro.dbt_utils.redshift__length", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/length.sql", "original_file_path": "macros/cross_db_utils/length.sql", "name": "redshift__length", "macro_sql": "{% macro redshift__length(expression) %}\n\n len(\n {{ expression }}\n )\n \n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.859117}, "macro.dbt_utils.dateadd": {"unique_id": "macro.dbt_utils.dateadd", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "dateadd", "macro_sql": "{% macro dateadd(datepart, interval, from_date_or_timestamp) %}\n {{ return(adapter.dispatch('dateadd', 'dbt_utils')(datepart, interval, from_date_or_timestamp)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8602371}, "macro.dbt_utils.default__dateadd": {"unique_id": "macro.dbt_utils.default__dateadd", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "default__dateadd", "macro_sql": "{% macro default__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n dateadd(\n {{ datepart }},\n {{ interval }},\n {{ from_date_or_timestamp }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.860717}, "macro.dbt_utils.bigquery__dateadd": {"unique_id": "macro.dbt_utils.bigquery__dateadd", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "bigquery__dateadd", "macro_sql": "{% macro bigquery__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n datetime_add(\n cast( {{ from_date_or_timestamp }} as datetime),\n interval {{ interval }} {{ datepart }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.861093}, "macro.dbt_utils.postgres__dateadd": {"unique_id": "macro.dbt_utils.postgres__dateadd", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "postgres__dateadd", "macro_sql": "{% macro postgres__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n {{ from_date_or_timestamp }} + ((interval '1 {{ datepart }}') * ({{ interval }}))\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.86145}, "macro.dbt_utils.redshift__dateadd": {"unique_id": "macro.dbt_utils.redshift__dateadd", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "redshift__dateadd", "macro_sql": "{% macro redshift__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n {{ return(dbt_utils.default__dateadd(datepart, interval, from_date_or_timestamp)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.861877}, "macro.dbt_utils.intersect": {"unique_id": "macro.dbt_utils.intersect", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/intersect.sql", "original_file_path": "macros/cross_db_utils/intersect.sql", "name": "intersect", "macro_sql": "{% macro intersect() %}\n {{ return(adapter.dispatch('intersect', 'dbt_utils')()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__intersect"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8625169}, "macro.dbt_utils.default__intersect": {"unique_id": "macro.dbt_utils.default__intersect", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/intersect.sql", "original_file_path": "macros/cross_db_utils/intersect.sql", "name": "default__intersect", "macro_sql": "{% macro default__intersect() %}\n\n intersect\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.862688}, "macro.dbt_utils.bigquery__intersect": {"unique_id": "macro.dbt_utils.bigquery__intersect", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/intersect.sql", "original_file_path": "macros/cross_db_utils/intersect.sql", "name": "bigquery__intersect", "macro_sql": "{% macro bigquery__intersect() %}\n\n intersect distinct\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.862852}, "macro.dbt_utils.right": {"unique_id": "macro.dbt_utils.right", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "right", "macro_sql": "{% macro right(string_text, length_expression) -%}\n {{ return(adapter.dispatch('right', 'dbt_utils') (string_text, length_expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.snowflake__right"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8639228}, "macro.dbt_utils.default__right": {"unique_id": "macro.dbt_utils.default__right", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "default__right", "macro_sql": "{% macro default__right(string_text, length_expression) %}\n\n right(\n {{ string_text }},\n {{ length_expression }}\n )\n \n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.864384}, "macro.dbt_utils.bigquery__right": {"unique_id": "macro.dbt_utils.bigquery__right", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "bigquery__right", "macro_sql": "{% macro bigquery__right(string_text, length_expression) %}\n\n case when {{ length_expression }} = 0 \n then ''\n else \n substr(\n {{ string_text }},\n -1 * ({{ length_expression }})\n )\n end\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8647308}, "macro.dbt_utils.snowflake__right": {"unique_id": "macro.dbt_utils.snowflake__right", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "snowflake__right", "macro_sql": "{% macro snowflake__right(string_text, length_expression) %}\n\n case when {{ length_expression }} = 0 \n then ''\n else \n right(\n {{ string_text }},\n {{ length_expression }}\n )\n end\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.865079}, "macro.dbt_utils.datediff": {"unique_id": "macro.dbt_utils.datediff", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "datediff", "macro_sql": "{% macro datediff(first_date, second_date, datepart) %}\n {{ return(adapter.dispatch('datediff', 'dbt_utils')(first_date, second_date, datepart)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8691049}, "macro.dbt_utils.default__datediff": {"unique_id": "macro.dbt_utils.default__datediff", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "default__datediff", "macro_sql": "{% macro default__datediff(first_date, second_date, datepart) %}\n\n datediff(\n {{ datepart }},\n {{ first_date }},\n {{ second_date }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.869471}, "macro.dbt_utils.bigquery__datediff": {"unique_id": "macro.dbt_utils.bigquery__datediff", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "bigquery__datediff", "macro_sql": "{% macro bigquery__datediff(first_date, second_date, datepart) %}\n\n datetime_diff(\n cast({{second_date}} as datetime),\n cast({{first_date}} as datetime),\n {{datepart}}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.869826}, "macro.dbt_utils.postgres__datediff": {"unique_id": "macro.dbt_utils.postgres__datediff", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "postgres__datediff", "macro_sql": "{% macro postgres__datediff(first_date, second_date, datepart) %}\n\n {% if datepart == 'year' %}\n (date_part('year', ({{second_date}})::date) - date_part('year', ({{first_date}})::date))\n {% elif datepart == 'quarter' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 4 + date_part('quarter', ({{second_date}})::date) - date_part('quarter', ({{first_date}})::date))\n {% elif datepart == 'month' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 12 + date_part('month', ({{second_date}})::date) - date_part('month', ({{first_date}})::date))\n {% elif datepart == 'day' %}\n (({{second_date}})::date - ({{first_date}})::date)\n {% elif datepart == 'week' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} / 7 + case\n when date_part('dow', ({{first_date}})::timestamp) <= date_part('dow', ({{second_date}})::timestamp) then\n case when {{first_date}} <= {{second_date}} then 0 else -1 end\n else\n case when {{first_date}} <= {{second_date}} then 1 else 0 end\n end)\n {% elif datepart == 'hour' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} * 24 + date_part('hour', ({{second_date}})::timestamp) - date_part('hour', ({{first_date}})::timestamp))\n {% elif datepart == 'minute' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'hour') }} * 60 + date_part('minute', ({{second_date}})::timestamp) - date_part('minute', ({{first_date}})::timestamp))\n {% elif datepart == 'second' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60 + floor(date_part('second', ({{second_date}})::timestamp)) - floor(date_part('second', ({{first_date}})::timestamp)))\n {% elif datepart == 'millisecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000 + floor(date_part('millisecond', ({{second_date}})::timestamp)) - floor(date_part('millisecond', ({{first_date}})::timestamp)))\n {% elif datepart == 'microsecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000000 + floor(date_part('microsecond', ({{second_date}})::timestamp)) - floor(date_part('microsecond', ({{first_date}})::timestamp)))\n {% else %}\n {{ exceptions.raise_compiler_error(\"Unsupported datepart for macro datediff in postgres: {!r}\".format(datepart)) }}\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.873712}, "macro.dbt_utils.redshift__datediff": {"unique_id": "macro.dbt_utils.redshift__datediff", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "redshift__datediff", "macro_sql": "{% macro redshift__datediff(first_date, second_date, datepart) %}\n\n {{ return(dbt_utils.default__datediff(first_date, second_date, datepart)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.874159}, "macro.dbt_utils.safe_cast": {"unique_id": "macro.dbt_utils.safe_cast", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "safe_cast", "macro_sql": "{% macro safe_cast(field, type) %}\n {{ return(adapter.dispatch('safe_cast', 'dbt_utils') (field, type)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.snowflake__safe_cast"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.874988}, "macro.dbt_utils.default__safe_cast": {"unique_id": "macro.dbt_utils.default__safe_cast", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "default__safe_cast", "macro_sql": "{% macro default__safe_cast(field, type) %}\n {# most databases don't support this function yet\n so we just need to use cast #}\n cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.875296}, "macro.dbt_utils.snowflake__safe_cast": {"unique_id": "macro.dbt_utils.snowflake__safe_cast", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "snowflake__safe_cast", "macro_sql": "{% macro snowflake__safe_cast(field, type) %}\n try_cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8755798}, "macro.dbt_utils.bigquery__safe_cast": {"unique_id": "macro.dbt_utils.bigquery__safe_cast", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "bigquery__safe_cast", "macro_sql": "{% macro bigquery__safe_cast(field, type) %}\n safe_cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8758621}, "macro.dbt_utils.hash": {"unique_id": "macro.dbt_utils.hash", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/hash.sql", "original_file_path": "macros/cross_db_utils/hash.sql", "name": "hash", "macro_sql": "{% macro hash(field) -%}\n {{ return(adapter.dispatch('hash', 'dbt_utils') (field)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__hash"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.87656}, "macro.dbt_utils.default__hash": {"unique_id": "macro.dbt_utils.default__hash", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/hash.sql", "original_file_path": "macros/cross_db_utils/hash.sql", "name": "default__hash", "macro_sql": "{% macro default__hash(field) -%}\n md5(cast({{field}} as {{dbt_utils.type_string()}}))\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8768692}, "macro.dbt_utils.bigquery__hash": {"unique_id": "macro.dbt_utils.bigquery__hash", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/hash.sql", "original_file_path": "macros/cross_db_utils/hash.sql", "name": "bigquery__hash", "macro_sql": "{% macro bigquery__hash(field) -%}\n to_hex({{dbt_utils.default__hash(field)}})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__hash"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.877155}, "macro.dbt_utils.cast_bool_to_text": {"unique_id": "macro.dbt_utils.cast_bool_to_text", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_bool_to_text.sql", "original_file_path": "macros/cross_db_utils/cast_bool_to_text.sql", "name": "cast_bool_to_text", "macro_sql": "{% macro cast_bool_to_text(field) %}\n {{ adapter.dispatch('cast_bool_to_text', 'dbt_utils') (field) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.87788}, "macro.dbt_utils.default__cast_bool_to_text": {"unique_id": "macro.dbt_utils.default__cast_bool_to_text", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_bool_to_text.sql", "original_file_path": "macros/cross_db_utils/cast_bool_to_text.sql", "name": "default__cast_bool_to_text", "macro_sql": "{% macro default__cast_bool_to_text(field) %}\n cast({{ field }} as {{ dbt_utils.type_string() }})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8781939}, "macro.dbt_utils.redshift__cast_bool_to_text": {"unique_id": "macro.dbt_utils.redshift__cast_bool_to_text", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_bool_to_text.sql", "original_file_path": "macros/cross_db_utils/cast_bool_to_text.sql", "name": "redshift__cast_bool_to_text", "macro_sql": "{% macro redshift__cast_bool_to_text(field) %}\n case\n when {{ field }} is true then 'true'\n when {{ field }} is false then 'false'\n end::text\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.878473}, "macro.dbt_utils.identifier": {"unique_id": "macro.dbt_utils.identifier", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/identifier.sql", "original_file_path": "macros/cross_db_utils/identifier.sql", "name": "identifier", "macro_sql": "{% macro identifier(value) %}\t\n {%- set error_message = '\n Warning: the `identifier` macro is no longer supported and will be deprecated in a future release of dbt-utils. \\\n Use `adapter.quote` instead. The {}.{} model triggered this warning. \\\n '.format(model.package_name, model.name) -%}\n {%- do exceptions.warn(error_message) -%}\n {{ return(adapter.dispatch('identifier', 'dbt_utils') (value)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__identifier"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8795362}, "macro.dbt_utils.default__identifier": {"unique_id": "macro.dbt_utils.default__identifier", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/identifier.sql", "original_file_path": "macros/cross_db_utils/identifier.sql", "name": "default__identifier", "macro_sql": "{% macro default__identifier(value) -%}\t\n \"{{ value }}\"\t\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.879772}, "macro.dbt_utils.bigquery__identifier": {"unique_id": "macro.dbt_utils.bigquery__identifier", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/identifier.sql", "original_file_path": "macros/cross_db_utils/identifier.sql", "name": "bigquery__identifier", "macro_sql": "{% macro bigquery__identifier(value) -%}\t\n `{{ value }}`\t\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.879998}, "macro.dbt_utils.position": {"unique_id": "macro.dbt_utils.position", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/position.sql", "original_file_path": "macros/cross_db_utils/position.sql", "name": "position", "macro_sql": "{% macro position(substring_text, string_text) -%}\n {{ return(adapter.dispatch('position', 'dbt_utils') (substring_text, string_text)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__position"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.880818}, "macro.dbt_utils.default__position": {"unique_id": "macro.dbt_utils.default__position", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/position.sql", "original_file_path": "macros/cross_db_utils/position.sql", "name": "default__position", "macro_sql": "{% macro default__position(substring_text, string_text) %}\n\n position(\n {{ substring_text }} in {{ string_text }}\n )\n \n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.881119}, "macro.dbt_utils.bigquery__position": {"unique_id": "macro.dbt_utils.bigquery__position", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/position.sql", "original_file_path": "macros/cross_db_utils/position.sql", "name": "bigquery__position", "macro_sql": "{% macro bigquery__position(substring_text, string_text) %}\n\n strpos(\n {{ string_text }},\n {{ substring_text }}\n \n )\n \n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8814158}, "macro.dbt_utils.string_literal": {"unique_id": "macro.dbt_utils.string_literal", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/literal.sql", "original_file_path": "macros/cross_db_utils/literal.sql", "name": "string_literal", "macro_sql": "{%- macro string_literal(value) -%}\n {{ return(adapter.dispatch('string_literal', 'dbt_utils') (value)) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__string_literal"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8820531}, "macro.dbt_utils.default__string_literal": {"unique_id": "macro.dbt_utils.default__string_literal", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/literal.sql", "original_file_path": "macros/cross_db_utils/literal.sql", "name": "default__string_literal", "macro_sql": "{% macro default__string_literal(value) -%}\n '{{ value }}'\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.882284}, "macro.dbt_utils.current_timestamp": {"unique_id": "macro.dbt_utils.current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "current_timestamp", "macro_sql": "{% macro current_timestamp() -%}\n {{ return(adapter.dispatch('current_timestamp', 'dbt_utils')()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8833761}, "macro.dbt_utils.default__current_timestamp": {"unique_id": "macro.dbt_utils.default__current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "default__current_timestamp", "macro_sql": "{% macro default__current_timestamp() %}\n current_timestamp::{{dbt_utils.type_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.883633}, "macro.dbt_utils.redshift__current_timestamp": {"unique_id": "macro.dbt_utils.redshift__current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "redshift__current_timestamp", "macro_sql": "{% macro redshift__current_timestamp() %}\n getdate()\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8837981}, "macro.dbt_utils.bigquery__current_timestamp": {"unique_id": "macro.dbt_utils.bigquery__current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "bigquery__current_timestamp", "macro_sql": "{% macro bigquery__current_timestamp() %}\n current_timestamp\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.883966}, "macro.dbt_utils.current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "current_timestamp_in_utc", "macro_sql": "{% macro current_timestamp_in_utc() -%}\n {{ return(adapter.dispatch('current_timestamp_in_utc', 'dbt_utils')()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.snowflake__current_timestamp_in_utc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8844202}, "macro.dbt_utils.default__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.default__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "default__current_timestamp_in_utc", "macro_sql": "{% macro default__current_timestamp_in_utc() %}\n {{dbt_utils.current_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.884667}, "macro.dbt_utils.snowflake__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.snowflake__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "snowflake__current_timestamp_in_utc", "macro_sql": "{% macro snowflake__current_timestamp_in_utc() %}\n convert_timezone('UTC', {{dbt_utils.current_timestamp()}})::{{dbt_utils.type_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.current_timestamp", "macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.884989}, "macro.dbt_utils.postgres__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.postgres__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "postgres__current_timestamp_in_utc", "macro_sql": "{% macro postgres__current_timestamp_in_utc() %}\n (current_timestamp at time zone 'utc')::{{dbt_utils.type_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8852348}, "macro.dbt_utils.redshift__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.redshift__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "redshift__current_timestamp_in_utc", "macro_sql": "{% macro redshift__current_timestamp_in_utc() %}\n {{ return(dbt_utils.default__current_timestamp_in_utc()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__current_timestamp_in_utc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8855228}, "macro.dbt_utils.width_bucket": {"unique_id": "macro.dbt_utils.width_bucket", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "width_bucket", "macro_sql": "{% macro width_bucket(expr, min_value, max_value, num_buckets) %}\n {{ return(adapter.dispatch('width_bucket', 'dbt_utils') (expr, min_value, max_value, num_buckets)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.snowflake__width_bucket"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.887796}, "macro.dbt_utils.default__width_bucket": {"unique_id": "macro.dbt_utils.default__width_bucket", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "default__width_bucket", "macro_sql": "{% macro default__width_bucket(expr, min_value, max_value, num_buckets) -%}\n\n {% set bin_size -%}\n (( {{ max_value }} - {{ min_value }} ) / {{ num_buckets }} )\n {%- endset %}\n (\n -- to break ties when the amount is eaxtly at the bucket egde\n case\n when\n mod(\n {{ dbt_utils.safe_cast(expr, dbt_utils.type_numeric() ) }},\n {{ dbt_utils.safe_cast(bin_size, dbt_utils.type_numeric() ) }}\n ) = 0\n then 1\n else 0\n end\n ) +\n -- Anything over max_value goes the N+1 bucket\n least(\n ceil(\n ({{ expr }} - {{ min_value }})/{{ bin_size }}\n ),\n {{ num_buckets }} + 1\n )\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.safe_cast", "macro.dbt_utils.type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.888801}, "macro.dbt_utils.redshift__width_bucket": {"unique_id": "macro.dbt_utils.redshift__width_bucket", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "redshift__width_bucket", "macro_sql": "{% macro redshift__width_bucket(expr, min_value, max_value, num_buckets) -%}\n\n {% set bin_size -%}\n (( {{ max_value }} - {{ min_value }} ) / {{ num_buckets }} )\n {%- endset %}\n (\n -- to break ties when the amount is exactly at the bucket edge\n case\n when\n {{ dbt_utils.safe_cast(expr, dbt_utils.type_numeric() ) }} %\n {{ dbt_utils.safe_cast(bin_size, dbt_utils.type_numeric() ) }}\n = 0\n then 1\n else 0\n end\n ) +\n -- Anything over max_value goes the N+1 bucket\n least(\n ceil(\n ({{ expr }} - {{ min_value }})/{{ bin_size }}\n ),\n {{ num_buckets }} + 1\n )\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.safe_cast", "macro.dbt_utils.type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.889808}, "macro.dbt_utils.snowflake__width_bucket": {"unique_id": "macro.dbt_utils.snowflake__width_bucket", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "snowflake__width_bucket", "macro_sql": "{% macro snowflake__width_bucket(expr, min_value, max_value, num_buckets) %}\n width_bucket({{ expr }}, {{ min_value }}, {{ max_value }}, {{ num_buckets }} )\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.89023}, "macro.dbt_utils.last_day": {"unique_id": "macro.dbt_utils.last_day", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "last_day", "macro_sql": "{% macro last_day(date, datepart) %}\n {{ return(adapter.dispatch('last_day', 'dbt_utils') (date, datepart)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.89135}, "macro.dbt_utils.default_last_day": {"unique_id": "macro.dbt_utils.default_last_day", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "default_last_day", "macro_sql": "\n\n\n{%- macro default_last_day(date, datepart) -%}\n cast(\n {{dbt_utils.dateadd('day', '-1',\n dbt_utils.dateadd(datepart, '1', dbt_utils.date_trunc(datepart, date))\n )}}\n as date)\n{%- endmacro -%}\n\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd", "macro.dbt_utils.date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.891926}, "macro.dbt_utils.default__last_day": {"unique_id": "macro.dbt_utils.default__last_day", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "default__last_day", "macro_sql": "{% macro default__last_day(date, datepart) -%}\n {{dbt_utils.default_last_day(date, datepart)}}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default_last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.892249}, "macro.dbt_utils.postgres__last_day": {"unique_id": "macro.dbt_utils.postgres__last_day", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "postgres__last_day", "macro_sql": "{% macro postgres__last_day(date, datepart) -%}\n\n {%- if datepart == 'quarter' -%}\n -- postgres dateadd does not support quarter interval.\n cast(\n {{dbt_utils.dateadd('day', '-1',\n dbt_utils.dateadd('month', '3', dbt_utils.date_trunc(datepart, date))\n )}}\n as date)\n {%- else -%}\n {{dbt_utils.default_last_day(date, datepart)}}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd", "macro.dbt_utils.date_trunc", "macro.dbt_utils.default_last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8931022}, "macro.dbt_utils.redshift__last_day": {"unique_id": "macro.dbt_utils.redshift__last_day", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "redshift__last_day", "macro_sql": "{% macro redshift__last_day(date, datepart) %}\n\n {{ return(dbt_utils.default__last_day(date, datepart)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.893485}, "macro.dbt_utils.split_part": {"unique_id": "macro.dbt_utils.split_part", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "split_part", "macro_sql": "{% macro split_part(string_text, delimiter_text, part_number) %}\n {{ return(adapter.dispatch('split_part', 'dbt_utils') (string_text, delimiter_text, part_number)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__split_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.894419}, "macro.dbt_utils.default__split_part": {"unique_id": "macro.dbt_utils.default__split_part", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "default__split_part", "macro_sql": "{% macro default__split_part(string_text, delimiter_text, part_number) %}\n\n split_part(\n {{ string_text }},\n {{ delimiter_text }},\n {{ part_number }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8948312}, "macro.dbt_utils.bigquery__split_part": {"unique_id": "macro.dbt_utils.bigquery__split_part", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "bigquery__split_part", "macro_sql": "{% macro bigquery__split_part(string_text, delimiter_text, part_number) %}\n\n split(\n {{ string_text }},\n {{ delimiter_text }}\n )[safe_offset({{ part_number - 1 }})]\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.895217}, "macro.dbt_utils.date_trunc": {"unique_id": "macro.dbt_utils.date_trunc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/date_trunc.sql", "original_file_path": "macros/cross_db_utils/date_trunc.sql", "name": "date_trunc", "macro_sql": "{% macro date_trunc(datepart, date) -%}\n {{ return(adapter.dispatch('date_trunc', 'dbt_utils') (datepart, date)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8959942}, "macro.dbt_utils.default__date_trunc": {"unique_id": "macro.dbt_utils.default__date_trunc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/date_trunc.sql", "original_file_path": "macros/cross_db_utils/date_trunc.sql", "name": "default__date_trunc", "macro_sql": "{% macro default__date_trunc(datepart, date) %}\n date_trunc('{{datepart}}', {{date}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.896287}, "macro.dbt_utils.bigquery__date_trunc": {"unique_id": "macro.dbt_utils.bigquery__date_trunc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/date_trunc.sql", "original_file_path": "macros/cross_db_utils/date_trunc.sql", "name": "bigquery__date_trunc", "macro_sql": "{% macro bigquery__date_trunc(datepart, date) %}\n timestamp_trunc(\n cast({{date}} as timestamp),\n {{datepart}}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.896579}, "macro.dbt_utils._is_ephemeral": {"unique_id": "macro.dbt_utils._is_ephemeral", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/_is_ephemeral.sql", "original_file_path": "macros/cross_db_utils/_is_ephemeral.sql", "name": "_is_ephemeral", "macro_sql": "{% macro _is_ephemeral(obj, macro) %}\n {%- if obj.is_cte -%}\n {% set ephemeral_prefix = api.Relation.add_ephemeral_prefix('') %}\n {% if obj.name.startswith(ephemeral_prefix) %}\n {% set model_name = obj.name[(ephemeral_prefix|length):] %}\n {% else %}\n {% set model_name = obj.name %}\n {%- endif -%}\n {% set error_message %}\nThe `{{ macro }}` macro cannot be used with ephemeral models, as it relies on the information schema.\n\n`{{ model_name }}` is an ephemeral model. Consider making it a view or table instead.\n {% endset %}\n {%- do exceptions.raise_compiler_error(error_message) -%}\n {%- endif -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.8983319}, "macro.dbt_utils.get_period_boundaries": {"unique_id": "macro.dbt_utils.get_period_boundaries", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "get_period_boundaries", "macro_sql": "{% macro get_period_boundaries(target_schema, target_table, timestamp_field, start_date, stop_date, period) -%}\n {{ return(adapter.dispatch('get_period_boundaries', 'dbt_utils')(target_schema, target_table, timestamp_field, start_date, stop_date, period)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_period_boundaries"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.907077}, "macro.dbt_utils.default__get_period_boundaries": {"unique_id": "macro.dbt_utils.default__get_period_boundaries", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "default__get_period_boundaries", "macro_sql": "{% macro default__get_period_boundaries(target_schema, target_table, timestamp_field, start_date, stop_date, period) -%}\n\n {% call statement('period_boundaries', fetch_result=True) -%}\n with data as (\n select\n coalesce(max(\"{{timestamp_field}}\"), '{{start_date}}')::timestamp as start_timestamp,\n coalesce(\n {{dbt_utils.dateadd('millisecond',\n -1,\n \"nullif('\" ~ stop_date ~ \"','')::timestamp\")}},\n {{dbt_utils.current_timestamp()}}\n ) as stop_timestamp\n from \"{{target_schema}}\".\"{{target_table}}\"\n )\n\n select\n start_timestamp,\n stop_timestamp,\n {{dbt_utils.datediff('start_timestamp',\n 'stop_timestamp',\n period)}} + 1 as num_periods\n from data\n {%- endcall %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.dateadd", "macro.dbt_utils.current_timestamp", "macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.908303}, "macro.dbt_utils.get_period_sql": {"unique_id": "macro.dbt_utils.get_period_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "get_period_sql", "macro_sql": "{% macro get_period_sql(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset) -%}\n {{ return(adapter.dispatch('get_period_sql', 'dbt_utils')(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_period_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.908992}, "macro.dbt_utils.default__get_period_sql": {"unique_id": "macro.dbt_utils.default__get_period_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "default__get_period_sql", "macro_sql": "{% macro default__get_period_sql(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset) -%}\n\n {%- set period_filter -%}\n (\"{{timestamp_field}}\" > '{{start_timestamp}}'::timestamp + interval '{{offset}} {{period}}' and\n \"{{timestamp_field}}\" <= '{{start_timestamp}}'::timestamp + interval '{{offset}} {{period}}' + interval '1 {{period}}' and\n \"{{timestamp_field}}\" < '{{stop_timestamp}}'::timestamp)\n {%- endset -%}\n\n {%- set filtered_sql = sql | replace(\"__PERIOD_FILTER__\", period_filter) -%}\n\n select\n {{target_cols_csv}}\n from (\n {{filtered_sql}}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.910096}, "macro.dbt_utils.materialization_insert_by_period_default": {"unique_id": "macro.dbt_utils.materialization_insert_by_period_default", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "materialization_insert_by_period_default", "macro_sql": "{% materialization insert_by_period, default -%}\n {%- set timestamp_field = config.require('timestamp_field') -%}\n {%- set start_date = config.require('start_date') -%}\n {%- set stop_date = config.get('stop_date') or '' -%}}\n {%- set period = config.get('period') or 'week' -%}\n\n {%- if sql.find('__PERIOD_FILTER__') == -1 -%}\n {%- set error_message -%}\n Model '{{ model.unique_id }}' does not include the required string '__PERIOD_FILTER__' in its sql\n {%- endset -%}\n {{ exceptions.raise_compiler_error(error_message) }}\n {%- endif -%}\n\n {%- set identifier = model['name'] -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier, schema=schema, type='table') -%}\n\n {%- set non_destructive_mode = (flags.NON_DESTRUCTIVE == True) -%}\n {%- set full_refresh_mode = (flags.FULL_REFRESH == True) -%}\n\n {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n {%- set exists_not_as_table = (old_relation is not none and not old_relation.is_table) -%}\n\n {%- set should_truncate = (non_destructive_mode and full_refresh_mode and exists_as_table) -%}\n {%- set should_drop = (not should_truncate and (full_refresh_mode or exists_not_as_table)) -%}\n {%- set force_create = (flags.FULL_REFRESH and not flags.NON_DESTRUCTIVE) -%}\n\n -- setup\n {% if old_relation is none -%}\n -- noop\n {%- elif should_truncate -%}\n {{adapter.truncate_relation(old_relation)}}\n {%- elif should_drop -%}\n {{adapter.drop_relation(old_relation)}}\n {%- set old_relation = none -%}\n {%- endif %}\n\n {{run_hooks(pre_hooks, inside_transaction=False)}}\n\n -- `begin` happens here, so `commit` after it to finish the transaction\n {{run_hooks(pre_hooks, inside_transaction=True)}}\n {% call statement() -%}\n begin; -- make extra sure we've closed out the transaction\n commit;\n {%- endcall %}\n\n -- build model\n {% if force_create or old_relation is none -%}\n {# Create an empty target table -#}\n {% call statement('main') -%}\n {%- set empty_sql = sql | replace(\"__PERIOD_FILTER__\", 'false') -%}\n {{create_table_as(False, target_relation, empty_sql)}}\n {%- endcall %}\n {%- endif %}\n\n {% set _ = dbt_utils.get_period_boundaries(schema,\n identifier,\n timestamp_field,\n start_date,\n stop_date,\n period) %}\n {%- set start_timestamp = load_result('period_boundaries')['data'][0][0] | string -%}\n {%- set stop_timestamp = load_result('period_boundaries')['data'][0][1] | string -%}\n {%- set num_periods = load_result('period_boundaries')['data'][0][2] | int -%}\n\n {% set target_columns = adapter.get_columns_in_relation(target_relation) %}\n {%- set target_cols_csv = target_columns | map(attribute='quoted') | join(', ') -%}\n {%- set loop_vars = {'sum_rows_inserted': 0} -%}\n\n -- commit each period as a separate transaction\n {% for i in range(num_periods) -%}\n {%- set msg = \"Running for \" ~ period ~ \" \" ~ (i + 1) ~ \" of \" ~ (num_periods) -%}\n {{ dbt_utils.log_info(msg) }}\n\n {%- set tmp_identifier = model['name'] ~ '__dbt_incremental_period' ~ i ~ '_tmp' -%}\n {%- set tmp_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema, type='table') -%}\n {% call statement() -%}\n {% set tmp_table_sql = dbt_utils.get_period_sql(target_cols_csv,\n sql,\n timestamp_field,\n period,\n start_timestamp,\n stop_timestamp,\n i) %}\n {{dbt.create_table_as(True, tmp_relation, tmp_table_sql)}}\n {%- endcall %}\n\n {{adapter.expand_target_column_types(from_relation=tmp_relation,\n to_relation=target_relation)}}\n {%- set name = 'main-' ~ i -%}\n {% call statement(name, fetch_result=True) -%}\n insert into {{target_relation}} ({{target_cols_csv}})\n (\n select\n {{target_cols_csv}}\n from {{tmp_relation.include(schema=False)}}\n );\n {%- endcall %}\n {% set result = load_result('main-' ~ i) %}\n {% if 'response' in result.keys() %} {# added in v0.19.0 #}\n {% set rows_inserted = result['response']['rows_affected'] %}\n {% else %} {# older versions #}\n {% set rows_inserted = result['status'].split(\" \")[2] | int %}\n {% endif %}\n \n {%- set sum_rows_inserted = loop_vars['sum_rows_inserted'] + rows_inserted -%}\n {%- if loop_vars.update({'sum_rows_inserted': sum_rows_inserted}) %} {% endif -%}\n\n {%- set msg = \"Ran for \" ~ period ~ \" \" ~ (i + 1) ~ \" of \" ~ (num_periods) ~ \"; \" ~ rows_inserted ~ \" records inserted\" -%}\n {{ dbt_utils.log_info(msg) }}\n\n {%- endfor %}\n\n {% call statement() -%}\n begin;\n {%- endcall %}\n\n {{run_hooks(post_hooks, inside_transaction=True)}}\n\n {% call statement() -%}\n commit;\n {%- endcall %}\n\n {{run_hooks(post_hooks, inside_transaction=False)}}\n\n {%- set status_string = \"INSERT \" ~ loop_vars['sum_rows_inserted'] -%}\n\n {% call noop_statement('main', status_string) -%}\n -- no-op\n {%- endcall %}\n\n -- Return the relations created in this materialization\n {{ return({'relations': [target_relation]}) }} \n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt_utils.get_period_boundaries", "macro.dbt_utils.log_info", "macro.dbt_utils.get_period_sql", "macro.dbt.noop_statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.921243}, "macro.dbt_utils.get_url_host": {"unique_id": "macro.dbt_utils.get_url_host", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "name": "get_url_host", "macro_sql": "{% macro get_url_host(field) -%}\n {{ return(adapter.dispatch('get_url_host', 'dbt_utils')(field)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_url_host"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.933612}, "macro.dbt_utils.default__get_url_host": {"unique_id": "macro.dbt_utils.default__get_url_host", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "name": "default__get_url_host", "macro_sql": "{% macro default__get_url_host(field) -%}\n\n{%- set parsed =\n dbt_utils.split_part(\n dbt_utils.split_part(\n dbt_utils.replace(\n dbt_utils.replace(\n dbt_utils.replace(field, \"'android-app://'\", \"''\"\n ), \"'http://'\", \"''\"\n ), \"'https://'\", \"''\"\n ), \"'/'\", 1\n ), \"'?'\", 1\n )\n\n-%}\n\n\n {{ dbt_utils.safe_cast(\n parsed,\n dbt_utils.type_string()\n )}}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.split_part", "macro.dbt_utils.replace", "macro.dbt_utils.safe_cast", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.935704}, "macro.dbt_utils.get_url_path": {"unique_id": "macro.dbt_utils.get_url_path", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "name": "get_url_path", "macro_sql": "{% macro get_url_path(field) -%}\n {{ return(adapter.dispatch('get_url_path', 'dbt_utils')(field)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_url_path"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.937442}, "macro.dbt_utils.default__get_url_path": {"unique_id": "macro.dbt_utils.default__get_url_path", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "name": "default__get_url_path", "macro_sql": "{% macro default__get_url_path(field) -%}\n\n {%- set stripped_url = \n dbt_utils.replace(\n dbt_utils.replace(field, \"'http://'\", \"''\"), \"'https://'\", \"''\")\n -%}\n\n {%- set first_slash_pos -%}\n coalesce(\n nullif({{dbt_utils.position(\"'/'\", stripped_url)}}, 0),\n {{dbt_utils.position(\"'?'\", stripped_url)}} - 1\n )\n {%- endset -%}\n\n {%- set parsed_path =\n dbt_utils.split_part(\n dbt_utils.right(\n stripped_url, \n dbt_utils.length(stripped_url) ~ \"-\" ~ first_slash_pos\n ), \n \"'?'\", 1\n )\n -%}\n\n {{ dbt_utils.safe_cast(\n parsed_path,\n dbt_utils.type_string()\n )}}\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.replace", "macro.dbt_utils.position", "macro.dbt_utils.split_part", "macro.dbt_utils.right", "macro.dbt_utils.length", "macro.dbt_utils.safe_cast", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.939594}, "macro.dbt_utils.get_url_parameter": {"unique_id": "macro.dbt_utils.get_url_parameter", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "name": "get_url_parameter", "macro_sql": "{% macro get_url_parameter(field, url_parameter) -%}\n {{ return(adapter.dispatch('get_url_parameter', 'dbt_utils')(field, url_parameter)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_url_parameter"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.940662}, "macro.dbt_utils.default__get_url_parameter": {"unique_id": "macro.dbt_utils.default__get_url_parameter", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "name": "default__get_url_parameter", "macro_sql": "{% macro default__get_url_parameter(field, url_parameter) -%}\n\n{%- set formatted_url_parameter = \"'\" + url_parameter + \"='\" -%}\n\n{%- set split = dbt_utils.split_part(dbt_utils.split_part(field, formatted_url_parameter, 2), \"'&'\", 1) -%}\n\nnullif({{ split }},'')\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.split_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.941629}, "macro.dbt_utils.pretty_log_format": {"unique_id": "macro.dbt_utils.pretty_log_format", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_log_format.sql", "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", "name": "pretty_log_format", "macro_sql": "{% macro pretty_log_format(message) %}\n {{ return(adapter.dispatch('pretty_log_format', 'dbt_utils')(message)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__pretty_log_format"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.942548}, "macro.dbt_utils.default__pretty_log_format": {"unique_id": "macro.dbt_utils.default__pretty_log_format", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_log_format.sql", "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", "name": "default__pretty_log_format", "macro_sql": "{% macro default__pretty_log_format(message) %}\n {{ return( dbt_utils.pretty_time() ~ ' + ' ~ message) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.pretty_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.943052}, "macro.dbt_utils.pretty_time": {"unique_id": "macro.dbt_utils.pretty_time", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_time.sql", "original_file_path": "macros/jinja_helpers/pretty_time.sql", "name": "pretty_time", "macro_sql": "{% macro pretty_time(format='%H:%M:%S') %}\n {{ return(adapter.dispatch('pretty_time', 'dbt_utils')(format)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__pretty_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.943883}, "macro.dbt_utils.default__pretty_time": {"unique_id": "macro.dbt_utils.default__pretty_time", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_time.sql", "original_file_path": "macros/jinja_helpers/pretty_time.sql", "name": "default__pretty_time", "macro_sql": "{% macro default__pretty_time(format='%H:%M:%S') %}\n {{ return(modules.datetime.datetime.now().strftime(format)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.9443898}, "macro.dbt_utils.log_info": {"unique_id": "macro.dbt_utils.log_info", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/log_info.sql", "original_file_path": "macros/jinja_helpers/log_info.sql", "name": "log_info", "macro_sql": "{% macro log_info(message) %}\n {{ return(adapter.dispatch('log_info', 'dbt_utils')(message)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__log_info"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.9451709}, "macro.dbt_utils.default__log_info": {"unique_id": "macro.dbt_utils.default__log_info", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/log_info.sql", "original_file_path": "macros/jinja_helpers/log_info.sql", "name": "default__log_info", "macro_sql": "{% macro default__log_info(message) %}\n {{ log(dbt_utils.pretty_log_format(message), info=True) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.pretty_log_format"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.945623}, "macro.dbt_utils.slugify": {"unique_id": "macro.dbt_utils.slugify", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/slugify.sql", "original_file_path": "macros/jinja_helpers/slugify.sql", "name": "slugify", "macro_sql": "{% macro slugify(string) %}\n\n{#- Lower case the string -#}\n{% set string = string | lower %}\n{#- Replace spaces and dashes with underscores -#}\n{% set string = modules.re.sub('[ -]+', '_', string) %}\n{#- Only take letters, numbers, and underscores -#}\n{% set string = modules.re.sub('[^a-z0-9_]+', '', string) %}\n\n{{ return(string) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.946931}, "macro.dbt_utils.test_fewer_rows_than": {"unique_id": "macro.dbt_utils.test_fewer_rows_than", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/fewer_rows_than.sql", "original_file_path": "macros/schema_tests/fewer_rows_than.sql", "name": "test_fewer_rows_than", "macro_sql": "{% test fewer_rows_than(model, compare_model) %}\n {{ return(adapter.dispatch('test_fewer_rows_than', 'dbt_utils')(model, compare_model)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_fewer_rows_than"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.948168}, "macro.dbt_utils.default__test_fewer_rows_than": {"unique_id": "macro.dbt_utils.default__test_fewer_rows_than", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/fewer_rows_than.sql", "original_file_path": "macros/schema_tests/fewer_rows_than.sql", "name": "default__test_fewer_rows_than", "macro_sql": "{% macro default__test_fewer_rows_than(model, compare_model) %}\n\n{{ config(fail_calc = 'coalesce(row_count_delta, 0)') }}\n\nwith a as (\n\n select count(*) as count_our_model from {{ model }}\n\n),\nb as (\n\n select count(*) as count_comparison_model from {{ compare_model }}\n\n),\ncounts as (\n\n select\n count_our_model,\n count_comparison_model\n from a\n cross join b\n\n),\nfinal as (\n\n select *,\n case\n -- fail the test if we have more rows than the reference model and return the row count delta\n when count_our_model > count_comparison_model then (count_our_model - count_comparison_model)\n -- fail the test if they are the same number\n when count_our_model = count_comparison_model then 1\n -- pass the test if the delta is positive (i.e. return the number 0)\n else 0\n end as row_count_delta\n from counts\n\n)\n\nselect * from final\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.94874}, "macro.dbt_utils.test_equal_rowcount": {"unique_id": "macro.dbt_utils.test_equal_rowcount", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/equal_rowcount.sql", "original_file_path": "macros/schema_tests/equal_rowcount.sql", "name": "test_equal_rowcount", "macro_sql": "{% test equal_rowcount(model, compare_model) %}\n {{ return(adapter.dispatch('test_equal_rowcount', 'dbt_utils')(model, compare_model)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_equal_rowcount"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.9497752}, "macro.dbt_utils.default__test_equal_rowcount": {"unique_id": "macro.dbt_utils.default__test_equal_rowcount", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/equal_rowcount.sql", "original_file_path": "macros/schema_tests/equal_rowcount.sql", "name": "default__test_equal_rowcount", "macro_sql": "{% macro default__test_equal_rowcount(model, compare_model) %}\n\n{#-- Needs to be set at parse time, before we return '' below --#}\n{{ config(fail_calc = 'coalesce(diff_count, 0)') }}\n\n{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n{%- if not execute -%}\n {{ return('') }}\n{% endif %}\n\nwith a as (\n\n select count(*) as count_a from {{ model }}\n\n),\nb as (\n\n select count(*) as count_b from {{ compare_model }}\n\n),\nfinal as (\n\n select\n count_a,\n count_b,\n abs(count_a - count_b) as diff_count\n from a\n cross join b\n\n)\n\nselect * from final\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.95053}, "macro.dbt_utils.test_relationships_where": {"unique_id": "macro.dbt_utils.test_relationships_where", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/relationships_where.sql", "original_file_path": "macros/schema_tests/relationships_where.sql", "name": "test_relationships_where", "macro_sql": "{% test relationships_where(model, column_name, to, field, from_condition=\"1=1\", to_condition=\"1=1\") %}\n {{ return(adapter.dispatch('test_relationships_where', 'dbt_utils')(model, column_name, to, field, from_condition, to_condition)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_relationships_where"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.9520729}, "macro.dbt_utils.default__test_relationships_where": {"unique_id": "macro.dbt_utils.default__test_relationships_where", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/relationships_where.sql", "original_file_path": "macros/schema_tests/relationships_where.sql", "name": "default__test_relationships_where", "macro_sql": "{% macro default__test_relationships_where(model, column_name, to, field, from_condition=\"1=1\", to_condition=\"1=1\") %}\n\n{# T-SQL has no boolean data type so we use 1=1 which returns TRUE #}\n{# ref https://stackoverflow.com/a/7170753/3842610 #}\n\nwith left_table as (\n\n select\n {{column_name}} as id\n\n from {{model}}\n\n where {{column_name}} is not null\n and {{from_condition}}\n\n),\n\nright_table as (\n\n select\n {{field}} as id\n\n from {{to}}\n\n where {{field}} is not null\n and {{to_condition}}\n\n),\n\nexceptions as (\n\n select\n left_table.id,\n right_table.id as right_id\n\n from left_table\n\n left join right_table\n on left_table.id = right_table.id\n\n where right_table.id is null\n\n)\n\nselect * from exceptions\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.9529521}, "macro.dbt_utils.test_recency": {"unique_id": "macro.dbt_utils.test_recency", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/recency.sql", "original_file_path": "macros/schema_tests/recency.sql", "name": "test_recency", "macro_sql": "{% test recency(model, field, datepart, interval) %}\n {{ return(adapter.dispatch('test_recency', 'dbt_utils')(model, field, datepart, interval)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_recency"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.9540448}, "macro.dbt_utils.default__test_recency": {"unique_id": "macro.dbt_utils.default__test_recency", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/recency.sql", "original_file_path": "macros/schema_tests/recency.sql", "name": "default__test_recency", "macro_sql": "{% macro default__test_recency(model, field, datepart, interval) %}\n\n{% set threshold = dbt_utils.dateadd(datepart, interval * -1, dbt_utils.current_timestamp()) %}\n\nwith recency as (\n\n select max({{field}}) as most_recent\n from {{ model }}\n\n)\n\nselect\n\n most_recent,\n {{ threshold }} as threshold\n\nfrom recency\nwhere most_recent < {{ threshold }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd", "macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.9550369}, "macro.dbt_utils.test_not_constant": {"unique_id": "macro.dbt_utils.test_not_constant", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/not_constant.sql", "original_file_path": "macros/schema_tests/not_constant.sql", "name": "test_not_constant", "macro_sql": "{% test not_constant(model, column_name) %}\n {{ return(adapter.dispatch('test_not_constant', 'dbt_utils')(model, column_name)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_not_constant"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.9559429}, "macro.dbt_utils.default__test_not_constant": {"unique_id": "macro.dbt_utils.default__test_not_constant", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/not_constant.sql", "original_file_path": "macros/schema_tests/not_constant.sql", "name": "default__test_not_constant", "macro_sql": "{% macro default__test_not_constant(model, column_name) %}\n\n\nselect\n {# In TSQL, subquery aggregate columns need aliases #}\n {# thus: a filler col name, 'filler_column' #}\n count(distinct {{ column_name }}) as filler_column\n\nfrom {{ model }}\n\nhaving count(distinct {{ column_name }}) = 1\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.9564002}, "macro.dbt_utils.test_accepted_range": {"unique_id": "macro.dbt_utils.test_accepted_range", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/accepted_range.sql", "original_file_path": "macros/schema_tests/accepted_range.sql", "name": "test_accepted_range", "macro_sql": "{% test accepted_range(model, column_name, min_value=none, max_value=none, inclusive=true) %}\n {{ return(adapter.dispatch('test_accepted_range', 'dbt_utils')(model, column_name, min_value, max_value, inclusive)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_accepted_range"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.957793}, "macro.dbt_utils.default__test_accepted_range": {"unique_id": "macro.dbt_utils.default__test_accepted_range", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/accepted_range.sql", "original_file_path": "macros/schema_tests/accepted_range.sql", "name": "default__test_accepted_range", "macro_sql": "{% macro default__test_accepted_range(model, column_name, min_value=none, max_value=none, inclusive=true) %}\n\nwith meet_condition as(\n select *\n from {{ model }}\n),\n\nvalidation_errors as (\n select *\n from meet_condition\n where\n -- never true, defaults to an empty result set. Exists to ensure any combo of the `or` clauses below succeeds\n 1 = 2\n\n {%- if min_value is not none %}\n -- records with a value >= min_value are permitted. The `not` flips this to find records that don't meet the rule.\n or not {{ column_name }} > {{- \"=\" if inclusive }} {{ min_value }}\n {%- endif %}\n\n {%- if max_value is not none %}\n -- records with a value <= max_value are permitted. The `not` flips this to find records that don't meet the rule.\n or not {{ column_name }} < {{- \"=\" if inclusive }} {{ max_value }}\n {%- endif %}\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.958914}, "macro.dbt_utils.test_not_accepted_values": {"unique_id": "macro.dbt_utils.test_not_accepted_values", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/not_accepted_values.sql", "original_file_path": "macros/schema_tests/not_accepted_values.sql", "name": "test_not_accepted_values", "macro_sql": "{% test not_accepted_values(model, column_name, values, quote=True) %}\n {{ return(adapter.dispatch('test_not_accepted_values', 'dbt_utils')(model, column_name, values, quote)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_not_accepted_values"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.9601028}, "macro.dbt_utils.default__test_not_accepted_values": {"unique_id": "macro.dbt_utils.default__test_not_accepted_values", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/not_accepted_values.sql", "original_file_path": "macros/schema_tests/not_accepted_values.sql", "name": "default__test_not_accepted_values", "macro_sql": "{% macro default__test_not_accepted_values(model, column_name, values, quote=True) %}\nwith all_values as (\n\n select distinct\n {{ column_name }} as value_field\n\n from {{ model }}\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field in (\n {% for value in values -%}\n {% if quote -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {%- endfor %}\n )\n\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.960972}, "macro.dbt_utils.test_unique_where": {"unique_id": "macro.dbt_utils.test_unique_where", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/test_unique_where.sql", "original_file_path": "macros/schema_tests/test_unique_where.sql", "name": "test_unique_where", "macro_sql": "{% test unique_where(model, column_name) %}\r\n {%- set deprecation_warning = '\r\n Warning: `dbt_utils.unique_where` is no longer supported.\r\n Starting in dbt v0.20.0, the built-in `unique` test supports a `where` config.\r\n ' -%}\r\n {%- do exceptions.warn(deprecation_warning) -%}\r\n {{ return(adapter.dispatch('test_unique_where', 'dbt_utils')(model, column_name)) }}\r\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_unique_where"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.961955}, "macro.dbt_utils.default__test_unique_where": {"unique_id": "macro.dbt_utils.default__test_unique_where", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/test_unique_where.sql", "original_file_path": "macros/schema_tests/test_unique_where.sql", "name": "default__test_unique_where", "macro_sql": "{% macro default__test_unique_where(model, column_name) %}\r\n {{ return(test_unique(model, column_name)) }}\r\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.test_unique"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.962324}, "macro.dbt_utils.test_at_least_one": {"unique_id": "macro.dbt_utils.test_at_least_one", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/at_least_one.sql", "original_file_path": "macros/schema_tests/at_least_one.sql", "name": "test_at_least_one", "macro_sql": "{% test at_least_one(model, column_name) %}\n {{ return(adapter.dispatch('test_at_least_one', 'dbt_utils')(model, column_name)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_at_least_one"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.963095}, "macro.dbt_utils.default__test_at_least_one": {"unique_id": "macro.dbt_utils.default__test_at_least_one", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/at_least_one.sql", "original_file_path": "macros/schema_tests/at_least_one.sql", "name": "default__test_at_least_one", "macro_sql": "{% macro default__test_at_least_one(model, column_name) %}\n\nselect *\nfrom (\n select\n {# In TSQL, subquery aggregate columns need aliases #}\n {# thus: a filler col name, 'filler_column' #}\n count({{ column_name }}) as filler_column\n\n from {{ model }}\n\n having count({{ column_name }}) = 0\n\n) validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.9634829}, "macro.dbt_utils.test_unique_combination_of_columns": {"unique_id": "macro.dbt_utils.test_unique_combination_of_columns", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/unique_combination_of_columns.sql", "original_file_path": "macros/schema_tests/unique_combination_of_columns.sql", "name": "test_unique_combination_of_columns", "macro_sql": "{% test unique_combination_of_columns(model, combination_of_columns, quote_columns=false) %}\n {{ return(adapter.dispatch('test_unique_combination_of_columns', 'dbt_utils')(model, combination_of_columns, quote_columns)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_unique_combination_of_columns"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.96469}, "macro.dbt_utils.default__test_unique_combination_of_columns": {"unique_id": "macro.dbt_utils.default__test_unique_combination_of_columns", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/unique_combination_of_columns.sql", "original_file_path": "macros/schema_tests/unique_combination_of_columns.sql", "name": "default__test_unique_combination_of_columns", "macro_sql": "{% macro default__test_unique_combination_of_columns(model, combination_of_columns, quote_columns=false) %}\n\n{% if not quote_columns %}\n {%- set column_list=combination_of_columns %}\n{% elif quote_columns %}\n {%- set column_list=[] %}\n {% for column in combination_of_columns -%}\n {% set column_list = column_list.append( adapter.quote(column) ) %}\n {%- endfor %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`quote_columns` argument for unique_combination_of_columns test must be one of [True, False] Got: '\" ~ quote ~\"'.'\"\n ) }}\n{% endif %}\n\n{%- set columns_csv=column_list | join(', ') %}\n\n\nwith validation_errors as (\n\n select\n {{ columns_csv }}\n from {{ model }}\n group by {{ columns_csv }}\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.966076}, "macro.dbt_utils.test_cardinality_equality": {"unique_id": "macro.dbt_utils.test_cardinality_equality", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/cardinality_equality.sql", "original_file_path": "macros/schema_tests/cardinality_equality.sql", "name": "test_cardinality_equality", "macro_sql": "{% test cardinality_equality(model, column_name, to, field) %}\n {{ return(adapter.dispatch('test_cardinality_equality', 'dbt_utils')(model, column_name, to, field)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_cardinality_equality"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.9671721}, "macro.dbt_utils.default__test_cardinality_equality": {"unique_id": "macro.dbt_utils.default__test_cardinality_equality", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/cardinality_equality.sql", "original_file_path": "macros/schema_tests/cardinality_equality.sql", "name": "default__test_cardinality_equality", "macro_sql": "{% macro default__test_cardinality_equality(model, column_name, to, field) %}\n\n{# T-SQL does not let you use numbers as aliases for columns #}\n{# Thus, no \"GROUP BY 1\" #}\n\nwith table_a as (\nselect\n {{ column_name }},\n count(*) as num_rows\nfrom {{ model }}\ngroup by {{ column_name }}\n),\n\ntable_b as (\nselect\n {{ field }},\n count(*) as num_rows\nfrom {{ to }}\ngroup by {{ field }}\n),\n\nexcept_a as (\n select *\n from table_a\n {{ dbt_utils.except() }}\n select *\n from table_b\n),\n\nexcept_b as (\n select *\n from table_b\n {{ dbt_utils.except() }}\n select *\n from table_a\n),\n\nunioned as (\n select *\n from except_a\n union all\n select *\n from except_b\n)\n\nselect *\nfrom unioned\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.except"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.967909}, "macro.dbt_utils.test_expression_is_true": {"unique_id": "macro.dbt_utils.test_expression_is_true", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/expression_is_true.sql", "original_file_path": "macros/schema_tests/expression_is_true.sql", "name": "test_expression_is_true", "macro_sql": "{% test expression_is_true(model, expression, column_name=None, condition='1=1') %}\n{# T-SQL has no boolean data type so we use 1=1 which returns TRUE #}\n{# ref https://stackoverflow.com/a/7170753/3842610 #}\n {{ return(adapter.dispatch('test_expression_is_true', 'dbt_utils')(model, expression, column_name, condition)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.96894}, "macro.dbt_utils.default__test_expression_is_true": {"unique_id": "macro.dbt_utils.default__test_expression_is_true", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/expression_is_true.sql", "original_file_path": "macros/schema_tests/expression_is_true.sql", "name": "default__test_expression_is_true", "macro_sql": "{% macro default__test_expression_is_true(model, expression, column_name, condition) %}\n\nwith meet_condition as (\n select * from {{ model }} where {{ condition }}\n)\n\nselect\n *\nfrom meet_condition\n{% if column_name is none %}\nwhere not({{ expression }})\n{%- else %}\nwhere not({{ column_name }} {{ expression }})\n{%- endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.969579}, "macro.dbt_utils.test_not_null_proportion": {"unique_id": "macro.dbt_utils.test_not_null_proportion", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/not_null_proportion.sql", "original_file_path": "macros/schema_tests/not_null_proportion.sql", "name": "test_not_null_proportion", "macro_sql": "{% macro test_not_null_proportion(model) %}\n {{ return(adapter.dispatch('test_not_null_proportion', 'dbt_utils')(model, **kwargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_not_null_proportion"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.9704902}, "macro.dbt_utils.default__test_not_null_proportion": {"unique_id": "macro.dbt_utils.default__test_not_null_proportion", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/not_null_proportion.sql", "original_file_path": "macros/schema_tests/not_null_proportion.sql", "name": "default__test_not_null_proportion", "macro_sql": "{% macro default__test_not_null_proportion(model) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}\n{% set at_least = kwargs.get('at_least', kwargs.get('arg')) %}\n{% set at_most = kwargs.get('at_most', kwargs.get('arg', 1)) %}\n\nwith validation as (\n select\n sum(case when {{ column_name }} is null then 0 else 1 end) / cast(count(*) as numeric) as not_null_proportion\n from {{ model }}\n),\nvalidation_errors as (\n select\n not_null_proportion\n from validation\n where not_null_proportion < {{ at_least }} or not_null_proportion > {{ at_most }}\n)\nselect\n *\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.971614}, "macro.dbt_utils.test_sequential_values": {"unique_id": "macro.dbt_utils.test_sequential_values", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/sequential_values.sql", "original_file_path": "macros/schema_tests/sequential_values.sql", "name": "test_sequential_values", "macro_sql": "{% test sequential_values(model, column_name, interval=1, datepart=None) %}\n\n {{ return(adapter.dispatch('test_sequential_values', 'dbt_utils')(model, column_name, interval, datepart)) }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_sequential_values"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.972857}, "macro.dbt_utils.default__test_sequential_values": {"unique_id": "macro.dbt_utils.default__test_sequential_values", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/sequential_values.sql", "original_file_path": "macros/schema_tests/sequential_values.sql", "name": "default__test_sequential_values", "macro_sql": "{% macro default__test_sequential_values(model, column_name, interval=1, datepart=None) %}\n\nwith windowed as (\n\n select\n {{ column_name }},\n lag({{ column_name }}) over (\n order by {{ column_name }}\n ) as previous_{{ column_name }}\n from {{ model }}\n),\n\nvalidation_errors as (\n select\n *\n from windowed\n {% if datepart %}\n where not(cast({{ column_name }} as {{ dbt_utils.type_timestamp() }})= cast({{ dbt_utils.dateadd(datepart, interval, 'previous_' + column_name) }} as {{ dbt_utils.type_timestamp() }}))\n {% else %}\n where not({{ column_name }} = previous_{{ column_name }} + {{ interval }})\n {% endif %}\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.974164}, "macro.dbt_utils.test_not_null_where": {"unique_id": "macro.dbt_utils.test_not_null_where", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/test_not_null_where.sql", "original_file_path": "macros/schema_tests/test_not_null_where.sql", "name": "test_not_null_where", "macro_sql": "{% test not_null_where(model, column_name) %}\r\n {%- set deprecation_warning = '\r\n Warning: `dbt_utils.not_null_where` is no longer supported.\r\n Starting in dbt v0.20.0, the built-in `not_null` test supports a `where` config.\r\n ' -%}\r\n {%- do exceptions.warn(deprecation_warning) -%}\r\n {{ return(adapter.dispatch('test_not_null_where', 'dbt_utils')(model, column_name)) }}\r\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_not_null_where"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.97513}, "macro.dbt_utils.default__test_not_null_where": {"unique_id": "macro.dbt_utils.default__test_not_null_where", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/test_not_null_where.sql", "original_file_path": "macros/schema_tests/test_not_null_where.sql", "name": "default__test_not_null_where", "macro_sql": "{% macro default__test_not_null_where(model, column_name) %}\r\n {{ return(test_not_null(model, column_name)) }}\r\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.test_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.975497}, "macro.dbt_utils.test_equality": {"unique_id": "macro.dbt_utils.test_equality", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/equality.sql", "original_file_path": "macros/schema_tests/equality.sql", "name": "test_equality", "macro_sql": "{% test equality(model, compare_model, compare_columns=None) %}\n {{ return(adapter.dispatch('test_equality', 'dbt_utils')(model, compare_model, compare_columns)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_equality"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.9769}, "macro.dbt_utils.default__test_equality": {"unique_id": "macro.dbt_utils.default__test_equality", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/equality.sql", "original_file_path": "macros/schema_tests/equality.sql", "name": "default__test_equality", "macro_sql": "{% macro default__test_equality(model, compare_model, compare_columns=None) %}\n\n{% set set_diff %}\n count(*) + coalesce(abs(\n sum(case when which_diff = 'a_minus_b' then 1 else 0 end) -\n sum(case when which_diff = 'b_minus_a' then 1 else 0 end)\n ), 0)\n{% endset %}\n\n{#-- Needs to be set at parse time, before we return '' below --#}\n{{ config(fail_calc = set_diff) }}\n\n{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n{%- if not execute -%}\n {{ return('') }}\n{% endif %}\n\n-- setup\n{%- do dbt_utils._is_relation(model, 'test_equality') -%}\n\n{#-\nIf the compare_cols arg is provided, we can run this test without querying the\ninformation schema\u00a0\u2014 this allows the model to be an ephemeral model\n-#}\n\n{%- if not compare_columns -%}\n {%- do dbt_utils._is_ephemeral(model, 'test_equality') -%}\n {%- set compare_columns = adapter.get_columns_in_relation(model) | map(attribute='quoted') -%}\n{%- endif -%}\n\n{% set compare_cols_csv = compare_columns | join(', ') %}\n\nwith a as (\n\n select * from {{ model }}\n\n),\n\nb as (\n\n select * from {{ compare_model }}\n\n),\n\na_minus_b as (\n\n select {{compare_cols_csv}} from a\n {{ dbt_utils.except() }}\n select {{compare_cols_csv}} from b\n\n),\n\nb_minus_a as (\n\n select {{compare_cols_csv}} from b\n {{ dbt_utils.except() }}\n select {{compare_cols_csv}} from a\n\n),\n\nunioned as (\n\n select 'a_minus_b' as which_diff, a_minus_b.* from a_minus_b\n union all\n select 'b_minus_a' as which_diff, b_minus_a.* from b_minus_a\n\n)\n\nselect * from unioned\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.except"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.978962}, "macro.dbt_utils.test_mutually_exclusive_ranges": {"unique_id": "macro.dbt_utils.test_mutually_exclusive_ranges", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/mutually_exclusive_ranges.sql", "original_file_path": "macros/schema_tests/mutually_exclusive_ranges.sql", "name": "test_mutually_exclusive_ranges", "macro_sql": "{% test mutually_exclusive_ranges(model, lower_bound_column, upper_bound_column, partition_by=None, gaps='allowed', zero_length_range_allowed=False) %}\n {{ return(adapter.dispatch('test_mutually_exclusive_ranges', 'dbt_utils')(model, lower_bound_column, upper_bound_column, partition_by, gaps, zero_length_range_allowed)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_mutually_exclusive_ranges"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.9837189}, "macro.dbt_utils.default__test_mutually_exclusive_ranges": {"unique_id": "macro.dbt_utils.default__test_mutually_exclusive_ranges", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/schema_tests/mutually_exclusive_ranges.sql", "original_file_path": "macros/schema_tests/mutually_exclusive_ranges.sql", "name": "default__test_mutually_exclusive_ranges", "macro_sql": "{% macro default__test_mutually_exclusive_ranges(model, lower_bound_column, upper_bound_column, partition_by=None, gaps='allowed', zero_length_range_allowed=False) %}\n{% if gaps == 'not_allowed' %}\n {% set allow_gaps_operator='=' %}\n {% set allow_gaps_operator_in_words='equal_to' %}\n{% elif gaps == 'allowed' %}\n {% set allow_gaps_operator='<=' %}\n {% set allow_gaps_operator_in_words='less_than_or_equal_to' %}\n{% elif gaps == 'required' %}\n {% set allow_gaps_operator='<' %}\n {% set allow_gaps_operator_in_words='less_than' %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`gaps` argument for mutually_exclusive_ranges test must be one of ['not_allowed', 'allowed', 'required'] Got: '\" ~ gaps ~\"'.'\"\n ) }}\n{% endif %}\n{% if not zero_length_range_allowed %}\n {% set allow_zero_length_operator='<' %}\n {% set allow_zero_length_operator_in_words='less_than' %}\n{% elif zero_length_range_allowed %}\n {% set allow_zero_length_operator='<=' %}\n {% set allow_zero_length_operator_in_words='less_than_or_equal_to' %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`zero_length_range_allowed` argument for mutually_exclusive_ranges test must be one of [true, false] Got: '\" ~ zero_length_range_allowed ~\"'.'\"\n ) }}\n{% endif %}\n\n{% set partition_clause=\"partition by \" ~ partition_by if partition_by else '' %}\n\nwith window_functions as (\n\n select\n {% if partition_by %}\n {{ partition_by }} as partition_by_col,\n {% endif %}\n {{ lower_bound_column }} as lower_bound,\n {{ upper_bound_column }} as upper_bound,\n\n lead({{ lower_bound_column }}) over (\n {{ partition_clause }}\n order by {{ lower_bound_column }}\n ) as next_lower_bound,\n\n row_number() over (\n {{ partition_clause }}\n order by {{ lower_bound_column }} desc\n ) = 1 as is_last_record\n\n from {{ model }}\n\n),\n\ncalc as (\n -- We want to return records where one of our assumptions fails, so we'll use\n -- the `not` function with `and` statements so we can write our assumptions nore cleanly\n select\n *,\n\n -- For each record: lower_bound should be < upper_bound.\n -- Coalesce it to return an error on the null case (implicit assumption\n -- these columns are not_null)\n coalesce(\n lower_bound {{ allow_zero_length_operator }} upper_bound,\n false\n ) as lower_bound_{{ allow_zero_length_operator_in_words }}_upper_bound,\n\n -- For each record: upper_bound {{ allow_gaps_operator }} the next lower_bound.\n -- Coalesce it to handle null cases for the last record.\n coalesce(\n upper_bound {{ allow_gaps_operator }} next_lower_bound,\n is_last_record,\n false\n ) as upper_bound_{{ allow_gaps_operator_in_words }}_next_lower_bound\n\n from window_functions\n\n),\n\nvalidation_errors as (\n\n select\n *\n from calc\n\n where not(\n -- THE FOLLOWING SHOULD BE TRUE --\n lower_bound_{{ allow_zero_length_operator_in_words }}_upper_bound\n and upper_bound_{{ allow_gaps_operator_in_words }}_next_lower_bound\n )\n)\n\nselect * from validation_errors\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.986977}, "macro.dbt_utils.get_intervals_between": {"unique_id": "macro.dbt_utils.get_intervals_between", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "get_intervals_between", "macro_sql": "{% macro get_intervals_between(start_date, end_date, datepart) -%}\n {{ return(adapter.dispatch('get_intervals_between', 'dbt_utils')(start_date, end_date, datepart)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_intervals_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.98869}, "macro.dbt_utils.default__get_intervals_between": {"unique_id": "macro.dbt_utils.default__get_intervals_between", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "default__get_intervals_between", "macro_sql": "{% macro default__get_intervals_between(start_date, end_date, datepart) -%}\n {%- call statement('get_intervals_between', fetch_result=True) %}\n\n select {{dbt_utils.datediff(start_date, end_date, datepart)}}\n\n {%- endcall -%}\n\n {%- set value_list = load_result('get_intervals_between') -%}\n\n {%- if value_list and value_list['data'] -%}\n {%- set values = value_list['data'] | map(attribute=0) | list %}\n {{ return(values[0]) }}\n {%- else -%}\n {{ return(1) }}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.989983}, "macro.dbt_utils.date_spine": {"unique_id": "macro.dbt_utils.date_spine", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "date_spine", "macro_sql": "{% macro date_spine(datepart, start_date, end_date) %}\n {{ return(adapter.dispatch('date_spine', 'dbt_utils')(datepart, start_date, end_date)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__date_spine"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.9904928}, "macro.dbt_utils.default__date_spine": {"unique_id": "macro.dbt_utils.default__date_spine", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "default__date_spine", "macro_sql": "{% macro default__date_spine(datepart, start_date, end_date) %}\n\n/*\ncall as follows:\n\ndate_spine(\n \"day\",\n \"to_date('01/01/2016', 'mm/dd/yyyy')\",\n \"dateadd(week, 1, current_date)\"\n)\n\n*/\n\nwith rawdata as (\n\n {{dbt_utils.generate_series(\n dbt_utils.get_intervals_between(start_date, end_date, datepart)\n )}}\n\n),\n\nall_periods as (\n\n select (\n {{\n dbt_utils.dateadd(\n datepart,\n \"row_number() over (order by 1) - 1\",\n start_date\n )\n }}\n ) as date_{{datepart}}\n from rawdata\n\n),\n\nfiltered as (\n\n select *\n from all_periods\n where date_{{datepart}} <= {{ end_date }}\n\n)\n\nselect * from filtered\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.generate_series", "macro.dbt_utils.get_intervals_between", "macro.dbt_utils.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.991271}, "macro.dbt_utils.nullcheck_table": {"unique_id": "macro.dbt_utils.nullcheck_table", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "name": "nullcheck_table", "macro_sql": "{% macro nullcheck_table(relation) %}\n {{ return(adapter.dispatch('nullcheck_table', 'dbt_utils')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__nullcheck_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.992032}, "macro.dbt_utils.default__nullcheck_table": {"unique_id": "macro.dbt_utils.default__nullcheck_table", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "name": "default__nullcheck_table", "macro_sql": "{% macro default__nullcheck_table(relation) %}\n\n {%- do dbt_utils._is_relation(relation, 'nullcheck_table') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'nullcheck_table') -%}\n {% set cols = adapter.get_columns_in_relation(relation) %}\n\n select {{ dbt_utils.nullcheck(cols) }}\n from {{relation}}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.nullcheck"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.992791}, "macro.dbt_utils.get_relations_by_pattern": {"unique_id": "macro.dbt_utils.get_relations_by_pattern", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "name": "get_relations_by_pattern", "macro_sql": "{% macro get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_relations_by_pattern', 'dbt_utils')(schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.9941351}, "macro.dbt_utils.default__get_relations_by_pattern": {"unique_id": "macro.dbt_utils.default__get_relations_by_pattern", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "name": "default__get_relations_by_pattern", "macro_sql": "{% macro default__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n {{ dbt_utils.get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude, database) }}\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=database,\n schema=row.table_schema,\n identifier=row.table_name,\n type=row.table_type\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.9959848}, "macro.dbt_utils.get_powers_of_two": {"unique_id": "macro.dbt_utils.get_powers_of_two", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "get_powers_of_two", "macro_sql": "{% macro get_powers_of_two(upper_bound) %}\n {{ return(adapter.dispatch('get_powers_of_two', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.997452}, "macro.dbt_utils.default__get_powers_of_two": {"unique_id": "macro.dbt_utils.default__get_powers_of_two", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "default__get_powers_of_two", "macro_sql": "{% macro default__get_powers_of_two(upper_bound) %}\n\n {% if upper_bound <= 0 %}\n {{ exceptions.raise_compiler_error(\"upper bound must be positive\") }}\n {% endif %}\n\n {% for _ in range(1, 100) %}\n {% if upper_bound <= 2 ** loop.index %}{{ return(loop.index) }}{% endif %}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.998357}, "macro.dbt_utils.generate_series": {"unique_id": "macro.dbt_utils.generate_series", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "generate_series", "macro_sql": "{% macro generate_series(upper_bound) %}\n {{ return(adapter.dispatch('generate_series', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__generate_series"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.998768}, "macro.dbt_utils.default__generate_series": {"unique_id": "macro.dbt_utils.default__generate_series", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "default__generate_series", "macro_sql": "{% macro default__generate_series(upper_bound) %}\n\n {% set n = dbt_utils.get_powers_of_two(upper_bound) %}\n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n {% for i in range(n) %}\n p{{i}}.generated_number * power(2, {{i}})\n {% if not loop.last %} + {% endif %}\n {% endfor %}\n + 1\n as generated_number\n\n from\n\n {% for i in range(n) %}\n p as p{{i}}\n {% if not loop.last %} cross join {% endif %}\n {% endfor %}\n\n )\n\n select *\n from unioned\n where generated_number <= {{upper_bound}}\n order by generated_number\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494961.9999092}, "macro.dbt_utils.get_relations_by_prefix": {"unique_id": "macro.dbt_utils.get_relations_by_prefix", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "name": "get_relations_by_prefix", "macro_sql": "{% macro get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_relations_by_prefix', 'dbt_utils')(schema, prefix, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_relations_by_prefix"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.0012548}, "macro.dbt_utils.default__get_relations_by_prefix": {"unique_id": "macro.dbt_utils.default__get_relations_by_prefix", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "name": "default__get_relations_by_prefix", "macro_sql": "{% macro default__get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n {{ dbt_utils.get_tables_by_prefix_sql(schema, prefix, exclude, database) }}\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=database,\n schema=row.table_schema,\n identifier=row.table_name,\n type=row.table_type\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.get_tables_by_prefix_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.0034492}, "macro.dbt_utils.get_tables_by_prefix_sql": {"unique_id": "macro.dbt_utils.get_tables_by_prefix_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "name": "get_tables_by_prefix_sql", "macro_sql": "{% macro get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_tables_by_prefix_sql', 'dbt_utils')(schema, prefix, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_tables_by_prefix_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.0043929}, "macro.dbt_utils.default__get_tables_by_prefix_sql": {"unique_id": "macro.dbt_utils.default__get_tables_by_prefix_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "name": "default__get_tables_by_prefix_sql", "macro_sql": "{% macro default__get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n\n {{ dbt_utils.get_tables_by_pattern_sql(\n schema_pattern = schema,\n table_pattern = prefix ~ '%',\n exclude = exclude,\n database = database\n ) }}\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.005013}, "macro.dbt_utils.star": {"unique_id": "macro.dbt_utils.star", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "name": "star", "macro_sql": "{% macro star(from, relation_alias=False, except=[], prefix='', suffix='') -%}\n {{ return(adapter.dispatch('star', 'dbt_utils')(from, relation_alias, except, prefix, suffix)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__star"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.006465}, "macro.dbt_utils.default__star": {"unique_id": "macro.dbt_utils.default__star", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "name": "default__star", "macro_sql": "{% macro default__star(from, relation_alias=False, except=[], prefix='', suffix='') -%}\n {%- do dbt_utils._is_relation(from, 'star') -%}\n {%- do dbt_utils._is_ephemeral(from, 'star') -%}\n\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {{ return('') }}\n {% endif %}\n\n {%- set include_cols = [] %}\n {%- set cols = adapter.get_columns_in_relation(from) -%}\n {%- set except = except | map(\"lower\") | list %}\n {%- for col in cols -%}\n\n {%- if col.column|lower not in except -%}\n {% do include_cols.append(col.column) %}\n\n {%- endif %}\n {%- endfor %}\n\n {%- for col in include_cols %}\n\n {%- if relation_alias %}{{ relation_alias }}.{% else %}{%- endif -%}{{ adapter.quote(col)|trim }} as {{ adapter.quote(prefix ~ col ~ suffix)|trim }}\n {%- if not loop.last %},{{ '\\n ' }}{% endif %}\n\n {%- endfor -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.008851}, "macro.dbt_utils.unpivot": {"unique_id": "macro.dbt_utils.unpivot", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "name": "unpivot", "macro_sql": "{% macro unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value', table=none) -%}\n {{ return(adapter.dispatch('unpivot', 'dbt_utils')(relation, cast_to, exclude, remove, field_name, value_name, table)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__unpivot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.011826}, "macro.dbt_utils.default__unpivot": {"unique_id": "macro.dbt_utils.default__unpivot", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "name": "default__unpivot", "macro_sql": "{% macro default__unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value', table=none) -%}\n\n {% if table %}\n {%- set error_message = '\n Warning: the `unpivot` macro no longer accepts a `table` parameter. \\\n This parameter will be deprecated in a future release of dbt-utils. Use the `relation` parameter instead. \\\n The {}.{} model triggered this warning. \\\n '.format(model.package_name, model.name) -%}\n {%- do exceptions.warn(error_message) -%}\n {% endif %}\n\n {% if relation and table %}\n {{ exceptions.raise_compiler_error(\"Error: both the `relation` and `table` parameters were provided to `unpivot` macro. Choose one only (we recommend `relation`).\") }}\n {% elif not relation and table %}\n {% set relation=table %}\n {% elif not relation and not table %}\n {{ exceptions.raise_compiler_error(\"Error: argument `relation` is required for `unpivot` macro.\") }}\n {% endif %}\n\n {%- set exclude = exclude if exclude is not none else [] %}\n {%- set remove = remove if remove is not none else [] %}\n\n {%- set include_cols = [] %}\n\n {%- set table_columns = {} %}\n\n {%- do table_columns.update({relation: []}) %}\n\n {%- do dbt_utils._is_relation(relation, 'unpivot') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'unpivot') -%}\n {%- set cols = adapter.get_columns_in_relation(relation) %}\n\n {%- for col in cols -%}\n {%- if col.column.lower() not in remove|map('lower') and col.column.lower() not in exclude|map('lower') -%}\n {% do include_cols.append(col) %}\n {%- endif %}\n {%- endfor %}\n\n\n {%- for col in include_cols -%}\n select\n {%- for exclude_col in exclude %}\n {{ exclude_col }},\n {%- endfor %}\n\n cast('{{ col.column }}' as {{ dbt_utils.type_string() }}) as {{ field_name }},\n cast( {% if col.data_type == 'boolean' %}\n {{ dbt_utils.cast_bool_to_text(col.column) }}\n {% else %}\n {{ col.column }}\n {% endif %}\n as {{ cast_to }}) as {{ value_name }}\n\n from {{ relation }}\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n {%- endfor -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.type_string", "macro.dbt_utils.cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.016304}, "macro.dbt_utils.union_relations": {"unique_id": "macro.dbt_utils.union_relations", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "name": "union_relations", "macro_sql": "{%- macro union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation') -%}\n {{ return(adapter.dispatch('union_relations', 'dbt_utils')(relations, column_override, include, exclude, source_column_name)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__union_relations"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.018937}, "macro.dbt_utils.default__union_relations": {"unique_id": "macro.dbt_utils.default__union_relations", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "name": "default__union_relations", "macro_sql": "\n\n{%- macro default__union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation') -%}\n\n {%- if exclude and include -%}\n {{ exceptions.raise_compiler_error(\"Both an exclude and include list were provided to the `union` macro. Only one is allowed\") }}\n {%- endif -%}\n\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. -#}\n {%- if not execute %}\n {{ return('') }}\n {% endif -%}\n\n {%- set column_override = column_override if column_override is not none else {} -%}\n\n {%- set relation_columns = {} -%}\n {%- set column_superset = {} -%}\n\n {%- for relation in relations -%}\n\n {%- do relation_columns.update({relation: []}) -%}\n\n {%- do dbt_utils._is_relation(relation, 'union_relations') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'union_relations') -%}\n {%- set cols = adapter.get_columns_in_relation(relation) -%}\n {%- for col in cols -%}\n\n {#- If an exclude list was provided and the column is in the list, do nothing -#}\n {%- if exclude and col.column in exclude -%}\n\n {#- If an include list was provided and the column is not in the list, do nothing -#}\n {%- elif include and col.column not in include -%}\n\n {#- Otherwise add the column to the column superset -#}\n {%- else -%}\n\n {#- update the list of columns in this relation -#}\n {%- do relation_columns[relation].append(col.column) -%}\n\n {%- if col.column in column_superset -%}\n\n {%- set stored = column_superset[col.column] -%}\n {%- if col.is_string() and stored.is_string() and col.string_size() > stored.string_size() -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif %}\n\n {%- else -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif -%}\n\n {%- endif -%}\n\n {%- endfor -%}\n {%- endfor -%}\n\n {%- set ordered_column_names = column_superset.keys() -%}\n\n {%- for relation in relations %}\n\n (\n select\n\n cast({{ dbt_utils.string_literal(relation) }} as {{ dbt_utils.type_string() }}) as {{ source_column_name }},\n {% for col_name in ordered_column_names -%}\n\n {%- set col = column_superset[col_name] %}\n {%- set col_type = column_override.get(col.column, col.data_type) %}\n {%- set col_name = adapter.quote(col_name) if col_name in relation_columns[relation] else 'null' %}\n cast({{ col_name }} as {{ col_type }}) as {{ col.quoted }} {% if not loop.last %},{% endif -%}\n\n {%- endfor %}\n\n from {{ relation }}\n )\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n\n {%- endfor -%}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.string_literal", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.0240781}, "macro.dbt_utils.group_by": {"unique_id": "macro.dbt_utils.group_by", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "name": "group_by", "macro_sql": "{%- macro group_by(n) -%}\n {{ return(adapter.dispatch('group_by', 'dbt_utils')(n)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__group_by"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.0247948}, "macro.dbt_utils.default__group_by": {"unique_id": "macro.dbt_utils.default__group_by", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "name": "default__group_by", "macro_sql": "\n\n{%- macro default__group_by(n) -%}\n\n group by {% for i in range(1, n + 1) -%}\n {{ i }}{{ ',' if not loop.last }} \n {%- endfor -%}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.025343}, "macro.dbt_utils.surrogate_key": {"unique_id": "macro.dbt_utils.surrogate_key", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "name": "surrogate_key", "macro_sql": "{%- macro surrogate_key(field_list) -%}\n {# needed for safe_add to allow for non-keyword arguments see SO post #}\n {# https://stackoverflow.com/questions/13944751/args-kwargs-in-jinja2-macros #}\n {% set frustrating_jinja_feature = varargs %}\n {{ return(adapter.dispatch('surrogate_key', 'dbt_utils')(field_list, *varargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__surrogate_key"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.0265422}, "macro.dbt_utils.default__surrogate_key": {"unique_id": "macro.dbt_utils.default__surrogate_key", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "name": "default__surrogate_key", "macro_sql": "\n\n{%- macro default__surrogate_key(field_list) -%}\n\n{%- if varargs|length >= 1 or field_list is string %}\n\n{%- set error_message = '\nWarning: the `surrogate_key` macro now takes a single list argument instead of \\\nmultiple string arguments. Support for multiple string arguments will be \\\ndeprecated in a future release of dbt-utils. The {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.warn(error_message) -%}\n\n{# first argument is not included in varargs, so add first element to field_list_xf #}\n{%- set field_list_xf = [field_list] -%}\n\n{%- for field in varargs %}\n{%- set _ = field_list_xf.append(field) -%}\n{%- endfor -%}\n\n{%- else -%}\n\n{# if using list, just set field_list_xf as field_list #}\n{%- set field_list_xf = field_list -%}\n\n{%- endif -%}\n\n\n{%- set fields = [] -%}\n\n{%- for field in field_list_xf -%}\n\n {%- set _ = fields.append(\n \"coalesce(cast(\" ~ field ~ \" as \" ~ dbt_utils.type_string() ~ \"), '')\"\n ) -%}\n\n {%- if not loop.last %}\n {%- set _ = fields.append(\"'-'\") -%}\n {%- endif -%}\n\n{%- endfor -%}\n\n{{dbt_utils.hash(dbt_utils.concat(fields))}}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string", "macro.dbt_utils.hash", "macro.dbt_utils.concat"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.0285592}, "macro.dbt_utils.safe_add": {"unique_id": "macro.dbt_utils.safe_add", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "name": "safe_add", "macro_sql": "{%- macro safe_add() -%}\n {# needed for safe_add to allow for non-keyword arguments see SO post #}\n {# https://stackoverflow.com/questions/13944751/args-kwargs-in-jinja2-macros #}\n {% set frustrating_jinja_feature = varargs %}\n {{ return(adapter.dispatch('safe_add', 'dbt_utils')(*varargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__safe_add"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.029501}, "macro.dbt_utils.default__safe_add": {"unique_id": "macro.dbt_utils.default__safe_add", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "name": "default__safe_add", "macro_sql": "\n\n{%- macro default__safe_add() -%}\n\n{% set fields = [] %}\n\n{%- for field in varargs -%}\n\n {% do fields.append(\"coalesce(\" ~ field ~ \", 0)\") %}\n\n{%- endfor -%}\n\n{{ fields|join(' +\\n ') }}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.030127}, "macro.dbt_utils.nullcheck": {"unique_id": "macro.dbt_utils.nullcheck", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "name": "nullcheck", "macro_sql": "{% macro nullcheck(cols) %}\n {{ return(adapter.dispatch('nullcheck', 'dbt_utils')(cols)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__nullcheck"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.030918}, "macro.dbt_utils.default__nullcheck": {"unique_id": "macro.dbt_utils.default__nullcheck", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "name": "default__nullcheck", "macro_sql": "{% macro default__nullcheck(cols) %}\n{%- for col in cols %}\n\n {% if col.is_string() -%}\n\n nullif({{col.name}},'') as {{col.name}}\n\n {%- else -%}\n\n {{col.name}}\n\n {%- endif -%}\n\n{%- if not loop.last -%} , {%- endif -%}\n\n{%- endfor -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.03172}, "macro.dbt_utils.get_tables_by_pattern_sql": {"unique_id": "macro.dbt_utils.get_tables_by_pattern_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "get_tables_by_pattern_sql", "macro_sql": "{% macro get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_tables_by_pattern_sql', 'dbt_utils')\n (schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.034324}, "macro.dbt_utils.default__get_tables_by_pattern_sql": {"unique_id": "macro.dbt_utils.default__get_tables_by_pattern_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "default__get_tables_by_pattern_sql", "macro_sql": "{% macro default__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n select distinct\n table_schema as \"table_schema\",\n table_name as \"table_name\",\n case table_type\n when 'BASE TABLE' then 'table'\n when 'EXTERNAL TABLE' then 'external'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as \"table_type\"\n from {{ database }}.information_schema.tables\n where table_schema ilike '{{ schema_pattern }}'\n and table_name ilike '{{ table_pattern }}'\n and table_name not ilike '{{ exclude }}'\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.0348601}, "macro.dbt_utils.bigquery__get_tables_by_pattern_sql": {"unique_id": "macro.dbt_utils.bigquery__get_tables_by_pattern_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "bigquery__get_tables_by_pattern_sql", "macro_sql": "{% macro bigquery__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {% if '%' in schema_pattern %}\n {% set schemata=dbt_utils._bigquery__get_matching_schemata(schema_pattern, database) %}\n {% else %}\n {% set schemata=[schema_pattern] %}\n {% endif %}\n\n {% set sql %}\n {% for schema in schemata %}\n select distinct\n table_schema,\n table_name,\n case table_type\n when 'BASE TABLE' then 'table'\n else lower(table_type)\n end as table_type\n\n from {{ adapter.quote(database) }}.{{ schema }}.INFORMATION_SCHEMA.TABLES\n where lower(table_name) like lower ('{{ table_pattern }}')\n and lower(table_name) not like lower ('{{ exclude }}')\n\n {% if not loop.last %} union all {% endif %}\n\n {% endfor %}\n {% endset %}\n\n {{ return(sql) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._bigquery__get_matching_schemata"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.036375}, "macro.dbt_utils._bigquery__get_matching_schemata": {"unique_id": "macro.dbt_utils._bigquery__get_matching_schemata", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "_bigquery__get_matching_schemata", "macro_sql": "{% macro _bigquery__get_matching_schemata(schema_pattern, database) %}\n {% if execute %}\n\n {% set sql %}\n select schema_name from {{ adapter.quote(database) }}.INFORMATION_SCHEMA.SCHEMATA\n where lower(schema_name) like lower('{{ schema_pattern }}')\n {% endset %}\n\n {% set results=run_query(sql) %}\n\n {% set schemata=results.columns['schema_name'].values() %}\n\n {{ return(schemata) }}\n\n {% else %}\n\n {{ return([]) }}\n\n {% endif %}\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.0375}, "macro.dbt_utils.get_column_values": {"unique_id": "macro.dbt_utils.get_column_values", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "name": "get_column_values", "macro_sql": "{% macro get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none) -%}\n {{ return(adapter.dispatch('get_column_values', 'dbt_utils')(table, column, order_by, max_records, default)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_column_values"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.039326}, "macro.dbt_utils.default__get_column_values": {"unique_id": "macro.dbt_utils.default__get_column_values", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "name": "default__get_column_values", "macro_sql": "{% macro default__get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none) -%}\n{% if default is none %}\n {% set default = [] %}\n{% endif %}\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {{ return(default) }}\n {% endif %}\n\n {# Not all relations are tables. Renaming for internal clarity without breaking functionality for anyone using named arguments #}\n {# TODO: Change the method signature in a future 0.x.0 release #}\n {%- set target_relation = table -%}\n\n {# adapter.load_relation is a convenience wrapper to avoid building a Relation when we already have one #}\n {% set relation_exists = (load_relation(target_relation)) is not none %}\n\n {%- call statement('get_column_values', fetch_result=true) %}\n\n {%- if not relation_exists and default is none -%}\n\n {{ exceptions.raise_compiler_error(\"In get_column_values(): relation \" ~ target_relation ~ \" does not exist and no default value was provided.\") }}\n\n {%- elif not relation_exists and default is not none -%}\n\n {{ log(\"Relation \" ~ target_relation ~ \" does not exist. Returning the default value: \" ~ default) }}\n\n {{ return(default) }}\n\n {%- else -%}\n\n\n select\n {{ column }} as value\n\n from {{ target_relation }}\n group by {{ column }}\n order by {{ order_by }}\n\n {% if max_records is not none %}\n limit {{ max_records }}\n {% endif %}\n\n {% endif %}\n\n {%- endcall -%}\n\n {%- set value_list = load_result('get_column_values') -%}\n\n {%- if value_list and value_list['data'] -%}\n {%- set values = value_list['data'] | map(attribute=0) | list %}\n {{ return(values) }}\n {%- else -%}\n {{ return(default) }}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.load_relation", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.04244}, "macro.dbt_utils.pivot": {"unique_id": "macro.dbt_utils.pivot", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "name": "pivot", "macro_sql": "{% macro pivot(column,\n values,\n alias=True,\n agg='sum',\n cmp='=',\n prefix='',\n suffix='',\n then_value=1,\n else_value=0,\n quote_identifiers=True,\n distinct=False) %}\n {{ return(adapter.dispatch('pivot', 'dbt_utils')(column, values, alias, agg, cmp, prefix, suffix, then_value, else_value, quote_identifiers, distinct)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__pivot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.044468}, "macro.dbt_utils.default__pivot": {"unique_id": "macro.dbt_utils.default__pivot", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "name": "default__pivot", "macro_sql": "{% macro default__pivot(column,\n values,\n alias=True,\n agg='sum',\n cmp='=',\n prefix='',\n suffix='',\n then_value=1,\n else_value=0,\n quote_identifiers=True,\n distinct=False) %}\n {% for v in values %}\n {{ agg }}(\n {% if distinct %} distinct {% endif %}\n case\n when {{ column }} {{ cmp }} '{{ v }}'\n then {{ then_value }}\n else {{ else_value }}\n end\n )\n {% if alias %}\n {% if quote_identifiers %}\n as {{ adapter.quote(prefix ~ v ~ suffix) }}\n {% else %}\n as {{ dbt_utils.slugify(prefix ~ v ~ suffix) }}\n {% endif %}\n {% endif %}\n {% if not loop.last %},{% endif %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.slugify"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.046277}, "macro.dbt_utils.get_query_results_as_dict": {"unique_id": "macro.dbt_utils.get_query_results_as_dict", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "name": "get_query_results_as_dict", "macro_sql": "{% macro get_query_results_as_dict(query) %}\n {{ return(adapter.dispatch('get_query_results_as_dict', 'dbt_utils')(query)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_query_results_as_dict"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.047146}, "macro.dbt_utils.default__get_query_results_as_dict": {"unique_id": "macro.dbt_utils.default__get_query_results_as_dict", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "name": "default__get_query_results_as_dict", "macro_sql": "{% macro default__get_query_results_as_dict(query) %}\n\n{# This macro returns a dictionary of the form {column_name: (tuple_of_results)} #}\n\n {%- call statement('get_query_results', fetch_result=True,auto_begin=false) -%}\n\n {{ query }}\n\n {%- endcall -%}\n\n {% set sql_results={} %}\n\n {%- if execute -%}\n {% set sql_results_table = load_result('get_query_results').table.columns %}\n {% for column_name, column in sql_results_table.items() %}\n {% do sql_results.update({column_name: column.values()}) %}\n {% endfor %}\n {%- endif -%}\n\n {{ return(sql_results) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.048436}, "macro.dbt_utils.degrees_to_radians": {"unique_id": "macro.dbt_utils.degrees_to_radians", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "degrees_to_radians", "macro_sql": "{% macro degrees_to_radians(degrees) -%}\n acos(-1) * {{degrees}} / 180\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.050187}, "macro.dbt_utils.haversine_distance": {"unique_id": "macro.dbt_utils.haversine_distance", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "haversine_distance", "macro_sql": "{% macro haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n {{ return(adapter.dispatch('haversine_distance', 'dbt_utils')(lat1,lon1,lat2,lon2,unit)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__haversine_distance"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.050804}, "macro.dbt_utils.default__haversine_distance": {"unique_id": "macro.dbt_utils.default__haversine_distance", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "default__haversine_distance", "macro_sql": "{% macro default__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{%- if unit == 'mi' %}\n {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n {% set conversion_rate = 1.60934 %}\n{% else %}\n {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n\n 2 * 3961 * asin(sqrt(power((sin(radians(({{ lat2 }} - {{ lat1 }}) / 2))), 2) +\n cos(radians({{lat1}})) * cos(radians({{lat2}})) *\n power((sin(radians(({{ lon2 }} - {{ lon1 }}) / 2))), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.0520802}, "macro.dbt_utils.bigquery__haversine_distance": {"unique_id": "macro.dbt_utils.bigquery__haversine_distance", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "bigquery__haversine_distance", "macro_sql": "{% macro bigquery__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{% set radians_lat1 = dbt_utils.degrees_to_radians(lat1) %}\n{% set radians_lat2 = dbt_utils.degrees_to_radians(lat2) %}\n{% set radians_lon1 = dbt_utils.degrees_to_radians(lon1) %}\n{% set radians_lon2 = dbt_utils.degrees_to_radians(lon2) %}\n{%- if unit == 'mi' %}\n {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n {% set conversion_rate = 1.60934 %}\n{% else %}\n {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n 2 * 3961 * asin(sqrt(power(sin(({{ radians_lat2 }} - {{ radians_lat1 }}) / 2), 2) +\n cos({{ radians_lat1 }}) * cos({{ radians_lat2 }}) *\n power(sin(({{ radians_lon2 }} - {{ radians_lon1 }}) / 2), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.degrees_to_radians"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.053854}, "macro.spark_utils.get_tables": {"unique_id": "macro.spark_utils.get_tables", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "get_tables", "macro_sql": "{% macro get_tables(table_regex_pattern='.*') %}\n\n {% set tables = [] %}\n {% for database in spark__list_schemas('not_used') %}\n {% for table in spark__list_relations_without_caching(database[0]) %}\n {% set db_tablename = database[0] ~ \".\" ~ table[1] %}\n {% set is_match = modules.re.match(table_regex_pattern, db_tablename) %}\n {% if is_match %}\n {% call statement('table_detail', fetch_result=True) -%}\n describe extended {{ db_tablename }}\n {% endcall %}\n\n {% set table_type = load_result('table_detail').table|reverse|selectattr(0, 'in', ('type', 'TYPE', 'Type'))|first %}\n {% if table_type[1]|lower != 'view' %}\n {{ tables.append(db_tablename) }}\n {% endif %}\n {% endif %}\n {% endfor %}\n {% endfor %}\n {{ return(tables) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.062049}, "macro.spark_utils.get_delta_tables": {"unique_id": "macro.spark_utils.get_delta_tables", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "get_delta_tables", "macro_sql": "{% macro get_delta_tables(table_regex_pattern='.*') %}\n\n {% set delta_tables = [] %}\n {% for db_tablename in get_tables(table_regex_pattern) %}\n {% call statement('table_detail', fetch_result=True) -%}\n describe extended {{ db_tablename }}\n {% endcall %}\n\n {% set table_type = load_result('table_detail').table|reverse|selectattr(0, 'in', ('provider', 'PROVIDER', 'Provider'))|first %}\n {% if table_type[1]|lower == 'delta' %}\n {{ delta_tables.append(db_tablename) }}\n {% endif %}\n {% endfor %}\n {{ return(delta_tables) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_tables", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.063662}, "macro.spark_utils.get_statistic_columns": {"unique_id": "macro.spark_utils.get_statistic_columns", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "get_statistic_columns", "macro_sql": "{% macro get_statistic_columns(table) %}\n\n {% call statement('input_columns', fetch_result=True) %}\n SHOW COLUMNS IN {{ table }}\n {% endcall %}\n {% set input_columns = load_result('input_columns').table %}\n\n {% set output_columns = [] %}\n {% for column in input_columns %}\n {% call statement('column_information', fetch_result=True) %}\n DESCRIBE TABLE {{ table }} `{{ column[0] }}`\n {% endcall %}\n {% if not load_result('column_information').table[1][1].startswith('struct') and not load_result('column_information').table[1][1].startswith('array') %}\n {{ output_columns.append('`' ~ column[0] ~ '`') }}\n {% endif %}\n {% endfor %}\n {{ return(output_columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.0656629}, "macro.spark_utils.spark_optimize_delta_tables": {"unique_id": "macro.spark_utils.spark_optimize_delta_tables", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "spark_optimize_delta_tables", "macro_sql": "{% macro spark_optimize_delta_tables(table_regex_pattern='.*') %}\n\n {% for table in get_delta_tables(table_regex_pattern) %}\n {% set start=modules.datetime.datetime.now() %}\n {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n {{ dbt_utils.log_info(message_prefix ~ \" Optimizing \" ~ table) }}\n {% do run_query(\"optimize \" ~ table) %}\n {% set end=modules.datetime.datetime.now() %}\n {% set total_seconds = (end - start).total_seconds() | round(2) %}\n {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_delta_tables", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.0672581}, "macro.spark_utils.spark_vacuum_delta_tables": {"unique_id": "macro.spark_utils.spark_vacuum_delta_tables", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "spark_vacuum_delta_tables", "macro_sql": "{% macro spark_vacuum_delta_tables(table_regex_pattern='.*') %}\n\n {% for table in get_delta_tables(table_regex_pattern) %}\n {% set start=modules.datetime.datetime.now() %}\n {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n {{ dbt_utils.log_info(message_prefix ~ \" Vacuuming \" ~ table) }}\n {% do run_query(\"vacuum \" ~ table) %}\n {% set end=modules.datetime.datetime.now() %}\n {% set total_seconds = (end - start).total_seconds() | round(2) %}\n {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_delta_tables", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.068851}, "macro.spark_utils.spark_analyze_tables": {"unique_id": "macro.spark_utils.spark_analyze_tables", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "spark_analyze_tables", "macro_sql": "{% macro spark_analyze_tables(table_regex_pattern='.*') %}\n\n {% for table in get_tables(table_regex_pattern) %}\n {% set start=modules.datetime.datetime.now() %}\n {% set columns = get_statistic_columns(table) | join(',') %}\n {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n {{ dbt_utils.log_info(message_prefix ~ \" Analyzing \" ~ table) }}\n {% if columns != '' %}\n {% do run_query(\"analyze table \" ~ table ~ \" compute statistics for columns \" ~ columns) %}\n {% endif %}\n {% set end=modules.datetime.datetime.now() %}\n {% set total_seconds = (end - start).total_seconds() | round(2) %}\n {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_tables", "macro.spark_utils.get_statistic_columns", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.070894}, "macro.spark_utils.spark__concat": {"unique_id": "macro.spark_utils.spark__concat", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/concat.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/concat.sql", "name": "spark__concat", "macro_sql": "{% macro spark__concat(fields) -%}\n concat({{ fields|join(', ') }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.071439}, "macro.spark_utils.spark__type_numeric": {"unique_id": "macro.spark_utils.spark__type_numeric", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/datatypes.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/datatypes.sql", "name": "spark__type_numeric", "macro_sql": "{% macro spark__type_numeric() %}\n decimal(28, 6)\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.071806}, "macro.spark_utils.spark__dateadd": {"unique_id": "macro.spark_utils.spark__dateadd", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/dateadd.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/dateadd.sql", "name": "spark__dateadd", "macro_sql": "{% macro spark__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n {%- set clock_component -%}\n {# make sure the dates + timestamps are real, otherwise raise an error asap #}\n to_unix_timestamp({{ spark_utils.assert_not_null('to_timestamp', from_date_or_timestamp) }})\n - to_unix_timestamp({{ spark_utils.assert_not_null('date', from_date_or_timestamp) }})\n {%- endset -%}\n\n {%- if datepart in ['day', 'week'] -%}\n \n {%- set multiplier = 7 if datepart == 'week' else 1 -%}\n\n to_timestamp(\n to_unix_timestamp(\n date_add(\n {{ spark_utils.assert_not_null('date', from_date_or_timestamp) }},\n cast({{interval}} * {{multiplier}} as int)\n )\n ) + {{clock_component}}\n )\n\n {%- elif datepart in ['month', 'quarter', 'year'] -%}\n \n {%- set multiplier -%} \n {%- if datepart == 'month' -%} 1\n {%- elif datepart == 'quarter' -%} 3\n {%- elif datepart == 'year' -%} 12\n {%- endif -%}\n {%- endset -%}\n\n to_timestamp(\n to_unix_timestamp(\n add_months(\n {{ spark_utils.assert_not_null('date', from_date_or_timestamp) }},\n cast({{interval}} * {{multiplier}} as int)\n )\n ) + {{clock_component}}\n )\n\n {%- elif datepart in ('hour', 'minute', 'second', 'millisecond', 'microsecond') -%}\n \n {%- set multiplier -%} \n {%- if datepart == 'hour' -%} 3600\n {%- elif datepart == 'minute' -%} 60\n {%- elif datepart == 'second' -%} 1\n {%- elif datepart == 'millisecond' -%} (1/1000000)\n {%- elif datepart == 'microsecond' -%} (1/1000000)\n {%- endif -%}\n {%- endset -%}\n\n to_timestamp(\n {{ spark_utils.assert_not_null('to_unix_timestamp', from_date_or_timestamp) }}\n + cast({{interval}} * {{multiplier}} as int)\n )\n\n {%- else -%}\n\n {{ exceptions.raise_compiler_error(\"macro dateadd not implemented for datepart ~ '\" ~ datepart ~ \"' ~ on Spark\") }}\n\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.07711}, "macro.spark_utils.spark__datediff": {"unique_id": "macro.spark_utils.spark__datediff", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/datediff.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/datediff.sql", "name": "spark__datediff", "macro_sql": "{% macro spark__datediff(first_date, second_date, datepart) %}\n\n {%- if datepart in ['day', 'week', 'month', 'quarter', 'year'] -%}\n \n {# make sure the dates are real, otherwise raise an error asap #}\n {% set first_date = spark_utils.assert_not_null('date', first_date) %}\n {% set second_date = spark_utils.assert_not_null('date', second_date) %}\n \n {%- endif -%}\n \n {%- if datepart == 'day' -%}\n \n datediff({{second_date}}, {{first_date}})\n \n {%- elif datepart == 'week' -%}\n \n case when {{first_date}} < {{second_date}}\n then floor(datediff({{second_date}}, {{first_date}})/7)\n else ceil(datediff({{second_date}}, {{first_date}})/7)\n end\n \n -- did we cross a week boundary (Sunday)?\n + case\n when {{first_date}} < {{second_date}} and dayofweek({{second_date}}) < dayofweek({{first_date}}) then 1\n when {{first_date}} > {{second_date}} and dayofweek({{second_date}}) > dayofweek({{first_date}}) then -1\n else 0 end\n\n {%- elif datepart == 'month' -%}\n\n case when {{first_date}} < {{second_date}}\n then floor(months_between(date({{second_date}}), date({{first_date}})))\n else ceil(months_between(date({{second_date}}), date({{first_date}})))\n end\n \n -- did we cross a month boundary?\n + case\n when {{first_date}} < {{second_date}} and dayofmonth({{second_date}}) < dayofmonth({{first_date}}) then 1\n when {{first_date}} > {{second_date}} and dayofmonth({{second_date}}) > dayofmonth({{first_date}}) then -1\n else 0 end\n \n {%- elif datepart == 'quarter' -%}\n \n case when {{first_date}} < {{second_date}}\n then floor(months_between(date({{second_date}}), date({{first_date}}))/3)\n else ceil(months_between(date({{second_date}}), date({{first_date}}))/3)\n end\n \n -- did we cross a quarter boundary?\n + case\n when {{first_date}} < {{second_date}} and (\n (dayofyear({{second_date}}) - (quarter({{second_date}}) * 365/4))\n < (dayofyear({{first_date}}) - (quarter({{first_date}}) * 365/4))\n ) then 1\n when {{first_date}} > {{second_date}} and (\n (dayofyear({{second_date}}) - (quarter({{second_date}}) * 365/4))\n > (dayofyear({{first_date}}) - (quarter({{first_date}}) * 365/4))\n ) then -1\n else 0 end\n\n {%- elif datepart == 'year' -%}\n \n year({{second_date}}) - year({{first_date}})\n\n {%- elif datepart in ('hour', 'minute', 'second', 'millisecond', 'microsecond') -%}\n \n {%- set divisor -%} \n {%- if datepart == 'hour' -%} 3600\n {%- elif datepart == 'minute' -%} 60\n {%- elif datepart == 'second' -%} 1\n {%- elif datepart == 'millisecond' -%} (1/1000)\n {%- elif datepart == 'microsecond' -%} (1/1000000)\n {%- endif -%}\n {%- endset -%}\n\n case when {{first_date}} < {{second_date}}\n then ceil((\n {# make sure the timestamps are real, otherwise raise an error asap #}\n {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', second_date)) }}\n - {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', first_date)) }}\n ) / {{divisor}})\n else floor((\n {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', second_date)) }}\n - {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', first_date)) }}\n ) / {{divisor}})\n end\n \n {% if datepart == 'millisecond' %}\n + cast(date_format({{second_date}}, 'SSS') as int)\n - cast(date_format({{first_date}}, 'SSS') as int)\n {% endif %}\n \n {% if datepart == 'microsecond' %} \n {% set capture_str = '[0-9]{4}-[0-9]{2}-[0-9]{2}.[0-9]{2}:[0-9]{2}:[0-9]{2}.([0-9]{6})' %}\n -- Spark doesn't really support microseconds, so this is a massive hack!\n -- It will only work if the timestamp-string is of the format\n -- 'yyyy-MM-dd-HH mm.ss.SSSSSS'\n + cast(regexp_extract({{second_date}}, '{{capture_str}}', 1) as int)\n - cast(regexp_extract({{first_date}}, '{{capture_str}}', 1) as int) \n {% endif %}\n\n {%- else -%}\n\n {{ exceptions.raise_compiler_error(\"macro datediff not implemented for datepart ~ '\" ~ datepart ~ \"' ~ on Spark\") }}\n\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.089886}, "macro.spark_utils.spark__current_timestamp": {"unique_id": "macro.spark_utils.spark__current_timestamp", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "name": "spark__current_timestamp", "macro_sql": "{% macro spark__current_timestamp() %}\n current_timestamp()\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.0902882}, "macro.spark_utils.spark__current_timestamp_in_utc": {"unique_id": "macro.spark_utils.spark__current_timestamp_in_utc", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "name": "spark__current_timestamp_in_utc", "macro_sql": "{% macro spark__current_timestamp_in_utc() %}\n unix_timestamp()\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.090455}, "macro.spark_utils.spark__split_part": {"unique_id": "macro.spark_utils.spark__split_part", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/split_part.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/split_part.sql", "name": "spark__split_part", "macro_sql": "{% macro spark__split_part(string_text, delimiter_text, part_number) %}\n\n {% set delimiter_expr %}\n \n -- escape if starts with a special character\n case when regexp_extract({{ delimiter_text }}, '([^A-Za-z0-9])(.*)', 1) != '_'\n then concat('\\\\', {{ delimiter_text }})\n else {{ delimiter_text }} end\n \n {% endset %}\n\n {% set split_part_expr %}\n \n split(\n {{ string_text }},\n {{ delimiter_expr }}\n )[({{ part_number - 1 }})]\n \n {% endset %}\n \n {{ return(split_part_expr) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.091727}, "macro.spark_utils.spark__get_relations_by_pattern": {"unique_id": "macro.spark_utils.spark__get_relations_by_pattern", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_relations_by_pattern", "macro_sql": "{% macro spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n show table extended in {{ schema_pattern }} like '{{ table_pattern }}'\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=None,\n schema=row[0],\n identifier=row[1],\n type=('view' if 'Type: VIEW' in row[3] else 'table')\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.0949252}, "macro.spark_utils.spark__get_relations_by_prefix": {"unique_id": "macro.spark_utils.spark__get_relations_by_prefix", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_relations_by_prefix", "macro_sql": "{% macro spark__get_relations_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {% set table_pattern = table_pattern ~ '*' %}\n {{ return(spark_utils.spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.095652}, "macro.spark_utils.spark__get_tables_by_pattern": {"unique_id": "macro.spark_utils.spark__get_tables_by_pattern", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_tables_by_pattern", "macro_sql": "{% macro spark__get_tables_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(spark_utils.spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.09625}, "macro.spark_utils.spark__get_tables_by_prefix": {"unique_id": "macro.spark_utils.spark__get_tables_by_prefix", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_tables_by_prefix", "macro_sql": "{% macro spark__get_tables_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(spark_utils.spark__get_relations_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_prefix"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.096915}, "macro.spark_utils.assert_not_null": {"unique_id": "macro.spark_utils.assert_not_null", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/etc/assert_not_null.sql", "original_file_path": "macros/etc/assert_not_null.sql", "name": "assert_not_null", "macro_sql": "{% macro assert_not_null(function, arg) -%}\n {{ return(adapter.dispatch('assert_not_null', 'spark_utils')(function, arg)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.default__assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.097687}, "macro.spark_utils.default__assert_not_null": {"unique_id": "macro.spark_utils.default__assert_not_null", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/etc/assert_not_null.sql", "original_file_path": "macros/etc/assert_not_null.sql", "name": "default__assert_not_null", "macro_sql": "{% macro default__assert_not_null(function, arg) %}\n\n coalesce({{function}}({{arg}}), nvl2({{function}}({{arg}}), assert_true({{function}}({{arg}}) is not null), null))\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.098146}, "macro.spark_utils.spark__convert_timezone": {"unique_id": "macro.spark_utils.spark__convert_timezone", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/snowplow/convert_timezone.sql", "original_file_path": "macros/snowplow/convert_timezone.sql", "name": "spark__convert_timezone", "macro_sql": "{% macro spark__convert_timezone(in_tz, out_tz, in_timestamp) %}\n from_utc_timestamp(to_utc_timestamp({{in_timestamp}}, {{in_tz}}), {{out_tz}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.098718}, "macro.fivetran_utils.enabled_vars": {"unique_id": "macro.fivetran_utils.enabled_vars", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/enabled_vars.sql", "original_file_path": "macros/enabled_vars.sql", "name": "enabled_vars", "macro_sql": "{% macro enabled_vars(vars) %}\n\n{% for v in vars %}\n \n {% if var(v, True) == False %}\n {{ return(False) }}\n {% endif %}\n\n{% endfor %}\n\n{{ return(True) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.099686}, "macro.fivetran_utils.percentile": {"unique_id": "macro.fivetran_utils.percentile", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "percentile", "macro_sql": "{% macro percentile(percentile_field, partition_field, percent) -%}\n\n{{ adapter.dispatch('percentile', 'fivetran_utils') (percentile_field, partition_field, percent) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__percentile"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.1012638}, "macro.fivetran_utils.default__percentile": {"unique_id": "macro.fivetran_utils.default__percentile", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "default__percentile", "macro_sql": "{% macro default__percentile(percentile_field, partition_field, percent) %}\n\n percentile_cont( \n {{ percent }} )\n within group ( order by {{ percentile_field }} )\n over ( partition by {{ partition_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.101642}, "macro.fivetran_utils.redshift__percentile": {"unique_id": "macro.fivetran_utils.redshift__percentile", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "redshift__percentile", "macro_sql": "{% macro redshift__percentile(percentile_field, partition_field, percent) %}\n\n percentile_cont( \n {{ percent }} )\n within group ( order by {{ percentile_field }} )\n over ( partition by {{ partition_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.102009}, "macro.fivetran_utils.bigquery__percentile": {"unique_id": "macro.fivetran_utils.bigquery__percentile", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "bigquery__percentile", "macro_sql": "{% macro bigquery__percentile(percentile_field, partition_field, percent) %}\n\n percentile_cont( \n {{ percentile_field }}, \n {{ percent }}) \n over (partition by {{ partition_field }} \n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.102378}, "macro.fivetran_utils.postgres__percentile": {"unique_id": "macro.fivetran_utils.postgres__percentile", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "postgres__percentile", "macro_sql": "{% macro postgres__percentile(percentile_field, partition_field, percent) %}\n\n percentile_cont( \n {{ percent }} )\n within group ( order by {{ percentile_field }} )\n /* have to group by partition field */\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.102706}, "macro.fivetran_utils.spark__percentile": {"unique_id": "macro.fivetran_utils.spark__percentile", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "spark__percentile", "macro_sql": "{% macro spark__percentile(percentile_field, partition_field, percent) %}\n\n percentile( \n {{ percentile_field }}, \n {{ percent }}) \n over (partition by {{ partition_field }} \n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.103083}, "macro.fivetran_utils.pivot_json_extract": {"unique_id": "macro.fivetran_utils.pivot_json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/pivot_json_extract.sql", "original_file_path": "macros/pivot_json_extract.sql", "name": "pivot_json_extract", "macro_sql": "{% macro pivot_json_extract(string, list_of_properties) %}\n\n{%- for property in list_of_properties -%}\n\nreplace( {{ fivetran_utils.json_extract(string, property) }}, '\"', '') as {{ property | replace(' ', '_') | lower }}\n\n{%- if not loop.last -%},{%- endif %}\n{% endfor -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.json_extract"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.104098}, "macro.fivetran_utils.persist_pass_through_columns": {"unique_id": "macro.fivetran_utils.persist_pass_through_columns", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/persist_pass_through_columns.sql", "original_file_path": "macros/persist_pass_through_columns.sql", "name": "persist_pass_through_columns", "macro_sql": "{% macro persist_pass_through_columns(pass_through_variable) %}\n\n{% if var(pass_through_variable, none) %}\n {% for field in var(pass_through_variable) %}\n , {{ field.alias if field.alias else field.name }}\n {% endfor %}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.105058}, "macro.fivetran_utils.json_parse": {"unique_id": "macro.fivetran_utils.json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "json_parse", "macro_sql": "{% macro json_parse(string, string_path) -%}\n\n{{ adapter.dispatch('json_parse', 'fivetran_utils') (string, string_path) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.snowflake__json_parse"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.106946}, "macro.fivetran_utils.default__json_parse": {"unique_id": "macro.fivetran_utils.default__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "default__json_parse", "macro_sql": "{% macro default__json_parse(string, string_path) %}\n\n json_extract_path_text({{string}}, {%- for s in string_path -%}'{{ s }}'{%- if not loop.last -%},{%- endif -%}{%- endfor -%} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.1076171}, "macro.fivetran_utils.redshift__json_parse": {"unique_id": "macro.fivetran_utils.redshift__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "redshift__json_parse", "macro_sql": "{% macro redshift__json_parse(string, string_path) %}\n\n json_extract_path_text({{string}}, {%- for s in string_path -%}'{{ s }}'{%- if not loop.last -%},{%- endif -%}{%- endfor -%} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.10817}, "macro.fivetran_utils.bigquery__json_parse": {"unique_id": "macro.fivetran_utils.bigquery__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "bigquery__json_parse", "macro_sql": "{% macro bigquery__json_parse(string, string_path) %}\n\n \n json_extract_scalar({{string}}, '$.{%- for s in string_path -%}{{ s }}{%- if not loop.last -%}.{%- endif -%}{%- endfor -%} ')\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.108704}, "macro.fivetran_utils.postgres__json_parse": {"unique_id": "macro.fivetran_utils.postgres__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "postgres__json_parse", "macro_sql": "{% macro postgres__json_parse(string, string_path) %}\n\n {{string}}::json #>> '{ {%- for s in string_path -%}{{ s }}{%- if not loop.last -%},{%- endif -%}{%- endfor -%} }'\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.109238}, "macro.fivetran_utils.snowflake__json_parse": {"unique_id": "macro.fivetran_utils.snowflake__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "snowflake__json_parse", "macro_sql": "{% macro snowflake__json_parse(string, string_path) %}\n\n parse_json( {{string}} ) {%- for s in string_path -%}{% if s is number %}[{{ s }}]{% else %}['{{ s }}']{% endif %}{%- endfor -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.10983}, "macro.fivetran_utils.spark__json_parse": {"unique_id": "macro.fivetran_utils.spark__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "spark__json_parse", "macro_sql": "{% macro spark__json_parse(string, string_path) %}\n\n {{string}} : {%- for s in string_path -%}{% if s is number %}[{{ s }}]{% else %}['{{ s }}']{% endif %}{%- endfor -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.110424}, "macro.fivetran_utils.max_bool": {"unique_id": "macro.fivetran_utils.max_bool", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "name": "max_bool", "macro_sql": "{% macro max_bool(boolean_field) -%}\n\n{{ adapter.dispatch('max_bool', 'fivetran_utils') (boolean_field) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.snowflake__max_bool"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.111166}, "macro.fivetran_utils.default__max_bool": {"unique_id": "macro.fivetran_utils.default__max_bool", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "name": "default__max_bool", "macro_sql": "{% macro default__max_bool(boolean_field) %}\n\n bool_or( {{ boolean_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.111399}, "macro.fivetran_utils.snowflake__max_bool": {"unique_id": "macro.fivetran_utils.snowflake__max_bool", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "name": "snowflake__max_bool", "macro_sql": "{% macro snowflake__max_bool(boolean_field) %}\n\n max( {{ boolean_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.11164}, "macro.fivetran_utils.bigquery__max_bool": {"unique_id": "macro.fivetran_utils.bigquery__max_bool", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "name": "bigquery__max_bool", "macro_sql": "{% macro bigquery__max_bool(boolean_field) %}\n\n max( {{ boolean_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.111871}, "macro.fivetran_utils.calculated_fields": {"unique_id": "macro.fivetran_utils.calculated_fields", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/calculated_fields.sql", "original_file_path": "macros/calculated_fields.sql", "name": "calculated_fields", "macro_sql": "{% macro calculated_fields(variable) -%}\n\n{% if var(variable, none) %}\n {% for field in var(variable) %}\n , {{ field.transform_sql }} as {{ field.name }} \n {% endfor %}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.112782}, "macro.fivetran_utils.seed_data_helper": {"unique_id": "macro.fivetran_utils.seed_data_helper", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/seed_data_helper.sql", "original_file_path": "macros/seed_data_helper.sql", "name": "seed_data_helper", "macro_sql": "{% macro seed_data_helper(seed_name, warehouses) %}\n\n{% if target.type in warehouses %}\n {% for w in warehouses %}\n {% if target.type == w %}\n {{ return(ref(seed_name ~ \"_\" ~ w ~ \"\")) }}\n {% endif %}\n {% endfor %}\n{% else %}\n{{ return(ref(seed_name)) }}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.114114}, "macro.fivetran_utils.fill_pass_through_columns": {"unique_id": "macro.fivetran_utils.fill_pass_through_columns", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/fill_pass_through_columns.sql", "original_file_path": "macros/fill_pass_through_columns.sql", "name": "fill_pass_through_columns", "macro_sql": "{% macro fill_pass_through_columns(pass_through_variable) %}\n\n{% if var(pass_through_variable) %}\n {% for field in var(pass_through_variable) %}\n {% if field.transform_sql %}\n , {{ field.transform_sql }} as {{ field.alias if field.alias else field.name }}\n {% else %}\n , {{ field.alias if field.alias else field.name }}\n {% endif %}\n {% endfor %}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.11556}, "macro.fivetran_utils.string_agg": {"unique_id": "macro.fivetran_utils.string_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "string_agg", "macro_sql": "{% macro string_agg(field_to_agg, delimiter) -%}\n\n{{ adapter.dispatch('string_agg', 'fivetran_utils') (field_to_agg, delimiter) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.snowflake__string_agg"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.116527}, "macro.fivetran_utils.default__string_agg": {"unique_id": "macro.fivetran_utils.default__string_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "default__string_agg", "macro_sql": "{% macro default__string_agg(field_to_agg, delimiter) %}\n string_agg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.116826}, "macro.fivetran_utils.snowflake__string_agg": {"unique_id": "macro.fivetran_utils.snowflake__string_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "snowflake__string_agg", "macro_sql": "{% macro snowflake__string_agg(field_to_agg, delimiter) %}\n listagg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.117122}, "macro.fivetran_utils.redshift__string_agg": {"unique_id": "macro.fivetran_utils.redshift__string_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "redshift__string_agg", "macro_sql": "{% macro redshift__string_agg(field_to_agg, delimiter) %}\n listagg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.117414}, "macro.fivetran_utils.spark__string_agg": {"unique_id": "macro.fivetran_utils.spark__string_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "spark__string_agg", "macro_sql": "{% macro spark__string_agg(field_to_agg, delimiter) %}\n -- collect set will remove duplicates\n replace(replace(replace(cast( collect_set({{ field_to_agg }}) as string), '[', ''), ']', ''), ', ', {{ delimiter }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.117711}, "macro.fivetran_utils.timestamp_diff": {"unique_id": "macro.fivetran_utils.timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "timestamp_diff", "macro_sql": "{% macro timestamp_diff(first_date, second_date, datepart) %}\n {{ adapter.dispatch('timestamp_diff', 'fivetran_utils')(first_date, second_date, datepart) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__timestamp_diff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.1221561}, "macro.fivetran_utils.default__timestamp_diff": {"unique_id": "macro.fivetran_utils.default__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "default__timestamp_diff", "macro_sql": "{% macro default__timestamp_diff(first_date, second_date, datepart) %}\n\n datediff(\n {{ datepart }},\n {{ first_date }},\n {{ second_date }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.122527}, "macro.fivetran_utils.redshift__timestamp_diff": {"unique_id": "macro.fivetran_utils.redshift__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "redshift__timestamp_diff", "macro_sql": "{% macro redshift__timestamp_diff(first_date, second_date, datepart) %}\n\n datediff(\n {{ datepart }},\n {{ first_date }},\n {{ second_date }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.12289}, "macro.fivetran_utils.bigquery__timestamp_diff": {"unique_id": "macro.fivetran_utils.bigquery__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "bigquery__timestamp_diff", "macro_sql": "{% macro bigquery__timestamp_diff(first_date, second_date, datepart) %}\n\n timestamp_diff(\n {{second_date}},\n {{first_date}},\n {{datepart}}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.123245}, "macro.fivetran_utils.postgres__timestamp_diff": {"unique_id": "macro.fivetran_utils.postgres__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "postgres__timestamp_diff", "macro_sql": "{% macro postgres__timestamp_diff(first_date, second_date, datepart) %}\n\n {% if datepart == 'year' %}\n (date_part('year', ({{second_date}})::date) - date_part('year', ({{first_date}})::date))\n {% elif datepart == 'quarter' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 4 + date_part('quarter', ({{second_date}})::date) - date_part('quarter', ({{first_date}})::date))\n {% elif datepart == 'month' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 12 + date_part('month', ({{second_date}})::date) - date_part('month', ({{first_date}})::date))\n {% elif datepart == 'day' %}\n (({{second_date}})::date - ({{first_date}})::date)\n {% elif datepart == 'week' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} / 7 + case\n when date_part('dow', ({{first_date}})::timestamp) <= date_part('dow', ({{second_date}})::timestamp) then\n case when {{first_date}} <= {{second_date}} then 0 else -1 end\n else\n case when {{first_date}} <= {{second_date}} then 1 else 0 end\n end)\n {% elif datepart == 'hour' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} * 24 + date_part('hour', ({{second_date}})::timestamp) - date_part('hour', ({{first_date}})::timestamp))\n {% elif datepart == 'minute' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'hour') }} * 60 + date_part('minute', ({{second_date}})::timestamp) - date_part('minute', ({{first_date}})::timestamp))\n {% elif datepart == 'second' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60 + floor(date_part('second', ({{second_date}})::timestamp)) - floor(date_part('second', ({{first_date}})::timestamp)))\n {% elif datepart == 'millisecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000 + floor(date_part('millisecond', ({{second_date}})::timestamp)) - floor(date_part('millisecond', ({{first_date}})::timestamp)))\n {% elif datepart == 'microsecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000000 + floor(date_part('microsecond', ({{second_date}})::timestamp)) - floor(date_part('microsecond', ({{first_date}})::timestamp)))\n {% else %}\n {{ exceptions.raise_compiler_error(\"Unsupported datepart for macro datediff in postgres: {!r}\".format(datepart)) }}\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.1271281}, "macro.fivetran_utils.generate_columns_macro": {"unique_id": "macro.fivetran_utils.generate_columns_macro", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/generate_columns_macro.sql", "original_file_path": "macros/generate_columns_macro.sql", "name": "generate_columns_macro", "macro_sql": "{% macro generate_columns_macro(table_name, schema_name, database_name=target.database) %}\n\n{% set columns = get_columns_for_macro(table_name, schema_name, database_name) %}\n\n{% set jinja_macro=[] %}\n\n{% do jinja_macro.append('{% macro get_' ~ table_name ~ '_columns() %}') %}\n{% do jinja_macro.append('') %}\n{% do jinja_macro.append('{% set columns = [') %}\n\n{% for col in columns %}\n{% do jinja_macro.append(' ' ~ col ~ (',' if not loop.last)) %}\n{% endfor %}\n\n{% do jinja_macro.append('] %}') %}\n{% do jinja_macro.append('') %}\n{% do jinja_macro.append('{{ return(columns) }}') %}\n{% do jinja_macro.append('') %}\n{% do jinja_macro.append('{% endmacro %}') %}\n\n{% if execute %}\n\n {% set joined = jinja_macro | join ('\\n') %}\n {{ log(joined, info=True) }}\n {% do return(joined) %}\n\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.get_columns_for_macro"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.1301708}, "macro.fivetran_utils.source_relation": {"unique_id": "macro.fivetran_utils.source_relation", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/source_relation.sql", "original_file_path": "macros/source_relation.sql", "name": "source_relation", "macro_sql": "{% macro source_relation(union_schema_variable='union_schemas', union_database_variable='union_databases') -%}\n\n{{ adapter.dispatch('source_relation', 'fivetran_utils') (union_schema_variable, union_database_variable) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__source_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.131196}, "macro.fivetran_utils.default__source_relation": {"unique_id": "macro.fivetran_utils.default__source_relation", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/source_relation.sql", "original_file_path": "macros/source_relation.sql", "name": "default__source_relation", "macro_sql": "{% macro default__source_relation(union_schema_variable, union_database_variable) %}\n\n{% if var(union_schema_variable, none) %}\n, case\n {% for schema in var(union_schema_variable) %}\n when lower(replace(replace(_dbt_source_relation,'\"',''),'`','')) like '%.{{ schema|lower }}.%' then '{{ schema|lower }}'\n {% endfor %}\n end as source_relation\n{% elif var(union_database_variable, none) %}\n, case\n {% for database in var(union_database_variable) %}\n when lower(replace(replace(_dbt_source_relation,'\"',''),'`','')) like '%{{ database|lower }}.%' then '{{ database|lower }}'\n {% endfor %}\n end as source_relation\n{% else %}\n, cast('' as {{ dbt_utils.type_string() }}) as source_relation\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.13253}, "macro.fivetran_utils.first_value": {"unique_id": "macro.fivetran_utils.first_value", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "name": "first_value", "macro_sql": "{% macro first_value(first_value_field, partition_field, order_by_field, order=\"asc\") -%}\n\n{{ adapter.dispatch('first_value', 'fivetran_utils') (first_value_field, partition_field, order_by_field, order) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__first_value"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.1335738}, "macro.fivetran_utils.default__first_value": {"unique_id": "macro.fivetran_utils.default__first_value", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "name": "default__first_value", "macro_sql": "{% macro default__first_value(first_value_field, partition_field, order_by_field, order=\"asc\") %}\n\n first_value( {{ first_value_field }} ignore nulls ) over (partition by {{ partition_field }} order by {{ order_by_field }} {{ order }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.1340318}, "macro.fivetran_utils.redshift__first_value": {"unique_id": "macro.fivetran_utils.redshift__first_value", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "name": "redshift__first_value", "macro_sql": "{% macro redshift__first_value(first_value_field, partition_field, order_by_field, order=\"asc\") %}\n\n first_value( {{ first_value_field }} ignore nulls ) over (partition by {{ partition_field }} order by {{ order_by_field }} {{ order }} , {{ partition_field }} rows unbounded preceding )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.134531}, "macro.fivetran_utils.add_dbt_source_relation": {"unique_id": "macro.fivetran_utils.add_dbt_source_relation", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/add_dbt_source_relation.sql", "original_file_path": "macros/add_dbt_source_relation.sql", "name": "add_dbt_source_relation", "macro_sql": "{% macro add_dbt_source_relation() %}\n\n{% if var('union_schemas', none) or var('union_databases', none) %}\n, _dbt_source_relation\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.135206}, "macro.fivetran_utils.add_pass_through_columns": {"unique_id": "macro.fivetran_utils.add_pass_through_columns", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/add_pass_through_columns.sql", "original_file_path": "macros/add_pass_through_columns.sql", "name": "add_pass_through_columns", "macro_sql": "{% macro add_pass_through_columns(base_columns, pass_through_var) %}\n\n {% if pass_through_var %}\n\n {% for column in pass_through_var %}\n\n {% if column.alias %}\n\n {% do base_columns.append({ \"name\": column.name, \"alias\": column.alias, \"datatype\": column.datatype if column.datatype else dbt_utils.type_string()}) %}\n\n {% else %}\n\n {% do base_columns.append({ \"name\": column.name, \"datatype\": column.datatype if column.datatype else dbt_utils.type_string()}) %}\n \n {% endif %}\n\n {% endfor %}\n\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.137032}, "macro.fivetran_utils.staging_models_automation": {"unique_id": "macro.fivetran_utils.staging_models_automation", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/staging_models_automation.sql", "original_file_path": "macros/staging_models_automation.sql", "name": "staging_models_automation", "macro_sql": "{% macro staging_models_automation(package, source_schema, source_database, tables) %}\n\n{% set package = \"\"~ package ~\"\" %}\n{% set source_schema = \"\"~ source_schema ~\"\" %}\n{% set source_database = \"\"~ source_database ~\"\" %}\n\n{% set zsh_command = \"source dbt_modules/fivetran_utils/columns_setup.sh '../dbt_\"\"\"~ package ~\"\"\"_source' stg_\"\"\"~ package ~\"\"\" \"\"\"~ source_database ~\"\"\" \"\"\"~ source_schema ~\"\"\" \" %}\n\n{% for t in tables %}\n {% if t != tables[-1] %}\n {% set help_command = zsh_command + t + \" && \\n\" %}\n\n {% else %}\n {% set help_command = zsh_command + t %}\n\n {% endif %}\n {{ log(help_command, info=True) }}\n\n{% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.139221}, "macro.fivetran_utils.union_relations": {"unique_id": "macro.fivetran_utils.union_relations", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/union_relations.sql", "original_file_path": "macros/union_relations.sql", "name": "union_relations", "macro_sql": "{%- macro union_relations(relations, aliases=none, column_override=none, include=[], exclude=[], source_column_name=none) -%}\n\n {%- if exclude and include -%}\n {{ exceptions.raise_compiler_error(\"Both an exclude and include list were provided to the `union` macro. Only one is allowed\") }}\n {%- endif -%}\n\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. -#}\n {%- if not execute %}\n {{ return('') }}\n {% endif -%}\n\n {%- set column_override = column_override if column_override is not none else {} -%}\n {%- set source_column_name = source_column_name if source_column_name is not none else '_dbt_source_relation' -%}\n\n {%- set relation_columns = {} -%}\n {%- set column_superset = {} -%}\n\n {%- for relation in relations -%}\n\n {%- do relation_columns.update({relation: []}) -%}\n\n {%- do dbt_utils._is_relation(relation, 'union_relations') -%}\n {%- set cols = adapter.get_columns_in_relation(relation) -%}\n {%- for col in cols -%}\n\n {#- If an exclude list was provided and the column is in the list, do nothing -#}\n {%- if exclude and col.column in exclude -%}\n\n {#- If an include list was provided and the column is not in the list, do nothing -#}\n {%- elif include and col.column not in include -%}\n\n {#- Otherwise add the column to the column superset -#}\n {%- else -%}\n\n {#- update the list of columns in this relation -#}\n {%- do relation_columns[relation].append(col.column) -%}\n\n {%- if col.column in column_superset -%}\n\n {%- set stored = column_superset[col.column] -%}\n {%- if col.is_string() and stored.is_string() and col.string_size() > stored.string_size() -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif %}\n\n {%- else -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif -%}\n\n {%- endif -%}\n\n {%- endfor -%}\n {%- endfor -%}\n\n {%- set ordered_column_names = column_superset.keys() -%}\n\n {%- for relation in relations %}\n\n (\n select\n\n cast({{ dbt_utils.string_literal(relation) }} as {{ dbt_utils.type_string() }}) as {{ source_column_name }},\n {% for col_name in ordered_column_names -%}\n\n {%- set col = column_superset[col_name] %}\n {%- set col_type = column_override.get(col.column, col.data_type) %}\n {%- set col_name = adapter.quote(col_name) if col_name in relation_columns[relation] else 'null' %}\n cast({{ col_name }} as {{ col_type }}) as {{ col.quoted }} {% if not loop.last %},{% endif -%}\n\n {%- endfor %}\n\n from {{ aliases[loop.index0] if aliases else relation }}\n )\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n\n {%- endfor -%}\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils.string_literal", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.1468291}, "macro.fivetran_utils.union_tables": {"unique_id": "macro.fivetran_utils.union_tables", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/union_relations.sql", "original_file_path": "macros/union_relations.sql", "name": "union_tables", "macro_sql": "{%- macro union_tables(tables, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_table') -%}\n\n {%- do exceptions.warn(\"Warning: the `union_tables` macro is no longer supported and will be deprecated in a future release of dbt-utils. Use the `union_relations` macro instead\") -%}\n\n {{ return(dbt_utils.union_relations(tables, column_override, include, exclude, source_column_name)) }}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.union_relations"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.14763}, "macro.fivetran_utils.snowflake_seed_data": {"unique_id": "macro.fivetran_utils.snowflake_seed_data", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/snowflake_seed_data.sql", "original_file_path": "macros/snowflake_seed_data.sql", "name": "snowflake_seed_data", "macro_sql": "{% macro snowflake_seed_data(seed_name) %}\n\n{% if target.type == 'snowflake' %}\n{{ return(ref(seed_name ~ '_snowflake')) }}\n{% else %}\n{{ return(ref(seed_name)) }}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.1485682}, "macro.fivetran_utils.default__get_columns_for_macro": {"unique_id": "macro.fivetran_utils.default__get_columns_for_macro", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/get_columns_for_macro.sql", "original_file_path": "macros/get_columns_for_macro.sql", "name": "default__get_columns_for_macro", "macro_sql": "{% macro default__get_columns_for_macro(table_name, schema_name, database_name=target.database) %}\n\n{% set query %}\n\nselect\n concat(\n '{\"name\": \"', \n lower(column_name), \n '\", \"datatype\": ',\n case\n when lower(data_type) like '%timestamp%' then 'dbt_utils.type_timestamp()' \n when lower(data_type) = 'text' then 'dbt_utils.type_string()' \n when lower(data_type) = 'boolean' then '\"boolean\"'\n when lower(data_type) = 'number' then 'dbt_utils.type_numeric()' \n when lower(data_type) = 'float' then 'dbt_utils.type_float()' \n when lower(data_type) = 'date' then '\"date\"'\n end,\n '}')\nfrom {{ database_name }}.information_schema.columns\nwhere lower(table_name) = '{{ table_name }}'\nand lower(table_schema) = '{{ schema_name }}'\norder by 1\n\n{% endset %}\n\n{% set results = run_query(query) %}\n{% set results_list = results.columns[0].values() %}}\n\n{{ return(results_list) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.150644}, "macro.fivetran_utils.bigquery__get_columns_for_macro": {"unique_id": "macro.fivetran_utils.bigquery__get_columns_for_macro", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/get_columns_for_macro.sql", "original_file_path": "macros/get_columns_for_macro.sql", "name": "bigquery__get_columns_for_macro", "macro_sql": "{% macro bigquery__get_columns_for_macro(table_name, schema_name, database_name=target.database) %}\n\n{% set query %}\n\nselect\n concat(\n '{\"name\": \"', \n lower(column_name), \n '\", \"datatype\": ',\n case\n when lower(data_type) like '%timestamp%' then 'dbt_utils.type_timestamp()' \n when lower(data_type) = 'string' then 'dbt_utils.type_string()' \n when lower(data_type) = 'bool' then '\"boolean\"'\n when lower(data_type) = 'numeric' then 'dbt_utils.type_numeric()' \n when lower(data_type) = 'float64' then 'dbt_utils.type_float()' \n when lower(data_type) = 'int64' then 'dbt_utils.type_int()' \n when lower(data_type) = 'date' then '\"date\"' \n when lower(data_type) = 'datetime' then '\"datetime\"' \n end,\n '}')\nfrom `{{ database_name }}`.{{ schema_name }}.INFORMATION_SCHEMA.COLUMNS\nwhere lower(table_name) = '{{ table_name }}'\nand lower(table_schema) = '{{ schema_name }}'\norder by 1\n\n{% endset %}\n\n{% set results = run_query(query) %}\n{% set results_list = results.columns[0].values() %}}\n\n{{ return(results_list) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.151662}, "macro.fivetran_utils.get_columns_for_macro": {"unique_id": "macro.fivetran_utils.get_columns_for_macro", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/get_columns_for_macro.sql", "original_file_path": "macros/get_columns_for_macro.sql", "name": "get_columns_for_macro", "macro_sql": "{% macro get_columns_for_macro(table_name, schema_name, database_name) -%}\n {{ return(adapter.dispatch('get_columns_for_macro')(table_name, schema_name, database_name)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__get_columns_for_macro"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.152138}, "macro.fivetran_utils.fill_staging_columns": {"unique_id": "macro.fivetran_utils.fill_staging_columns", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/fill_staging_columns.sql", "original_file_path": "macros/fill_staging_columns.sql", "name": "fill_staging_columns", "macro_sql": "{% macro fill_staging_columns(source_columns, staging_columns) -%}\n\n{%- set source_column_names = source_columns|map(attribute='name')|map('lower')|list -%}\n\n{%- for column in staging_columns %}\n {% if column.name|lower in source_column_names -%}\n {{ fivetran_utils.quote_column(column) }} as \n {%- if 'alias' in column %} {{ column.alias }} {% else %} {{ fivetran_utils.quote_column(column) }} {%- endif -%}\n {%- else -%}\n cast(null as {{ column.datatype }})\n {%- if 'alias' in column %} as {{ column.alias }} {% else %} as {{ fivetran_utils.quote_column(column) }} {% endif -%}\n {%- endif -%}\n {%- if not loop.last -%} , {% endif -%}\n{% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.quote_column"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.1551108}, "macro.fivetran_utils.quote_column": {"unique_id": "macro.fivetran_utils.quote_column", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/fill_staging_columns.sql", "original_file_path": "macros/fill_staging_columns.sql", "name": "quote_column", "macro_sql": "{% macro quote_column(column) %}\n {% if 'quote' in column %}\n {% if column.quote %}\n {% if target.type in ('bigquery', 'spark') %}\n `{{ column.name }}`\n {% elif target.type == 'snowflake' %}\n \"{{ column.name | upper }}\"\n {% else %}\n \"{{ column.name }}\"\n {% endif %}\n {% else %}\n {{ column.name }}\n {% endif %}\n {% else %}\n {{ column.name }}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.156325}, "macro.fivetran_utils.json_extract": {"unique_id": "macro.fivetran_utils.json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "json_extract", "macro_sql": "{% macro json_extract(string, string_path) -%}\n\n{{ adapter.dispatch('json_extract', 'fivetran_utils') (string, string_path) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.snowflake__json_extract"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.157465}, "macro.fivetran_utils.default__json_extract": {"unique_id": "macro.fivetran_utils.default__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "default__json_extract", "macro_sql": "{% macro default__json_extract(string, string_path) %}\n\n json_extract_path_text({{string}}, {{ \"'\" ~ string_path ~ \"'\" }} )\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.1578119}, "macro.fivetran_utils.snowflake__json_extract": {"unique_id": "macro.fivetran_utils.snowflake__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "snowflake__json_extract", "macro_sql": "{% macro snowflake__json_extract(string, string_path) %}\n\n json_extract_path_text(try_parse_json( {{string}} ), {{ \"'\" ~ string_path ~ \"'\" }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.15816}, "macro.fivetran_utils.redshift__json_extract": {"unique_id": "macro.fivetran_utils.redshift__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "redshift__json_extract", "macro_sql": "{% macro redshift__json_extract(string, string_path) %}\n\n case when is_valid_json( {{string}} ) then json_extract_path_text({{string}}, {{ \"'\" ~ string_path ~ \"'\" }} ) else null end\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.158541}, "macro.fivetran_utils.bigquery__json_extract": {"unique_id": "macro.fivetran_utils.bigquery__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "bigquery__json_extract", "macro_sql": "{% macro bigquery__json_extract(string, string_path) %}\n\n json_extract_scalar({{string}}, {{ \"'$.\" ~ string_path ~ \"'\" }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.15888}, "macro.fivetran_utils.postgres__json_extract": {"unique_id": "macro.fivetran_utils.postgres__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "postgres__json_extract", "macro_sql": "{% macro postgres__json_extract(string, string_path) %}\n\n {{string}}::json->>{{\"'\" ~ string_path ~ \"'\" }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.1592152}, "macro.fivetran_utils.collect_freshness": {"unique_id": "macro.fivetran_utils.collect_freshness", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/collect_freshness.sql", "original_file_path": "macros/collect_freshness.sql", "name": "collect_freshness", "macro_sql": "{% macro collect_freshness(source, loaded_at_field, filter) %}\n {{ return(adapter.dispatch('collect_freshness')(source, loaded_at_field, filter))}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__collect_freshness"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.160537}, "macro.fivetran_utils.default__collect_freshness": {"unique_id": "macro.fivetran_utils.default__collect_freshness", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/collect_freshness.sql", "original_file_path": "macros/collect_freshness.sql", "name": "default__collect_freshness", "macro_sql": "{% macro default__collect_freshness(source, loaded_at_field, filter) %}\n {% call statement('collect_freshness', fetch_result=True, auto_begin=False) -%}\n\n {%- set enabled_array = [] -%}\n {% for node in graph.sources.values() %}\n {% if node.name == source.name %}\n {% if (node.meta['is_enabled'] | default(true)) %}\n {%- do enabled_array.append(1) -%}\n {% endif %}\n {% endif %}\n {% endfor %}\n {% set is_enabled = (enabled_array != []) %}\n\n select\n {% if is_enabled %}\n max({{ loaded_at_field }})\n {% else %} \n {{ current_timestamp() }} {% endif %} as max_loaded_at,\n {{ current_timestamp() }} as snapshotted_at\n\n {% if is_enabled %}\n from {{ source }}\n {% if filter %}\n where {{ filter }}\n {% endif %}\n {% endif %}\n\n {% endcall %}\n {{ return(load_result('collect_freshness').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.162872}, "macro.fivetran_utils.timestamp_add": {"unique_id": "macro.fivetran_utils.timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "timestamp_add", "macro_sql": "{% macro timestamp_add(datepart, interval, from_timestamp) -%}\n\n{{ adapter.dispatch('timestamp_add', 'fivetran_utils') (datepart, interval, from_timestamp) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__timestamp_add"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.164175}, "macro.fivetran_utils.default__timestamp_add": {"unique_id": "macro.fivetran_utils.default__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "default__timestamp_add", "macro_sql": "{% macro default__timestamp_add(datepart, interval, from_timestamp) %}\n\n timestampadd(\n {{ datepart }},\n {{ interval }},\n {{ from_timestamp }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.164543}, "macro.fivetran_utils.bigquery__timestamp_add": {"unique_id": "macro.fivetran_utils.bigquery__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "bigquery__timestamp_add", "macro_sql": "{% macro bigquery__timestamp_add(datepart, interval, from_timestamp) %}\n\n timestamp_add({{ from_timestamp }}, interval {{ interval }} {{ datepart }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.164901}, "macro.fivetran_utils.redshift__timestamp_add": {"unique_id": "macro.fivetran_utils.redshift__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "redshift__timestamp_add", "macro_sql": "{% macro redshift__timestamp_add(datepart, interval, from_timestamp) %}\n\n dateadd(\n {{ datepart }},\n {{ interval }},\n {{ from_timestamp }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.165267}, "macro.fivetran_utils.postgres__timestamp_add": {"unique_id": "macro.fivetran_utils.postgres__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "postgres__timestamp_add", "macro_sql": "{% macro postgres__timestamp_add(datepart, interval, from_timestamp) %}\n\n {{ from_timestamp }} + ((interval '1 {{ datepart }}') * ({{ interval }}))\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.165633}, "macro.fivetran_utils.spark__timestamp_add": {"unique_id": "macro.fivetran_utils.spark__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "spark__timestamp_add", "macro_sql": "{% macro spark__timestamp_add(datepart, interval, from_timestamp) %}\n\n {{ dbt_utils.dateadd(datepart, interval, from_timestamp) }}\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.166023}, "macro.fivetran_utils.ceiling": {"unique_id": "macro.fivetran_utils.ceiling", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "name": "ceiling", "macro_sql": "{% macro ceiling(num) -%}\n\n{{ adapter.dispatch('ceiling', 'fivetran_utils') (num) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.snowflake__ceiling"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.166668}, "macro.fivetran_utils.default__ceiling": {"unique_id": "macro.fivetran_utils.default__ceiling", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "name": "default__ceiling", "macro_sql": "{% macro default__ceiling(num) %}\n ceiling({{ num }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.1669052}, "macro.fivetran_utils.snowflake__ceiling": {"unique_id": "macro.fivetran_utils.snowflake__ceiling", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "name": "snowflake__ceiling", "macro_sql": "{% macro snowflake__ceiling(num) %}\n ceil({{ num }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.167246}, "macro.fivetran_utils.remove_prefix_from_columns": {"unique_id": "macro.fivetran_utils.remove_prefix_from_columns", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/remove_prefix_from_columns.sql", "original_file_path": "macros/remove_prefix_from_columns.sql", "name": "remove_prefix_from_columns", "macro_sql": "{% macro remove_prefix_from_columns(columns, prefix='', exclude=[]) %}\n\n {%- for col in columns if col.name not in exclude -%}\n {%- if col.name[:prefix|length]|lower == prefix -%}\n {{ col.name }} as {{ col.name[prefix|length:] }}\n {%- else -%}\n {{ col.name }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {% endfor -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.168669}, "macro.fivetran_utils.union_data": {"unique_id": "macro.fivetran_utils.union_data", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/union_data.sql", "original_file_path": "macros/union_data.sql", "name": "union_data", "macro_sql": "{% macro union_data(table_identifier, database_variable, schema_variable, default_database, default_schema, default_variable, union_schema_variable='union_schemas', union_database_variable='union_databases') -%}\n\n{{ adapter.dispatch('union_data', 'fivetran_utils') (\n table_identifier, \n database_variable, \n schema_variable, \n default_database, \n default_schema, \n default_variable,\n union_schema_variable,\n union_database_variable\n ) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__union_data"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.170816}, "macro.fivetran_utils.default__union_data": {"unique_id": "macro.fivetran_utils.default__union_data", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/union_data.sql", "original_file_path": "macros/union_data.sql", "name": "default__union_data", "macro_sql": "{% macro default__union_data(\n table_identifier, \n database_variable, \n schema_variable, \n default_database, \n default_schema, \n default_variable,\n union_schema_variable,\n union_database_variable\n ) %}\n\n{% if var(union_schema_variable, none) %}\n\n {% set relations = [] %}\n \n {% if var(union_schema_variable) is string %}\n {% set trimmed = var(union_schema_variable)|trim('[')|trim(']') %}\n {% set schemas = trimmed.split(',')|map('trim',\" \")|map('trim','\"')|map('trim',\"'\") %}\n {% else %}\n {% set schemas = var(union_schema_variable) %}\n {% endif %}\n\n {% for schema in var(union_schema_variable) %}\n\n {% set relation=adapter.get_relation(\n database=var(database_variable, default_database),\n schema=schema,\n identifier=table_identifier\n ) -%}\n \n {% set relation_exists=relation is not none %}\n\n {% if relation_exists %}\n\n {% do relations.append(relation) %}\n \n {% endif %}\n\n {% endfor %}\n\n {{ dbt_utils.union_relations(relations) }}\n\n{% elif var(union_database_variable, none) %}\n\n {% set relations = [] %}\n\n {% for database in var(union_database_variable) %}\n\n {% set relation=adapter.get_relation(\n database=database,\n schema=var(schema_variable, default_schema),\n identifier=table_identifier\n ) -%}\n\n {% set relation_exists=relation is not none %}\n\n {% if relation_exists %}\n\n {% do relations.append(relation) %}\n \n {% endif %}\n\n {% endfor %}\n\n {{ dbt_utils.union_relations(relations) }}\n\n{% else %}\n\n select * \n from {{ var(default_variable) }}\n\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.union_relations"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.174873}, "macro.fivetran_utils.dummy_coalesce_value": {"unique_id": "macro.fivetran_utils.dummy_coalesce_value", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/dummy_coalesce_value.sql", "original_file_path": "macros/dummy_coalesce_value.sql", "name": "dummy_coalesce_value", "macro_sql": "{% macro dummy_coalesce_value(column) %}\n\n{% set coalesce_value = {\n 'STRING': \"'DUMMY_STRING'\",\n 'BOOLEAN': 'null',\n 'INT': 999999999,\n 'FLOAT': 999999999.99,\n 'TIMESTAMP': 'cast(\"2099-12-31\" as timestamp)',\n 'DATE': 'cast(\"2099-12-31\" as date)',\n} %}\n\n{% if column.is_float() %}\n{{ return(coalesce_value['FLOAT']) }}\n\n{% elif column.is_numeric() %}\n{{ return(coalesce_value['INT']) }}\n\n{% elif column.is_string() %}\n{{ return(coalesce_value['STRING']) }}\n\n{% elif column.data_type|lower == 'boolean' %}\n{{ return(coalesce_value['BOOLEAN']) }}\n\n{% elif 'timestamp' in column.data_type|lower %}\n{{ return(coalesce_value['TIMESTAMP']) }}\n\n{% elif 'date' in column.data_type|lower %}\n{{ return(coalesce_value['DATE']) }}\n\n{% elif 'int' in column.data_type|lower %}\n{{ return(coalesce_value['INT']) }}\n\n{% endif %}\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.1779468}, "macro.fivetran_utils.array_agg": {"unique_id": "macro.fivetran_utils.array_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "name": "array_agg", "macro_sql": "{% macro array_agg(field_to_agg) -%}\n\n{{ adapter.dispatch('array_agg', 'fivetran_utils') (field_to_agg) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__array_agg"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.178614}, "macro.fivetran_utils.default__array_agg": {"unique_id": "macro.fivetran_utils.default__array_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "name": "default__array_agg", "macro_sql": "{% macro default__array_agg(field_to_agg) %}\n array_agg({{ field_to_agg }})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.178846}, "macro.fivetran_utils.redshift__array_agg": {"unique_id": "macro.fivetran_utils.redshift__array_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "name": "redshift__array_agg", "macro_sql": "{% macro redshift__array_agg(field_to_agg) %}\n listagg({{ field_to_agg }}, ',')\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.17908}, "macro.fivetran_utils.empty_variable_warning": {"unique_id": "macro.fivetran_utils.empty_variable_warning", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/empty_variable_warning.sql", "original_file_path": "macros/empty_variable_warning.sql", "name": "empty_variable_warning", "macro_sql": "{% macro empty_variable_warning(variable, downstream_model) %}\n\n{% if not var(variable) %}\n{{ log(\n \"\"\"\n Warning: You have passed an empty list to the \"\"\" ~ variable ~ \"\"\".\n As a result, you won't see the history of any columns in the \"\"\" ~ downstream_model ~ \"\"\" model.\n \"\"\",\n info=True\n) }}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.180081}, "macro.fivetran_utils.enabled_vars_one_true": {"unique_id": "macro.fivetran_utils.enabled_vars_one_true", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/enabled_vars_one_true.sql", "original_file_path": "macros/enabled_vars_one_true.sql", "name": "enabled_vars_one_true", "macro_sql": "{% macro enabled_vars_one_true(vars) %}\n\n{% for v in vars %}\n \n {% if var(v, False) == True %}\n {{ return(True) }}\n {% endif %}\n\n{% endfor %}\n\n{{ return(False) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.181034}, "macro.tiktok_ads_source.get_ad_group_history_columns": {"unique_id": "macro.tiktok_ads_source.get_ad_group_history_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_ad_group_history_columns.sql", "original_file_path": "macros/get_ad_group_history_columns.sql", "name": "get_ad_group_history_columns", "macro_sql": "{% macro get_ad_group_history_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"action_days\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"adgroup_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"adgroup_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"advertiser_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"android_osv\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"app_download_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"app_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"app_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"app_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"audience_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"bid\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"bid_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"billing_event\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"budget\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"budget_mode\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"category\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"click_tracking_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"conversion_bid\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cpv_video_duration\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"create_time\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"creative_material_mode\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"dayparting\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"deep_bid_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"deep_cpabid\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"deep_external_action\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"display_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"enable_inventory_filter\", \"datatype\": \"boolean\"},\n {\"name\": \"external_action\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"fallback_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"frequency\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"frequency_schedule\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"gender\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"impression_tracking_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"ios_osv\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"is_comment_disable\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"is_hfss\", \"datatype\": \"boolean\"},\n {\"name\": \"is_new_structure\", \"datatype\": \"boolean\"},\n {\"name\": \"landing_page_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"open_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"open_url_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"opt_status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"optimize_goal\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"pacing\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"package\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"pixel_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"placement_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"profile_image\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"schedule_end_time\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"schedule_start_time\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"schedule_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"skip_learning_phase\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"statistic_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"updated_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"video_download\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"audience\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"excluded_audience\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"location\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"interest_category_v_2\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"pangle_block_app_list_id\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"action_categories\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"placement\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"keywords\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"age\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"languages\", \"datatype\": dbt_utils.type_string()}\n\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_numeric", "macro.dbt_utils.type_string", "macro.dbt_utils.type_float"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.1971068}, "macro.tiktok_ads_source.get_ad_group_report_hourly_columns": {"unique_id": "macro.tiktok_ads_source.get_ad_group_report_hourly_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_ad_group_report_hourly_columns.sql", "original_file_path": "macros/get_ad_group_report_hourly_columns.sql", "name": "get_ad_group_report_hourly_columns", "macro_sql": "{% macro get_ad_group_report_hourly_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"adgroup_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"average_video_play\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"average_video_play_per_user\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"clicks\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"comments\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_1000_reached\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_conversion\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_result\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_secondary_goal_result\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"cpc\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cpm\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"ctr\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"follows\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"impressions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"likes\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"profile_visits\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"profile_visits_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"reach\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"real_time_conversion\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"real_time_conversion_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"real_time_cost_per_conversion\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"real_time_cost_per_result\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"real_time_result\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"real_time_result_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"result\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"result_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"secondary_goal_result\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"secondary_goal_result_rate\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"shares\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"spend\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"stat_time_hour\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"video_play_actions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_100\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_25\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_50\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_75\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_2_s\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_6_s\", \"datatype\": dbt_utils.type_numeric()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_numeric", "macro.dbt_utils.type_float", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.206978}, "macro.tiktok_ads_source.get_advertiser_columns": {"unique_id": "macro.tiktok_ads_source.get_advertiser_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_advertiser_columns.sql", "original_file_path": "macros/get_advertiser_columns.sql", "name": "get_advertiser_columns", "macro_sql": "{% macro get_advertiser_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"address\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"balance\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"company\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"contacter\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"country\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"create_time\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"currency\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"description\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"email\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"industry\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"language\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"license_no\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"license_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"phone_number\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"promotion_area\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"reason\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"role\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"telephone\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"timezone\", \"datatype\": dbt_utils.type_string()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_string", "macro.dbt_utils.type_float", "macro.dbt_utils.type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.2123048}, "macro.tiktok_ads_source.get_campaign_history_columns": {"unique_id": "macro.tiktok_ads_source.get_campaign_history_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_campaign_history_columns.sql", "original_file_path": "macros/get_campaign_history_columns.sql", "name": "get_campaign_history_columns", "macro_sql": "{% macro get_campaign_history_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"advertiser_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"budget\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"budget_mode\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"campaign_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"create_time\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"is_new_structure\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"objective_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"opt_status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"split_test_variable\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"updated_at\", \"datatype\": dbt_utils.type_timestamp()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_numeric", "macro.dbt_utils.type_float", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.2155032}, "macro.tiktok_ads_source.get_campaign_report_hourly_columns": {"unique_id": "macro.tiktok_ads_source.get_campaign_report_hourly_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_campaign_report_hourly_columns.sql", "original_file_path": "macros/get_campaign_report_hourly_columns.sql", "name": "get_campaign_report_hourly_columns", "macro_sql": "{% macro get_campaign_report_hourly_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"average_video_play\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"average_video_play_per_user\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"clicks\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"comments\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_1000_reached\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_conversion\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_result\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_secondary_goal_result\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"cpc\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cpm\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"ctr\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"follows\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"impressions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"likes\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"profile_visits\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"profile_visits_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"reach\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"real_time_conversion\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"real_time_conversion_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"real_time_cost_per_conversion\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"real_time_cost_per_result\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"real_time_result\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"real_time_result_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"result\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"result_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"secondary_goal_result\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"secondary_goal_result_rate\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"shares\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"spend\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"stat_time_hour\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"video_play_actions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_100\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_25\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_50\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_75\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_2_s\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_6_s\", \"datatype\": dbt_utils.type_numeric()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_float", "macro.dbt_utils.type_numeric", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.225078}, "macro.tiktok_ads_source.get_ad_history_columns": {"unique_id": "macro.tiktok_ads_source.get_ad_history_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_ad_history_columns.sql", "original_file_path": "macros/get_ad_history_columns.sql", "name": "get_ad_history_columns", "macro_sql": "{% macro get_ad_history_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"ad_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"ad_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"ad_text\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"adgroup_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"advertiser_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"app_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"call_to_action\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"click_tracking_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"create_time\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"display_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"impression_tracking_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"is_aco\", \"datatype\": \"boolean\"},\n {\"name\": \"is_creative_authorized\", \"datatype\": \"boolean\"},\n {\"name\": \"is_new_structure\", \"datatype\": \"boolean\"},\n {\"name\": \"landing_page_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"open_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"opt_status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"playable_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"profile_image\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"updated_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"video_id\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"image_ids\", \"datatype\": dbt_utils.type_string()}\n\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_numeric", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.230725}, "macro.tiktok_ads_source.get_ad_report_hourly_columns": {"unique_id": "macro.tiktok_ads_source.get_ad_report_hourly_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_ad_report_hourly_columns.sql", "original_file_path": "macros/get_ad_report_hourly_columns.sql", "name": "get_ad_report_hourly_columns", "macro_sql": "{% macro get_ad_report_hourly_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"ad_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"average_video_play\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"average_video_play_per_user\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"clicks\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"comments\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_1000_reached\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_conversion\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_result\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_secondary_goal_result\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"cpc\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cpm\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"ctr\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"follows\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"impressions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"likes\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"profile_visits\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"profile_visits_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"reach\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"real_time_conversion\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"real_time_conversion_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"real_time_cost_per_conversion\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"real_time_cost_per_result\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"real_time_result\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"real_time_result_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"result\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"result_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"secondary_goal_result\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"secondary_goal_result_rate\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"shares\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"spend\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"stat_time_hour\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"video_play_actions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_100\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_25\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_50\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_75\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_2_s\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_6_s\", \"datatype\": dbt_utils.type_numeric()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_numeric", "macro.dbt_utils.type_float", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1641494962.240277}}, "docs": {"dbt.__overview__": {"unique_id": "dbt.__overview__", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "overview.md", "original_file_path": "docs/overview.md", "name": "__overview__", "block_contents": "### Welcome!\n\nWelcome to the auto-generated documentation for your dbt project!\n\n### Navigation\n\nYou can use the `Project` and `Database` navigation tabs on the left side of the window to explore the models\nin your project.\n\n#### Project Tab\nThe `Project` tab mirrors the directory structure of your dbt project. In this tab, you can see all of the\nmodels defined in your dbt project, as well as models imported from dbt packages.\n\n#### Database Tab\nThe `Database` tab also exposes your models, but in a format that looks more like a database explorer. This view\nshows relations (tables and views) grouped into database schemas. Note that ephemeral models are _not_ shown\nin this interface, as they do not exist in the database.\n\n### Graph Exploration\nYou can click the blue icon on the bottom-right corner of the page to view the lineage graph of your models.\n\nOn model pages, you'll see the immediate parents and children of the model you're exploring. By clicking the `Expand`\nbutton at the top-right of this lineage pane, you'll be able to see all of the models that are used to build,\nor are built from, the model you're exploring.\n\nOnce expanded, you'll be able to use the `--select` and `--exclude` model selection syntax to filter the\nmodels in the graph. For more information on model selection, check out the [dbt docs](https://docs.getdbt.com/docs/model-selection-syntax).\n\nNote that you can also right-click on models to interactively filter and explore the graph.\n\n---\n\n### More information\n\n- [What is dbt](https://docs.getdbt.com/docs/overview)?\n- Read the [dbt viewpoint](https://docs.getdbt.com/docs/viewpoint)\n- [Installation](https://docs.getdbt.com/docs/installation)\n- Join the [dbt Community](https://www.getdbt.com/community/) for questions and discussion"}}, "exposures": {}, "metrics": {}, "selectors": {}, "disabled": {}, "parent_map": {"model.tiktok_ads.tiktok_ads__ad_adapter": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad", "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "model.tiktok_ads.tiktok_ads__ad_group_report": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "model.tiktok_ads.tiktok_ads__ad_adapter"], "model.tiktok_ads.tiktok_ads__campaign_report": ["model.tiktok_ads.tiktok_ads__ad_adapter"], "model.tiktok_ads.int_tiktok_ads__most_recent_campaign": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"], "model.tiktok_ads.int_tiktok_ads__most_recent_ad": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"], "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__advertiser": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp", "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__ad_history": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_history": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp": ["source.tiktok_ads_source.tiktok_ads.ad_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp": ["source.tiktok_ads_source.tiktok_ads.ad_history"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp": ["source.tiktok_ads_source.tiktok_ads.adgroup_history"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp": ["source.tiktok_ads_source.tiktok_ads.campaign_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp": ["source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp": ["source.tiktok_ads_source.tiktok_ads.campaign_history"], "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp": ["source.tiktok_ads_source.tiktok_ads.advertiser"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_adapter_ad_id__date_day.c70f86f560": ["model.tiktok_ads.tiktok_ads__ad_adapter"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day.2eb4c2ff6d": ["model.tiktok_ads.tiktok_ads__ad_group_report"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day.cc5f756c69": ["model.tiktok_ads.tiktok_ads__campaign_report"], "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.fcb8c561bc": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad_group"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at.e2e9914076": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad_group"], "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_ad_id.14e9c145ca": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at.f58d824f65": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad"], "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_campaign_campaign_id.8cefa8981c": ["model.tiktok_ads.int_tiktok_ads__most_recent_campaign"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at.39077adf71": ["model.tiktok_ads.int_tiktok_ads__most_recent_campaign"], "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"], "source.tiktok_ads_source.tiktok_ads.advertiser": [], "source.tiktok_ads_source.tiktok_ads.campaign_history": [], "source.tiktok_ads_source.tiktok_ads.adgroup_history": [], "source.tiktok_ads_source.tiktok_ads.ad_history": [], "source.tiktok_ads_source.tiktok_ads.ad_report_hourly": [], "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly": [], "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly": []}, "child_map": {"model.tiktok_ads.tiktok_ads__ad_adapter": ["model.tiktok_ads.tiktok_ads__ad_group_report", "model.tiktok_ads.tiktok_ads__campaign_report", "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_adapter_ad_id__date_day.c70f86f560"], "model.tiktok_ads.tiktok_ads__ad_group_report": ["test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day.2eb4c2ff6d"], "model.tiktok_ads.tiktok_ads__campaign_report": ["test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day.cc5f756c69"], "model.tiktok_ads.int_tiktok_ads__most_recent_campaign": ["model.tiktok_ads.tiktok_ads__ad_adapter", "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at.39077adf71", "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_campaign_campaign_id.8cefa8981c"], "model.tiktok_ads.int_tiktok_ads__most_recent_ad": ["model.tiktok_ads.tiktok_ads__ad_adapter", "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at.f58d824f65", "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_ad_id.14e9c145ca"], "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group": ["model.tiktok_ads.tiktok_ads__ad_adapter", "model.tiktok_ads.tiktok_ads__ad_group_report", "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at.e2e9914076", "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.fcb8c561bc"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly": ["test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34", "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly": ["test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad", "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de", "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad"], "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly": ["model.tiktok_ads.tiktok_ads__ad_adapter", "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d"], "model.tiktok_ads_source.stg_tiktok_ads__advertiser": ["model.tiktok_ads.tiktok_ads__ad_adapter", "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def", "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66"], "model.tiktok_ads_source.stg_tiktok_ads__ad_history": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad", "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1", "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_history": ["model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b", "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1"], "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history", "model.tiktok_ads_source.stg_tiktok_ads__ad_history"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history", "model.tiktok_ads_source.stg_tiktok_ads__campaign_history"], "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser", "model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_adapter_ad_id__date_day.c70f86f560": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day.2eb4c2ff6d": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day.cc5f756c69": [], "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.fcb8c561bc": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at.e2e9914076": [], "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_ad_id.14e9c145ca": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at.f58d824f65": [], "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_campaign_campaign_id.8cefa8981c": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at.39077adf71": [], "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34": [], "source.tiktok_ads_source.tiktok_ads.advertiser": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp"], "source.tiktok_ads_source.tiktok_ads.campaign_history": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp"], "source.tiktok_ads_source.tiktok_ads.adgroup_history": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp"], "source.tiktok_ads_source.tiktok_ads.ad_history": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp"], "source.tiktok_ads_source.tiktok_ads.ad_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp"], "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp"], "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp"]}} \ No newline at end of file diff --git a/docs/run_results.json b/docs/run_results.json deleted file mode 100644 index 95d7bd2..0000000 --- a/docs/run_results.json +++ /dev/null @@ -1 +0,0 @@ -{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/run-results/v4.json", "dbt_version": "1.0.0", "generated_at": "2022-01-06T18:49:27.854077Z", "invocation_id": "8ad2e9d0-66fc-47f9-abe0-fe38c6948257", "env": {}}, "results": [{"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:25.159286Z", "completed_at": "2022-01-06T18:49:25.178370Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:25.179707Z", "completed_at": "2022-01-06T18:49:25.179730Z"}], "thread_id": "Thread-1", "execution_time": 0.02376699447631836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:25.160330Z", "completed_at": "2022-01-06T18:49:25.178655Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:25.179914Z", "completed_at": "2022-01-06T18:49:25.179922Z"}], "thread_id": "Thread-2", "execution_time": 0.023427963256835938, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:25.165672Z", "completed_at": "2022-01-06T18:49:25.179340Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:25.181310Z", "completed_at": "2022-01-06T18:49:25.181321Z"}], "thread_id": "Thread-3", "execution_time": 0.024337053298950195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:25.165867Z", "completed_at": "2022-01-06T18:49:25.179533Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:25.181519Z", "completed_at": "2022-01-06T18:49:25.181529Z"}], "thread_id": "Thread-4", "execution_time": 0.024299144744873047, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:25.185828Z", "completed_at": "2022-01-06T18:49:25.205346Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:25.214948Z", "completed_at": "2022-01-06T18:49:25.214960Z"}], "thread_id": "Thread-2", "execution_time": 0.03225278854370117, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:25.185642Z", "completed_at": "2022-01-06T18:49:25.214077Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:25.215442Z", "completed_at": "2022-01-06T18:49:25.215449Z"}], "thread_id": "Thread-1", "execution_time": 0.033735036849975586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:25.195052Z", "completed_at": "2022-01-06T18:49:25.215095Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:25.217926Z", "completed_at": "2022-01-06T18:49:25.217935Z"}], "thread_id": "Thread-3", "execution_time": 0.03473687171936035, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:25.195240Z", "completed_at": "2022-01-06T18:49:26.174665Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:26.174987Z", "completed_at": "2022-01-06T18:49:26.174998Z"}], "thread_id": "Thread-4", "execution_time": 1.1719632148742676, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:25.221368Z", "completed_at": "2022-01-06T18:49:26.388980Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:26.390291Z", "completed_at": "2022-01-06T18:49:26.390300Z"}], "thread_id": "Thread-1", "execution_time": 1.3582439422607422, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:25.236168Z", "completed_at": "2022-01-06T18:49:26.388523Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:26.388843Z", "completed_at": "2022-01-06T18:49:26.388854Z"}], "thread_id": "Thread-3", "execution_time": 1.3697190284729004, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:25.220900Z", "completed_at": "2022-01-06T18:49:26.439192Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:26.439536Z", "completed_at": "2022-01-06T18:49:26.439548Z"}], "thread_id": "Thread-2", "execution_time": 1.4170830249786377, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:26.686056Z", "completed_at": "2022-01-06T18:49:26.692719Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:26.693067Z", "completed_at": "2022-01-06T18:49:26.693076Z"}], "thread_id": "Thread-2", "execution_time": 0.007912874221801758, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:26.694629Z", "completed_at": "2022-01-06T18:49:26.705711Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:26.706128Z", "completed_at": "2022-01-06T18:49:26.706139Z"}], "thread_id": "Thread-2", "execution_time": 0.012740135192871094, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:26.715183Z", "completed_at": "2022-01-06T18:49:26.721000Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:26.721410Z", "completed_at": "2022-01-06T18:49:26.721418Z"}], "thread_id": "Thread-2", "execution_time": 0.0070798397064208984, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:26.722358Z", "completed_at": "2022-01-06T18:49:26.742536Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:26.744300Z", "completed_at": "2022-01-06T18:49:26.744332Z"}], "thread_id": "Thread-2", "execution_time": 0.022963285446166992, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:26.746378Z", "completed_at": "2022-01-06T18:49:26.754179Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:26.755119Z", "completed_at": "2022-01-06T18:49:26.755129Z"}], "thread_id": "Thread-2", "execution_time": 0.009985685348510742, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:26.757076Z", "completed_at": "2022-01-06T18:49:26.763863Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:26.764138Z", "completed_at": "2022-01-06T18:49:26.764147Z"}], "thread_id": "Thread-2", "execution_time": 0.008049249649047852, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:26.765082Z", "completed_at": "2022-01-06T18:49:26.768482Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:26.768740Z", "completed_at": "2022-01-06T18:49:26.768747Z"}], "thread_id": "Thread-2", "execution_time": 0.004220008850097656, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:26.769705Z", "completed_at": "2022-01-06T18:49:26.782075Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:26.782344Z", "completed_at": "2022-01-06T18:49:26.782352Z"}], "thread_id": "Thread-2", "execution_time": 0.01324009895324707, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at.e2e9914076"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:26.783317Z", "completed_at": "2022-01-06T18:49:26.788043Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:26.788308Z", "completed_at": "2022-01-06T18:49:26.788315Z"}], "thread_id": "Thread-2", "execution_time": 0.005584239959716797, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.fcb8c561bc"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:26.789228Z", "completed_at": "2022-01-06T18:49:26.796323Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:26.796586Z", "completed_at": "2022-01-06T18:49:26.796594Z"}], "thread_id": "Thread-2", "execution_time": 0.00798797607421875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at.f58d824f65"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:26.797448Z", "completed_at": "2022-01-06T18:49:26.802094Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:26.802360Z", "completed_at": "2022-01-06T18:49:26.802367Z"}], "thread_id": "Thread-2", "execution_time": 0.005483865737915039, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_ad_id.14e9c145ca"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:26.359586Z", "completed_at": "2022-01-06T18:49:27.282034Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:27.282304Z", "completed_at": "2022-01-06T18:49:27.282314Z"}], "thread_id": "Thread-4", "execution_time": 1.1022319793701172, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:27.462528Z", "completed_at": "2022-01-06T18:49:27.471461Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:27.471810Z", "completed_at": "2022-01-06T18:49:27.471821Z"}], "thread_id": "Thread-4", "execution_time": 0.010293960571289062, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:27.472898Z", "completed_at": "2022-01-06T18:49:27.477804Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:27.478555Z", "completed_at": "2022-01-06T18:49:27.478564Z"}], "thread_id": "Thread-4", "execution_time": 0.0065097808837890625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:27.478714Z", "completed_at": "2022-01-06T18:49:27.488858Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:27.494521Z", "completed_at": "2022-01-06T18:49:27.494532Z"}], "thread_id": "Thread-2", "execution_time": 0.01700901985168457, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at.39077adf71"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:27.488729Z", "completed_at": "2022-01-06T18:49:27.495368Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:27.495667Z", "completed_at": "2022-01-06T18:49:27.495674Z"}], "thread_id": "Thread-4", "execution_time": 0.007816076278686523, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_campaign_campaign_id.8cefa8981c"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:26.655478Z", "completed_at": "2022-01-06T18:49:27.546122Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:27.546393Z", "completed_at": "2022-01-06T18:49:27.546403Z"}], "thread_id": "Thread-1", "execution_time": 1.103442907333374, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:26.661236Z", "completed_at": "2022-01-06T18:49:27.572112Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:27.572365Z", "completed_at": "2022-01-06T18:49:27.572375Z"}], "thread_id": "Thread-3", "execution_time": 1.1310482025146484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:27.718502Z", "completed_at": "2022-01-06T18:49:27.777141Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:27.778607Z", "completed_at": "2022-01-06T18:49:27.778617Z"}], "thread_id": "Thread-2", "execution_time": 0.06233716011047363, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:27.718656Z", "completed_at": "2022-01-06T18:49:27.777661Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:27.779202Z", "completed_at": "2022-01-06T18:49:27.779210Z"}], "thread_id": "Thread-4", "execution_time": 0.06264781951904297, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:27.718805Z", "completed_at": "2022-01-06T18:49:27.778739Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:27.780518Z", "completed_at": "2022-01-06T18:49:27.780527Z"}], "thread_id": "Thread-1", "execution_time": 0.06365513801574707, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads.tiktok_ads__ad_adapter"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:27.780694Z", "completed_at": "2022-01-06T18:49:27.792808Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:27.799090Z", "completed_at": "2022-01-06T18:49:27.799104Z"}], "thread_id": "Thread-3", "execution_time": 0.04981207847595215, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:27.787822Z", "completed_at": "2022-01-06T18:49:27.793788Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:27.829134Z", "completed_at": "2022-01-06T18:49:27.829145Z"}], "thread_id": "Thread-2", "execution_time": 0.04914093017578125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:27.793657Z", "completed_at": "2022-01-06T18:49:27.829639Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:27.831186Z", "completed_at": "2022-01-06T18:49:27.831194Z"}], "thread_id": "Thread-1", "execution_time": 0.03942108154296875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads.tiktok_ads__campaign_report"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:27.793246Z", "completed_at": "2022-01-06T18:49:27.829783Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:27.831348Z", "completed_at": "2022-01-06T18:49:27.831356Z"}], "thread_id": "Thread-4", "execution_time": 0.04392409324645996, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads.tiktok_ads__ad_group_report"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:27.831509Z", "completed_at": "2022-01-06T18:49:27.839075Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:27.844738Z", "completed_at": "2022-01-06T18:49:27.844750Z"}], "thread_id": "Thread-3", "execution_time": 0.020009994506835938, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_adapter_ad_id__date_day.c70f86f560"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:27.839381Z", "completed_at": "2022-01-06T18:49:27.850724Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:27.851226Z", "completed_at": "2022-01-06T18:49:27.851236Z"}], "thread_id": "Thread-2", "execution_time": 0.013586997985839844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day.cc5f756c69"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-01-06T18:49:27.839712Z", "completed_at": "2022-01-06T18:49:27.851367Z"}, {"name": "execute", "started_at": "2022-01-06T18:49:27.852131Z", "completed_at": "2022-01-06T18:49:27.852141Z"}], "thread_id": "Thread-1", "execution_time": 0.013849973678588867, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day.2eb4c2ff6d"}], "elapsed_time": 4.369296073913574, "args": {"write_json": true, "use_colors": true, "printer_width": 80, "version_check": true, "partial_parse": true, "static_parser": true, "profiles_dir": "/Users/renee.li/.dbt", "send_anonymous_usage_stats": true, "event_buffer_size": 100000, "compile": true, "which": "generate", "rpc_method": "docs.generate", "indirect_selection": "eager"}} \ No newline at end of file diff --git a/integration_tests/seeds/tiktok_ad_history_data.csv b/integration_tests/seeds/tiktok_ad_history_data.csv index 14e35fa..94ba9cc 100644 --- a/integration_tests/seeds/tiktok_ad_history_data.csv +++ b/integration_tests/seeds/tiktok_ad_history_data.csv @@ -1,5 +1,5 @@ AD_ID,UPDATED_AT,ADVERTISER_ID,ADGROUP_ID,CAMPAIGN_ID,CREATE_TIME,AD_NAME,CALL_TO_ACTION,STATUS,OPT_STATUS,AD_TEXT,VIDEO_ID,APP_NAME,OPEN_URL,LANDING_PAGE_URL,DISPLAY_NAME,PROFILE_IMAGE,IMPRESSION_TRACKING_URL,CLICK_TRACKING_URL,PLAYABLE_URL,IS_ACO,IS_CREATIVE_AUTHORIZED,IS_NEW_STRUCTURE,IMAGE_IDS,_FIVETRAN_SYNCED -1,2021-09-15 04:26:28.000 +0000,1,1,1,2021-08-27 14:13:57.000 +0000,ad name one,SIGN_UP,AD_STATUS_DELIVERY_OK,DISABLE,subscribe,v10033g50000c4kf54jc77ucvou6fv0g,,,https://www.stuffthatworks.health/,health,,,,,TRUE,FALSE,TRUE,[ 124938917 ],2021-09-15 15:53:16.797 +0000 -2,2021-09-15 03:19:25.000 +0000,2,2,2,2021-09-13 18:54:11.000 +0000,ad name two,SIGN_UP,AD_STATUS_DELIVERY_OK,ENABLE,join us,v10033g50000c4vnvmbc77u58bhlklvg,,,https://swaggystocks.com/dashboard/home,stocks,,,,,TRUE,FALSE,TRUE,[ 124938917 ],2021-09-15 15:53:16.641 +0000 -3,2021-09-15 03:54:51.000 +0000,3,3,3,2021-07-26 16:28:39.000 +0000,ad name three,INTERESTED,AD_STATUS_DELIVERY_OK,ENABLE,like and share,v10033g50000c3qbo6jc77uaacd9hvv0,,,https://finviz.com/screener.ashx,more stocks,,,,,TRUE,FALSE,TRUE,[ 124938917 ],2021-09-15 15:53:18.918 +0000 -4,2021-09-15 04:26:26.000 +0000,4,4,4,2021-08-05 21:02:33.000 +0000,ad name four,SUBSCRIBE,AD_STATUS_DELIVERY_OK,DISABLE,get stuck in,v10033g50000c3qbo6jc77ucp113o3qg,,,linkedin.com,linkedin,,,,,TRUE,FALSE,TRUE,[ 124938917 ],2021-09-15 15:53:18.897 +0000 \ No newline at end of file +1,2021-09-15 04:26:28.000,1,1,1,2021-08-27 14:13:57.000,ad name one,SIGN_UP,AD_STATUS_DELIVERY_OK,DISABLE,subscribe,v10033g50000c4kf54jc77ucvou6fv0g,,,https://www.stuffthatworks.health/,health,,,,,TRUE,FALSE,TRUE,[ 124938917 ],2021-09-15 15:53:16.797 +2,2021-09-15 03:19:25.000,2,2,2,2021-09-13 18:54:11.000,ad name two,SIGN_UP,AD_STATUS_DELIVERY_OK,ENABLE,join us,v10033g50000c4vnvmbc77u58bhlklvg,,,https://swaggystocks.com/dashboard/home,stocks,,,,,TRUE,FALSE,TRUE,[ 124938917 ],2021-09-15 15:53:16.641 +3,2021-09-15 03:54:51.000,3,3,3,2021-07-26 16:28:39.000,ad name three,INTERESTED,AD_STATUS_DELIVERY_OK,ENABLE,like and share,v10033g50000c3qbo6jc77uaacd9hvv0,,,https://finviz.com/screener.ashx,more stocks,,,,,TRUE,FALSE,TRUE,[ 124938917 ],2021-09-15 15:53:18.918 +4,2021-09-15 04:26:26.000,4,4,4,2021-08-05 21:02:33.000,ad name four,SUBSCRIBE,AD_STATUS_DELIVERY_OK,DISABLE,get stuck in,v10033g50000c3qbo6jc77ucp113o3qg,,,linkedin.com,linkedin,,,,,TRUE,FALSE,TRUE,[ 124938917 ],2021-09-15 15:53:18.897 \ No newline at end of file diff --git a/integration_tests/seeds/tiktok_ad_report_hourly_data.csv b/integration_tests/seeds/tiktok_ad_report_hourly_data.csv index 69f8600..7bf854e 100644 --- a/integration_tests/seeds/tiktok_ad_report_hourly_data.csv +++ b/integration_tests/seeds/tiktok_ad_report_hourly_data.csv @@ -1,5 +1,5 @@ AD_ID,STAT_TIME_HOUR,COST_PER_CONVERSION,REAL_TIME_CONVERSION,CPC,VIDEO_PLAY_ACTIONS,CONVERSION_RATE,VIDEO_VIEWS_P_75,RESULT,VIDEO_VIEWS_P_50,IMPRESSIONS,COMMENTS,REAL_TIME_COST_PER_RESULT,CONVERSION,REAL_TIME_RESULT,VIDEO_VIEWS_P_100,SHARES,REAL_TIME_CONVERSION_RATE,COST_PER_SECONDARY_GOAL_RESULT,SECONDARY_GOAL_RESULT_RATE,CLICKS,COST_PER_1000_REACHED,VIDEO_VIEWS_P_25,REACH,REAL_TIME_COST_PER_CONVERSION,PROFILE_VISITS_RATE,AVERAGE_VIDEO_PLAY,PROFILE_VISITS,CPM,CTR,VIDEO_WATCHED_2_S,FOLLOWS,RESULT_RATE,VIDEO_WATCHED_6_S,SECONDARY_GOAL_RESULT,COST_PER_RESULT,AVERAGE_VIDEO_PLAY_PER_USER,REAL_TIME_RESULT_RATE,SPEND,LIKES,_FIVETRAN_SYNCED -1,2021-09-15 10:00:00,0,0,0,22,0,2,0,2,23,0,0,0,0,0,0,0,-,-,0,0,22,0,0,0,2.22,0,32.22,0,2,0,0,22,-,0,0,0,2.22,0,2021-09-15 15:56:34.862 +0000 -2,2021-09-15 10:00:00,0,0,0,33,0,0,0,0,22,0,0,0,0,0,0,0,-,-,0,0,3,0,0,0,2.22,0,2.22,0,2,0,0,2,-,0,0,0,0.22,0,2021-09-15 15:56:34.953 +0000 -3,2021-09-15 10:00:00,0,0,0,2,0,0,0,0,2,0,0,0,0,0,0,0,-,-,0,0,0,0,0,0,2.22,0,0,0,0,0,0,0,-,0,0,0,0,0,2021-09-15 15:56:34.923 +0000 -4,2021-09-15 10:00:00,0.22,2,0.22,22,222,2,2,2,22,0,0.22,2,2,2,0,200,-,-,2,0,2,0,0.22,0,2.22,0,22.22,2.22,2,0,100,2,-,0.22,0,222,0.22,2,2021-09-15 15:56:34.950 +0000 \ No newline at end of file +1,2021-09-15 10:00:00,0,0,0,22,0,2,0,2,23,0,0,0,0,0,0,0,-,-,0,0,22,0,0,0,2.22,0,32.22,0,2,0,0,22,-,0,0,0,2.22,0,2021-09-15 15:56:34.862 +2,2021-09-15 10:00:00,0,0,0,33,0,0,0,0,22,0,0,0,0,0,0,0,-,-,0,0,3,0,0,0,2.22,0,2.22,0,2,0,0,2,-,0,0,0,0.22,0,2021-09-15 15:56:34.953 +3,2021-09-15 10:00:00,0,0,0,2,0,0,0,0,2,0,0,0,0,0,0,0,-,-,0,0,0,0,0,0,2.22,0,0,0,0,0,0,0,-,0,0,0,0,0,2021-09-15 15:56:34.923 +4,2021-09-15 10:00:00,0.22,2,0.22,22,222,2,2,2,22,0,0.22,2,2,2,0,200,-,-,2,0,2,0,0.22,0,2.22,0,22.22,2.22,2,0,100,2,-,0.22,0,222,0.22,2,2021-09-15 15:56:34.950 \ No newline at end of file diff --git a/integration_tests/seeds/tiktok_adgroup_history_data.csv b/integration_tests/seeds/tiktok_adgroup_history_data.csv index 776e7ae..59577a5 100644 --- a/integration_tests/seeds/tiktok_adgroup_history_data.csv +++ b/integration_tests/seeds/tiktok_adgroup_history_data.csv @@ -1,5 +1,5 @@ ADGROUP_ID,UPDATED_AT,ADVERTISER_ID,CAMPAIGN_ID,CREATE_TIME,ADGROUP_NAME,PLACEMENT_TYPE,PROFILE_IMAGE,LANDING_PAGE_URL,DISPLAY_NAME,APP_TYPE,APP_DOWNLOAD_URL,APP_NAME,EXTERNAL_ACTION,DEEP_EXTERNAL_ACTION,CREATIVE_MATERIAL_MODE,AUDIENCE_TYPE,GENDER,ANDROID_OSV,IOS_OSV,BUDGET_MODE,SCHEDULE_TYPE,DAYPARTING,OPTIMIZE_GOAL,CPV_VIDEO_DURATION,PACING,BILLING_EVENT,BID_TYPE,DEEP_BID_TYPE,IMPRESSION_TRACKING_URL,CLICK_TRACKING_URL,STATUS,OPT_STATUS,STATISTIC_TYPE,VIDEO_DOWNLOAD,OPEN_URL,OPEN_URL_TYPE,FALLBACK_TYPE,BUDGET,BID,CONVERSION_BID,DEEP_CPABID,SCHEDULE_START_TIME,SCHEDULE_END_TIME,APP_ID,PIXEL_ID,ENABLE_INVENTORY_FILTER,IS_HFSS,IS_NEW_STRUCTURE,CATEGORY,IS_COMMENT_DISABLE,SKIP_LEARNING_PHASE,FREQUENCY,FREQUENCY_SCHEDULE,ACTION_DAYS,AUDIENCE,EXCLUDED_AUDIENCE,LOCATION,INTEREST_CATEGORY_V_2,PANGLE_BLOCK_APP_LIST_ID,ACTION_CATEGORIES,PLACEMENT,KEYWORDS,AGE,LANGUAGES,OPERATION_SYSTEM,CONNECTION_TYPE,CARRIERS,VIDEO_ACTIONS,PACKAGE,_FIVETRAN_SYNCED -1,2021-09-15 02:44:56.000 +0000,111,222,2021-08-05 01:34:25.000 +0000,Ad group name one,PLACEMENT_TYPE_NORMAL,,,,,,,ON_WEB_REGISTER,,DYNAMIC,,GENDER_UNLIMITED,,,BUDGET_MODE_DAY,SCHEDULE_FROM_NOW,,CONVERT,,PACING_MODE_SMOOTH,OCPM,BID_TYPE_NO_BID,,,,ADGROUP_STATUS_DELIVERY_OK,ENABLE,,ALLOW_DOWNLOAD,,,,500,0,0,0,2021-08-05 02:30:23.000 +0000,2031-08-03 02:30:23.000 +0000,,543543543,FALSE,FALSE,TRUE,0,1,1,,,,[ 124938917 ],[ 124938917 ],[ 124938917 ],[ 124938917 ],[],[],"[ ""PLACEMENT_TIKTOK"" ]",,"[ ""AGE_25_34"", ""AGE_35_44"", ""AGE_45_54"", ""AGE_55_100"", ""AGE_18_24"" ]","[ ""en"" ]",[],[],[],[],,2021-09-15 02:47:55.652 +0000 -2,2021-09-15 00:52:08.000 +0000,222,333,2021-08-16 20:40:16.000 +0000,Ad group name two,PLACEMENT_TYPE_NORMAL,,,,,,,ON_WEB_REGISTER,,DYNAMIC,,GENDER_UNLIMITED,,,BUDGET_MODE_INFINITE,SCHEDULE_FROM_NOW,,CONVERT,,PACING_MODE_SMOOTH,OCPM,BID_TYPE_NO_BID,,,,ADGROUP_STATUS_DELIVERY_OK,ENABLE,,ALLOW_DOWNLOAD,,,,0,0,0,0,2021-08-17 13:00:08.000 +0000,2031-08-15 13:00:08.000 +0000,,543543543,FALSE,FALSE,TRUE,0,1,1,,,,[ 124938917 ],[ 124938917 ],[ 124938917 ],[ 124938917 ],[],[],"[ ""PLACEMENT_TIKTOK"" ]",,"[ ""AGE_25_34"", ""AGE_35_44"", ""AGE_45_54"", ""AGE_55_100"", ""AGE_18_24"" ]","[ ""en"" ]",[],[],[],[],,2021-09-15 02:47:55.643 +0000 -3,2021-09-15 02:44:55.000 +0000,333,444,2021-09-13 18:44:14.000 +0000,Ad group name three,PLACEMENT_TYPE_NORMAL,,,,,,,ON_WEB_REGISTER,,CUSTOM,,GENDER_UNLIMITED,,,BUDGET_MODE_DAY,SCHEDULE_FROM_NOW,,CONVERT,,PACING_MODE_SMOOTH,OCPM,BID_TYPE_NO_BID,,,,ADGROUP_STATUS_DELIVERY_OK,ENABLE,,ALLOW_DOWNLOAD,,,,900,0,0,0,2021-09-13 18:44:05.000 +0000,2031-09-11 18:44:05.000 +0000,,654645654,FALSE,FALSE,TRUE,0,1,1,,,,[ 124938917 ],[ 124938917 ],[ 124938917 ],[ 124938917 ],[],[],"[ ""PLACEMENT_TIKTOK"" ]",,"[ ""AGE_25_34"", ""AGE_35_44"", ""AGE_45_54"", ""AGE_55_100"", ""AGE_18_24"" ]","[ ""en"" ]",[],[],[],[],,2021-09-15 02:47:55.635 +0000 -4,2021-09-15 02:44:55.000 +0000,444,555,2021-09-13 19:21:33.000 +0000,Ad group name four,PLACEMENT_TYPE_NORMAL,,,,,,,ON_WEB_REGISTER,,DYNAMIC,,GENDER_UNLIMITED,,,BUDGET_MODE_DAY,SCHEDULE_FROM_NOW,,CONVERT,,PACING_MODE_SMOOTH,OCPM,BID_TYPE_NO_BID,,,,ADGROUP_STATUS_DELIVERY_OK,ENABLE,,ALLOW_DOWNLOAD,,,,500,0,0,0,2021-09-13 20:14:52.000 +0000,2031-09-11 20:14:52.000 +0000,,867876867,FALSE,FALSE,TRUE,0,1,1,,,,[ 124938917 ],[ 124938917 ],[ 124938917 ],[ 124938917 ],[],[],"[ ""PLACEMENT_TIKTOK"" ]",,"[ ""AGE_25_34"", ""AGE_35_44"", ""AGE_45_54"", ""AGE_55_100"", ""AGE_18_24"" ]","[ ""en"" ]",[],[],[],[],,2021-09-15 02:47:55.633 +0000 \ No newline at end of file +1,2021-09-15 02:44:56.000,111,222,2021-08-05 01:34:25.000,Ad group name one,PLACEMENT_TYPE_NORMAL,,,,,,,ON_WEB_REGISTER,,DYNAMIC,,GENDER_UNLIMITED,,,BUDGET_MODE_DAY,SCHEDULE_FROM_NOW,,CONVERT,,PACING_MODE_SMOOTH,OCPM,BID_TYPE_NO_BID,,,,ADGROUP_STATUS_DELIVERY_OK,ENABLE,,ALLOW_DOWNLOAD,,,,500,0,0,0,2021-08-05 02:30:23.000,2031-08-03 02:30:23.000,,543543543,FALSE,FALSE,TRUE,0,1,1,,,,[ 124938917 ],[ 124938917 ],[ 124938917 ],[ 124938917 ],[],[],"[ ""PLACEMENT_TIKTOK"" ]",,"[ ""AGE_25_34"", ""AGE_35_44"", ""AGE_45_54"", ""AGE_55_100"", ""AGE_18_24"" ]","[ ""en"" ]",[],[],[],[],,2021-09-15 02:47:55.652 +2,2021-09-15 00:52:08.000,222,333,2021-08-16 20:40:16.000,Ad group name two,PLACEMENT_TYPE_NORMAL,,,,,,,ON_WEB_REGISTER,,DYNAMIC,,GENDER_UNLIMITED,,,BUDGET_MODE_INFINITE,SCHEDULE_FROM_NOW,,CONVERT,,PACING_MODE_SMOOTH,OCPM,BID_TYPE_NO_BID,,,,ADGROUP_STATUS_DELIVERY_OK,ENABLE,,ALLOW_DOWNLOAD,,,,0,0,0,0,2021-08-17 13:00:08.000,2031-08-15 13:00:08.000,,543543543,FALSE,FALSE,TRUE,0,1,1,,,,[ 124938917 ],[ 124938917 ],[ 124938917 ],[ 124938917 ],[],[],"[ ""PLACEMENT_TIKTOK"" ]",,"[ ""AGE_25_34"", ""AGE_35_44"", ""AGE_45_54"", ""AGE_55_100"", ""AGE_18_24"" ]","[ ""en"" ]",[],[],[],[],,2021-09-15 02:47:55.643 +3,2021-09-15 02:44:55.000,333,444,2021-09-13 18:44:14.000,Ad group name three,PLACEMENT_TYPE_NORMAL,,,,,,,ON_WEB_REGISTER,,CUSTOM,,GENDER_UNLIMITED,,,BUDGET_MODE_DAY,SCHEDULE_FROM_NOW,,CONVERT,,PACING_MODE_SMOOTH,OCPM,BID_TYPE_NO_BID,,,,ADGROUP_STATUS_DELIVERY_OK,ENABLE,,ALLOW_DOWNLOAD,,,,900,0,0,0,2021-09-13 18:44:05.000,2031-09-11 18:44:05.000,,654645654,FALSE,FALSE,TRUE,0,1,1,,,,[ 124938917 ],[ 124938917 ],[ 124938917 ],[ 124938917 ],[],[],"[ ""PLACEMENT_TIKTOK"" ]",,"[ ""AGE_25_34"", ""AGE_35_44"", ""AGE_45_54"", ""AGE_55_100"", ""AGE_18_24"" ]","[ ""en"" ]",[],[],[],[],,2021-09-15 02:47:55.635 +4,2021-09-15 02:44:55.000,444,555,2021-09-13 19:21:33.000,Ad group name four,PLACEMENT_TYPE_NORMAL,,,,,,,ON_WEB_REGISTER,,DYNAMIC,,GENDER_UNLIMITED,,,BUDGET_MODE_DAY,SCHEDULE_FROM_NOW,,CONVERT,,PACING_MODE_SMOOTH,OCPM,BID_TYPE_NO_BID,,,,ADGROUP_STATUS_DELIVERY_OK,ENABLE,,ALLOW_DOWNLOAD,,,,500,0,0,0,2021-09-13 20:14:52.000,2031-09-11 20:14:52.000,,867876867,FALSE,FALSE,TRUE,0,1,1,,,,[ 124938917 ],[ 124938917 ],[ 124938917 ],[ 124938917 ],[],[],"[ ""PLACEMENT_TIKTOK"" ]",,"[ ""AGE_25_34"", ""AGE_35_44"", ""AGE_45_54"", ""AGE_55_100"", ""AGE_18_24"" ]","[ ""en"" ]",[],[],[],[],,2021-09-15 02:47:55.633 \ No newline at end of file diff --git a/integration_tests/seeds/tiktok_adgroup_report_hourly_data.csv b/integration_tests/seeds/tiktok_adgroup_report_hourly_data.csv index ec92421..61b04ea 100644 --- a/integration_tests/seeds/tiktok_adgroup_report_hourly_data.csv +++ b/integration_tests/seeds/tiktok_adgroup_report_hourly_data.csv @@ -1,5 +1,5 @@ ADGROUP_ID,STAT_TIME_HOUR,COST_PER_CONVERSION,REAL_TIME_CONVERSION,CPC,VIDEO_PLAY_ACTIONS,CONVERSION_RATE,VIDEO_VIEWS_P_75,RESULT,VIDEO_VIEWS_P_50,IMPRESSIONS,COMMENTS,REAL_TIME_COST_PER_RESULT,CONVERSION,REAL_TIME_RESULT,VIDEO_VIEWS_P_100,SHARES,REAL_TIME_CONVERSION_RATE,COST_PER_SECONDARY_GOAL_RESULT,SECONDARY_GOAL_RESULT_RATE,CLICKS,COST_PER_1000_REACHED,VIDEO_VIEWS_P_25,REACH,REAL_TIME_COST_PER_CONVERSION,PROFILE_VISITS_RATE,AVERAGE_VIDEO_PLAY,PROFILE_VISITS,CPM,CTR,VIDEO_WATCHED_2_S,FOLLOWS,RESULT_RATE,VIDEO_WATCHED_6_S,SECONDARY_GOAL_RESULT,COST_PER_RESULT,AVERAGE_VIDEO_PLAY_PER_USER,REAL_TIME_RESULT_RATE,SPEND,LIKES,_FIVETRAN_SYNCED -1,2021-09-15 5:00:00,0,0,1.77,555,0,33,0,38,32,0,0,0,0,3,0,0,-,-,2,18.44,150,333,0,0,5,0,17.99,1.22,333,0,0,133,-,0,4.66,0,7.6,3,2021-09-15 15:57:22.614 +0000 -2,2021-09-15 7:00:00,1.33,7,0.76,1111,39,33,5,33,3235,0,4.123,5,3,44,0,43.22,-,-,34,0,150,0,1.75,0,3.33,0,13.66,1.44,333,0,36.77,233,-,2.3342,0,38.88,17.22,3,2021-09-15 15:57:22.606 +0000 -3,2021-09-15 7:00:00,3.23,7,1,2222,33,33,7,443,3235,0,2.353,5,7,55,0,22,-,-,33,0,333,0,4.44,0,4.22,0,11.88,1.55,334,0,34,233,-,3.6212,0,22,25.33,4,2021-09-15 15:57:22.616 +0000 -4,2021-09-15 4:00:00,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-,-,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-,0,0,0,0,0,2021-09-15 15:57:22.616 +0000 \ No newline at end of file +1,2021-09-15 5:00:00,0,0,1.77,555,0,33,0,38,32,0,0,0,0,3,0,0,-,-,2,18.44,150,333,0,0,5,0,17.99,1.22,333,0,0,133,-,0,4.66,0,7.6,3,2021-09-15 15:57:22.614 +2,2021-09-15 7:00:00,1.33,7,0.76,1111,39,33,5,33,3235,0,4.123,5,3,44,0,43.22,-,-,34,0,150,0,1.75,0,3.33,0,13.66,1.44,333,0,36.77,233,-,2.3342,0,38.88,17.22,3,2021-09-15 15:57:22.606 +3,2021-09-15 7:00:00,3.23,7,1,2222,33,33,7,443,3235,0,2.353,5,7,55,0,22,-,-,33,0,333,0,4.44,0,4.22,0,11.88,1.55,334,0,34,233,-,3.6212,0,22,25.33,4,2021-09-15 15:57:22.616 +4,2021-09-15 4:00:00,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-,-,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-,0,0,0,0,0,2021-09-15 15:57:22.616 \ No newline at end of file diff --git a/integration_tests/seeds/tiktok_advertiser_data.csv b/integration_tests/seeds/tiktok_advertiser_data.csv index 9ad3ad7..2565a05 100644 --- a/integration_tests/seeds/tiktok_advertiser_data.csv +++ b/integration_tests/seeds/tiktok_advertiser_data.csv @@ -1,3 +1,3 @@ ID,NAME,ADDRESS,COMPANY,CONTACTER,COUNTRY,CURRENCY,DESCRIPTION,EMAIL,INDUSTRY,LICENSE_NO,LICENSE_URL,PROMOTION_AREA,REASON,ROLE,STATUS,TELEPHONE,TIMEZONE,BALANCE,CREATE_TIME,LANGUAGE,PHONE_NUMBER,_FIVETRAN_SYNCED -1,US,1600 pennsylvania avenue,White House,,US,USD,hello,louis@vuitton.com,123,,,111,,ROLE_ADVERTISER,STATUS_ENABLE,1,Etc/GMT+5,32.12,2021-08-27 18:13:41.000 +0000,en,string,2021-09-15 15:53:18.938 +0000 -2,Canada,21 w wacker st,Blanco House,,CAN,CAN,world,jeff@bezos.com,321,,,0,,ROLE_ADVERTISER,STATUS_ENABLE,1,Etc/GMT+5,321.22,2021-03-09 20:55:37.000 +0000,en,string,2021-09-15 15:53:07.621 +0000 \ No newline at end of file +1,US,1600 pennsylvania avenue,White House,,US,USD,hello,louis@vuitton.com,123,,,111,,ROLE_ADVERTISER,STATUS_ENABLE,1,Etc/GMT+5,32.12,2021-08-27 18:13:41.000,en,string,2021-09-15 15:53:18.938 +2,Canada,21 w wacker st,Blanco House,,CAN,CAN,world,jeff@bezos.com,321,,,0,,ROLE_ADVERTISER,STATUS_ENABLE,1,Etc/GMT+5,321.22,2021-03-09 20:55:37.000,en,string,2021-09-15 15:53:07.621 \ No newline at end of file diff --git a/integration_tests/seeds/tiktok_campaign_history_data.csv b/integration_tests/seeds/tiktok_campaign_history_data.csv index 7bb3120..383d484 100644 --- a/integration_tests/seeds/tiktok_campaign_history_data.csv +++ b/integration_tests/seeds/tiktok_campaign_history_data.csv @@ -1,5 +1,5 @@ CAMPAIGN_ID,UPDATED_AT,ADVERTISER_ID,CAMPAIGN_NAME,CAMPAIGN_TYPE,BUDGET,BUDGET_MODE,OPT_STATUS,OBJECTIVE_TYPE,IS_NEW_STRUCTURE,SPLIT_TEST_VARIABLE,CREATE_TIME,_FIVETRAN_SYNCED -1,2021-09-15 00:52:08.000 +0000,1,campaign name one,REGULAR_CAMPAIGN,450,BUDGET_MODE_DAY,ENABLE,CONVERSIONS,TRUE,,2021-08-16 20:40:15.000 +0000,2021-09-15 02:47:54.737 +0000 -2,2021-09-15 01:33:37.000 +0000,2,campaign name two,REGULAR_CAMPAIGN,300,BUDGET_MODE_DAY,ENABLE,CONVERSIONS,TRUE,,2021-08-16 20:29:06.000 +0000,2021-09-15 02:47:54.737 +0000 -3,2021-09-14 02:53:48.000 +0000,3,campaign name three,REGULAR_CAMPAIGN,450,BUDGET_MODE_DAY,ENABLE,CONVERSIONS,TRUE,,2021-08-16 20:40:15.000 +0000,2021-09-14 03:01:03.005 +0000 -4,2021-09-14 02:59:01.000 +0000,4,campaign name four,REGULAR_CAMPAIGN,300,BUDGET_MODE_DAY,ENABLE,CONVERSIONS,TRUE,,2021-08-16 20:29:06.000 +0000,2021-09-14 03:01:03.006 +0000 \ No newline at end of file +1,2021-09-15 00:52:08.000,1,campaign name one,REGULAR_CAMPAIGN,450,BUDGET_MODE_DAY,ENABLE,CONVERSIONS,TRUE,,2021-08-16 20:40:15.000,2021-09-15 02:47:54.737 +2,2021-09-15 01:33:37.000,2,campaign name two,REGULAR_CAMPAIGN,300,BUDGET_MODE_DAY,ENABLE,CONVERSIONS,TRUE,,2021-08-16 20:29:06.000,2021-09-15 02:47:54.737 +3,2021-09-14 02:53:48.000,3,campaign name three,REGULAR_CAMPAIGN,450,BUDGET_MODE_DAY,ENABLE,CONVERSIONS,TRUE,,2021-08-16 20:40:15.000,2021-09-14 03:01:03.005 +4,2021-09-14 02:59:01.000,4,campaign name four,REGULAR_CAMPAIGN,300,BUDGET_MODE_DAY,ENABLE,CONVERSIONS,TRUE,,2021-08-16 20:29:06.000,2021-09-14 03:01:03.006 \ No newline at end of file diff --git a/integration_tests/seeds/tiktok_campaign_report_hourly_data.csv b/integration_tests/seeds/tiktok_campaign_report_hourly_data.csv index 1515c79..dbf4271 100644 --- a/integration_tests/seeds/tiktok_campaign_report_hourly_data.csv +++ b/integration_tests/seeds/tiktok_campaign_report_hourly_data.csv @@ -1,5 +1,5 @@ CAMPAIGN_ID,STAT_TIME_HOUR,COST_PER_CONVERSION,REAL_TIME_CONVERSION,CPC,VIDEO_PLAY_ACTIONS,CONVERSION_RATE,VIDEO_VIEWS_P_75,RESULT,VIDEO_VIEWS_P_50,IMPRESSIONS,COMMENTS,REAL_TIME_COST_PER_RESULT,CONVERSION,REAL_TIME_RESULT,VIDEO_VIEWS_P_100,SHARES,REAL_TIME_CONVERSION_RATE,COST_PER_SECONDARY_GOAL_RESULT,SECONDARY_GOAL_RESULT_RATE,CLICKS,COST_PER_1000_REACHED,VIDEO_VIEWS_P_25,REACH,REAL_TIME_COST_PER_CONVERSION,PROFILE_VISITS_RATE,AVERAGE_VIDEO_PLAY,PROFILE_VISITS,CPM,CTR,VIDEO_WATCHED_2_S,FOLLOWS,RESULT_RATE,VIDEO_WATCHED_6_S,SECONDARY_GOAL_RESULT,COST_PER_RESULT,AVERAGE_VIDEO_PLAY_PER_USER,REAL_TIME_RESULT_RATE,SPEND,LIKES,_FIVETRAN_SYNCED -1,2021-09-15 5:00:00,0,0,1.88,32322,0,222,222,222,22222,0,3.3235,0,23423,33,0,0,-,-,22,2.234,233,22413,0,0,2.22,0,2.35,0.33,2222,0,22.35,322,-,35.32,2.13,22.22,222.12,22,2021-09-15 15:58:05.904 +0000 -2,2021-09-15 4:00:00,0,0,0,4,0,0,0,0,4,0,0,0,0,0,0,0,-,-,0,22,1,4,0,0,3.334,0,22,0,2,0,0,2,-,3,2.35,0,0.22,2,2021-09-15 15:58:05.905 +0000 -3,2021-09-15 8:00:00,2.3,22,2.2,222222,222,222,22,787,12222,0,4.12312,22,33,222,2,22.2,-,-,222,0,2335,0,2.55,0,3.52,0,22.22,0.232,3322,0,33.22,2222,-,2.2222,0,22.2,222.22,22,2021-09-15 15:58:05.903 +0000 -4,2021-09-15 10:00:00,0,0,0,15,0,1,0,1,22,0,0,0,0,1,0,0,-,-,0,0,2,0,0,0,3.324,0,22,0,3,0,0,4,-,0,0,0,0.232,22,2021-09-15 15:58:05.903 +0000 \ No newline at end of file +1,2021-09-15 5:00:00,0,0,1.88,32322,0,222,222,222,22222,0,3.3235,0,23423,33,0,0,-,-,22,2.234,233,22413,0,0,2.22,0,2.35,0.33,2222,0,22.35,322,-,35.32,2.13,22.22,222.12,22,2021-09-15 15:58:05.904 +2,2021-09-15 4:00:00,0,0,0,4,0,0,0,0,4,0,0,0,0,0,0,0,-,-,0,22,1,4,0,0,3.334,0,22,0,2,0,0,2,-,3,2.35,0,0.22,2,2021-09-15 15:58:05.905 +3,2021-09-15 8:00:00,2.3,22,2.2,222222,222,222,22,787,12222,0,4.12312,22,33,222,2,22.2,-,-,222,0,2335,0,2.55,0,3.52,0,22.22,0.232,3322,0,33.22,2222,-,2.2222,0,22.2,222.22,22,2021-09-15 15:58:05.903 +4,2021-09-15 10:00:00,0,0,0,15,0,1,0,1,22,0,0,0,0,1,0,0,-,-,0,0,2,0,0,0,3.324,0,22,0,3,0,0,4,-,0,0,0,0.232,22,2021-09-15 15:58:05.903 \ No newline at end of file From bc7b24308f969e042ee55558b587e7ba030184fd Mon Sep 17 00:00:00 2001 From: fivetran-reneeli Date: Fri, 22 Jul 2022 16:59:23 +0200 Subject: [PATCH 20/41] docs --- docs/manifest.json | 1 + docs/run_results.json | 1 + 2 files changed, 2 insertions(+) create mode 100644 docs/manifest.json create mode 100644 docs/run_results.json diff --git a/docs/manifest.json b/docs/manifest.json new file mode 100644 index 0000000..5726993 --- /dev/null +++ b/docs/manifest.json @@ -0,0 +1 @@ +{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v4.json", "dbt_version": "1.0.0", "generated_at": "2022-07-19T17:44:46.074116Z", "invocation_id": "6dabac40-7cab-45b6-976c-67e398be82f2", "env": {}, "project_id": "faebc42304447d4427374f806679ecb5", "user_id": "e607f749-4294-4b15-833b-0ae4a87d4d24", "send_anonymous_usage_stats": true, "adapter_type": "bigquery"}, "nodes": {"model.tiktok_ads.int_tiktok_ads__most_recent_campaign": {"raw_sql": "with base as (\n\n select *\n from {{ var('campaign_history') }}\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "ephemeral", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads", "intermediate", "int_tiktok_ads__most_recent_campaign"], "unique_id": "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "intermediate/int_tiktok_ads__most_recent_campaign.sql", "original_file_path": "models/intermediate/int_tiktok_ads__most_recent_campaign.sql", "name": "int_tiktok_ads__most_recent_campaign", "alias": "int_tiktok_ads__most_recent_campaign", "checksum": {"name": "sha256", "checksum": "6c395cfec3d0d6060d64883569154a087d790db7a438b72cea679e96e4fdd220"}, "tags": [], "refs": [["stg_tiktok_ads__campaign_history"]], "sources": [], "description": "Each record in this table represents the most recent data for each campaign.", "columns": {"campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_type": {"name": "campaign_type", "description": "Campaign Type, indicates the campaign is a regular campaign or iOS 14 campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "split_test_variable": {"name": "split_test_variable", "description": "Split Test variables. Optional values; TARGETING, BIDDING_OPTIMIZATION , CREATIVE.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/intermediate/intermediate.yml", "compiled_path": "target/compiled/tiktok_ads/models/intermediate/int_tiktok_ads__most_recent_campaign.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "ephemeral"}, "created_at": 1658244909.3519292, "compiled_sql": "with base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null}, "model.tiktok_ads.int_tiktok_ads__most_recent_ad": {"raw_sql": "with base as (\n\n select *\n from {{ var('ad_history') }}\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "ephemeral", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads", "intermediate", "int_tiktok_ads__most_recent_ad"], "unique_id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "intermediate/int_tiktok_ads__most_recent_ad.sql", "original_file_path": "models/intermediate/int_tiktok_ads__most_recent_ad.sql", "name": "int_tiktok_ads__most_recent_ad", "alias": "int_tiktok_ads__most_recent_ad", "checksum": {"name": "sha256", "checksum": "418d75ad47295f6fe67385f0c94e018602e4028dc4cf52a28e9f7006121ad7d7"}, "tags": [], "refs": [["stg_tiktok_ads__ad_history"]], "sources": [], "description": "Each record in this table represents the most recent data for each ad.", "columns": {"ad_id": {"name": "ad_id", "description": "Ad ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "base_url": {"name": "base_url", "description": "The base URL of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_name": {"name": "ad_name", "description": "Ad Name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_text": {"name": "ad_text", "description": "The ad text.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "call_to_action": {"name": "call_to_action", "description": "Call to action values.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "click_tracking_url": {"name": "click_tracking_url", "description": "Click monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impression_tracking_url": {"name": "impression_tracking_url", "description": "Display monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_host": {"name": "url_host", "description": "The URL host of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_path": {"name": "url_path", "description": "The URL path of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_source": {"name": "utm_source", "description": "The utm_source parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_medium": {"name": "utm_medium", "description": "The utm_medium parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_campaign": {"name": "utm_campaign", "description": "The utm_campaign parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_content": {"name": "utm_content", "description": "The utm_content parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_term": {"name": "utm_term", "description": "The utm_term parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_id": {"name": "video_id", "description": "The video ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/intermediate/intermediate.yml", "compiled_path": "target/compiled/tiktok_ads/models/intermediate/int_tiktok_ads__most_recent_ad.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "ephemeral"}, "created_at": 1658244909.348017, "compiled_sql": "with base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null}, "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group": {"raw_sql": "with base as (\n\n select *\n from {{ var('ad_group_history') }}\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "ephemeral", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads", "intermediate", "int_tiktok_ads__most_recent_ad_group"], "unique_id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "intermediate/int_tiktok_ads__most_recent_ad_group.sql", "original_file_path": "models/intermediate/int_tiktok_ads__most_recent_ad_group.sql", "name": "int_tiktok_ads__most_recent_ad_group", "alias": "int_tiktok_ads__most_recent_ad_group", "checksum": {"name": "sha256", "checksum": "a1d9693e48ac9773013bd17c70506c937b917254481075d677d7e989e9665358"}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_history"]], "sources": [], "description": "Each record in this table represents the most recent data for each ad group.", "columns": {"ad_group_id": {"name": "ad_group_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The Ad group's campaign ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_days": {"name": "action_days", "description": "Action days", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "Ad group name. Character limit is 512 and cannot contain emoji.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "age": {"name": "age", "description": "Age groups you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience_type": {"name": "audience_type", "description": "Audience Type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "category": {"name": "category", "description": "Ad group category.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "display_name": {"name": "display_name", "description": "Display name of ad group.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency": {"name": "frequency", "description": "frequency, together with frequency_schedule, controls how often people see your ad (only available for REACH ads). For example, frequency = 2 frequency_schedule = 3 means \"show ads no more than twice every 3 day\".\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency_schedule": {"name": "frequency_schedule", "description": "frequency, together with frequency, controls how often people see your ad (only available for REACH ads).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_download": {"name": "video_download", "description": "Whether the video is allowed to be downloaded.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "languages": {"name": "languages", "description": "Codes of the languages that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/intermediate/intermediate.yml", "compiled_path": "target/compiled/tiktok_ads/models/intermediate/int_tiktok_ads__most_recent_ad_group.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "ephemeral"}, "created_at": 1658244909.338349, "compiled_sql": "with base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__ad_group_history_tmp') }}\n\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__ad_group_history_tmp')),\n staging_columns=get_ad_group_history_columns()\n )\n }}\n\n from base\n\n), \n\nfinal as (\n\n select \n adgroup_id as ad_group_id,\n cast(updated_at as {{ dbt_utils.type_timestamp() }}) as updated_at,\n advertiser_id,\n campaign_id,\n action_days,\n action_categories,\n adgroup_name as ad_group_name,\n age,\n audience_type,\n budget,\n category,\n display_name,\n interest_category_v_2 as interest_category,\n frequency,\n frequency_schedule,\n gender,\n languages, \n landing_page_url,\n cast(_fivetran_synced as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced\n from fields\n\n), \n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by ad_group_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n\n)\n\nselect * from most_recent", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_ad_group_history_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.persist_docs"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__ad_group_history"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__ad_group_history.sql", "original_file_path": "models/stg_tiktok_ads__ad_group_history.sql", "name": "stg_tiktok_ads__ad_group_history", "alias": "stg_tiktok_ads__ad_group_history", "checksum": {"name": "sha256", "checksum": "4d843f63ac431a0500151055902258c50993aa9d985af1871c02a9c6acdf20ee"}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_history_tmp"], ["stg_tiktok_ads__ad_group_history_tmp"]], "sources": [], "description": "Each record represents data for each ad group.", "columns": {"ad_group_id": {"name": "ad_group_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_categories": {"name": "action_categories", "description": "IDs of the action categories (behaviors) that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The Ad group's campaign ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_days": {"name": "action_days", "description": "Action days", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "Ad group name. Character limit is 512 and cannot contain emoji.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "age": {"name": "age", "description": "Age groups you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience_type": {"name": "audience_type", "description": "Audience Type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget": {"name": "budget", "description": "Ad budget. Returns 0.0 when Campaign Budget Optimization (budget_optimize_switch) is on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "category": {"name": "category", "description": "Ad group category.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "display_name": {"name": "display_name", "description": "Display name of ad group.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "interest_category": {"name": "interest_category", "description": "Interest classification. If the interest is specified, users that do not meet interest target will be excluded during delivery.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency": {"name": "frequency", "description": "frequency, together with frequency_schedule, controls how often people see your ad (only available for REACH ads). For example, frequency = 2 frequency_schedule = 3 means \"show ads no more than twice every 3 day\".\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency_schedule": {"name": "frequency_schedule", "description": "frequency, together with frequency, controls how often people see your ad (only available for REACH ads).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "languages": {"name": "languages", "description": "Codes of the languages that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__ad_group_history.sql", "build_path": "target/run/tiktok_ads_source/models/stg_tiktok_ads__ad_group_history.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1658244909.520811, "compiled_sql": "with base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_group_history_tmp`\n\n), \n\nfields as (\n\n select\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n action_days\n \n as \n \n action_days\n \n, \n \n \n adgroup_id\n \n as \n \n adgroup_id\n \n, \n \n \n adgroup_name\n \n as \n \n adgroup_name\n \n, \n \n \n advertiser_id\n \n as \n \n advertiser_id\n \n, \n \n \n android_osv\n \n as \n \n android_osv\n \n, \n \n \n app_download_url\n \n as \n \n app_download_url\n \n, \n \n \n app_id\n \n as \n \n app_id\n \n, \n \n \n app_name\n \n as \n \n app_name\n \n, \n \n \n app_type\n \n as \n \n app_type\n \n, \n \n \n audience_type\n \n as \n \n audience_type\n \n, \n \n \n bid\n \n as \n \n bid\n \n, \n \n \n bid_type\n \n as \n \n bid_type\n \n, \n \n \n billing_event\n \n as \n \n billing_event\n \n, \n \n \n budget\n \n as \n \n budget\n \n, \n \n \n budget_mode\n \n as \n \n budget_mode\n \n, \n \n \n campaign_id\n \n as \n \n campaign_id\n \n, \n \n \n category\n \n as \n \n category\n \n, \n \n \n click_tracking_url\n \n as \n \n click_tracking_url\n \n, \n \n \n conversion_bid\n \n as \n \n conversion_bid\n \n, \n \n \n cpv_video_duration\n \n as \n \n cpv_video_duration\n \n, \n \n \n create_time\n \n as \n \n create_time\n \n, \n \n \n creative_material_mode\n \n as \n \n creative_material_mode\n \n, \n \n \n dayparting\n \n as \n \n dayparting\n \n, \n \n \n deep_bid_type\n \n as \n \n deep_bid_type\n \n, \n \n \n deep_cpabid\n \n as \n \n deep_cpabid\n \n, \n \n \n deep_external_action\n \n as \n \n deep_external_action\n \n, \n \n \n display_name\n \n as \n \n display_name\n \n, \n \n \n enable_inventory_filter\n \n as \n \n enable_inventory_filter\n \n, \n \n \n external_action\n \n as \n \n external_action\n \n, \n \n \n fallback_type\n \n as \n \n fallback_type\n \n, \n \n \n frequency\n \n as \n \n frequency\n \n, \n \n \n frequency_schedule\n \n as \n \n frequency_schedule\n \n, \n \n \n gender\n \n as \n \n gender\n \n, \n \n \n impression_tracking_url\n \n as \n \n impression_tracking_url\n \n, \n \n \n ios_osv\n \n as \n \n ios_osv\n \n, \n \n \n is_comment_disable\n \n as \n \n is_comment_disable\n \n, \n \n \n is_hfss\n \n as \n \n is_hfss\n \n, \n \n \n is_new_structure\n \n as \n \n is_new_structure\n \n, \n \n \n landing_page_url\n \n as \n \n landing_page_url\n \n, \n \n \n open_url\n \n as \n \n open_url\n \n, \n \n \n open_url_type\n \n as \n \n open_url_type\n \n, \n \n \n opt_status\n \n as \n \n opt_status\n \n, \n \n \n optimize_goal\n \n as \n \n optimize_goal\n \n, \n \n \n pacing\n \n as \n \n pacing\n \n, \n \n \n package\n \n as \n \n package\n \n, \n \n \n pixel_id\n \n as \n \n pixel_id\n \n, \n \n \n placement_type\n \n as \n \n placement_type\n \n, \n \n \n profile_image\n \n as \n \n profile_image\n \n, \n \n \n schedule_end_time\n \n as \n \n schedule_end_time\n \n, \n \n \n schedule_start_time\n \n as \n \n schedule_start_time\n \n, \n \n \n schedule_type\n \n as \n \n schedule_type\n \n, \n \n \n skip_learning_phase\n \n as \n \n skip_learning_phase\n \n, \n \n \n statistic_type\n \n as \n \n statistic_type\n \n, \n \n \n status\n \n as \n \n status\n \n, \n \n \n updated_at\n \n as \n \n updated_at\n \n, \n \n \n video_download\n \n as \n \n video_download\n \n, \n \n \n audience\n \n as \n \n audience\n \n, \n \n \n excluded_audience\n \n as \n \n excluded_audience\n \n, \n \n \n location\n \n as \n \n location\n \n, \n \n \n interest_category_v_2\n \n as \n \n interest_category_v_2\n \n, \n \n \n pangle_block_app_list_id\n \n as \n \n pangle_block_app_list_id\n \n, \n \n \n action_categories\n \n as \n \n action_categories\n \n, \n \n \n placement\n \n as \n \n placement\n \n, \n \n \n keywords\n \n as \n \n keywords\n \n, \n \n \n age\n \n as \n \n age\n \n, \n \n \n languages\n \n as \n \n languages\n \n\n\n\n\n from base\n\n), \n\nfinal as (\n\n select \n adgroup_id as ad_group_id,\n cast(updated_at as \n timestamp\n) as updated_at,\n advertiser_id,\n campaign_id,\n action_days,\n action_categories,\n adgroup_name as ad_group_name,\n age,\n audience_type,\n budget,\n category,\n display_name,\n interest_category_v_2 as interest_category,\n frequency,\n frequency_schedule,\n gender,\n languages, \n landing_page_url,\n cast(_fivetran_synced as \n timestamp\n) as _fivetran_synced\n from fields\n\n), \n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by ad_group_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n\n)\n\nselect * from most_recent", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_group_history`"}, "model.tiktok_ads_source.stg_tiktok_ads__advertiser": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__advertiser_tmp') }}\n\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__advertiser_tmp')),\n staging_columns=get_advertiser_columns()\n )\n }}\n\n from base\n\n), \n\nfinal as (\n\n select \n id as advertiser_id, \n address, \n balance, \n company, \n contacter, \n country, \n currency, \n description, \n email, \n industry, \n language,\n name as advertiser_name, \n phone_number, \n telephone, \n timezone,\n cast(_fivetran_synced as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced\n from fields\n\n)\n\nselect * from final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_advertiser_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.persist_docs"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp", "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__advertiser"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__advertiser.sql", "original_file_path": "models/stg_tiktok_ads__advertiser.sql", "name": "stg_tiktok_ads__advertiser", "alias": "stg_tiktok_ads__advertiser", "checksum": {"name": "sha256", "checksum": "ea57cac495f083449b4e4f35bd88581ac909156fdda0023a7a52ca0f43c6aa42"}, "tags": [], "refs": [["stg_tiktok_ads__advertiser_tmp"], ["stg_tiktok_ads__advertiser_tmp"]], "sources": [], "description": "Each record represents data for each advertiser.", "columns": {"advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "address": {"name": "address", "description": "Advertiser address information", "meta": {}, "data_type": null, "quote": null, "tags": []}, "balance": {"name": "balance", "description": "Account available balance", "meta": {}, "data_type": null, "quote": null, "tags": []}, "company": {"name": "company", "description": "Advertiser's company name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "contacter": {"name": "contacter", "description": "Contact Person", "meta": {}, "data_type": null, "quote": null, "tags": []}, "country": {"name": "country", "description": "The advertiser's country", "meta": {}, "data_type": null, "quote": null, "tags": []}, "create_time": {"name": "create_time", "description": "Advertiser's create time", "meta": {}, "data_type": null, "quote": null, "tags": []}, "currency": {"name": "currency", "description": "Type of currency used by advertisers", "meta": {}, "data_type": null, "quote": null, "tags": []}, "description": {"name": "description", "description": "Brand description, i.e. promotional content", "meta": {}, "data_type": null, "quote": null, "tags": []}, "email": {"name": "email", "description": "Advertiser contact email, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "industry": {"name": "industry", "description": "Advertiser industry category", "meta": {}, "data_type": null, "quote": null, "tags": []}, "language": {"name": "language", "description": "Language used by advertisers", "meta": {}, "data_type": null, "quote": null, "tags": []}, "license_no": {"name": "license_no", "description": "License number", "meta": {}, "data_type": null, "quote": null, "tags": []}, "license_url": {"name": "license_url", "description": "License preview address, the link is valid for an hour by default.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_name": {"name": "advertiser_name", "description": "Advertiser name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "phone_number": {"name": "phone_number", "description": "Contact mobile number, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "telephone": {"name": "telephone", "description": "Fixed phone number, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "timezone": {"name": "timezone", "description": "Ad account time zone including GMT offset", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__advertiser.sql", "build_path": "target/run/tiktok_ads_source/models/stg_tiktok_ads__advertiser.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1658244909.512266, "compiled_sql": "with base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__advertiser_tmp`\n\n), \n\nfields as (\n\n select\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n address\n \n as \n \n address\n \n, \n \n \n balance\n \n as \n \n balance\n \n, \n \n \n company\n \n as \n \n company\n \n, \n \n \n contacter\n \n as \n \n contacter\n \n, \n \n \n country\n \n as \n \n country\n \n, \n \n \n create_time\n \n as \n \n create_time\n \n, \n \n \n currency\n \n as \n \n currency\n \n, \n \n \n description\n \n as \n \n description\n \n, \n \n \n email\n \n as \n \n email\n \n, \n \n \n id\n \n as \n \n id\n \n, \n \n \n industry\n \n as \n \n industry\n \n, \n \n \n language\n \n as \n \n language\n \n, \n \n \n license_no\n \n as \n \n license_no\n \n, \n \n \n license_url\n \n as \n \n license_url\n \n, \n \n \n name\n \n as \n \n name\n \n, \n \n \n phone_number\n \n as \n \n phone_number\n \n, \n \n \n promotion_area\n \n as \n \n promotion_area\n \n, \n \n \n reason\n \n as \n \n reason\n \n, \n \n \n role\n \n as \n \n role\n \n, \n \n \n status\n \n as \n \n status\n \n, \n \n \n telephone\n \n as \n \n telephone\n \n, \n \n \n timezone\n \n as \n \n timezone\n \n\n\n\n\n from base\n\n), \n\nfinal as (\n\n select \n id as advertiser_id, \n address, \n balance, \n company, \n contacter, \n country, \n currency, \n description, \n email, \n industry, \n language,\n name as advertiser_name, \n phone_number, \n telephone, \n timezone,\n cast(_fivetran_synced as \n timestamp\n) as _fivetran_synced\n from fields\n\n)\n\nselect * from final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__advertiser`"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_history": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__ad_history_tmp') }}\n\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__ad_history_tmp')),\n staging_columns=get_ad_history_columns()\n )\n }}\n\n from base\n\n), \n\nfinal as (\n\n select \n ad_id,\n cast(updated_at as {{ dbt_utils.type_timestamp() }}) as updated_at,\n adgroup_id as ad_group_id,\n advertiser_id,\n campaign_id,\n ad_name,\n ad_text,\n call_to_action,\n click_tracking_url,\n impression_tracking_url,\n {{ dbt_utils.split_part('landing_page_url', \"'?'\", 1) }} as base_url,\n {{ dbt_utils.get_url_host('landing_page_url') }} as url_host,\n '/' || {{ dbt_utils.get_url_path('landing_page_url') }} as url_path,\n {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_source') }} as utm_source,\n {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_medium') }} as utm_medium,\n {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_campaign') }} as utm_campaign,\n {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_content') }} as utm_content,\n {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_term') }} as utm_term,\n landing_page_url,\n video_id,\n cast(_fivetran_synced as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced,\n from fields\n\n), \n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by ad_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n\n)\n\nselect * from most_recent", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_ad_history_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp", "macro.dbt_utils.split_part", "macro.dbt_utils.get_url_host", "macro.dbt_utils.get_url_path", "macro.dbt_utils.get_url_parameter", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.persist_docs"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__ad_history"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__ad_history.sql", "original_file_path": "models/stg_tiktok_ads__ad_history.sql", "name": "stg_tiktok_ads__ad_history", "alias": "stg_tiktok_ads__ad_history", "checksum": {"name": "sha256", "checksum": "0b295a3935ba7b401b8e8bec0a80f51ce4051c23a80416f981bdb90620e299a6"}, "tags": [], "refs": [["stg_tiktok_ads__ad_history_tmp"], ["stg_tiktok_ads__ad_history_tmp"]], "sources": [], "description": "Each record represents data for each ad.", "columns": {"ad_id": {"name": "ad_id", "description": "Ad ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "base_url": {"name": "base_url", "description": "The base URL of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_name": {"name": "ad_name", "description": "Ad Name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_text": {"name": "ad_text", "description": "The ad text.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "call_to_action": {"name": "call_to_action", "description": "Call to action values.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "click_tracking_url": {"name": "click_tracking_url", "description": "Click monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impression_tracking_url": {"name": "impression_tracking_url", "description": "Display monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_host": {"name": "url_host", "description": "The URL host of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_path": {"name": "url_path", "description": "The URL path of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_source": {"name": "utm_source", "description": "The utm_source parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_medium": {"name": "utm_medium", "description": "The utm_medium parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_campaign": {"name": "utm_campaign", "description": "The utm_campaign parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_content": {"name": "utm_content", "description": "The utm_content parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_term": {"name": "utm_term", "description": "The utm_term parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_id": {"name": "video_id", "description": "The video ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__ad_history.sql", "build_path": "target/run/tiktok_ads_source/models/stg_tiktok_ads__ad_history.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1658244909.5304372, "compiled_sql": "with base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_history_tmp`\n\n), \n\nfields as (\n\n select\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n ad_id\n \n as \n \n ad_id\n \n, \n \n \n ad_name\n \n as \n \n ad_name\n \n, \n \n \n ad_text\n \n as \n \n ad_text\n \n, \n \n \n adgroup_id\n \n as \n \n adgroup_id\n \n, \n \n \n advertiser_id\n \n as \n \n advertiser_id\n \n, \n \n \n app_name\n \n as \n \n app_name\n \n, \n \n \n call_to_action\n \n as \n \n call_to_action\n \n, \n \n \n campaign_id\n \n as \n \n campaign_id\n \n, \n \n \n click_tracking_url\n \n as \n \n click_tracking_url\n \n, \n \n \n create_time\n \n as \n \n create_time\n \n, \n \n \n display_name\n \n as \n \n display_name\n \n, \n \n \n impression_tracking_url\n \n as \n \n impression_tracking_url\n \n, \n \n \n is_aco\n \n as \n \n is_aco\n \n, \n \n \n is_creative_authorized\n \n as \n \n is_creative_authorized\n \n, \n \n \n is_new_structure\n \n as \n \n is_new_structure\n \n, \n \n \n landing_page_url\n \n as \n \n landing_page_url\n \n, \n \n \n open_url\n \n as \n \n open_url\n \n, \n \n \n opt_status\n \n as \n \n opt_status\n \n, \n \n \n playable_url\n \n as \n \n playable_url\n \n, \n \n \n profile_image\n \n as \n \n profile_image\n \n, \n \n \n status\n \n as \n \n status\n \n, \n \n \n updated_at\n \n as \n \n updated_at\n \n, \n \n \n video_id\n \n as \n \n video_id\n \n, \n \n \n image_ids\n \n as \n \n image_ids\n \n\n\n\n\n from base\n\n), \n\nfinal as (\n\n select \n ad_id,\n cast(updated_at as \n timestamp\n) as updated_at,\n adgroup_id as ad_group_id,\n advertiser_id,\n campaign_id,\n ad_name,\n ad_text,\n call_to_action,\n click_tracking_url,\n impression_tracking_url,\n \n\n \n split(\n landing_page_url,\n '?'\n )[safe_offset(0)]\n \n\n as base_url,\n \n safe_cast(\n\n \n split(\n \n\n \n split(\n \n\n replace(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'android-app://',\n ''\n )\n \n\n,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n '/'\n )[safe_offset(0)]\n \n\n,\n '?'\n )[safe_offset(0)]\n \n\n as \n string\n)\n as url_host,\n '/' || \n safe_cast(\n\n \n split(\n \n\n case when \n \n length(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n\n )-coalesce(\n nullif(\n\n strpos(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n '/'\n \n ), 0),\n \n\n strpos(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n '?'\n \n ) - 1\n ) = 0 \n then ''\n else \n substr(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n -1 * (\n \n length(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n\n )-coalesce(\n nullif(\n\n strpos(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n '/'\n \n ), 0),\n \n\n strpos(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n '?'\n \n ) - 1\n ))\n )\n end,\n '?'\n )[safe_offset(0)]\n \n\n as \n string\n)\n as url_path,\n nullif(\n\n \n split(\n \n\n \n split(\n landing_page_url,\n 'utm_source='\n )[safe_offset(1)]\n \n\n,\n '&'\n )[safe_offset(0)]\n \n\n,'') as utm_source,\n nullif(\n\n \n split(\n \n\n \n split(\n landing_page_url,\n 'utm_medium='\n )[safe_offset(1)]\n \n\n,\n '&'\n )[safe_offset(0)]\n \n\n,'') as utm_medium,\n nullif(\n\n \n split(\n \n\n \n split(\n landing_page_url,\n 'utm_campaign='\n )[safe_offset(1)]\n \n\n,\n '&'\n )[safe_offset(0)]\n \n\n,'') as utm_campaign,\n nullif(\n\n \n split(\n \n\n \n split(\n landing_page_url,\n 'utm_content='\n )[safe_offset(1)]\n \n\n,\n '&'\n )[safe_offset(0)]\n \n\n,'') as utm_content,\n nullif(\n\n \n split(\n \n\n \n split(\n landing_page_url,\n 'utm_term='\n )[safe_offset(1)]\n \n\n,\n '&'\n )[safe_offset(0)]\n \n\n,'') as utm_term,\n landing_page_url,\n video_id,\n cast(_fivetran_synced as \n timestamp\n) as _fivetran_synced,\n from fields\n\n), \n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by ad_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n\n)\n\nselect * from most_recent", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_history`"}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_history": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__campaign_history_tmp') }}\n\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__campaign_history_tmp')),\n staging_columns=get_campaign_history_columns()\n )\n }}\n \n from base\n\n), \n\nfinal as (\n\n select \n campaign_id, \n cast(updated_at as {{ dbt_utils.type_timestamp() }}) as updated_at,\n advertiser_id, \n campaign_name, \n campaign_type, \n split_test_variable,\n cast(_fivetran_synced as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced\n\n from fields\n\n), \n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by campaign_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n\n)\n\nselect * from most_recent", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_campaign_history_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.persist_docs"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__campaign_history"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__campaign_history.sql", "original_file_path": "models/stg_tiktok_ads__campaign_history.sql", "name": "stg_tiktok_ads__campaign_history", "alias": "stg_tiktok_ads__campaign_history", "checksum": {"name": "sha256", "checksum": "35a02027d9ca3690939568301f43e56471c777fbf33db541cf46d48626a7e8fe"}, "tags": [], "refs": [["stg_tiktok_ads__campaign_history_tmp"], ["stg_tiktok_ads__campaign_history_tmp"]], "sources": [], "description": "Each record represents data for each campaign.", "columns": {"campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_type": {"name": "campaign_type", "description": "Campaign Type, indicates the campaign is a regular campaign or iOS 14 campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "split_test_variable": {"name": "split_test_variable", "description": "Split Test variables. Optional values; TARGETING, BIDDING_OPTIMIZATION , CREATIVE.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__campaign_history.sql", "build_path": "target/run/tiktok_ads_source/models/stg_tiktok_ads__campaign_history.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1658244909.534303, "compiled_sql": "with base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_history_tmp`\n\n), \n\nfields as (\n\n select\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n advertiser_id\n \n as \n \n advertiser_id\n \n, \n \n \n budget\n \n as \n \n budget\n \n, \n \n \n budget_mode\n \n as \n \n budget_mode\n \n, \n \n \n campaign_id\n \n as \n \n campaign_id\n \n, \n \n \n campaign_name\n \n as \n \n campaign_name\n \n, \n \n \n campaign_type\n \n as \n \n campaign_type\n \n, \n \n \n create_time\n \n as \n \n create_time\n \n, \n \n \n is_new_structure\n \n as \n \n is_new_structure\n \n, \n \n \n objective_type\n \n as \n \n objective_type\n \n, \n \n \n opt_status\n \n as \n \n opt_status\n \n, \n \n \n split_test_variable\n \n as \n \n split_test_variable\n \n, \n \n \n updated_at\n \n as \n \n updated_at\n \n\n\n\n \n from base\n\n), \n\nfinal as (\n\n select \n campaign_id, \n cast(updated_at as \n timestamp\n) as updated_at,\n advertiser_id, \n campaign_name, \n campaign_type, \n split_test_variable,\n cast(_fivetran_synced as \n timestamp\n) as _fivetran_synced\n\n from fields\n\n), \n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by campaign_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n\n)\n\nselect * from most_recent", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_history`"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp": {"raw_sql": "select *\nfrom {{ var('ad_report_hourly') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt.create_or_replace_view", "macro.dbt.persist_docs"], "nodes": ["source.tiktok_ads_source.tiktok_ads.ad_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__ad_report_hourly_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__ad_report_hourly_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__ad_report_hourly_tmp.sql", "name": "stg_tiktok_ads__ad_report_hourly_tmp", "alias": "stg_tiktok_ads__ad_report_hourly_tmp", "checksum": {"name": "sha256", "checksum": "a487182a6ea56715aff4fb53a16e8e185223097096f8b06c53beeaf354bffb3f"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "ad_report_hourly"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_report_hourly_tmp.sql", "build_path": "target/run/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_report_hourly_tmp.sql", "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1658244909.106455, "compiled_sql": "select *\nfrom `database`.`tiktok_ads_joe`.`ad_report_hourly`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_report_hourly_tmp`"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp": {"raw_sql": "select *\nfrom {{ var('ad_history') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt.create_or_replace_view", "macro.dbt.persist_docs"], "nodes": ["source.tiktok_ads_source.tiktok_ads.ad_history"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__ad_history_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__ad_history_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__ad_history_tmp.sql", "name": "stg_tiktok_ads__ad_history_tmp", "alias": "stg_tiktok_ads__ad_history_tmp", "checksum": {"name": "sha256", "checksum": "a57ca2d986b3dbad7d2bbd8b0a0dd7c992c25bc5cda65daee19e3541f40b6890"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "ad_history"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_history_tmp.sql", "build_path": "target/run/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_history_tmp.sql", "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1658244909.114927, "compiled_sql": "select *\nfrom `database`.`tiktok_ads_joe`.`ad_history`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_history_tmp`"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp": {"raw_sql": "select *\nfrom {{ var('ad_group_history') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt.create_or_replace_view", "macro.dbt.persist_docs"], "nodes": ["source.tiktok_ads_source.tiktok_ads.adgroup_history"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__ad_group_history_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__ad_group_history_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__ad_group_history_tmp.sql", "name": "stg_tiktok_ads__ad_group_history_tmp", "alias": "stg_tiktok_ads__ad_group_history_tmp", "checksum": {"name": "sha256", "checksum": "b3d1b8772b0465ed063cfa1f77cb9384475c21fa4ac9f970065e3da5c327ad1a"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "adgroup_history"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_group_history_tmp.sql", "build_path": "target/run/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_group_history_tmp.sql", "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1658244909.122536, "compiled_sql": "select *\nfrom `database`.`tiktok_ads_joe`.`adgroup_history`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_group_history_tmp`"}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp": {"raw_sql": "select *\nfrom {{ var('campaign_report_hourly') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt.create_or_replace_view", "macro.dbt.persist_docs"], "nodes": ["source.tiktok_ads_source.tiktok_ads.campaign_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__campaign_report_hourly_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__campaign_report_hourly_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__campaign_report_hourly_tmp.sql", "name": "stg_tiktok_ads__campaign_report_hourly_tmp", "alias": "stg_tiktok_ads__campaign_report_hourly_tmp", "checksum": {"name": "sha256", "checksum": "198e8d143514167295dfe352776c5050850cb7bc60e46b122a6a0a0da08a14ce"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "campaign_report_hourly"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__campaign_report_hourly_tmp.sql", "build_path": "target/run/tiktok_ads_source/models/tmp/stg_tiktok_ads__campaign_report_hourly_tmp.sql", "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1658244909.13061, "compiled_sql": "select *\nfrom `database`.`tiktok_ads_joe`.`campaign_report_hourly`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_report_hourly_tmp`"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp": {"raw_sql": "select *\nfrom {{ var('ad_group_hourly') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt.create_or_replace_view", "macro.dbt.persist_docs"], "nodes": ["source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__ad_group_report_hourly_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__ad_group_report_hourly_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__ad_group_report_hourly_tmp.sql", "name": "stg_tiktok_ads__ad_group_report_hourly_tmp", "alias": "stg_tiktok_ads__ad_group_report_hourly_tmp", "checksum": {"name": "sha256", "checksum": "187c3f6f290dd9846646843a108714a51fff1700c838c4c7e58852db64a1edfd"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "adgroup_report_hourly"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_group_report_hourly_tmp.sql", "build_path": "target/run/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_group_report_hourly_tmp.sql", "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1658244909.138232, "compiled_sql": "select *\nfrom `database`.`tiktok_ads_joe`.`adgroup_report_hourly`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_group_report_hourly_tmp`"}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp": {"raw_sql": "select *\nfrom {{ var('campaign_history') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt.create_or_replace_view", "macro.dbt.persist_docs"], "nodes": ["source.tiktok_ads_source.tiktok_ads.campaign_history"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__campaign_history_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__campaign_history_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__campaign_history_tmp.sql", "name": "stg_tiktok_ads__campaign_history_tmp", "alias": "stg_tiktok_ads__campaign_history_tmp", "checksum": {"name": "sha256", "checksum": "d695c134485444137d663f41732085a5cfa81de49f3ec2676e9f8e58f1c62c02"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "campaign_history"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__campaign_history_tmp.sql", "build_path": "target/run/tiktok_ads_source/models/tmp/stg_tiktok_ads__campaign_history_tmp.sql", "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1658244909.14746, "compiled_sql": "select *\nfrom `database`.`tiktok_ads_joe`.`campaign_history`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_history_tmp`"}, "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp": {"raw_sql": "select *\nfrom {{ var('advertiser') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt.create_or_replace_view", "macro.dbt.persist_docs"], "nodes": ["source.tiktok_ads_source.tiktok_ads.advertiser"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__advertiser_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__advertiser_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__advertiser_tmp.sql", "name": "stg_tiktok_ads__advertiser_tmp", "alias": "stg_tiktok_ads__advertiser_tmp", "checksum": {"name": "sha256", "checksum": "2806a63477df7962ac6a4476e3e514a47ae56470e95f490e88b58696a99c2fcf"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "advertiser"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__advertiser_tmp.sql", "build_path": "target/run/tiktok_ads_source/models/tmp/stg_tiktok_ads__advertiser_tmp.sql", "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1658244909.176338, "compiled_sql": "select *\nfrom `database`.`tiktok_ads_joe`.`advertiser`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__advertiser_tmp`"}, "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.fcb8c561bc": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_group_id", "model": "{{ get_where_subquery(ref('int_tiktok_ads__most_recent_ad_group')) }}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad_group"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "intermediate", "not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id"], "unique_id": "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.fcb8c561bc", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.sql", "original_file_path": "models/intermediate/intermediate.yml", "name": "not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id", "alias": "not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["int_tiktok_ads__most_recent_ad_group"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1658244909.3530219, "column_name": "ad_group_id", "file_key_name": "models.int_tiktok_ads__most_recent_ad_group"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at.e2e9914076": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_7aae7967f01788b5ccce56d37f64c75b\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_group_id", "updated_at"], "model": "{{ get_where_subquery(ref('int_tiktok_ads__most_recent_ad_group')) }}"}, "namespace": "dbt_utils"}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad_group"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_7aae7967f01788b5ccce56d37f64c75b", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "intermediate", "dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at.e2e9914076", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_7aae7967f01788b5ccce56d37f64c75b.sql", "original_file_path": "models/intermediate/intermediate.yml", "name": "dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at", "alias": "dbt_utils_unique_combination_o_7aae7967f01788b5ccce56d37f64c75b", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["int_tiktok_ads__most_recent_ad_group"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_7aae7967f01788b5ccce56d37f64c75b"}, "created_at": 1658244909.355435, "column_name": null, "file_key_name": "models.int_tiktok_ads__most_recent_ad_group"}, "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_ad_id.14e9c145ca": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_id", "model": "{{ get_where_subquery(ref('int_tiktok_ads__most_recent_ad')) }}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "intermediate", "not_null_int_tiktok_ads__most_recent_ad_ad_id"], "unique_id": "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_ad_id.14e9c145ca", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_int_tiktok_ads__most_recent_ad_ad_id.sql", "original_file_path": "models/intermediate/intermediate.yml", "name": "not_null_int_tiktok_ads__most_recent_ad_ad_id", "alias": "not_null_int_tiktok_ads__most_recent_ad_ad_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["int_tiktok_ads__most_recent_ad"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1658244909.361087, "column_name": "ad_id", "file_key_name": "models.int_tiktok_ads__most_recent_ad"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at.f58d824f65": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_82db7b1c335645aabf3916a22992c42a\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_id", "updated_at"], "model": "{{ get_where_subquery(ref('int_tiktok_ads__most_recent_ad')) }}"}, "namespace": "dbt_utils"}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_82db7b1c335645aabf3916a22992c42a", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "intermediate", "dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at.f58d824f65", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_82db7b1c335645aabf3916a22992c42a.sql", "original_file_path": "models/intermediate/intermediate.yml", "name": "dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at", "alias": "dbt_utils_unique_combination_o_82db7b1c335645aabf3916a22992c42a", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["int_tiktok_ads__most_recent_ad"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_82db7b1c335645aabf3916a22992c42a"}, "created_at": 1658244909.363595, "column_name": null, "file_key_name": "models.int_tiktok_ads__most_recent_ad"}, "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_campaign_campaign_id.8cefa8981c": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "campaign_id", "model": "{{ get_where_subquery(ref('int_tiktok_ads__most_recent_campaign')) }}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.tiktok_ads.int_tiktok_ads__most_recent_campaign"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "intermediate", "not_null_int_tiktok_ads__most_recent_campaign_campaign_id"], "unique_id": "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_campaign_campaign_id.8cefa8981c", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_int_tiktok_ads__most_recent_campaign_campaign_id.sql", "original_file_path": "models/intermediate/intermediate.yml", "name": "not_null_int_tiktok_ads__most_recent_campaign_campaign_id", "alias": "not_null_int_tiktok_ads__most_recent_campaign_campaign_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["int_tiktok_ads__most_recent_campaign"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1658244909.3695822, "column_name": "campaign_id", "file_key_name": "models.int_tiktok_ads__most_recent_campaign"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at.39077adf71": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_8456719f1ebbe11b109db2e39e0239ce\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["campaign_id", "updated_at"], "model": "{{ get_where_subquery(ref('int_tiktok_ads__most_recent_campaign')) }}"}, "namespace": "dbt_utils"}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.int_tiktok_ads__most_recent_campaign"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_8456719f1ebbe11b109db2e39e0239ce", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "intermediate", "dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at.39077adf71", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_8456719f1ebbe11b109db2e39e0239ce.sql", "original_file_path": "models/intermediate/intermediate.yml", "name": "dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at", "alias": "dbt_utils_unique_combination_o_8456719f1ebbe11b109db2e39e0239ce", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["int_tiktok_ads__most_recent_campaign"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_8456719f1ebbe11b109db2e39e0239ce"}, "created_at": 1658244909.3716831, "column_name": null, "file_key_name": "models.int_tiktok_ads__most_recent_campaign"}, "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66": {"raw_sql": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "unique", "kwargs": {"column_name": "advertiser_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__advertiser')) }}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_unique"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "unique_stg_tiktok_ads__advertiser_advertiser_id"], "unique_id": "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "unique_stg_tiktok_ads__advertiser_advertiser_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "unique_stg_tiktok_ads__advertiser_advertiser_id", "alias": "unique_stg_tiktok_ads__advertiser_advertiser_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__advertiser"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1658244909.572356, "column_name": "advertiser_id", "file_key_name": "models.stg_tiktok_ads__advertiser"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "advertiser_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__advertiser')) }}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__advertiser_advertiser_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__advertiser_advertiser_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__advertiser_advertiser_id", "alias": "not_null_stg_tiktok_ads__advertiser_advertiser_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__advertiser"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1658244909.574541, "column_name": "advertiser_id", "file_key_name": "models.stg_tiktok_ads__advertiser"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_group_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_group_history')) }}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__ad_group_history_ad_group_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__ad_group_history_ad_group_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__ad_group_history_ad_group_id", "alias": "not_null_stg_tiktok_ads__ad_group_history_ad_group_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1658244909.576759, "column_name": "ad_group_id", "file_key_name": "models.stg_tiktok_ads__ad_group_history"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_group_id", "updated_at"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_group_history')) }}"}, "namespace": "dbt_utils"}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at", "alias": "dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8"}, "created_at": 1658244909.578942, "column_name": null, "file_key_name": "models.stg_tiktok_ads__ad_group_history"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_history')) }}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__ad_history_ad_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__ad_history_ad_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__ad_history_ad_id", "alias": "not_null_stg_tiktok_ads__ad_history_ad_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1658244909.585593, "column_name": "ad_id", "file_key_name": "models.stg_tiktok_ads__ad_history"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_id", "updated_at"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_history')) }}"}, "namespace": "dbt_utils"}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at", "alias": "dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f"}, "created_at": 1658244909.588042, "column_name": null, "file_key_name": "models.stg_tiktok_ads__ad_history"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "campaign_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__campaign_history')) }}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__campaign_history_campaign_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__campaign_history_campaign_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__campaign_history_campaign_id", "alias": "not_null_stg_tiktok_ads__campaign_history_campaign_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__campaign_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1658244909.593933, "column_name": "campaign_id", "file_key_name": "models.stg_tiktok_ads__campaign_history"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["campaign_id", "updated_at"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__campaign_history')) }}"}, "namespace": "dbt_utils"}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at", "alias": "dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__campaign_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000"}, "created_at": 1658244909.596266, "column_name": null, "file_key_name": "models.stg_tiktok_ads__campaign_history"}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__campaign_report_hourly_tmp') }}\n\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__campaign_report_hourly_tmp')),\n staging_columns=get_campaign_report_hourly_columns()\n )\n }}\n\n from base\n\n), \n\nfinal as (\n\n select \n campaign_id, \n cast(_fivetran_synced as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced,\n stat_time_hour, \n cpc, \n cpm, \n ctr, \n impressions, \n clicks, \n spend, \n reach, \n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n \n {% for metric in var('tiktok_ads__campaign_hourly_passthrough_metrics', []) %}\n , {{ metric }}\n {% endfor %}\n from fields\n\n)\n\nselect * from final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_campaign_report_hourly_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.persist_docs"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__campaign_report_hourly"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__campaign_report_hourly.sql", "original_file_path": "models/stg_tiktok_ads__campaign_report_hourly.sql", "name": "stg_tiktok_ads__campaign_report_hourly", "alias": "stg_tiktok_ads__campaign_report_hourly", "checksum": {"name": "sha256", "checksum": "36cebad79aa22bc918fc4519ead62167487f301b20b999adf52c0ce500c2d1ff"}, "tags": [], "refs": [["stg_tiktok_ads__campaign_report_hourly_tmp"], ["stg_tiktok_ads__campaign_report_hourly_tmp"]], "sources": [], "description": "Each record represent data for each campaign for each hour.", "columns": {"campaign_id": {"name": "campaign_id", "description": "Campaign id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time per user your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__campaign_report_hourly.sql", "build_path": "target/run/tiktok_ads_source/models/stg_tiktok_ads__campaign_report_hourly.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1658250907.4618518, "compiled_sql": "with base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_report_hourly_tmp`\n\n), \n\nfields as (\n\n select\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n average_video_play\n \n as \n \n average_video_play\n \n, \n \n \n average_video_play_per_user\n \n as \n \n average_video_play_per_user\n \n, \n \n \n campaign_id\n \n as \n \n campaign_id\n \n, \n \n \n clicks\n \n as \n \n clicks\n \n, \n \n \n comments\n \n as \n \n comments\n \n, \n \n \n conversion\n \n as \n \n conversion\n \n, \n \n \n conversion_rate\n \n as \n \n conversion_rate\n \n, \n \n \n cost_per_1000_reached\n \n as \n \n cost_per_1000_reached\n \n, \n \n \n cost_per_conversion\n \n as \n \n cost_per_conversion\n \n, \n \n \n cost_per_result\n \n as \n \n cost_per_result\n \n, \n \n \n cost_per_secondary_goal_result\n \n as \n \n cost_per_secondary_goal_result\n \n, \n \n \n cpc\n \n as \n \n cpc\n \n, \n \n \n cpm\n \n as \n \n cpm\n \n, \n \n \n ctr\n \n as \n \n ctr\n \n, \n \n \n follows\n \n as \n \n follows\n \n, \n \n \n impressions\n \n as \n \n impressions\n \n, \n \n \n likes\n \n as \n \n likes\n \n, \n \n \n profile_visits\n \n as \n \n profile_visits\n \n, \n \n \n profile_visits_rate\n \n as \n \n profile_visits_rate\n \n, \n \n \n reach\n \n as \n \n reach\n \n, \n \n \n real_time_conversion\n \n as \n \n real_time_conversion\n \n, \n \n \n real_time_conversion_rate\n \n as \n \n real_time_conversion_rate\n \n, \n \n \n real_time_cost_per_conversion\n \n as \n \n real_time_cost_per_conversion\n \n, \n \n \n real_time_cost_per_result\n \n as \n \n real_time_cost_per_result\n \n, \n \n \n real_time_result\n \n as \n \n real_time_result\n \n, \n \n \n real_time_result_rate\n \n as \n \n real_time_result_rate\n \n, \n \n \n result\n \n as \n \n result\n \n, \n \n \n result_rate\n \n as \n \n result_rate\n \n, \n \n \n secondary_goal_result\n \n as \n \n secondary_goal_result\n \n, \n \n \n secondary_goal_result_rate\n \n as \n \n secondary_goal_result_rate\n \n, \n \n \n shares\n \n as \n \n shares\n \n, \n \n \n spend\n \n as \n \n spend\n \n, \n \n \n stat_time_hour\n \n as \n \n stat_time_hour\n \n, \n \n \n video_play_actions\n \n as \n \n video_play_actions\n \n, \n \n \n video_views_p_100\n \n as \n \n video_views_p_100\n \n, \n \n \n video_views_p_25\n \n as \n \n video_views_p_25\n \n, \n \n \n video_views_p_50\n \n as \n \n video_views_p_50\n \n, \n \n \n video_views_p_75\n \n as \n \n video_views_p_75\n \n, \n \n \n video_watched_2_s\n \n as \n \n video_watched_2_s\n \n, \n \n \n video_watched_6_s\n \n as \n \n video_watched_6_s\n \n\n\n\n\n from base\n\n), \n\nfinal as (\n\n select \n campaign_id, \n cast(_fivetran_synced as \n timestamp\n) as _fivetran_synced,\n stat_time_hour, \n cpc, \n cpm, \n ctr, \n impressions, \n clicks, \n spend, \n reach, \n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n \n \n from fields\n\n)\n\nselect * from final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_report_hourly`"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__ad_group_report_hourly_tmp') }}\n\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__ad_group_report_hourly_tmp')),\n staging_columns=get_ad_group_report_hourly_columns()\n )\n }}\n\n from base\n\n), \n\nfinal as (\n\n select \n adgroup_id as ad_group_id, \n cast(_fivetran_synced as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced,\n stat_time_hour, \n cpc, \n cpm, \n ctr, \n impressions, \n clicks, \n spend, \n reach, \n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n \n {% for metric in var('tiktok_ads__ad_group_hourly_passthrough_metrics', []) %}\n , {{ metric }}\n {% endfor %}\n from fields\n\n) \n\nselect * from final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_ad_group_report_hourly_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.persist_docs"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__ad_group_report_hourly"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__ad_group_report_hourly.sql", "original_file_path": "models/stg_tiktok_ads__ad_group_report_hourly.sql", "name": "stg_tiktok_ads__ad_group_report_hourly", "alias": "stg_tiktok_ads__ad_group_report_hourly", "checksum": {"name": "sha256", "checksum": "2beb5b8fdc28d5e19f8dc9a15a966aab1b0d0836b74f2977d5360e061c1ff89a"}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_report_hourly_tmp"], ["stg_tiktok_ads__ad_group_report_hourly_tmp"]], "sources": [], "description": "Each record represents data for each ad group for each hour.", "columns": {"ad_group_id": {"name": "ad_group_id", "description": "Ad group id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time per user your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__ad_group_report_hourly.sql", "build_path": "target/run/tiktok_ads_source/models/stg_tiktok_ads__ad_group_report_hourly.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1658250907.474358, "compiled_sql": "with base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_group_report_hourly_tmp`\n\n), \n\nfields as (\n\n select\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n adgroup_id\n \n as \n \n adgroup_id\n \n, \n \n \n average_video_play\n \n as \n \n average_video_play\n \n, \n \n \n average_video_play_per_user\n \n as \n \n average_video_play_per_user\n \n, \n \n \n clicks\n \n as \n \n clicks\n \n, \n \n \n comments\n \n as \n \n comments\n \n, \n \n \n conversion\n \n as \n \n conversion\n \n, \n \n \n conversion_rate\n \n as \n \n conversion_rate\n \n, \n \n \n cost_per_1000_reached\n \n as \n \n cost_per_1000_reached\n \n, \n \n \n cost_per_conversion\n \n as \n \n cost_per_conversion\n \n, \n \n \n cost_per_result\n \n as \n \n cost_per_result\n \n, \n \n \n cost_per_secondary_goal_result\n \n as \n \n cost_per_secondary_goal_result\n \n, \n \n \n cpc\n \n as \n \n cpc\n \n, \n \n \n cpm\n \n as \n \n cpm\n \n, \n \n \n ctr\n \n as \n \n ctr\n \n, \n \n \n follows\n \n as \n \n follows\n \n, \n \n \n impressions\n \n as \n \n impressions\n \n, \n \n \n likes\n \n as \n \n likes\n \n, \n \n \n profile_visits\n \n as \n \n profile_visits\n \n, \n \n \n profile_visits_rate\n \n as \n \n profile_visits_rate\n \n, \n \n \n reach\n \n as \n \n reach\n \n, \n \n \n real_time_conversion\n \n as \n \n real_time_conversion\n \n, \n \n \n real_time_conversion_rate\n \n as \n \n real_time_conversion_rate\n \n, \n \n \n real_time_cost_per_conversion\n \n as \n \n real_time_cost_per_conversion\n \n, \n \n \n real_time_cost_per_result\n \n as \n \n real_time_cost_per_result\n \n, \n \n \n real_time_result\n \n as \n \n real_time_result\n \n, \n \n \n real_time_result_rate\n \n as \n \n real_time_result_rate\n \n, \n \n \n result\n \n as \n \n result\n \n, \n \n \n result_rate\n \n as \n \n result_rate\n \n, \n \n \n secondary_goal_result\n \n as \n \n secondary_goal_result\n \n, \n \n \n secondary_goal_result_rate\n \n as \n \n secondary_goal_result_rate\n \n, \n \n \n shares\n \n as \n \n shares\n \n, \n \n \n spend\n \n as \n \n spend\n \n, \n \n \n stat_time_hour\n \n as \n \n stat_time_hour\n \n, \n \n \n video_play_actions\n \n as \n \n video_play_actions\n \n, \n \n \n video_views_p_100\n \n as \n \n video_views_p_100\n \n, \n \n \n video_views_p_25\n \n as \n \n video_views_p_25\n \n, \n \n \n video_views_p_50\n \n as \n \n video_views_p_50\n \n, \n \n \n video_views_p_75\n \n as \n \n video_views_p_75\n \n, \n \n \n video_watched_2_s\n \n as \n \n video_watched_2_s\n \n, \n \n \n video_watched_6_s\n \n as \n \n video_watched_6_s\n \n\n\n\n\n from base\n\n), \n\nfinal as (\n\n select \n adgroup_id as ad_group_id, \n cast(_fivetran_synced as \n timestamp\n) as _fivetran_synced,\n stat_time_hour, \n cpc, \n cpm, \n ctr, \n impressions, \n clicks, \n spend, \n reach, \n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n \n \n from fields\n\n) \n\nselect * from final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_group_report_hourly`"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__ad_report_hourly_tmp') }}\n\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__ad_report_hourly_tmp')),\n staging_columns=get_ad_report_hourly_columns()\n )\n }}\n\n from base\n\n), \n\nfinal as (\n\n select \n ad_id, \n cast(_fivetran_synced as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced,\n stat_time_hour, \n cpc, \n cpm, \n ctr, \n impressions, \n clicks, \n spend, \n reach, \n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n \n {% for metric in var('tiktok_ads__ad_hourly_passthrough_metrics', []) %}\n , {{ metric }}\n {% endfor %}\n from fields\n\n)\n\nselect * from final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_ad_report_hourly_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.persist_docs"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__ad_report_hourly"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__ad_report_hourly.sql", "original_file_path": "models/stg_tiktok_ads__ad_report_hourly.sql", "name": "stg_tiktok_ads__ad_report_hourly", "alias": "stg_tiktok_ads__ad_report_hourly", "checksum": {"name": "sha256", "checksum": "cc0d2dff4f71cc11bb6d6a299b30737906acf14780bcadab2a52620a4d929ec4"}, "tags": [], "refs": [["stg_tiktok_ads__ad_report_hourly_tmp"], ["stg_tiktok_ads__ad_report_hourly_tmp"]], "sources": [], "description": "Each record represents data for each ad for each hour.", "columns": {"ad_id": {"name": "ad_id", "description": "Ad id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time per user your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__ad_report_hourly.sql", "build_path": "target/run/tiktok_ads_source/models/stg_tiktok_ads__ad_report_hourly.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1658250907.487308, "compiled_sql": "with base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_report_hourly_tmp`\n\n), \n\nfields as (\n\n select\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n ad_id\n \n as \n \n ad_id\n \n, \n \n \n average_video_play\n \n as \n \n average_video_play\n \n, \n \n \n average_video_play_per_user\n \n as \n \n average_video_play_per_user\n \n, \n \n \n clicks\n \n as \n \n clicks\n \n, \n \n \n comments\n \n as \n \n comments\n \n, \n \n \n conversion\n \n as \n \n conversion\n \n, \n \n \n conversion_rate\n \n as \n \n conversion_rate\n \n, \n \n \n cost_per_1000_reached\n \n as \n \n cost_per_1000_reached\n \n, \n \n \n cost_per_conversion\n \n as \n \n cost_per_conversion\n \n, \n \n \n cost_per_result\n \n as \n \n cost_per_result\n \n, \n \n \n cost_per_secondary_goal_result\n \n as \n \n cost_per_secondary_goal_result\n \n, \n \n \n cpc\n \n as \n \n cpc\n \n, \n \n \n cpm\n \n as \n \n cpm\n \n, \n \n \n ctr\n \n as \n \n ctr\n \n, \n \n \n follows\n \n as \n \n follows\n \n, \n \n \n impressions\n \n as \n \n impressions\n \n, \n \n \n likes\n \n as \n \n likes\n \n, \n \n \n profile_visits\n \n as \n \n profile_visits\n \n, \n \n \n profile_visits_rate\n \n as \n \n profile_visits_rate\n \n, \n \n \n reach\n \n as \n \n reach\n \n, \n \n \n real_time_conversion\n \n as \n \n real_time_conversion\n \n, \n \n \n real_time_conversion_rate\n \n as \n \n real_time_conversion_rate\n \n, \n \n \n real_time_cost_per_conversion\n \n as \n \n real_time_cost_per_conversion\n \n, \n \n \n real_time_cost_per_result\n \n as \n \n real_time_cost_per_result\n \n, \n \n \n real_time_result\n \n as \n \n real_time_result\n \n, \n \n \n real_time_result_rate\n \n as \n \n real_time_result_rate\n \n, \n \n \n result\n \n as \n \n result\n \n, \n \n \n result_rate\n \n as \n \n result_rate\n \n, \n \n \n secondary_goal_result\n \n as \n \n secondary_goal_result\n \n, \n \n \n secondary_goal_result_rate\n \n as \n \n secondary_goal_result_rate\n \n, \n \n \n shares\n \n as \n \n shares\n \n, \n \n \n spend\n \n as \n \n spend\n \n, \n \n \n stat_time_hour\n \n as \n \n stat_time_hour\n \n, \n \n \n video_play_actions\n \n as \n \n video_play_actions\n \n, \n \n \n video_views_p_100\n \n as \n \n video_views_p_100\n \n, \n \n \n video_views_p_25\n \n as \n \n video_views_p_25\n \n, \n \n \n video_views_p_50\n \n as \n \n video_views_p_50\n \n, \n \n \n video_views_p_75\n \n as \n \n video_views_p_75\n \n, \n \n \n video_watched_2_s\n \n as \n \n video_watched_2_s\n \n, \n \n \n video_watched_6_s\n \n as \n \n video_watched_6_s\n \n\n\n\n\n from base\n\n), \n\nfinal as (\n\n select \n ad_id, \n cast(_fivetran_synced as \n timestamp\n) as _fivetran_synced,\n stat_time_hour, \n cpc, \n cpm, \n ctr, \n impressions, \n clicks, \n spend, \n reach, \n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n \n \n from fields\n\n)\n\nselect * from final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_report_hourly`"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "campaign_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__campaign_report_hourly')) }}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id", "alias": "not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__campaign_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1658250907.496785, "column_name": "campaign_id", "file_key_name": "models.stg_tiktok_ads__campaign_report_hourly"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["campaign_id", "stat_time_hour"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__campaign_report_hourly')) }}"}, "namespace": "dbt_utils"}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour", "alias": "dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__campaign_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16"}, "created_at": 1658250907.499296, "column_name": null, "file_key_name": "models.stg_tiktok_ads__campaign_report_hourly"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_group_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_group_report_hourly')) }}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id", "alias": "not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1658250907.515866, "column_name": "ad_group_id", "file_key_name": "models.stg_tiktok_ads__ad_group_report_hourly"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_group_id", "stat_time_hour"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_group_report_hourly')) }}"}, "namespace": "dbt_utils"}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour", "alias": "dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60"}, "created_at": 1658250907.518048, "column_name": null, "file_key_name": "models.stg_tiktok_ads__ad_group_report_hourly"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_id", "stat_time_hour"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_report_hourly')) }}"}, "namespace": "dbt_utils"}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour", "alias": "dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc"}, "created_at": 1658250907.52393, "column_name": null, "file_key_name": "models.stg_tiktok_ads__ad_report_hourly"}, "model.tiktok_ads.tiktok_ads__campaign_report": {"raw_sql": "with hourly as (\n \n select *\n from {{ var('campaign_report_hourly') }}\n\n), campaigns as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_campaign') }}\n\n), advertiser as (\n\n select *\n from {{ var('advertiser') }}\n \n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n advertiser.advertiser_id,\n advertiser.advertiser_name,\n campaigns.campaign_id,\n campaigns.campaign_name,\n advertiser.currency,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n {% for metric in var('tiktok_ads__campaign_hourly_passthrough_metrics', []) %}\n , {{ metric }}\n {% endfor %}\n from hourly\n left join campaigns\n on hourly.campaign_id = campaigns.campaign_id\n left join advertiser\n on campaigns.advertiser_id = advertiser.advertiser_id\n {{ dbt_utils.group_by(6) }}\n\n)\n\nselect *\nfrom aggregated", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.group_by", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.persist_docs"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly", "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "model.tiktok_ads_source.stg_tiktok_ads__advertiser"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads", "tiktok_ads__campaign_report"], "unique_id": "model.tiktok_ads.tiktok_ads__campaign_report", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "tiktok_ads__campaign_report.sql", "original_file_path": "models/tiktok_ads__campaign_report.sql", "name": "tiktok_ads__campaign_report", "alias": "tiktok_ads__campaign_report", "checksum": {"name": "sha256", "checksum": "74332b261c90ffb6559548d8307099aa764b49548f70d686477a4ba9862bf55a"}, "tags": [], "refs": [["stg_tiktok_ads__campaign_report_hourly"], ["int_tiktok_ads__most_recent_campaign"], ["stg_tiktok_ads__advertiser"]], "sources": [], "description": "Each record in this table represents the daily performance at the campaign level.", "columns": {"date_day": {"name": "date_day", "description": "Day of record", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_name": {"name": "advertiser_name", "description": "Advertiser name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of impressions that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The amount of spend that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of follows that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpc": {"name": "daily_cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpm": {"name": "daily_cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_daily_ctr": {"name": "daily_daily_ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads__campaign_report.sql", "build_path": "target/run/tiktok_ads/models/tiktok_ads__campaign_report.sql", "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "table"}, "created_at": 1658252626.2299352, "compiled_sql": "with __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n),hourly as (\n \n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_report_hourly`\n\n), campaigns as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_campaign\n\n), advertiser as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__advertiser`\n \n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n advertiser.advertiser_id,\n advertiser.advertiser_name,\n campaigns.campaign_id,\n campaigns.campaign_name,\n advertiser.currency,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n \n from hourly\n left join campaigns\n on hourly.campaign_id = campaigns.campaign_id\n left join advertiser\n on campaigns.advertiser_id = advertiser.advertiser_id\n group by 1,2,3,4,5,6\n\n)\n\nselect *\nfrom aggregated", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "sql": " __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": "`database`.`schema`.`tiktok_ads__campaign_report`"}, "model.tiktok_ads.tiktok_ads__url_report": {"raw_sql": "with hourly as (\n \n select *\n from {{ var('ad_report_hourly') }}\n\n), ads as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_ad') }}\n\n), ad_groups as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_ad_group') }}\n\n), advertiser as (\n\n select *\n from {{ var('advertiser') }}\n\n), campaigns as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_campaign') }}\n\n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n ad_groups.advertiser_id,\n advertiser.advertiser_name,\n campaigns.campaign_id,\n campaigns.campaign_name,\n ad_groups.ad_group_id,\n ad_groups.ad_group_name,\n ads.ad_id,\n ads.ad_name,\n ads.base_url,\n ads.url_host,\n ads.url_path,\n ads.utm_source,\n ads.utm_medium,\n ads.utm_campaign,\n ads.utm_content,\n ads.utm_term,\n advertiser.currency,\n ad_groups.action_categories,\n ad_groups.category,\n ad_groups.gender,\n ad_groups.audience_type,\n ad_groups.budget,\n ad_groups.age,\n ad_groups.languages,\n ad_groups.interest_category,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n {% for metric in var('tiktok_ads__ad_hourly_passthrough_metrics', []) %}\n , {{ metric }}\n {% endfor %}\n from hourly\n left join ads\n on hourly.ad_id = ads.ad_id\n left join ad_groups \n on ads.ad_group_id = ad_groups.ad_group_id\n left join advertiser\n on ads.advertiser_id = advertiser.advertiser_id\n left join campaigns\n on ads.campaign_id = campaigns.campaign_id\n\n -- We only want utm ads to populate this report. Therefore, we filter where url ads are populated.\n where ads.landing_page_url is not null\n {{ dbt_utils.group_by(26) }}\n\n)\n\nselect *\nfrom aggregated", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.group_by", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.persist_docs"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "model.tiktok_ads_source.stg_tiktok_ads__advertiser", "model.tiktok_ads.int_tiktok_ads__most_recent_campaign"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads", "tiktok_ads__url_report"], "unique_id": "model.tiktok_ads.tiktok_ads__url_report", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "tiktok_ads__url_report.sql", "original_file_path": "models/tiktok_ads__url_report.sql", "name": "tiktok_ads__url_report", "alias": "tiktok_ads__url_report", "checksum": {"name": "sha256", "checksum": "49680f4cd1cb5608f77097399a90ef7e1f27e25549b4963f9003ed545edbe9dd"}, "tags": [], "refs": [["stg_tiktok_ads__ad_report_hourly"], ["int_tiktok_ads__most_recent_ad"], ["int_tiktok_ads__most_recent_ad_group"], ["stg_tiktok_ads__advertiser"], ["int_tiktok_ads__most_recent_campaign"]], "sources": [], "description": "Each record in this table represents the daily performance of ads at the ad level and URL level.", "columns": {"date_day": {"name": "date_day", "description": "Day of record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_id": {"name": "ad_id", "description": "Ad ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_name": {"name": "ad_name", "description": "Ad name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_name": {"name": "advertiser_name", "description": "Advertiser name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "Ad group ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "Ad group name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "base_url": {"name": "base_url", "description": "The base URL of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_host": {"name": "url_host", "description": "The URL host of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_path": {"name": "url_path", "description": "The URL path of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_source": {"name": "utm_source", "description": "The utm_source parameter of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_medium": {"name": "utm_medium", "description": "The utm_medium parameter of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_campaign": {"name": "utm_campaign", "description": "The utm_campaign parameter of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_content": {"name": "utm_content", "description": "The utm_content parameter of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_term": {"name": "utm_term", "description": "The utm_term parameter of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_categories": {"name": "action_categories", "description": "IDs of the action categories (behaviors) that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "age": {"name": "age", "description": "Age groups you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience_type": {"name": "audience_type", "description": "Audience Type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget": {"name": "budget", "description": "Ad budget. Returns 0.0 when Campaign Budget Optimization (budget_optimize_switch) is on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "category": {"name": "category", "description": "Ad group category.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "interest_category": {"name": "interest_category", "description": "Interest classification. If the interest is specified, users that do not meet interest target will be excluded during delivery.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "languages": {"name": "languages", "description": "Codes of the languages that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "currency": {"name": "currency", "description": "Advertiser's currency.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of impressions that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The amount of spend that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of follows that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpc": {"name": "daily_cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpm": {"name": "daily_cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_ctr": {"name": "daily_ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads__url_report.sql", "build_path": "target/run/tiktok_ads/models/tiktok_ads__url_report.sql", "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "table"}, "created_at": 1658252626.260878, "compiled_sql": "with __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n), __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n), __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n),hourly as (\n \n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_report_hourly`\n\n), ads as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_ad\n\n), ad_groups as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_ad_group\n\n), advertiser as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__advertiser`\n\n), campaigns as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_campaign\n\n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n ad_groups.advertiser_id,\n advertiser.advertiser_name,\n campaigns.campaign_id,\n campaigns.campaign_name,\n ad_groups.ad_group_id,\n ad_groups.ad_group_name,\n ads.ad_id,\n ads.ad_name,\n ads.base_url,\n ads.url_host,\n ads.url_path,\n ads.utm_source,\n ads.utm_medium,\n ads.utm_campaign,\n ads.utm_content,\n ads.utm_term,\n advertiser.currency,\n ad_groups.action_categories,\n ad_groups.category,\n ad_groups.gender,\n ad_groups.audience_type,\n ad_groups.budget,\n ad_groups.age,\n ad_groups.languages,\n ad_groups.interest_category,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n \n from hourly\n left join ads\n on hourly.ad_id = ads.ad_id\n left join ad_groups \n on ads.ad_group_id = ad_groups.ad_group_id\n left join advertiser\n on ads.advertiser_id = advertiser.advertiser_id\n left join campaigns\n on ads.campaign_id = campaigns.campaign_id\n\n -- We only want utm ads to populate this report. Therefore, we filter where url ads are populated.\n where ads.landing_page_url is not null\n group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26\n\n)\n\nselect *\nfrom aggregated", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}, {"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}, {"id": "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "sql": " __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": "`database`.`schema`.`tiktok_ads__url_report`"}, "model.tiktok_ads.tiktok_ads__ad_report": {"raw_sql": "with hourly as (\n \n select *\n from {{ var('ad_report_hourly') }}\n\n), ads as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_ad') }}\n\n), ad_groups as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_ad_group') }}\n\n), advertiser as (\n\n select *\n from {{ var('advertiser') }}\n\n), campaigns as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_campaign') }}\n\n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n ad_groups.advertiser_id,\n advertiser.advertiser_name,\n campaigns.campaign_id,\n campaigns.campaign_name,\n ad_groups.ad_group_id,\n ad_groups.ad_group_name,\n ads.ad_id,\n ads.ad_name,\n advertiser.currency,\n ad_groups.category,\n ad_groups.action_categories,\n ad_groups.gender,\n ad_groups.audience_type,\n ad_groups.budget,\n ad_groups.age,\n ad_groups.languages,\n ad_groups.interest_category,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n {% for metric in var('tiktok_ads__ad_hourly_passthrough_metrics', []) %}\n , {{ metric }}\n {% endfor %}\n from hourly\n left join ads\n on hourly.ad_id = ads.ad_id\n left join ad_groups \n on ads.ad_group_id = ad_groups.ad_group_id\n left join advertiser\n on ads.advertiser_id = advertiser.advertiser_id\n left join campaigns\n on ads.campaign_id = campaigns.campaign_id\n {{ dbt_utils.group_by(18) }}\n\n)\n\nselect *\nfrom aggregated", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.group_by", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.persist_docs"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "model.tiktok_ads_source.stg_tiktok_ads__advertiser", "model.tiktok_ads.int_tiktok_ads__most_recent_campaign"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads", "tiktok_ads__ad_report"], "unique_id": "model.tiktok_ads.tiktok_ads__ad_report", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "tiktok_ads__ad_report.sql", "original_file_path": "models/tiktok_ads__ad_report.sql", "name": "tiktok_ads__ad_report", "alias": "tiktok_ads__ad_report", "checksum": {"name": "sha256", "checksum": "d42e8279a49948b41e916c806ba2e7522134d1267e2352b1e356c593c941e397"}, "tags": [], "refs": [["stg_tiktok_ads__ad_report_hourly"], ["int_tiktok_ads__most_recent_ad"], ["int_tiktok_ads__most_recent_ad_group"], ["stg_tiktok_ads__advertiser"], ["int_tiktok_ads__most_recent_campaign"]], "sources": [], "description": "Each record in this table represents the daily performance of ads at the ad level and URL level.", "columns": {"date_day": {"name": "date_day", "description": "Day of record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_id": {"name": "ad_id", "description": "Ad ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_name": {"name": "ad_name", "description": "Ad name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_name": {"name": "advertiser_name", "description": "Advertiser name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "Ad group ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "Ad group name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_categories": {"name": "action_categories", "description": "IDs of the action categories (behaviors) that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "age": {"name": "age", "description": "Age groups you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience_type": {"name": "audience_type", "description": "Audience Type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget": {"name": "budget", "description": "Ad budget. Returns 0.0 when Campaign Budget Optimization (budget_optimize_switch) is on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "category": {"name": "category", "description": "Ad group category.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "interest_category": {"name": "interest_category", "description": "Interest classification. If the interest is specified, users that do not meet interest target will be excluded during delivery.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "languages": {"name": "languages", "description": "Codes of the languages that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "currency": {"name": "currency", "description": "Advertiser's currency.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of impressions that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The amount of spend that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of follows that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpc": {"name": "daily_cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpm": {"name": "daily_cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_ctr": {"name": "daily_ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads__ad_report.sql", "build_path": "target/run/tiktok_ads/models/tiktok_ads__ad_report.sql", "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "table"}, "created_at": 1658252626.244402, "compiled_sql": "with __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n), __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n), __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n),hourly as (\n \n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_report_hourly`\n\n), ads as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_ad\n\n), ad_groups as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_ad_group\n\n), advertiser as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__advertiser`\n\n), campaigns as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_campaign\n\n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n ad_groups.advertiser_id,\n advertiser.advertiser_name,\n campaigns.campaign_id,\n campaigns.campaign_name,\n ad_groups.ad_group_id,\n ad_groups.ad_group_name,\n ads.ad_id,\n ads.ad_name,\n advertiser.currency,\n ad_groups.category,\n ad_groups.action_categories,\n ad_groups.gender,\n ad_groups.audience_type,\n ad_groups.budget,\n ad_groups.age,\n ad_groups.languages,\n ad_groups.interest_category,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n \n from hourly\n left join ads\n on hourly.ad_id = ads.ad_id\n left join ad_groups \n on ads.ad_group_id = ad_groups.ad_group_id\n left join advertiser\n on ads.advertiser_id = advertiser.advertiser_id\n left join campaigns\n on ads.campaign_id = campaigns.campaign_id\n group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18\n\n)\n\nselect *\nfrom aggregated", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}, {"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}, {"id": "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "sql": " __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": "`database`.`schema`.`tiktok_ads__ad_report`"}, "model.tiktok_ads.tiktok_ads__account_report": {"raw_sql": "with hourly as (\n \n select *\n from {{ var('ad_report_hourly') }}\n\n), advertiser as (\n\n select *\n from {{ var('advertiser') }}\n\n), ads as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_ad') }}\n\n), joined as (\n\n select \n cast(hourly.stat_time_hour as date) as date_day,\n advertiser.advertiser_id,\n advertiser.advertiser_name,\n advertiser.currency,\n sum(hourly.clicks) as clicks,\n sum(hourly.impressions) as impressions,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s, \n sum(hourly.video_watched_6_s) as video_watched_6_s, \n sum(hourly.video_views_p_25) as video_views_p_25, \n sum(hourly.video_views_p_50) as video_views_p_50,\n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n {% for metric in var('tiktok_ads__ad_hourly_passthrough_metrics', []) %}\n , {{ metric }}\n {% endfor %}\n from hourly\n left join ads\n on hourly.ad_id = ads.ad_id\n left join advertiser\n on ads.advertiser_id = advertiser.advertiser_id\n {{ dbt_utils.group_by(4) }}\n \n\n\n)\n\nselect *\nfrom joined", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.group_by", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.persist_docs"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__advertiser", "model.tiktok_ads.int_tiktok_ads__most_recent_ad"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads", "tiktok_ads__account_report"], "unique_id": "model.tiktok_ads.tiktok_ads__account_report", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "tiktok_ads__account_report.sql", "original_file_path": "models/tiktok_ads__account_report.sql", "name": "tiktok_ads__account_report", "alias": "tiktok_ads__account_report", "checksum": {"name": "sha256", "checksum": "ce526838e287ff56ca0e097ce435bde857bc2bbd43d83e60f4f71f4a6c387a0e"}, "tags": [], "refs": [["stg_tiktok_ads__ad_report_hourly"], ["stg_tiktok_ads__advertiser"], ["int_tiktok_ads__most_recent_ad"]], "sources": [], "description": "Each record in this table represents the daily performance of ads at the ad level and URL level.", "columns": {"date_day": {"name": "date_day", "description": "Day of record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_name": {"name": "advertiser_name", "description": "Advertiser name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "currency": {"name": "currency", "description": "Advertiser's currency.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of impressions that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The amount of spend that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of follows that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpc": {"name": "daily_cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpm": {"name": "daily_cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_ctr": {"name": "daily_ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads__account_report.sql", "build_path": "target/run/tiktok_ads/models/tiktok_ads__account_report.sql", "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "table"}, "created_at": 1658252626.2716942, "compiled_sql": "with __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n),hourly as (\n \n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_report_hourly`\n\n), advertiser as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__advertiser`\n\n), ads as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_ad\n\n), joined as (\n\n select \n cast(hourly.stat_time_hour as date) as date_day,\n advertiser.advertiser_id,\n advertiser.advertiser_name,\n advertiser.currency,\n sum(hourly.clicks) as clicks,\n sum(hourly.impressions) as impressions,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s, \n sum(hourly.video_watched_6_s) as video_watched_6_s, \n sum(hourly.video_views_p_25) as video_views_p_25, \n sum(hourly.video_views_p_50) as video_views_p_50,\n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n \n from hourly\n left join ads\n on hourly.ad_id = ads.ad_id\n left join advertiser\n on ads.advertiser_id = advertiser.advertiser_id\n group by 1,2,3,4\n \n\n\n)\n\nselect *\nfrom joined", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": "`database`.`schema`.`tiktok_ads__account_report`"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day.cc5f756c69": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_48804305b042fff8fc9179671c157c13\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["campaign_id", "date_day"], "model": "{{ get_where_subquery(ref('tiktok_ads__campaign_report')) }}"}, "namespace": "dbt_utils"}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__campaign_report"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_48804305b042fff8fc9179671c157c13", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day.cc5f756c69", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_48804305b042fff8fc9179671c157c13.sql", "original_file_path": "models/tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day", "alias": "dbt_utils_unique_combination_o_48804305b042fff8fc9179671c157c13", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__campaign_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_48804305b042fff8fc9179671c157c13"}, "created_at": 1658252626.304491, "column_name": null, "file_key_name": "models.tiktok_ads__campaign_report"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_report_ad_id__date_day.15357fac89": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_056f22d77c1daa2b10c2ecadca5404c3\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_id", "date_day"], "model": "{{ get_where_subquery(ref('tiktok_ads__ad_report')) }}"}, "namespace": "dbt_utils"}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__ad_report"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_056f22d77c1daa2b10c2ecadca5404c3", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "dbt_utils_unique_combination_of_columns_tiktok_ads__ad_report_ad_id__date_day"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_report_ad_id__date_day.15357fac89", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_056f22d77c1daa2b10c2ecadca5404c3.sql", "original_file_path": "models/tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_tiktok_ads__ad_report_ad_id__date_day", "alias": "dbt_utils_unique_combination_o_056f22d77c1daa2b10c2ecadca5404c3", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__ad_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_056f22d77c1daa2b10c2ecadca5404c3"}, "created_at": 1658252626.311863, "column_name": null, "file_key_name": "models.tiktok_ads__ad_report"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__url_report_ad_id__date_day.8b73e512af": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_30d691e3772c912d1a7e5874b0b91854\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_id", "date_day"], "model": "{{ get_where_subquery(ref('tiktok_ads__url_report')) }}"}, "namespace": "dbt_utils"}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__url_report"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_30d691e3772c912d1a7e5874b0b91854", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "dbt_utils_unique_combination_of_columns_tiktok_ads__url_report_ad_id__date_day"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__url_report_ad_id__date_day.8b73e512af", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_30d691e3772c912d1a7e5874b0b91854.sql", "original_file_path": "models/tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_tiktok_ads__url_report_ad_id__date_day", "alias": "dbt_utils_unique_combination_o_30d691e3772c912d1a7e5874b0b91854", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__url_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_30d691e3772c912d1a7e5874b0b91854"}, "created_at": 1658252626.3190432, "column_name": null, "file_key_name": "models.tiktok_ads__url_report"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__account_report_advertiser_id__date_day.7b27a2f43b": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_e775e605c8835d2fdc47cf9d0cf5ee54\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["advertiser_id", "date_day"], "model": "{{ get_where_subquery(ref('tiktok_ads__account_report')) }}"}, "namespace": "dbt_utils"}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__account_report"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_e775e605c8835d2fdc47cf9d0cf5ee54", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "dbt_utils_unique_combination_of_columns_tiktok_ads__account_report_advertiser_id__date_day"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__account_report_advertiser_id__date_day.7b27a2f43b", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_e775e605c8835d2fdc47cf9d0cf5ee54.sql", "original_file_path": "models/tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_tiktok_ads__account_report_advertiser_id__date_day", "alias": "dbt_utils_unique_combination_o_e775e605c8835d2fdc47cf9d0cf5ee54", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__account_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_e775e605c8835d2fdc47cf9d0cf5ee54"}, "created_at": 1658252626.3259652, "column_name": null, "file_key_name": "models.tiktok_ads__account_report"}, "model.tiktok_ads.tiktok_ads__ad_group_report": {"raw_sql": "with hourly as (\n \n select *\n from {{ var('ad_group_report_hourly') }}\n\n), ad_groups as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_ad_group') }}\n\n), advertiser as (\n\n select *\n from {{ var('advertiser') }}\n\n), campaigns as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_campaign') }}\n\n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n ad_groups.advertiser_id,\n advertiser.advertiser_name,\n campaigns.campaign_id,\n campaigns.campaign_name,\n ad_groups.ad_group_id,\n ad_groups.ad_group_name,\n advertiser.currency,\n ad_groups.action_categories,\n ad_groups.category,\n ad_groups.gender,\n ad_groups.audience_type,\n ad_groups.budget,\n ad_groups.age,\n ad_groups.languages,\n ad_groups.interest_category,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n {% for metric in var('tiktok_ads__ad_group_hourly_passthrough_metrics', []) %}\n , {{ metric }}\n {% endfor %}\n from hourly\n left join ad_groups \n on hourly.ad_group_id = ad_groups.ad_group_id\n left join advertiser\n on ad_groups.advertiser_id = advertiser.advertiser_id\n left join campaigns\n on ad_groups.campaign_id = campaigns.campaign_id\n {{ dbt_utils.group_by(16) }}\n\n)\n\nselect *\nfrom aggregated", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.group_by", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.persist_docs"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly", "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "model.tiktok_ads_source.stg_tiktok_ads__advertiser", "model.tiktok_ads.int_tiktok_ads__most_recent_campaign"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads", "tiktok_ads__ad_group_report"], "unique_id": "model.tiktok_ads.tiktok_ads__ad_group_report", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "tiktok_ads__ad_group_report.sql", "original_file_path": "models/tiktok_ads__ad_group_report.sql", "name": "tiktok_ads__ad_group_report", "alias": "tiktok_ads__ad_group_report", "checksum": {"name": "sha256", "checksum": "56e4982c59d6d1fa1b6505ea507eca8bef5145ac7d82c69de61cac908c40201c"}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_report_hourly"], ["int_tiktok_ads__most_recent_ad_group"], ["stg_tiktok_ads__advertiser"], ["int_tiktok_ads__most_recent_campaign"]], "sources": [], "description": "Each record in this table represents the daily performance of ads at the ad group level.", "columns": {"date_day": {"name": "date_day", "description": "Day of record", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "Ad group name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_name": {"name": "advertiser_name", "description": "Advertiser name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "currency": {"name": "currency", "description": "Advertiser's currency.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_categories": {"name": "action_categories", "description": "IDs of the action categories (behaviors) that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "age": {"name": "age", "description": "Age groups you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience_type": {"name": "audience_type", "description": "Audience Type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget": {"name": "budget", "description": "Ad budget. Returns 0.0 when Campaign Budget Optimization (budget_optimize_switch) is on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "category": {"name": "category", "description": "Ad group category.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "interest_category": {"name": "interest_category", "description": "Interest classification. If the interest is specified, users that do not meet interest target will be excluded during delivery.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "languages": {"name": "languages", "description": "Codes of the languages that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of impressions that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The amount of spend that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of follows that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpc": {"name": "daily_cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpm": {"name": "daily_cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_ctr": {"name": "daily_ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads__ad_group_report.sql", "build_path": "target/run/tiktok_ads/models/tiktok_ads__ad_group_report.sql", "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "table"}, "created_at": 1658252686.271764, "compiled_sql": "with __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n), __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n),hourly as (\n \n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_group_report_hourly`\n\n), ad_groups as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_ad_group\n\n), advertiser as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__advertiser`\n\n), campaigns as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_campaign\n\n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n ad_groups.advertiser_id,\n advertiser.advertiser_name,\n campaigns.campaign_id,\n campaigns.campaign_name,\n ad_groups.ad_group_id,\n ad_groups.ad_group_name,\n advertiser.currency,\n ad_groups.action_categories,\n ad_groups.category,\n ad_groups.gender,\n ad_groups.audience_type,\n ad_groups.budget,\n ad_groups.age,\n ad_groups.languages,\n ad_groups.interest_category,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n \n from hourly\n left join ad_groups \n on hourly.ad_group_id = ad_groups.ad_group_id\n left join advertiser\n on ad_groups.advertiser_id = advertiser.advertiser_id\n left join campaigns\n on ad_groups.campaign_id = campaigns.campaign_id\n group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16\n\n)\n\nselect *\nfrom aggregated", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}, {"id": "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "sql": " __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": "`database`.`schema`.`tiktok_ads__ad_group_report`"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_adapter_ad_id__date_day.c70f86f560": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_9db65ce81760c299942d65ab5e7e6d4e\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_id", "date_day"], "model": "{{ get_where_subquery(ref('tiktok_ads__ad_adapter')) }}"}, "namespace": "dbt_utils"}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": []}, "config": {"enabled": false, "alias": "dbt_utils_unique_combination_o_9db65ce81760c299942d65ab5e7e6d4e", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "dbt_utils_unique_combination_of_columns_tiktok_ads__ad_adapter_ad_id__date_day"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_adapter_ad_id__date_day.c70f86f560", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_9db65ce81760c299942d65ab5e7e6d4e.sql", "original_file_path": "models/tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_tiktok_ads__ad_adapter_ad_id__date_day", "alias": "dbt_utils_unique_combination_o_9db65ce81760c299942d65ab5e7e6d4e", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__ad_adapter"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_9db65ce81760c299942d65ab5e7e6d4e"}, "created_at": 1658252686.281006, "column_name": null, "file_key_name": "models.tiktok_ads__ad_adapter"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day.2eb4c2ff6d": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_72fdc194de3164f205583879773e492a\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_group_id", "date_day"], "model": "{{ get_where_subquery(ref('tiktok_ads__ad_group_report')) }}"}, "namespace": "dbt_utils"}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__ad_group_report"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_72fdc194de3164f205583879773e492a", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day.2eb4c2ff6d", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_72fdc194de3164f205583879773e492a.sql", "original_file_path": "models/tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day", "alias": "dbt_utils_unique_combination_o_72fdc194de3164f205583879773e492a", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__ad_group_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_72fdc194de3164f205583879773e492a"}, "created_at": 1658252686.296779, "column_name": null, "file_key_name": "models.tiktok_ads__ad_group_report"}}, "sources": {"source.tiktok_ads_source.tiktok_ads.advertiser": {"fqn": ["tiktok_ads_source", "tiktok_ads", "advertiser"], "database": "database", "schema": "tiktok_ads_joe", "unique_id": "source.tiktok_ads_source.tiktok_ads.advertiser", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "advertiser", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "advertiser", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents data for one advertiser.", "columns": {"id": {"name": "id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "address": {"name": "address", "description": "Advertiser address information", "meta": {}, "data_type": null, "quote": null, "tags": []}, "balance": {"name": "balance", "description": "Account available balance", "meta": {}, "data_type": null, "quote": null, "tags": []}, "company": {"name": "company", "description": "Advertiser's company name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "contacter": {"name": "contacter", "description": "Contact Person", "meta": {}, "data_type": null, "quote": null, "tags": []}, "country": {"name": "country", "description": "The advertiser's country", "meta": {}, "data_type": null, "quote": null, "tags": []}, "create_time": {"name": "create_time", "description": "Advertiser's create time", "meta": {}, "data_type": null, "quote": null, "tags": []}, "currency": {"name": "currency", "description": "Type of currency used by advertisers", "meta": {}, "data_type": null, "quote": null, "tags": []}, "description": {"name": "description", "description": "Brand description, i.e. promotional content", "meta": {}, "data_type": null, "quote": null, "tags": []}, "email": {"name": "email", "description": "Advertiser contact email, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "industry": {"name": "industry", "description": "Advertiser industry category", "meta": {}, "data_type": null, "quote": null, "tags": []}, "language": {"name": "language", "description": "Language used by advertisers", "meta": {}, "data_type": null, "quote": null, "tags": []}, "license_no": {"name": "license_no", "description": "License number", "meta": {}, "data_type": null, "quote": null, "tags": []}, "license_url": {"name": "license_url", "description": "License preview address, the link is valid for an hour by default.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "Advertiser name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "phone_number": {"name": "phone_number", "description": "Contact mobile number, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "promotion_area": {"name": "promotion_area", "description": "Operation area", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reason": {"name": "reason", "description": "Reason for rejection", "meta": {}, "data_type": null, "quote": null, "tags": []}, "role": {"name": "role", "description": "Advertiser role", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Advertiser status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "telephone": {"name": "telephone", "description": "Fixed phone number, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "timezone": {"name": "timezone", "description": "Ad account time zone including GMT offset", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`database`.`tiktok_ads_joe`.`advertiser`", "created_at": 1658244909.62709}, "source.tiktok_ads_source.tiktok_ads.campaign_history": {"fqn": ["tiktok_ads_source", "tiktok_ads", "campaign_history"], "database": "database", "schema": "tiktok_ads_joe", "unique_id": "source.tiktok_ads_source.tiktok_ads.campaign_history", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "campaign_history", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "campaign_history", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents a version of a TikTok campaign.", "columns": {"campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget": {"name": "budget", "description": "Campaign budget", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget_mode": {"name": "budget_mode", "description": "Budget type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_type": {"name": "campaign_type", "description": "Campaign Type, indicates the campaign is a regular campaign or iOS 14 campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "create_time": {"name": "create_time", "description": "Time at which the campaign was created.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_new_structure": {"name": "is_new_structure", "description": "Whether the campaign is a new structure (for the same campaign, the structure of campaign, adgroups and ads are the same)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "objective_type": {"name": "objective_type", "description": "Advertising objective.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "opt_status": {"name": "opt_status", "description": "Operation status.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Campaign status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "split_test_variable": {"name": "split_test_variable", "description": "Split Test variables. Optional values; TARGETING, BIDDING_OPTIMIZATION , CREATIVE.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`database`.`tiktok_ads_joe`.`campaign_history`", "created_at": 1658244909.627365}, "source.tiktok_ads_source.tiktok_ads.adgroup_history": {"fqn": ["tiktok_ads_source", "tiktok_ads", "adgroup_history"], "database": "database", "schema": "tiktok_ads_joe", "unique_id": "source.tiktok_ads_source.tiktok_ads.adgroup_history", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "adgroup_history", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "adgroup_history", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents a version of a TikTok ad group.", "columns": {"adgroup_id": {"name": "adgroup_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The Ad group's campaign ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_categories": {"name": "action_categories", "description": "IDs of the action categories (behaviors) that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_days": {"name": "action_days", "description": "The number of days of the time period to include action from.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "adgroup_name": {"name": "adgroup_name", "description": "Ad group name. Character limit is 512 and cannot contain emoji.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "age": {"name": "age", "description": "Age groups you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "android_osv": {"name": "android_osv", "description": "Minimum Android version.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "app_download_url": {"name": "app_download_url", "description": "App download link", "meta": {}, "data_type": null, "quote": null, "tags": []}, "app_id": {"name": "app_id", "description": "The Application id of the promoted app", "meta": {}, "data_type": null, "quote": null, "tags": []}, "app_name": {"name": "app_name", "description": "App name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "app_type": {"name": "app_type", "description": "App type.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience": {"name": "audience", "description": "A list of audience IDs.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience_type": {"name": "audience_type", "description": "Audience Type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "bid": {"name": "bid", "description": "CPC, CPM bidding, oCPM learning bidding", "meta": {}, "data_type": null, "quote": null, "tags": []}, "bid_type": {"name": "bid_type", "description": "Bidding Strategy", "meta": {}, "data_type": null, "quote": null, "tags": []}, "billing_event": {"name": "billing_event", "description": "Bid method.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget": {"name": "budget", "description": "Ad budget. Returns 0.0 when Campaign Budget Optimization (budget_optimize_switch) is on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget_mode": {"name": "budget_mode", "description": "Budget mode. This field will be ignored when Campaign Budget Optimization (budget_optimize_switch) is enabled.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "carriers": {"name": "carriers", "description": "Carriers that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "category": {"name": "category", "description": "Ad group category.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "click_tracking_url": {"name": "click_tracking_url", "description": "Click monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "connection_type": {"name": "connection_type", "description": "Device connection types that you want to target. Default; unlimited.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_bid": {"name": "conversion_bid", "description": "oCPM conversion bid", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpv_video_duration": {"name": "cpv_video_duration", "description": "Video playback duration, required if optimize_goal is VIDEO_VIEW. Allowed values; SIX_SECONDS (video playback 6s), TWO_SECONDS (video playback 2s)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "creative_material_mode": {"name": "creative_material_mode", "description": "Creative delivery mode.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "dayparting": {"name": "dayparting", "description": "Ad delivery period, the default is always and the format is 48 * 7 character string, represented by 0 or 1. > That is, with half an hour as the minimum granularity, a day (24 hours) is divided by the minimum granularity(30 mins) from Monday to Sunday. Resulting in a 48*7 format.0 represents not to be delivered, 1 represents delivery. no transmission, full transmission 0, full transmission 1 all represent full time delivery", "meta": {}, "data_type": null, "quote": null, "tags": []}, "deep_bid_type": {"name": "deep_bid_type", "description": "Bidding strategy for in-app events.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "deep_cpabid": {"name": "deep_cpabid", "description": "Deep bid", "meta": {}, "data_type": null, "quote": null, "tags": []}, "deep_external_action": {"name": "deep_external_action", "description": "Deep conversion event.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "display_name": {"name": "display_name", "description": "Display name of ad group.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "enable_inventory_filter": {"name": "enable_inventory_filter", "description": "Inventory filtering (Unsafe videos will not be displayed).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "excluded_audience": {"name": "excluded_audience", "description": "A list of audience ID to be excluded.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "external_action": {"name": "external_action", "description": "Conversion event for the ad group. It is required when the promoted object is an app with tracking urls, or when pixel_id is specified.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "fallback_type": {"name": "fallback_type", "description": "Fallback Type. If the audience do not have the app installed, you can have them fall back to install the app, or to view a specific web page. Not applicable for Deferred Deeplink. Allowed values; APP_INSTALL, WEBSITE, UNSET. If website is chosen, you need to specify the url via landing_page_url field.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency": {"name": "frequency", "description": "frequency, together with frequency_schedule, controls how often people see your ad (only available for REACH ads). For example, frequency = 2 frequency_schedule = 3 means \"show ads no more than twice every 3 day\".\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency_schedule": {"name": "frequency_schedule", "description": "frequency, together with frequency, controls how often people see your ad (only available for REACH ads).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impression_tracking_url": {"name": "impression_tracking_url", "description": "Display monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "interest_category_v2": {"name": "interest_category_v2", "description": "Interest classification. If the interest is specified, users that do not meet interest target will be excluded during delivery.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ios_osv": {"name": "ios_osv", "description": "Minimum iOS version.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_comment_disable": {"name": "is_comment_disable", "description": "Whether to allow comments on your ads on TikTok, Vigo, Helo.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_hfss": {"name": "is_hfss", "description": "Whether the promoted content is HFSS foods (foods that are high in fat, salt, or sugar).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_new_structure": {"name": "is_new_structure", "description": "Whether the campaign is a new structure.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "keywords": {"name": "keywords", "description": "Keywords used.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "languages": {"name": "languages", "description": "Codes of the languages that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "location": {"name": "location", "description": "IDs of the locations that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "open_url": {"name": "open_url", "description": "The specific location where you want your audience to go if they have your app installed.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "open_url_type": {"name": "open_url_type", "description": "The open URL type.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "operation_system": {"name": "operation_system", "description": "Device operating systems that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "opt_status": {"name": "opt_status", "description": "Operation status.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "optimize_goal": {"name": "optimize_goal", "description": "Optimization goal.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "pacing": {"name": "pacing", "description": "You can choose between PACING_MODE_SMOOTH and PACING_MODE_FAST. For PACING_MODE_SMOOTH, the budget is allocated evenly within the scheduled time. PACING_MODE_FAST would consume budget and produce results as soon as possible. \n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "package": {"name": "package", "description": "Package name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "pangle_block_app_list_id": {"name": "pangle_block_app_list_id", "description": "Pangle app block list ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "pixel_id": {"name": "pixel_id", "description": "Pixel ID. Only application for landing pages.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "placement": {"name": "placement", "description": "The apps where you want to deliver your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "placement_type": {"name": "placement_type", "description": "Placement type.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_image": {"name": "profile_image", "description": "Avatar URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "schedule_end_time": {"name": "schedule_end_time", "description": "Ad delivery end time (UTC+0). Format should be YYYY-MM-DD HH:MM:SS", "meta": {}, "data_type": null, "quote": null, "tags": []}, "schedule_start_time": {"name": "schedule_start_time", "description": "Ad delivery start time (UTC+0). Format should be YYYY-MM-DD HH:MM:SS", "meta": {}, "data_type": null, "quote": null, "tags": []}, "schedule_type": {"name": "schedule_type", "description": "The schedule type, which can be either SCHEDULE_START_END or SCHEDULE_FROM_NOW.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "skip_learning_phase": {"name": "skip_learning_phase", "description": "Whether to skip the learning stage.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "statistic_type": {"name": "statistic_type", "description": "conversion bid statistic type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Ad group status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_actions": {"name": "video_actions", "description": "Number of video actions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_download": {"name": "video_download", "description": "Whether users can download your video ads on TikTok(cannot be updated once created).", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`database`.`tiktok_ads_joe`.`adgroup_history`", "created_at": 1658244909.627717}, "source.tiktok_ads_source.tiktok_ads.ad_history": {"fqn": ["tiktok_ads_source", "tiktok_ads", "ad_history"], "database": "database", "schema": "tiktok_ads_joe", "unique_id": "source.tiktok_ads_source.tiktok_ads.ad_history", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "ad_history", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "ad_history", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents a version of a TikTok ad.", "columns": {"ad_id": {"name": "ad_id", "description": "Ad ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "adgroup_id": {"name": "adgroup_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_name": {"name": "ad_name", "description": "Ad Name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_text": {"name": "ad_text", "description": "The ad text.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "app_name": {"name": "app_name", "description": "The display name of app download ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "call_to_action": {"name": "call_to_action", "description": "Call to action values.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "click_tracking_url": {"name": "click_tracking_url", "description": "Click monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "create_time": {"name": "create_time", "description": "Time at which the ad was created.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "display_name": {"name": "display_name", "description": "The display name of landing page or pure exposure ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "image_ids": {"name": "image_ids", "description": "A list of image IDs.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impression_tracking_url": {"name": "impression_tracking_url", "description": "Display monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_aco": {"name": "is_aco", "description": "Whether the ad is an automated ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_creative_authorized": {"name": "is_creative_authorized", "description": "Whether you grant displaying some of your ads in our TikTok For Business Creative Center. Only valid for non-US advertisers, the default value is false.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_new_structure": {"name": "is_new_structure", "description": "Whether the campaign is a new structure.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "open_url": {"name": "open_url", "description": "The specific location where you want your audience to go if they have your app installed.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "opt_status": {"name": "opt_status", "description": "Operation status.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "playable_url": {"name": "playable_url", "description": "Playable material url.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_image": {"name": "profile_image", "description": "Avatar URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Ad status.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_id": {"name": "video_id", "description": "The video ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`database`.`tiktok_ads_joe`.`ad_history`", "created_at": 1658244909.6279502}, "source.tiktok_ads_source.tiktok_ads.ad_report_hourly": {"fqn": ["tiktok_ads_source", "tiktok_ads", "ad_report_hourly"], "database": "database", "schema": "tiktok_ads_joe", "unique_id": "source.tiktok_ads_source.tiktok_ads.ad_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "ad_report_hourly", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "ad_report_hourly", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents data for each ad for each hour.", "columns": {"ad_id": {"name": "ad_id", "description": "Ad id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion": {"name": "real_time_conversion", "description": "The number of times your ad achieved an outcome, based on the objective and settings you selected. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result": {"name": "result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the results. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_result": {"name": "real_time_cost_per_result", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now, please go to the ad group section to view the cost per Result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result": {"name": "real_time_result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As a campaign may have different optimization goals, the total number of result is not supported in campaign section now , Please go to the ad group section to view the result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_view_p_100": {"name": "video_view_p_100", "description": "The number of times your video was played at 100% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion_rate": {"name": "real_time_conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_secondary_goal_result": {"name": "cost_per_secondary_goal_result", "description": "The average cost for each secondary goal result from your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result_rate": {"name": "secondary_goal_result_rate", "description": "The percentage of secondary goal results you achieved out of all of the installs of your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. The total count is calculated based on the time each ad impression occurred.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_conversion": {"name": "real_time_cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result_rate": {"name": "result_rate", "description": "The percentage of results you achieved out of all of the views/clicks on your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the result rate. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result": {"name": "secondary_goal_result", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_result": {"name": "cost_per_result", "description": "The average cost for each result from your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the cost per result. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time your video was played per person, including any time spent replaying the video. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result_rate": {"name": "real_time_result_rate", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now ,Please go to the ad group section to view the Result Rate. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`database`.`tiktok_ads_joe`.`ad_report_hourly`", "created_at": 1658244909.6282392}, "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly": {"fqn": ["tiktok_ads_source", "tiktok_ads", "campaign_report_hourly"], "database": "database", "schema": "tiktok_ads_joe", "unique_id": "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "campaign_report_hourly", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "campaign_report_hourly", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents data for each campaign for each hour.", "columns": {"campaign_id": {"name": "campaign_id", "description": "Campaign id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion": {"name": "real_time_conversion", "description": "The number of times your ad achieved an outcome, based on the objective and settings you selected. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result": {"name": "result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the results. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_result": {"name": "real_time_cost_per_result", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now, please go to the ad group section to view the cost per Result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result": {"name": "real_time_result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As a campaign may have different optimization goals, the total number of result is not supported in campaign section now , Please go to the ad group section to view the result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_view_p_100": {"name": "video_view_p_100", "description": "The number of times your video was played at 100% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion_rate": {"name": "real_time_conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_secondary_goal_result": {"name": "cost_per_secondary_goal_result", "description": "The average cost for each secondary goal result from your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result_rate": {"name": "secondary_goal_result_rate", "description": "The percentage of secondary goal results you achieved out of all of the installs of your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. The total count is calculated based on the time each ad impression occurred.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_conversion": {"name": "real_time_cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result_rate": {"name": "result_rate", "description": "The percentage of results you achieved out of all of the views/clicks on your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the result rate. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result": {"name": "secondary_goal_result", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_result": {"name": "cost_per_result", "description": "The average cost for each result from your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the cost per result. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time your video was played per person, including any time spent replaying the video. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result_rate": {"name": "real_time_result_rate", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now ,Please go to the ad group section to view the Result Rate. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`database`.`tiktok_ads_joe`.`campaign_report_hourly`", "created_at": 1658244909.628515}, "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly": {"fqn": ["tiktok_ads_source", "tiktok_ads", "adgroup_report_hourly"], "database": "database", "schema": "tiktok_ads_joe", "unique_id": "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "adgroup_report_hourly", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "adgroup_report_hourly", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents data for each ad group for each hour.", "columns": {"adgroup_id": {"name": "adgroup_id", "description": "Ad group id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion": {"name": "real_time_conversion", "description": "The number of times your ad achieved an outcome, based on the objective and settings you selected. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result": {"name": "result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the results. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_result": {"name": "real_time_cost_per_result", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now, please go to the ad group section to view the cost per Result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result": {"name": "real_time_result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As a campaign may have different optimization goals, the total number of result is not supported in campaign section now , Please go to the ad group section to view the result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_view_p_100": {"name": "video_view_p_100", "description": "The number of times your video was played at 100% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion_rate": {"name": "real_time_conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_secondary_goal_result": {"name": "cost_per_secondary_goal_result", "description": "The average cost for each secondary goal result from your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result_rate": {"name": "secondary_goal_result_rate", "description": "The percentage of secondary goal results you achieved out of all of the installs of your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. The total count is calculated based on the time each ad impression occurred.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_conversion": {"name": "real_time_cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result_rate": {"name": "result_rate", "description": "The percentage of results you achieved out of all of the views/clicks on your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the result rate. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result": {"name": "secondary_goal_result", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_result": {"name": "cost_per_result", "description": "The average cost for each result from your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the cost per result. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time your video was played per person, including any time spent replaying the video. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result_rate": {"name": "real_time_result_rate", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now ,Please go to the ad group section to view the Result Rate. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`database`.`tiktok_ads_joe`.`adgroup_report_hourly`", "created_at": 1658244909.629567}}, "macros": {"macro.dbt_bigquery.date_sharded_table": {"unique_id": "macro.dbt_bigquery.date_sharded_table", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/etc.sql", "original_file_path": "macros/etc.sql", "name": "date_sharded_table", "macro_sql": "{% macro date_sharded_table(base_name) %}\n {{ return(base_name ~ \"[DBT__PARTITION_DATE]\") }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.9067001}, "macro.dbt_bigquery.grant_access_to": {"unique_id": "macro.dbt_bigquery.grant_access_to", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/etc.sql", "original_file_path": "macros/etc.sql", "name": "grant_access_to", "macro_sql": "{% macro grant_access_to(entity, entity_type, role, grant_target_dict) -%}\n {% do adapter.grant_access_to(entity, entity_type, role, grant_target_dict) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.907427}, "macro.dbt_bigquery.get_partitions_metadata": {"unique_id": "macro.dbt_bigquery.get_partitions_metadata", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/etc.sql", "original_file_path": "macros/etc.sql", "name": "get_partitions_metadata", "macro_sql": "\n\n{%- macro get_partitions_metadata(table) -%}\n {%- if execute -%}\n {%- set res = adapter.get_partitions_metadata(table) -%}\n {{- return(res) -}}\n {%- endif -%}\n {{- return(None) -}}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.908194}, "macro.dbt_bigquery.bigquery__get_catalog": {"unique_id": "macro.dbt_bigquery.bigquery__get_catalog", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "name": "bigquery__get_catalog", "macro_sql": "{% macro bigquery__get_catalog(information_schema, schemas) -%}\n\n {%- if (schemas | length) == 0 -%}\n {# Hopefully nothing cares about the columns we return when there are no rows #}\n {%- set query = \"select 1 as id limit 0\" -%}\n {%- else -%}\n\n {%- set query -%}\n with tables as (\n select\n project_id as table_database,\n dataset_id as table_schema,\n table_id as original_table_name,\n\n concat(project_id, '.', dataset_id, '.', table_id) as relation_id,\n\n row_count,\n size_bytes as size_bytes,\n case\n when type = 1 then 'table'\n when type = 2 then 'view'\n else 'external'\n end as table_type,\n\n REGEXP_CONTAINS(table_id, '^.+[0-9]{8}$') and coalesce(type, 0) = 1 as is_date_shard,\n REGEXP_EXTRACT(table_id, '^(.+)[0-9]{8}$') as shard_base_name,\n REGEXP_EXTRACT(table_id, '^.+([0-9]{8})$') as shard_name\n\n from {{ information_schema.replace(information_schema_view='__TABLES__') }}\n where (\n {%- for schema in schemas -%}\n upper(dataset_id) = upper('{{ schema }}'){%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n )\n ),\n\n extracted as (\n\n select *,\n case\n when is_date_shard then shard_base_name\n else original_table_name\n end as table_name\n\n from tables\n\n ),\n\n unsharded_tables as (\n\n select\n table_database,\n table_schema,\n table_name,\n coalesce(table_type, 'external') as table_type,\n is_date_shard,\n\n struct(\n min(shard_name) as shard_min,\n max(shard_name) as shard_max,\n count(*) as shard_count\n ) as table_shards,\n\n sum(size_bytes) as size_bytes,\n sum(row_count) as row_count,\n\n max(relation_id) as relation_id\n\n from extracted\n group by 1,2,3,4,5\n\n ),\n\n info_schema_columns as (\n\n select\n concat(table_catalog, '.', table_schema, '.', table_name) as relation_id,\n table_catalog as table_database,\n table_schema,\n table_name,\n\n -- use the \"real\" column name from the paths query below\n column_name as base_column_name,\n ordinal_position as column_index,\n\n is_partitioning_column,\n clustering_ordinal_position\n\n from {{ information_schema.replace(information_schema_view='COLUMNS') }}\n where ordinal_position is not null\n\n ),\n\n info_schema_column_paths as (\n\n select\n concat(table_catalog, '.', table_schema, '.', table_name) as relation_id,\n field_path as column_name,\n data_type as column_type,\n column_name as base_column_name,\n description as column_comment\n\n from {{ information_schema.replace(information_schema_view='COLUMN_FIELD_PATHS') }}\n\n ),\n\n columns as (\n\n select * except (base_column_name)\n from info_schema_columns\n join info_schema_column_paths using (relation_id, base_column_name)\n\n ),\n\n column_stats as (\n\n select\n table_database,\n table_schema,\n table_name,\n max(relation_id) as relation_id,\n max(case when is_partitioning_column = 'YES' then 1 else 0 end) = 1 as is_partitioned,\n max(case when is_partitioning_column = 'YES' then column_name else null end) as partition_column,\n max(case when clustering_ordinal_position is not null then 1 else 0 end) = 1 as is_clustered,\n array_to_string(\n array_agg(\n case\n when clustering_ordinal_position is not null then column_name\n else null\n end ignore nulls\n order by clustering_ordinal_position\n ), ', '\n ) as clustering_columns\n\n from columns\n group by 1,2,3\n\n )\n\n select\n unsharded_tables.table_database,\n unsharded_tables.table_schema,\n case\n when is_date_shard then concat(unsharded_tables.table_name, '*')\n else unsharded_tables.table_name\n end as table_name,\n unsharded_tables.table_type,\n\n -- coalesce name and type for External tables - these columns are not\n -- present in the COLUMN_FIELD_PATHS resultset\n coalesce(columns.column_name, '') as column_name,\n -- invent a row number to account for nested fields -- BQ does\n -- not treat these nested properties as independent fields\n row_number() over (\n partition by relation_id\n order by columns.column_index, columns.column_name\n ) as column_index,\n coalesce(columns.column_type, '') as column_type,\n columns.column_comment,\n\n 'Shard count' as `stats__date_shards__label`,\n table_shards.shard_count as `stats__date_shards__value`,\n 'The number of date shards in this table' as `stats__date_shards__description`,\n is_date_shard as `stats__date_shards__include`,\n\n 'Shard (min)' as `stats__date_shard_min__label`,\n table_shards.shard_min as `stats__date_shard_min__value`,\n 'The first date shard in this table' as `stats__date_shard_min__description`,\n is_date_shard as `stats__date_shard_min__include`,\n\n 'Shard (max)' as `stats__date_shard_max__label`,\n table_shards.shard_max as `stats__date_shard_max__value`,\n 'The last date shard in this table' as `stats__date_shard_max__description`,\n is_date_shard as `stats__date_shard_max__include`,\n\n '# Rows' as `stats__num_rows__label`,\n row_count as `stats__num_rows__value`,\n 'Approximate count of rows in this table' as `stats__num_rows__description`,\n (unsharded_tables.table_type = 'table') as `stats__num_rows__include`,\n\n 'Approximate Size' as `stats__num_bytes__label`,\n size_bytes as `stats__num_bytes__value`,\n 'Approximate size of table as reported by BigQuery' as `stats__num_bytes__description`,\n (unsharded_tables.table_type = 'table') as `stats__num_bytes__include`,\n\n 'Partitioned By' as `stats__partitioning_type__label`,\n partition_column as `stats__partitioning_type__value`,\n 'The partitioning column for this table' as `stats__partitioning_type__description`,\n is_partitioned as `stats__partitioning_type__include`,\n\n 'Clustered By' as `stats__clustering_fields__label`,\n clustering_columns as `stats__clustering_fields__value`,\n 'The clustering columns for this table' as `stats__clustering_fields__description`,\n is_clustered as `stats__clustering_fields__include`\n\n -- join using relation_id (an actual relation, not a shard prefix) to make\n -- sure that column metadata is picked up through the join. This will only\n -- return the column information for the \"max\" table in a date-sharded table set\n from unsharded_tables\n left join columns using (relation_id)\n left join column_stats using (relation_id)\n {%- endset -%}\n\n {%- endif -%}\n\n {{ return(run_query(query)) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.replace", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.915194}, "macro.dbt_bigquery.partition_by": {"unique_id": "macro.dbt_bigquery.partition_by", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "partition_by", "macro_sql": "{% macro partition_by(partition_config) -%}\n {%- if partition_config is none -%}\n {% do return('') %}\n {%- elif partition_config.data_type | lower in ('date','timestamp','datetime') -%}\n partition by {{ partition_config.render() }}\n {%- elif partition_config.data_type | lower in ('int64') -%}\n {%- set range = partition_config.range -%}\n partition by range_bucket(\n {{ partition_config.field }},\n generate_array({{ range.start}}, {{ range.end }}, {{ range.interval }})\n )\n {%- endif -%}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.92565}, "macro.dbt_bigquery.cluster_by": {"unique_id": "macro.dbt_bigquery.cluster_by", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "cluster_by", "macro_sql": "{% macro cluster_by(raw_cluster_by) %}\n {%- if raw_cluster_by is not none -%}\n cluster by {% if raw_cluster_by is string -%}\n {% set raw_cluster_by = [raw_cluster_by] %}\n {%- endif -%}\n {%- for cluster in raw_cluster_by -%}\n {{ cluster }}\n {%- if not loop.last -%}, {% endif -%}\n {%- endfor -%}\n\n {% endif %}\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.92669}, "macro.dbt_bigquery.bigquery_options": {"unique_id": "macro.dbt_bigquery.bigquery_options", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery_options", "macro_sql": "{% macro bigquery_options(opts) %}\n {% set options -%}\n OPTIONS({% for opt_key, opt_val in opts.items() %}\n {{ opt_key }}={{ opt_val }}{{ \",\" if not loop.last }}\n {% endfor %})\n {%- endset %}\n {%- do return(options) -%}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.927667}, "macro.dbt_bigquery.bigquery_table_options": {"unique_id": "macro.dbt_bigquery.bigquery_table_options", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery_table_options", "macro_sql": "{% macro bigquery_table_options(config, node, temporary) %}\n {% set opts = adapter.get_table_options(config, node, temporary) %}\n {%- do return(bigquery_options(opts)) -%}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery_options"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.928376}, "macro.dbt_bigquery.bigquery__create_table_as": {"unique_id": "macro.dbt_bigquery.bigquery__create_table_as", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__create_table_as", "macro_sql": "{% macro bigquery__create_table_as(temporary, relation, sql) -%}\n {%- set raw_partition_by = config.get('partition_by', none) -%}\n {%- set raw_cluster_by = config.get('cluster_by', none) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {%- set partition_config = adapter.parse_partition_by(raw_partition_by) -%}\n\n {{ sql_header if sql_header is not none }}\n\n create or replace table {{ relation }}\n {{ partition_by(partition_config) }}\n {{ cluster_by(raw_cluster_by) }}\n {{ bigquery_table_options(config, model, temporary) }}\n as (\n {{ sql }}\n );\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.partition_by", "macro.dbt_bigquery.cluster_by", "macro.dbt_bigquery.bigquery_table_options"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.930104}, "macro.dbt_bigquery.bigquery_view_options": {"unique_id": "macro.dbt_bigquery.bigquery_view_options", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery_view_options", "macro_sql": "{% macro bigquery_view_options(config, node) %}\n {% set opts = adapter.get_view_options(config, node) %}\n {%- do return(bigquery_options(opts)) -%}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery_options"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.930756}, "macro.dbt_bigquery.bigquery__create_view_as": {"unique_id": "macro.dbt_bigquery.bigquery__create_view_as", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__create_view_as", "macro_sql": "{% macro bigquery__create_view_as(relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n\n create or replace view {{ relation }}\n {{ bigquery_view_options(config, model) }}\n as {{ sql }};\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery_view_options"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.9316218}, "macro.dbt_bigquery.bigquery__create_schema": {"unique_id": "macro.dbt_bigquery.bigquery__create_schema", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__create_schema", "macro_sql": "{% macro bigquery__create_schema(relation) -%}\n {{ adapter.create_schema(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.931982}, "macro.dbt_bigquery.bigquery__drop_schema": {"unique_id": "macro.dbt_bigquery.bigquery__drop_schema", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__drop_schema", "macro_sql": "{% macro bigquery__drop_schema(relation) -%}\n {{ adapter.drop_schema(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.932333}, "macro.dbt_bigquery.bigquery__drop_relation": {"unique_id": "macro.dbt_bigquery.bigquery__drop_relation", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__drop_relation", "macro_sql": "{% macro bigquery__drop_relation(relation) -%}\n {% call statement('drop_relation') -%}\n drop {{ relation.type }} if exists {{ relation }}\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.932877}, "macro.dbt_bigquery.bigquery__get_columns_in_relation": {"unique_id": "macro.dbt_bigquery.bigquery__get_columns_in_relation", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__get_columns_in_relation", "macro_sql": "{% macro bigquery__get_columns_in_relation(relation) -%}\n {{ return(adapter.get_columns_in_relation(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.933287}, "macro.dbt_bigquery.bigquery__list_relations_without_caching": {"unique_id": "macro.dbt_bigquery.bigquery__list_relations_without_caching", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__list_relations_without_caching", "macro_sql": "{% macro bigquery__list_relations_without_caching(schema_relation) -%}\n {{ return(adapter.list_relations_without_caching(schema_relation)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.933685}, "macro.dbt_bigquery.bigquery__current_timestamp": {"unique_id": "macro.dbt_bigquery.bigquery__current_timestamp", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__current_timestamp", "macro_sql": "{% macro bigquery__current_timestamp() -%}\n CURRENT_TIMESTAMP()\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.9339}, "macro.dbt_bigquery.bigquery__snapshot_string_as_time": {"unique_id": "macro.dbt_bigquery.bigquery__snapshot_string_as_time", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__snapshot_string_as_time", "macro_sql": "{% macro bigquery__snapshot_string_as_time(timestamp) -%}\n {%- set result = 'TIMESTAMP(\"' ~ timestamp ~ '\")' -%}\n {{ return(result) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.9343848}, "macro.dbt_bigquery.bigquery__list_schemas": {"unique_id": "macro.dbt_bigquery.bigquery__list_schemas", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__list_schemas", "macro_sql": "{% macro bigquery__list_schemas(database) -%}\n {{ return(adapter.list_schemas(database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.93479}, "macro.dbt_bigquery.bigquery__check_schema_exists": {"unique_id": "macro.dbt_bigquery.bigquery__check_schema_exists", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__check_schema_exists", "macro_sql": "{% macro bigquery__check_schema_exists(information_schema, schema) %}\n {{ return(adapter.check_schema_exists(information_schema.database, schema)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.93545}, "macro.dbt_bigquery.bigquery__persist_docs": {"unique_id": "macro.dbt_bigquery.bigquery__persist_docs", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__persist_docs", "macro_sql": "{% macro bigquery__persist_docs(relation, model, for_relation, for_columns) -%}\n {% if for_columns and config.persist_column_docs() and model.columns %}\n {% do alter_column_comment(relation, model.columns) %}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.936215}, "macro.dbt_bigquery.bigquery__alter_column_comment": {"unique_id": "macro.dbt_bigquery.bigquery__alter_column_comment", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__alter_column_comment", "macro_sql": "{% macro bigquery__alter_column_comment(relation, column_dict) -%}\n {% do adapter.update_columns(relation, column_dict) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.936647}, "macro.dbt_bigquery.bigquery__rename_relation": {"unique_id": "macro.dbt_bigquery.bigquery__rename_relation", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__rename_relation", "macro_sql": "{% macro bigquery__rename_relation(from_relation, to_relation) -%}\n {% do adapter.rename_relation(from_relation, to_relation) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.937072}, "macro.dbt_bigquery.bigquery__alter_relation_add_columns": {"unique_id": "macro.dbt_bigquery.bigquery__alter_relation_add_columns", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__alter_relation_add_columns", "macro_sql": "{% macro bigquery__alter_relation_add_columns(relation, add_columns) %}\n \n {% set sql -%}\n \n alter {{ relation.type }} {{ relation }}\n {% for column in add_columns %}\n add column {{ column.name }} {{ column.data_type }}{{ ',' if not loop.last }}\n {% endfor %}\n \n {%- endset -%}\n\n {{ return(run_query(sql)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.938161}, "macro.dbt_bigquery.bigquery__alter_relation_drop_columns": {"unique_id": "macro.dbt_bigquery.bigquery__alter_relation_drop_columns", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__alter_relation_drop_columns", "macro_sql": "{% macro bigquery__alter_relation_drop_columns(relation, drop_columns) %}\n \n {% set sql -%}\n \n alter {{ relation.type }} {{ relation }}\n\n {% for column in drop_columns %}\n drop column {{ column.name }}{{ ',' if not loop.last }}\n {% endfor %}\n \n {%- endset -%}\n \n {{ return(run_query(sql)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.939177}, "macro.dbt_bigquery.bigquery__alter_column_type": {"unique_id": "macro.dbt_bigquery.bigquery__alter_column_type", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__alter_column_type", "macro_sql": "{% macro bigquery__alter_column_type(relation, column_name, new_column_type) -%}\n {#-- Changing a column's data type using a query requires you to scan the entire table.\n The query charges can be significant if the table is very large.\n\n https://cloud.google.com/bigquery/docs/manually-changing-schemas#changing_a_columns_data_type\n #}\n {% set relation_columns = get_columns_in_relation(relation) %}\n\n {% set sql %}\n select\n {%- for col in relation_columns -%}\n {% if col.column == column_name %}\n CAST({{ col.quoted }} AS {{ new_column_type }}) AS {{ col.quoted }}\n {%- else %}\n {{ col.quoted }}\n {%- endif %}\n {%- if not loop.last %},{% endif -%}\n {%- endfor %}\n from {{ relation }}\n {% endset %}\n\n {% call statement('alter_column_type') %}\n {{ create_table_as(False, relation, sql)}}\n {%- endcall %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_columns_in_relation", "macro.dbt.statement", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.9409652}, "macro.dbt_bigquery.bigquery__test_unique": {"unique_id": "macro.dbt_bigquery.bigquery__test_unique", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__test_unique", "macro_sql": "{% macro bigquery__test_unique(model, column_name) %}\n\nwith dbt_test__target as (\n \n select {{ column_name }} as unique_field\n from {{ model }}\n where {{ column_name }} is not null\n \n)\n\nselect\n unique_field,\n count(*) as n_records\n\nfrom dbt_test__target\ngroup by unique_field\nhaving count(*) > 1\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.941416}, "macro.dbt_bigquery.bigquery__create_csv_table": {"unique_id": "macro.dbt_bigquery.bigquery__create_csv_table", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "name": "bigquery__create_csv_table", "macro_sql": "{% macro bigquery__create_csv_table(model, agate_table) %}\n -- no-op\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.942343}, "macro.dbt_bigquery.bigquery__reset_csv_table": {"unique_id": "macro.dbt_bigquery.bigquery__reset_csv_table", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "name": "bigquery__reset_csv_table", "macro_sql": "{% macro bigquery__reset_csv_table(model, full_refresh, old_relation, agate_table) %}\n {{ adapter.drop_relation(old_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.9427788}, "macro.dbt_bigquery.bigquery__load_csv_rows": {"unique_id": "macro.dbt_bigquery.bigquery__load_csv_rows", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "name": "bigquery__load_csv_rows", "macro_sql": "{% macro bigquery__load_csv_rows(model, agate_table) %}\n\n {%- set column_override = model['config'].get('column_types', {}) -%}\n {{ adapter.load_dataframe(model['database'], model['schema'], model['alias'],\n \t\t\t\t\t\t\tagate_table, column_override) }}\n {% if config.persist_relation_docs() and 'description' in model %}\n\n \t{{ adapter.update_table_description(model['database'], model['schema'], model['alias'], model['description']) }}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.944406}, "macro.dbt_bigquery.bigquery__handle_existing_table": {"unique_id": "macro.dbt_bigquery.bigquery__handle_existing_table", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/view.sql", "original_file_path": "macros/materializations/view.sql", "name": "bigquery__handle_existing_table", "macro_sql": "{% macro bigquery__handle_existing_table(full_refresh, old_relation) %}\n {%- if full_refresh -%}\n {{ adapter.drop_relation(old_relation) }}\n {%- else -%}\n {{ exceptions.relation_wrong_type(old_relation, 'view') }}\n {%- endif -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.945806}, "macro.dbt_bigquery.materialization_view_bigquery": {"unique_id": "macro.dbt_bigquery.materialization_view_bigquery", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/view.sql", "original_file_path": "macros/materializations/view.sql", "name": "materialization_view_bigquery", "macro_sql": "{% materialization view, adapter='bigquery' -%}\n {% set to_return = create_or_replace_view() %}\n\n {% set target_relation = this.incorporate(type='view') %}\n {% do persist_docs(target_relation, model) %}\n\n {% if config.get('grant_access_to') %}\n {% for grant_target_dict in config.get('grant_access_to') %}\n {% do adapter.grant_access_to(this, 'view', None, grant_target_dict) %}\n {% endfor %}\n {% endif %}\n\n {% do return(to_return) %}\n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_or_replace_view", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.947392}, "macro.dbt_bigquery.materialization_table_bigquery": {"unique_id": "macro.dbt_bigquery.materialization_table_bigquery", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "name": "materialization_table_bigquery", "macro_sql": "{% materialization table, adapter='bigquery' -%}\n\n {%- set identifier = model['alias'] -%}\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set exists_not_as_table = (old_relation is not none and not old_relation.is_table) -%}\n {%- set target_relation = api.Relation.create(database=database, schema=schema, identifier=identifier, type='table') -%}\n\n {{ run_hooks(pre_hooks) }}\n\n {#\n We only need to drop this thing if it is not a table.\n If it _is_ already a table, then we can overwrite it without downtime\n Unlike table -> view, no need for `--full-refresh`: dropping a view is no big deal\n #}\n {%- if exists_not_as_table -%}\n {{ adapter.drop_relation(old_relation) }}\n {%- endif -%}\n\n -- build model\n {%- set raw_partition_by = config.get('partition_by', none) -%}\n {%- set partition_by = adapter.parse_partition_by(raw_partition_by) -%}\n {%- set cluster_by = config.get('cluster_by', none) -%}\n {% if not adapter.is_replaceable(old_relation, partition_by, cluster_by) %}\n {% do log(\"Hard refreshing \" ~ old_relation ~ \" because it is not replaceable\") %}\n {% do adapter.drop_relation(old_relation) %}\n {% endif %}\n {% call statement('main') -%}\n {{ create_table_as(False, target_relation, sql) }}\n {% endcall -%}\n\n {{ run_hooks(post_hooks) }}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.951961}, "macro.dbt_bigquery.materialization_copy_bigquery": {"unique_id": "macro.dbt_bigquery.materialization_copy_bigquery", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/copy.sql", "original_file_path": "macros/materializations/copy.sql", "name": "materialization_copy_bigquery", "macro_sql": "{% materialization copy, adapter='bigquery' -%}\n\n {# Setup #}\n {{ run_hooks(pre_hooks) }}\n\n {% set destination = this.incorporate(type='table') %}\n\n {# there can be several ref() or source() according to BQ copy API docs #}\n {# cycle over ref() and source() to create source tables array #}\n {% set source_array = [] %}\n {% for ref_table in model.refs %}\n {{ source_array.append(ref(*ref_table)) }}\n {% endfor %}\n\n {% for src_table in model.sources %}\n {{ source_array.append(source(*src_table)) }}\n {% endfor %}\n\n {# Call adapter's copy_table function #}\n {%- set result_str = adapter.copy_table(\n source_array,\n destination,\n config.get('copy_materialization', default = 'table')) -%}\n\n {{ store_result('main', response=result_str) }}\n\n {# Clean up #}\n {{ run_hooks(post_hooks) }}\n {{ adapter.commit() }}\n\n {{ return({'relations': [destination]}) }}\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.955111}, "macro.dbt_bigquery.declare_dbt_max_partition": {"unique_id": "macro.dbt_bigquery.declare_dbt_max_partition", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "name": "declare_dbt_max_partition", "macro_sql": "{% macro declare_dbt_max_partition(relation, partition_by, sql) %}\n\n {% if '_dbt_max_partition' in sql %}\n\n declare _dbt_max_partition {{ partition_by.data_type }} default (\n select max({{ partition_by.field }}) from {{ this }}\n where {{ partition_by.field }} is not null\n );\n \n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.959073}, "macro.dbt_bigquery.dbt_bigquery_validate_get_incremental_strategy": {"unique_id": "macro.dbt_bigquery.dbt_bigquery_validate_get_incremental_strategy", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "name": "dbt_bigquery_validate_get_incremental_strategy", "macro_sql": "{% macro dbt_bigquery_validate_get_incremental_strategy(config) %}\n {#-- Find and validate the incremental strategy #}\n {%- set strategy = config.get(\"incremental_strategy\", default=\"merge\") -%}\n\n {% set invalid_strategy_msg -%}\n Invalid incremental strategy provided: {{ strategy }}\n Expected one of: 'merge', 'insert_overwrite'\n {%- endset %}\n {% if strategy not in ['merge', 'insert_overwrite'] %}\n {% do exceptions.raise_compiler_error(invalid_strategy_msg) %}\n {% endif %}\n\n {% do return(strategy) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.9602828}, "macro.dbt_bigquery.bq_insert_overwrite": {"unique_id": "macro.dbt_bigquery.bq_insert_overwrite", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "name": "bq_insert_overwrite", "macro_sql": "{% macro bq_insert_overwrite(\n tmp_relation, target_relation, sql, unique_key, partition_by, partitions, dest_columns, tmp_relation_exists\n) %}\n\n {% if partitions is not none and partitions != [] %} {# static #}\n\n {% set predicate -%}\n {{ partition_by.render(alias='DBT_INTERNAL_DEST') }} in (\n {{ partitions | join (', ') }}\n )\n {%- endset %}\n\n {%- set source_sql -%}\n (\n {{sql}}\n )\n {%- endset -%}\n\n {{ get_insert_overwrite_merge_sql(target_relation, source_sql, dest_columns, [predicate], include_sql_header=true) }}\n\n {% else %} {# dynamic #}\n\n {% set predicate -%}\n {{ partition_by.render(alias='DBT_INTERNAL_DEST') }} in unnest(dbt_partitions_for_replacement)\n {%- endset %}\n\n {%- set source_sql -%}\n (\n select * from {{ tmp_relation }}\n )\n {%- endset -%}\n\n -- generated script to merge partitions into {{ target_relation }}\n declare dbt_partitions_for_replacement array<{{ partition_by.data_type }}>;\n\n {# have we already created the temp table to check for schema changes? #}\n {% if not tmp_relation_exists %}\n {{ declare_dbt_max_partition(this, partition_by, sql) }}\n \n -- 1. create a temp table\n {{ create_table_as(True, tmp_relation, sql) }}\n {% else %}\n -- 1. temp table already exists, we used it to check for schema changes\n {% endif %}\n\n -- 2. define partitions to update\n set (dbt_partitions_for_replacement) = (\n select as struct\n array_agg(distinct {{ partition_by.render() }})\n from {{ tmp_relation }}\n );\n\n {#\n TODO: include_sql_header is a hack; consider a better approach that includes\n the sql_header at the materialization-level instead\n #}\n -- 3. run the merge statement\n {{ get_insert_overwrite_merge_sql(target_relation, source_sql, dest_columns, [predicate], include_sql_header=false) }};\n\n -- 4. clean up the temp table\n drop table if exists {{ tmp_relation }}\n\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_insert_overwrite_merge_sql", "macro.dbt_bigquery.declare_dbt_max_partition", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.963743}, "macro.dbt_bigquery.bq_generate_incremental_build_sql": {"unique_id": "macro.dbt_bigquery.bq_generate_incremental_build_sql", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "name": "bq_generate_incremental_build_sql", "macro_sql": "{% macro bq_generate_incremental_build_sql(\n strategy, tmp_relation, target_relation, sql, unique_key, partition_by, partitions, dest_columns, tmp_relation_exists\n) %}\n {#-- if partitioned, use BQ scripting to get the range of partition values to be updated --#}\n {% if strategy == 'insert_overwrite' %}\n\n {% set missing_partition_msg -%}\n The 'insert_overwrite' strategy requires the `partition_by` config.\n {%- endset %}\n {% if partition_by is none %}\n {% do exceptions.raise_compiler_error(missing_partition_msg) %}\n {% endif %}\n\n {% set build_sql = bq_insert_overwrite(\n tmp_relation, target_relation, sql, unique_key, partition_by, partitions, dest_columns, on_schema_change\n ) %}\n\n {% else %} {# strategy == 'merge' #}\n {%- set source_sql -%}\n {%- if tmp_relation_exists -%}\n (\n select * from {{ tmp_relation }}\n )\n {%- else -%} {#-- wrap sql in parens to make it a subquery --#}\n (\n {{sql}}\n )\n {%- endif -%}\n {%- endset -%}\n\n {% set build_sql = get_merge_sql(target_relation, source_sql, unique_key, dest_columns) %}\n\n {% endif %}\n\n {{ return(build_sql) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bq_insert_overwrite", "macro.dbt.get_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.966035}, "macro.dbt_bigquery.materialization_incremental_bigquery": {"unique_id": "macro.dbt_bigquery.materialization_incremental_bigquery", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "name": "materialization_incremental_bigquery", "macro_sql": "{% materialization incremental, adapter='bigquery' -%}\n\n {%- set unique_key = config.get('unique_key') -%}\n {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n {%- set target_relation = this %}\n {%- set existing_relation = load_relation(this) %}\n {%- set tmp_relation = make_temp_relation(this) %}\n\n {#-- Validate early so we don't run SQL if the strategy is invalid --#}\n {% set strategy = dbt_bigquery_validate_get_incremental_strategy(config) -%}\n\n {%- set raw_partition_by = config.get('partition_by', none) -%}\n {%- set partition_by = adapter.parse_partition_by(raw_partition_by) -%}\n {%- set partitions = config.get('partitions', none) -%}\n {%- set cluster_by = config.get('cluster_by', none) -%}\n\n {% set on_schema_change = incremental_validate_on_schema_change(config.get('on_schema_change'), default='ignore') %}\n\n {{ run_hooks(pre_hooks) }}\n\n {% if existing_relation is none %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n \n {% elif existing_relation.is_view %}\n {#-- There's no way to atomically replace a view with a table on BQ --#}\n {{ adapter.drop_relation(existing_relation) }}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n \n {% elif full_refresh_mode %}\n {#-- If the partition/cluster config has changed, then we must drop and recreate --#}\n {% if not adapter.is_replaceable(existing_relation, partition_by, cluster_by) %}\n {% do log(\"Hard refreshing \" ~ existing_relation ~ \" because it is not replaceable\") %}\n {{ adapter.drop_relation(existing_relation) }}\n {% endif %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n \n {% else %}\n {% set tmp_relation_exists = false %}\n {% if on_schema_change != 'ignore' %} {# Check first, since otherwise we may not build a temp table #}\n {% do run_query(\n declare_dbt_max_partition(this, partition_by, sql) + create_table_as(True, tmp_relation, sql)\n ) %}\n {% set tmp_relation_exists = true %}\n {#-- Process schema changes. Returns dict of changes if successful. Use source columns for upserting/merging --#}\n {% set dest_columns = process_schema_changes(on_schema_change, tmp_relation, existing_relation) %}\n {% endif %}\n {% if not dest_columns %}\n {% set dest_columns = adapter.get_columns_in_relation(existing_relation) %}\n {% endif %}\n {% set build_sql = bq_generate_incremental_build_sql(\n strategy, tmp_relation, target_relation, sql, unique_key, partition_by, partitions, dest_columns, tmp_relation_exists\n ) %}\n\n {% endif %}\n\n {%- call statement('main') -%}\n {{ build_sql }}\n {% endcall %}\n\n {{ run_hooks(post_hooks) }}\n\n {% set target_relation = this.incorporate(type='table') %}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.load_relation", "macro.dbt.make_temp_relation", "macro.dbt_bigquery.dbt_bigquery_validate_get_incremental_strategy", "macro.dbt.incremental_validate_on_schema_change", "macro.dbt.run_hooks", "macro.dbt.create_table_as", "macro.dbt.run_query", "macro.dbt_bigquery.declare_dbt_max_partition", "macro.dbt.process_schema_changes", "macro.dbt_bigquery.bq_generate_incremental_build_sql", "macro.dbt.statement", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.974067}, "macro.dbt_bigquery.bigquery__snapshot_hash_arguments": {"unique_id": "macro.dbt_bigquery.bigquery__snapshot_hash_arguments", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/snapshot.sql", "original_file_path": "macros/materializations/snapshot.sql", "name": "bigquery__snapshot_hash_arguments", "macro_sql": "{% macro bigquery__snapshot_hash_arguments(args) -%}\n to_hex(md5(concat({%- for arg in args -%}\n coalesce(cast({{ arg }} as string), ''){% if not loop.last %}, '|',{% endif -%}\n {%- endfor -%}\n )))\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.97557}, "macro.dbt_bigquery.bigquery__create_columns": {"unique_id": "macro.dbt_bigquery.bigquery__create_columns", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/snapshot.sql", "original_file_path": "macros/materializations/snapshot.sql", "name": "bigquery__create_columns", "macro_sql": "{% macro bigquery__create_columns(relation, columns) %}\n {{ adapter.alter_table_add_columns(relation, columns) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.976353}, "macro.dbt_bigquery.bigquery__post_snapshot": {"unique_id": "macro.dbt_bigquery.bigquery__post_snapshot", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/snapshot.sql", "original_file_path": "macros/materializations/snapshot.sql", "name": "bigquery__post_snapshot", "macro_sql": "{% macro bigquery__post_snapshot(staging_relation) %}\n -- Clean up the snapshot temp table\n {% do drop_relation(staging_relation) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.drop_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.976852}, "macro.dbt.run_hooks": {"unique_id": "macro.dbt.run_hooks", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "run_hooks", "macro_sql": "{% macro run_hooks(hooks, inside_transaction=True) %}\n {% for hook in hooks | selectattr('transaction', 'equalto', inside_transaction) %}\n {% if not inside_transaction and loop.first %}\n {% call statement(auto_begin=inside_transaction) %}\n commit;\n {% endcall %}\n {% endif %}\n {% set rendered = render(hook.get('sql')) | trim %}\n {% if (rendered | length) > 0 %}\n {% call statement(auto_begin=inside_transaction) %}\n {{ rendered }}\n {% endcall %}\n {% endif %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.979854}, "macro.dbt.make_hook_config": {"unique_id": "macro.dbt.make_hook_config", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "make_hook_config", "macro_sql": "{% macro make_hook_config(sql, inside_transaction) %}\n {{ tojson({\"sql\": sql, \"transaction\": inside_transaction}) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.980416}, "macro.dbt.before_begin": {"unique_id": "macro.dbt.before_begin", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "before_begin", "macro_sql": "{% macro before_begin(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.9808261}, "macro.dbt.in_transaction": {"unique_id": "macro.dbt.in_transaction", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "in_transaction", "macro_sql": "{% macro in_transaction(sql) %}\n {{ make_hook_config(sql, inside_transaction=True) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.981245}, "macro.dbt.after_commit": {"unique_id": "macro.dbt.after_commit", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "after_commit", "macro_sql": "{% macro after_commit(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.9816582}, "macro.dbt.set_sql_header": {"unique_id": "macro.dbt.set_sql_header", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "name": "set_sql_header", "macro_sql": "{% macro set_sql_header(config) -%}\n {{ config.set('sql_header', caller()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.9828632}, "macro.dbt.should_full_refresh": {"unique_id": "macro.dbt.should_full_refresh", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "name": "should_full_refresh", "macro_sql": "{% macro should_full_refresh() %}\n {% set config_full_refresh = config.get('full_refresh') %}\n {% if config_full_refresh is none %}\n {% set config_full_refresh = flags.FULL_REFRESH %}\n {% endif %}\n {% do return(config_full_refresh) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.983711}, "macro.dbt.should_store_failures": {"unique_id": "macro.dbt.should_store_failures", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "name": "should_store_failures", "macro_sql": "{% macro should_store_failures() %}\n {% set config_store_failures = config.get('store_failures') %}\n {% if config_store_failures is none %}\n {% set config_store_failures = flags.STORE_FAILURES %}\n {% endif %}\n {% do return(config_store_failures) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.984548}, "macro.dbt.snapshot_merge_sql": {"unique_id": "macro.dbt.snapshot_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshots/snapshot_merge.sql", "name": "snapshot_merge_sql", "macro_sql": "{% macro snapshot_merge_sql(target, source, insert_cols) -%}\n {{ adapter.dispatch('snapshot_merge_sql', 'dbt')(target, source, insert_cols) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__snapshot_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.985753}, "macro.dbt.default__snapshot_merge_sql": {"unique_id": "macro.dbt.default__snapshot_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshots/snapshot_merge.sql", "name": "default__snapshot_merge_sql", "macro_sql": "{% macro default__snapshot_merge_sql(target, source, insert_cols) -%}\n {%- set insert_cols_csv = insert_cols | join(', ') -%}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on DBT_INTERNAL_SOURCE.dbt_scd_id = DBT_INTERNAL_DEST.dbt_scd_id\n\n when matched\n and DBT_INTERNAL_DEST.dbt_valid_to is null\n and DBT_INTERNAL_SOURCE.dbt_change_type in ('update', 'delete')\n then update\n set dbt_valid_to = DBT_INTERNAL_SOURCE.dbt_valid_to\n\n when not matched\n and DBT_INTERNAL_SOURCE.dbt_change_type = 'insert'\n then insert ({{ insert_cols_csv }})\n values ({{ insert_cols_csv }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.9864829}, "macro.dbt.strategy_dispatch": {"unique_id": "macro.dbt.strategy_dispatch", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "strategy_dispatch", "macro_sql": "{% macro strategy_dispatch(name) -%}\n{% set original_name = name %}\n {% if '.' in name %}\n {% set package_name, name = name.split(\".\", 1) %}\n {% else %}\n {% set package_name = none %}\n {% endif %}\n\n {% if package_name is none %}\n {% set package_context = context %}\n {% elif package_name in context %}\n {% set package_context = context[package_name] %}\n {% else %}\n {% set error_msg %}\n Could not find package '{{package_name}}', called with '{{original_name}}'\n {% endset %}\n {{ exceptions.raise_compiler_error(error_msg | trim) }}\n {% endif %}\n\n {%- set search_name = 'snapshot_' ~ name ~ '_strategy' -%}\n\n {% if search_name not in package_context %}\n {% set error_msg %}\n The specified strategy macro '{{name}}' was not found in package '{{ package_name }}'\n {% endset %}\n {{ exceptions.raise_compiler_error(error_msg | trim) }}\n {% endif %}\n {{ return(package_context[search_name]) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.993691}, "macro.dbt.snapshot_hash_arguments": {"unique_id": "macro.dbt.snapshot_hash_arguments", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_hash_arguments", "macro_sql": "{% macro snapshot_hash_arguments(args) -%}\n {{ adapter.dispatch('snapshot_hash_arguments', 'dbt')(args) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.994161}, "macro.dbt.default__snapshot_hash_arguments": {"unique_id": "macro.dbt.default__snapshot_hash_arguments", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "default__snapshot_hash_arguments", "macro_sql": "{% macro default__snapshot_hash_arguments(args) -%}\n md5({%- for arg in args -%}\n coalesce(cast({{ arg }} as varchar ), '')\n {% if not loop.last %} || '|' || {% endif %}\n {%- endfor -%})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.994768}, "macro.dbt.snapshot_get_time": {"unique_id": "macro.dbt.snapshot_get_time", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_get_time", "macro_sql": "{% macro snapshot_get_time() -%}\n {{ adapter.dispatch('snapshot_get_time', 'dbt')() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.9951591}, "macro.dbt.default__snapshot_get_time": {"unique_id": "macro.dbt.default__snapshot_get_time", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "default__snapshot_get_time", "macro_sql": "{% macro default__snapshot_get_time() -%}\n {{ current_timestamp() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.995428}, "macro.dbt.snapshot_timestamp_strategy": {"unique_id": "macro.dbt.snapshot_timestamp_strategy", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_timestamp_strategy", "macro_sql": "{% macro snapshot_timestamp_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n {% set primary_key = config['unique_key'] %}\n {% set updated_at = config['updated_at'] %}\n {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n\n {#/*\n The snapshot relation might not have an {{ updated_at }} value if the\n snapshot strategy is changed from `check` to `timestamp`. We\n should use a dbt-created column for the comparison in the snapshot\n table instead of assuming that the user-supplied {{ updated_at }}\n will be present in the historical data.\n\n See https://github.com/dbt-labs/dbt-core/issues/2350\n */ #}\n {% set row_changed_expr -%}\n ({{ snapshotted_rel }}.dbt_valid_from < {{ current_rel }}.{{ updated_at }})\n {%- endset %}\n\n {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n {% do return({\n \"unique_key\": primary_key,\n \"updated_at\": updated_at,\n \"row_changed\": row_changed_expr,\n \"scd_id\": scd_id_expr,\n \"invalidate_hard_deletes\": invalidate_hard_deletes\n }) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.997559}, "macro.dbt.snapshot_string_as_time": {"unique_id": "macro.dbt.snapshot_string_as_time", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_string_as_time", "macro_sql": "{% macro snapshot_string_as_time(timestamp) -%}\n {{ adapter.dispatch('snapshot_string_as_time', 'dbt')(timestamp) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__snapshot_string_as_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.998008}, "macro.dbt.default__snapshot_string_as_time": {"unique_id": "macro.dbt.default__snapshot_string_as_time", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "default__snapshot_string_as_time", "macro_sql": "{% macro default__snapshot_string_as_time(timestamp) %}\n {% do exceptions.raise_not_implemented(\n 'snapshot_string_as_time macro not implemented for adapter '+adapter.type()\n ) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.998471}, "macro.dbt.snapshot_check_all_get_existing_columns": {"unique_id": "macro.dbt.snapshot_check_all_get_existing_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_check_all_get_existing_columns", "macro_sql": "{% macro snapshot_check_all_get_existing_columns(node, target_exists) -%}\n {%- set query_columns = get_columns_in_query(node['compiled_sql']) -%}\n {%- if not target_exists -%}\n {# no table yet -> return whatever the query does #}\n {{ return([false, query_columns]) }}\n {%- endif -%}\n {# handle any schema changes #}\n {%- set target_table = node.get('alias', node.get('name')) -%}\n {%- set target_relation = adapter.get_relation(database=node.database, schema=node.schema, identifier=target_table) -%}\n {%- set existing_cols = get_columns_in_query('select * from ' ~ target_relation) -%}\n {%- set ns = namespace() -%} {# handle for-loop scoping with a namespace #}\n {%- set ns.column_added = false -%}\n\n {%- set intersection = [] -%}\n {%- for col in query_columns -%}\n {%- if col in existing_cols -%}\n {%- do intersection.append(col) -%}\n {%- else -%}\n {% set ns.column_added = true %}\n {%- endif -%}\n {%- endfor -%}\n {{ return([ns.column_added, intersection]) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.0011}, "macro.dbt.snapshot_check_strategy": {"unique_id": "macro.dbt.snapshot_check_strategy", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_check_strategy", "macro_sql": "{% macro snapshot_check_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n {% set check_cols_config = config['check_cols'] %}\n {% set primary_key = config['unique_key'] %}\n {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n \n {% set select_current_time -%}\n select {{ snapshot_get_time() }} as snapshot_start\n {%- endset %}\n\n {#-- don't access the column by name, to avoid dealing with casing issues on snowflake #}\n {%- set now = run_query(select_current_time)[0][0] -%}\n {% if now is none or now is undefined -%}\n {%- do exceptions.raise_compiler_error('Could not get a snapshot start time from the database') -%}\n {%- endif %}\n {% set updated_at = config.get('updated_at', snapshot_string_as_time(now)) %}\n\n {% set column_added = false %}\n\n {% if check_cols_config == 'all' %}\n {% set column_added, check_cols = snapshot_check_all_get_existing_columns(node, target_exists) %}\n {% elif check_cols_config is iterable and (check_cols_config | length) > 0 %}\n {% set check_cols = check_cols_config %}\n {% else %}\n {% do exceptions.raise_compiler_error(\"Invalid value for 'check_cols': \" ~ check_cols_config) %}\n {% endif %}\n\n {%- set row_changed_expr -%}\n (\n {%- if column_added -%}\n TRUE\n {%- else -%}\n {%- for col in check_cols -%}\n {{ snapshotted_rel }}.{{ col }} != {{ current_rel }}.{{ col }}\n or\n (\n (({{ snapshotted_rel }}.{{ col }} is null) and not ({{ current_rel }}.{{ col }} is null))\n or\n ((not {{ snapshotted_rel }}.{{ col }} is null) and ({{ current_rel }}.{{ col }} is null))\n )\n {%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n {%- endif -%}\n )\n {%- endset %}\n\n {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n {% do return({\n \"unique_key\": primary_key,\n \"updated_at\": updated_at,\n \"row_changed\": row_changed_expr,\n \"scd_id\": scd_id_expr,\n \"invalidate_hard_deletes\": invalidate_hard_deletes\n }) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.snapshot_get_time", "macro.dbt.run_query", "macro.dbt.snapshot_string_as_time", "macro.dbt.snapshot_check_all_get_existing_columns", "macro.dbt.snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.006127}, "macro.dbt.create_columns": {"unique_id": "macro.dbt.create_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "create_columns", "macro_sql": "{% macro create_columns(relation, columns) %}\n {{ adapter.dispatch('create_columns', 'dbt')(relation, columns) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_columns"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.012222}, "macro.dbt.default__create_columns": {"unique_id": "macro.dbt.default__create_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "default__create_columns", "macro_sql": "{% macro default__create_columns(relation, columns) %}\n {% for column in columns %}\n {% call statement() %}\n alter table {{ relation }} add column \"{{ column.name }}\" {{ column.data_type }};\n {% endcall %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.013012}, "macro.dbt.post_snapshot": {"unique_id": "macro.dbt.post_snapshot", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "post_snapshot", "macro_sql": "{% macro post_snapshot(staging_relation) %}\n {{ adapter.dispatch('post_snapshot', 'dbt')(staging_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.013479}, "macro.dbt.default__post_snapshot": {"unique_id": "macro.dbt.default__post_snapshot", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "default__post_snapshot", "macro_sql": "{% macro default__post_snapshot(staging_relation) %}\n {# no-op #}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.013728}, "macro.dbt.snapshot_staging_table": {"unique_id": "macro.dbt.snapshot_staging_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "snapshot_staging_table", "macro_sql": "{% macro snapshot_staging_table(strategy, source_sql, target_relation) -%}\n {{ adapter.dispatch('snapshot_staging_table', 'dbt')(strategy, source_sql, target_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__snapshot_staging_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.014283}, "macro.dbt.default__snapshot_staging_table": {"unique_id": "macro.dbt.default__snapshot_staging_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "default__snapshot_staging_table", "macro_sql": "{% macro default__snapshot_staging_table(strategy, source_sql, target_relation) -%}\n\n with snapshot_query as (\n\n {{ source_sql }}\n\n ),\n\n snapshotted_data as (\n\n select *,\n {{ strategy.unique_key }} as dbt_unique_key\n\n from {{ target_relation }}\n where dbt_valid_to is null\n\n ),\n\n insertions_source_data as (\n\n select\n *,\n {{ strategy.unique_key }} as dbt_unique_key,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to,\n {{ strategy.scd_id }} as dbt_scd_id\n\n from snapshot_query\n ),\n\n updates_source_data as (\n\n select\n *,\n {{ strategy.unique_key }} as dbt_unique_key,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n {{ strategy.updated_at }} as dbt_valid_to\n\n from snapshot_query\n ),\n\n {%- if strategy.invalidate_hard_deletes %}\n\n deletes_source_data as (\n\n select \n *,\n {{ strategy.unique_key }} as dbt_unique_key\n from snapshot_query\n ),\n {% endif %}\n\n insertions as (\n\n select\n 'insert' as dbt_change_type,\n source_data.*\n\n from insertions_source_data as source_data\n left outer join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where snapshotted_data.dbt_unique_key is null\n or (\n snapshotted_data.dbt_unique_key is not null\n and (\n {{ strategy.row_changed }}\n )\n )\n\n ),\n\n updates as (\n\n select\n 'update' as dbt_change_type,\n source_data.*,\n snapshotted_data.dbt_scd_id\n\n from updates_source_data as source_data\n join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where (\n {{ strategy.row_changed }}\n )\n )\n\n {%- if strategy.invalidate_hard_deletes -%}\n ,\n\n deletes as (\n \n select\n 'delete' as dbt_change_type,\n source_data.*,\n {{ snapshot_get_time() }} as dbt_valid_from,\n {{ snapshot_get_time() }} as dbt_updated_at,\n {{ snapshot_get_time() }} as dbt_valid_to,\n snapshotted_data.dbt_scd_id\n \n from snapshotted_data\n left join deletes_source_data as source_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where source_data.dbt_unique_key is null\n )\n {%- endif %}\n\n select * from insertions\n union all\n select * from updates\n {%- if strategy.invalidate_hard_deletes %}\n union all\n select * from deletes\n {%- endif %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.016578}, "macro.dbt.build_snapshot_table": {"unique_id": "macro.dbt.build_snapshot_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "build_snapshot_table", "macro_sql": "{% macro build_snapshot_table(strategy, sql) -%}\n {{ adapter.dispatch('build_snapshot_table', 'dbt')(strategy, sql) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__build_snapshot_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.0170932}, "macro.dbt.default__build_snapshot_table": {"unique_id": "macro.dbt.default__build_snapshot_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "default__build_snapshot_table", "macro_sql": "{% macro default__build_snapshot_table(strategy, sql) %}\n\n select *,\n {{ strategy.scd_id }} as dbt_scd_id,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to\n from (\n {{ sql }}\n ) sbq\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.01778}, "macro.dbt.build_snapshot_staging_table": {"unique_id": "macro.dbt.build_snapshot_staging_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "build_snapshot_staging_table", "macro_sql": "{% macro build_snapshot_staging_table(strategy, sql, target_relation) %}\n {% set tmp_relation = make_temp_relation(target_relation) %}\n\n {% set select = snapshot_staging_table(strategy, sql, target_relation) %}\n\n {% call statement('build_snapshot_staging_relation') %}\n {{ create_table_as(True, tmp_relation, select) }}\n {% endcall %}\n\n {% do return(tmp_relation) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_temp_relation", "macro.dbt.snapshot_staging_table", "macro.dbt.statement", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.018938}, "macro.dbt.materialization_snapshot_default": {"unique_id": "macro.dbt.materialization_snapshot_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/snapshot.sql", "original_file_path": "macros/materializations/snapshots/snapshot.sql", "name": "materialization_snapshot_default", "macro_sql": "{% materialization snapshot, default %}\n {%- set config = model['config'] -%}\n\n {%- set target_table = model.get('alias', model.get('name')) -%}\n\n {%- set strategy_name = config.get('strategy') -%}\n {%- set unique_key = config.get('unique_key') %}\n\n {% if not adapter.check_schema_exists(model.database, model.schema) %}\n {% do create_schema(model.database, model.schema) %}\n {% endif %}\n\n {% set target_relation_exists, target_relation = get_or_create_relation(\n database=model.database,\n schema=model.schema,\n identifier=target_table,\n type='table') -%}\n\n {%- if not target_relation.is_table -%}\n {% do exceptions.relation_wrong_type(target_relation, 'table') %}\n {%- endif -%}\n\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set strategy_macro = strategy_dispatch(strategy_name) %}\n {% set strategy = strategy_macro(model, \"snapshotted_data\", \"source_data\", config, target_relation_exists) %}\n\n {% if not target_relation_exists %}\n\n {% set build_sql = build_snapshot_table(strategy, model['compiled_sql']) %}\n {% set final_sql = create_table_as(False, target_relation, build_sql) %}\n\n {% else %}\n\n {{ adapter.valid_snapshot_target(target_relation) }}\n\n {% set staging_table = build_snapshot_staging_table(strategy, sql, target_relation) %}\n\n -- this may no-op if the database does not require column expansion\n {% do adapter.expand_target_column_types(from_relation=staging_table,\n to_relation=target_relation) %}\n\n {% set missing_columns = adapter.get_missing_columns(staging_table, target_relation)\n | rejectattr('name', 'equalto', 'dbt_change_type')\n | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n | rejectattr('name', 'equalto', 'dbt_unique_key')\n | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n | list %}\n\n {% do create_columns(target_relation, missing_columns) %}\n\n {% set source_columns = adapter.get_columns_in_relation(staging_table)\n | rejectattr('name', 'equalto', 'dbt_change_type')\n | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n | rejectattr('name', 'equalto', 'dbt_unique_key')\n | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n | list %}\n\n {% set quoted_source_columns = [] %}\n {% for column in source_columns %}\n {% do quoted_source_columns.append(adapter.quote(column.name)) %}\n {% endfor %}\n\n {% set final_sql = snapshot_merge_sql(\n target = target_relation,\n source = staging_table,\n insert_cols = quoted_source_columns\n )\n %}\n\n {% endif %}\n\n {% call statement('main') %}\n {{ final_sql }}\n {% endcall %}\n\n {% do persist_docs(target_relation, model) %}\n\n {% if not target_relation_exists %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {% if staging_table is defined %}\n {% do post_snapshot(staging_table) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_schema", "macro.dbt.get_or_create_relation", "macro.dbt.run_hooks", "macro.dbt.strategy_dispatch", "macro.dbt.build_snapshot_table", "macro.dbt.create_table_as", "macro.dbt.build_snapshot_staging_table", "macro.dbt.create_columns", "macro.dbt.snapshot_merge_sql", "macro.dbt.statement", "macro.dbt.persist_docs", "macro.dbt.create_indexes", "macro.dbt.post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.0325398}, "macro.dbt.materialization_test_default": {"unique_id": "macro.dbt.materialization_test_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/test.sql", "original_file_path": "macros/materializations/tests/test.sql", "name": "materialization_test_default", "macro_sql": "{%- materialization test, default -%}\n\n {% set relations = [] %}\n\n {% if should_store_failures() %}\n\n {% set identifier = model['alias'] %}\n {% set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n {% set target_relation = api.Relation.create(\n identifier=identifier, schema=schema, database=database, type='table') -%} %}\n \n {% if old_relation %}\n {% do adapter.drop_relation(old_relation) %}\n {% endif %}\n \n {% call statement(auto_begin=True) %}\n {{ create_table_as(False, target_relation, sql) }}\n {% endcall %}\n \n {% do relations.append(target_relation) %}\n \n {% set main_sql %}\n select *\n from {{ target_relation }}\n {% endset %}\n \n {{ adapter.commit() }}\n \n {% else %}\n\n {% set main_sql = sql %}\n \n {% endif %}\n\n {% set limit = config.get('limit') %}\n {% set fail_calc = config.get('fail_calc') %}\n {% set warn_if = config.get('warn_if') %}\n {% set error_if = config.get('error_if') %}\n\n {% call statement('main', fetch_result=True) -%}\n\n {{ get_test_sql(main_sql, fail_calc, warn_if, error_if, limit)}}\n\n {%- endcall %}\n \n {{ return({'relations': relations}) }}\n\n{%- endmaterialization -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.should_store_failures", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt.get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.037768}, "macro.dbt.get_test_sql": {"unique_id": "macro.dbt.get_test_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/helpers.sql", "original_file_path": "macros/materializations/tests/helpers.sql", "name": "get_test_sql", "macro_sql": "{% macro get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n {{ adapter.dispatch('get_test_sql', 'dbt')(main_sql, fail_calc, warn_if, error_if, limit) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.038992}, "macro.dbt.default__get_test_sql": {"unique_id": "macro.dbt.default__get_test_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/helpers.sql", "original_file_path": "macros/materializations/tests/helpers.sql", "name": "default__get_test_sql", "macro_sql": "{% macro default__get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n select\n {{ fail_calc }} as failures,\n {{ fail_calc }} {{ warn_if }} as should_warn,\n {{ fail_calc }} {{ error_if }} as should_error\n from (\n {{ main_sql }}\n {{ \"limit \" ~ limit if limit != none }}\n ) dbt_internal_test\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.039804}, "macro.dbt.get_where_subquery": {"unique_id": "macro.dbt.get_where_subquery", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/where_subquery.sql", "original_file_path": "macros/materializations/tests/where_subquery.sql", "name": "get_where_subquery", "macro_sql": "{% macro get_where_subquery(relation) -%}\n {% do return(adapter.dispatch('get_where_subquery', 'dbt')(relation)) %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_where_subquery"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.040861}, "macro.dbt.default__get_where_subquery": {"unique_id": "macro.dbt.default__get_where_subquery", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/where_subquery.sql", "original_file_path": "macros/materializations/tests/where_subquery.sql", "name": "default__get_where_subquery", "macro_sql": "{% macro default__get_where_subquery(relation) -%}\n {% set where = config.get('where', '') %}\n {% if where %}\n {%- set filtered -%}\n (select * from {{ relation }} where {{ where }}) dbt_subquery\n {%- endset -%}\n {% do return(filtered) %}\n {%- else -%}\n {% do return(relation) %}\n {%- endif -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.041891}, "macro.dbt.get_quoted_csv": {"unique_id": "macro.dbt.get_quoted_csv", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "name": "get_quoted_csv", "macro_sql": "{% macro get_quoted_csv(column_names) %}\n \n {% set quoted = [] %}\n {% for col in column_names -%}\n {%- do quoted.append(adapter.quote(col)) -%}\n {%- endfor %}\n\n {%- set dest_cols_csv = quoted | join(', ') -%}\n {{ return(dest_cols_csv) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.0438342}, "macro.dbt.diff_columns": {"unique_id": "macro.dbt.diff_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "name": "diff_columns", "macro_sql": "{% macro diff_columns(source_columns, target_columns) %}\n\n {% set result = [] %}\n {% set source_names = source_columns | map(attribute = 'column') | list %}\n {% set target_names = target_columns | map(attribute = 'column') | list %}\n \n {# --check whether the name attribute exists in the target - this does not perform a data type check #}\n {% for sc in source_columns %}\n {% if sc.name not in target_names %}\n {{ result.append(sc) }}\n {% endif %}\n {% endfor %}\n \n {{ return(result) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.0452769}, "macro.dbt.diff_column_data_types": {"unique_id": "macro.dbt.diff_column_data_types", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "name": "diff_column_data_types", "macro_sql": "{% macro diff_column_data_types(source_columns, target_columns) %}\n \n {% set result = [] %}\n {% for sc in source_columns %}\n {% set tc = target_columns | selectattr(\"name\", \"equalto\", sc.name) | list | first %}\n {% if tc %}\n {% if sc.data_type != tc.data_type %}\n {{ result.append( { 'column_name': tc.name, 'new_type': sc.data_type } ) }} \n {% endif %}\n {% endif %}\n {% endfor %}\n\n {{ return(result) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.0468931}, "macro.dbt.get_merge_sql": {"unique_id": "macro.dbt.get_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "get_merge_sql", "macro_sql": "{% macro get_merge_sql(target, source, unique_key, dest_columns, predicates=none) -%}\n {{ adapter.dispatch('get_merge_sql', 'dbt')(target, source, unique_key, dest_columns, predicates) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.05217}, "macro.dbt.default__get_merge_sql": {"unique_id": "macro.dbt.default__get_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "default__get_merge_sql", "macro_sql": "{% macro default__get_merge_sql(target, source, unique_key, dest_columns, predicates) -%}\n {%- set predicates = [] if predicates is none else [] + predicates -%}\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n {%- set update_columns = config.get('merge_update_columns', default = dest_columns | map(attribute=\"quoted\") | list) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {% if unique_key %}\n {% set unique_key_match %}\n DBT_INTERNAL_SOURCE.{{ unique_key }} = DBT_INTERNAL_DEST.{{ unique_key }}\n {% endset %}\n {% do predicates.append(unique_key_match) %}\n {% else %}\n {% do predicates.append('FALSE') %}\n {% endif %}\n\n {{ sql_header if sql_header is not none }}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on {{ predicates | join(' and ') }}\n\n {% if unique_key %}\n when matched then update set\n {% for column_name in update_columns -%}\n {{ column_name }} = DBT_INTERNAL_SOURCE.{{ column_name }}\n {%- if not loop.last %}, {%- endif %}\n {%- endfor %}\n {% endif %}\n\n when not matched then insert\n ({{ dest_cols_csv }})\n values\n ({{ dest_cols_csv }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.055203}, "macro.dbt.get_delete_insert_merge_sql": {"unique_id": "macro.dbt.get_delete_insert_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "get_delete_insert_merge_sql", "macro_sql": "{% macro get_delete_insert_merge_sql(target, source, unique_key, dest_columns) -%}\n {{ adapter.dispatch('get_delete_insert_merge_sql', 'dbt')(target, source, unique_key, dest_columns) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_delete_insert_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.055819}, "macro.dbt.default__get_delete_insert_merge_sql": {"unique_id": "macro.dbt.default__get_delete_insert_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "default__get_delete_insert_merge_sql", "macro_sql": "{% macro default__get_delete_insert_merge_sql(target, source, unique_key, dest_columns) -%}\n\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n {% if unique_key is not none %}\n delete from {{ target }}\n where ({{ unique_key }}) in (\n select ({{ unique_key }})\n from {{ source }}\n );\n {% endif %}\n\n insert into {{ target }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ source }}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.0569532}, "macro.dbt.get_insert_overwrite_merge_sql": {"unique_id": "macro.dbt.get_insert_overwrite_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "get_insert_overwrite_merge_sql", "macro_sql": "{% macro get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header=false) -%}\n {{ adapter.dispatch('get_insert_overwrite_merge_sql', 'dbt')(target, source, dest_columns, predicates, include_sql_header) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_insert_overwrite_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.057643}, "macro.dbt.default__get_insert_overwrite_merge_sql": {"unique_id": "macro.dbt.default__get_insert_overwrite_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "default__get_insert_overwrite_merge_sql", "macro_sql": "{% macro default__get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header) -%}\n {%- set predicates = [] if predicates is none else [] + predicates -%}\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none and include_sql_header }}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on FALSE\n\n when not matched by source\n {% if predicates %} and {{ predicates | join(' and ') }} {% endif %}\n then delete\n\n when not matched then insert\n ({{ dest_cols_csv }})\n values\n ({{ dest_cols_csv }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.059339}, "macro.dbt.is_incremental": {"unique_id": "macro.dbt.is_incremental", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/is_incremental.sql", "original_file_path": "macros/materializations/models/incremental/is_incremental.sql", "name": "is_incremental", "macro_sql": "{% macro is_incremental() %}\n {#-- do not run introspective queries in parsing #}\n {% if not execute %}\n {{ return(False) }}\n {% else %}\n {% set relation = adapter.get_relation(this.database, this.schema, this.table) %}\n {{ return(relation is not none\n and relation.type == 'table'\n and model.config.materialized == 'incremental'\n and not should_full_refresh()) }}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.should_full_refresh"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.0611022}, "macro.dbt.materialization_incremental_default": {"unique_id": "macro.dbt.materialization_incremental_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/incremental.sql", "original_file_path": "macros/materializations/models/incremental/incremental.sql", "name": "materialization_incremental_default", "macro_sql": "{% materialization incremental, default -%}\n\n {% set unique_key = config.get('unique_key') %}\n\n {% set target_relation = this.incorporate(type='table') %}\n {% set existing_relation = load_relation(this) %}\n {% set tmp_relation = make_temp_relation(target_relation) %}\n {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n {% set on_schema_change = incremental_validate_on_schema_change(config.get('on_schema_change'), default='ignore') %}\n\n {% set tmp_identifier = model['name'] + '__dbt_tmp' %}\n {% set backup_identifier = model['name'] + \"__dbt_backup\" %}\n\n -- the intermediate_ and backup_ relations should not already exist in the database; get_relation\n -- will return None in that case. Otherwise, we get a relation that we can drop\n -- later, before we try to use this name for the current operation. This has to happen before\n -- BEGIN, in a separate transaction\n {% set preexisting_intermediate_relation = adapter.get_relation(identifier=tmp_identifier, \n schema=schema,\n database=database) %} \n {% set preexisting_backup_relation = adapter.get_relation(identifier=backup_identifier,\n schema=schema,\n database=database) %}\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set to_drop = [] %}\n\n {# -- first check whether we want to full refresh for source view or config reasons #}\n {% set trigger_full_refresh = (full_refresh_mode or existing_relation.is_view) %}\n\n {% if existing_relation is none %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n{% elif trigger_full_refresh %}\n {#-- Make sure the backup doesn't exist so we don't encounter issues with the rename below #}\n {% set tmp_identifier = model['name'] + '__dbt_tmp' %}\n {% set backup_identifier = model['name'] + '__dbt_backup' %}\n {% set intermediate_relation = existing_relation.incorporate(path={\"identifier\": tmp_identifier}) %}\n {% set backup_relation = existing_relation.incorporate(path={\"identifier\": backup_identifier}) %}\n\n {% set build_sql = create_table_as(False, intermediate_relation, sql) %}\n {% set need_swap = true %}\n {% do to_drop.append(backup_relation) %}\n {% else %}\n {% do run_query(create_table_as(True, tmp_relation, sql)) %}\n {% do adapter.expand_target_column_types(\n from_relation=tmp_relation,\n to_relation=target_relation) %}\n {#-- Process schema changes. Returns dict of changes if successful. Use source columns for upserting/merging --#}\n {% set dest_columns = process_schema_changes(on_schema_change, tmp_relation, existing_relation) %}\n {% if not dest_columns %}\n {% set dest_columns = adapter.get_columns_in_relation(existing_relation) %}\n {% endif %}\n {% set build_sql = get_delete_insert_merge_sql(target_relation, tmp_relation, unique_key, dest_columns) %}\n \n {% endif %}\n\n {% call statement(\"main\") %}\n {{ build_sql }}\n {% endcall %}\n\n {% if need_swap %} \n {% do adapter.rename_relation(target_relation, backup_relation) %} \n {% do adapter.rename_relation(intermediate_relation, target_relation) %} \n {% endif %}\n\n {% do persist_docs(target_relation, model) %}\n\n {% if existing_relation is none or existing_relation.is_view or should_full_refresh() %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {% do adapter.commit() %}\n\n {% for rel in to_drop %}\n {% do adapter.drop_relation(rel) %}\n {% endfor %}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.load_relation", "macro.dbt.make_temp_relation", "macro.dbt.should_full_refresh", "macro.dbt.incremental_validate_on_schema_change", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.create_table_as", "macro.dbt.run_query", "macro.dbt.process_schema_changes", "macro.dbt.get_delete_insert_merge_sql", "macro.dbt.statement", "macro.dbt.persist_docs", "macro.dbt.create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.0728068}, "macro.dbt.incremental_validate_on_schema_change": {"unique_id": "macro.dbt.incremental_validate_on_schema_change", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "name": "incremental_validate_on_schema_change", "macro_sql": "{% macro incremental_validate_on_schema_change(on_schema_change, default='ignore') %}\n \n {% if on_schema_change not in ['sync_all_columns', 'append_new_columns', 'fail', 'ignore'] %}\n \n {% set log_message = 'Invalid value for on_schema_change (%s) specified. Setting default value of %s.' % (on_schema_change, default) %}\n {% do log(log_message) %}\n \n {{ return(default) }}\n\n {% else %}\n\n {{ return(on_schema_change) }}\n \n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.082229}, "macro.dbt.check_for_schema_changes": {"unique_id": "macro.dbt.check_for_schema_changes", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "name": "check_for_schema_changes", "macro_sql": "{% macro check_for_schema_changes(source_relation, target_relation) %}\n \n {% set schema_changed = False %}\n \n {%- set source_columns = adapter.get_columns_in_relation(source_relation) -%}\n {%- set target_columns = adapter.get_columns_in_relation(target_relation) -%}\n {%- set source_not_in_target = diff_columns(source_columns, target_columns) -%}\n {%- set target_not_in_source = diff_columns(target_columns, source_columns) -%}\n\n {% set new_target_types = diff_column_data_types(source_columns, target_columns) %}\n\n {% if source_not_in_target != [] %}\n {% set schema_changed = True %}\n {% elif target_not_in_source != [] or new_target_types != [] %}\n {% set schema_changed = True %}\n {% elif new_target_types != [] %}\n {% set schema_changed = True %}\n {% endif %}\n \n {% set changes_dict = {\n 'schema_changed': schema_changed,\n 'source_not_in_target': source_not_in_target,\n 'target_not_in_source': target_not_in_source,\n 'source_columns': source_columns,\n 'target_columns': target_columns,\n 'new_target_types': new_target_types\n } %}\n\n {% set msg %}\n In {{ target_relation }}:\n Schema changed: {{ schema_changed }}\n Source columns not in target: {{ source_not_in_target }}\n Target columns not in source: {{ target_not_in_source }}\n New column types: {{ new_target_types }}\n {% endset %}\n \n {% do log(msg) %}\n\n {{ return(changes_dict) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.diff_columns", "macro.dbt.diff_column_data_types"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.085539}, "macro.dbt.sync_column_schemas": {"unique_id": "macro.dbt.sync_column_schemas", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "name": "sync_column_schemas", "macro_sql": "{% macro sync_column_schemas(on_schema_change, target_relation, schema_changes_dict) %}\n \n {%- set add_to_target_arr = schema_changes_dict['source_not_in_target'] -%}\n\n {%- if on_schema_change == 'append_new_columns'-%}\n {%- if add_to_target_arr | length > 0 -%}\n {%- do alter_relation_add_remove_columns(target_relation, add_to_target_arr, none) -%}\n {%- endif -%}\n \n {% elif on_schema_change == 'sync_all_columns' %}\n {%- set remove_from_target_arr = schema_changes_dict['target_not_in_source'] -%}\n {%- set new_target_types = schema_changes_dict['new_target_types'] -%}\n \n {% if add_to_target_arr | length > 0 or remove_from_target_arr | length > 0 %} \n {%- do alter_relation_add_remove_columns(target_relation, add_to_target_arr, remove_from_target_arr) -%}\n {% endif %}\n\n {% if new_target_types != [] %}\n {% for ntt in new_target_types %}\n {% set column_name = ntt['column_name'] %}\n {% set new_type = ntt['new_type'] %}\n {% do alter_column_type(target_relation, column_name, new_type) %}\n {% endfor %}\n {% endif %}\n \n {% endif %}\n\n {% set schema_change_message %}\n In {{ target_relation }}:\n Schema change approach: {{ on_schema_change }}\n Columns added: {{ add_to_target_arr }}\n Columns removed: {{ remove_from_target_arr }}\n Data types changed: {{ new_target_types }}\n {% endset %}\n \n {% do log(schema_change_message) %}\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.alter_relation_add_remove_columns", "macro.dbt.alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.088779}, "macro.dbt.process_schema_changes": {"unique_id": "macro.dbt.process_schema_changes", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "name": "process_schema_changes", "macro_sql": "{% macro process_schema_changes(on_schema_change, source_relation, target_relation) %}\n \n {% if on_schema_change == 'ignore' %}\n\n {{ return({}) }}\n\n {% else %}\n \n {% set schema_changes_dict = check_for_schema_changes(source_relation, target_relation) %}\n \n {% if schema_changes_dict['schema_changed'] %}\n \n {% if on_schema_change == 'fail' %}\n \n {% set fail_msg %}\n The source and target schemas on this incremental model are out of sync!\n They can be reconciled in several ways: \n - set the `on_schema_change` config to either append_new_columns or sync_all_columns, depending on your situation.\n - Re-run the incremental model with `full_refresh: True` to update the target schema.\n - update the schema manually and re-run the process.\n {% endset %}\n \n {% do exceptions.raise_compiler_error(fail_msg) %}\n \n {# -- unless we ignore, run the sync operation per the config #}\n {% else %}\n \n {% do sync_column_schemas(on_schema_change, target_relation, schema_changes_dict) %}\n \n {% endif %}\n \n {% endif %}\n\n {{ return(schema_changes_dict['source_columns']) }}\n \n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.check_for_schema_changes", "macro.dbt.sync_column_schemas"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.090712}, "macro.dbt.materialization_table_default": {"unique_id": "macro.dbt.materialization_table_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/table.sql", "original_file_path": "macros/materializations/models/table/table.sql", "name": "materialization_table_default", "macro_sql": "{% materialization table, default %}\n {%- set identifier = model['alias'] -%}\n {%- set tmp_identifier = model['name'] + '__dbt_tmp' -%}\n {%- set backup_identifier = model['name'] + '__dbt_backup' -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier,\n schema=schema,\n database=database,\n type='table') -%}\n {%- set intermediate_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema,\n database=database,\n type='table') -%}\n -- the intermediate_relation should not already exist in the database; get_relation\n -- will return None in that case. Otherwise, we get a relation that we can drop\n -- later, before we try to use this name for the current operation\n {%- set preexisting_intermediate_relation = adapter.get_relation(identifier=tmp_identifier, \n schema=schema,\n database=database) -%}\n /*\n See ../view/view.sql for more information about this relation.\n */\n {%- set backup_relation_type = 'table' if old_relation is none else old_relation.type -%}\n {%- set backup_relation = api.Relation.create(identifier=backup_identifier,\n schema=schema,\n database=database,\n type=backup_relation_type) -%}\n -- as above, the backup_relation should not already exist\n {%- set preexisting_backup_relation = adapter.get_relation(identifier=backup_identifier,\n schema=schema,\n database=database) -%}\n\n\n -- drop the temp relations if they exist already in the database\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% call statement('main') -%}\n {{ get_create_table_as_sql(False, intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n {% if old_relation is not none %}\n {{ adapter.rename_relation(old_relation, backup_relation) }}\n {% endif %}\n\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {% do create_indexes(target_relation) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {% do persist_docs(target_relation, model) %}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n -- finally, drop the existing/backup relation after the commit\n {{ drop_relation_if_exists(backup_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.get_create_table_as_sql", "macro.dbt.create_indexes", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.099231}, "macro.dbt.get_create_table_as_sql": {"unique_id": "macro.dbt.get_create_table_as_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.sql", "name": "get_create_table_as_sql", "macro_sql": "{% macro get_create_table_as_sql(temporary, relation, sql) -%}\n {{ adapter.dispatch('get_create_table_as_sql', 'dbt')(temporary, relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_create_table_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.10042}, "macro.dbt.default__get_create_table_as_sql": {"unique_id": "macro.dbt.default__get_create_table_as_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.sql", "name": "default__get_create_table_as_sql", "macro_sql": "{% macro default__get_create_table_as_sql(temporary, relation, sql) -%}\n {{ return(create_table_as(temporary, relation, sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1009312}, "macro.dbt.create_table_as": {"unique_id": "macro.dbt.create_table_as", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.sql", "name": "create_table_as", "macro_sql": "{% macro create_table_as(temporary, relation, sql) -%}\n {{ adapter.dispatch('create_table_as', 'dbt')(temporary, relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.101475}, "macro.dbt.default__create_table_as": {"unique_id": "macro.dbt.default__create_table_as", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.sql", "name": "default__create_table_as", "macro_sql": "{% macro default__create_table_as(temporary, relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n \n {{ sql_header if sql_header is not none }}\n \n create {% if temporary: -%}temporary{%- endif %} table\n {{ relation.include(database=(not temporary), schema=(not temporary)) }}\n as (\n {{ sql }}\n );\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.102564}, "macro.dbt.materialization_view_default": {"unique_id": "macro.dbt.materialization_view_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/view.sql", "original_file_path": "macros/materializations/models/view/view.sql", "name": "materialization_view_default", "macro_sql": "{%- materialization view, default -%}\n\n {%- set identifier = model['alias'] -%}\n {%- set tmp_identifier = model['name'] + '__dbt_tmp' -%}\n {%- set backup_identifier = model['name'] + '__dbt_backup' -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier, schema=schema, database=database,\n type='view') -%}\n {%- set intermediate_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema, database=database, type='view') -%}\n -- the intermediate_relation should not already exist in the database; get_relation\n -- will return None in that case. Otherwise, we get a relation that we can drop\n -- later, before we try to use this name for the current operation\n {%- set preexisting_intermediate_relation = adapter.get_relation(identifier=tmp_identifier, \n schema=schema,\n database=database) -%}\n /*\n This relation (probably) doesn't exist yet. If it does exist, it's a leftover from\n a previous run, and we're going to try to drop it immediately. At the end of this\n materialization, we're going to rename the \"old_relation\" to this identifier,\n and then we're going to drop it. In order to make sure we run the correct one of:\n - drop view ...\n - drop table ...\n\n We need to set the type of this relation to be the type of the old_relation, if it exists,\n or else \"view\" as a sane default if it does not. Note that if the old_relation does not\n exist, then there is nothing to move out of the way and subsequentally drop. In that case,\n this relation will be effectively unused.\n */\n {%- set backup_relation_type = 'view' if old_relation is none else old_relation.type -%}\n {%- set backup_relation = api.Relation.create(identifier=backup_identifier,\n schema=schema, database=database,\n type=backup_relation_type) -%}\n -- as above, the backup_relation should not already exist\n {%- set preexisting_backup_relation = adapter.get_relation(identifier=backup_identifier,\n schema=schema,\n database=database) -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- drop the temp relations if they exist already in the database\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% call statement('main') -%}\n {{ create_view_as(intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n -- move the existing view out of the way\n {% if old_relation is not none %}\n {{ adapter.rename_relation(old_relation, backup_relation) }}\n {% endif %}\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {{ drop_relation_if_exists(backup_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt.create_view_as", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.110757}, "macro.dbt.handle_existing_table": {"unique_id": "macro.dbt.handle_existing_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/helpers.sql", "original_file_path": "macros/materializations/models/view/helpers.sql", "name": "handle_existing_table", "macro_sql": "{% macro handle_existing_table(full_refresh, old_relation) %}\n {{ adapter.dispatch('handle_existing_table', 'dbt')(full_refresh, old_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__handle_existing_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.111795}, "macro.dbt.default__handle_existing_table": {"unique_id": "macro.dbt.default__handle_existing_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/helpers.sql", "original_file_path": "macros/materializations/models/view/helpers.sql", "name": "default__handle_existing_table", "macro_sql": "{% macro default__handle_existing_table(full_refresh, old_relation) %}\n {{ log(\"Dropping relation \" ~ old_relation ~ \" because it is of type \" ~ old_relation.type) }}\n {{ adapter.drop_relation(old_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.112403}, "macro.dbt.create_or_replace_view": {"unique_id": "macro.dbt.create_or_replace_view", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_or_replace_view.sql", "original_file_path": "macros/materializations/models/view/create_or_replace_view.sql", "name": "create_or_replace_view", "macro_sql": "{% macro create_or_replace_view() %}\n {%- set identifier = model['alias'] -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {%- set target_relation = api.Relation.create(\n identifier=identifier, schema=schema, database=database,\n type='view') -%}\n\n {{ run_hooks(pre_hooks) }}\n\n -- If there's a table with the same name and we weren't told to full refresh,\n -- that's an error. If we were told to full refresh, drop it. This behavior differs\n -- for Snowflake and BigQuery, so multiple dispatch is used.\n {%- if old_relation is not none and old_relation.is_table -%}\n {{ handle_existing_table(should_full_refresh(), old_relation) }}\n {%- endif -%}\n\n -- build model\n {% call statement('main') -%}\n {{ get_create_view_as_sql(target_relation, sql) }}\n {%- endcall %}\n\n {{ run_hooks(post_hooks) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.handle_existing_table", "macro.dbt.should_full_refresh", "macro.dbt.statement", "macro.dbt.get_create_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.115532}, "macro.dbt.get_create_view_as_sql": {"unique_id": "macro.dbt.get_create_view_as_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.sql", "name": "get_create_view_as_sql", "macro_sql": "{% macro get_create_view_as_sql(relation, sql) -%}\n {{ adapter.dispatch('get_create_view_as_sql', 'dbt')(relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_create_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.116577}, "macro.dbt.default__get_create_view_as_sql": {"unique_id": "macro.dbt.default__get_create_view_as_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.sql", "name": "default__get_create_view_as_sql", "macro_sql": "{% macro default__get_create_view_as_sql(relation, sql) -%}\n {{ return(create_view_as(relation, sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1170251}, "macro.dbt.create_view_as": {"unique_id": "macro.dbt.create_view_as", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.sql", "name": "create_view_as", "macro_sql": "{% macro create_view_as(relation, sql) -%}\n {{ adapter.dispatch('create_view_as', 'dbt')(relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1175208}, "macro.dbt.default__create_view_as": {"unique_id": "macro.dbt.default__create_view_as", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.sql", "name": "default__create_view_as", "macro_sql": "{% macro default__create_view_as(relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n create view {{ relation }} as (\n {{ sql }}\n );\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.118241}, "macro.dbt.materialization_seed_default": {"unique_id": "macro.dbt.materialization_seed_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/seed.sql", "original_file_path": "macros/materializations/seeds/seed.sql", "name": "materialization_seed_default", "macro_sql": "{% materialization seed, default %}\n\n {%- set identifier = model['alias'] -%}\n {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n\n {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {%- set agate_table = load_agate_table() -%}\n {%- do store_result('agate_table', response='OK', agate_table=agate_table) -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% set create_table_sql = \"\" %}\n {% if exists_as_view %}\n {{ exceptions.raise_compiler_error(\"Cannot seed to '{}', it is a view\".format(old_relation)) }}\n {% elif exists_as_table %}\n {% set create_table_sql = reset_csv_table(model, full_refresh_mode, old_relation, agate_table) %}\n {% else %}\n {% set create_table_sql = create_csv_table(model, agate_table) %}\n {% endif %}\n\n {% set code = 'CREATE' if full_refresh_mode else 'INSERT' %}\n {% set rows_affected = (agate_table.rows | length) %}\n {% set sql = load_csv_rows(model, agate_table) %}\n\n {% call noop_statement('main', code ~ ' ' ~ rows_affected, code, rows_affected) %}\n {{ create_table_sql }};\n -- dbt seed --\n {{ sql }}\n {% endcall %}\n\n {% set target_relation = this.incorporate(type='table') %}\n {% do persist_docs(target_relation, model) %}\n\n {% if full_refresh_mode or not exists_as_table %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.run_hooks", "macro.dbt.reset_csv_table", "macro.dbt.create_csv_table", "macro.dbt.load_csv_rows", "macro.dbt.noop_statement", "macro.dbt.persist_docs", "macro.dbt.create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.125561}, "macro.dbt.create_csv_table": {"unique_id": "macro.dbt.create_csv_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "create_csv_table", "macro_sql": "{% macro create_csv_table(model, agate_table) -%}\n {{ adapter.dispatch('create_csv_table', 'dbt')(model, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.133514}, "macro.dbt.default__create_csv_table": {"unique_id": "macro.dbt.default__create_csv_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__create_csv_table", "macro_sql": "{% macro default__create_csv_table(model, agate_table) %}\n {%- set column_override = model['config'].get('column_types', {}) -%}\n {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n\n {% set sql %}\n create table {{ this.render() }} (\n {%- for col_name in agate_table.column_names -%}\n {%- set inferred_type = adapter.convert_type(agate_table, loop.index0) -%}\n {%- set type = column_override.get(col_name, inferred_type) -%}\n {%- set column_name = (col_name | string) -%}\n {{ adapter.quote_seed_column(column_name, quote_seed_column) }} {{ type }} {%- if not loop.last -%}, {%- endif -%}\n {%- endfor -%}\n )\n {% endset %}\n\n {% call statement('_') -%}\n {{ sql }}\n {%- endcall %}\n\n {{ return(sql) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.13602}, "macro.dbt.reset_csv_table": {"unique_id": "macro.dbt.reset_csv_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "reset_csv_table", "macro_sql": "{% macro reset_csv_table(model, full_refresh, old_relation, agate_table) -%}\n {{ adapter.dispatch('reset_csv_table', 'dbt')(model, full_refresh, old_relation, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__reset_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.136692}, "macro.dbt.default__reset_csv_table": {"unique_id": "macro.dbt.default__reset_csv_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__reset_csv_table", "macro_sql": "{% macro default__reset_csv_table(model, full_refresh, old_relation, agate_table) %}\n {% set sql = \"\" %}\n {% if full_refresh %}\n {{ adapter.drop_relation(old_relation) }}\n {% set sql = create_csv_table(model, agate_table) %}\n {% else %}\n {{ adapter.truncate_relation(old_relation) }}\n {% set sql = \"truncate table \" ~ old_relation %}\n {% endif %}\n\n {{ return(sql) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.137991}, "macro.dbt.get_binding_char": {"unique_id": "macro.dbt.get_binding_char", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "get_binding_char", "macro_sql": "{% macro get_binding_char() -%}\n {{ adapter.dispatch('get_binding_char', 'dbt')() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_binding_char"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1383822}, "macro.dbt.default__get_binding_char": {"unique_id": "macro.dbt.default__get_binding_char", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__get_binding_char", "macro_sql": "{% macro default__get_binding_char() %}\n {{ return('%s') }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1387148}, "macro.dbt.get_batch_size": {"unique_id": "macro.dbt.get_batch_size", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "get_batch_size", "macro_sql": "{% macro get_batch_size() -%}\n {{ return(adapter.dispatch('get_batch_size', 'dbt')()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_batch_size"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1392388}, "macro.dbt.default__get_batch_size": {"unique_id": "macro.dbt.default__get_batch_size", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__get_batch_size", "macro_sql": "{% macro default__get_batch_size() %}\n {{ return(10000) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.139574}, "macro.dbt.get_seed_column_quoted_csv": {"unique_id": "macro.dbt.get_seed_column_quoted_csv", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "get_seed_column_quoted_csv", "macro_sql": "{% macro get_seed_column_quoted_csv(model, column_names) %}\n {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n {% set quoted = [] %}\n {% for col in column_names -%}\n {%- do quoted.append(adapter.quote_seed_column(col, quote_seed_column)) -%}\n {%- endfor %}\n\n {%- set dest_cols_csv = quoted | join(', ') -%}\n {{ return(dest_cols_csv) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1410491}, "macro.dbt.load_csv_rows": {"unique_id": "macro.dbt.load_csv_rows", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "load_csv_rows", "macro_sql": "{% macro load_csv_rows(model, agate_table) -%}\n {{ adapter.dispatch('load_csv_rows', 'dbt')(model, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__load_csv_rows"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.141728}, "macro.dbt.default__load_csv_rows": {"unique_id": "macro.dbt.default__load_csv_rows", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__load_csv_rows", "macro_sql": "{% macro default__load_csv_rows(model, agate_table) %}\n\n {% set batch_size = get_batch_size() %}\n\n {% set cols_sql = get_seed_column_quoted_csv(model, agate_table.column_names) %}\n {% set bindings = [] %}\n\n {% set statements = [] %}\n\n {% for chunk in agate_table.rows | batch(batch_size) %}\n {% set bindings = [] %}\n\n {% for row in chunk %}\n {% do bindings.extend(row) %}\n {% endfor %}\n\n {% set sql %}\n insert into {{ this.render() }} ({{ cols_sql }}) values\n {% for row in chunk -%}\n ({%- for column in agate_table.column_names -%}\n {{ get_binding_char() }}\n {%- if not loop.last%},{%- endif %}\n {%- endfor -%})\n {%- if not loop.last%},{%- endif %}\n {%- endfor %}\n {% endset %}\n\n {% do adapter.add_query(sql, bindings=bindings, abridge_sql_log=True) %}\n\n {% if loop.index0 == 0 %}\n {% do statements.append(sql) %}\n {% endif %}\n {% endfor %}\n\n {# Return SQL so we can render it out into the compiled files #}\n {{ return(statements[0]) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_batch_size", "macro.dbt.get_seed_column_quoted_csv", "macro.dbt.get_binding_char"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.146574}, "macro.dbt.generate_alias_name": {"unique_id": "macro.dbt.generate_alias_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_alias.sql", "original_file_path": "macros/get_custom_name/get_custom_alias.sql", "name": "generate_alias_name", "macro_sql": "{% macro generate_alias_name(custom_alias_name=none, node=none) -%}\n {% do return(adapter.dispatch('generate_alias_name', 'dbt')(custom_alias_name, node)) %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__generate_alias_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1480231}, "macro.dbt.default__generate_alias_name": {"unique_id": "macro.dbt.default__generate_alias_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_alias.sql", "original_file_path": "macros/get_custom_name/get_custom_alias.sql", "name": "default__generate_alias_name", "macro_sql": "{% macro default__generate_alias_name(custom_alias_name=none, node=none) -%}\n\n {%- if custom_alias_name is none -%}\n\n {{ node.name }}\n\n {%- else -%}\n\n {{ custom_alias_name | trim }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.148864}, "macro.dbt.generate_schema_name": {"unique_id": "macro.dbt.generate_schema_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "name": "generate_schema_name", "macro_sql": "{% macro generate_schema_name(custom_schema_name=none, node=none) -%}\n {{ return(adapter.dispatch('generate_schema_name', 'dbt')(custom_schema_name, node)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__generate_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1508842}, "macro.dbt.default__generate_schema_name": {"unique_id": "macro.dbt.default__generate_schema_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "name": "default__generate_schema_name", "macro_sql": "{% macro default__generate_schema_name(custom_schema_name, node) -%}\n\n {%- set default_schema = target.schema -%}\n {%- if custom_schema_name is none -%}\n\n {{ default_schema }}\n\n {%- else -%}\n\n {{ default_schema }}_{{ custom_schema_name | trim }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.151943}, "macro.dbt.generate_schema_name_for_env": {"unique_id": "macro.dbt.generate_schema_name_for_env", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "name": "generate_schema_name_for_env", "macro_sql": "{% macro generate_schema_name_for_env(custom_schema_name, node) -%}\n\n {%- set default_schema = target.schema -%}\n {%- if target.name == 'prod' and custom_schema_name is not none -%}\n\n {{ custom_schema_name | trim }}\n\n {%- else -%}\n\n {{ default_schema }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.153335}, "macro.dbt.generate_database_name": {"unique_id": "macro.dbt.generate_database_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_database.sql", "original_file_path": "macros/get_custom_name/get_custom_database.sql", "name": "generate_database_name", "macro_sql": "{% macro generate_database_name(custom_database_name=none, node=none) -%}\n {% do return(adapter.dispatch('generate_database_name', 'dbt')(custom_database_name, node)) %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__generate_database_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.154808}, "macro.dbt.default__generate_database_name": {"unique_id": "macro.dbt.default__generate_database_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_database.sql", "original_file_path": "macros/get_custom_name/get_custom_database.sql", "name": "default__generate_database_name", "macro_sql": "{% macro default__generate_database_name(custom_database_name=none, node=none) -%}\n {%- set default_database = target.database -%}\n {%- if custom_database_name is none -%}\n\n {{ default_database }}\n\n {%- else -%}\n\n {{ custom_database_name }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1555278}, "macro.dbt.default__test_relationships": {"unique_id": "macro.dbt.default__test_relationships", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/generic_test_sql/relationships.sql", "original_file_path": "macros/generic_test_sql/relationships.sql", "name": "default__test_relationships", "macro_sql": "{% macro default__test_relationships(model, column_name, to, field) %}\n\nwith child as (\n select {{ column_name }} as from_field\n from {{ model }}\n where {{ column_name }} is not null\n),\n\nparent as (\n select {{ field }} as to_field\n from {{ to }}\n)\n\nselect\n from_field\n\nfrom child\nleft join parent\n on child.from_field = parent.to_field\n\nwhere parent.to_field is null\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1565912}, "macro.dbt.default__test_not_null": {"unique_id": "macro.dbt.default__test_not_null", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/generic_test_sql/not_null.sql", "original_file_path": "macros/generic_test_sql/not_null.sql", "name": "default__test_not_null", "macro_sql": "{% macro default__test_not_null(model, column_name) %}\n\nselect *\nfrom {{ model }}\nwhere {{ column_name }} is null\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1572402}, "macro.dbt.default__test_unique": {"unique_id": "macro.dbt.default__test_unique", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/generic_test_sql/unique.sql", "original_file_path": "macros/generic_test_sql/unique.sql", "name": "default__test_unique", "macro_sql": "{% macro default__test_unique(model, column_name) %}\n\nselect\n {{ column_name }} as unique_field,\n count(*) as n_records\n\nfrom {{ model }}\nwhere {{ column_name }} is not null\ngroup by {{ column_name }}\nhaving count(*) > 1\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.158035}, "macro.dbt.default__test_accepted_values": {"unique_id": "macro.dbt.default__test_accepted_values", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/generic_test_sql/accepted_values.sql", "original_file_path": "macros/generic_test_sql/accepted_values.sql", "name": "default__test_accepted_values", "macro_sql": "{% macro default__test_accepted_values(model, column_name, values, quote=True) %}\n\nwith all_values as (\n\n select\n {{ column_name }} as value_field,\n count(*) as n_records\n\n from {{ model }}\n group by {{ column_name }}\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n {% for value in values -%}\n {% if quote -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {%- endfor %}\n)\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.159806}, "macro.dbt.statement": {"unique_id": "macro.dbt.statement", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "name": "statement", "macro_sql": "{% macro statement(name=None, fetch_result=False, auto_begin=True) -%}\n {%- if execute: -%}\n {%- set sql = caller() -%}\n\n {%- if name == 'main' -%}\n {{ log('Writing runtime SQL for node \"{}\"'.format(model['unique_id'])) }}\n {{ write(sql) }}\n {%- endif -%}\n\n {%- set res, table = adapter.execute(sql, auto_begin=auto_begin, fetch=fetch_result) -%}\n {%- if name is not none -%}\n {{ store_result(name, response=res, agate_table=table) }}\n {%- endif -%}\n\n {%- endif -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.163162}, "macro.dbt.noop_statement": {"unique_id": "macro.dbt.noop_statement", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "name": "noop_statement", "macro_sql": "{% macro noop_statement(name=None, message=None, code=None, rows_affected=None, res=None) -%}\n {%- set sql = caller() -%}\n\n {%- if name == 'main' -%}\n {{ log('Writing runtime SQL for node \"{}\"'.format(model['unique_id'])) }}\n {{ write(sql) }}\n {%- endif -%}\n\n {%- if name is not none -%}\n {{ store_raw_result(name, message=message, code=code, rows_affected=rows_affected, agate_table=res) }}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.164746}, "macro.dbt.run_query": {"unique_id": "macro.dbt.run_query", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "name": "run_query", "macro_sql": "{% macro run_query(sql) %}\n {% call statement(\"run_query_statement\", fetch_result=true, auto_begin=false) %}\n {{ sql }}\n {% endcall %}\n\n {% do return(load_result(\"run_query_statement\").table) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.165555}, "macro.dbt.convert_datetime": {"unique_id": "macro.dbt.convert_datetime", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "convert_datetime", "macro_sql": "{% macro convert_datetime(date_str, date_fmt) %}\n\n {% set error_msg -%}\n The provided partition date '{{ date_str }}' does not match the expected format '{{ date_fmt }}'\n {%- endset %}\n\n {% set res = try_or_compiler_error(error_msg, modules.datetime.datetime.strptime, date_str.strip(), date_fmt) %}\n {{ return(res) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.170479}, "macro.dbt.dates_in_range": {"unique_id": "macro.dbt.dates_in_range", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "dates_in_range", "macro_sql": "{% macro dates_in_range(start_date_str, end_date_str=none, in_fmt=\"%Y%m%d\", out_fmt=\"%Y%m%d\") %}\n {% set end_date_str = start_date_str if end_date_str is none else end_date_str %}\n\n {% set start_date = convert_datetime(start_date_str, in_fmt) %}\n {% set end_date = convert_datetime(end_date_str, in_fmt) %}\n\n {% set day_count = (end_date - start_date).days %}\n {% if day_count < 0 %}\n {% set msg -%}\n Partiton start date is after the end date ({{ start_date }}, {{ end_date }})\n {%- endset %}\n\n {{ exceptions.raise_compiler_error(msg, model) }}\n {% endif %}\n\n {% set date_list = [] %}\n {% for i in range(0, day_count + 1) %}\n {% set the_date = (modules.datetime.timedelta(days=i) + start_date) %}\n {% if not out_fmt %}\n {% set _ = date_list.append(the_date) %}\n {% else %}\n {% set _ = date_list.append(the_date.strftime(out_fmt)) %}\n {% endif %}\n {% endfor %}\n\n {{ return(date_list) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.convert_datetime"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1739562}, "macro.dbt.partition_range": {"unique_id": "macro.dbt.partition_range", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "partition_range", "macro_sql": "{% macro partition_range(raw_partition_date, date_fmt='%Y%m%d') %}\n {% set partition_range = (raw_partition_date | string).split(\",\") %}\n\n {% if (partition_range | length) == 1 %}\n {% set start_date = partition_range[0] %}\n {% set end_date = none %}\n {% elif (partition_range | length) == 2 %}\n {% set start_date = partition_range[0] %}\n {% set end_date = partition_range[1] %}\n {% else %}\n {{ exceptions.raise_compiler_error(\"Invalid partition time. Expected format: {Start Date}[,{End Date}]. Got: \" ~ raw_partition_date) }}\n {% endif %}\n\n {{ return(dates_in_range(start_date, end_date, in_fmt=date_fmt)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.dates_in_range"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1761699}, "macro.dbt.py_current_timestring": {"unique_id": "macro.dbt.py_current_timestring", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "py_current_timestring", "macro_sql": "{% macro py_current_timestring() %}\n {% set dt = modules.datetime.datetime.now() %}\n {% do return(dt.strftime(\"%Y%m%d%H%M%S%f\")) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.176838}, "macro.dbt.create_schema": {"unique_id": "macro.dbt.create_schema", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "name": "create_schema", "macro_sql": "{% macro create_schema(relation) -%}\n {{ adapter.dispatch('create_schema', 'dbt')(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_schema"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1780841}, "macro.dbt.default__create_schema": {"unique_id": "macro.dbt.default__create_schema", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "name": "default__create_schema", "macro_sql": "{% macro default__create_schema(relation) -%}\n {%- call statement('create_schema') -%}\n create schema if not exists {{ relation.without_identifier() }}\n {% endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.178663}, "macro.dbt.drop_schema": {"unique_id": "macro.dbt.drop_schema", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "name": "drop_schema", "macro_sql": "{% macro drop_schema(relation) -%}\n {{ adapter.dispatch('drop_schema', 'dbt')(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__drop_schema"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1791282}, "macro.dbt.default__drop_schema": {"unique_id": "macro.dbt.default__drop_schema", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "name": "default__drop_schema", "macro_sql": "{% macro default__drop_schema(relation) -%}\n {%- call statement('drop_schema') -%}\n drop schema if exists {{ relation.without_identifier() }} cascade\n {% endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.179646}, "macro.dbt.get_create_index_sql": {"unique_id": "macro.dbt.get_create_index_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "name": "get_create_index_sql", "macro_sql": "{% macro get_create_index_sql(relation, index_dict) -%}\n {{ return(adapter.dispatch('get_create_index_sql', 'dbt')(relation, index_dict)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_create_index_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.180919}, "macro.dbt.default__get_create_index_sql": {"unique_id": "macro.dbt.default__get_create_index_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "name": "default__get_create_index_sql", "macro_sql": "{% macro default__get_create_index_sql(relation, index_dict) -%}\n {% do return(None) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1813078}, "macro.dbt.create_indexes": {"unique_id": "macro.dbt.create_indexes", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "name": "create_indexes", "macro_sql": "{% macro create_indexes(relation) -%}\n {{ adapter.dispatch('create_indexes', 'dbt')(relation) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.181806}, "macro.dbt.default__create_indexes": {"unique_id": "macro.dbt.default__create_indexes", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "name": "default__create_indexes", "macro_sql": "{% macro default__create_indexes(relation) -%}\n {%- set _indexes = config.get('indexes', default=[]) -%}\n\n {% for _index_dict in _indexes %}\n {% set create_index_sql = get_create_index_sql(relation, _index_dict) %}\n {% if create_index_sql %}\n {% do run_query(create_index_sql) %}\n {% endif %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_create_index_sql", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.18291}, "macro.dbt.make_temp_relation": {"unique_id": "macro.dbt.make_temp_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "make_temp_relation", "macro_sql": "{% macro make_temp_relation(base_relation, suffix='__dbt_tmp') %}\n {{ return(adapter.dispatch('make_temp_relation', 'dbt')(base_relation, suffix))}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__make_temp_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.186929}, "macro.dbt.default__make_temp_relation": {"unique_id": "macro.dbt.default__make_temp_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__make_temp_relation", "macro_sql": "{% macro default__make_temp_relation(base_relation, suffix) %}\n {% set tmp_identifier = base_relation.identifier ~ suffix %}\n {% set tmp_relation = base_relation.incorporate(\n path={\"identifier\": tmp_identifier}) -%}\n\n {% do return(tmp_relation) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1879108}, "macro.dbt.drop_relation": {"unique_id": "macro.dbt.drop_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "drop_relation", "macro_sql": "{% macro drop_relation(relation) -%}\n {{ return(adapter.dispatch('drop_relation', 'dbt')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__drop_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.188538}, "macro.dbt.default__drop_relation": {"unique_id": "macro.dbt.default__drop_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__drop_relation", "macro_sql": "{% macro default__drop_relation(relation) -%}\n {% call statement('drop_relation', auto_begin=False) -%}\n drop {{ relation.type }} if exists {{ relation }} cascade\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.18919}, "macro.dbt.truncate_relation": {"unique_id": "macro.dbt.truncate_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "truncate_relation", "macro_sql": "{% macro truncate_relation(relation) -%}\n {{ return(adapter.dispatch('truncate_relation', 'dbt')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__truncate_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.189704}, "macro.dbt.default__truncate_relation": {"unique_id": "macro.dbt.default__truncate_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__truncate_relation", "macro_sql": "{% macro default__truncate_relation(relation) -%}\n {% call statement('truncate_relation') -%}\n truncate table {{ relation }}\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.190154}, "macro.dbt.rename_relation": {"unique_id": "macro.dbt.rename_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "rename_relation", "macro_sql": "{% macro rename_relation(from_relation, to_relation) -%}\n {{ return(adapter.dispatch('rename_relation', 'dbt')(from_relation, to_relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__rename_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.190877}, "macro.dbt.default__rename_relation": {"unique_id": "macro.dbt.default__rename_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__rename_relation", "macro_sql": "{% macro default__rename_relation(from_relation, to_relation) -%}\n {% set target_name = adapter.quote_as_configured(to_relation.identifier, 'identifier') %}\n {% call statement('rename_relation') -%}\n alter table {{ from_relation }} rename to {{ target_name }}\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.191663}, "macro.dbt.get_or_create_relation": {"unique_id": "macro.dbt.get_or_create_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "get_or_create_relation", "macro_sql": "{% macro get_or_create_relation(database, schema, identifier, type) -%}\n {{ return(adapter.dispatch('get_or_create_relation', 'dbt')(database, schema, identifier, type)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_or_create_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.192343}, "macro.dbt.default__get_or_create_relation": {"unique_id": "macro.dbt.default__get_or_create_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__get_or_create_relation", "macro_sql": "{% macro default__get_or_create_relation(database, schema, identifier, type) %}\n {%- set target_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n\n {% if target_relation %}\n {% do return([true, target_relation]) %}\n {% endif %}\n\n {%- set new_relation = api.Relation.create(\n database=database,\n schema=schema,\n identifier=identifier,\n type=type\n ) -%}\n {% do return([false, new_relation]) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.193886}, "macro.dbt.load_relation": {"unique_id": "macro.dbt.load_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "load_relation", "macro_sql": "{% macro load_relation(relation) %}\n {% do return(adapter.get_relation(\n database=relation.database,\n schema=relation.schema,\n identifier=relation.identifier\n )) -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.194604}, "macro.dbt.drop_relation_if_exists": {"unique_id": "macro.dbt.drop_relation_if_exists", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "drop_relation_if_exists", "macro_sql": "{% macro drop_relation_if_exists(relation) %}\n {% if relation is not none %}\n {{ adapter.drop_relation(relation) }}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.195245}, "macro.dbt.current_timestamp": {"unique_id": "macro.dbt.current_timestamp", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "name": "current_timestamp", "macro_sql": "{% macro current_timestamp() -%}\n {{ adapter.dispatch('current_timestamp', 'dbt')() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1965382}, "macro.dbt.default__current_timestamp": {"unique_id": "macro.dbt.default__current_timestamp", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "name": "default__current_timestamp", "macro_sql": "{% macro default__current_timestamp() -%}\n {{ exceptions.raise_not_implemented(\n 'current_timestamp macro not implemented for adapter '+adapter.type()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1969368}, "macro.dbt.collect_freshness": {"unique_id": "macro.dbt.collect_freshness", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "name": "collect_freshness", "macro_sql": "{% macro collect_freshness(source, loaded_at_field, filter) %}\n {{ return(adapter.dispatch('collect_freshness', 'dbt')(source, loaded_at_field, filter))}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__collect_freshness"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1975539}, "macro.dbt.default__collect_freshness": {"unique_id": "macro.dbt.default__collect_freshness", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "name": "default__collect_freshness", "macro_sql": "{% macro default__collect_freshness(source, loaded_at_field, filter) %}\n {% call statement('collect_freshness', fetch_result=True, auto_begin=False) -%}\n select\n max({{ loaded_at_field }}) as max_loaded_at,\n {{ current_timestamp() }} as snapshotted_at\n from {{ source }}\n {% if filter %}\n where {{ filter }}\n {% endif %}\n {% endcall %}\n {{ return(load_result('collect_freshness').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.198721}, "macro.dbt.alter_column_comment": {"unique_id": "macro.dbt.alter_column_comment", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "alter_column_comment", "macro_sql": "{% macro alter_column_comment(relation, column_dict) -%}\n {{ return(adapter.dispatch('alter_column_comment', 'dbt')(relation, column_dict)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.201047}, "macro.dbt.default__alter_column_comment": {"unique_id": "macro.dbt.default__alter_column_comment", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "default__alter_column_comment", "macro_sql": "{% macro default__alter_column_comment(relation, column_dict) -%}\n {{ exceptions.raise_not_implemented(\n 'alter_column_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2015061}, "macro.dbt.alter_relation_comment": {"unique_id": "macro.dbt.alter_relation_comment", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "alter_relation_comment", "macro_sql": "{% macro alter_relation_comment(relation, relation_comment) -%}\n {{ return(adapter.dispatch('alter_relation_comment', 'dbt')(relation, relation_comment)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__alter_relation_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.202059}, "macro.dbt.default__alter_relation_comment": {"unique_id": "macro.dbt.default__alter_relation_comment", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "default__alter_relation_comment", "macro_sql": "{% macro default__alter_relation_comment(relation, relation_comment) -%}\n {{ exceptions.raise_not_implemented(\n 'alter_relation_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.202517}, "macro.dbt.persist_docs": {"unique_id": "macro.dbt.persist_docs", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "persist_docs", "macro_sql": "{% macro persist_docs(relation, model, for_relation=true, for_columns=true) -%}\n {{ return(adapter.dispatch('persist_docs', 'dbt')(relation, model, for_relation, for_columns)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.203237}, "macro.dbt.default__persist_docs": {"unique_id": "macro.dbt.default__persist_docs", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "default__persist_docs", "macro_sql": "{% macro default__persist_docs(relation, model, for_relation, for_columns) -%}\n {% if for_relation and config.persist_relation_docs() and model.description %}\n {% do run_query(alter_relation_comment(relation, model.description)) %}\n {% endif %}\n\n {% if for_columns and config.persist_column_docs() and model.columns %}\n {% do run_query(alter_column_comment(relation, model.columns)) %}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query", "macro.dbt.alter_relation_comment", "macro.dbt.alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.204733}, "macro.dbt.get_catalog": {"unique_id": "macro.dbt.get_catalog", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "get_catalog", "macro_sql": "{% macro get_catalog(information_schema, schemas) -%}\n {{ return(adapter.dispatch('get_catalog', 'dbt')(information_schema, schemas)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_catalog"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.207857}, "macro.dbt.default__get_catalog": {"unique_id": "macro.dbt.default__get_catalog", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__get_catalog", "macro_sql": "{% macro default__get_catalog(information_schema, schemas) -%}\n\n {% set typename = adapter.type() %}\n {% set msg -%}\n get_catalog not implemented for {{ typename }}\n {%- endset %}\n\n {{ exceptions.raise_compiler_error(msg) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2086048}, "macro.dbt.information_schema_name": {"unique_id": "macro.dbt.information_schema_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "information_schema_name", "macro_sql": "{% macro information_schema_name(database) %}\n {{ return(adapter.dispatch('information_schema_name', 'dbt')(database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__information_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.209265}, "macro.dbt.default__information_schema_name": {"unique_id": "macro.dbt.default__information_schema_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__information_schema_name", "macro_sql": "{% macro default__information_schema_name(database) -%}\n {%- if database -%}\n {{ database }}.INFORMATION_SCHEMA\n {%- else -%}\n INFORMATION_SCHEMA\n {%- endif -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2097259}, "macro.dbt.list_schemas": {"unique_id": "macro.dbt.list_schemas", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "list_schemas", "macro_sql": "{% macro list_schemas(database) -%}\n {{ return(adapter.dispatch('list_schemas', 'dbt')(database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__list_schemas"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.210232}, "macro.dbt.default__list_schemas": {"unique_id": "macro.dbt.default__list_schemas", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__list_schemas", "macro_sql": "{% macro default__list_schemas(database) -%}\n {% set sql %}\n select distinct schema_name\n from {{ information_schema_name(database) }}.SCHEMATA\n where catalog_name ilike '{{ database }}'\n {% endset %}\n {{ return(run_query(sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.information_schema_name", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.210912}, "macro.dbt.check_schema_exists": {"unique_id": "macro.dbt.check_schema_exists", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "check_schema_exists", "macro_sql": "{% macro check_schema_exists(information_schema, schema) -%}\n {{ return(adapter.dispatch('check_schema_exists', 'dbt')(information_schema, schema)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__check_schema_exists"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.214667}, "macro.dbt.default__check_schema_exists": {"unique_id": "macro.dbt.default__check_schema_exists", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__check_schema_exists", "macro_sql": "{% macro default__check_schema_exists(information_schema, schema) -%}\n {% set sql -%}\n select count(*)\n from {{ information_schema.replace(information_schema_view='SCHEMATA') }}\n where catalog_name='{{ information_schema.database }}'\n and schema_name='{{ schema }}'\n {%- endset %}\n {{ return(run_query(sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.replace", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.215689}, "macro.dbt.list_relations_without_caching": {"unique_id": "macro.dbt.list_relations_without_caching", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "list_relations_without_caching", "macro_sql": "{% macro list_relations_without_caching(schema_relation) %}\n {{ return(adapter.dispatch('list_relations_without_caching', 'dbt')(schema_relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__list_relations_without_caching"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2162979}, "macro.dbt.default__list_relations_without_caching": {"unique_id": "macro.dbt.default__list_relations_without_caching", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__list_relations_without_caching", "macro_sql": "{% macro default__list_relations_without_caching(schema_relation) %}\n {{ exceptions.raise_not_implemented(\n 'list_relations_without_caching macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.216931}, "macro.dbt.get_columns_in_relation": {"unique_id": "macro.dbt.get_columns_in_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "get_columns_in_relation", "macro_sql": "{% macro get_columns_in_relation(relation) -%}\n {{ return(adapter.dispatch('get_columns_in_relation', 'dbt')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2208571}, "macro.dbt.default__get_columns_in_relation": {"unique_id": "macro.dbt.default__get_columns_in_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "default__get_columns_in_relation", "macro_sql": "{% macro default__get_columns_in_relation(relation) -%}\n {{ exceptions.raise_not_implemented(\n 'get_columns_in_relation macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.221295}, "macro.dbt.sql_convert_columns_in_relation": {"unique_id": "macro.dbt.sql_convert_columns_in_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "sql_convert_columns_in_relation", "macro_sql": "{% macro sql_convert_columns_in_relation(table) -%}\n {% set columns = [] %}\n {% for row in table %}\n {% do columns.append(api.Column(*row)) %}\n {% endfor %}\n {{ return(columns) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.222147}, "macro.dbt.get_columns_in_query": {"unique_id": "macro.dbt.get_columns_in_query", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "get_columns_in_query", "macro_sql": "{% macro get_columns_in_query(select_sql) -%}\n {{ return(adapter.dispatch('get_columns_in_query', 'dbt')(select_sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.22265}, "macro.dbt.default__get_columns_in_query": {"unique_id": "macro.dbt.default__get_columns_in_query", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "default__get_columns_in_query", "macro_sql": "{% macro default__get_columns_in_query(select_sql) %}\n {% call statement('get_columns_in_query', fetch_result=True, auto_begin=False) -%}\n select * from (\n {{ select_sql }}\n ) as __dbt_sbq\n where false\n limit 0\n {% endcall %}\n\n {{ return(load_result('get_columns_in_query').table.columns | map(attribute='name') | list) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.223556}, "macro.dbt.alter_column_type": {"unique_id": "macro.dbt.alter_column_type", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "alter_column_type", "macro_sql": "{% macro alter_column_type(relation, column_name, new_column_type) -%}\n {{ return(adapter.dispatch('alter_column_type', 'dbt')(relation, column_name, new_column_type)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2241752}, "macro.dbt.default__alter_column_type": {"unique_id": "macro.dbt.default__alter_column_type", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "default__alter_column_type", "macro_sql": "{% macro default__alter_column_type(relation, column_name, new_column_type) -%}\n {#\n 1. Create a new column (w/ temp name and correct type)\n 2. Copy data over to it\n 3. Drop the existing column (cascade!)\n 4. Rename the new column to existing column\n #}\n {%- set tmp_column = column_name + \"__dbt_alter\" -%}\n\n {% call statement('alter_column_type') %}\n alter table {{ relation }} add column {{ adapter.quote(tmp_column) }} {{ new_column_type }};\n update {{ relation }} set {{ adapter.quote(tmp_column) }} = {{ adapter.quote(column_name) }};\n alter table {{ relation }} drop column {{ adapter.quote(column_name) }} cascade;\n alter table {{ relation }} rename column {{ adapter.quote(tmp_column) }} to {{ adapter.quote(column_name) }}\n {% endcall %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2257988}, "macro.dbt.alter_relation_add_remove_columns": {"unique_id": "macro.dbt.alter_relation_add_remove_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "alter_relation_add_remove_columns", "macro_sql": "{% macro alter_relation_add_remove_columns(relation, add_columns = none, remove_columns = none) -%}\n {{ return(adapter.dispatch('alter_relation_add_remove_columns', 'dbt')(relation, add_columns, remove_columns)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__alter_relation_add_remove_columns"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.226581}, "macro.dbt.default__alter_relation_add_remove_columns": {"unique_id": "macro.dbt.default__alter_relation_add_remove_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "default__alter_relation_add_remove_columns", "macro_sql": "{% macro default__alter_relation_add_remove_columns(relation, add_columns, remove_columns) %}\n \n {% if add_columns is none %}\n {% set add_columns = [] %}\n {% endif %}\n {% if remove_columns is none %}\n {% set remove_columns = [] %}\n {% endif %}\n \n {% set sql -%}\n \n alter {{ relation.type }} {{ relation }}\n \n {% for column in add_columns %}\n add column {{ column.name }} {{ column.data_type }}{{ ',' if not loop.last }}\n {% endfor %}{{ ',' if add_columns and remove_columns }}\n \n {% for column in remove_columns %}\n drop column {{ column.name }}{{ ',' if not loop.last }}\n {% endfor %}\n \n {%- endset -%}\n\n {% do run_query(sql) %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.22914}, "macro.dbt.test_unique": {"unique_id": "macro.dbt.test_unique", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "name": "test_unique", "macro_sql": "{% test unique(model, column_name) %}\n {% set macro = adapter.dispatch('test_unique', 'dbt') %}\n {{ macro(model, column_name) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__test_unique"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2307148}, "macro.dbt.test_not_null": {"unique_id": "macro.dbt.test_not_null", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "name": "test_not_null", "macro_sql": "{% test not_null(model, column_name) %}\n {% set macro = adapter.dispatch('test_not_null', 'dbt') %}\n {{ macro(model, column_name) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__test_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.231359}, "macro.dbt.test_accepted_values": {"unique_id": "macro.dbt.test_accepted_values", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "name": "test_accepted_values", "macro_sql": "{% test accepted_values(model, column_name, values, quote=True) %}\n {% set macro = adapter.dispatch('test_accepted_values', 'dbt') %}\n {{ macro(model, column_name, values, quote) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__test_accepted_values"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.232146}, "macro.dbt.test_relationships": {"unique_id": "macro.dbt.test_relationships", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "name": "test_relationships", "macro_sql": "{% test relationships(model, column_name, to, field) %}\n {% set macro = adapter.dispatch('test_relationships', 'dbt') %}\n {{ macro(model, column_name, to, field) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__test_relationships"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2329001}, "macro.dbt_utils.except": {"unique_id": "macro.dbt_utils.except", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/except.sql", "original_file_path": "macros/cross_db_utils/except.sql", "name": "except", "macro_sql": "{% macro except() %}\n {{ return(adapter.dispatch('except', 'dbt_utils')()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__except"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2338188}, "macro.dbt_utils.default__except": {"unique_id": "macro.dbt_utils.default__except", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/except.sql", "original_file_path": "macros/cross_db_utils/except.sql", "name": "default__except", "macro_sql": "{% macro default__except() %}\n\n except\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.234048}, "macro.dbt_utils.bigquery__except": {"unique_id": "macro.dbt_utils.bigquery__except", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/except.sql", "original_file_path": "macros/cross_db_utils/except.sql", "name": "bigquery__except", "macro_sql": "{% macro bigquery__except() %}\n\n except distinct\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.234376}, "macro.dbt_utils.replace": {"unique_id": "macro.dbt_utils.replace", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/replace.sql", "original_file_path": "macros/cross_db_utils/replace.sql", "name": "replace", "macro_sql": "{% macro replace(field, old_chars, new_chars) -%}\n {{ return(adapter.dispatch('replace', 'dbt_utils') (field, old_chars, new_chars)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__replace"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.235466}, "macro.dbt_utils.default__replace": {"unique_id": "macro.dbt_utils.default__replace", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/replace.sql", "original_file_path": "macros/cross_db_utils/replace.sql", "name": "default__replace", "macro_sql": "{% macro default__replace(field, old_chars, new_chars) %}\n\n replace(\n {{ field }},\n {{ old_chars }},\n {{ new_chars }}\n )\n \n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.235924}, "macro.dbt_utils.concat": {"unique_id": "macro.dbt_utils.concat", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/concat.sql", "original_file_path": "macros/cross_db_utils/concat.sql", "name": "concat", "macro_sql": "{% macro concat(fields) -%}\n {{ return(adapter.dispatch('concat', 'dbt_utils')(fields)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__concat"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.23674}, "macro.dbt_utils.default__concat": {"unique_id": "macro.dbt_utils.default__concat", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/concat.sql", "original_file_path": "macros/cross_db_utils/concat.sql", "name": "default__concat", "macro_sql": "{% macro default__concat(fields) -%}\n {{ fields|join(' || ') }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.237141}, "macro.dbt_utils.type_string": {"unique_id": "macro.dbt_utils.type_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_string", "macro_sql": "\n\n{%- macro type_string() -%}\n {{ return(adapter.dispatch('type_string', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.238854}, "macro.dbt_utils.default__type_string": {"unique_id": "macro.dbt_utils.default__type_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_string", "macro_sql": "{% macro default__type_string() %}\n string\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.239648}, "macro.dbt_utils.redshift__type_string": {"unique_id": "macro.dbt_utils.redshift__type_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "redshift__type_string", "macro_sql": "\n\n{%- macro redshift__type_string() -%}\n varchar\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.239873}, "macro.dbt_utils.postgres__type_string": {"unique_id": "macro.dbt_utils.postgres__type_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "postgres__type_string", "macro_sql": "{% macro postgres__type_string() %}\n varchar\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.240088}, "macro.dbt_utils.snowflake__type_string": {"unique_id": "macro.dbt_utils.snowflake__type_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "snowflake__type_string", "macro_sql": "{% macro snowflake__type_string() %}\n varchar\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2403011}, "macro.dbt_utils.type_timestamp": {"unique_id": "macro.dbt_utils.type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_timestamp", "macro_sql": "\n\n{%- macro type_timestamp() -%}\n {{ return(adapter.dispatch('type_timestamp', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2408829}, "macro.dbt_utils.default__type_timestamp": {"unique_id": "macro.dbt_utils.default__type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_timestamp", "macro_sql": "{% macro default__type_timestamp() %}\n timestamp\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.241138}, "macro.dbt_utils.postgres__type_timestamp": {"unique_id": "macro.dbt_utils.postgres__type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "postgres__type_timestamp", "macro_sql": "{% macro postgres__type_timestamp() %}\n timestamp without time zone\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.241351}, "macro.dbt_utils.snowflake__type_timestamp": {"unique_id": "macro.dbt_utils.snowflake__type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "snowflake__type_timestamp", "macro_sql": "{% macro snowflake__type_timestamp() %}\n timestamp_ntz\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2415512}, "macro.dbt_utils.type_float": {"unique_id": "macro.dbt_utils.type_float", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_float", "macro_sql": "\n\n{%- macro type_float() -%}\n {{ return(adapter.dispatch('type_float', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__type_float"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.241982}, "macro.dbt_utils.default__type_float": {"unique_id": "macro.dbt_utils.default__type_float", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_float", "macro_sql": "{% macro default__type_float() %}\n float\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.242558}, "macro.dbt_utils.bigquery__type_float": {"unique_id": "macro.dbt_utils.bigquery__type_float", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_float", "macro_sql": "{% macro bigquery__type_float() %}\n float64\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.242769}, "macro.dbt_utils.type_numeric": {"unique_id": "macro.dbt_utils.type_numeric", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_numeric", "macro_sql": "\n\n{%- macro type_numeric() -%}\n {{ return(adapter.dispatch('type_numeric', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.243262}, "macro.dbt_utils.default__type_numeric": {"unique_id": "macro.dbt_utils.default__type_numeric", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_numeric", "macro_sql": "{% macro default__type_numeric() %}\n numeric(28, 6)\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.243488}, "macro.dbt_utils.bigquery__type_numeric": {"unique_id": "macro.dbt_utils.bigquery__type_numeric", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_numeric", "macro_sql": "{% macro bigquery__type_numeric() %}\n numeric\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.243692}, "macro.dbt_utils.type_bigint": {"unique_id": "macro.dbt_utils.type_bigint", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_bigint", "macro_sql": "\n\n{%- macro type_bigint() -%}\n {{ return(adapter.dispatch('type_bigint', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.244132}, "macro.dbt_utils.default__type_bigint": {"unique_id": "macro.dbt_utils.default__type_bigint", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_bigint", "macro_sql": "{% macro default__type_bigint() %}\n bigint\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.24434}, "macro.dbt_utils.bigquery__type_bigint": {"unique_id": "macro.dbt_utils.bigquery__type_bigint", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_bigint", "macro_sql": "{% macro bigquery__type_bigint() %}\n int64\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.244541}, "macro.dbt_utils.type_int": {"unique_id": "macro.dbt_utils.type_int", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_int", "macro_sql": "\n\n{%- macro type_int() -%}\n {{ return(adapter.dispatch('type_int', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__type_int"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.244976}, "macro.dbt_utils.default__type_int": {"unique_id": "macro.dbt_utils.default__type_int", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_int", "macro_sql": "{% macro default__type_int() %}\n int\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.245183}, "macro.dbt_utils.bigquery__type_int": {"unique_id": "macro.dbt_utils.bigquery__type_int", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_int", "macro_sql": "{% macro bigquery__type_int() %}\n int64\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.245385}, "macro.dbt_utils._is_relation": {"unique_id": "macro.dbt_utils._is_relation", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/_is_relation.sql", "original_file_path": "macros/cross_db_utils/_is_relation.sql", "name": "_is_relation", "macro_sql": "{% macro _is_relation(obj, macro) %}\n {%- if not (obj is mapping and obj.get('metadata', {}).get('type', '').endswith('Relation')) -%}\n {%- do exceptions.raise_compiler_error(\"Macro \" ~ macro ~ \" expected a Relation but received the value: \" ~ obj) -%}\n {%- endif -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.24677}, "macro.dbt_utils.cast_array_to_string": {"unique_id": "macro.dbt_utils.cast_array_to_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_array_to_string.sql", "original_file_path": "macros/cross_db_utils/cast_array_to_string.sql", "name": "cast_array_to_string", "macro_sql": "{% macro cast_array_to_string(array) %}\n {{ adapter.dispatch('cast_array_to_string', 'dbt_utils') (array) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__cast_array_to_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2479029}, "macro.dbt_utils.default__cast_array_to_string": {"unique_id": "macro.dbt_utils.default__cast_array_to_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_array_to_string.sql", "original_file_path": "macros/cross_db_utils/cast_array_to_string.sql", "name": "default__cast_array_to_string", "macro_sql": "{% macro default__cast_array_to_string(array) %}\n cast({{ array }} as {{ dbt_utils.type_string() }})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2483032}, "macro.dbt_utils.postgres__cast_array_to_string": {"unique_id": "macro.dbt_utils.postgres__cast_array_to_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_array_to_string.sql", "original_file_path": "macros/cross_db_utils/cast_array_to_string.sql", "name": "postgres__cast_array_to_string", "macro_sql": "{% macro postgres__cast_array_to_string(array) %}\n {%- set array_as_string -%}cast({{ array }} as {{ dbt_utils.type_string() }}){%- endset -%}\n {{ dbt_utils.replace(dbt_utils.replace(array_as_string,\"'}'\",\"']'\"),\"'{'\",\"'['\") }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string", "macro.dbt_utils.replace"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.249293}, "macro.dbt_utils.redshift__cast_array_to_string": {"unique_id": "macro.dbt_utils.redshift__cast_array_to_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_array_to_string.sql", "original_file_path": "macros/cross_db_utils/cast_array_to_string.sql", "name": "redshift__cast_array_to_string", "macro_sql": "{% macro redshift__cast_array_to_string(array) %}\n cast({{ array }} as {{ dbt_utils.type_string() }})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2496908}, "macro.dbt_utils.bigquery__cast_array_to_string": {"unique_id": "macro.dbt_utils.bigquery__cast_array_to_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_array_to_string.sql", "original_file_path": "macros/cross_db_utils/cast_array_to_string.sql", "name": "bigquery__cast_array_to_string", "macro_sql": "{% macro bigquery__cast_array_to_string(array) %}\n '['||(select string_agg(cast(element as string), ',') from unnest({{ array }}) element)||']'\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.249988}, "macro.dbt_utils.length": {"unique_id": "macro.dbt_utils.length", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/length.sql", "original_file_path": "macros/cross_db_utils/length.sql", "name": "length", "macro_sql": "{% macro length(expression) -%}\n {{ return(adapter.dispatch('length', 'dbt_utils') (expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__length"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.250944}, "macro.dbt_utils.default__length": {"unique_id": "macro.dbt_utils.default__length", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/length.sql", "original_file_path": "macros/cross_db_utils/length.sql", "name": "default__length", "macro_sql": "{% macro default__length(expression) %}\n \n length(\n {{ expression }}\n )\n \n{%- endmacro -%}\n\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2512589}, "macro.dbt_utils.redshift__length": {"unique_id": "macro.dbt_utils.redshift__length", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/length.sql", "original_file_path": "macros/cross_db_utils/length.sql", "name": "redshift__length", "macro_sql": "{% macro redshift__length(expression) %}\n\n len(\n {{ expression }}\n )\n \n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.251544}, "macro.dbt_utils.dateadd": {"unique_id": "macro.dbt_utils.dateadd", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "dateadd", "macro_sql": "{% macro dateadd(datepart, interval, from_date_or_timestamp) %}\n {{ return(adapter.dispatch('dateadd', 'dbt_utils')(datepart, interval, from_date_or_timestamp)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.252983}, "macro.dbt_utils.default__dateadd": {"unique_id": "macro.dbt_utils.default__dateadd", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "default__dateadd", "macro_sql": "{% macro default__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n dateadd(\n {{ datepart }},\n {{ interval }},\n {{ from_date_or_timestamp }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.253471}, "macro.dbt_utils.bigquery__dateadd": {"unique_id": "macro.dbt_utils.bigquery__dateadd", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "bigquery__dateadd", "macro_sql": "{% macro bigquery__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n datetime_add(\n cast( {{ from_date_or_timestamp }} as datetime),\n interval {{ interval }} {{ datepart }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.253951}, "macro.dbt_utils.postgres__dateadd": {"unique_id": "macro.dbt_utils.postgres__dateadd", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "postgres__dateadd", "macro_sql": "{% macro postgres__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n {{ from_date_or_timestamp }} + ((interval '1 {{ datepart }}') * ({{ interval }}))\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.254396}, "macro.dbt_utils.redshift__dateadd": {"unique_id": "macro.dbt_utils.redshift__dateadd", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "redshift__dateadd", "macro_sql": "{% macro redshift__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n {{ return(dbt_utils.default__dateadd(datepart, interval, from_date_or_timestamp)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.254923}, "macro.dbt_utils.intersect": {"unique_id": "macro.dbt_utils.intersect", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/intersect.sql", "original_file_path": "macros/cross_db_utils/intersect.sql", "name": "intersect", "macro_sql": "{% macro intersect() %}\n {{ return(adapter.dispatch('intersect', 'dbt_utils')()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__intersect"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.255754}, "macro.dbt_utils.default__intersect": {"unique_id": "macro.dbt_utils.default__intersect", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/intersect.sql", "original_file_path": "macros/cross_db_utils/intersect.sql", "name": "default__intersect", "macro_sql": "{% macro default__intersect() %}\n\n intersect\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.255967}, "macro.dbt_utils.bigquery__intersect": {"unique_id": "macro.dbt_utils.bigquery__intersect", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/intersect.sql", "original_file_path": "macros/cross_db_utils/intersect.sql", "name": "bigquery__intersect", "macro_sql": "{% macro bigquery__intersect() %}\n\n intersect distinct\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2561688}, "macro.dbt_utils.escape_single_quotes": {"unique_id": "macro.dbt_utils.escape_single_quotes", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/escape_single_quotes.sql", "original_file_path": "macros/cross_db_utils/escape_single_quotes.sql", "name": "escape_single_quotes", "macro_sql": "{% macro escape_single_quotes(expression) %}\n {{ return(adapter.dispatch('escape_single_quotes', 'dbt_utils') (expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__escape_single_quotes"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.261027}, "macro.dbt_utils.default__escape_single_quotes": {"unique_id": "macro.dbt_utils.default__escape_single_quotes", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/escape_single_quotes.sql", "original_file_path": "macros/cross_db_utils/escape_single_quotes.sql", "name": "default__escape_single_quotes", "macro_sql": "{% macro default__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\",\"''\") }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.261502}, "macro.dbt_utils.snowflake__escape_single_quotes": {"unique_id": "macro.dbt_utils.snowflake__escape_single_quotes", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/escape_single_quotes.sql", "original_file_path": "macros/cross_db_utils/escape_single_quotes.sql", "name": "snowflake__escape_single_quotes", "macro_sql": "{% macro snowflake__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\", \"\\\\'\") }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.262003}, "macro.dbt_utils.bigquery__escape_single_quotes": {"unique_id": "macro.dbt_utils.bigquery__escape_single_quotes", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/escape_single_quotes.sql", "original_file_path": "macros/cross_db_utils/escape_single_quotes.sql", "name": "bigquery__escape_single_quotes", "macro_sql": "{% macro bigquery__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\", \"\\\\'\") }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.26245}, "macro.dbt_utils.right": {"unique_id": "macro.dbt_utils.right", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "right", "macro_sql": "{% macro right(string_text, length_expression) -%}\n {{ return(adapter.dispatch('right', 'dbt_utils') (string_text, length_expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__right"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.263917}, "macro.dbt_utils.default__right": {"unique_id": "macro.dbt_utils.default__right", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "default__right", "macro_sql": "{% macro default__right(string_text, length_expression) %}\n\n right(\n {{ string_text }},\n {{ length_expression }}\n )\n \n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.264297}, "macro.dbt_utils.bigquery__right": {"unique_id": "macro.dbt_utils.bigquery__right", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "bigquery__right", "macro_sql": "{% macro bigquery__right(string_text, length_expression) %}\n\n case when {{ length_expression }} = 0 \n then ''\n else \n substr(\n {{ string_text }},\n -1 * ({{ length_expression }})\n )\n end\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.264728}, "macro.dbt_utils.snowflake__right": {"unique_id": "macro.dbt_utils.snowflake__right", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "snowflake__right", "macro_sql": "{% macro snowflake__right(string_text, length_expression) %}\n\n case when {{ length_expression }} = 0 \n then ''\n else \n right(\n {{ string_text }},\n {{ length_expression }}\n )\n end\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.265162}, "macro.dbt_utils.listagg": {"unique_id": "macro.dbt_utils.listagg", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/listagg.sql", "original_file_path": "macros/cross_db_utils/listagg.sql", "name": "listagg", "macro_sql": "{% macro listagg(measure, delimiter_text=\"','\", order_by_clause=none, limit_num=none) -%}\n {{ return(adapter.dispatch('listagg', 'dbt_utils') (measure, delimiter_text, order_by_clause, limit_num)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__listagg"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.27019}, "macro.dbt_utils.default__listagg": {"unique_id": "macro.dbt_utils.default__listagg", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/listagg.sql", "original_file_path": "macros/cross_db_utils/listagg.sql", "name": "default__listagg", "macro_sql": "{% macro default__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n\n {% if limit_num -%}\n array_to_string(\n array_slice(\n array_agg(\n {{ measure }}\n ){% if order_by_clause -%}\n within group ({{ order_by_clause }})\n {%- endif %}\n ,0\n ,{{ limit_num }}\n ),\n {{ delimiter_text }}\n )\n {%- else %}\n listagg(\n {{ measure }},\n {{ delimiter_text }}\n )\n {% if order_by_clause -%}\n within group ({{ order_by_clause }})\n {%- endif %}\n {%- endif %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.271602}, "macro.dbt_utils.bigquery__listagg": {"unique_id": "macro.dbt_utils.bigquery__listagg", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/listagg.sql", "original_file_path": "macros/cross_db_utils/listagg.sql", "name": "bigquery__listagg", "macro_sql": "{% macro bigquery__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n\n string_agg(\n {{ measure }},\n {{ delimiter_text }}\n {% if order_by_clause -%}\n {{ order_by_clause }}\n {%- endif %}\n {% if limit_num -%}\n limit {{ limit_num }}\n {%- endif %}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.272715}, "macro.dbt_utils.postgres__listagg": {"unique_id": "macro.dbt_utils.postgres__listagg", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/listagg.sql", "original_file_path": "macros/cross_db_utils/listagg.sql", "name": "postgres__listagg", "macro_sql": "{% macro postgres__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n \n {% if limit_num -%}\n array_to_string(\n (array_agg(\n {{ measure }}\n {% if order_by_clause -%}\n {{ order_by_clause }}\n {%- endif %}\n ))[1:{{ limit_num }}],\n {{ delimiter_text }}\n )\n {%- else %}\n string_agg(\n {{ measure }},\n {{ delimiter_text }}\n {% if order_by_clause -%}\n {{ order_by_clause }}\n {%- endif %}\n )\n {%- endif %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2740512}, "macro.dbt_utils.redshift__listagg": {"unique_id": "macro.dbt_utils.redshift__listagg", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/listagg.sql", "original_file_path": "macros/cross_db_utils/listagg.sql", "name": "redshift__listagg", "macro_sql": "{% macro redshift__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n\n {% if limit_num -%}\n {% set ns = namespace() %}\n {% set ns.delimiter_text_regex = delimiter_text|trim(\"'\") %}\n {% set special_chars %}\\,^,$,.,|,?,*,+,(,),[,],{,}{% endset %} \n {%- for char in special_chars.split(',') -%}\n {% set escape_char %}\\\\{{ char }}{% endset %}\n {% set ns.delimiter_text_regex = ns.delimiter_text_regex|replace(char,escape_char) %}\n {%- endfor -%}\n\n {% set regex %}'([^{{ ns.delimiter_text_regex }}]+{{ ns.delimiter_text_regex }}){1,{{ limit_num - 1}}}[^{{ ns.delimiter_text_regex }}]+'{% endset %}\n regexp_substr(\n listagg(\n {{ measure }},\n {{ delimiter_text }}\n )\n {% if order_by_clause -%}\n within group ({{ order_by_clause }})\n {%- endif %}\n ,{{ regex }}\n )\n {%- else %}\n listagg(\n {{ measure }},\n {{ delimiter_text }}\n )\n {% if order_by_clause -%}\n within group ({{ order_by_clause }})\n {%- endif %}\n {%- endif %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.276726}, "macro.dbt_utils.datediff": {"unique_id": "macro.dbt_utils.datediff", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "datediff", "macro_sql": "{% macro datediff(first_date, second_date, datepart) %}\n {{ return(adapter.dispatch('datediff', 'dbt_utils')(first_date, second_date, datepart)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2824068}, "macro.dbt_utils.default__datediff": {"unique_id": "macro.dbt_utils.default__datediff", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "default__datediff", "macro_sql": "{% macro default__datediff(first_date, second_date, datepart) -%}\n\n datediff(\n {{ datepart }},\n {{ first_date }},\n {{ second_date }}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2829561}, "macro.dbt_utils.bigquery__datediff": {"unique_id": "macro.dbt_utils.bigquery__datediff", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "bigquery__datediff", "macro_sql": "{% macro bigquery__datediff(first_date, second_date, datepart) -%}\n\n datetime_diff(\n cast({{second_date}} as datetime),\n cast({{first_date}} as datetime),\n {{datepart}}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.283515}, "macro.dbt_utils.postgres__datediff": {"unique_id": "macro.dbt_utils.postgres__datediff", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "postgres__datediff", "macro_sql": "{% macro postgres__datediff(first_date, second_date, datepart) -%}\n\n {% if datepart == 'year' %}\n (date_part('year', ({{second_date}})::date) - date_part('year', ({{first_date}})::date))\n {% elif datepart == 'quarter' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 4 + date_part('quarter', ({{second_date}})::date) - date_part('quarter', ({{first_date}})::date))\n {% elif datepart == 'month' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 12 + date_part('month', ({{second_date}})::date) - date_part('month', ({{first_date}})::date))\n {% elif datepart == 'day' %}\n (({{second_date}})::date - ({{first_date}})::date)\n {% elif datepart == 'week' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} / 7 + case\n when date_part('dow', ({{first_date}})::timestamp) <= date_part('dow', ({{second_date}})::timestamp) then\n case when {{first_date}} <= {{second_date}} then 0 else -1 end\n else\n case when {{first_date}} <= {{second_date}} then 1 else 0 end\n end)\n {% elif datepart == 'hour' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} * 24 + date_part('hour', ({{second_date}})::timestamp) - date_part('hour', ({{first_date}})::timestamp))\n {% elif datepart == 'minute' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'hour') }} * 60 + date_part('minute', ({{second_date}})::timestamp) - date_part('minute', ({{first_date}})::timestamp))\n {% elif datepart == 'second' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60 + floor(date_part('second', ({{second_date}})::timestamp)) - floor(date_part('second', ({{first_date}})::timestamp)))\n {% elif datepart == 'millisecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000 + floor(date_part('millisecond', ({{second_date}})::timestamp)) - floor(date_part('millisecond', ({{first_date}})::timestamp)))\n {% elif datepart == 'microsecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000000 + floor(date_part('microsecond', ({{second_date}})::timestamp)) - floor(date_part('microsecond', ({{first_date}})::timestamp)))\n {% else %}\n {{ exceptions.raise_compiler_error(\"Unsupported datepart for macro datediff in postgres: {!r}\".format(datepart)) }}\n {% endif %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.288387}, "macro.dbt_utils.redshift__datediff": {"unique_id": "macro.dbt_utils.redshift__datediff", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "redshift__datediff", "macro_sql": "{% macro redshift__datediff(first_date, second_date, datepart) -%}\n\n {{ return(dbt_utils.default__datediff(first_date, second_date, datepart)) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.28897}, "macro.dbt_utils.safe_cast": {"unique_id": "macro.dbt_utils.safe_cast", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "safe_cast", "macro_sql": "{% macro safe_cast(field, type) %}\n {{ return(adapter.dispatch('safe_cast', 'dbt_utils') (field, type)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__safe_cast"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.290348}, "macro.dbt_utils.default__safe_cast": {"unique_id": "macro.dbt_utils.default__safe_cast", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "default__safe_cast", "macro_sql": "{% macro default__safe_cast(field, type) %}\n {# most databases don't support this function yet\n so we just need to use cast #}\n cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.290751}, "macro.dbt_utils.snowflake__safe_cast": {"unique_id": "macro.dbt_utils.snowflake__safe_cast", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "snowflake__safe_cast", "macro_sql": "{% macro snowflake__safe_cast(field, type) %}\n try_cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.291112}, "macro.dbt_utils.bigquery__safe_cast": {"unique_id": "macro.dbt_utils.bigquery__safe_cast", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "bigquery__safe_cast", "macro_sql": "{% macro bigquery__safe_cast(field, type) %}\n safe_cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.291473}, "macro.dbt_utils.hash": {"unique_id": "macro.dbt_utils.hash", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/hash.sql", "original_file_path": "macros/cross_db_utils/hash.sql", "name": "hash", "macro_sql": "{% macro hash(field) -%}\n {{ return(adapter.dispatch('hash', 'dbt_utils') (field)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__hash"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.292476}, "macro.dbt_utils.default__hash": {"unique_id": "macro.dbt_utils.default__hash", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/hash.sql", "original_file_path": "macros/cross_db_utils/hash.sql", "name": "default__hash", "macro_sql": "{% macro default__hash(field) -%}\n md5(cast({{field}} as {{dbt_utils.type_string()}}))\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2929869}, "macro.dbt_utils.bigquery__hash": {"unique_id": "macro.dbt_utils.bigquery__hash", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/hash.sql", "original_file_path": "macros/cross_db_utils/hash.sql", "name": "bigquery__hash", "macro_sql": "{% macro bigquery__hash(field) -%}\n to_hex({{dbt_utils.default__hash(field)}})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__hash"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2934248}, "macro.dbt_utils.cast_bool_to_text": {"unique_id": "macro.dbt_utils.cast_bool_to_text", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_bool_to_text.sql", "original_file_path": "macros/cross_db_utils/cast_bool_to_text.sql", "name": "cast_bool_to_text", "macro_sql": "{% macro cast_bool_to_text(field) %}\n {{ adapter.dispatch('cast_bool_to_text', 'dbt_utils') (field) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2943811}, "macro.dbt_utils.default__cast_bool_to_text": {"unique_id": "macro.dbt_utils.default__cast_bool_to_text", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_bool_to_text.sql", "original_file_path": "macros/cross_db_utils/cast_bool_to_text.sql", "name": "default__cast_bool_to_text", "macro_sql": "{% macro default__cast_bool_to_text(field) %}\n cast({{ field }} as {{ dbt_utils.type_string() }})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2947788}, "macro.dbt_utils.redshift__cast_bool_to_text": {"unique_id": "macro.dbt_utils.redshift__cast_bool_to_text", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_bool_to_text.sql", "original_file_path": "macros/cross_db_utils/cast_bool_to_text.sql", "name": "redshift__cast_bool_to_text", "macro_sql": "{% macro redshift__cast_bool_to_text(field) %}\n case\n when {{ field }} is true then 'true'\n when {{ field }} is false then 'false'\n end::text\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.295192}, "macro.dbt_utils.identifier": {"unique_id": "macro.dbt_utils.identifier", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/identifier.sql", "original_file_path": "macros/cross_db_utils/identifier.sql", "name": "identifier", "macro_sql": "{% macro identifier(value) %}\t\n {%- set error_message = '\n Warning: the `identifier` macro is no longer supported and will be deprecated in a future release of dbt-utils. \\\n Use `adapter.quote` instead. The {}.{} model triggered this warning. \\\n '.format(model.package_name, model.name) -%}\n {%- do exceptions.warn(error_message) -%}\n {{ return(adapter.dispatch('identifier', 'dbt_utils') (value)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__identifier"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.296787}, "macro.dbt_utils.default__identifier": {"unique_id": "macro.dbt_utils.default__identifier", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/identifier.sql", "original_file_path": "macros/cross_db_utils/identifier.sql", "name": "default__identifier", "macro_sql": "{% macro default__identifier(value) -%}\t\n \"{{ value }}\"\t\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.297211}, "macro.dbt_utils.bigquery__identifier": {"unique_id": "macro.dbt_utils.bigquery__identifier", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/identifier.sql", "original_file_path": "macros/cross_db_utils/identifier.sql", "name": "bigquery__identifier", "macro_sql": "{% macro bigquery__identifier(value) -%}\t\n `{{ value }}`\t\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2975612}, "macro.dbt_utils.any_value": {"unique_id": "macro.dbt_utils.any_value", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/any_value.sql", "original_file_path": "macros/cross_db_utils/any_value.sql", "name": "any_value", "macro_sql": "{% macro any_value(expression) -%}\n {{ return(adapter.dispatch('any_value', 'dbt_utils') (expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__any_value"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2985952}, "macro.dbt_utils.default__any_value": {"unique_id": "macro.dbt_utils.default__any_value", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/any_value.sql", "original_file_path": "macros/cross_db_utils/any_value.sql", "name": "default__any_value", "macro_sql": "{% macro default__any_value(expression) -%}\n \n any_value({{ expression }})\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.299057}, "macro.dbt_utils.postgres__any_value": {"unique_id": "macro.dbt_utils.postgres__any_value", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/any_value.sql", "original_file_path": "macros/cross_db_utils/any_value.sql", "name": "postgres__any_value", "macro_sql": "{% macro postgres__any_value(expression) -%}\n {#- /*Postgres doesn't support any_value, so we're using min() to get the same result*/ -#}\n min({{ expression }})\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.299446}, "macro.dbt_utils.position": {"unique_id": "macro.dbt_utils.position", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/position.sql", "original_file_path": "macros/cross_db_utils/position.sql", "name": "position", "macro_sql": "{% macro position(substring_text, string_text) -%}\n {{ return(adapter.dispatch('position', 'dbt_utils') (substring_text, string_text)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__position"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.301024}, "macro.dbt_utils.default__position": {"unique_id": "macro.dbt_utils.default__position", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/position.sql", "original_file_path": "macros/cross_db_utils/position.sql", "name": "default__position", "macro_sql": "{% macro default__position(substring_text, string_text) %}\n\n position(\n {{ substring_text }} in {{ string_text }}\n )\n \n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.301412}, "macro.dbt_utils.bigquery__position": {"unique_id": "macro.dbt_utils.bigquery__position", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/position.sql", "original_file_path": "macros/cross_db_utils/position.sql", "name": "bigquery__position", "macro_sql": "{% macro bigquery__position(substring_text, string_text) %}\n\n strpos(\n {{ string_text }},\n {{ substring_text }}\n \n )\n \n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3019679}, "macro.dbt_utils.string_literal": {"unique_id": "macro.dbt_utils.string_literal", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/literal.sql", "original_file_path": "macros/cross_db_utils/literal.sql", "name": "string_literal", "macro_sql": "{%- macro string_literal(value) -%}\n {{ return(adapter.dispatch('string_literal', 'dbt_utils') (value)) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__string_literal"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.303188}, "macro.dbt_utils.default__string_literal": {"unique_id": "macro.dbt_utils.default__string_literal", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/literal.sql", "original_file_path": "macros/cross_db_utils/literal.sql", "name": "default__string_literal", "macro_sql": "{% macro default__string_literal(value) -%}\n '{{ value }}'\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.303626}, "macro.dbt_utils.current_timestamp": {"unique_id": "macro.dbt_utils.current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "current_timestamp", "macro_sql": "{% macro current_timestamp() -%}\n {{ return(adapter.dispatch('current_timestamp', 'dbt_utils')()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.305344}, "macro.dbt_utils.default__current_timestamp": {"unique_id": "macro.dbt_utils.default__current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "default__current_timestamp", "macro_sql": "{% macro default__current_timestamp() %}\n current_timestamp::{{dbt_utils.type_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3062232}, "macro.dbt_utils.redshift__current_timestamp": {"unique_id": "macro.dbt_utils.redshift__current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "redshift__current_timestamp", "macro_sql": "{% macro redshift__current_timestamp() %}\n getdate()\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.306568}, "macro.dbt_utils.bigquery__current_timestamp": {"unique_id": "macro.dbt_utils.bigquery__current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "bigquery__current_timestamp", "macro_sql": "{% macro bigquery__current_timestamp() %}\n current_timestamp\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.307004}, "macro.dbt_utils.current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "current_timestamp_in_utc", "macro_sql": "{% macro current_timestamp_in_utc() -%}\n {{ return(adapter.dispatch('current_timestamp_in_utc', 'dbt_utils')()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__current_timestamp_in_utc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.307568}, "macro.dbt_utils.default__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.default__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "default__current_timestamp_in_utc", "macro_sql": "{% macro default__current_timestamp_in_utc() %}\n {{dbt_utils.current_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.307904}, "macro.dbt_utils.snowflake__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.snowflake__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "snowflake__current_timestamp_in_utc", "macro_sql": "{% macro snowflake__current_timestamp_in_utc() %}\n convert_timezone('UTC', {{dbt_utils.current_timestamp()}})::{{dbt_utils.type_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.current_timestamp", "macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.308321}, "macro.dbt_utils.postgres__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.postgres__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "postgres__current_timestamp_in_utc", "macro_sql": "{% macro postgres__current_timestamp_in_utc() %}\n (current_timestamp at time zone 'utc')::{{dbt_utils.type_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.308633}, "macro.dbt_utils.redshift__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.redshift__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "redshift__current_timestamp_in_utc", "macro_sql": "{% macro redshift__current_timestamp_in_utc() %}\n {{ return(dbt_utils.default__current_timestamp_in_utc()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__current_timestamp_in_utc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.309001}, "macro.dbt_utils.width_bucket": {"unique_id": "macro.dbt_utils.width_bucket", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "width_bucket", "macro_sql": "{% macro width_bucket(expr, min_value, max_value, num_buckets) %}\n {{ return(adapter.dispatch('width_bucket', 'dbt_utils') (expr, min_value, max_value, num_buckets)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__width_bucket"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.312084}, "macro.dbt_utils.default__width_bucket": {"unique_id": "macro.dbt_utils.default__width_bucket", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "default__width_bucket", "macro_sql": "{% macro default__width_bucket(expr, min_value, max_value, num_buckets) -%}\n\n {% set bin_size -%}\n (( {{ max_value }} - {{ min_value }} ) / {{ num_buckets }} )\n {%- endset %}\n (\n -- to break ties when the amount is eaxtly at the bucket egde\n case\n when\n mod(\n {{ dbt_utils.safe_cast(expr, dbt_utils.type_numeric() ) }},\n {{ dbt_utils.safe_cast(bin_size, dbt_utils.type_numeric() ) }}\n ) = 0\n then 1\n else 0\n end\n ) +\n -- Anything over max_value goes the N+1 bucket\n least(\n ceil(\n ({{ expr }} - {{ min_value }})/{{ bin_size }}\n ),\n {{ num_buckets }} + 1\n )\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.safe_cast", "macro.dbt_utils.type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.31343}, "macro.dbt_utils.redshift__width_bucket": {"unique_id": "macro.dbt_utils.redshift__width_bucket", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "redshift__width_bucket", "macro_sql": "{% macro redshift__width_bucket(expr, min_value, max_value, num_buckets) -%}\n\n {% set bin_size -%}\n (( {{ max_value }} - {{ min_value }} ) / {{ num_buckets }} )\n {%- endset %}\n (\n -- to break ties when the amount is exactly at the bucket edge\n case\n when\n {{ dbt_utils.safe_cast(expr, dbt_utils.type_numeric() ) }} %\n {{ dbt_utils.safe_cast(bin_size, dbt_utils.type_numeric() ) }}\n = 0\n then 1\n else 0\n end\n ) +\n -- Anything over max_value goes the N+1 bucket\n least(\n ceil(\n ({{ expr }} - {{ min_value }})/{{ bin_size }}\n ),\n {{ num_buckets }} + 1\n )\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.safe_cast", "macro.dbt_utils.type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3153868}, "macro.dbt_utils.snowflake__width_bucket": {"unique_id": "macro.dbt_utils.snowflake__width_bucket", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "snowflake__width_bucket", "macro_sql": "{% macro snowflake__width_bucket(expr, min_value, max_value, num_buckets) %}\n width_bucket({{ expr }}, {{ min_value }}, {{ max_value }}, {{ num_buckets }} )\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.315991}, "macro.dbt_utils.array_concat": {"unique_id": "macro.dbt_utils.array_concat", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_concat.sql", "original_file_path": "macros/cross_db_utils/array_concat.sql", "name": "array_concat", "macro_sql": "{% macro array_concat(array_1, array_2) -%}\n {{ return(adapter.dispatch('array_concat', 'dbt_utils')(array_1, array_2)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__array_concat"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.317375}, "macro.dbt_utils.default__array_concat": {"unique_id": "macro.dbt_utils.default__array_concat", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_concat.sql", "original_file_path": "macros/cross_db_utils/array_concat.sql", "name": "default__array_concat", "macro_sql": "{% macro default__array_concat(array_1, array_2) -%}\n array_cat({{ array_1 }}, {{ array_2 }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.317823}, "macro.dbt_utils.bigquery__array_concat": {"unique_id": "macro.dbt_utils.bigquery__array_concat", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_concat.sql", "original_file_path": "macros/cross_db_utils/array_concat.sql", "name": "bigquery__array_concat", "macro_sql": "{% macro bigquery__array_concat(array_1, array_2) -%}\n array_concat({{ array_1 }}, {{ array_2 }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.318197}, "macro.dbt_utils.redshift__array_concat": {"unique_id": "macro.dbt_utils.redshift__array_concat", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_concat.sql", "original_file_path": "macros/cross_db_utils/array_concat.sql", "name": "redshift__array_concat", "macro_sql": "{% macro redshift__array_concat(array_1, array_2) -%}\n array_concat({{ array_1 }}, {{ array_2 }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3185558}, "macro.dbt_utils.bool_or": {"unique_id": "macro.dbt_utils.bool_or", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/bool_or.sql", "original_file_path": "macros/cross_db_utils/bool_or.sql", "name": "bool_or", "macro_sql": "{% macro bool_or(expression) -%}\n {{ return(adapter.dispatch('bool_or', 'dbt_utils') (expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__bool_or"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3196108}, "macro.dbt_utils.default__bool_or": {"unique_id": "macro.dbt_utils.default__bool_or", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/bool_or.sql", "original_file_path": "macros/cross_db_utils/bool_or.sql", "name": "default__bool_or", "macro_sql": "{% macro default__bool_or(expression) -%}\n \n bool_or({{ expression }})\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3200169}, "macro.dbt_utils.snowflake__bool_or": {"unique_id": "macro.dbt_utils.snowflake__bool_or", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/bool_or.sql", "original_file_path": "macros/cross_db_utils/bool_or.sql", "name": "snowflake__bool_or", "macro_sql": "{% macro snowflake__bool_or(expression) -%}\n \n boolor_agg({{ expression }})\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3206131}, "macro.dbt_utils.bigquery__bool_or": {"unique_id": "macro.dbt_utils.bigquery__bool_or", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/bool_or.sql", "original_file_path": "macros/cross_db_utils/bool_or.sql", "name": "bigquery__bool_or", "macro_sql": "{% macro bigquery__bool_or(expression) -%}\n \n logical_or({{ expression }})\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.321001}, "macro.dbt_utils.last_day": {"unique_id": "macro.dbt_utils.last_day", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "last_day", "macro_sql": "{% macro last_day(date, datepart) %}\n {{ return(adapter.dispatch('last_day', 'dbt_utils') (date, datepart)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.323137}, "macro.dbt_utils.default_last_day": {"unique_id": "macro.dbt_utils.default_last_day", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "default_last_day", "macro_sql": "\n\n\n{%- macro default_last_day(date, datepart) -%}\n cast(\n {{dbt_utils.dateadd('day', '-1',\n dbt_utils.dateadd(datepart, '1', dbt_utils.date_trunc(datepart, date))\n )}}\n as date)\n{%- endmacro -%}\n\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd", "macro.dbt_utils.date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.324016}, "macro.dbt_utils.default__last_day": {"unique_id": "macro.dbt_utils.default__last_day", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "default__last_day", "macro_sql": "{% macro default__last_day(date, datepart) -%}\n {{dbt_utils.default_last_day(date, datepart)}}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default_last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.324447}, "macro.dbt_utils.postgres__last_day": {"unique_id": "macro.dbt_utils.postgres__last_day", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "postgres__last_day", "macro_sql": "{% macro postgres__last_day(date, datepart) -%}\n\n {%- if datepart == 'quarter' -%}\n -- postgres dateadd does not support quarter interval.\n cast(\n {{dbt_utils.dateadd('day', '-1',\n dbt_utils.dateadd('month', '3', dbt_utils.date_trunc(datepart, date))\n )}}\n as date)\n {%- else -%}\n {{dbt_utils.default_last_day(date, datepart)}}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd", "macro.dbt_utils.date_trunc", "macro.dbt_utils.default_last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3256378}, "macro.dbt_utils.redshift__last_day": {"unique_id": "macro.dbt_utils.redshift__last_day", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "redshift__last_day", "macro_sql": "{% macro redshift__last_day(date, datepart) %}\n\n {{ return(dbt_utils.default__last_day(date, datepart)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3261619}, "macro.dbt_utils.split_part": {"unique_id": "macro.dbt_utils.split_part", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "split_part", "macro_sql": "{% macro split_part(string_text, delimiter_text, part_number) %}\n {{ return(adapter.dispatch('split_part', 'dbt_utils') (string_text, delimiter_text, part_number)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__split_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.329513}, "macro.dbt_utils.default__split_part": {"unique_id": "macro.dbt_utils.default__split_part", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "default__split_part", "macro_sql": "{% macro default__split_part(string_text, delimiter_text, part_number) %}\n\n split_part(\n {{ string_text }},\n {{ delimiter_text }},\n {{ part_number }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3301032}, "macro.dbt_utils._split_part_negative": {"unique_id": "macro.dbt_utils._split_part_negative", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "_split_part_negative", "macro_sql": "{% macro _split_part_negative(string_text, delimiter_text, part_number) %}\n\n split_part(\n {{ string_text }},\n {{ delimiter_text }},\n length({{ string_text }}) \n - length(\n replace({{ string_text }}, {{ delimiter_text }}, '')\n ) + 2 {{ part_number }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3307462}, "macro.dbt_utils.postgres__split_part": {"unique_id": "macro.dbt_utils.postgres__split_part", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "postgres__split_part", "macro_sql": "{% macro postgres__split_part(string_text, delimiter_text, part_number) %}\n\n {% if part_number >= 0 %}\n {{ dbt_utils.default__split_part(string_text, delimiter_text, part_number) }}\n {% else %}\n {{ dbt_utils._split_part_negative(string_text, delimiter_text, part_number) }}\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__split_part", "macro.dbt_utils._split_part_negative"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.331667}, "macro.dbt_utils.redshift__split_part": {"unique_id": "macro.dbt_utils.redshift__split_part", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "redshift__split_part", "macro_sql": "{% macro redshift__split_part(string_text, delimiter_text, part_number) %}\n\n {% if part_number >= 0 %}\n {{ dbt_utils.default__split_part(string_text, delimiter_text, part_number) }}\n {% else %}\n {{ dbt_utils._split_part_negative(string_text, delimiter_text, part_number) }}\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__split_part", "macro.dbt_utils._split_part_negative"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.332761}, "macro.dbt_utils.bigquery__split_part": {"unique_id": "macro.dbt_utils.bigquery__split_part", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "bigquery__split_part", "macro_sql": "{% macro bigquery__split_part(string_text, delimiter_text, part_number) %}\n\n {% if part_number >= 0 %}\n split(\n {{ string_text }},\n {{ delimiter_text }}\n )[safe_offset({{ part_number - 1 }})]\n {% else %}\n split(\n {{ string_text }},\n {{ delimiter_text }}\n )[safe_offset(\n length({{ string_text }}) \n - length(\n replace({{ string_text }}, {{ delimiter_text }}, '')\n ) + 1\n )]\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3339741}, "macro.dbt_utils.date_trunc": {"unique_id": "macro.dbt_utils.date_trunc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/date_trunc.sql", "original_file_path": "macros/cross_db_utils/date_trunc.sql", "name": "date_trunc", "macro_sql": "{% macro date_trunc(datepart, date) -%}\n {{ return(adapter.dispatch('date_trunc', 'dbt_utils') (datepart, date)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.335432}, "macro.dbt_utils.default__date_trunc": {"unique_id": "macro.dbt_utils.default__date_trunc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/date_trunc.sql", "original_file_path": "macros/cross_db_utils/date_trunc.sql", "name": "default__date_trunc", "macro_sql": "{% macro default__date_trunc(datepart, date) -%}\n date_trunc('{{datepart}}', {{date}})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.335813}, "macro.dbt_utils.bigquery__date_trunc": {"unique_id": "macro.dbt_utils.bigquery__date_trunc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/date_trunc.sql", "original_file_path": "macros/cross_db_utils/date_trunc.sql", "name": "bigquery__date_trunc", "macro_sql": "{% macro bigquery__date_trunc(datepart, date) -%}\n timestamp_trunc(\n cast({{date}} as timestamp),\n {{datepart}}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.336267}, "macro.dbt_utils.array_construct": {"unique_id": "macro.dbt_utils.array_construct", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_construct.sql", "original_file_path": "macros/cross_db_utils/array_construct.sql", "name": "array_construct", "macro_sql": "{% macro array_construct(inputs = [], data_type = api.Column.translate_type('integer')) -%}\n {{ return(adapter.dispatch('array_construct', 'dbt_utils')(inputs, data_type)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__array_construct"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.337866}, "macro.dbt_utils.default__array_construct": {"unique_id": "macro.dbt_utils.default__array_construct", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_construct.sql", "original_file_path": "macros/cross_db_utils/array_construct.sql", "name": "default__array_construct", "macro_sql": "{% macro default__array_construct(inputs, data_type) -%}\n {% if inputs|length > 0 %}\n array[ {{ inputs|join(' , ') }} ]\n {% else %}\n array[]::{{data_type}}[]\n {% endif %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.338629}, "macro.dbt_utils.snowflake__array_construct": {"unique_id": "macro.dbt_utils.snowflake__array_construct", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_construct.sql", "original_file_path": "macros/cross_db_utils/array_construct.sql", "name": "snowflake__array_construct", "macro_sql": "{% macro snowflake__array_construct(inputs, data_type) -%}\n array_construct( {{ inputs|join(' , ') }} )\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.33903}, "macro.dbt_utils.redshift__array_construct": {"unique_id": "macro.dbt_utils.redshift__array_construct", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_construct.sql", "original_file_path": "macros/cross_db_utils/array_construct.sql", "name": "redshift__array_construct", "macro_sql": "{% macro redshift__array_construct(inputs, data_type) -%}\n array( {{ inputs|join(' , ') }} )\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3394828}, "macro.dbt_utils.bigquery__array_construct": {"unique_id": "macro.dbt_utils.bigquery__array_construct", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_construct.sql", "original_file_path": "macros/cross_db_utils/array_construct.sql", "name": "bigquery__array_construct", "macro_sql": "{% macro bigquery__array_construct(inputs, data_type) -%}\n [ {{ inputs|join(' , ') }} ]\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.339884}, "macro.dbt_utils._is_ephemeral": {"unique_id": "macro.dbt_utils._is_ephemeral", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/_is_ephemeral.sql", "original_file_path": "macros/cross_db_utils/_is_ephemeral.sql", "name": "_is_ephemeral", "macro_sql": "{% macro _is_ephemeral(obj, macro) %}\n {%- if obj.is_cte -%}\n {% set ephemeral_prefix = api.Relation.add_ephemeral_prefix('') %}\n {% if obj.name.startswith(ephemeral_prefix) %}\n {% set model_name = obj.name[(ephemeral_prefix|length):] %}\n {% else %}\n {% set model_name = obj.name %}\n {%- endif -%}\n {% set error_message %}\nThe `{{ macro }}` macro cannot be used with ephemeral models, as it relies on the information schema.\n\n`{{ model_name }}` is an ephemeral model. Consider making it a view or table instead.\n {% endset %}\n {%- do exceptions.raise_compiler_error(error_message) -%}\n {%- endif -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.342409}, "macro.dbt_utils.array_append": {"unique_id": "macro.dbt_utils.array_append", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_append.sql", "original_file_path": "macros/cross_db_utils/array_append.sql", "name": "array_append", "macro_sql": "{% macro array_append(array, new_element) -%}\n {{ return(adapter.dispatch('array_append', 'dbt_utils')(array, new_element)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__array_append"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.343581}, "macro.dbt_utils.default__array_append": {"unique_id": "macro.dbt_utils.default__array_append", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_append.sql", "original_file_path": "macros/cross_db_utils/array_append.sql", "name": "default__array_append", "macro_sql": "{% macro default__array_append(array, new_element) -%}\n array_append({{ array }}, {{ new_element }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.343997}, "macro.dbt_utils.bigquery__array_append": {"unique_id": "macro.dbt_utils.bigquery__array_append", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_append.sql", "original_file_path": "macros/cross_db_utils/array_append.sql", "name": "bigquery__array_append", "macro_sql": "{% macro bigquery__array_append(array, new_element) -%}\n {{ dbt_utils.array_concat(array, dbt_utils.array_construct([new_element])) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.array_concat", "macro.dbt_utils.array_construct"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3445382}, "macro.dbt_utils.redshift__array_append": {"unique_id": "macro.dbt_utils.redshift__array_append", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_append.sql", "original_file_path": "macros/cross_db_utils/array_append.sql", "name": "redshift__array_append", "macro_sql": "{% macro redshift__array_append(array, new_element) -%}\n {{ dbt_utils.array_concat(array, dbt_utils.array_construct([new_element])) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.array_concat", "macro.dbt_utils.array_construct"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.34523}, "macro.dbt_utils.get_period_boundaries": {"unique_id": "macro.dbt_utils.get_period_boundaries", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "get_period_boundaries", "macro_sql": "{% macro get_period_boundaries(target_schema, target_table, timestamp_field, start_date, stop_date, period) -%}\n {{ return(adapter.dispatch('get_period_boundaries', 'dbt_utils')(target_schema, target_table, timestamp_field, start_date, stop_date, period)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_period_boundaries"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.357065}, "macro.dbt_utils.default__get_period_boundaries": {"unique_id": "macro.dbt_utils.default__get_period_boundaries", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "default__get_period_boundaries", "macro_sql": "{% macro default__get_period_boundaries(target_schema, target_table, timestamp_field, start_date, stop_date, period) -%}\n\n {% call statement('period_boundaries', fetch_result=True) -%}\n with data as (\n select\n coalesce(max(\"{{timestamp_field}}\"), '{{start_date}}')::timestamp as start_timestamp,\n coalesce(\n {{dbt_utils.dateadd('millisecond',\n -1,\n \"nullif('\" ~ stop_date ~ \"','')::timestamp\")}},\n {{dbt_utils.current_timestamp()}}\n ) as stop_timestamp\n from \"{{target_schema}}\".\"{{target_table}}\"\n )\n\n select\n start_timestamp,\n stop_timestamp,\n {{dbt_utils.datediff('start_timestamp',\n 'stop_timestamp',\n period)}} + 1 as num_periods\n from data\n {%- endcall %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.dateadd", "macro.dbt_utils.current_timestamp", "macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.358463}, "macro.dbt_utils.get_period_sql": {"unique_id": "macro.dbt_utils.get_period_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "get_period_sql", "macro_sql": "{% macro get_period_sql(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset) -%}\n {{ return(adapter.dispatch('get_period_sql', 'dbt_utils')(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_period_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3593862}, "macro.dbt_utils.default__get_period_sql": {"unique_id": "macro.dbt_utils.default__get_period_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "default__get_period_sql", "macro_sql": "{% macro default__get_period_sql(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset) -%}\n\n {%- set period_filter -%}\n (\"{{timestamp_field}}\" > '{{start_timestamp}}'::timestamp + interval '{{offset}} {{period}}' and\n \"{{timestamp_field}}\" <= '{{start_timestamp}}'::timestamp + interval '{{offset}} {{period}}' + interval '1 {{period}}' and\n \"{{timestamp_field}}\" < '{{stop_timestamp}}'::timestamp)\n {%- endset -%}\n\n {%- set filtered_sql = sql | replace(\"__PERIOD_FILTER__\", period_filter) -%}\n\n select\n {{target_cols_csv}}\n from (\n {{filtered_sql}}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.361161}, "macro.dbt_utils.materialization_insert_by_period_default": {"unique_id": "macro.dbt_utils.materialization_insert_by_period_default", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "materialization_insert_by_period_default", "macro_sql": "{% materialization insert_by_period, default -%}\n {%- set timestamp_field = config.require('timestamp_field') -%}\n {%- set start_date = config.require('start_date') -%}\n {%- set stop_date = config.get('stop_date') or '' -%}\n {%- set period = config.get('period') or 'week' -%}\n\n {%- if sql.find('__PERIOD_FILTER__') == -1 -%}\n {%- set error_message -%}\n Model '{{ model.unique_id }}' does not include the required string '__PERIOD_FILTER__' in its sql\n {%- endset -%}\n {{ exceptions.raise_compiler_error(error_message) }}\n {%- endif -%}\n\n {%- set identifier = model['name'] -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier, schema=schema, type='table') -%}\n\n {%- set non_destructive_mode = (flags.NON_DESTRUCTIVE == True) -%}\n {%- set full_refresh_mode = (flags.FULL_REFRESH == True) -%}\n\n {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n {%- set exists_not_as_table = (old_relation is not none and not old_relation.is_table) -%}\n\n {%- set should_truncate = (non_destructive_mode and full_refresh_mode and exists_as_table) -%}\n {%- set should_drop = (not should_truncate and (full_refresh_mode or exists_not_as_table)) -%}\n {%- set force_create = (flags.FULL_REFRESH and not flags.NON_DESTRUCTIVE) -%}\n\n -- setup\n {% if old_relation is none -%}\n -- noop\n {%- elif should_truncate -%}\n {{adapter.truncate_relation(old_relation)}}\n {%- elif should_drop -%}\n {{adapter.drop_relation(old_relation)}}\n {%- set old_relation = none -%}\n {%- endif %}\n\n {{run_hooks(pre_hooks, inside_transaction=False)}}\n\n -- `begin` happens here, so `commit` after it to finish the transaction\n {{run_hooks(pre_hooks, inside_transaction=True)}}\n {% call statement() -%}\n begin; -- make extra sure we've closed out the transaction\n commit;\n {%- endcall %}\n\n -- build model\n {% if force_create or old_relation is none -%}\n {# Create an empty target table -#}\n {% call statement('main') -%}\n {%- set empty_sql = sql | replace(\"__PERIOD_FILTER__\", 'false') -%}\n {{create_table_as(False, target_relation, empty_sql)}}\n {%- endcall %}\n {%- endif %}\n\n {% set _ = dbt_utils.get_period_boundaries(schema,\n identifier,\n timestamp_field,\n start_date,\n stop_date,\n period) %}\n {%- set start_timestamp = load_result('period_boundaries')['data'][0][0] | string -%}\n {%- set stop_timestamp = load_result('period_boundaries')['data'][0][1] | string -%}\n {%- set num_periods = load_result('period_boundaries')['data'][0][2] | int -%}\n\n {% set target_columns = adapter.get_columns_in_relation(target_relation) %}\n {%- set target_cols_csv = target_columns | map(attribute='quoted') | join(', ') -%}\n {%- set loop_vars = {'sum_rows_inserted': 0} -%}\n\n -- commit each period as a separate transaction\n {% for i in range(num_periods) -%}\n {%- set msg = \"Running for \" ~ period ~ \" \" ~ (i + 1) ~ \" of \" ~ (num_periods) -%}\n {{ dbt_utils.log_info(msg) }}\n\n {%- set tmp_identifier = model['name'] ~ '__dbt_incremental_period' ~ i ~ '_tmp' -%}\n {%- set tmp_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema, type='table') -%}\n {% call statement() -%}\n {% set tmp_table_sql = dbt_utils.get_period_sql(target_cols_csv,\n sql,\n timestamp_field,\n period,\n start_timestamp,\n stop_timestamp,\n i) %}\n {{dbt.create_table_as(True, tmp_relation, tmp_table_sql)}}\n {%- endcall %}\n\n {{adapter.expand_target_column_types(from_relation=tmp_relation,\n to_relation=target_relation)}}\n {%- set name = 'main-' ~ i -%}\n {% call statement(name, fetch_result=True) -%}\n insert into {{target_relation}} ({{target_cols_csv}})\n (\n select\n {{target_cols_csv}}\n from {{tmp_relation.include(schema=False)}}\n );\n {%- endcall %}\n {% set result = load_result('main-' ~ i) %}\n {% if 'response' in result.keys() %} {# added in v0.19.0 #}\n {% set rows_inserted = result['response']['rows_affected'] %}\n {% else %} {# older versions #}\n {% set rows_inserted = result['status'].split(\" \")[2] | int %}\n {% endif %}\n \n {%- set sum_rows_inserted = loop_vars['sum_rows_inserted'] + rows_inserted -%}\n {%- if loop_vars.update({'sum_rows_inserted': sum_rows_inserted}) %} {% endif -%}\n\n {%- set msg = \"Ran for \" ~ period ~ \" \" ~ (i + 1) ~ \" of \" ~ (num_periods) ~ \"; \" ~ rows_inserted ~ \" records inserted\" -%}\n {{ dbt_utils.log_info(msg) }}\n\n {%- endfor %}\n\n {% call statement() -%}\n begin;\n {%- endcall %}\n\n {{run_hooks(post_hooks, inside_transaction=True)}}\n\n {% call statement() -%}\n commit;\n {%- endcall %}\n\n {{run_hooks(post_hooks, inside_transaction=False)}}\n\n {%- set status_string = \"INSERT \" ~ loop_vars['sum_rows_inserted'] -%}\n\n {% call noop_statement('main', status_string) -%}\n -- no-op\n {%- endcall %}\n\n -- Return the relations created in this materialization\n {{ return({'relations': [target_relation]}) }} \n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt_utils.get_period_boundaries", "macro.dbt_utils.log_info", "macro.dbt_utils.get_period_sql", "macro.dbt.noop_statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.376039}, "macro.dbt_utils.get_url_host": {"unique_id": "macro.dbt_utils.get_url_host", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "name": "get_url_host", "macro_sql": "{% macro get_url_host(field) -%}\n {{ return(adapter.dispatch('get_url_host', 'dbt_utils')(field)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_url_host"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.377228}, "macro.dbt_utils.default__get_url_host": {"unique_id": "macro.dbt_utils.default__get_url_host", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "name": "default__get_url_host", "macro_sql": "{% macro default__get_url_host(field) -%}\n\n{%- set parsed =\n dbt_utils.split_part(\n dbt_utils.split_part(\n dbt_utils.replace(\n dbt_utils.replace(\n dbt_utils.replace(field, \"'android-app://'\", \"''\"\n ), \"'http://'\", \"''\"\n ), \"'https://'\", \"''\"\n ), \"'/'\", 1\n ), \"'?'\", 1\n )\n\n-%}\n\n\n {{ dbt_utils.safe_cast(\n parsed,\n dbt_utils.type_string()\n )}}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.split_part", "macro.dbt_utils.replace", "macro.dbt_utils.safe_cast", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.37851}, "macro.dbt_utils.get_url_path": {"unique_id": "macro.dbt_utils.get_url_path", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "name": "get_url_path", "macro_sql": "{% macro get_url_path(field) -%}\n {{ return(adapter.dispatch('get_url_path', 'dbt_utils')(field)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_url_path"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3800051}, "macro.dbt_utils.default__get_url_path": {"unique_id": "macro.dbt_utils.default__get_url_path", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "name": "default__get_url_path", "macro_sql": "{% macro default__get_url_path(field) -%}\n\n {%- set stripped_url = \n dbt_utils.replace(\n dbt_utils.replace(field, \"'http://'\", \"''\"), \"'https://'\", \"''\")\n -%}\n\n {%- set first_slash_pos -%}\n coalesce(\n nullif({{dbt_utils.position(\"'/'\", stripped_url)}}, 0),\n {{dbt_utils.position(\"'?'\", stripped_url)}} - 1\n )\n {%- endset -%}\n\n {%- set parsed_path =\n dbt_utils.split_part(\n dbt_utils.right(\n stripped_url, \n dbt_utils.length(stripped_url) ~ \"-\" ~ first_slash_pos\n ), \n \"'?'\", 1\n )\n -%}\n\n {{ dbt_utils.safe_cast(\n parsed_path,\n dbt_utils.type_string()\n )}}\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.replace", "macro.dbt_utils.position", "macro.dbt_utils.split_part", "macro.dbt_utils.right", "macro.dbt_utils.length", "macro.dbt_utils.safe_cast", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.382074}, "macro.dbt_utils.get_url_parameter": {"unique_id": "macro.dbt_utils.get_url_parameter", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "name": "get_url_parameter", "macro_sql": "{% macro get_url_parameter(field, url_parameter) -%}\n {{ return(adapter.dispatch('get_url_parameter', 'dbt_utils')(field, url_parameter)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_url_parameter"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.383191}, "macro.dbt_utils.default__get_url_parameter": {"unique_id": "macro.dbt_utils.default__get_url_parameter", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "name": "default__get_url_parameter", "macro_sql": "{% macro default__get_url_parameter(field, url_parameter) -%}\n\n{%- set formatted_url_parameter = \"'\" + url_parameter + \"='\" -%}\n\n{%- set split = dbt_utils.split_part(dbt_utils.split_part(field, formatted_url_parameter, 2), \"'&'\", 1) -%}\n\nnullif({{ split }},'')\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.split_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.384266}, "macro.dbt_utils.test_fewer_rows_than": {"unique_id": "macro.dbt_utils.test_fewer_rows_than", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/fewer_rows_than.sql", "original_file_path": "macros/generic_tests/fewer_rows_than.sql", "name": "test_fewer_rows_than", "macro_sql": "{% test fewer_rows_than(model, compare_model) %}\n {{ return(adapter.dispatch('test_fewer_rows_than', 'dbt_utils')(model, compare_model)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_fewer_rows_than"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.386009}, "macro.dbt_utils.default__test_fewer_rows_than": {"unique_id": "macro.dbt_utils.default__test_fewer_rows_than", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/fewer_rows_than.sql", "original_file_path": "macros/generic_tests/fewer_rows_than.sql", "name": "default__test_fewer_rows_than", "macro_sql": "{% macro default__test_fewer_rows_than(model, compare_model) %}\n\n{{ config(fail_calc = 'coalesce(row_count_delta, 0)') }}\n\nwith a as (\n\n select count(*) as count_our_model from {{ model }}\n\n),\nb as (\n\n select count(*) as count_comparison_model from {{ compare_model }}\n\n),\ncounts as (\n\n select\n count_our_model,\n count_comparison_model\n from a\n cross join b\n\n),\nfinal as (\n\n select *,\n case\n -- fail the test if we have more rows than the reference model and return the row count delta\n when count_our_model > count_comparison_model then (count_our_model - count_comparison_model)\n -- fail the test if they are the same number\n when count_our_model = count_comparison_model then 1\n -- pass the test if the delta is positive (i.e. return the number 0)\n else 0\n end as row_count_delta\n from counts\n\n)\n\nselect * from final\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3867478}, "macro.dbt_utils.test_equal_rowcount": {"unique_id": "macro.dbt_utils.test_equal_rowcount", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/equal_rowcount.sql", "original_file_path": "macros/generic_tests/equal_rowcount.sql", "name": "test_equal_rowcount", "macro_sql": "{% test equal_rowcount(model, compare_model) %}\n {{ return(adapter.dispatch('test_equal_rowcount', 'dbt_utils')(model, compare_model)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_equal_rowcount"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.387882}, "macro.dbt_utils.default__test_equal_rowcount": {"unique_id": "macro.dbt_utils.default__test_equal_rowcount", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/equal_rowcount.sql", "original_file_path": "macros/generic_tests/equal_rowcount.sql", "name": "default__test_equal_rowcount", "macro_sql": "{% macro default__test_equal_rowcount(model, compare_model) %}\n\n{#-- Needs to be set at parse time, before we return '' below --#}\n{{ config(fail_calc = 'coalesce(diff_count, 0)') }}\n\n{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n{%- if not execute -%}\n {{ return('') }}\n{% endif %}\n\nwith a as (\n\n select count(*) as count_a from {{ model }}\n\n),\nb as (\n\n select count(*) as count_b from {{ compare_model }}\n\n),\nfinal as (\n\n select\n count_a,\n count_b,\n abs(count_a - count_b) as diff_count\n from a\n cross join b\n\n)\n\nselect * from final\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3886871}, "macro.dbt_utils.test_relationships_where": {"unique_id": "macro.dbt_utils.test_relationships_where", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/relationships_where.sql", "original_file_path": "macros/generic_tests/relationships_where.sql", "name": "test_relationships_where", "macro_sql": "{% test relationships_where(model, column_name, to, field, from_condition=\"1=1\", to_condition=\"1=1\") %}\n {{ return(adapter.dispatch('test_relationships_where', 'dbt_utils')(model, column_name, to, field, from_condition, to_condition)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_relationships_where"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.390313}, "macro.dbt_utils.default__test_relationships_where": {"unique_id": "macro.dbt_utils.default__test_relationships_where", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/relationships_where.sql", "original_file_path": "macros/generic_tests/relationships_where.sql", "name": "default__test_relationships_where", "macro_sql": "{% macro default__test_relationships_where(model, column_name, to, field, from_condition=\"1=1\", to_condition=\"1=1\") %}\n\n{# T-SQL has no boolean data type so we use 1=1 which returns TRUE #}\n{# ref https://stackoverflow.com/a/7170753/3842610 #}\n\nwith left_table as (\n\n select\n {{column_name}} as id\n\n from {{model}}\n\n where {{column_name}} is not null\n and {{from_condition}}\n\n),\n\nright_table as (\n\n select\n {{field}} as id\n\n from {{to}}\n\n where {{field}} is not null\n and {{to_condition}}\n\n),\n\nexceptions as (\n\n select\n left_table.id,\n right_table.id as right_id\n\n from left_table\n\n left join right_table\n on left_table.id = right_table.id\n\n where right_table.id is null\n\n)\n\nselect * from exceptions\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.391221}, "macro.dbt_utils.test_recency": {"unique_id": "macro.dbt_utils.test_recency", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/recency.sql", "original_file_path": "macros/generic_tests/recency.sql", "name": "test_recency", "macro_sql": "{% test recency(model, field, datepart, interval) %}\n {{ return(adapter.dispatch('test_recency', 'dbt_utils')(model, field, datepart, interval)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_recency"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3923671}, "macro.dbt_utils.default__test_recency": {"unique_id": "macro.dbt_utils.default__test_recency", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/recency.sql", "original_file_path": "macros/generic_tests/recency.sql", "name": "default__test_recency", "macro_sql": "{% macro default__test_recency(model, field, datepart, interval) %}\n\n{% set threshold = dbt_utils.dateadd(datepart, interval * -1, dbt_utils.current_timestamp()) %}\n\nwith recency as (\n\n select max({{field}}) as most_recent\n from {{ model }}\n\n)\n\nselect\n\n most_recent,\n {{ threshold }} as threshold\n\nfrom recency\nwhere most_recent < {{ threshold }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd", "macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.393327}, "macro.dbt_utils.test_not_constant": {"unique_id": "macro.dbt_utils.test_not_constant", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/not_constant.sql", "original_file_path": "macros/generic_tests/not_constant.sql", "name": "test_not_constant", "macro_sql": "{% test not_constant(model, column_name) %}\n {{ return(adapter.dispatch('test_not_constant', 'dbt_utils')(model, column_name)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_not_constant"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.394308}, "macro.dbt_utils.default__test_not_constant": {"unique_id": "macro.dbt_utils.default__test_not_constant", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/not_constant.sql", "original_file_path": "macros/generic_tests/not_constant.sql", "name": "default__test_not_constant", "macro_sql": "{% macro default__test_not_constant(model, column_name) %}\n\n\nselect\n {# In TSQL, subquery aggregate columns need aliases #}\n {# thus: a filler col name, 'filler_column' #}\n count(distinct {{ column_name }}) as filler_column\n\nfrom {{ model }}\n\nhaving count(distinct {{ column_name }}) = 1\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3948438}, "macro.dbt_utils.test_accepted_range": {"unique_id": "macro.dbt_utils.test_accepted_range", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/accepted_range.sql", "original_file_path": "macros/generic_tests/accepted_range.sql", "name": "test_accepted_range", "macro_sql": "{% test accepted_range(model, column_name, min_value=none, max_value=none, inclusive=true) %}\n {{ return(adapter.dispatch('test_accepted_range', 'dbt_utils')(model, column_name, min_value, max_value, inclusive)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_accepted_range"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.396745}, "macro.dbt_utils.default__test_accepted_range": {"unique_id": "macro.dbt_utils.default__test_accepted_range", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/accepted_range.sql", "original_file_path": "macros/generic_tests/accepted_range.sql", "name": "default__test_accepted_range", "macro_sql": "{% macro default__test_accepted_range(model, column_name, min_value=none, max_value=none, inclusive=true) %}\n\nwith meet_condition as(\n select *\n from {{ model }}\n),\n\nvalidation_errors as (\n select *\n from meet_condition\n where\n -- never true, defaults to an empty result set. Exists to ensure any combo of the `or` clauses below succeeds\n 1 = 2\n\n {%- if min_value is not none %}\n -- records with a value >= min_value are permitted. The `not` flips this to find records that don't meet the rule.\n or not {{ column_name }} > {{- \"=\" if inclusive }} {{ min_value }}\n {%- endif %}\n\n {%- if max_value is not none %}\n -- records with a value <= max_value are permitted. The `not` flips this to find records that don't meet the rule.\n or not {{ column_name }} < {{- \"=\" if inclusive }} {{ max_value }}\n {%- endif %}\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.398196}, "macro.dbt_utils.test_not_accepted_values": {"unique_id": "macro.dbt_utils.test_not_accepted_values", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/not_accepted_values.sql", "original_file_path": "macros/generic_tests/not_accepted_values.sql", "name": "test_not_accepted_values", "macro_sql": "{% test not_accepted_values(model, column_name, values, quote=True) %}\n {{ return(adapter.dispatch('test_not_accepted_values', 'dbt_utils')(model, column_name, values, quote)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_not_accepted_values"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.399682}, "macro.dbt_utils.default__test_not_accepted_values": {"unique_id": "macro.dbt_utils.default__test_not_accepted_values", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/not_accepted_values.sql", "original_file_path": "macros/generic_tests/not_accepted_values.sql", "name": "default__test_not_accepted_values", "macro_sql": "{% macro default__test_not_accepted_values(model, column_name, values, quote=True) %}\nwith all_values as (\n\n select distinct\n {{ column_name }} as value_field\n\n from {{ model }}\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field in (\n {% for value in values -%}\n {% if quote -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {%- endfor %}\n )\n\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.401016}, "macro.dbt_utils.test_unique_where": {"unique_id": "macro.dbt_utils.test_unique_where", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/test_unique_where.sql", "original_file_path": "macros/generic_tests/test_unique_where.sql", "name": "test_unique_where", "macro_sql": "{% test unique_where(model, column_name) %}\r\n {%- set deprecation_warning = '\r\n Warning: `dbt_utils.unique_where` is no longer supported.\r\n Starting in dbt v0.20.0, the built-in `unique` test supports a `where` config.\r\n ' -%}\r\n {%- do exceptions.warn(deprecation_warning) -%}\r\n {{ return(adapter.dispatch('test_unique_where', 'dbt_utils')(model, column_name)) }}\r\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_unique_where"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.403647}, "macro.dbt_utils.default__test_unique_where": {"unique_id": "macro.dbt_utils.default__test_unique_where", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/test_unique_where.sql", "original_file_path": "macros/generic_tests/test_unique_where.sql", "name": "default__test_unique_where", "macro_sql": "{% macro default__test_unique_where(model, column_name) %}\r\n {{ return(test_unique(model, column_name)) }}\r\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.test_unique"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.404181}, "macro.dbt_utils.test_at_least_one": {"unique_id": "macro.dbt_utils.test_at_least_one", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/at_least_one.sql", "original_file_path": "macros/generic_tests/at_least_one.sql", "name": "test_at_least_one", "macro_sql": "{% test at_least_one(model, column_name) %}\n {{ return(adapter.dispatch('test_at_least_one', 'dbt_utils')(model, column_name)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_at_least_one"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.405217}, "macro.dbt_utils.default__test_at_least_one": {"unique_id": "macro.dbt_utils.default__test_at_least_one", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/at_least_one.sql", "original_file_path": "macros/generic_tests/at_least_one.sql", "name": "default__test_at_least_one", "macro_sql": "{% macro default__test_at_least_one(model, column_name) %}\n\nselect *\nfrom (\n select\n {# In TSQL, subquery aggregate columns need aliases #}\n {# thus: a filler col name, 'filler_column' #}\n count({{ column_name }}) as filler_column\n\n from {{ model }}\n\n having count({{ column_name }}) = 0\n\n) validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.40572}, "macro.dbt_utils.test_unique_combination_of_columns": {"unique_id": "macro.dbt_utils.test_unique_combination_of_columns", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/unique_combination_of_columns.sql", "original_file_path": "macros/generic_tests/unique_combination_of_columns.sql", "name": "test_unique_combination_of_columns", "macro_sql": "{% test unique_combination_of_columns(model, combination_of_columns, quote_columns=false) %}\n {{ return(adapter.dispatch('test_unique_combination_of_columns', 'dbt_utils')(model, combination_of_columns, quote_columns)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_unique_combination_of_columns"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.407243}, "macro.dbt_utils.default__test_unique_combination_of_columns": {"unique_id": "macro.dbt_utils.default__test_unique_combination_of_columns", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/unique_combination_of_columns.sql", "original_file_path": "macros/generic_tests/unique_combination_of_columns.sql", "name": "default__test_unique_combination_of_columns", "macro_sql": "{% macro default__test_unique_combination_of_columns(model, combination_of_columns, quote_columns=false) %}\n\n{% if not quote_columns %}\n {%- set column_list=combination_of_columns %}\n{% elif quote_columns %}\n {%- set column_list=[] %}\n {% for column in combination_of_columns -%}\n {% set column_list = column_list.append( adapter.quote(column) ) %}\n {%- endfor %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`quote_columns` argument for unique_combination_of_columns test must be one of [True, False] Got: '\" ~ quote ~\"'.'\"\n ) }}\n{% endif %}\n\n{%- set columns_csv=column_list | join(', ') %}\n\n\nwith validation_errors as (\n\n select\n {{ columns_csv }}\n from {{ model }}\n group by {{ columns_csv }}\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.409055}, "macro.dbt_utils.test_cardinality_equality": {"unique_id": "macro.dbt_utils.test_cardinality_equality", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/cardinality_equality.sql", "original_file_path": "macros/generic_tests/cardinality_equality.sql", "name": "test_cardinality_equality", "macro_sql": "{% test cardinality_equality(model, column_name, to, field) %}\n {{ return(adapter.dispatch('test_cardinality_equality', 'dbt_utils')(model, column_name, to, field)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_cardinality_equality"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.410665}, "macro.dbt_utils.default__test_cardinality_equality": {"unique_id": "macro.dbt_utils.default__test_cardinality_equality", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/cardinality_equality.sql", "original_file_path": "macros/generic_tests/cardinality_equality.sql", "name": "default__test_cardinality_equality", "macro_sql": "{% macro default__test_cardinality_equality(model, column_name, to, field) %}\n\n{# T-SQL does not let you use numbers as aliases for columns #}\n{# Thus, no \"GROUP BY 1\" #}\n\nwith table_a as (\nselect\n {{ column_name }},\n count(*) as num_rows\nfrom {{ model }}\ngroup by {{ column_name }}\n),\n\ntable_b as (\nselect\n {{ field }},\n count(*) as num_rows\nfrom {{ to }}\ngroup by {{ field }}\n),\n\nexcept_a as (\n select *\n from table_a\n {{ dbt_utils.except() }}\n select *\n from table_b\n),\n\nexcept_b as (\n select *\n from table_b\n {{ dbt_utils.except() }}\n select *\n from table_a\n),\n\nunioned as (\n select *\n from except_a\n union all\n select *\n from except_b\n)\n\nselect *\nfrom unioned\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.except"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.411595}, "macro.dbt_utils.test_expression_is_true": {"unique_id": "macro.dbt_utils.test_expression_is_true", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/expression_is_true.sql", "original_file_path": "macros/generic_tests/expression_is_true.sql", "name": "test_expression_is_true", "macro_sql": "{% test expression_is_true(model, expression, column_name=None, condition='1=1') %}\n{# T-SQL has no boolean data type so we use 1=1 which returns TRUE #}\n{# ref https://stackoverflow.com/a/7170753/3842610 #}\n {{ return(adapter.dispatch('test_expression_is_true', 'dbt_utils')(model, expression, column_name, condition)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.4130628}, "macro.dbt_utils.default__test_expression_is_true": {"unique_id": "macro.dbt_utils.default__test_expression_is_true", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/expression_is_true.sql", "original_file_path": "macros/generic_tests/expression_is_true.sql", "name": "default__test_expression_is_true", "macro_sql": "{% macro default__test_expression_is_true(model, expression, column_name, condition) %}\n\nwith meet_condition as (\n select * from {{ model }} where {{ condition }}\n)\n\nselect\n *\nfrom meet_condition\n{% if column_name is none %}\nwhere not({{ expression }})\n{%- else %}\nwhere not({{ column_name }} {{ expression }})\n{%- endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.4139771}, "macro.dbt_utils.test_not_null_proportion": {"unique_id": "macro.dbt_utils.test_not_null_proportion", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/not_null_proportion.sql", "original_file_path": "macros/generic_tests/not_null_proportion.sql", "name": "test_not_null_proportion", "macro_sql": "{% macro test_not_null_proportion(model) %}\n {{ return(adapter.dispatch('test_not_null_proportion', 'dbt_utils')(model, **kwargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_not_null_proportion"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.4152489}, "macro.dbt_utils.default__test_not_null_proportion": {"unique_id": "macro.dbt_utils.default__test_not_null_proportion", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/not_null_proportion.sql", "original_file_path": "macros/generic_tests/not_null_proportion.sql", "name": "default__test_not_null_proportion", "macro_sql": "{% macro default__test_not_null_proportion(model) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}\n{% set at_least = kwargs.get('at_least', kwargs.get('arg')) %}\n{% set at_most = kwargs.get('at_most', kwargs.get('arg', 1)) %}\n\nwith validation as (\n select\n sum(case when {{ column_name }} is null then 0 else 1 end) / cast(count(*) as numeric) as not_null_proportion\n from {{ model }}\n),\nvalidation_errors as (\n select\n not_null_proportion\n from validation\n where not_null_proportion < {{ at_least }} or not_null_proportion > {{ at_most }}\n)\nselect\n *\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.4174662}, "macro.dbt_utils.test_sequential_values": {"unique_id": "macro.dbt_utils.test_sequential_values", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/sequential_values.sql", "original_file_path": "macros/generic_tests/sequential_values.sql", "name": "test_sequential_values", "macro_sql": "{% test sequential_values(model, column_name, interval=1, datepart=None) %}\n\n {{ return(adapter.dispatch('test_sequential_values', 'dbt_utils')(model, column_name, interval, datepart)) }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_sequential_values"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.4197881}, "macro.dbt_utils.default__test_sequential_values": {"unique_id": "macro.dbt_utils.default__test_sequential_values", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/sequential_values.sql", "original_file_path": "macros/generic_tests/sequential_values.sql", "name": "default__test_sequential_values", "macro_sql": "{% macro default__test_sequential_values(model, column_name, interval=1, datepart=None) %}\n\n{% set previous_column_name = \"previous_\" ~ dbt_utils.slugify(column_name) %}\n\nwith windowed as (\n\n select\n {{ column_name }},\n lag({{ column_name }}) over (\n order by {{ column_name }}\n ) as {{ previous_column_name }}\n from {{ model }}\n),\n\nvalidation_errors as (\n select\n *\n from windowed\n {% if datepart %}\n where not(cast({{ column_name }} as {{ dbt_utils.type_timestamp() }})= cast({{ dbt_utils.dateadd(datepart, interval, previous_column_name) }} as {{ dbt_utils.type_timestamp() }}))\n {% else %}\n where not({{ column_name }} = {{ previous_column_name }} + {{ interval }})\n {% endif %}\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.slugify", "macro.dbt_utils.type_timestamp", "macro.dbt_utils.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.421862}, "macro.dbt_utils.test_not_null_where": {"unique_id": "macro.dbt_utils.test_not_null_where", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/test_not_null_where.sql", "original_file_path": "macros/generic_tests/test_not_null_where.sql", "name": "test_not_null_where", "macro_sql": "{% test not_null_where(model, column_name) %}\r\n {%- set deprecation_warning = '\r\n Warning: `dbt_utils.not_null_where` is no longer supported.\r\n Starting in dbt v0.20.0, the built-in `not_null` test supports a `where` config.\r\n ' -%}\r\n {%- do exceptions.warn(deprecation_warning) -%}\r\n {{ return(adapter.dispatch('test_not_null_where', 'dbt_utils')(model, column_name)) }}\r\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_not_null_where"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.423708}, "macro.dbt_utils.default__test_not_null_where": {"unique_id": "macro.dbt_utils.default__test_not_null_where", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/test_not_null_where.sql", "original_file_path": "macros/generic_tests/test_not_null_where.sql", "name": "default__test_not_null_where", "macro_sql": "{% macro default__test_not_null_where(model, column_name) %}\r\n {{ return(test_not_null(model, column_name)) }}\r\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.test_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.424621}, "macro.dbt_utils.test_equality": {"unique_id": "macro.dbt_utils.test_equality", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/equality.sql", "original_file_path": "macros/generic_tests/equality.sql", "name": "test_equality", "macro_sql": "{% test equality(model, compare_model, compare_columns=None) %}\n {{ return(adapter.dispatch('test_equality', 'dbt_utils')(model, compare_model, compare_columns)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_equality"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.427901}, "macro.dbt_utils.default__test_equality": {"unique_id": "macro.dbt_utils.default__test_equality", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/equality.sql", "original_file_path": "macros/generic_tests/equality.sql", "name": "default__test_equality", "macro_sql": "{% macro default__test_equality(model, compare_model, compare_columns=None) %}\n\n{% set set_diff %}\n count(*) + coalesce(abs(\n sum(case when which_diff = 'a_minus_b' then 1 else 0 end) -\n sum(case when which_diff = 'b_minus_a' then 1 else 0 end)\n ), 0)\n{% endset %}\n\n{#-- Needs to be set at parse time, before we return '' below --#}\n{{ config(fail_calc = set_diff) }}\n\n{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n{%- if not execute -%}\n {{ return('') }}\n{% endif %}\n\n-- setup\n{%- do dbt_utils._is_relation(model, 'test_equality') -%}\n\n{#-\nIf the compare_cols arg is provided, we can run this test without querying the\ninformation schema\u00a0\u2014 this allows the model to be an ephemeral model\n-#}\n\n{%- if not compare_columns -%}\n {%- do dbt_utils._is_ephemeral(model, 'test_equality') -%}\n {%- set compare_columns = adapter.get_columns_in_relation(model) | map(attribute='quoted') -%}\n{%- endif -%}\n\n{% set compare_cols_csv = compare_columns | join(', ') %}\n\nwith a as (\n\n select * from {{ model }}\n\n),\n\nb as (\n\n select * from {{ compare_model }}\n\n),\n\na_minus_b as (\n\n select {{compare_cols_csv}} from a\n {{ dbt_utils.except() }}\n select {{compare_cols_csv}} from b\n\n),\n\nb_minus_a as (\n\n select {{compare_cols_csv}} from b\n {{ dbt_utils.except() }}\n select {{compare_cols_csv}} from a\n\n),\n\nunioned as (\n\n select 'a_minus_b' as which_diff, a_minus_b.* from a_minus_b\n union all\n select 'b_minus_a' as which_diff, b_minus_a.* from b_minus_a\n\n)\n\nselect * from unioned\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.except"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.430897}, "macro.dbt_utils.test_mutually_exclusive_ranges": {"unique_id": "macro.dbt_utils.test_mutually_exclusive_ranges", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/mutually_exclusive_ranges.sql", "original_file_path": "macros/generic_tests/mutually_exclusive_ranges.sql", "name": "test_mutually_exclusive_ranges", "macro_sql": "{% test mutually_exclusive_ranges(model, lower_bound_column, upper_bound_column, partition_by=None, gaps='allowed', zero_length_range_allowed=False) %}\n {{ return(adapter.dispatch('test_mutually_exclusive_ranges', 'dbt_utils')(model, lower_bound_column, upper_bound_column, partition_by, gaps, zero_length_range_allowed)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_mutually_exclusive_ranges"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.437928}, "macro.dbt_utils.default__test_mutually_exclusive_ranges": {"unique_id": "macro.dbt_utils.default__test_mutually_exclusive_ranges", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/mutually_exclusive_ranges.sql", "original_file_path": "macros/generic_tests/mutually_exclusive_ranges.sql", "name": "default__test_mutually_exclusive_ranges", "macro_sql": "{% macro default__test_mutually_exclusive_ranges(model, lower_bound_column, upper_bound_column, partition_by=None, gaps='allowed', zero_length_range_allowed=False) %}\n{% if gaps == 'not_allowed' %}\n {% set allow_gaps_operator='=' %}\n {% set allow_gaps_operator_in_words='equal_to' %}\n{% elif gaps == 'allowed' %}\n {% set allow_gaps_operator='<=' %}\n {% set allow_gaps_operator_in_words='less_than_or_equal_to' %}\n{% elif gaps == 'required' %}\n {% set allow_gaps_operator='<' %}\n {% set allow_gaps_operator_in_words='less_than' %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`gaps` argument for mutually_exclusive_ranges test must be one of ['not_allowed', 'allowed', 'required'] Got: '\" ~ gaps ~\"'.'\"\n ) }}\n{% endif %}\n{% if not zero_length_range_allowed %}\n {% set allow_zero_length_operator='<' %}\n {% set allow_zero_length_operator_in_words='less_than' %}\n{% elif zero_length_range_allowed %}\n {% set allow_zero_length_operator='<=' %}\n {% set allow_zero_length_operator_in_words='less_than_or_equal_to' %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`zero_length_range_allowed` argument for mutually_exclusive_ranges test must be one of [true, false] Got: '\" ~ zero_length_range_allowed ~\"'.'\"\n ) }}\n{% endif %}\n\n{% set partition_clause=\"partition by \" ~ partition_by if partition_by else '' %}\n\nwith window_functions as (\n\n select\n {% if partition_by %}\n {{ partition_by }} as partition_by_col,\n {% endif %}\n {{ lower_bound_column }} as lower_bound,\n {{ upper_bound_column }} as upper_bound,\n\n lead({{ lower_bound_column }}) over (\n {{ partition_clause }}\n order by {{ lower_bound_column }}\n ) as next_lower_bound,\n\n row_number() over (\n {{ partition_clause }}\n order by {{ lower_bound_column }} desc\n ) = 1 as is_last_record\n\n from {{ model }}\n\n),\n\ncalc as (\n -- We want to return records where one of our assumptions fails, so we'll use\n -- the `not` function with `and` statements so we can write our assumptions nore cleanly\n select\n *,\n\n -- For each record: lower_bound should be < upper_bound.\n -- Coalesce it to return an error on the null case (implicit assumption\n -- these columns are not_null)\n coalesce(\n lower_bound {{ allow_zero_length_operator }} upper_bound,\n false\n ) as lower_bound_{{ allow_zero_length_operator_in_words }}_upper_bound,\n\n -- For each record: upper_bound {{ allow_gaps_operator }} the next lower_bound.\n -- Coalesce it to handle null cases for the last record.\n coalesce(\n upper_bound {{ allow_gaps_operator }} next_lower_bound,\n is_last_record,\n false\n ) as upper_bound_{{ allow_gaps_operator_in_words }}_next_lower_bound\n\n from window_functions\n\n),\n\nvalidation_errors as (\n\n select\n *\n from calc\n\n where not(\n -- THE FOLLOWING SHOULD BE TRUE --\n lower_bound_{{ allow_zero_length_operator_in_words }}_upper_bound\n and upper_bound_{{ allow_gaps_operator_in_words }}_next_lower_bound\n )\n)\n\nselect * from validation_errors\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.4421492}, "macro.dbt_utils.pretty_log_format": {"unique_id": "macro.dbt_utils.pretty_log_format", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_log_format.sql", "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", "name": "pretty_log_format", "macro_sql": "{% macro pretty_log_format(message) %}\n {{ return(adapter.dispatch('pretty_log_format', 'dbt_utils')(message)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__pretty_log_format"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.44335}, "macro.dbt_utils.default__pretty_log_format": {"unique_id": "macro.dbt_utils.default__pretty_log_format", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_log_format.sql", "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", "name": "default__pretty_log_format", "macro_sql": "{% macro default__pretty_log_format(message) %}\n {{ return( dbt_utils.pretty_time() ~ ' + ' ~ message) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.pretty_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.4440541}, "macro.dbt_utils.pretty_time": {"unique_id": "macro.dbt_utils.pretty_time", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_time.sql", "original_file_path": "macros/jinja_helpers/pretty_time.sql", "name": "pretty_time", "macro_sql": "{% macro pretty_time(format='%H:%M:%S') %}\n {{ return(adapter.dispatch('pretty_time', 'dbt_utils')(format)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__pretty_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.44515}, "macro.dbt_utils.default__pretty_time": {"unique_id": "macro.dbt_utils.default__pretty_time", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_time.sql", "original_file_path": "macros/jinja_helpers/pretty_time.sql", "name": "default__pretty_time", "macro_sql": "{% macro default__pretty_time(format='%H:%M:%S') %}\n {{ return(modules.datetime.datetime.now().strftime(format)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.4456909}, "macro.dbt_utils.log_info": {"unique_id": "macro.dbt_utils.log_info", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/log_info.sql", "original_file_path": "macros/jinja_helpers/log_info.sql", "name": "log_info", "macro_sql": "{% macro log_info(message) %}\n {{ return(adapter.dispatch('log_info', 'dbt_utils')(message)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__log_info"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.4465559}, "macro.dbt_utils.default__log_info": {"unique_id": "macro.dbt_utils.default__log_info", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/log_info.sql", "original_file_path": "macros/jinja_helpers/log_info.sql", "name": "default__log_info", "macro_sql": "{% macro default__log_info(message) %}\n {{ log(dbt_utils.pretty_log_format(message), info=True) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.pretty_log_format"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.447131}, "macro.dbt_utils.slugify": {"unique_id": "macro.dbt_utils.slugify", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/slugify.sql", "original_file_path": "macros/jinja_helpers/slugify.sql", "name": "slugify", "macro_sql": "{% macro slugify(string) %}\n\n{#- Lower case the string -#}\n{% set string = string | lower %}\n{#- Replace spaces and dashes with underscores -#}\n{% set string = modules.re.sub('[ -]+', '_', string) %}\n{#- Only take letters, numbers, and underscores -#}\n{% set string = modules.re.sub('[^a-z0-9_]+', '', string) %}\n\n{{ return(string) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.448692}, "macro.dbt_utils.get_intervals_between": {"unique_id": "macro.dbt_utils.get_intervals_between", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "get_intervals_between", "macro_sql": "{% macro get_intervals_between(start_date, end_date, datepart) -%}\n {{ return(adapter.dispatch('get_intervals_between', 'dbt_utils')(start_date, end_date, datepart)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_intervals_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.450985}, "macro.dbt_utils.default__get_intervals_between": {"unique_id": "macro.dbt_utils.default__get_intervals_between", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "default__get_intervals_between", "macro_sql": "{% macro default__get_intervals_between(start_date, end_date, datepart) -%}\n {%- call statement('get_intervals_between', fetch_result=True) %}\n\n select {{dbt_utils.datediff(start_date, end_date, datepart)}}\n\n {%- endcall -%}\n\n {%- set value_list = load_result('get_intervals_between') -%}\n\n {%- if value_list and value_list['data'] -%}\n {%- set values = value_list['data'] | map(attribute=0) | list %}\n {{ return(values[0]) }}\n {%- else -%}\n {{ return(1) }}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.452853}, "macro.dbt_utils.date_spine": {"unique_id": "macro.dbt_utils.date_spine", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "date_spine", "macro_sql": "{% macro date_spine(datepart, start_date, end_date) %}\n {{ return(adapter.dispatch('date_spine', 'dbt_utils')(datepart, start_date, end_date)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__date_spine"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.454018}, "macro.dbt_utils.default__date_spine": {"unique_id": "macro.dbt_utils.default__date_spine", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "default__date_spine", "macro_sql": "{% macro default__date_spine(datepart, start_date, end_date) %}\n\n\n{# call as follows:\n\ndate_spine(\n \"day\",\n \"to_date('01/01/2016', 'mm/dd/yyyy')\",\n \"dateadd(week, 1, current_date)\"\n) #}\n\n\nwith rawdata as (\n\n {{dbt_utils.generate_series(\n dbt_utils.get_intervals_between(start_date, end_date, datepart)\n )}}\n\n),\n\nall_periods as (\n\n select (\n {{\n dbt_utils.dateadd(\n datepart,\n \"row_number() over (order by 1) - 1\",\n start_date\n )\n }}\n ) as date_{{datepart}}\n from rawdata\n\n),\n\nfiltered as (\n\n select *\n from all_periods\n where date_{{datepart}} <= {{ end_date }}\n\n)\n\nselect * from filtered\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.generate_series", "macro.dbt_utils.get_intervals_between", "macro.dbt_utils.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.455335}, "macro.dbt_utils.nullcheck_table": {"unique_id": "macro.dbt_utils.nullcheck_table", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "name": "nullcheck_table", "macro_sql": "{% macro nullcheck_table(relation) %}\n {{ return(adapter.dispatch('nullcheck_table', 'dbt_utils')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__nullcheck_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.456583}, "macro.dbt_utils.default__nullcheck_table": {"unique_id": "macro.dbt_utils.default__nullcheck_table", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "name": "default__nullcheck_table", "macro_sql": "{% macro default__nullcheck_table(relation) %}\n\n {%- do dbt_utils._is_relation(relation, 'nullcheck_table') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'nullcheck_table') -%}\n {% set cols = adapter.get_columns_in_relation(relation) %}\n\n select {{ dbt_utils.nullcheck(cols) }}\n from {{relation}}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.nullcheck"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.4580429}, "macro.dbt_utils.get_relations_by_pattern": {"unique_id": "macro.dbt_utils.get_relations_by_pattern", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "name": "get_relations_by_pattern", "macro_sql": "{% macro get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_relations_by_pattern', 'dbt_utils')(schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.459852}, "macro.dbt_utils.default__get_relations_by_pattern": {"unique_id": "macro.dbt_utils.default__get_relations_by_pattern", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "name": "default__get_relations_by_pattern", "macro_sql": "{% macro default__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n {{ dbt_utils.get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude, database) }}\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=database,\n schema=row.table_schema,\n identifier=row.table_name,\n type=row.table_type\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.462634}, "macro.dbt_utils.get_powers_of_two": {"unique_id": "macro.dbt_utils.get_powers_of_two", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "get_powers_of_two", "macro_sql": "{% macro get_powers_of_two(upper_bound) %}\n {{ return(adapter.dispatch('get_powers_of_two', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.464576}, "macro.dbt_utils.default__get_powers_of_two": {"unique_id": "macro.dbt_utils.default__get_powers_of_two", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "default__get_powers_of_two", "macro_sql": "{% macro default__get_powers_of_two(upper_bound) %}\n\n {% if upper_bound <= 0 %}\n {{ exceptions.raise_compiler_error(\"upper bound must be positive\") }}\n {% endif %}\n\n {% for _ in range(1, 100) %}\n {% if upper_bound <= 2 ** loop.index %}{{ return(loop.index) }}{% endif %}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.465824}, "macro.dbt_utils.generate_series": {"unique_id": "macro.dbt_utils.generate_series", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "generate_series", "macro_sql": "{% macro generate_series(upper_bound) %}\n {{ return(adapter.dispatch('generate_series', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__generate_series"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.466347}, "macro.dbt_utils.default__generate_series": {"unique_id": "macro.dbt_utils.default__generate_series", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "default__generate_series", "macro_sql": "{% macro default__generate_series(upper_bound) %}\n\n {% set n = dbt_utils.get_powers_of_two(upper_bound) %}\n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n {% for i in range(n) %}\n p{{i}}.generated_number * power(2, {{i}})\n {% if not loop.last %} + {% endif %}\n {% endfor %}\n + 1\n as generated_number\n\n from\n\n {% for i in range(n) %}\n p as p{{i}}\n {% if not loop.last %} cross join {% endif %}\n {% endfor %}\n\n )\n\n select *\n from unioned\n where generated_number <= {{upper_bound}}\n order by generated_number\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.4677482}, "macro.dbt_utils.get_relations_by_prefix": {"unique_id": "macro.dbt_utils.get_relations_by_prefix", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "name": "get_relations_by_prefix", "macro_sql": "{% macro get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_relations_by_prefix', 'dbt_utils')(schema, prefix, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_relations_by_prefix"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.469434}, "macro.dbt_utils.default__get_relations_by_prefix": {"unique_id": "macro.dbt_utils.default__get_relations_by_prefix", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "name": "default__get_relations_by_prefix", "macro_sql": "{% macro default__get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n {{ dbt_utils.get_tables_by_prefix_sql(schema, prefix, exclude, database) }}\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=database,\n schema=row.table_schema,\n identifier=row.table_name,\n type=row.table_type\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.get_tables_by_prefix_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.471682}, "macro.dbt_utils.get_tables_by_prefix_sql": {"unique_id": "macro.dbt_utils.get_tables_by_prefix_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "name": "get_tables_by_prefix_sql", "macro_sql": "{% macro get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_tables_by_prefix_sql', 'dbt_utils')(schema, prefix, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_tables_by_prefix_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.472878}, "macro.dbt_utils.default__get_tables_by_prefix_sql": {"unique_id": "macro.dbt_utils.default__get_tables_by_prefix_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "name": "default__get_tables_by_prefix_sql", "macro_sql": "{% macro default__get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n\n {{ dbt_utils.get_tables_by_pattern_sql(\n schema_pattern = schema,\n table_pattern = prefix ~ '%',\n exclude = exclude,\n database = database\n ) }}\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.4736278}, "macro.dbt_utils.star": {"unique_id": "macro.dbt_utils.star", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "name": "star", "macro_sql": "{% macro star(from, relation_alias=False, except=[], prefix='', suffix='') -%}\n {{ return(adapter.dispatch('star', 'dbt_utils')(from, relation_alias, except, prefix, suffix)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__star"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.475368}, "macro.dbt_utils.default__star": {"unique_id": "macro.dbt_utils.default__star", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "name": "default__star", "macro_sql": "{% macro default__star(from, relation_alias=False, except=[], prefix='', suffix='') -%}\n {%- do dbt_utils._is_relation(from, 'star') -%}\n {%- do dbt_utils._is_ephemeral(from, 'star') -%}\n\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {{ return('*') }}\n {% endif %}\n\n {% set cols = dbt_utils.get_filtered_columns_in_relation(from, except) %}\n\n {%- if cols|length <= 0 -%}\n {{- return('*') -}}\n {%- else -%}\n {%- for col in cols %}\n {%- if relation_alias %}{{ relation_alias }}.{% else %}{%- endif -%}{{ adapter.quote(col)|trim }} {%- if prefix!='' or suffix!='' %} as {{ adapter.quote(prefix ~ col ~ suffix)|trim }} {%- endif -%}\n {%- if not loop.last %},{{ '\\n ' }}{% endif %}\n {%- endfor -%}\n {% endif %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.get_filtered_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.477987}, "macro.dbt_utils.unpivot": {"unique_id": "macro.dbt_utils.unpivot", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "name": "unpivot", "macro_sql": "{% macro unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value', table=none) -%}\n {{ return(adapter.dispatch('unpivot', 'dbt_utils')(relation, cast_to, exclude, remove, field_name, value_name, table)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__unpivot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.481627}, "macro.dbt_utils.default__unpivot": {"unique_id": "macro.dbt_utils.default__unpivot", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "name": "default__unpivot", "macro_sql": "{% macro default__unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value', table=none) -%}\n\n {% if table %}\n {%- set error_message = '\n Warning: the `unpivot` macro no longer accepts a `table` parameter. \\\n This parameter will be deprecated in a future release of dbt-utils. Use the `relation` parameter instead. \\\n The {}.{} model triggered this warning. \\\n '.format(model.package_name, model.name) -%}\n {%- do exceptions.warn(error_message) -%}\n {% endif %}\n\n {% if relation and table %}\n {{ exceptions.raise_compiler_error(\"Error: both the `relation` and `table` parameters were provided to `unpivot` macro. Choose one only (we recommend `relation`).\") }}\n {% elif not relation and table %}\n {% set relation=table %}\n {% elif not relation and not table %}\n {{ exceptions.raise_compiler_error(\"Error: argument `relation` is required for `unpivot` macro.\") }}\n {% endif %}\n\n {%- set exclude = exclude if exclude is not none else [] %}\n {%- set remove = remove if remove is not none else [] %}\n\n {%- set include_cols = [] %}\n\n {%- set table_columns = {} %}\n\n {%- do table_columns.update({relation: []}) %}\n\n {%- do dbt_utils._is_relation(relation, 'unpivot') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'unpivot') -%}\n {%- set cols = adapter.get_columns_in_relation(relation) %}\n\n {%- for col in cols -%}\n {%- if col.column.lower() not in remove|map('lower') and col.column.lower() not in exclude|map('lower') -%}\n {% do include_cols.append(col) %}\n {%- endif %}\n {%- endfor %}\n\n\n {%- for col in include_cols -%}\n select\n {%- for exclude_col in exclude %}\n {{ exclude_col }},\n {%- endfor %}\n\n cast('{{ col.column }}' as {{ dbt_utils.type_string() }}) as {{ field_name }},\n cast( {% if col.data_type == 'boolean' %}\n {{ dbt_utils.cast_bool_to_text(col.column) }}\n {% else %}\n {{ col.column }}\n {% endif %}\n as {{ cast_to }}) as {{ value_name }}\n\n from {{ relation }}\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n {%- endfor -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.type_string", "macro.dbt_utils.cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.487097}, "macro.dbt_utils.union_relations": {"unique_id": "macro.dbt_utils.union_relations", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "name": "union_relations", "macro_sql": "{%- macro union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation', where=none) -%}\n {{ return(adapter.dispatch('union_relations', 'dbt_utils')(relations, column_override, include, exclude, source_column_name, where)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__union_relations"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.493441}, "macro.dbt_utils.default__union_relations": {"unique_id": "macro.dbt_utils.default__union_relations", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "name": "default__union_relations", "macro_sql": "\n\n{%- macro default__union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation', where=none) -%}\n\n {%- if exclude and include -%}\n {{ exceptions.raise_compiler_error(\"Both an exclude and include list were provided to the `union` macro. Only one is allowed\") }}\n {%- endif -%}\n\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. -#}\n {%- if not execute %}\n {{ return('') }}\n {% endif -%}\n\n {%- set column_override = column_override if column_override is not none else {} -%}\n\n {%- set relation_columns = {} -%}\n {%- set column_superset = {} -%}\n\n {%- for relation in relations -%}\n\n {%- do relation_columns.update({relation: []}) -%}\n\n {%- do dbt_utils._is_relation(relation, 'union_relations') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'union_relations') -%}\n {%- set cols = adapter.get_columns_in_relation(relation) -%}\n {%- for col in cols -%}\n\n {#- If an exclude list was provided and the column is in the list, do nothing -#}\n {%- if exclude and col.column in exclude -%}\n\n {#- If an include list was provided and the column is not in the list, do nothing -#}\n {%- elif include and col.column not in include -%}\n\n {#- Otherwise add the column to the column superset -#}\n {%- else -%}\n\n {#- update the list of columns in this relation -#}\n {%- do relation_columns[relation].append(col.column) -%}\n\n {%- if col.column in column_superset -%}\n\n {%- set stored = column_superset[col.column] -%}\n {%- if col.is_string() and stored.is_string() and col.string_size() > stored.string_size() -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif %}\n\n {%- else -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif -%}\n\n {%- endif -%}\n\n {%- endfor -%}\n {%- endfor -%}\n\n {%- set ordered_column_names = column_superset.keys() -%}\n {%- set dbt_command = flags.WHICH -%}\n\n\n {% if dbt_command in ['run', 'build'] %}\n {% if (include | length > 0 or exclude | length > 0) and not column_superset.keys() %}\n {%- set relations_string -%}\n {%- for relation in relations -%}\n {{ relation.name }}\n {%- if not loop.last %}, {% endif -%}\n {%- endfor -%}\n {%- endset -%}\n\n {%- set error_message -%}\n There were no columns found to union for relations {{ relations_string }}\n {%- endset -%}\n\n {{ exceptions.raise_compiler_error(error_message) }}\n {%- endif -%}\n {%- endif -%}\n\n {%- for relation in relations %}\n\n (\n select\n\n cast({{ dbt_utils.string_literal(relation) }} as {{ dbt_utils.type_string() }}) as {{ source_column_name }},\n {% for col_name in ordered_column_names -%}\n\n {%- set col = column_superset[col_name] %}\n {%- set col_type = column_override.get(col.column, col.data_type) %}\n {%- set col_name = adapter.quote(col_name) if col_name in relation_columns[relation] else 'null' %}\n cast({{ col_name }} as {{ col_type }}) as {{ col.quoted }} {% if not loop.last %},{% endif -%}\n\n {%- endfor %}\n\n from {{ relation }}\n\n {% if where -%}\n where {{ where }}\n {%- endif %}\n )\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n\n {%- endfor -%}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.string_literal", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.503598}, "macro.dbt_utils.group_by": {"unique_id": "macro.dbt_utils.group_by", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "name": "group_by", "macro_sql": "{%- macro group_by(n) -%}\n {{ return(adapter.dispatch('group_by', 'dbt_utils')(n)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__group_by"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.504651}, "macro.dbt_utils.default__group_by": {"unique_id": "macro.dbt_utils.default__group_by", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "name": "default__group_by", "macro_sql": "\n\n{%- macro default__group_by(n) -%}\n\n group by {% for i in range(1, n + 1) -%}\n {{ i }}{{ ',' if not loop.last }} \n {%- endfor -%}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.5053282}, "macro.dbt_utils.deduplicate": {"unique_id": "macro.dbt_utils.deduplicate", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "name": "deduplicate", "macro_sql": "{%- macro deduplicate(relation, partition_by, order_by=none, relation_alias=none) -%}\n\n {%- set error_message_group_by -%}\nWarning: the `group_by` parameter of the `deduplicate` macro is no longer supported and will be deprecated in a future release of dbt-utils.\nUse `partition_by` instead.\nThe {{ model.package_name }}.{{ model.name }} model triggered this warning.\n {%- endset -%}\n\n {% if kwargs.get('group_by') %}\n {%- do exceptions.warn(error_message_group_by) -%}\n {%- endif -%}\n\n {%- set error_message_order_by -%}\nWarning: `order_by` as an optional parameter of the `deduplicate` macro is no longer supported and will be deprecated in a future release of dbt-utils.\nSupply a non-null value for `order_by` instead.\nThe {{ model.package_name }}.{{ model.name }} model triggered this warning.\n {%- endset -%}\n\n {% if not order_by %}\n {%- do exceptions.warn(error_message_order_by) -%}\n {%- endif -%}\n\n {%- set error_message_alias -%}\nWarning: the `relation_alias` parameter of the `deduplicate` macro is no longer supported and will be deprecated in a future release of dbt-utils.\nIf you were using `relation_alias` to point to a CTE previously then you can now pass the alias directly to `relation` instead.\nThe {{ model.package_name }}.{{ model.name }} model triggered this warning.\n {%- endset -%}\n\n {% if relation_alias %}\n {%- do exceptions.warn(error_message_alias) -%}\n {%- endif -%}\n\n {% set partition_by = partition_by or kwargs.get('group_by') %}\n {% set relation = relation_alias or relation %}\n {% set order_by = order_by or \"'1'\" %}\n\n {{ return(adapter.dispatch('deduplicate', 'dbt_utils')(relation, partition_by, order_by)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__deduplicate"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.5111392}, "macro.dbt_utils.default__deduplicate": {"unique_id": "macro.dbt_utils.default__deduplicate", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "name": "default__deduplicate", "macro_sql": "\n\n{%- macro default__deduplicate(relation, partition_by, order_by) -%}\n\n with row_numbered as (\n select\n _inner.*,\n row_number() over (\n partition by {{ partition_by }}\n order by {{ order_by }}\n ) as rn\n from {{ relation }} as _inner\n )\n\n select\n distinct data.*\n from {{ relation }} as data\n {#\n -- Not all DBs will support natural joins but the ones that do include:\n -- Oracle, MySQL, SQLite, Redshift, Teradata, Materialize, Databricks\n -- Apache Spark, SingleStore, Vertica\n -- Those that do not appear to support natural joins include:\n -- SQLServer, Trino, Presto, Rockset, Athena\n #}\n natural join row_numbered\n where row_numbered.rn = 1\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.511758}, "macro.dbt_utils.redshift__deduplicate": {"unique_id": "macro.dbt_utils.redshift__deduplicate", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "name": "redshift__deduplicate", "macro_sql": "{% macro redshift__deduplicate(relation, partition_by, order_by) -%}\n\n {{ return(dbt_utils.default__deduplicate(relation, partition_by, order_by=order_by)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__deduplicate"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.512318}, "macro.dbt_utils.postgres__deduplicate": {"unique_id": "macro.dbt_utils.postgres__deduplicate", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "name": "postgres__deduplicate", "macro_sql": "\n{%- macro postgres__deduplicate(relation, partition_by, order_by) -%}\n\n select\n distinct on ({{ partition_by }}) *\n from {{ relation }}\n order by {{ partition_by }}{{ ',' ~ order_by }}\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.51289}, "macro.dbt_utils.snowflake__deduplicate": {"unique_id": "macro.dbt_utils.snowflake__deduplicate", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "name": "snowflake__deduplicate", "macro_sql": "\n{%- macro snowflake__deduplicate(relation, partition_by, order_by) -%}\n\n select *\n from {{ relation }}\n qualify\n row_number() over (\n partition by {{ partition_by }}\n order by {{ order_by }}\n ) = 1\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.5135748}, "macro.dbt_utils.bigquery__deduplicate": {"unique_id": "macro.dbt_utils.bigquery__deduplicate", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "name": "bigquery__deduplicate", "macro_sql": "\n{%- macro bigquery__deduplicate(relation, partition_by, order_by) -%}\n\n select unique.*\n from (\n select\n array_agg (\n original\n order by {{ order_by }}\n limit 1\n )[offset(0)] unique\n from {{ relation }} original\n group by {{ partition_by }}\n )\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.514087}, "macro.dbt_utils.surrogate_key": {"unique_id": "macro.dbt_utils.surrogate_key", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "name": "surrogate_key", "macro_sql": "{%- macro surrogate_key(field_list) -%}\n {# needed for safe_add to allow for non-keyword arguments see SO post #}\n {# https://stackoverflow.com/questions/13944751/args-kwargs-in-jinja2-macros #}\n {% set frustrating_jinja_feature = varargs %}\n {{ return(adapter.dispatch('surrogate_key', 'dbt_utils')(field_list, *varargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__surrogate_key"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.515969}, "macro.dbt_utils.default__surrogate_key": {"unique_id": "macro.dbt_utils.default__surrogate_key", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "name": "default__surrogate_key", "macro_sql": "\n\n{%- macro default__surrogate_key(field_list) -%}\n\n{%- if varargs|length >= 1 or field_list is string %}\n\n{%- set error_message = '\nWarning: the `surrogate_key` macro now takes a single list argument instead of \\\nmultiple string arguments. Support for multiple string arguments will be \\\ndeprecated in a future release of dbt-utils. The {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.warn(error_message) -%}\n\n{# first argument is not included in varargs, so add first element to field_list_xf #}\n{%- set field_list_xf = [field_list] -%}\n\n{%- for field in varargs %}\n{%- set _ = field_list_xf.append(field) -%}\n{%- endfor -%}\n\n{%- else -%}\n\n{# if using list, just set field_list_xf as field_list #}\n{%- set field_list_xf = field_list -%}\n\n{%- endif -%}\n\n\n{%- set fields = [] -%}\n\n{%- for field in field_list_xf -%}\n\n {%- set _ = fields.append(\n \"coalesce(cast(\" ~ field ~ \" as \" ~ dbt_utils.type_string() ~ \"), '')\"\n ) -%}\n\n {%- if not loop.last %}\n {%- set _ = fields.append(\"'-'\") -%}\n {%- endif -%}\n\n{%- endfor -%}\n\n{{dbt_utils.hash(dbt_utils.concat(fields))}}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string", "macro.dbt_utils.hash", "macro.dbt_utils.concat"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.518479}, "macro.dbt_utils.safe_add": {"unique_id": "macro.dbt_utils.safe_add", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "name": "safe_add", "macro_sql": "{%- macro safe_add() -%}\n {# needed for safe_add to allow for non-keyword arguments see SO post #}\n {# https://stackoverflow.com/questions/13944751/args-kwargs-in-jinja2-macros #}\n {% set frustrating_jinja_feature = varargs %}\n {{ return(adapter.dispatch('safe_add', 'dbt_utils')(*varargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__safe_add"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.519664}, "macro.dbt_utils.default__safe_add": {"unique_id": "macro.dbt_utils.default__safe_add", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "name": "default__safe_add", "macro_sql": "\n\n{%- macro default__safe_add() -%}\n\n{% set fields = [] %}\n\n{%- for field in varargs -%}\n\n {% do fields.append(\"coalesce(\" ~ field ~ \", 0)\") %}\n\n{%- endfor -%}\n\n{{ fields|join(' +\\n ') }}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.520515}, "macro.dbt_utils.nullcheck": {"unique_id": "macro.dbt_utils.nullcheck", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "name": "nullcheck", "macro_sql": "{% macro nullcheck(cols) %}\n {{ return(adapter.dispatch('nullcheck', 'dbt_utils')(cols)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__nullcheck"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.521593}, "macro.dbt_utils.default__nullcheck": {"unique_id": "macro.dbt_utils.default__nullcheck", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "name": "default__nullcheck", "macro_sql": "{% macro default__nullcheck(cols) %}\n{%- for col in cols %}\n\n {% if col.is_string() -%}\n\n nullif({{col.name}},'') as {{col.name}}\n\n {%- else -%}\n\n {{col.name}}\n\n {%- endif -%}\n\n{%- if not loop.last -%} , {%- endif -%}\n\n{%- endfor -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.5229409}, "macro.dbt_utils.get_tables_by_pattern_sql": {"unique_id": "macro.dbt_utils.get_tables_by_pattern_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "get_tables_by_pattern_sql", "macro_sql": "{% macro get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_tables_by_pattern_sql', 'dbt_utils')\n (schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.526874}, "macro.dbt_utils.default__get_tables_by_pattern_sql": {"unique_id": "macro.dbt_utils.default__get_tables_by_pattern_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "default__get_tables_by_pattern_sql", "macro_sql": "{% macro default__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n select distinct\n table_schema as \"table_schema\",\n table_name as \"table_name\",\n {{ dbt_utils.get_table_types_sql() }}\n from {{ database }}.information_schema.tables\n where table_schema ilike '{{ schema_pattern }}'\n and table_name ilike '{{ table_pattern }}'\n and table_name not ilike '{{ exclude }}'\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.527719}, "macro.dbt_utils.bigquery__get_tables_by_pattern_sql": {"unique_id": "macro.dbt_utils.bigquery__get_tables_by_pattern_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "bigquery__get_tables_by_pattern_sql", "macro_sql": "{% macro bigquery__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {% if '%' in schema_pattern %}\n {% set schemata=dbt_utils._bigquery__get_matching_schemata(schema_pattern, database) %}\n {% else %}\n {% set schemata=[schema_pattern] %}\n {% endif %}\n\n {% set sql %}\n {% for schema in schemata %}\n select distinct\n table_schema,\n table_name,\n {{ dbt_utils.get_table_types_sql() }}\n\n from {{ adapter.quote(database) }}.{{ schema }}.INFORMATION_SCHEMA.TABLES\n where lower(table_name) like lower ('{{ table_pattern }}')\n and lower(table_name) not like lower ('{{ exclude }}')\n\n {% if not loop.last %} union all {% endif %}\n\n {% endfor %}\n {% endset %}\n\n {{ return(sql) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._bigquery__get_matching_schemata", "macro.dbt_utils.get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.52998}, "macro.dbt_utils._bigquery__get_matching_schemata": {"unique_id": "macro.dbt_utils._bigquery__get_matching_schemata", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "_bigquery__get_matching_schemata", "macro_sql": "{% macro _bigquery__get_matching_schemata(schema_pattern, database) %}\n {% if execute %}\n\n {% set sql %}\n select schema_name from {{ adapter.quote(database) }}.INFORMATION_SCHEMA.SCHEMATA\n where lower(schema_name) like lower('{{ schema_pattern }}')\n {% endset %}\n\n {% set results=run_query(sql) %}\n\n {% set schemata=results.columns['schema_name'].values() %}\n\n {{ return(schemata) }}\n\n {% else %}\n\n {{ return([]) }}\n\n {% endif %}\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.5314949}, "macro.dbt_utils.get_column_values": {"unique_id": "macro.dbt_utils.get_column_values", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "name": "get_column_values", "macro_sql": "{% macro get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none, where=none) -%}\n {{ return(adapter.dispatch('get_column_values', 'dbt_utils')(table, column, order_by, max_records, default, where)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_column_values"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.5340958}, "macro.dbt_utils.default__get_column_values": {"unique_id": "macro.dbt_utils.default__get_column_values", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "name": "default__get_column_values", "macro_sql": "{% macro default__get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none, where=none) -%}\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {% set default = [] if not default %}\n {{ return(default) }}\n {% endif %}\n\n {%- do dbt_utils._is_ephemeral(table, 'get_column_values') -%}\n\n {# Not all relations are tables. Renaming for internal clarity without breaking functionality for anyone using named arguments #}\n {# TODO: Change the method signature in a future 0.x.0 release #}\n {%- set target_relation = table -%}\n\n {# adapter.load_relation is a convenience wrapper to avoid building a Relation when we already have one #}\n {% set relation_exists = (load_relation(target_relation)) is not none %}\n\n {%- call statement('get_column_values', fetch_result=true) %}\n\n {%- if not relation_exists and default is none -%}\n\n {{ exceptions.raise_compiler_error(\"In get_column_values(): relation \" ~ target_relation ~ \" does not exist and no default value was provided.\") }}\n\n {%- elif not relation_exists and default is not none -%}\n\n {{ log(\"Relation \" ~ target_relation ~ \" does not exist. Returning the default value: \" ~ default) }}\n\n {{ return(default) }}\n\n {%- else -%}\n\n\n select\n {{ column }} as value\n\n from {{ target_relation }}\n\n {% if where is not none %}\n where {{ where }}\n {% endif %}\n\n group by {{ column }}\n order by {{ order_by }}\n\n {% if max_records is not none %}\n limit {{ max_records }}\n {% endif %}\n\n {% endif %}\n\n {%- endcall -%}\n\n {%- set value_list = load_result('get_column_values') -%}\n\n {%- if value_list and value_list['data'] -%}\n {%- set values = value_list['data'] | map(attribute=0) | list %}\n {{ return(values) }}\n {%- else -%}\n {{ return(default) }}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_ephemeral", "macro.dbt.load_relation", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.53823}, "macro.dbt_utils.pivot": {"unique_id": "macro.dbt_utils.pivot", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "name": "pivot", "macro_sql": "{% macro pivot(column,\n values,\n alias=True,\n agg='sum',\n cmp='=',\n prefix='',\n suffix='',\n then_value=1,\n else_value=0,\n quote_identifiers=True,\n distinct=False) %}\n {{ return(adapter.dispatch('pivot', 'dbt_utils')(column, values, alias, agg, cmp, prefix, suffix, then_value, else_value, quote_identifiers, distinct)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__pivot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.5410361}, "macro.dbt_utils.default__pivot": {"unique_id": "macro.dbt_utils.default__pivot", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "name": "default__pivot", "macro_sql": "{% macro default__pivot(column,\n values,\n alias=True,\n agg='sum',\n cmp='=',\n prefix='',\n suffix='',\n then_value=1,\n else_value=0,\n quote_identifiers=True,\n distinct=False) %}\n {% for value in values %}\n {{ agg }}(\n {% if distinct %} distinct {% endif %}\n case\n when {{ column }} {{ cmp }} '{{ dbt_utils.escape_single_quotes(value) }}'\n then {{ then_value }}\n else {{ else_value }}\n end\n )\n {% if alias %}\n {% if quote_identifiers %}\n as {{ adapter.quote(prefix ~ value ~ suffix) }}\n {% else %}\n as {{ dbt_utils.slugify(prefix ~ value ~ suffix) }}\n {% endif %}\n {% endif %}\n {% if not loop.last %},{% endif %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.escape_single_quotes", "macro.dbt_utils.slugify"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.543369}, "macro.dbt_utils.get_filtered_columns_in_relation": {"unique_id": "macro.dbt_utils.get_filtered_columns_in_relation", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_filtered_columns_in_relation.sql", "original_file_path": "macros/sql/get_filtered_columns_in_relation.sql", "name": "get_filtered_columns_in_relation", "macro_sql": "{% macro get_filtered_columns_in_relation(from, except=[]) -%}\n {{ return(adapter.dispatch('get_filtered_columns_in_relation', 'dbt_utils')(from, except)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_filtered_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.544885}, "macro.dbt_utils.default__get_filtered_columns_in_relation": {"unique_id": "macro.dbt_utils.default__get_filtered_columns_in_relation", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_filtered_columns_in_relation.sql", "original_file_path": "macros/sql/get_filtered_columns_in_relation.sql", "name": "default__get_filtered_columns_in_relation", "macro_sql": "{% macro default__get_filtered_columns_in_relation(from, except=[]) -%}\n {%- do dbt_utils._is_relation(from, 'get_filtered_columns_in_relation') -%}\n {%- do dbt_utils._is_ephemeral(from, 'get_filtered_columns_in_relation') -%}\n\n {# -- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {{ return('') }}\n {% endif %}\n\n {%- set include_cols = [] %}\n {%- set cols = adapter.get_columns_in_relation(from) -%}\n {%- set except = except | map(\"lower\") | list %}\n {%- for col in cols -%}\n {%- if col.column|lower not in except -%}\n {% do include_cols.append(col.column) %}\n {%- endif %}\n {%- endfor %}\n\n {{ return(include_cols) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.5470011}, "macro.dbt_utils.get_query_results_as_dict": {"unique_id": "macro.dbt_utils.get_query_results_as_dict", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "name": "get_query_results_as_dict", "macro_sql": "{% macro get_query_results_as_dict(query) %}\n {{ return(adapter.dispatch('get_query_results_as_dict', 'dbt_utils')(query)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_query_results_as_dict"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.548364}, "macro.dbt_utils.default__get_query_results_as_dict": {"unique_id": "macro.dbt_utils.default__get_query_results_as_dict", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "name": "default__get_query_results_as_dict", "macro_sql": "{% macro default__get_query_results_as_dict(query) %}\n\n{# This macro returns a dictionary of the form {column_name: (tuple_of_results)} #}\n\n {%- call statement('get_query_results', fetch_result=True,auto_begin=false) -%}\n\n {{ query }}\n\n {%- endcall -%}\n\n {% set sql_results={} %}\n\n {%- if execute -%}\n {% set sql_results_table = load_result('get_query_results').table.columns %}\n {% for column_name, column in sql_results_table.items() %}\n {% do sql_results.update({column_name: column.values()}) %}\n {% endfor %}\n {%- endif -%}\n\n {{ return(sql_results) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.550088}, "macro.dbt_utils.get_table_types_sql": {"unique_id": "macro.dbt_utils.get_table_types_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "name": "get_table_types_sql", "macro_sql": "{%- macro get_table_types_sql() -%}\n {{ return(adapter.dispatch('get_table_types_sql', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.55138}, "macro.dbt_utils.default__get_table_types_sql": {"unique_id": "macro.dbt_utils.default__get_table_types_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "name": "default__get_table_types_sql", "macro_sql": "{% macro default__get_table_types_sql() %}\n case table_type\n when 'BASE TABLE' then 'table'\n when 'EXTERNAL TABLE' then 'external'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as \"table_type\"\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.551641}, "macro.dbt_utils.postgres__get_table_types_sql": {"unique_id": "macro.dbt_utils.postgres__get_table_types_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "name": "postgres__get_table_types_sql", "macro_sql": "{% macro postgres__get_table_types_sql() %}\n case table_type\n when 'BASE TABLE' then 'table'\n when 'FOREIGN' then 'external'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as \"table_type\"\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.551872}, "macro.dbt_utils.bigquery__get_table_types_sql": {"unique_id": "macro.dbt_utils.bigquery__get_table_types_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "name": "bigquery__get_table_types_sql", "macro_sql": "{% macro bigquery__get_table_types_sql() %}\n case table_type\n when 'BASE TABLE' then 'table'\n when 'EXTERNAL TABLE' then 'external'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as `table_type`\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.552096}, "macro.dbt_utils.degrees_to_radians": {"unique_id": "macro.dbt_utils.degrees_to_radians", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "degrees_to_radians", "macro_sql": "{% macro degrees_to_radians(degrees) -%}\n acos(-1) * {{degrees}} / 180\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.55547}, "macro.dbt_utils.haversine_distance": {"unique_id": "macro.dbt_utils.haversine_distance", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "haversine_distance", "macro_sql": "{% macro haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n {{ return(adapter.dispatch('haversine_distance', 'dbt_utils')(lat1,lon1,lat2,lon2,unit)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__haversine_distance"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.5562801}, "macro.dbt_utils.default__haversine_distance": {"unique_id": "macro.dbt_utils.default__haversine_distance", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "default__haversine_distance", "macro_sql": "{% macro default__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{%- if unit == 'mi' %}\n {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n {% set conversion_rate = 1.60934 %}\n{% else %}\n {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n\n 2 * 3961 * asin(sqrt(power((sin(radians(({{ lat2 }} - {{ lat1 }}) / 2))), 2) +\n cos(radians({{lat1}})) * cos(radians({{lat2}})) *\n power((sin(radians(({{ lon2 }} - {{ lon1 }}) / 2))), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.558584}, "macro.dbt_utils.bigquery__haversine_distance": {"unique_id": "macro.dbt_utils.bigquery__haversine_distance", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "bigquery__haversine_distance", "macro_sql": "{% macro bigquery__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{% set radians_lat1 = dbt_utils.degrees_to_radians(lat1) %}\n{% set radians_lat2 = dbt_utils.degrees_to_radians(lat2) %}\n{% set radians_lon1 = dbt_utils.degrees_to_radians(lon1) %}\n{% set radians_lon2 = dbt_utils.degrees_to_radians(lon2) %}\n{%- if unit == 'mi' %}\n {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n {% set conversion_rate = 1.60934 %}\n{% else %}\n {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n 2 * 3961 * asin(sqrt(power(sin(({{ radians_lat2 }} - {{ radians_lat1 }}) / 2), 2) +\n cos({{ radians_lat1 }}) * cos({{ radians_lat2 }}) *\n power(sin(({{ radians_lon2 }} - {{ radians_lon1 }}) / 2), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.degrees_to_radians"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.561258}, "macro.spark_utils.get_tables": {"unique_id": "macro.spark_utils.get_tables", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "get_tables", "macro_sql": "{% macro get_tables(table_regex_pattern='.*') %}\n\n {% set tables = [] %}\n {% for database in spark__list_schemas('not_used') %}\n {% for table in spark__list_relations_without_caching(database[0]) %}\n {% set db_tablename = database[0] ~ \".\" ~ table[1] %}\n {% set is_match = modules.re.match(table_regex_pattern, db_tablename) %}\n {% if is_match %}\n {% call statement('table_detail', fetch_result=True) -%}\n describe extended {{ db_tablename }}\n {% endcall %}\n\n {% set table_type = load_result('table_detail').table|reverse|selectattr(0, 'in', ('type', 'TYPE', 'Type'))|first %}\n {% if table_type[1]|lower != 'view' %}\n {{ tables.append(db_tablename) }}\n {% endif %}\n {% endif %}\n {% endfor %}\n {% endfor %}\n {{ return(tables) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.573875}, "macro.spark_utils.get_delta_tables": {"unique_id": "macro.spark_utils.get_delta_tables", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "get_delta_tables", "macro_sql": "{% macro get_delta_tables(table_regex_pattern='.*') %}\n\n {% set delta_tables = [] %}\n {% for db_tablename in get_tables(table_regex_pattern) %}\n {% call statement('table_detail', fetch_result=True) -%}\n describe extended {{ db_tablename }}\n {% endcall %}\n\n {% set table_type = load_result('table_detail').table|reverse|selectattr(0, 'in', ('provider', 'PROVIDER', 'Provider'))|first %}\n {% if table_type[1]|lower == 'delta' %}\n {{ delta_tables.append(db_tablename) }}\n {% endif %}\n {% endfor %}\n {{ return(delta_tables) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_tables", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.575775}, "macro.spark_utils.get_statistic_columns": {"unique_id": "macro.spark_utils.get_statistic_columns", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "get_statistic_columns", "macro_sql": "{% macro get_statistic_columns(table) %}\n\n {% call statement('input_columns', fetch_result=True) %}\n SHOW COLUMNS IN {{ table }}\n {% endcall %}\n {% set input_columns = load_result('input_columns').table %}\n\n {% set output_columns = [] %}\n {% for column in input_columns %}\n {% call statement('column_information', fetch_result=True) %}\n DESCRIBE TABLE {{ table }} `{{ column[0] }}`\n {% endcall %}\n {% if not load_result('column_information').table[1][1].startswith('struct') and not load_result('column_information').table[1][1].startswith('array') %}\n {{ output_columns.append('`' ~ column[0] ~ '`') }}\n {% endif %}\n {% endfor %}\n {{ return(output_columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.5782678}, "macro.spark_utils.spark_optimize_delta_tables": {"unique_id": "macro.spark_utils.spark_optimize_delta_tables", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "spark_optimize_delta_tables", "macro_sql": "{% macro spark_optimize_delta_tables(table_regex_pattern='.*') %}\n\n {% for table in get_delta_tables(table_regex_pattern) %}\n {% set start=modules.datetime.datetime.now() %}\n {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n {{ dbt_utils.log_info(message_prefix ~ \" Optimizing \" ~ table) }}\n {% do run_query(\"optimize \" ~ table) %}\n {% set end=modules.datetime.datetime.now() %}\n {% set total_seconds = (end - start).total_seconds() | round(2) %}\n {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_delta_tables", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.580319}, "macro.spark_utils.spark_vacuum_delta_tables": {"unique_id": "macro.spark_utils.spark_vacuum_delta_tables", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "spark_vacuum_delta_tables", "macro_sql": "{% macro spark_vacuum_delta_tables(table_regex_pattern='.*') %}\n\n {% for table in get_delta_tables(table_regex_pattern) %}\n {% set start=modules.datetime.datetime.now() %}\n {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n {{ dbt_utils.log_info(message_prefix ~ \" Vacuuming \" ~ table) }}\n {% do run_query(\"vacuum \" ~ table) %}\n {% set end=modules.datetime.datetime.now() %}\n {% set total_seconds = (end - start).total_seconds() | round(2) %}\n {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_delta_tables", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.582368}, "macro.spark_utils.spark_analyze_tables": {"unique_id": "macro.spark_utils.spark_analyze_tables", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "spark_analyze_tables", "macro_sql": "{% macro spark_analyze_tables(table_regex_pattern='.*') %}\n\n {% for table in get_tables(table_regex_pattern) %}\n {% set start=modules.datetime.datetime.now() %}\n {% set columns = get_statistic_columns(table) | join(',') %}\n {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n {{ dbt_utils.log_info(message_prefix ~ \" Analyzing \" ~ table) }}\n {% if columns != '' %}\n {% do run_query(\"analyze table \" ~ table ~ \" compute statistics for columns \" ~ columns) %}\n {% endif %}\n {% set end=modules.datetime.datetime.now() %}\n {% set total_seconds = (end - start).total_seconds() | round(2) %}\n {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_tables", "macro.spark_utils.get_statistic_columns", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.584821}, "macro.spark_utils.spark__concat": {"unique_id": "macro.spark_utils.spark__concat", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/concat.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/concat.sql", "name": "spark__concat", "macro_sql": "{% macro spark__concat(fields) -%}\n concat({{ fields|join(', ') }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.585639}, "macro.spark_utils.spark__type_numeric": {"unique_id": "macro.spark_utils.spark__type_numeric", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/datatypes.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/datatypes.sql", "name": "spark__type_numeric", "macro_sql": "{% macro spark__type_numeric() %}\n decimal(28, 6)\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.5861928}, "macro.spark_utils.spark__dateadd": {"unique_id": "macro.spark_utils.spark__dateadd", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/dateadd.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/dateadd.sql", "name": "spark__dateadd", "macro_sql": "{% macro spark__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n {%- set clock_component -%}\n {# make sure the dates + timestamps are real, otherwise raise an error asap #}\n to_unix_timestamp({{ spark_utils.assert_not_null('to_timestamp', from_date_or_timestamp) }})\n - to_unix_timestamp({{ spark_utils.assert_not_null('date', from_date_or_timestamp) }})\n {%- endset -%}\n\n {%- if datepart in ['day', 'week'] -%}\n \n {%- set multiplier = 7 if datepart == 'week' else 1 -%}\n\n to_timestamp(\n to_unix_timestamp(\n date_add(\n {{ spark_utils.assert_not_null('date', from_date_or_timestamp) }},\n cast({{interval}} * {{multiplier}} as int)\n )\n ) + {{clock_component}}\n )\n\n {%- elif datepart in ['month', 'quarter', 'year'] -%}\n \n {%- set multiplier -%} \n {%- if datepart == 'month' -%} 1\n {%- elif datepart == 'quarter' -%} 3\n {%- elif datepart == 'year' -%} 12\n {%- endif -%}\n {%- endset -%}\n\n to_timestamp(\n to_unix_timestamp(\n add_months(\n {{ spark_utils.assert_not_null('date', from_date_or_timestamp) }},\n cast({{interval}} * {{multiplier}} as int)\n )\n ) + {{clock_component}}\n )\n\n {%- elif datepart in ('hour', 'minute', 'second', 'millisecond', 'microsecond') -%}\n \n {%- set multiplier -%} \n {%- if datepart == 'hour' -%} 3600\n {%- elif datepart == 'minute' -%} 60\n {%- elif datepart == 'second' -%} 1\n {%- elif datepart == 'millisecond' -%} (1/1000000)\n {%- elif datepart == 'microsecond' -%} (1/1000000)\n {%- endif -%}\n {%- endset -%}\n\n to_timestamp(\n {{ spark_utils.assert_not_null('to_unix_timestamp', from_date_or_timestamp) }}\n + cast({{interval}} * {{multiplier}} as int)\n )\n\n {%- else -%}\n\n {{ exceptions.raise_compiler_error(\"macro dateadd not implemented for datepart ~ '\" ~ datepart ~ \"' ~ on Spark\") }}\n\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.59291}, "macro.spark_utils.spark__datediff": {"unique_id": "macro.spark_utils.spark__datediff", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/datediff.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/datediff.sql", "name": "spark__datediff", "macro_sql": "{% macro spark__datediff(first_date, second_date, datepart) %}\n\n {%- if datepart in ['day', 'week', 'month', 'quarter', 'year'] -%}\n \n {# make sure the dates are real, otherwise raise an error asap #}\n {% set first_date = spark_utils.assert_not_null('date', first_date) %}\n {% set second_date = spark_utils.assert_not_null('date', second_date) %}\n \n {%- endif -%}\n \n {%- if datepart == 'day' -%}\n \n datediff({{second_date}}, {{first_date}})\n \n {%- elif datepart == 'week' -%}\n \n case when {{first_date}} < {{second_date}}\n then floor(datediff({{second_date}}, {{first_date}})/7)\n else ceil(datediff({{second_date}}, {{first_date}})/7)\n end\n \n -- did we cross a week boundary (Sunday)?\n + case\n when {{first_date}} < {{second_date}} and dayofweek({{second_date}}) < dayofweek({{first_date}}) then 1\n when {{first_date}} > {{second_date}} and dayofweek({{second_date}}) > dayofweek({{first_date}}) then -1\n else 0 end\n\n {%- elif datepart == 'month' -%}\n\n case when {{first_date}} < {{second_date}}\n then floor(months_between(date({{second_date}}), date({{first_date}})))\n else ceil(months_between(date({{second_date}}), date({{first_date}})))\n end\n \n -- did we cross a month boundary?\n + case\n when {{first_date}} < {{second_date}} and dayofmonth({{second_date}}) < dayofmonth({{first_date}}) then 1\n when {{first_date}} > {{second_date}} and dayofmonth({{second_date}}) > dayofmonth({{first_date}}) then -1\n else 0 end\n \n {%- elif datepart == 'quarter' -%}\n \n case when {{first_date}} < {{second_date}}\n then floor(months_between(date({{second_date}}), date({{first_date}}))/3)\n else ceil(months_between(date({{second_date}}), date({{first_date}}))/3)\n end\n \n -- did we cross a quarter boundary?\n + case\n when {{first_date}} < {{second_date}} and (\n (dayofyear({{second_date}}) - (quarter({{second_date}}) * 365/4))\n < (dayofyear({{first_date}}) - (quarter({{first_date}}) * 365/4))\n ) then 1\n when {{first_date}} > {{second_date}} and (\n (dayofyear({{second_date}}) - (quarter({{second_date}}) * 365/4))\n > (dayofyear({{first_date}}) - (quarter({{first_date}}) * 365/4))\n ) then -1\n else 0 end\n\n {%- elif datepart == 'year' -%}\n \n year({{second_date}}) - year({{first_date}})\n\n {%- elif datepart in ('hour', 'minute', 'second', 'millisecond', 'microsecond') -%}\n \n {%- set divisor -%} \n {%- if datepart == 'hour' -%} 3600\n {%- elif datepart == 'minute' -%} 60\n {%- elif datepart == 'second' -%} 1\n {%- elif datepart == 'millisecond' -%} (1/1000)\n {%- elif datepart == 'microsecond' -%} (1/1000000)\n {%- endif -%}\n {%- endset -%}\n\n case when {{first_date}} < {{second_date}}\n then ceil((\n {# make sure the timestamps are real, otherwise raise an error asap #}\n {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', second_date)) }}\n - {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', first_date)) }}\n ) / {{divisor}})\n else floor((\n {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', second_date)) }}\n - {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', first_date)) }}\n ) / {{divisor}})\n end\n \n {% if datepart == 'millisecond' %}\n + cast(date_format({{second_date}}, 'SSS') as int)\n - cast(date_format({{first_date}}, 'SSS') as int)\n {% endif %}\n \n {% if datepart == 'microsecond' %} \n {% set capture_str = '[0-9]{4}-[0-9]{2}-[0-9]{2}.[0-9]{2}:[0-9]{2}:[0-9]{2}.([0-9]{6})' %}\n -- Spark doesn't really support microseconds, so this is a massive hack!\n -- It will only work if the timestamp-string is of the format\n -- 'yyyy-MM-dd-HH mm.ss.SSSSSS'\n + cast(regexp_extract({{second_date}}, '{{capture_str}}', 1) as int)\n - cast(regexp_extract({{first_date}}, '{{capture_str}}', 1) as int) \n {% endif %}\n\n {%- else -%}\n\n {{ exceptions.raise_compiler_error(\"macro datediff not implemented for datepart ~ '\" ~ datepart ~ \"' ~ on Spark\") }}\n\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.609067}, "macro.spark_utils.spark__current_timestamp": {"unique_id": "macro.spark_utils.spark__current_timestamp", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "name": "spark__current_timestamp", "macro_sql": "{% macro spark__current_timestamp() %}\n current_timestamp()\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.609689}, "macro.spark_utils.spark__current_timestamp_in_utc": {"unique_id": "macro.spark_utils.spark__current_timestamp_in_utc", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "name": "spark__current_timestamp_in_utc", "macro_sql": "{% macro spark__current_timestamp_in_utc() %}\n unix_timestamp()\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.609897}, "macro.spark_utils.spark__split_part": {"unique_id": "macro.spark_utils.spark__split_part", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/split_part.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/split_part.sql", "name": "spark__split_part", "macro_sql": "{% macro spark__split_part(string_text, delimiter_text, part_number) %}\n\n {% set delimiter_expr %}\n \n -- escape if starts with a special character\n case when regexp_extract({{ delimiter_text }}, '([^A-Za-z0-9])(.*)', 1) != '_'\n then concat('\\\\', {{ delimiter_text }})\n else {{ delimiter_text }} end\n \n {% endset %}\n\n {% set split_part_expr %}\n \n split(\n {{ string_text }},\n {{ delimiter_expr }}\n )[({{ part_number - 1 }})]\n \n {% endset %}\n \n {{ return(split_part_expr) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6114292}, "macro.spark_utils.spark__get_relations_by_pattern": {"unique_id": "macro.spark_utils.spark__get_relations_by_pattern", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_relations_by_pattern", "macro_sql": "{% macro spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n show table extended in {{ schema_pattern }} like '{{ table_pattern }}'\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=None,\n schema=row[0],\n identifier=row[1],\n type=('view' if 'Type: VIEW' in row[3] else 'table')\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6153579}, "macro.spark_utils.spark__get_relations_by_prefix": {"unique_id": "macro.spark_utils.spark__get_relations_by_prefix", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_relations_by_prefix", "macro_sql": "{% macro spark__get_relations_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {% set table_pattern = table_pattern ~ '*' %}\n {{ return(spark_utils.spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.616321}, "macro.spark_utils.spark__get_tables_by_pattern": {"unique_id": "macro.spark_utils.spark__get_tables_by_pattern", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_tables_by_pattern", "macro_sql": "{% macro spark__get_tables_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(spark_utils.spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.617082}, "macro.spark_utils.spark__get_tables_by_prefix": {"unique_id": "macro.spark_utils.spark__get_tables_by_prefix", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_tables_by_prefix", "macro_sql": "{% macro spark__get_tables_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(spark_utils.spark__get_relations_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_prefix"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.617841}, "macro.spark_utils.assert_not_null": {"unique_id": "macro.spark_utils.assert_not_null", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/etc/assert_not_null.sql", "original_file_path": "macros/etc/assert_not_null.sql", "name": "assert_not_null", "macro_sql": "{% macro assert_not_null(function, arg) -%}\n {{ return(adapter.dispatch('assert_not_null', 'spark_utils')(function, arg)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.default__assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.61887}, "macro.spark_utils.default__assert_not_null": {"unique_id": "macro.spark_utils.default__assert_not_null", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/etc/assert_not_null.sql", "original_file_path": "macros/etc/assert_not_null.sql", "name": "default__assert_not_null", "macro_sql": "{% macro default__assert_not_null(function, arg) %}\n\n coalesce({{function}}({{arg}}), nvl2({{function}}({{arg}}), assert_true({{function}}({{arg}}) is not null), null))\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.619458}, "macro.spark_utils.spark__convert_timezone": {"unique_id": "macro.spark_utils.spark__convert_timezone", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/snowplow/convert_timezone.sql", "original_file_path": "macros/snowplow/convert_timezone.sql", "name": "spark__convert_timezone", "macro_sql": "{% macro spark__convert_timezone(in_tz, out_tz, in_timestamp) %}\n from_utc_timestamp(to_utc_timestamp({{in_timestamp}}, {{in_tz}}), {{out_tz}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.620199}, "macro.fivetran_utils.enabled_vars": {"unique_id": "macro.fivetran_utils.enabled_vars", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/enabled_vars.sql", "original_file_path": "macros/enabled_vars.sql", "name": "enabled_vars", "macro_sql": "{% macro enabled_vars(vars) %}\n\n{% for v in vars %}\n \n {% if var(v, True) == False %}\n {{ return(False) }}\n {% endif %}\n\n{% endfor %}\n\n{{ return(True) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.621526}, "macro.fivetran_utils.percentile": {"unique_id": "macro.fivetran_utils.percentile", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "percentile", "macro_sql": "{% macro percentile(percentile_field, partition_field, percent) -%}\n\n{{ adapter.dispatch('percentile', 'fivetran_utils') (percentile_field, partition_field, percent) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.bigquery__percentile"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.623894}, "macro.fivetran_utils.default__percentile": {"unique_id": "macro.fivetran_utils.default__percentile", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "default__percentile", "macro_sql": "{% macro default__percentile(percentile_field, partition_field, percent) %}\n\n percentile_cont( \n {{ percent }} )\n within group ( order by {{ percentile_field }} )\n over ( partition by {{ partition_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.624385}, "macro.fivetran_utils.redshift__percentile": {"unique_id": "macro.fivetran_utils.redshift__percentile", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "redshift__percentile", "macro_sql": "{% macro redshift__percentile(percentile_field, partition_field, percent) %}\n\n percentile_cont( \n {{ percent }} )\n within group ( order by {{ percentile_field }} )\n over ( partition by {{ partition_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6248882}, "macro.fivetran_utils.bigquery__percentile": {"unique_id": "macro.fivetran_utils.bigquery__percentile", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "bigquery__percentile", "macro_sql": "{% macro bigquery__percentile(percentile_field, partition_field, percent) %}\n\n percentile_cont( \n {{ percentile_field }}, \n {{ percent }}) \n over (partition by {{ partition_field }} \n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.625521}, "macro.fivetran_utils.postgres__percentile": {"unique_id": "macro.fivetran_utils.postgres__percentile", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "postgres__percentile", "macro_sql": "{% macro postgres__percentile(percentile_field, partition_field, percent) %}\n\n percentile_cont( \n {{ percent }} )\n within group ( order by {{ percentile_field }} )\n /* have to group by partition field */\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.625945}, "macro.fivetran_utils.spark__percentile": {"unique_id": "macro.fivetran_utils.spark__percentile", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "spark__percentile", "macro_sql": "{% macro spark__percentile(percentile_field, partition_field, percent) %}\n\n percentile( \n {{ percentile_field }}, \n {{ percent }}) \n over (partition by {{ partition_field }} \n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6264188}, "macro.fivetran_utils.pivot_json_extract": {"unique_id": "macro.fivetran_utils.pivot_json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/pivot_json_extract.sql", "original_file_path": "macros/pivot_json_extract.sql", "name": "pivot_json_extract", "macro_sql": "{% macro pivot_json_extract(string, list_of_properties) %}\n\n{%- for property in list_of_properties -%}\n\nreplace( {{ fivetran_utils.json_extract(string, property) }}, '\"', '') as {{ property | replace(' ', '_') | lower }}\n\n{%- if not loop.last -%},{%- endif %}\n{% endfor -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.json_extract"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.627744}, "macro.fivetran_utils.persist_pass_through_columns": {"unique_id": "macro.fivetran_utils.persist_pass_through_columns", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/persist_pass_through_columns.sql", "original_file_path": "macros/persist_pass_through_columns.sql", "name": "persist_pass_through_columns", "macro_sql": "{% macro persist_pass_through_columns(pass_through_variable) %}\n\n{% if var(pass_through_variable, none) %}\n {% for field in var(pass_through_variable) %}\n , {{ field.alias if field.alias else field.name }}\n {% endfor %}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6289868}, "macro.fivetran_utils.json_parse": {"unique_id": "macro.fivetran_utils.json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "json_parse", "macro_sql": "{% macro json_parse(string, string_path) -%}\n\n{{ adapter.dispatch('json_parse', 'fivetran_utils') (string, string_path) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.bigquery__json_parse"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.631362}, "macro.fivetran_utils.default__json_parse": {"unique_id": "macro.fivetran_utils.default__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "default__json_parse", "macro_sql": "{% macro default__json_parse(string, string_path) %}\n\n json_extract_path_text({{string}}, {%- for s in string_path -%}'{{ s }}'{%- if not loop.last -%},{%- endif -%}{%- endfor -%} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.632394}, "macro.fivetran_utils.redshift__json_parse": {"unique_id": "macro.fivetran_utils.redshift__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "redshift__json_parse", "macro_sql": "{% macro redshift__json_parse(string, string_path) %}\n\n json_extract_path_text({{string}}, {%- for s in string_path -%}'{{ s }}'{%- if not loop.last -%},{%- endif -%}{%- endfor -%} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.633257}, "macro.fivetran_utils.bigquery__json_parse": {"unique_id": "macro.fivetran_utils.bigquery__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "bigquery__json_parse", "macro_sql": "{% macro bigquery__json_parse(string, string_path) %}\n\n \n json_extract_scalar({{string}}, '$.{%- for s in string_path -%}{{ s }}{%- if not loop.last -%}.{%- endif -%}{%- endfor -%} ')\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.63396}, "macro.fivetran_utils.postgres__json_parse": {"unique_id": "macro.fivetran_utils.postgres__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "postgres__json_parse", "macro_sql": "{% macro postgres__json_parse(string, string_path) %}\n\n {{string}}::json #>> '{ {%- for s in string_path -%}{{ s }}{%- if not loop.last -%},{%- endif -%}{%- endfor -%} }'\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.634639}, "macro.fivetran_utils.snowflake__json_parse": {"unique_id": "macro.fivetran_utils.snowflake__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "snowflake__json_parse", "macro_sql": "{% macro snowflake__json_parse(string, string_path) %}\n\n parse_json( {{string}} ) {%- for s in string_path -%}{% if s is number %}[{{ s }}]{% else %}['{{ s }}']{% endif %}{%- endfor -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.635408}, "macro.fivetran_utils.spark__json_parse": {"unique_id": "macro.fivetran_utils.spark__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "spark__json_parse", "macro_sql": "{% macro spark__json_parse(string, string_path) %}\n\n {{string}} : {%- for s in string_path -%}{% if s is number %}[{{ s }}]{% else %}['{{ s }}']{% endif %}{%- endfor -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.636168}, "macro.fivetran_utils.max_bool": {"unique_id": "macro.fivetran_utils.max_bool", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "name": "max_bool", "macro_sql": "{% macro max_bool(boolean_field) -%}\n\n{{ adapter.dispatch('max_bool', 'fivetran_utils') (boolean_field) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.bigquery__max_bool"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.637154}, "macro.fivetran_utils.default__max_bool": {"unique_id": "macro.fivetran_utils.default__max_bool", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "name": "default__max_bool", "macro_sql": "{% macro default__max_bool(boolean_field) %}\n\n bool_or( {{ boolean_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6374452}, "macro.fivetran_utils.snowflake__max_bool": {"unique_id": "macro.fivetran_utils.snowflake__max_bool", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "name": "snowflake__max_bool", "macro_sql": "{% macro snowflake__max_bool(boolean_field) %}\n\n max( {{ boolean_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.637726}, "macro.fivetran_utils.bigquery__max_bool": {"unique_id": "macro.fivetran_utils.bigquery__max_bool", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "name": "bigquery__max_bool", "macro_sql": "{% macro bigquery__max_bool(boolean_field) %}\n\n max( {{ boolean_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.638013}, "macro.fivetran_utils.calculated_fields": {"unique_id": "macro.fivetran_utils.calculated_fields", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/calculated_fields.sql", "original_file_path": "macros/calculated_fields.sql", "name": "calculated_fields", "macro_sql": "{% macro calculated_fields(variable) -%}\n\n{% if var(variable, none) %}\n {% for field in var(variable) %}\n , {{ field.transform_sql }} as {{ field.name }} \n {% endfor %}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.639183}, "macro.fivetran_utils.seed_data_helper": {"unique_id": "macro.fivetran_utils.seed_data_helper", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/seed_data_helper.sql", "original_file_path": "macros/seed_data_helper.sql", "name": "seed_data_helper", "macro_sql": "{% macro seed_data_helper(seed_name, warehouses) %}\n\n{% if target.type in warehouses %}\n {% for w in warehouses %}\n {% if target.type == w %}\n {{ return(ref(seed_name ~ \"_\" ~ w ~ \"\")) }}\n {% endif %}\n {% endfor %}\n{% else %}\n{{ return(ref(seed_name)) }}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.640896}, "macro.fivetran_utils.fill_pass_through_columns": {"unique_id": "macro.fivetran_utils.fill_pass_through_columns", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/fill_pass_through_columns.sql", "original_file_path": "macros/fill_pass_through_columns.sql", "name": "fill_pass_through_columns", "macro_sql": "{% macro fill_pass_through_columns(pass_through_variable) %}\n\n{% if var(pass_through_variable) %}\n {% for field in var(pass_through_variable) %}\n {% if field.transform_sql %}\n , {{ field.transform_sql }} as {{ field.alias if field.alias else field.name }}\n {% else %}\n , {{ field.alias if field.alias else field.name }}\n {% endif %}\n {% endfor %}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.642686}, "macro.fivetran_utils.string_agg": {"unique_id": "macro.fivetran_utils.string_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "string_agg", "macro_sql": "{% macro string_agg(field_to_agg, delimiter) -%}\n\n{{ adapter.dispatch('string_agg', 'fivetran_utils') (field_to_agg, delimiter) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__string_agg"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.643894}, "macro.fivetran_utils.default__string_agg": {"unique_id": "macro.fivetran_utils.default__string_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "default__string_agg", "macro_sql": "{% macro default__string_agg(field_to_agg, delimiter) %}\n string_agg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6442611}, "macro.fivetran_utils.snowflake__string_agg": {"unique_id": "macro.fivetran_utils.snowflake__string_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "snowflake__string_agg", "macro_sql": "{% macro snowflake__string_agg(field_to_agg, delimiter) %}\n listagg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.644675}, "macro.fivetran_utils.redshift__string_agg": {"unique_id": "macro.fivetran_utils.redshift__string_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "redshift__string_agg", "macro_sql": "{% macro redshift__string_agg(field_to_agg, delimiter) %}\n listagg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.645063}, "macro.fivetran_utils.spark__string_agg": {"unique_id": "macro.fivetran_utils.spark__string_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "spark__string_agg", "macro_sql": "{% macro spark__string_agg(field_to_agg, delimiter) %}\n -- collect set will remove duplicates\n replace(replace(replace(cast( collect_set({{ field_to_agg }}) as string), '[', ''), ']', ''), ', ', {{ delimiter }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6454349}, "macro.fivetran_utils.timestamp_diff": {"unique_id": "macro.fivetran_utils.timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "timestamp_diff", "macro_sql": "{% macro timestamp_diff(first_date, second_date, datepart) %}\n {{ adapter.dispatch('timestamp_diff', 'fivetran_utils')(first_date, second_date, datepart) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.bigquery__timestamp_diff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6514251}, "macro.fivetran_utils.default__timestamp_diff": {"unique_id": "macro.fivetran_utils.default__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "default__timestamp_diff", "macro_sql": "{% macro default__timestamp_diff(first_date, second_date, datepart) %}\n\n datediff(\n {{ datepart }},\n {{ first_date }},\n {{ second_date }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.651885}, "macro.fivetran_utils.redshift__timestamp_diff": {"unique_id": "macro.fivetran_utils.redshift__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "redshift__timestamp_diff", "macro_sql": "{% macro redshift__timestamp_diff(first_date, second_date, datepart) %}\n\n datediff(\n {{ datepart }},\n {{ first_date }},\n {{ second_date }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.652338}, "macro.fivetran_utils.bigquery__timestamp_diff": {"unique_id": "macro.fivetran_utils.bigquery__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "bigquery__timestamp_diff", "macro_sql": "{% macro bigquery__timestamp_diff(first_date, second_date, datepart) %}\n\n timestamp_diff(\n {{second_date}},\n {{first_date}},\n {{datepart}}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.65279}, "macro.fivetran_utils.postgres__timestamp_diff": {"unique_id": "macro.fivetran_utils.postgres__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "postgres__timestamp_diff", "macro_sql": "{% macro postgres__timestamp_diff(first_date, second_date, datepart) %}\n\n {% if datepart == 'year' %}\n (date_part('year', ({{second_date}})::date) - date_part('year', ({{first_date}})::date))\n {% elif datepart == 'quarter' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 4 + date_part('quarter', ({{second_date}})::date) - date_part('quarter', ({{first_date}})::date))\n {% elif datepart == 'month' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 12 + date_part('month', ({{second_date}})::date) - date_part('month', ({{first_date}})::date))\n {% elif datepart == 'day' %}\n (({{second_date}})::date - ({{first_date}})::date)\n {% elif datepart == 'week' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} / 7 + case\n when date_part('dow', ({{first_date}})::timestamp) <= date_part('dow', ({{second_date}})::timestamp) then\n case when {{first_date}} <= {{second_date}} then 0 else -1 end\n else\n case when {{first_date}} <= {{second_date}} then 1 else 0 end\n end)\n {% elif datepart == 'hour' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} * 24 + date_part('hour', ({{second_date}})::timestamp) - date_part('hour', ({{first_date}})::timestamp))\n {% elif datepart == 'minute' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'hour') }} * 60 + date_part('minute', ({{second_date}})::timestamp) - date_part('minute', ({{first_date}})::timestamp))\n {% elif datepart == 'second' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60 + floor(date_part('second', ({{second_date}})::timestamp)) - floor(date_part('second', ({{first_date}})::timestamp)))\n {% elif datepart == 'millisecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000 + floor(date_part('millisecond', ({{second_date}})::timestamp)) - floor(date_part('millisecond', ({{first_date}})::timestamp)))\n {% elif datepart == 'microsecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000000 + floor(date_part('microsecond', ({{second_date}})::timestamp)) - floor(date_part('microsecond', ({{first_date}})::timestamp)))\n {% else %}\n {{ exceptions.raise_compiler_error(\"Unsupported datepart for macro datediff in postgres: {!r}\".format(datepart)) }}\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.657823}, "macro.fivetran_utils.try_cast": {"unique_id": "macro.fivetran_utils.try_cast", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "try_cast", "macro_sql": "{% macro try_cast(field, type) %}\n {{ adapter.dispatch('try_cast', 'fivetran_utils') (field, type) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.bigquery__try_cast"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.659924}, "macro.fivetran_utils.default__safe_cast": {"unique_id": "macro.fivetran_utils.default__safe_cast", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "default__safe_cast", "macro_sql": "{% macro default__safe_cast(field, type) %}\n {# most databases don't support this function yet\n so we just need to use cast #}\n cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6603148}, "macro.fivetran_utils.redshift__try_cast": {"unique_id": "macro.fivetran_utils.redshift__try_cast", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "redshift__try_cast", "macro_sql": "{% macro redshift__try_cast(field, type) %}\n{%- if type == 'numeric' -%}\n\n case\n when trim({{field}}) ~ '^(0|[1-9][0-9]*)$' then trim({{field}})\n else null\n end::{{type}}\n\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"non-numeric datatypes are not currently supported\") }}\n\n{% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6610749}, "macro.fivetran_utils.postgres__try_cast": {"unique_id": "macro.fivetran_utils.postgres__try_cast", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "postgres__try_cast", "macro_sql": "{% macro postgres__try_cast(field, type) %}\n{%- if type == 'numeric' -%}\n\n case\n when replace(cast({{field}} as varchar),cast(' ' as varchar),cast('' as varchar)) ~ '^(0|[1-9][0-9]*)$' \n then replace(cast({{field}} as varchar),cast(' ' as varchar),cast('' as varchar))\n else null\n end::{{type}}\n\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"non-numeric datatypes are not currently supported\") }}\n\n{% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.661935}, "macro.fivetran_utils.snowflake__try_cast": {"unique_id": "macro.fivetran_utils.snowflake__try_cast", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "snowflake__try_cast", "macro_sql": "{% macro snowflake__try_cast(field, type) %}\n try_cast(cast({{field}} as varchar) as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.662313}, "macro.fivetran_utils.bigquery__try_cast": {"unique_id": "macro.fivetran_utils.bigquery__try_cast", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "bigquery__try_cast", "macro_sql": "{% macro bigquery__try_cast(field, type) %}\n safe_cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.662673}, "macro.fivetran_utils.spark__try_cast": {"unique_id": "macro.fivetran_utils.spark__try_cast", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "spark__try_cast", "macro_sql": "{% macro spark__try_cast(field, type) %}\n try_cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.663033}, "macro.fivetran_utils.source_relation": {"unique_id": "macro.fivetran_utils.source_relation", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/source_relation.sql", "original_file_path": "macros/source_relation.sql", "name": "source_relation", "macro_sql": "{% macro source_relation(union_schema_variable='union_schemas', union_database_variable='union_databases') -%}\n\n{{ adapter.dispatch('source_relation', 'fivetran_utils') (union_schema_variable, union_database_variable) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__source_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.664484}, "macro.fivetran_utils.default__source_relation": {"unique_id": "macro.fivetran_utils.default__source_relation", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/source_relation.sql", "original_file_path": "macros/source_relation.sql", "name": "default__source_relation", "macro_sql": "{% macro default__source_relation(union_schema_variable, union_database_variable) %}\n\n{% if var(union_schema_variable, none) %}\n, case\n {% for schema in var(union_schema_variable) %}\n when lower(replace(replace(_dbt_source_relation,'\"',''),'`','')) like '%.{{ schema|lower }}.%' then '{{ schema|lower }}'\n {% endfor %}\n end as source_relation\n{% elif var(union_database_variable, none) %}\n, case\n {% for database in var(union_database_variable) %}\n when lower(replace(replace(_dbt_source_relation,'\"',''),'`','')) like '%{{ database|lower }}.%' then '{{ database|lower }}'\n {% endfor %}\n end as source_relation\n{% else %}\n, cast('' as {{ dbt_utils.type_string() }}) as source_relation\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.666095}, "macro.fivetran_utils.first_value": {"unique_id": "macro.fivetran_utils.first_value", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "name": "first_value", "macro_sql": "{% macro first_value(first_value_field, partition_field, order_by_field, order=\"asc\") -%}\n\n{{ adapter.dispatch('first_value', 'fivetran_utils') (first_value_field, partition_field, order_by_field, order) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__first_value"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.667427}, "macro.fivetran_utils.default__first_value": {"unique_id": "macro.fivetran_utils.default__first_value", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "name": "default__first_value", "macro_sql": "{% macro default__first_value(first_value_field, partition_field, order_by_field, order=\"asc\") %}\n\n first_value( {{ first_value_field }} ignore nulls ) over (partition by {{ partition_field }} order by {{ order_by_field }} {{ order }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.66799}, "macro.fivetran_utils.redshift__first_value": {"unique_id": "macro.fivetran_utils.redshift__first_value", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "name": "redshift__first_value", "macro_sql": "{% macro redshift__first_value(first_value_field, partition_field, order_by_field, order=\"asc\") %}\n\n first_value( {{ first_value_field }} ignore nulls ) over (partition by {{ partition_field }} order by {{ order_by_field }} {{ order }} , {{ partition_field }} rows unbounded preceding )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.66861}, "macro.fivetran_utils.add_dbt_source_relation": {"unique_id": "macro.fivetran_utils.add_dbt_source_relation", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/add_dbt_source_relation.sql", "original_file_path": "macros/add_dbt_source_relation.sql", "name": "add_dbt_source_relation", "macro_sql": "{% macro add_dbt_source_relation() %}\n\n{% if var('union_schemas', none) or var('union_databases', none) %}\n, _dbt_source_relation\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6694698}, "macro.fivetran_utils.add_pass_through_columns": {"unique_id": "macro.fivetran_utils.add_pass_through_columns", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/add_pass_through_columns.sql", "original_file_path": "macros/add_pass_through_columns.sql", "name": "add_pass_through_columns", "macro_sql": "{% macro add_pass_through_columns(base_columns, pass_through_var) %}\n\n {% if pass_through_var %}\n\n {% for column in pass_through_var %}\n\n {% if column.alias %}\n\n {% do base_columns.append({ \"name\": column.name, \"alias\": column.alias, \"datatype\": column.datatype if column.datatype else dbt_utils.type_string()}) %}\n\n {% else %}\n\n {% do base_columns.append({ \"name\": column.name, \"datatype\": column.datatype if column.datatype else dbt_utils.type_string()}) %}\n \n {% endif %}\n\n {% endfor %}\n\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.671725}, "macro.fivetran_utils.union_relations": {"unique_id": "macro.fivetran_utils.union_relations", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/union_relations.sql", "original_file_path": "macros/union_relations.sql", "name": "union_relations", "macro_sql": "{%- macro union_relations(relations, aliases=none, column_override=none, include=[], exclude=[], source_column_name=none) -%}\n\n {%- if exclude and include -%}\n {{ exceptions.raise_compiler_error(\"Both an exclude and include list were provided to the `union` macro. Only one is allowed\") }}\n {%- endif -%}\n\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. -#}\n {%- if not execute %}\n {{ return('') }}\n {% endif -%}\n\n {%- set column_override = column_override if column_override is not none else {} -%}\n {%- set source_column_name = source_column_name if source_column_name is not none else '_dbt_source_relation' -%}\n\n {%- set relation_columns = {} -%}\n {%- set column_superset = {} -%}\n\n {%- for relation in relations -%}\n\n {%- do relation_columns.update({relation: []}) -%}\n\n {%- do dbt_utils._is_relation(relation, 'union_relations') -%}\n {%- set cols = adapter.get_columns_in_relation(relation) -%}\n {%- for col in cols -%}\n\n {#- If an exclude list was provided and the column is in the list, do nothing -#}\n {%- if exclude and col.column in exclude -%}\n\n {#- If an include list was provided and the column is not in the list, do nothing -#}\n {%- elif include and col.column not in include -%}\n\n {#- Otherwise add the column to the column superset -#}\n {%- else -%}\n\n {#- update the list of columns in this relation -#}\n {%- do relation_columns[relation].append(col.column) -%}\n\n {%- if col.column in column_superset -%}\n\n {%- set stored = column_superset[col.column] -%}\n {%- if col.is_string() and stored.is_string() and col.string_size() > stored.string_size() -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif %}\n\n {%- else -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif -%}\n\n {%- endif -%}\n\n {%- endfor -%}\n {%- endfor -%}\n\n {%- set ordered_column_names = column_superset.keys() -%}\n\n {%- for relation in relations %}\n\n (\n select\n\n cast({{ dbt_utils.string_literal(relation) }} as {{ dbt_utils.type_string() }}) as {{ source_column_name }},\n {% for col_name in ordered_column_names -%}\n\n {%- set col = column_superset[col_name] %}\n {%- set col_type = column_override.get(col.column, col.data_type) %}\n {%- set col_name = adapter.quote(col_name) if col_name in relation_columns[relation] else 'null' %}\n cast({{ col_name }} as {{ col_type }}) as {{ col.quoted }} {% if not loop.last %},{% endif -%}\n\n {%- endfor %}\n\n from {{ aliases[loop.index0] if aliases else relation }}\n )\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n\n {%- endfor -%}\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils.string_literal", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6812952}, "macro.fivetran_utils.union_tables": {"unique_id": "macro.fivetran_utils.union_tables", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/union_relations.sql", "original_file_path": "macros/union_relations.sql", "name": "union_tables", "macro_sql": "{%- macro union_tables(tables, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_table') -%}\n\n {%- do exceptions.warn(\"Warning: the `union_tables` macro is no longer supported and will be deprecated in a future release of dbt-utils. Use the `union_relations` macro instead\") -%}\n\n {{ return(dbt_utils.union_relations(tables, column_override, include, exclude, source_column_name)) }}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.union_relations"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.68226}, "macro.fivetran_utils.snowflake_seed_data": {"unique_id": "macro.fivetran_utils.snowflake_seed_data", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/snowflake_seed_data.sql", "original_file_path": "macros/snowflake_seed_data.sql", "name": "snowflake_seed_data", "macro_sql": "{% macro snowflake_seed_data(seed_name) %}\n\n{% if target.type == 'snowflake' %}\n{{ return(ref(seed_name ~ '_snowflake')) }}\n{% else %}\n{{ return(ref(seed_name)) }}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6834738}, "macro.fivetran_utils.fill_staging_columns": {"unique_id": "macro.fivetran_utils.fill_staging_columns", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/fill_staging_columns.sql", "original_file_path": "macros/fill_staging_columns.sql", "name": "fill_staging_columns", "macro_sql": "{% macro fill_staging_columns(source_columns, staging_columns) -%}\n\n{%- set source_column_names = source_columns|map(attribute='name')|map('lower')|list -%}\n\n{%- for column in staging_columns %}\n {% if column.name|lower in source_column_names -%}\n {{ fivetran_utils.quote_column(column) }} as \n {%- if 'alias' in column %} {{ column.alias }} {% else %} {{ fivetran_utils.quote_column(column) }} {%- endif -%}\n {%- else -%}\n cast(null as {{ column.datatype }})\n {%- if 'alias' in column %} as {{ column.alias }} {% else %} as {{ fivetran_utils.quote_column(column) }} {% endif -%}\n {%- endif -%}\n {%- if not loop.last -%} , {% endif -%}\n{% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.quote_column"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.687086}, "macro.fivetran_utils.quote_column": {"unique_id": "macro.fivetran_utils.quote_column", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/fill_staging_columns.sql", "original_file_path": "macros/fill_staging_columns.sql", "name": "quote_column", "macro_sql": "{% macro quote_column(column) %}\n {% if 'quote' in column %}\n {% if column.quote %}\n {% if target.type in ('bigquery', 'spark') %}\n `{{ column.name }}`\n {% elif target.type == 'snowflake' %}\n \"{{ column.name | upper }}\"\n {% else %}\n \"{{ column.name }}\"\n {% endif %}\n {% else %}\n {{ column.name }}\n {% endif %}\n {% else %}\n {{ column.name }}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.689054}, "macro.fivetran_utils.json_extract": {"unique_id": "macro.fivetran_utils.json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "json_extract", "macro_sql": "{% macro json_extract(string, string_path) -%}\n\n{{ adapter.dispatch('json_extract', 'fivetran_utils') (string, string_path) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.bigquery__json_extract"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.691005}, "macro.fivetran_utils.default__json_extract": {"unique_id": "macro.fivetran_utils.default__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "default__json_extract", "macro_sql": "{% macro default__json_extract(string, string_path) %}\n\n json_extract_path_text({{string}}, {{ \"'\" ~ string_path ~ \"'\" }} )\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.691655}, "macro.fivetran_utils.snowflake__json_extract": {"unique_id": "macro.fivetran_utils.snowflake__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "snowflake__json_extract", "macro_sql": "{% macro snowflake__json_extract(string, string_path) %}\n\n json_extract_path_text(try_parse_json( {{string}} ), {{ \"'\" ~ string_path ~ \"'\" }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.692363}, "macro.fivetran_utils.redshift__json_extract": {"unique_id": "macro.fivetran_utils.redshift__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "redshift__json_extract", "macro_sql": "{% macro redshift__json_extract(string, string_path) %}\n\n case when is_valid_json( {{string}} ) then json_extract_path_text({{string}}, {{ \"'\" ~ string_path ~ \"'\" }} ) else null end\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6929631}, "macro.fivetran_utils.bigquery__json_extract": {"unique_id": "macro.fivetran_utils.bigquery__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "bigquery__json_extract", "macro_sql": "{% macro bigquery__json_extract(string, string_path) %}\n\n json_extract_scalar({{string}}, {{ \"'$.\" ~ string_path ~ \"'\" }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6935139}, "macro.fivetran_utils.postgres__json_extract": {"unique_id": "macro.fivetran_utils.postgres__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "postgres__json_extract", "macro_sql": "{% macro postgres__json_extract(string, string_path) %}\n\n {{string}}::json->>{{\"'\" ~ string_path ~ \"'\" }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.69395}, "macro.fivetran_utils.collect_freshness": {"unique_id": "macro.fivetran_utils.collect_freshness", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/collect_freshness.sql", "original_file_path": "macros/collect_freshness.sql", "name": "collect_freshness", "macro_sql": "{% macro collect_freshness(source, loaded_at_field, filter) %}\n {{ return(adapter.dispatch('collect_freshness')(source, loaded_at_field, filter))}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__collect_freshness"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.695863}, "macro.fivetran_utils.default__collect_freshness": {"unique_id": "macro.fivetran_utils.default__collect_freshness", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/collect_freshness.sql", "original_file_path": "macros/collect_freshness.sql", "name": "default__collect_freshness", "macro_sql": "{% macro default__collect_freshness(source, loaded_at_field, filter) %}\n {% call statement('collect_freshness', fetch_result=True, auto_begin=False) -%}\n\n {%- set enabled_array = [] -%}\n {% for node in graph.sources.values() %}\n {% if node.identifier == source.identifier %}\n {% if (node.meta['is_enabled'] | default(true)) %}\n {%- do enabled_array.append(1) -%}\n {% endif %}\n {% endif %}\n {% endfor %}\n {% set is_enabled = (enabled_array != []) %}\n\n select\n {% if is_enabled %}\n max({{ loaded_at_field }})\n {% else %} \n {{ current_timestamp() }} {% endif %} as max_loaded_at,\n {{ current_timestamp() }} as snapshotted_at\n\n {% if is_enabled %}\n from {{ source }}\n {% if filter %}\n where {{ filter }}\n {% endif %}\n {% endif %}\n\n {% endcall %}\n {{ return(load_result('collect_freshness').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.698679}, "macro.fivetran_utils.timestamp_add": {"unique_id": "macro.fivetran_utils.timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "timestamp_add", "macro_sql": "{% macro timestamp_add(datepart, interval, from_timestamp) -%}\n\n{{ adapter.dispatch('timestamp_add', 'fivetran_utils') (datepart, interval, from_timestamp) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.bigquery__timestamp_add"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.7005591}, "macro.fivetran_utils.default__timestamp_add": {"unique_id": "macro.fivetran_utils.default__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "default__timestamp_add", "macro_sql": "{% macro default__timestamp_add(datepart, interval, from_timestamp) %}\n\n timestampadd(\n {{ datepart }},\n {{ interval }},\n {{ from_timestamp }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.701091}, "macro.fivetran_utils.bigquery__timestamp_add": {"unique_id": "macro.fivetran_utils.bigquery__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "bigquery__timestamp_add", "macro_sql": "{% macro bigquery__timestamp_add(datepart, interval, from_timestamp) %}\n\n timestamp_add({{ from_timestamp }}, interval {{ interval }} {{ datepart }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.701615}, "macro.fivetran_utils.redshift__timestamp_add": {"unique_id": "macro.fivetran_utils.redshift__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "redshift__timestamp_add", "macro_sql": "{% macro redshift__timestamp_add(datepart, interval, from_timestamp) %}\n\n dateadd(\n {{ datepart }},\n {{ interval }},\n {{ from_timestamp }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.702077}, "macro.fivetran_utils.postgres__timestamp_add": {"unique_id": "macro.fivetran_utils.postgres__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "postgres__timestamp_add", "macro_sql": "{% macro postgres__timestamp_add(datepart, interval, from_timestamp) %}\n\n {{ from_timestamp }} + ((interval '1 {{ datepart }}') * ({{ interval }}))\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.7025359}, "macro.fivetran_utils.spark__timestamp_add": {"unique_id": "macro.fivetran_utils.spark__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "spark__timestamp_add", "macro_sql": "{% macro spark__timestamp_add(datepart, interval, from_timestamp) %}\n\n {{ dbt_utils.dateadd(datepart, interval, from_timestamp) }}\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.703081}, "macro.fivetran_utils.ceiling": {"unique_id": "macro.fivetran_utils.ceiling", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "name": "ceiling", "macro_sql": "{% macro ceiling(num) -%}\n\n{{ adapter.dispatch('ceiling', 'fivetran_utils') (num) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__ceiling"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.704004}, "macro.fivetran_utils.default__ceiling": {"unique_id": "macro.fivetran_utils.default__ceiling", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "name": "default__ceiling", "macro_sql": "{% macro default__ceiling(num) %}\n ceiling({{ num }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.704363}, "macro.fivetran_utils.snowflake__ceiling": {"unique_id": "macro.fivetran_utils.snowflake__ceiling", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "name": "snowflake__ceiling", "macro_sql": "{% macro snowflake__ceiling(num) %}\n ceil({{ num }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.704691}, "macro.fivetran_utils.remove_prefix_from_columns": {"unique_id": "macro.fivetran_utils.remove_prefix_from_columns", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/remove_prefix_from_columns.sql", "original_file_path": "macros/remove_prefix_from_columns.sql", "name": "remove_prefix_from_columns", "macro_sql": "{% macro remove_prefix_from_columns(columns, prefix='', exclude=[]) %}\n\n {%- for col in columns if col.name not in exclude -%}\n {%- if col.name[:prefix|length]|lower == prefix -%}\n {{ col.name }} as {{ col.name[prefix|length:] }}\n {%- else -%}\n {{ col.name }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {% endfor -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.7074711}, "macro.fivetran_utils.union_data": {"unique_id": "macro.fivetran_utils.union_data", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/union_data.sql", "original_file_path": "macros/union_data.sql", "name": "union_data", "macro_sql": "{% macro union_data(table_identifier, database_variable, schema_variable, default_database, default_schema, default_variable, union_schema_variable='union_schemas', union_database_variable='union_databases') -%}\n\n{{ adapter.dispatch('union_data', 'fivetran_utils') (\n table_identifier, \n database_variable, \n schema_variable, \n default_database, \n default_schema, \n default_variable,\n union_schema_variable,\n union_database_variable\n ) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__union_data"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.710659}, "macro.fivetran_utils.default__union_data": {"unique_id": "macro.fivetran_utils.default__union_data", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/union_data.sql", "original_file_path": "macros/union_data.sql", "name": "default__union_data", "macro_sql": "{% macro default__union_data(\n table_identifier, \n database_variable, \n schema_variable, \n default_database, \n default_schema, \n default_variable,\n union_schema_variable,\n union_database_variable\n ) %}\n\n{% if var(union_schema_variable, none) %}\n\n {% set relations = [] %}\n \n {% if var(union_schema_variable) is string %}\n {% set trimmed = var(union_schema_variable)|trim('[')|trim(']') %}\n {% set schemas = trimmed.split(',')|map('trim',\" \")|map('trim','\"')|map('trim',\"'\") %}\n {% else %}\n {% set schemas = var(union_schema_variable) %}\n {% endif %}\n\n {% for schema in var(union_schema_variable) %}\n\n {% set relation=adapter.get_relation(\n database=var(database_variable, default_database),\n schema=schema,\n identifier=table_identifier\n ) -%}\n \n {% set relation_exists=relation is not none %}\n\n {% if relation_exists %}\n\n {% do relations.append(relation) %}\n \n {% endif %}\n\n {% endfor %}\n\n {{ dbt_utils.union_relations(relations) }}\n\n{% elif var(union_database_variable, none) %}\n\n {% set relations = [] %}\n\n {% for database in var(union_database_variable) %}\n\n {% set relation=adapter.get_relation(\n database=database,\n schema=var(schema_variable, default_schema),\n identifier=table_identifier\n ) -%}\n\n {% set relation_exists=relation is not none %}\n\n {% if relation_exists %}\n\n {% do relations.append(relation) %}\n \n {% endif %}\n\n {% endfor %}\n\n {{ dbt_utils.union_relations(relations) }}\n\n{% else %}\n\n select * \n from {{ var(default_variable) }}\n\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.union_relations"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.715785}, "macro.fivetran_utils.dummy_coalesce_value": {"unique_id": "macro.fivetran_utils.dummy_coalesce_value", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/dummy_coalesce_value.sql", "original_file_path": "macros/dummy_coalesce_value.sql", "name": "dummy_coalesce_value", "macro_sql": "{% macro dummy_coalesce_value(column) %}\n\n{% set coalesce_value = {\n 'STRING': \"'DUMMY_STRING'\",\n 'BOOLEAN': 'null',\n 'INT': 999999999,\n 'FLOAT': 999999999.99,\n 'TIMESTAMP': 'cast(\"2099-12-31\" as timestamp)',\n 'DATE': 'cast(\"2099-12-31\" as date)',\n} %}\n\n{% if column.is_float() %}\n{{ return(coalesce_value['FLOAT']) }}\n\n{% elif column.is_numeric() %}\n{{ return(coalesce_value['INT']) }}\n\n{% elif column.is_string() %}\n{{ return(coalesce_value['STRING']) }}\n\n{% elif column.data_type|lower == 'boolean' %}\n{{ return(coalesce_value['BOOLEAN']) }}\n\n{% elif 'timestamp' in column.data_type|lower %}\n{{ return(coalesce_value['TIMESTAMP']) }}\n\n{% elif 'date' in column.data_type|lower %}\n{{ return(coalesce_value['DATE']) }}\n\n{% elif 'int' in column.data_type|lower %}\n{{ return(coalesce_value['INT']) }}\n\n{% endif %}\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.719852}, "macro.fivetran_utils.array_agg": {"unique_id": "macro.fivetran_utils.array_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "name": "array_agg", "macro_sql": "{% macro array_agg(field_to_agg) -%}\n\n{{ adapter.dispatch('array_agg', 'fivetran_utils') (field_to_agg) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__array_agg"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.720824}, "macro.fivetran_utils.default__array_agg": {"unique_id": "macro.fivetran_utils.default__array_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "name": "default__array_agg", "macro_sql": "{% macro default__array_agg(field_to_agg) %}\n array_agg({{ field_to_agg }})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.7211242}, "macro.fivetran_utils.redshift__array_agg": {"unique_id": "macro.fivetran_utils.redshift__array_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "name": "redshift__array_agg", "macro_sql": "{% macro redshift__array_agg(field_to_agg) %}\n listagg({{ field_to_agg }}, ',')\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.721515}, "macro.fivetran_utils.empty_variable_warning": {"unique_id": "macro.fivetran_utils.empty_variable_warning", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/empty_variable_warning.sql", "original_file_path": "macros/empty_variable_warning.sql", "name": "empty_variable_warning", "macro_sql": "{% macro empty_variable_warning(variable, downstream_model) %}\n\n{% if not var(variable) %}\n{{ log(\n \"\"\"\n Warning: You have passed an empty list to the \"\"\" ~ variable ~ \"\"\".\n As a result, you won't see the history of any columns in the \"\"\" ~ downstream_model ~ \"\"\" model.\n \"\"\",\n info=True\n) }}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.722732}, "macro.fivetran_utils.enabled_vars_one_true": {"unique_id": "macro.fivetran_utils.enabled_vars_one_true", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/enabled_vars_one_true.sql", "original_file_path": "macros/enabled_vars_one_true.sql", "name": "enabled_vars_one_true", "macro_sql": "{% macro enabled_vars_one_true(vars) %}\n\n{% for v in vars %}\n \n {% if var(v, False) == True %}\n {{ return(True) }}\n {% endif %}\n\n{% endfor %}\n\n{{ return(False) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.723952}, "macro.tiktok_ads_source.get_ad_group_history_columns": {"unique_id": "macro.tiktok_ads_source.get_ad_group_history_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_ad_group_history_columns.sql", "original_file_path": "macros/get_ad_group_history_columns.sql", "name": "get_ad_group_history_columns", "macro_sql": "{% macro get_ad_group_history_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"action_days\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"adgroup_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"adgroup_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"advertiser_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"android_osv\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"app_download_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"app_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"app_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"app_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"audience_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"bid\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"bid_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"billing_event\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"budget\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"budget_mode\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"category\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"click_tracking_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"conversion_bid\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cpv_video_duration\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"create_time\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"creative_material_mode\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"dayparting\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"deep_bid_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"deep_cpabid\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"deep_external_action\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"display_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"enable_inventory_filter\", \"datatype\": \"boolean\"},\n {\"name\": \"external_action\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"fallback_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"frequency\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"frequency_schedule\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"gender\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"impression_tracking_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"ios_osv\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"is_comment_disable\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"is_hfss\", \"datatype\": \"boolean\"},\n {\"name\": \"is_new_structure\", \"datatype\": \"boolean\"},\n {\"name\": \"landing_page_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"open_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"open_url_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"opt_status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"optimize_goal\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"pacing\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"package\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"pixel_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"placement_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"profile_image\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"schedule_end_time\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"schedule_start_time\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"schedule_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"skip_learning_phase\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"statistic_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"updated_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"video_download\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"audience\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"excluded_audience\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"location\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"interest_category_v_2\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"pangle_block_app_list_id\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"action_categories\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"placement\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"keywords\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"age\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"languages\", \"datatype\": dbt_utils.type_string()}\n\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_numeric", "macro.dbt_utils.type_string", "macro.dbt_utils.type_float"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.7445319}, "macro.tiktok_ads_source.get_ad_group_report_hourly_columns": {"unique_id": "macro.tiktok_ads_source.get_ad_group_report_hourly_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_ad_group_report_hourly_columns.sql", "original_file_path": "macros/get_ad_group_report_hourly_columns.sql", "name": "get_ad_group_report_hourly_columns", "macro_sql": "{% macro get_ad_group_report_hourly_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"adgroup_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"average_video_play\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"average_video_play_per_user\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"clicks\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"comments\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_1000_reached\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_conversion\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_result\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_secondary_goal_result\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"cpc\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cpm\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"ctr\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"follows\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"impressions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"likes\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"profile_visits\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"profile_visits_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"reach\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"real_time_conversion\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"real_time_conversion_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"real_time_cost_per_conversion\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"real_time_cost_per_result\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"real_time_result\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"real_time_result_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"result\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"result_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"secondary_goal_result\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"secondary_goal_result_rate\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"shares\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"spend\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"stat_time_hour\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"video_play_actions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_100\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_25\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_50\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_75\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_2_s\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_6_s\", \"datatype\": dbt_utils.type_numeric()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_numeric", "macro.dbt_utils.type_float", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.756104}, "macro.tiktok_ads_source.get_advertiser_columns": {"unique_id": "macro.tiktok_ads_source.get_advertiser_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_advertiser_columns.sql", "original_file_path": "macros/get_advertiser_columns.sql", "name": "get_advertiser_columns", "macro_sql": "{% macro get_advertiser_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"address\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"balance\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"company\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"contacter\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"country\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"create_time\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"currency\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"description\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"email\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"industry\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"language\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"license_no\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"license_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"phone_number\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"promotion_area\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"reason\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"role\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"telephone\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"timezone\", \"datatype\": dbt_utils.type_string()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_string", "macro.dbt_utils.type_float", "macro.dbt_utils.type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.762691}, "macro.tiktok_ads_source.get_campaign_history_columns": {"unique_id": "macro.tiktok_ads_source.get_campaign_history_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_campaign_history_columns.sql", "original_file_path": "macros/get_campaign_history_columns.sql", "name": "get_campaign_history_columns", "macro_sql": "{% macro get_campaign_history_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"advertiser_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"budget\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"budget_mode\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"campaign_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"create_time\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"is_new_structure\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"objective_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"opt_status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"split_test_variable\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"updated_at\", \"datatype\": dbt_utils.type_timestamp()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_numeric", "macro.dbt_utils.type_float", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.766666}, "macro.tiktok_ads_source.get_campaign_report_hourly_columns": {"unique_id": "macro.tiktok_ads_source.get_campaign_report_hourly_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_campaign_report_hourly_columns.sql", "original_file_path": "macros/get_campaign_report_hourly_columns.sql", "name": "get_campaign_report_hourly_columns", "macro_sql": "{% macro get_campaign_report_hourly_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"average_video_play\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"average_video_play_per_user\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"clicks\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"comments\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_1000_reached\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_conversion\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_result\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_secondary_goal_result\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"cpc\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cpm\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"ctr\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"follows\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"impressions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"likes\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"profile_visits\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"profile_visits_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"reach\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"real_time_conversion\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"real_time_conversion_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"real_time_cost_per_conversion\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"real_time_cost_per_result\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"real_time_result\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"real_time_result_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"result\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"result_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"secondary_goal_result\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"secondary_goal_result_rate\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"shares\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"spend\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"stat_time_hour\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"video_play_actions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_100\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_25\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_50\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_75\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_2_s\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_6_s\", \"datatype\": dbt_utils.type_numeric()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_float", "macro.dbt_utils.type_numeric", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.7784178}, "macro.tiktok_ads_source.get_ad_history_columns": {"unique_id": "macro.tiktok_ads_source.get_ad_history_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_ad_history_columns.sql", "original_file_path": "macros/get_ad_history_columns.sql", "name": "get_ad_history_columns", "macro_sql": "{% macro get_ad_history_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"ad_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"ad_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"ad_text\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"adgroup_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"advertiser_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"app_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"call_to_action\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"click_tracking_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"create_time\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"display_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"impression_tracking_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"is_aco\", \"datatype\": \"boolean\"},\n {\"name\": \"is_creative_authorized\", \"datatype\": \"boolean\"},\n {\"name\": \"is_new_structure\", \"datatype\": \"boolean\"},\n {\"name\": \"landing_page_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"open_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"opt_status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"playable_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"profile_image\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"updated_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"video_id\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"image_ids\", \"datatype\": dbt_utils.type_string()}\n\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_numeric", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.7856908}, "macro.tiktok_ads_source.get_ad_report_hourly_columns": {"unique_id": "macro.tiktok_ads_source.get_ad_report_hourly_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_ad_report_hourly_columns.sql", "original_file_path": "macros/get_ad_report_hourly_columns.sql", "name": "get_ad_report_hourly_columns", "macro_sql": "{% macro get_ad_report_hourly_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"ad_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"average_video_play\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"average_video_play_per_user\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"clicks\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"comments\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_1000_reached\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_conversion\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_result\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_secondary_goal_result\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"cpc\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cpm\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"ctr\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"follows\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"impressions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"likes\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"profile_visits\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"profile_visits_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"reach\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"real_time_conversion\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"real_time_conversion_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"real_time_cost_per_conversion\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"real_time_cost_per_result\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"real_time_result\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"real_time_result_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"result\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"result_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"secondary_goal_result\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"secondary_goal_result_rate\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"shares\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"spend\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"stat_time_hour\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"video_play_actions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_100\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_25\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_50\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_75\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_2_s\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_6_s\", \"datatype\": dbt_utils.type_numeric()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_numeric", "macro.dbt_utils.type_float", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.797817}}, "docs": {"dbt.__overview__": {"unique_id": "dbt.__overview__", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "overview.md", "original_file_path": "docs/overview.md", "name": "__overview__", "block_contents": "### Welcome!\n\nWelcome to the auto-generated documentation for your dbt project!\n\n### Navigation\n\nYou can use the `Project` and `Database` navigation tabs on the left side of the window to explore the models\nin your project.\n\n#### Project Tab\nThe `Project` tab mirrors the directory structure of your dbt project. In this tab, you can see all of the\nmodels defined in your dbt project, as well as models imported from dbt packages.\n\n#### Database Tab\nThe `Database` tab also exposes your models, but in a format that looks more like a database explorer. This view\nshows relations (tables and views) grouped into database schemas. Note that ephemeral models are _not_ shown\nin this interface, as they do not exist in the database.\n\n### Graph Exploration\nYou can click the blue icon on the bottom-right corner of the page to view the lineage graph of your models.\n\nOn model pages, you'll see the immediate parents and children of the model you're exploring. By clicking the `Expand`\nbutton at the top-right of this lineage pane, you'll be able to see all of the models that are used to build,\nor are built from, the model you're exploring.\n\nOnce expanded, you'll be able to use the `--select` and `--exclude` model selection syntax to filter the\nmodels in the graph. For more information on model selection, check out the [dbt docs](https://docs.getdbt.com/docs/model-selection-syntax).\n\nNote that you can also right-click on models to interactively filter and explore the graph.\n\n---\n\n### More information\n\n- [What is dbt](https://docs.getdbt.com/docs/overview)?\n- Read the [dbt viewpoint](https://docs.getdbt.com/docs/viewpoint)\n- [Installation](https://docs.getdbt.com/docs/installation)\n- Join the [dbt Community](https://www.getdbt.com/community/) for questions and discussion"}}, "exposures": {}, "metrics": {}, "selectors": {}, "disabled": {}, "parent_map": {"model.tiktok_ads.int_tiktok_ads__most_recent_campaign": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"], "model.tiktok_ads.int_tiktok_ads__most_recent_ad": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"], "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__advertiser": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp", "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__ad_history": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_history": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp": ["source.tiktok_ads_source.tiktok_ads.ad_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp": ["source.tiktok_ads_source.tiktok_ads.ad_history"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp": ["source.tiktok_ads_source.tiktok_ads.adgroup_history"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp": ["source.tiktok_ads_source.tiktok_ads.campaign_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp": ["source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp": ["source.tiktok_ads_source.tiktok_ads.campaign_history"], "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp": ["source.tiktok_ads_source.tiktok_ads.advertiser"], "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.fcb8c561bc": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad_group"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at.e2e9914076": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad_group"], "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_ad_id.14e9c145ca": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at.f58d824f65": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad"], "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_campaign_campaign_id.8cefa8981c": ["model.tiktok_ads.int_tiktok_ads__most_recent_campaign"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at.39077adf71": ["model.tiktok_ads.int_tiktok_ads__most_recent_campaign"], "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"], "model.tiktok_ads.tiktok_ads__campaign_report": ["model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "model.tiktok_ads_source.stg_tiktok_ads__advertiser", "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"], "model.tiktok_ads.tiktok_ads__url_report": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad", "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "model.tiktok_ads.tiktok_ads__ad_report": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad", "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "model.tiktok_ads.tiktok_ads__account_report": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad", "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day.cc5f756c69": ["model.tiktok_ads.tiktok_ads__campaign_report"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_report_ad_id__date_day.15357fac89": ["model.tiktok_ads.tiktok_ads__ad_report"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__url_report_ad_id__date_day.8b73e512af": ["model.tiktok_ads.tiktok_ads__url_report"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__account_report_advertiser_id__date_day.7b27a2f43b": ["model.tiktok_ads.tiktok_ads__account_report"], "model.tiktok_ads.tiktok_ads__ad_group_report": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_adapter_ad_id__date_day.c70f86f560": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day.2eb4c2ff6d": ["model.tiktok_ads.tiktok_ads__ad_group_report"], "source.tiktok_ads_source.tiktok_ads.advertiser": [], "source.tiktok_ads_source.tiktok_ads.campaign_history": [], "source.tiktok_ads_source.tiktok_ads.adgroup_history": [], "source.tiktok_ads_source.tiktok_ads.ad_history": [], "source.tiktok_ads_source.tiktok_ads.ad_report_hourly": [], "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly": [], "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly": []}, "child_map": {"model.tiktok_ads.int_tiktok_ads__most_recent_campaign": ["model.tiktok_ads.tiktok_ads__ad_group_report", "model.tiktok_ads.tiktok_ads__ad_report", "model.tiktok_ads.tiktok_ads__campaign_report", "model.tiktok_ads.tiktok_ads__url_report", "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at.39077adf71", "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_campaign_campaign_id.8cefa8981c"], "model.tiktok_ads.int_tiktok_ads__most_recent_ad": ["model.tiktok_ads.tiktok_ads__account_report", "model.tiktok_ads.tiktok_ads__ad_report", "model.tiktok_ads.tiktok_ads__url_report", "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at.f58d824f65", "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_ad_id.14e9c145ca"], "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group": ["model.tiktok_ads.tiktok_ads__ad_group_report", "model.tiktok_ads.tiktok_ads__ad_report", "model.tiktok_ads.tiktok_ads__url_report", "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at.e2e9914076", "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.fcb8c561bc"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de", "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad"], "model.tiktok_ads_source.stg_tiktok_ads__advertiser": ["model.tiktok_ads.tiktok_ads__account_report", "model.tiktok_ads.tiktok_ads__ad_group_report", "model.tiktok_ads.tiktok_ads__ad_report", "model.tiktok_ads.tiktok_ads__campaign_report", "model.tiktok_ads.tiktok_ads__url_report", "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def", "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66"], "model.tiktok_ads_source.stg_tiktok_ads__ad_history": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad", "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1", "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_history": ["model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b", "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1"], "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history", "model.tiktok_ads_source.stg_tiktok_ads__ad_history"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history", "model.tiktok_ads_source.stg_tiktok_ads__campaign_history"], "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser", "model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.fcb8c561bc": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at.e2e9914076": [], "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_ad_id.14e9c145ca": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at.f58d824f65": [], "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_campaign_campaign_id.8cefa8981c": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at.39077adf71": [], "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b": [], "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly": ["model.tiktok_ads.tiktok_ads__campaign_report", "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34", "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly": ["model.tiktok_ads.tiktok_ads__ad_group_report", "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad", "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1"], "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly": ["model.tiktok_ads.tiktok_ads__account_report", "model.tiktok_ads.tiktok_ads__ad_report", "model.tiktok_ads.tiktok_ads__url_report", "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d": [], "model.tiktok_ads.tiktok_ads__campaign_report": ["test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day.cc5f756c69"], "model.tiktok_ads.tiktok_ads__url_report": ["test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__url_report_ad_id__date_day.8b73e512af"], "model.tiktok_ads.tiktok_ads__ad_report": ["test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_report_ad_id__date_day.15357fac89"], "model.tiktok_ads.tiktok_ads__account_report": ["test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__account_report_advertiser_id__date_day.7b27a2f43b"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day.cc5f756c69": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_report_ad_id__date_day.15357fac89": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__url_report_ad_id__date_day.8b73e512af": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__account_report_advertiser_id__date_day.7b27a2f43b": [], "model.tiktok_ads.tiktok_ads__ad_group_report": ["test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day.2eb4c2ff6d"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_adapter_ad_id__date_day.c70f86f560": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day.2eb4c2ff6d": [], "source.tiktok_ads_source.tiktok_ads.advertiser": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp"], "source.tiktok_ads_source.tiktok_ads.campaign_history": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp"], "source.tiktok_ads_source.tiktok_ads.adgroup_history": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp"], "source.tiktok_ads_source.tiktok_ads.ad_history": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp"], "source.tiktok_ads_source.tiktok_ads.ad_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp"], "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp"], "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp"]}} \ No newline at end of file diff --git a/docs/run_results.json b/docs/run_results.json new file mode 100644 index 0000000..69a096d --- /dev/null +++ b/docs/run_results.json @@ -0,0 +1 @@ +{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/run-results/v4.json", "dbt_version": "1.0.0", "generated_at": "2022-07-19T17:45:41.159099Z", "invocation_id": "6dabac40-7cab-45b6-976c-67e398be82f2", "env": {}}, "results": [{"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:47.640915Z", "completed_at": "2022-07-19T17:44:47.704534Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:47.710267Z", "completed_at": "2022-07-19T17:44:48.656179Z"}], "thread_id": "Thread-2", "execution_time": 1.0178651809692383, "adapter_response": {"_message": "OK", "code": "CREATE VIEW"}, "message": "OK", "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:47.641607Z", "completed_at": "2022-07-19T17:44:47.709174Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:47.726167Z", "completed_at": "2022-07-19T17:44:48.727344Z"}], "thread_id": "Thread-4", "execution_time": 1.0883028507232666, "adapter_response": {"_message": "OK", "code": "CREATE VIEW"}, "message": "OK", "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:47.640705Z", "completed_at": "2022-07-19T17:44:47.709614Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:47.762855Z", "completed_at": "2022-07-19T17:44:48.750433Z"}], "thread_id": "Thread-1", "execution_time": 1.1129519939422607, "adapter_response": {"_message": "OK", "code": "CREATE VIEW"}, "message": "OK", "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:47.704094Z", "completed_at": "2022-07-19T17:44:47.736355Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:47.766466Z", "completed_at": "2022-07-19T17:44:48.764035Z"}], "thread_id": "Thread-3", "execution_time": 1.123201847076416, "adapter_response": {"_message": "OK", "code": "CREATE VIEW"}, "message": "OK", "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:48.659369Z", "completed_at": "2022-07-19T17:44:48.664109Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:48.664425Z", "completed_at": "2022-07-19T17:44:49.598610Z"}], "thread_id": "Thread-2", "execution_time": 0.9402968883514404, "adapter_response": {"_message": "OK", "code": "CREATE VIEW"}, "message": "OK", "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:48.730178Z", "completed_at": "2022-07-19T17:44:48.734320Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:48.734665Z", "completed_at": "2022-07-19T17:44:49.697903Z"}], "thread_id": "Thread-4", "execution_time": 0.9685781002044678, "adapter_response": {"_message": "OK", "code": "CREATE VIEW"}, "message": "OK", "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:48.753000Z", "completed_at": "2022-07-19T17:44:48.757172Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:48.757518Z", "completed_at": "2022-07-19T17:44:49.708509Z"}], "thread_id": "Thread-1", "execution_time": 0.9565601348876953, "adapter_response": {"_message": "OK", "code": "CREATE VIEW"}, "message": "OK", "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:48.768395Z", "completed_at": "2022-07-19T17:44:49.169101Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:49.169435Z", "completed_at": "2022-07-19T17:44:51.965630Z"}], "thread_id": "Thread-3", "execution_time": 3.198690891265869, "adapter_response": {"_message": "CREATE TABLE (26.0 rows, 5.3 KB processed)", "code": "CREATE TABLE", "rows_affected": 26, "bytes_processed": 5408}, "message": "CREATE TABLE (26.0 rows, 5.3 KB processed)", "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:49.601194Z", "completed_at": "2022-07-19T17:44:49.928465Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:49.928756Z", "completed_at": "2022-07-19T17:44:52.739865Z"}], "thread_id": "Thread-2", "execution_time": 3.139665126800537, "adapter_response": {"_message": "CREATE TABLE (26.0 rows, 5.3 KB processed)", "code": "CREATE TABLE", "rows_affected": 26, "bytes_processed": 5408}, "message": "CREATE TABLE (26.0 rows, 5.3 KB processed)", "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:49.712107Z", "completed_at": "2022-07-19T17:44:50.140948Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:50.141648Z", "completed_at": "2022-07-19T17:44:53.129881Z"}], "thread_id": "Thread-1", "execution_time": 3.418915033340454, "adapter_response": {"_message": "CREATE TABLE (1.0 rows, 191.0 Bytes processed)", "code": "CREATE TABLE", "rows_affected": 1, "bytes_processed": 191}, "message": "CREATE TABLE (1.0 rows, 191.0 Bytes processed)", "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:49.700428Z", "completed_at": "2022-07-19T17:44:50.092669Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:50.093293Z", "completed_at": "2022-07-19T17:44:53.193656Z"}], "thread_id": "Thread-4", "execution_time": 3.4941351413726807, "adapter_response": {"_message": "CREATE TABLE (2.0 rows, 278.0 Bytes processed)", "code": "CREATE TABLE", "rows_affected": 2, "bytes_processed": 278}, "message": "CREATE TABLE (2.0 rows, 278.0 Bytes processed)", "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:51.969372Z", "completed_at": "2022-07-19T17:44:52.351817Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:52.352167Z", "completed_at": "2022-07-19T17:44:55.413926Z"}], "thread_id": "Thread-3", "execution_time": 3.445889949798584, "adapter_response": {"_message": "CREATE TABLE (1.0 rows, 175.0 Bytes processed)", "code": "CREATE TABLE", "rows_affected": 1, "bytes_processed": 175}, "message": "CREATE TABLE (1.0 rows, 175.0 Bytes processed)", "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:52.743048Z", "completed_at": "2022-07-19T17:44:53.165452Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:53.165862Z", "completed_at": "2022-07-19T17:44:56.223151Z"}], "thread_id": "Thread-2", "execution_time": 3.4815449714660645, "adapter_response": {"_message": "CREATE TABLE (2.0 rows, 138.0 Bytes processed)", "code": "CREATE TABLE", "rows_affected": 2, "bytes_processed": 138}, "message": "CREATE TABLE (2.0 rows, 138.0 Bytes processed)", "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:53.133985Z", "completed_at": "2022-07-19T17:44:53.618472Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:53.618807Z", "completed_at": "2022-07-19T17:44:56.418470Z"}], "thread_id": "Thread-1", "execution_time": 3.2864370346069336, "adapter_response": {"_message": "CREATE TABLE (26.0 rows, 5.3 KB processed)", "code": "CREATE TABLE", "rows_affected": 26, "bytes_processed": 5408}, "message": "CREATE TABLE (26.0 rows, 5.3 KB processed)", "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:55.417551Z", "completed_at": "2022-07-19T17:44:55.459815Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:55.460215Z", "completed_at": "2022-07-19T17:44:58.753625Z"}], "thread_id": "Thread-4", "execution_time": 3.3373730182647705, "adapter_response": {"_message": "CREATE TABLE (5.0 rows, 3.5 KB processed)", "code": "CREATE TABLE", "rows_affected": 5, "bytes_processed": 3589}, "message": "CREATE TABLE (5.0 rows, 3.5 KB processed)", "failures": null, "unique_id": "model.tiktok_ads.tiktok_ads__account_report"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:56.235600Z", "completed_at": "2022-07-19T17:44:56.330057Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:56.330435Z", "completed_at": "2022-07-19T17:44:59.427414Z"}], "thread_id": "Thread-3", "execution_time": 3.1934618949890137, "adapter_response": {"_message": "CREATE TABLE (5.0 rows, 3.8 KB processed)", "code": "CREATE TABLE", "rows_affected": 5, "bytes_processed": 3937}, "message": "CREATE TABLE (5.0 rows, 3.8 KB processed)", "failures": null, "unique_id": "model.tiktok_ads.tiktok_ads__ad_report"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:56.235398Z", "completed_at": "2022-07-19T17:44:56.326152Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:56.326525Z", "completed_at": "2022-07-19T17:44:59.567816Z"}], "thread_id": "Thread-2", "execution_time": 3.3343770503997803, "adapter_response": {"_message": "CREATE TABLE (5.0 rows, 3.8 KB processed)", "code": "CREATE TABLE", "rows_affected": 5, "bytes_processed": 3876}, "message": "CREATE TABLE (5.0 rows, 3.8 KB processed)", "failures": null, "unique_id": "model.tiktok_ads.tiktok_ads__ad_group_report"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:58.757502Z", "completed_at": "2022-07-19T17:44:58.799176Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:58.799601Z", "completed_at": "2022-07-19T17:45:01.886900Z"}], "thread_id": "Thread-4", "execution_time": 3.130856990814209, "adapter_response": {"_message": "CREATE TABLE (5.0 rows, 3.6 KB processed)", "code": "CREATE TABLE", "rows_affected": 5, "bytes_processed": 3644}, "message": "CREATE TABLE (5.0 rows, 3.6 KB processed)", "failures": null, "unique_id": "model.tiktok_ads.tiktok_ads__campaign_report"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:56.422132Z", "completed_at": "2022-07-19T17:44:56.470128Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:56.470488Z", "completed_at": "2022-07-19T17:45:41.153445Z"}], "thread_id": "Thread-1", "execution_time": 44.73266816139221, "adapter_response": {"_message": "CREATE TABLE (5.0 rows, 3.9 KB processed)", "code": "CREATE TABLE", "rows_affected": 5, "bytes_processed": 4021}, "message": "CREATE TABLE (5.0 rows, 3.9 KB processed)", "failures": null, "unique_id": "model.tiktok_ads.tiktok_ads__url_report"}], "elapsed_time": 54.804869174957275, "args": {"write_json": true, "use_colors": true, "printer_width": 80, "version_check": true, "partial_parse": true, "static_parser": true, "profiles_dir": "/Users/renee.li/.dbt", "send_anonymous_usage_stats": true, "event_buffer_size": 100000, "which": "run", "rpc_method": "run", "indirect_selection": "eager"}} \ No newline at end of file From 3bc6d57a888cbf98def2e894df78f11b24ebef2d Mon Sep 17 00:00:00 2001 From: fivetran-reneeli Date: Fri, 22 Jul 2022 20:57:23 +0200 Subject: [PATCH 21/41] readme --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index ca0a809..1d763a7 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,21 @@ vars: ``` ## (Optional) Step 4: Additional configurations + +### Passing Through Additional Metrics +If you would like to pass through additional metrics to the end models that are not by default, add the following configuration to your `dbt_project.yml` file: + +```yml +# dbt_project.yml + +... +vars: + tiktok_ads__ad_group_hourly_passthrough_metrics: ['the', 'list', 'of', 'metric', 'columns', 'to', 'include'] # from tiktok_ads.adgroup_report_hourly + tiktok_ads__ad_hourly_passthrough_metrics: ['the', 'list', 'of', 'metric', 'columns', 'to', 'include'] # from tiktok_ads.ad_report_hourly + tiktok_ads__campaign_hourly_passthrough_metrics: ['the', 'list', 'of', 'metric', 'columns', 'to', 'include'] # from tiktok_ads.campaign_report_hourly +``` +> Please ensure you use due diligence when adding metrics to these models. The metrics added by default have been vetted by the Fivetran team maintaining this package for accuracy. You will want to ensure whichever metrics you pass through are indeed appropriate to aggregate. + ### Changing the Build Schema By default, this package will build the TikTok Ads staging models within a schema titled ( + `_stg_tiktok_ads`) in your target database. If this is not where you would like your TikTok Ads staging data to be written to, add the following configuration to your `dbt_project.yml` file: From 5c821759c86431c298aa611075b1775e8265638e Mon Sep 17 00:00:00 2001 From: fivetran-reneeli Date: Wed, 27 Jul 2022 21:25:08 +0200 Subject: [PATCH 22/41] update --- README.md | 2 +- integration_tests/requirements.txt | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 1d763a7..63f99b1 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ # Tiktok Ads Source dbt Package ([Docs](https://fivetran.github.io/dbt_tiktok_ads_source/)) # šŸ“£ What does this dbt package do? -- Materializes [Tiktok Ads staging tables](https://fivetran.github.io/dbt_tiktok_ads_source/#!/overview/tiktok_ads_source/models/?g_v=1) which leverage data in the format described by [this ERD](https://fivetran.com/docs/applications/tiktok_ads/#schemainformation). These staging tables clean, test, and prepare your Tiktok Ads data from [Fivetran's connector](https://fivetran.com/docs/applications/tiktok_ads) for analysis by doing the following: +- Materializes [Tiktok Ads staging tables](https://fivetran.github.io/dbt-tiktok-ads-source/#!/overview/tiktok-ads-source/models/?g_v=1) which leverage data in the format described by [this ERD](https://fivetran.com/docs/applications/tiktok_ads/#schemainformation). These staging tables clean, test, and prepare your Tiktok Ads data from [Fivetran's connector](https://fivetran.com/docs/applications/tiktok_ads) for analysis by doing the following: - Name columns for consistency across all packages and for easier analysis - Adds freshness tests to source data - Adds column-level testing where applicable. For example, all primary keys are tested for uniqueness and non-null values. diff --git a/integration_tests/requirements.txt b/integration_tests/requirements.txt index 89c6ccb..4913903 100644 --- a/integration_tests/requirements.txt +++ b/integration_tests/requirements.txt @@ -1,6 +1,6 @@ -dbt-snowflake~=1.0.0 -dbt-bigquery~=1.0.0 -dbt-redshift~=1.0.0 -dbt-postgres~=1.0.0 -dbt-spark~=1.0.0 -dbt-spark[PyHive]~=1.0.0 +dbt-snowflake>=1.0.0 +dbt-bigquery>=1.0.0 +dbt-redshift>=1.0.0 +dbt-postgres>=1.0.0 +dbt-spark>=1.0.0 +dbt-spark[PyHive]>=1.0.0 \ No newline at end of file From c37511c937fa9fc62e7b08e296f4a34017ea5563 Mon Sep 17 00:00:00 2001 From: fivetran-reneeli Date: Thu, 28 Jul 2022 18:14:32 +0200 Subject: [PATCH 23/41] rm fivetran synced field since not used --- macros/get_ad_group_history_columns.sql | 1 - macros/get_ad_group_report_hourly_columns.sql | 1 - macros/get_ad_history_columns.sql | 1 - macros/get_ad_report_hourly_columns.sql | 1 - macros/get_advertiser_columns.sql | 1 - macros/get_campaign_history_columns.sql | 1 - macros/get_campaign_report_hourly_columns.sql | 1 - models/stg_tiktok_ads.yml | 21 ++----------------- models/stg_tiktok_ads__ad_group_history.sql | 9 ++------ ...stg_tiktok_ads__ad_group_report_hourly.sql | 11 ++++------ models/stg_tiktok_ads__ad_history.sql | 10 +++------ models/stg_tiktok_ads__ad_report_hourly.sql | 9 +++----- models/stg_tiktok_ads__advertiser.sql | 11 ++++------ models/stg_tiktok_ads__campaign_history.sql | 11 +++------- ...stg_tiktok_ads__campaign_report_hourly.sql | 15 ++++++------- 15 files changed, 27 insertions(+), 77 deletions(-) diff --git a/macros/get_ad_group_history_columns.sql b/macros/get_ad_group_history_columns.sql index 4ae1909..66527a8 100644 --- a/macros/get_ad_group_history_columns.sql +++ b/macros/get_ad_group_history_columns.sql @@ -1,7 +1,6 @@ {% macro get_ad_group_history_columns() %} {% set columns = [ - {"name": "_fivetran_synced", "datatype": dbt_utils.type_timestamp()}, {"name": "action_days", "datatype": dbt_utils.type_numeric()}, {"name": "adgroup_id", "datatype": dbt_utils.type_numeric()}, {"name": "adgroup_name", "datatype": dbt_utils.type_string()}, diff --git a/macros/get_ad_group_report_hourly_columns.sql b/macros/get_ad_group_report_hourly_columns.sql index 21c486c..dc256d3 100644 --- a/macros/get_ad_group_report_hourly_columns.sql +++ b/macros/get_ad_group_report_hourly_columns.sql @@ -1,7 +1,6 @@ {% macro get_ad_group_report_hourly_columns() %} {% set columns = [ - {"name": "_fivetran_synced", "datatype": dbt_utils.type_timestamp()}, {"name": "adgroup_id", "datatype": dbt_utils.type_numeric()}, {"name": "average_video_play", "datatype": dbt_utils.type_float()}, {"name": "average_video_play_per_user", "datatype": dbt_utils.type_float()}, diff --git a/macros/get_ad_history_columns.sql b/macros/get_ad_history_columns.sql index 47fa90f..9b763fb 100644 --- a/macros/get_ad_history_columns.sql +++ b/macros/get_ad_history_columns.sql @@ -1,7 +1,6 @@ {% macro get_ad_history_columns() %} {% set columns = [ - {"name": "_fivetran_synced", "datatype": dbt_utils.type_timestamp()}, {"name": "ad_id", "datatype": dbt_utils.type_numeric()}, {"name": "ad_name", "datatype": dbt_utils.type_string()}, {"name": "adgroup_id", "datatype": dbt_utils.type_numeric()}, diff --git a/macros/get_ad_report_hourly_columns.sql b/macros/get_ad_report_hourly_columns.sql index 94a115b..3045c4a 100644 --- a/macros/get_ad_report_hourly_columns.sql +++ b/macros/get_ad_report_hourly_columns.sql @@ -1,7 +1,6 @@ {% macro get_ad_report_hourly_columns() %} {% set columns = [ - {"name": "_fivetran_synced", "datatype": dbt_utils.type_timestamp()}, {"name": "ad_id", "datatype": dbt_utils.type_numeric()}, {"name": "average_video_play", "datatype": dbt_utils.type_float()}, {"name": "average_video_play_per_user", "datatype": dbt_utils.type_float()}, diff --git a/macros/get_advertiser_columns.sql b/macros/get_advertiser_columns.sql index bbaf597..e863dd0 100644 --- a/macros/get_advertiser_columns.sql +++ b/macros/get_advertiser_columns.sql @@ -1,7 +1,6 @@ {% macro get_advertiser_columns() %} {% set columns = [ - {"name": "_fivetran_synced", "datatype": dbt_utils.type_timestamp()}, {"name": "address", "datatype": dbt_utils.type_string()}, {"name": "balance", "datatype": dbt_utils.type_float()}, {"name": "company", "datatype": dbt_utils.type_string()}, diff --git a/macros/get_campaign_history_columns.sql b/macros/get_campaign_history_columns.sql index e3a1298..13a87ed 100644 --- a/macros/get_campaign_history_columns.sql +++ b/macros/get_campaign_history_columns.sql @@ -1,7 +1,6 @@ {% macro get_campaign_history_columns() %} {% set columns = [ - {"name": "_fivetran_synced", "datatype": dbt_utils.type_timestamp()}, {"name": "advertiser_id", "datatype": dbt_utils.type_numeric()}, {"name": "campaign_id", "datatype": dbt_utils.type_numeric()}, {"name": "campaign_name", "datatype": dbt_utils.type_string()}, diff --git a/macros/get_campaign_report_hourly_columns.sql b/macros/get_campaign_report_hourly_columns.sql index c432b34..27f82e5 100644 --- a/macros/get_campaign_report_hourly_columns.sql +++ b/macros/get_campaign_report_hourly_columns.sql @@ -2,7 +2,6 @@ {% set columns = [ {"name": "campaign_id", "datatype": dbt_utils.type_numeric()}, - {"name": "_fivetran_synced", "datatype": dbt_utils.type_timestamp()}, {"name": "ad_id", "datatype": dbt_utils.type_numeric()}, {"name": "average_video_play", "datatype": dbt_utils.type_float()}, {"name": "average_video_play_per_user", "datatype": dbt_utils.type_float()}, diff --git a/models/stg_tiktok_ads.yml b/models/stg_tiktok_ads.yml index 37e4e1e..c976612 100644 --- a/models/stg_tiktok_ads.yml +++ b/models/stg_tiktok_ads.yml @@ -45,10 +45,6 @@ models: description: Fixed phone number, desensitised data - name: timezone description: Ad account time zone including GMT offset - - name: _fivetran_synced - description: Timestamp of when Fivetran synced a record. - - name: is_most_recent_record - description: Whether record is the most recent one for this particular grain. - name: stg_tiktok_ads__ad_group_history @@ -99,11 +95,8 @@ models: description: Landing page URL. - name: languages description: Codes of the languages that you want to target. - - name: _fivetran_synced - description: Timestamp of when Fivetran synced a record. - name: is_most_recent_record description: Whether record is the most recent one for this particular grain. - - name: stg_tiktok_ads__ad_history description: Each record represents data for each ad. @@ -151,8 +144,6 @@ models: description: The utm_content parameter of the ad, extracted from the `landing_page_url`. - name: utm_term description: The utm_term parameter of the ad, extracted from the `landing_page_url`. - - name: _fivetran_synced - description: Timestamp of when Fivetran synced a record. - name: is_most_recent_record description: Whether record is the most recent one for this particular grain. @@ -179,8 +170,6 @@ models: description: Campaign Type, indicates the campaign is a regular campaign or iOS 14 campaign. - name: split_test_variable description: Split Test variables. Optional values; TARGETING, BIDDING_OPTIMIZATION , CREATIVE. - - name: _fivetran_synced - description: Timestamp of when Fivetran synced a record. - name: is_most_recent_record description: Whether record is the most recent one for this particular grain. @@ -257,9 +246,7 @@ models: - name: spend description: The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule. - name: likes - description: The number of likes your video creative received within 1 day of a user seeing a paid ad. - - name: _fivetran_synced - description: Timestamp of when Fivetran synced a record. + description: The number of likes your video creative received within 1 day of a user seeing a paid ad. - name: stg_tiktok_ads__ad_group_report_hourly @@ -335,8 +322,6 @@ models: description: The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule. - name: likes description: The number of likes your video creative received within 1 day of a user seeing a paid ad. - - name: _fivetran_synced - description: Timestamp of when Fivetran synced a record. - name: stg_tiktok_ads__campaign_report_hourly @@ -411,6 +396,4 @@ models: - name: spend description: The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule. - name: likes - description: The number of likes your video creative received within 1 day of a user seeing a paid ad. - - name: _fivetran_synced - description: Timestamp of when Fivetran synced a record. \ No newline at end of file + description: The number of likes your video creative received within 1 day of a user seeing a paid ad. \ No newline at end of file diff --git a/models/stg_tiktok_ads__ad_group_history.sql b/models/stg_tiktok_ads__ad_group_history.sql index 4f7426a..bc43c6f 100644 --- a/models/stg_tiktok_ads__ad_group_history.sql +++ b/models/stg_tiktok_ads__ad_group_history.sql @@ -2,7 +2,6 @@ with base as ( select * from {{ ref('stg_tiktok_ads__ad_group_history_tmp') }} - ), fields as ( @@ -16,12 +15,11 @@ fields as ( }} from base - ), final as ( - select + select adgroup_id as ad_group_id, cast(updated_at as {{ dbt_utils.type_timestamp() }}) as updated_at, advertiser_id, @@ -39,10 +37,8 @@ final as ( frequency_schedule, gender, languages, - landing_page_url, - cast(_fivetran_synced as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced + landing_page_url from fields - ), most_recent as ( @@ -51,7 +47,6 @@ most_recent as ( *, row_number() over (partition by ad_group_id order by updated_at desc) = 1 as is_most_recent_record from final - ) select * from most_recent \ No newline at end of file diff --git a/models/stg_tiktok_ads__ad_group_report_hourly.sql b/models/stg_tiktok_ads__ad_group_report_hourly.sql index f0d1579..8028775 100644 --- a/models/stg_tiktok_ads__ad_group_report_hourly.sql +++ b/models/stg_tiktok_ads__ad_group_report_hourly.sql @@ -2,7 +2,6 @@ with base as ( select * from {{ ref('stg_tiktok_ads__ad_group_report_hourly_tmp') }} - ), fields as ( @@ -20,15 +19,13 @@ fields as ( {% endfor %} from base - ), final as ( select - adgroup_id as ad_group_id, - cast(_fivetran_synced as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced, - stat_time_hour, + adgroup_id as ad_group_id, + cast(stat_time_hour as {{ dbt_utils.type_timestamp() }}) as stat_time_hour, cpc, cpm, ctr, @@ -57,8 +54,8 @@ final as ( , {{ metric }} {% endfor %} from fields - ) -select * from final +select * +from final diff --git a/models/stg_tiktok_ads__ad_history.sql b/models/stg_tiktok_ads__ad_history.sql index d629674..587ec62 100644 --- a/models/stg_tiktok_ads__ad_history.sql +++ b/models/stg_tiktok_ads__ad_history.sql @@ -2,7 +2,6 @@ with base as ( select * from {{ ref('stg_tiktok_ads__ad_history_tmp') }} - ), fields as ( @@ -16,7 +15,6 @@ fields as ( }} from base - ), final as ( @@ -39,10 +37,8 @@ final as ( {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_campaign') }} as utm_campaign, {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_content') }} as utm_content, {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_term') }} as utm_term, - landing_page_url, - cast(_fivetran_synced as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced + landing_page_url from fields - ), most_recent as ( @@ -51,7 +47,7 @@ most_recent as ( *, row_number() over (partition by ad_id order by updated_at desc) = 1 as is_most_recent_record from final - ) -select * from most_recent \ No newline at end of file +select * +from most_recent \ No newline at end of file diff --git a/models/stg_tiktok_ads__ad_report_hourly.sql b/models/stg_tiktok_ads__ad_report_hourly.sql index 22d4ee9..15cc96d 100644 --- a/models/stg_tiktok_ads__ad_report_hourly.sql +++ b/models/stg_tiktok_ads__ad_report_hourly.sql @@ -2,7 +2,6 @@ with base as ( select * from {{ ref('stg_tiktok_ads__ad_report_hourly_tmp') }} - ), fields as ( @@ -20,15 +19,13 @@ fields as ( {% endfor %} from base - ), final as ( select ad_id, - cast(_fivetran_synced as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced, - stat_time_hour, + cast(stat_time_hour as {{ dbt_utils.type_timestamp() }}) as stat_time_hour, cpc, cpm, ctr, @@ -57,8 +54,8 @@ final as ( , {{ metric }} {% endfor %} from fields - ) -select * from final +select * +from final diff --git a/models/stg_tiktok_ads__advertiser.sql b/models/stg_tiktok_ads__advertiser.sql index 17cbdd8..b49c4d4 100644 --- a/models/stg_tiktok_ads__advertiser.sql +++ b/models/stg_tiktok_ads__advertiser.sql @@ -2,7 +2,6 @@ with base as ( select * from {{ ref('stg_tiktok_ads__advertiser_tmp') }} - ), fields as ( @@ -16,8 +15,7 @@ fields as ( }} from base - -), +), final as ( @@ -36,10 +34,9 @@ final as ( name as advertiser_name, phone_number, telephone, - timezone, - cast(_fivetran_synced as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced + timezone from fields - ) -select * from final \ No newline at end of file +select * +from final \ No newline at end of file diff --git a/models/stg_tiktok_ads__campaign_history.sql b/models/stg_tiktok_ads__campaign_history.sql index cbfefb0..96fe4b9 100644 --- a/models/stg_tiktok_ads__campaign_history.sql +++ b/models/stg_tiktok_ads__campaign_history.sql @@ -2,7 +2,6 @@ with base as ( select * from {{ ref('stg_tiktok_ads__campaign_history_tmp') }} - ), fields as ( @@ -16,7 +15,6 @@ fields as ( }} from base - ), final as ( @@ -27,11 +25,8 @@ final as ( advertiser_id, campaign_name, campaign_type, - split_test_variable, - cast(_fivetran_synced as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced - + split_test_variable from fields - ), most_recent as ( @@ -40,7 +35,7 @@ most_recent as ( *, row_number() over (partition by campaign_id order by updated_at desc) = 1 as is_most_recent_record from final - ) -select * from most_recent \ No newline at end of file +select * +from most_recent \ No newline at end of file diff --git a/models/stg_tiktok_ads__campaign_report_hourly.sql b/models/stg_tiktok_ads__campaign_report_hourly.sql index f0135d4..a696ea7 100644 --- a/models/stg_tiktok_ads__campaign_report_hourly.sql +++ b/models/stg_tiktok_ads__campaign_report_hourly.sql @@ -2,7 +2,6 @@ with base as ( select * from {{ ref('stg_tiktok_ads__campaign_report_hourly_tmp') }} - ), fields as ( @@ -20,22 +19,20 @@ fields as ( {% endfor %} from base - ), final as ( select - campaign_id, - cast(_fivetran_synced as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced, - stat_time_hour, + campaign_id, + cast(stat_time_hour as {{ dbt_utils.type_timestamp() }}) as stat_time_hour, cpc, - cpm, + cpm, ctr, impressions, clicks, spend, - reach, + reach, conversion, cost_per_conversion, conversion_rate, @@ -57,8 +54,8 @@ final as ( , {{ metric }} {% endfor %} from fields - ) -select * from final +select * +from final From fc6b85549bfb4a7ea2aaf5707fc77d066e7c3049 Mon Sep 17 00:00:00 2001 From: fivetran-reneeli Date: Thu, 28 Jul 2022 18:14:40 +0200 Subject: [PATCH 24/41] add freshness test --- models/src_tiktok_ads.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/models/src_tiktok_ads.yml b/models/src_tiktok_ads.yml index 0787e6f..8142c51 100644 --- a/models/src_tiktok_ads.yml +++ b/models/src_tiktok_ads.yml @@ -8,6 +8,10 @@ sources: loader: fivetran loaded_at_field: _fivetran_synced + freshness: + warn_after: {count: 48, period: hour} + error_after: {count: 168, period: hour} + tables: - name: advertiser identifier: "{{ var('tiktok_ads__advertiser_identifier', 'advertiser') }}" From 8e17b440ec0352a3ccfd2cb3b94274b04c582ed9 Mon Sep 17 00:00:00 2001 From: fivetran-reneeli Date: Thu, 28 Jul 2022 18:14:48 +0200 Subject: [PATCH 25/41] update naming of integration test --- integration_tests/dbt_project.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration_tests/dbt_project.yml b/integration_tests/dbt_project.yml index a819cc3..a1927bf 100644 --- a/integration_tests/dbt_project.yml +++ b/integration_tests/dbt_project.yml @@ -1,4 +1,4 @@ -name: 'tiktok_ads_source_integration_tests' +name: 'tiktok_ads_source_integration_tests_1' version: '0.2.0' profile: 'integration_tests' config-version: 2 From d5573a534f51d997542663884f1b27357249c572 Mon Sep 17 00:00:00 2001 From: fivetran-reneeli Date: Thu, 28 Jul 2022 19:11:49 +0200 Subject: [PATCH 26/41] docs --- README.md | 4 +- docs/catalog.json | 1 + docs/index.html | 102 ++++++++++++++++++++++++++++++++++++++++++ docs/manifest.json | 2 +- docs/run_results.json | 2 +- 5 files changed, 107 insertions(+), 4 deletions(-) create mode 100644 docs/catalog.json create mode 100644 docs/index.html diff --git a/README.md b/README.md index 63f99b1..6b62951 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ # Tiktok Ads Source dbt Package ([Docs](https://fivetran.github.io/dbt_tiktok_ads_source/)) # šŸ“£ What does this dbt package do? -- Materializes [Tiktok Ads staging tables](https://fivetran.github.io/dbt-tiktok-ads-source/#!/overview/tiktok-ads-source/models/?g_v=1) which leverage data in the format described by [this ERD](https://fivetran.com/docs/applications/tiktok_ads/#schemainformation). These staging tables clean, test, and prepare your Tiktok Ads data from [Fivetran's connector](https://fivetran.com/docs/applications/tiktok_ads) for analysis by doing the following: +- Materializes [Tiktok Ads staging tables](https://fivetran.github.io/dbt_tiktok_ads_source/#!/overview/tiktok-ads-source/models/?g_v=1) which leverage data in the format described by [this ERD](https://fivetran.com/docs/applications/tiktok_ads/#schemainformation). These staging tables clean, test, and prepare your Tiktok Ads data from [Fivetran's connector](https://fivetran.com/docs/applications/tiktok_ads) for analysis by doing the following: - Name columns for consistency across all packages and for easier analysis - Adds freshness tests to source data - Adds column-level testing where applicable. For example, all primary keys are tested for uniqueness and non-null values. @@ -36,7 +36,7 @@ packages: ``` ## Step 3: Define database and schema variables -By default, this package runs using your destination and the `tiktok_ads` schema. If this is not where your Tiktok Ads data is (for example, if your Tiktok schema is named `tiktok_ads_fivetran`), add the following configuration to your root `dbt_project.yml` file: +By default, this package runs using your destination and the `tiktok_ads` schema. If this is not where your Tiktok Ads data is (for example, if your Tiktok schema is named `tiktok_ads_fivetran`), you would add the following configuration to your root `dbt_project.yml` file with your custom database and schema names: ```yml vars: diff --git a/docs/catalog.json b/docs/catalog.json new file mode 100644 index 0000000..7758ce5 --- /dev/null +++ b/docs/catalog.json @@ -0,0 +1 @@ +{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/catalog/v1.json", "dbt_version": "1.0.0", "generated_at": "2022-07-28T16:21:17.346472Z", "invocation_id": "73d9028b-4406-406d-9101-01780cecfbb9", "env": {}}, "nodes": {"model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp": {"metadata": {"type": "view", "schema": "schema", "name": "stg_tiktok_ads__campaign_report_hourly_tmp", "database": "database", "comment": null, "owner": null}, "columns": {"campaign_id": {"type": "INT64", "index": 1, "name": "campaign_id", "comment": null}, "stat_time_hour": {"type": "DATETIME", "index": 2, "name": "stat_time_hour", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "average_video_play": {"type": "FLOAT64", "index": 4, "name": "average_video_play", "comment": null}, "average_video_play_per_user": {"type": "FLOAT64", "index": 5, "name": "average_video_play_per_user", "comment": null}, "clicks": {"type": "INT64", "index": 6, "name": "clicks", "comment": null}, "comments": {"type": "INT64", "index": 7, "name": "comments", "comment": null}, "conversion": {"type": "INT64", "index": 8, "name": "conversion", "comment": null}, "conversion_rate": {"type": "FLOAT64", "index": 9, "name": "conversion_rate", "comment": null}, "cost_per_1000_reached": {"type": "FLOAT64", "index": 10, "name": "cost_per_1000_reached", "comment": null}, "cost_per_conversion": {"type": "FLOAT64", "index": 11, "name": "cost_per_conversion", "comment": null}, "cost_per_result": {"type": "FLOAT64", "index": 12, "name": "cost_per_result", "comment": null}, "cost_per_secondary_goal_result": {"type": "STRING", "index": 13, "name": "cost_per_secondary_goal_result", "comment": null}, "cpc": {"type": "FLOAT64", "index": 14, "name": "cpc", "comment": null}, "cpm": {"type": "FLOAT64", "index": 15, "name": "cpm", "comment": null}, "ctr": {"type": "FLOAT64", "index": 16, "name": "ctr", "comment": null}, "follows": {"type": "INT64", "index": 17, "name": "follows", "comment": null}, "impressions": {"type": "INT64", "index": 18, "name": "impressions", "comment": null}, "likes": {"type": "INT64", "index": 19, "name": "likes", "comment": null}, "profile_visits": {"type": "INT64", "index": 20, "name": "profile_visits", "comment": null}, "profile_visits_rate": {"type": "FLOAT64", "index": 21, "name": "profile_visits_rate", "comment": null}, "reach": {"type": "INT64", "index": 22, "name": "reach", "comment": null}, "real_time_conversion": {"type": "INT64", "index": 23, "name": "real_time_conversion", "comment": null}, "real_time_conversion_rate": {"type": "FLOAT64", "index": 24, "name": "real_time_conversion_rate", "comment": null}, "real_time_cost_per_conversion": {"type": "FLOAT64", "index": 25, "name": "real_time_cost_per_conversion", "comment": null}, "real_time_cost_per_result": {"type": "FLOAT64", "index": 26, "name": "real_time_cost_per_result", "comment": null}, "real_time_result": {"type": "INT64", "index": 27, "name": "real_time_result", "comment": null}, "real_time_result_rate": {"type": "FLOAT64", "index": 28, "name": "real_time_result_rate", "comment": null}, "result": {"type": "INT64", "index": 29, "name": "result", "comment": null}, "result_rate": {"type": "FLOAT64", "index": 30, "name": "result_rate", "comment": null}, "sales_lead": {"type": "FLOAT64", "index": 31, "name": "sales_lead", "comment": null}, "secondary_goal_result": {"type": "STRING", "index": 32, "name": "secondary_goal_result", "comment": null}, "secondary_goal_result_rate": {"type": "STRING", "index": 33, "name": "secondary_goal_result_rate", "comment": null}, "shares": {"type": "INT64", "index": 34, "name": "shares", "comment": null}, "spend": {"type": "FLOAT64", "index": 35, "name": "spend", "comment": null}, "total_purchase": {"type": "FLOAT64", "index": 36, "name": "total_purchase", "comment": null}, "total_purchase_value": {"type": "FLOAT64", "index": 37, "name": "total_purchase_value", "comment": null}, "total_sales_lead": {"type": "FLOAT64", "index": 38, "name": "total_sales_lead", "comment": null}, "total_sales_lead_value": {"type": "FLOAT64", "index": 39, "name": "total_sales_lead_value", "comment": null}, "video_play_actions": {"type": "INT64", "index": 40, "name": "video_play_actions", "comment": null}, "video_views_p_100": {"type": "INT64", "index": 41, "name": "video_views_p_100", "comment": null}, "video_views_p_25": {"type": "INT64", "index": 42, "name": "video_views_p_25", "comment": null}, "video_views_p_50": {"type": "INT64", "index": 43, "name": "video_views_p_50", "comment": null}, "video_views_p_75": {"type": "INT64", "index": 44, "name": "video_views_p_75", "comment": null}, "video_watched_2_s": {"type": "INT64", "index": 45, "name": "video_watched_2_s", "comment": null}, "video_watched_6_s": {"type": "INT64", "index": 46, "name": "video_watched_6_s", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp": {"metadata": {"type": "view", "schema": "schema", "name": "stg_tiktok_ads__ad_report_hourly_tmp", "database": "database", "comment": null, "owner": null}, "columns": {"ad_id": {"type": "INT64", "index": 1, "name": "ad_id", "comment": null}, "stat_time_hour": {"type": "DATETIME", "index": 2, "name": "stat_time_hour", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "average_video_play": {"type": "FLOAT64", "index": 4, "name": "average_video_play", "comment": null}, "average_video_play_per_user": {"type": "FLOAT64", "index": 5, "name": "average_video_play_per_user", "comment": null}, "clicks": {"type": "INT64", "index": 6, "name": "clicks", "comment": null}, "comments": {"type": "INT64", "index": 7, "name": "comments", "comment": null}, "conversion": {"type": "INT64", "index": 8, "name": "conversion", "comment": null}, "conversion_rate": {"type": "FLOAT64", "index": 9, "name": "conversion_rate", "comment": null}, "cost_per_1000_reached": {"type": "FLOAT64", "index": 10, "name": "cost_per_1000_reached", "comment": null}, "cost_per_conversion": {"type": "FLOAT64", "index": 11, "name": "cost_per_conversion", "comment": null}, "cost_per_result": {"type": "FLOAT64", "index": 12, "name": "cost_per_result", "comment": null}, "cost_per_secondary_goal_result": {"type": "STRING", "index": 13, "name": "cost_per_secondary_goal_result", "comment": null}, "cpc": {"type": "FLOAT64", "index": 14, "name": "cpc", "comment": null}, "cpm": {"type": "FLOAT64", "index": 15, "name": "cpm", "comment": null}, "ctr": {"type": "FLOAT64", "index": 16, "name": "ctr", "comment": null}, "follows": {"type": "INT64", "index": 17, "name": "follows", "comment": null}, "impressions": {"type": "INT64", "index": 18, "name": "impressions", "comment": null}, "likes": {"type": "INT64", "index": 19, "name": "likes", "comment": null}, "profile_visits": {"type": "INT64", "index": 20, "name": "profile_visits", "comment": null}, "profile_visits_rate": {"type": "FLOAT64", "index": 21, "name": "profile_visits_rate", "comment": null}, "reach": {"type": "INT64", "index": 22, "name": "reach", "comment": null}, "real_time_conversion": {"type": "INT64", "index": 23, "name": "real_time_conversion", "comment": null}, "real_time_conversion_rate": {"type": "FLOAT64", "index": 24, "name": "real_time_conversion_rate", "comment": null}, "real_time_cost_per_conversion": {"type": "FLOAT64", "index": 25, "name": "real_time_cost_per_conversion", "comment": null}, "real_time_cost_per_result": {"type": "FLOAT64", "index": 26, "name": "real_time_cost_per_result", "comment": null}, "real_time_result": {"type": "INT64", "index": 27, "name": "real_time_result", "comment": null}, "real_time_result_rate": {"type": "FLOAT64", "index": 28, "name": "real_time_result_rate", "comment": null}, "result": {"type": "INT64", "index": 29, "name": "result", "comment": null}, "result_rate": {"type": "FLOAT64", "index": 30, "name": "result_rate", "comment": null}, "sales_lead": {"type": "FLOAT64", "index": 31, "name": "sales_lead", "comment": null}, "secondary_goal_result": {"type": "STRING", "index": 32, "name": "secondary_goal_result", "comment": null}, "secondary_goal_result_rate": {"type": "STRING", "index": 33, "name": "secondary_goal_result_rate", "comment": null}, "shares": {"type": "INT64", "index": 34, "name": "shares", "comment": null}, "spend": {"type": "FLOAT64", "index": 35, "name": "spend", "comment": null}, "total_purchase": {"type": "FLOAT64", "index": 36, "name": "total_purchase", "comment": null}, "total_purchase_value": {"type": "FLOAT64", "index": 37, "name": "total_purchase_value", "comment": null}, "total_sales_lead": {"type": "FLOAT64", "index": 38, "name": "total_sales_lead", "comment": null}, "total_sales_lead_value": {"type": "FLOAT64", "index": 39, "name": "total_sales_lead_value", "comment": null}, "video_play_actions": {"type": "INT64", "index": 40, "name": "video_play_actions", "comment": null}, "video_views_p_100": {"type": "INT64", "index": 41, "name": "video_views_p_100", "comment": null}, "video_views_p_25": {"type": "INT64", "index": 42, "name": "video_views_p_25", "comment": null}, "video_views_p_50": {"type": "INT64", "index": 43, "name": "video_views_p_50", "comment": null}, "video_views_p_75": {"type": "INT64", "index": 44, "name": "video_views_p_75", "comment": null}, "video_watched_2_s": {"type": "INT64", "index": 45, "name": "video_watched_2_s", "comment": null}, "video_watched_6_s": {"type": "INT64", "index": 46, "name": "video_watched_6_s", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp"}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly": {"metadata": {"type": "table", "schema": "schema", "name": "stg_tiktok_ads__campaign_report_hourly", "database": "database", "comment": null, "owner": null}, "columns": {"campaign_id": {"type": "INT64", "index": 1, "name": "campaign_id", "comment": null}, "stat_time_hour": {"type": "TIMESTAMP", "index": 2, "name": "stat_time_hour", "comment": null}, "cpc": {"type": "FLOAT64", "index": 3, "name": "cpc", "comment": null}, "cpm": {"type": "FLOAT64", "index": 4, "name": "cpm", "comment": null}, "ctr": {"type": "FLOAT64", "index": 5, "name": "ctr", "comment": null}, "impressions": {"type": "INT64", "index": 6, "name": "impressions", "comment": null}, "clicks": {"type": "INT64", "index": 7, "name": "clicks", "comment": null}, "spend": {"type": "FLOAT64", "index": 8, "name": "spend", "comment": null}, "reach": {"type": "INT64", "index": 9, "name": "reach", "comment": null}, "conversion": {"type": "INT64", "index": 10, "name": "conversion", "comment": null}, "cost_per_conversion": {"type": "FLOAT64", "index": 11, "name": "cost_per_conversion", "comment": null}, "conversion_rate": {"type": "FLOAT64", "index": 12, "name": "conversion_rate", "comment": null}, "likes": {"type": "INT64", "index": 13, "name": "likes", "comment": null}, "comments": {"type": "INT64", "index": 14, "name": "comments", "comment": null}, "shares": {"type": "INT64", "index": 15, "name": "shares", "comment": null}, "profile_visits": {"type": "INT64", "index": 16, "name": "profile_visits", "comment": null}, "follows": {"type": "INT64", "index": 17, "name": "follows", "comment": null}, "video_play_actions": {"type": "INT64", "index": 18, "name": "video_play_actions", "comment": null}, "video_watched_2_s": {"type": "INT64", "index": 19, "name": "video_watched_2_s", "comment": null}, "video_watched_6_s": {"type": "INT64", "index": 20, "name": "video_watched_6_s", "comment": null}, "video_views_p_25": {"type": "INT64", "index": 21, "name": "video_views_p_25", "comment": null}, "video_views_p_50": {"type": "INT64", "index": 22, "name": "video_views_p_50", "comment": null}, "video_views_p_75": {"type": "INT64", "index": 23, "name": "video_views_p_75", "comment": null}, "average_video_play": {"type": "FLOAT64", "index": 24, "name": "average_video_play", "comment": null}, "average_video_play_per_user": {"type": "FLOAT64", "index": 25, "name": "average_video_play_per_user", "comment": null}, "result": {"type": "INT64", "index": 26, "name": "result", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 26.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 5408.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp": {"metadata": {"type": "view", "schema": "schema", "name": "stg_tiktok_ads__ad_group_report_hourly_tmp", "database": "database", "comment": null, "owner": null}, "columns": {"adgroup_id": {"type": "INT64", "index": 1, "name": "adgroup_id", "comment": null}, "stat_time_hour": {"type": "DATETIME", "index": 2, "name": "stat_time_hour", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "average_video_play": {"type": "FLOAT64", "index": 4, "name": "average_video_play", "comment": null}, "average_video_play_per_user": {"type": "FLOAT64", "index": 5, "name": "average_video_play_per_user", "comment": null}, "clicks": {"type": "INT64", "index": 6, "name": "clicks", "comment": null}, "comments": {"type": "INT64", "index": 7, "name": "comments", "comment": null}, "conversion": {"type": "INT64", "index": 8, "name": "conversion", "comment": null}, "conversion_rate": {"type": "FLOAT64", "index": 9, "name": "conversion_rate", "comment": null}, "cost_per_1000_reached": {"type": "FLOAT64", "index": 10, "name": "cost_per_1000_reached", "comment": null}, "cost_per_conversion": {"type": "FLOAT64", "index": 11, "name": "cost_per_conversion", "comment": null}, "cost_per_result": {"type": "FLOAT64", "index": 12, "name": "cost_per_result", "comment": null}, "cost_per_secondary_goal_result": {"type": "STRING", "index": 13, "name": "cost_per_secondary_goal_result", "comment": null}, "cpc": {"type": "FLOAT64", "index": 14, "name": "cpc", "comment": null}, "cpm": {"type": "FLOAT64", "index": 15, "name": "cpm", "comment": null}, "ctr": {"type": "FLOAT64", "index": 16, "name": "ctr", "comment": null}, "follows": {"type": "INT64", "index": 17, "name": "follows", "comment": null}, "impressions": {"type": "INT64", "index": 18, "name": "impressions", "comment": null}, "likes": {"type": "INT64", "index": 19, "name": "likes", "comment": null}, "profile_visits": {"type": "INT64", "index": 20, "name": "profile_visits", "comment": null}, "profile_visits_rate": {"type": "FLOAT64", "index": 21, "name": "profile_visits_rate", "comment": null}, "reach": {"type": "INT64", "index": 22, "name": "reach", "comment": null}, "real_time_conversion": {"type": "INT64", "index": 23, "name": "real_time_conversion", "comment": null}, "real_time_conversion_rate": {"type": "FLOAT64", "index": 24, "name": "real_time_conversion_rate", "comment": null}, "real_time_cost_per_conversion": {"type": "FLOAT64", "index": 25, "name": "real_time_cost_per_conversion", "comment": null}, "real_time_cost_per_result": {"type": "FLOAT64", "index": 26, "name": "real_time_cost_per_result", "comment": null}, "real_time_result": {"type": "INT64", "index": 27, "name": "real_time_result", "comment": null}, "real_time_result_rate": {"type": "FLOAT64", "index": 28, "name": "real_time_result_rate", "comment": null}, "result": {"type": "INT64", "index": 29, "name": "result", "comment": null}, "result_rate": {"type": "FLOAT64", "index": 30, "name": "result_rate", "comment": null}, "sales_lead": {"type": "FLOAT64", "index": 31, "name": "sales_lead", "comment": null}, "secondary_goal_result": {"type": "STRING", "index": 32, "name": "secondary_goal_result", "comment": null}, "secondary_goal_result_rate": {"type": "STRING", "index": 33, "name": "secondary_goal_result_rate", "comment": null}, "shares": {"type": "INT64", "index": 34, "name": "shares", "comment": null}, "spend": {"type": "FLOAT64", "index": 35, "name": "spend", "comment": null}, "total_purchase": {"type": "FLOAT64", "index": 36, "name": "total_purchase", "comment": null}, "total_purchase_value": {"type": "FLOAT64", "index": 37, "name": "total_purchase_value", "comment": null}, "total_sales_lead": {"type": "FLOAT64", "index": 38, "name": "total_sales_lead", "comment": null}, "total_sales_lead_value": {"type": "FLOAT64", "index": 39, "name": "total_sales_lead_value", "comment": null}, "video_play_actions": {"type": "INT64", "index": 40, "name": "video_play_actions", "comment": null}, "video_views_p_100": {"type": "INT64", "index": 41, "name": "video_views_p_100", "comment": null}, "video_views_p_25": {"type": "INT64", "index": 42, "name": "video_views_p_25", "comment": null}, "video_views_p_50": {"type": "INT64", "index": 43, "name": "video_views_p_50", "comment": null}, "video_views_p_75": {"type": "INT64", "index": 44, "name": "video_views_p_75", "comment": null}, "video_watched_2_s": {"type": "INT64", "index": 45, "name": "video_watched_2_s", "comment": null}, "video_watched_6_s": {"type": "INT64", "index": 46, "name": "video_watched_6_s", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp"}, "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp": {"metadata": {"type": "view", "schema": "schema", "name": "stg_tiktok_ads__advertiser_tmp", "database": "database", "comment": null, "owner": null}, "columns": {"id": {"type": "INT64", "index": 1, "name": "id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 2, "name": "_fivetran_synced", "comment": null}, "address": {"type": "STRING", "index": 3, "name": "address", "comment": null}, "balance": {"type": "FLOAT64", "index": 4, "name": "balance", "comment": null}, "company": {"type": "STRING", "index": 5, "name": "company", "comment": null}, "contacter": {"type": "STRING", "index": 6, "name": "contacter", "comment": null}, "country": {"type": "STRING", "index": 7, "name": "country", "comment": null}, "create_time": {"type": "TIMESTAMP", "index": 8, "name": "create_time", "comment": null}, "currency": {"type": "STRING", "index": 9, "name": "currency", "comment": null}, "description": {"type": "STRING", "index": 10, "name": "description", "comment": null}, "email": {"type": "STRING", "index": 11, "name": "email", "comment": null}, "industry": {"type": "STRING", "index": 12, "name": "industry", "comment": null}, "language": {"type": "STRING", "index": 13, "name": "language", "comment": null}, "license_no": {"type": "STRING", "index": 14, "name": "license_no", "comment": null}, "license_url": {"type": "STRING", "index": 15, "name": "license_url", "comment": null}, "name": {"type": "STRING", "index": 16, "name": "name", "comment": null}, "phone_number": {"type": "STRING", "index": 17, "name": "phone_number", "comment": null}, "promotion_area": {"type": "STRING", "index": 18, "name": "promotion_area", "comment": null}, "reason": {"type": "STRING", "index": 19, "name": "reason", "comment": null}, "role": {"type": "STRING", "index": 20, "name": "role", "comment": null}, "status": {"type": "STRING", "index": 21, "name": "status", "comment": null}, "telephone": {"type": "STRING", "index": 22, "name": "telephone", "comment": null}, "timezone": {"type": "STRING", "index": 23, "name": "timezone", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly": {"metadata": {"type": "table", "schema": "schema", "name": "stg_tiktok_ads__ad_report_hourly", "database": "database", "comment": null, "owner": null}, "columns": {"ad_id": {"type": "INT64", "index": 1, "name": "ad_id", "comment": null}, "stat_time_hour": {"type": "TIMESTAMP", "index": 2, "name": "stat_time_hour", "comment": null}, "cpc": {"type": "FLOAT64", "index": 3, "name": "cpc", "comment": null}, "cpm": {"type": "FLOAT64", "index": 4, "name": "cpm", "comment": null}, "ctr": {"type": "FLOAT64", "index": 5, "name": "ctr", "comment": null}, "impressions": {"type": "INT64", "index": 6, "name": "impressions", "comment": null}, "clicks": {"type": "INT64", "index": 7, "name": "clicks", "comment": null}, "spend": {"type": "FLOAT64", "index": 8, "name": "spend", "comment": null}, "reach": {"type": "INT64", "index": 9, "name": "reach", "comment": null}, "conversion": {"type": "INT64", "index": 10, "name": "conversion", "comment": null}, "cost_per_conversion": {"type": "FLOAT64", "index": 11, "name": "cost_per_conversion", "comment": null}, "conversion_rate": {"type": "FLOAT64", "index": 12, "name": "conversion_rate", "comment": null}, "likes": {"type": "INT64", "index": 13, "name": "likes", "comment": null}, "comments": {"type": "INT64", "index": 14, "name": "comments", "comment": null}, "shares": {"type": "INT64", "index": 15, "name": "shares", "comment": null}, "profile_visits": {"type": "INT64", "index": 16, "name": "profile_visits", "comment": null}, "follows": {"type": "INT64", "index": 17, "name": "follows", "comment": null}, "video_play_actions": {"type": "INT64", "index": 18, "name": "video_play_actions", "comment": null}, "video_watched_2_s": {"type": "INT64", "index": 19, "name": "video_watched_2_s", "comment": null}, "video_watched_6_s": {"type": "INT64", "index": 20, "name": "video_watched_6_s", "comment": null}, "video_views_p_25": {"type": "INT64", "index": 21, "name": "video_views_p_25", "comment": null}, "video_views_p_50": {"type": "INT64", "index": 22, "name": "video_views_p_50", "comment": null}, "video_views_p_75": {"type": "INT64", "index": 23, "name": "video_views_p_75", "comment": null}, "average_video_play": {"type": "FLOAT64", "index": 24, "name": "average_video_play", "comment": null}, "average_video_play_per_user": {"type": "FLOAT64", "index": 25, "name": "average_video_play_per_user", "comment": null}, "REAL_TIME_COST_PER_RESULT": {"type": "FLOAT64", "index": 26, "name": "REAL_TIME_COST_PER_RESULT", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 26.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 5408.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history": {"metadata": {"type": "table", "schema": "schema", "name": "stg_tiktok_ads__ad_group_history", "database": "database", "comment": null, "owner": null}, "columns": {"ad_group_id": {"type": "INT64", "index": 1, "name": "ad_group_id", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 2, "name": "updated_at", "comment": null}, "advertiser_id": {"type": "INT64", "index": 3, "name": "advertiser_id", "comment": null}, "campaign_id": {"type": "INT64", "index": 4, "name": "campaign_id", "comment": null}, "action_days": {"type": "INT64", "index": 5, "name": "action_days", "comment": null}, "action_categories": {"type": "STRING", "index": 6, "name": "action_categories", "comment": null}, "ad_group_name": {"type": "STRING", "index": 7, "name": "ad_group_name", "comment": null}, "age": {"type": "STRING", "index": 8, "name": "age", "comment": null}, "audience_type": {"type": "STRING", "index": 9, "name": "audience_type", "comment": null}, "budget": {"type": "FLOAT64", "index": 10, "name": "budget", "comment": null}, "category": {"type": "INT64", "index": 11, "name": "category", "comment": null}, "display_name": {"type": "STRING", "index": 12, "name": "display_name", "comment": null}, "interest_category": {"type": "STRING", "index": 13, "name": "interest_category", "comment": null}, "frequency": {"type": "INT64", "index": 14, "name": "frequency", "comment": null}, "frequency_schedule": {"type": "INT64", "index": 15, "name": "frequency_schedule", "comment": null}, "gender": {"type": "STRING", "index": 16, "name": "gender", "comment": null}, "languages": {"type": "STRING", "index": 17, "name": "languages", "comment": null}, "landing_page_url": {"type": "STRING", "index": 18, "name": "landing_page_url", "comment": null}, "is_most_recent_record": {"type": "BOOL", "index": 19, "name": "is_most_recent_record", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 2.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 264.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp": {"metadata": {"type": "view", "schema": "schema", "name": "stg_tiktok_ads__campaign_history_tmp", "database": "database", "comment": null, "owner": null}, "columns": {"campaign_id": {"type": "INT64", "index": 1, "name": "campaign_id", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 2, "name": "updated_at", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "advertiser_id": {"type": "INT64", "index": 4, "name": "advertiser_id", "comment": null}, "budget": {"type": "FLOAT64", "index": 5, "name": "budget", "comment": null}, "budget_mode": {"type": "STRING", "index": 6, "name": "budget_mode", "comment": null}, "campaign_name": {"type": "STRING", "index": 7, "name": "campaign_name", "comment": null}, "campaign_type": {"type": "STRING", "index": 8, "name": "campaign_type", "comment": null}, "create_time": {"type": "TIMESTAMP", "index": 9, "name": "create_time", "comment": null}, "is_new_structure": {"type": "STRING", "index": 10, "name": "is_new_structure", "comment": null}, "objective_type": {"type": "STRING", "index": 11, "name": "objective_type", "comment": null}, "opt_status": {"type": "STRING", "index": 12, "name": "opt_status", "comment": null}, "split_test_variable": {"type": "STRING", "index": 13, "name": "split_test_variable", "comment": null}, "status": {"type": "STRING", "index": 14, "name": "status", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp"}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_history": {"metadata": {"type": "table", "schema": "schema", "name": "stg_tiktok_ads__campaign_history", "database": "database", "comment": null, "owner": null}, "columns": {"campaign_id": {"type": "INT64", "index": 1, "name": "campaign_id", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 2, "name": "updated_at", "comment": null}, "advertiser_id": {"type": "INT64", "index": 3, "name": "advertiser_id", "comment": null}, "campaign_name": {"type": "STRING", "index": 4, "name": "campaign_name", "comment": null}, "campaign_type": {"type": "STRING", "index": 5, "name": "campaign_type", "comment": null}, "split_test_variable": {"type": "STRING", "index": 6, "name": "split_test_variable", "comment": null}, "is_most_recent_record": {"type": "BOOL", "index": 7, "name": "is_most_recent_record", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 2.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 124.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history"}, "model.tiktok_ads_source.stg_tiktok_ads__advertiser": {"metadata": {"type": "table", "schema": "schema", "name": "stg_tiktok_ads__advertiser", "database": "database", "comment": null, "owner": null}, "columns": {"advertiser_id": {"type": "INT64", "index": 1, "name": "advertiser_id", "comment": null}, "address": {"type": "STRING", "index": 2, "name": "address", "comment": null}, "balance": {"type": "FLOAT64", "index": 3, "name": "balance", "comment": null}, "company": {"type": "STRING", "index": 4, "name": "company", "comment": null}, "contacter": {"type": "STRING", "index": 5, "name": "contacter", "comment": null}, "country": {"type": "STRING", "index": 6, "name": "country", "comment": null}, "currency": {"type": "STRING", "index": 7, "name": "currency", "comment": null}, "description": {"type": "STRING", "index": 8, "name": "description", "comment": null}, "email": {"type": "STRING", "index": 9, "name": "email", "comment": null}, "industry": {"type": "STRING", "index": 10, "name": "industry", "comment": null}, "language": {"type": "STRING", "index": 11, "name": "language", "comment": null}, "advertiser_name": {"type": "STRING", "index": 12, "name": "advertiser_name", "comment": null}, "phone_number": {"type": "STRING", "index": 13, "name": "phone_number", "comment": null}, "telephone": {"type": "STRING", "index": 14, "name": "telephone", "comment": null}, "timezone": {"type": "STRING", "index": 15, "name": "timezone", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 1.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 167.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp": {"metadata": {"type": "view", "schema": "schema", "name": "stg_tiktok_ads__ad_group_history_tmp", "database": "database", "comment": null, "owner": null}, "columns": {"adgroup_id": {"type": "INT64", "index": 1, "name": "adgroup_id", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 2, "name": "updated_at", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "action_categories": {"type": "STRING", "index": 4, "name": "action_categories", "comment": null}, "action_days": {"type": "INT64", "index": 5, "name": "action_days", "comment": null}, "adgroup_name": {"type": "STRING", "index": 6, "name": "adgroup_name", "comment": null}, "advertiser_id": {"type": "INT64", "index": 7, "name": "advertiser_id", "comment": null}, "age": {"type": "STRING", "index": 8, "name": "age", "comment": null}, "android_osv": {"type": "STRING", "index": 9, "name": "android_osv", "comment": null}, "app_download_url": {"type": "STRING", "index": 10, "name": "app_download_url", "comment": null}, "app_id": {"type": "INT64", "index": 11, "name": "app_id", "comment": null}, "app_name": {"type": "STRING", "index": 12, "name": "app_name", "comment": null}, "app_type": {"type": "STRING", "index": 13, "name": "app_type", "comment": null}, "audience": {"type": "STRING", "index": 14, "name": "audience", "comment": null}, "audience_type": {"type": "STRING", "index": 15, "name": "audience_type", "comment": null}, "bid": {"type": "FLOAT64", "index": 16, "name": "bid", "comment": null}, "bid_type": {"type": "STRING", "index": 17, "name": "bid_type", "comment": null}, "billing_event": {"type": "STRING", "index": 18, "name": "billing_event", "comment": null}, "budget": {"type": "FLOAT64", "index": 19, "name": "budget", "comment": null}, "budget_mode": {"type": "STRING", "index": 20, "name": "budget_mode", "comment": null}, "campaign_id": {"type": "INT64", "index": 21, "name": "campaign_id", "comment": null}, "carriers": {"type": "STRING", "index": 22, "name": "carriers", "comment": null}, "category": {"type": "INT64", "index": 23, "name": "category", "comment": null}, "click_tracking_url": {"type": "STRING", "index": 24, "name": "click_tracking_url", "comment": null}, "connection_type": {"type": "STRING", "index": 25, "name": "connection_type", "comment": null}, "conversion_bid": {"type": "FLOAT64", "index": 26, "name": "conversion_bid", "comment": null}, "cpv_video_duration": {"type": "STRING", "index": 27, "name": "cpv_video_duration", "comment": null}, "create_time": {"type": "TIMESTAMP", "index": 28, "name": "create_time", "comment": null}, "creative_material_mode": {"type": "STRING", "index": 29, "name": "creative_material_mode", "comment": null}, "dayparting": {"type": "STRING", "index": 30, "name": "dayparting", "comment": null}, "deep_bid_type": {"type": "STRING", "index": 31, "name": "deep_bid_type", "comment": null}, "deep_cpabid": {"type": "FLOAT64", "index": 32, "name": "deep_cpabid", "comment": null}, "deep_external_action": {"type": "STRING", "index": 33, "name": "deep_external_action", "comment": null}, "display_name": {"type": "STRING", "index": 34, "name": "display_name", "comment": null}, "enable_inventory_filter": {"type": "BOOL", "index": 35, "name": "enable_inventory_filter", "comment": null}, "excluded_audience": {"type": "STRING", "index": 36, "name": "excluded_audience", "comment": null}, "external_action": {"type": "STRING", "index": 37, "name": "external_action", "comment": null}, "fallback_type": {"type": "STRING", "index": 38, "name": "fallback_type", "comment": null}, "frequency": {"type": "INT64", "index": 39, "name": "frequency", "comment": null}, "frequency_schedule": {"type": "INT64", "index": 40, "name": "frequency_schedule", "comment": null}, "gender": {"type": "STRING", "index": 41, "name": "gender", "comment": null}, "impression_tracking_url": {"type": "STRING", "index": 42, "name": "impression_tracking_url", "comment": null}, "interest_category_v_2": {"type": "STRING", "index": 43, "name": "interest_category_v_2", "comment": null}, "ios_osv": {"type": "STRING", "index": 44, "name": "ios_osv", "comment": null}, "is_comment_disable": {"type": "INT64", "index": 45, "name": "is_comment_disable", "comment": null}, "is_hfss": {"type": "BOOL", "index": 46, "name": "is_hfss", "comment": null}, "is_new_structure": {"type": "BOOL", "index": 47, "name": "is_new_structure", "comment": null}, "keywords": {"type": "STRING", "index": 48, "name": "keywords", "comment": null}, "landing_page_url": {"type": "STRING", "index": 49, "name": "landing_page_url", "comment": null}, "languages": {"type": "STRING", "index": 50, "name": "languages", "comment": null}, "location": {"type": "STRING", "index": 51, "name": "location", "comment": null}, "open_url": {"type": "STRING", "index": 52, "name": "open_url", "comment": null}, "open_url_type": {"type": "STRING", "index": 53, "name": "open_url_type", "comment": null}, "operation_system": {"type": "STRING", "index": 54, "name": "operation_system", "comment": null}, "opt_status": {"type": "STRING", "index": 55, "name": "opt_status", "comment": null}, "optimize_goal": {"type": "STRING", "index": 56, "name": "optimize_goal", "comment": null}, "pacing": {"type": "STRING", "index": 57, "name": "pacing", "comment": null}, "package": {"type": "STRING", "index": 58, "name": "package", "comment": null}, "pangle_block_app_list_id": {"type": "STRING", "index": 59, "name": "pangle_block_app_list_id", "comment": null}, "pixel_id": {"type": "INT64", "index": 60, "name": "pixel_id", "comment": null}, "placement": {"type": "STRING", "index": 61, "name": "placement", "comment": null}, "placement_type": {"type": "STRING", "index": 62, "name": "placement_type", "comment": null}, "profile_image": {"type": "STRING", "index": 63, "name": "profile_image", "comment": null}, "schedule_end_time": {"type": "TIMESTAMP", "index": 64, "name": "schedule_end_time", "comment": null}, "schedule_start_time": {"type": "TIMESTAMP", "index": 65, "name": "schedule_start_time", "comment": null}, "schedule_type": {"type": "STRING", "index": 66, "name": "schedule_type", "comment": null}, "skip_learning_phase": {"type": "INT64", "index": 67, "name": "skip_learning_phase", "comment": null}, "statistic_type": {"type": "STRING", "index": 68, "name": "statistic_type", "comment": null}, "status": {"type": "STRING", "index": 69, "name": "status", "comment": null}, "video_actions": {"type": "STRING", "index": 70, "name": "video_actions", "comment": null}, "video_download": {"type": "STRING", "index": 71, "name": "video_download", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_history": {"metadata": {"type": "table", "schema": "schema", "name": "stg_tiktok_ads__ad_history", "database": "database", "comment": null, "owner": null}, "columns": {"ad_id": {"type": "INT64", "index": 1, "name": "ad_id", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 2, "name": "updated_at", "comment": null}, "ad_group_id": {"type": "INT64", "index": 3, "name": "ad_group_id", "comment": null}, "advertiser_id": {"type": "INT64", "index": 4, "name": "advertiser_id", "comment": null}, "campaign_id": {"type": "INT64", "index": 5, "name": "campaign_id", "comment": null}, "ad_name": {"type": "STRING", "index": 6, "name": "ad_name", "comment": null}, "call_to_action": {"type": "STRING", "index": 7, "name": "call_to_action", "comment": null}, "click_tracking_url": {"type": "STRING", "index": 8, "name": "click_tracking_url", "comment": null}, "impression_tracking_url": {"type": "STRING", "index": 9, "name": "impression_tracking_url", "comment": null}, "base_url": {"type": "STRING", "index": 10, "name": "base_url", "comment": null}, "url_host": {"type": "STRING", "index": 11, "name": "url_host", "comment": null}, "url_path": {"type": "STRING", "index": 12, "name": "url_path", "comment": null}, "utm_source": {"type": "STRING", "index": 13, "name": "utm_source", "comment": null}, "utm_medium": {"type": "STRING", "index": 14, "name": "utm_medium", "comment": null}, "utm_campaign": {"type": "STRING", "index": 15, "name": "utm_campaign", "comment": null}, "utm_content": {"type": "STRING", "index": 16, "name": "utm_content", "comment": null}, "utm_term": {"type": "STRING", "index": 17, "name": "utm_term", "comment": null}, "landing_page_url": {"type": "STRING", "index": 18, "name": "landing_page_url", "comment": null}, "is_most_recent_record": {"type": "BOOL", "index": 19, "name": "is_most_recent_record", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 1.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 169.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly": {"metadata": {"type": "table", "schema": "schema", "name": "stg_tiktok_ads__ad_group_report_hourly", "database": "database", "comment": null, "owner": null}, "columns": {"ad_group_id": {"type": "INT64", "index": 1, "name": "ad_group_id", "comment": null}, "stat_time_hour": {"type": "TIMESTAMP", "index": 2, "name": "stat_time_hour", "comment": null}, "cpc": {"type": "FLOAT64", "index": 3, "name": "cpc", "comment": null}, "cpm": {"type": "FLOAT64", "index": 4, "name": "cpm", "comment": null}, "ctr": {"type": "FLOAT64", "index": 5, "name": "ctr", "comment": null}, "impressions": {"type": "INT64", "index": 6, "name": "impressions", "comment": null}, "clicks": {"type": "INT64", "index": 7, "name": "clicks", "comment": null}, "spend": {"type": "FLOAT64", "index": 8, "name": "spend", "comment": null}, "reach": {"type": "INT64", "index": 9, "name": "reach", "comment": null}, "conversion": {"type": "INT64", "index": 10, "name": "conversion", "comment": null}, "cost_per_conversion": {"type": "FLOAT64", "index": 11, "name": "cost_per_conversion", "comment": null}, "conversion_rate": {"type": "FLOAT64", "index": 12, "name": "conversion_rate", "comment": null}, "likes": {"type": "INT64", "index": 13, "name": "likes", "comment": null}, "comments": {"type": "INT64", "index": 14, "name": "comments", "comment": null}, "shares": {"type": "INT64", "index": 15, "name": "shares", "comment": null}, "profile_visits": {"type": "INT64", "index": 16, "name": "profile_visits", "comment": null}, "follows": {"type": "INT64", "index": 17, "name": "follows", "comment": null}, "video_play_actions": {"type": "INT64", "index": 18, "name": "video_play_actions", "comment": null}, "video_watched_2_s": {"type": "INT64", "index": 19, "name": "video_watched_2_s", "comment": null}, "video_watched_6_s": {"type": "INT64", "index": 20, "name": "video_watched_6_s", "comment": null}, "video_views_p_25": {"type": "INT64", "index": 21, "name": "video_views_p_25", "comment": null}, "video_views_p_50": {"type": "INT64", "index": 22, "name": "video_views_p_50", "comment": null}, "video_views_p_75": {"type": "INT64", "index": 23, "name": "video_views_p_75", "comment": null}, "average_video_play": {"type": "FLOAT64", "index": 24, "name": "average_video_play", "comment": null}, "average_video_play_per_user": {"type": "FLOAT64", "index": 25, "name": "average_video_play_per_user", "comment": null}, "result": {"type": "INT64", "index": 26, "name": "result", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 26.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 5408.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp": {"metadata": {"type": "view", "schema": "schema", "name": "stg_tiktok_ads__ad_history_tmp", "database": "database", "comment": null, "owner": null}, "columns": {"ad_id": {"type": "INT64", "index": 1, "name": "ad_id", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 2, "name": "updated_at", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "ad_name": {"type": "STRING", "index": 4, "name": "ad_name", "comment": null}, "ad_text": {"type": "STRING", "index": 5, "name": "ad_text", "comment": null}, "adgroup_id": {"type": "INT64", "index": 6, "name": "adgroup_id", "comment": null}, "advertiser_id": {"type": "INT64", "index": 7, "name": "advertiser_id", "comment": null}, "app_name": {"type": "STRING", "index": 8, "name": "app_name", "comment": null}, "call_to_action": {"type": "STRING", "index": 9, "name": "call_to_action", "comment": null}, "campaign_id": {"type": "INT64", "index": 10, "name": "campaign_id", "comment": null}, "click_tracking_url": {"type": "STRING", "index": 11, "name": "click_tracking_url", "comment": null}, "create_time": {"type": "TIMESTAMP", "index": 12, "name": "create_time", "comment": null}, "display_name": {"type": "STRING", "index": 13, "name": "display_name", "comment": null}, "image_ids": {"type": "STRING", "index": 14, "name": "image_ids", "comment": null}, "impression_tracking_url": {"type": "STRING", "index": 15, "name": "impression_tracking_url", "comment": null}, "is_aco": {"type": "BOOL", "index": 16, "name": "is_aco", "comment": null}, "is_creative_authorized": {"type": "BOOL", "index": 17, "name": "is_creative_authorized", "comment": null}, "is_new_structure": {"type": "BOOL", "index": 18, "name": "is_new_structure", "comment": null}, "landing_page_url": {"type": "STRING", "index": 19, "name": "landing_page_url", "comment": null}, "open_url": {"type": "STRING", "index": 20, "name": "open_url", "comment": null}, "opt_status": {"type": "STRING", "index": 21, "name": "opt_status", "comment": null}, "playable_url": {"type": "STRING", "index": 22, "name": "playable_url", "comment": null}, "profile_image": {"type": "STRING", "index": 23, "name": "profile_image", "comment": null}, "status": {"type": "STRING", "index": 24, "name": "status", "comment": null}, "video_id": {"type": "STRING", "index": 25, "name": "video_id", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp"}, "model.tiktok_ads.tiktok_ads__account_report": {"metadata": {"type": "table", "schema": "dbt_renee_tiktok_ads", "name": "tiktok_ads__account_report", "database": "database", "comment": null, "owner": null}, "columns": {"date_day": {"type": "DATE", "index": 1, "name": "date_day", "comment": null}, "advertiser_id": {"type": "INT64", "index": 2, "name": "advertiser_id", "comment": null}, "advertiser_name": {"type": "STRING", "index": 3, "name": "advertiser_name", "comment": null}, "currency": {"type": "STRING", "index": 4, "name": "currency", "comment": null}, "clicks": {"type": "INT64", "index": 5, "name": "clicks", "comment": null}, "impressions": {"type": "INT64", "index": 6, "name": "impressions", "comment": null}, "spend": {"type": "FLOAT64", "index": 7, "name": "spend", "comment": null}, "reach": {"type": "INT64", "index": 8, "name": "reach", "comment": null}, "conversion": {"type": "INT64", "index": 9, "name": "conversion", "comment": null}, "likes": {"type": "INT64", "index": 10, "name": "likes", "comment": null}, "comments": {"type": "INT64", "index": 11, "name": "comments", "comment": null}, "shares": {"type": "INT64", "index": 12, "name": "shares", "comment": null}, "profile_visits": {"type": "INT64", "index": 13, "name": "profile_visits", "comment": null}, "follows": {"type": "INT64", "index": 14, "name": "follows", "comment": null}, "video_watched_2_s": {"type": "INT64", "index": 15, "name": "video_watched_2_s", "comment": null}, "video_watched_6_s": {"type": "INT64", "index": 16, "name": "video_watched_6_s", "comment": null}, "video_views_p_25": {"type": "INT64", "index": 17, "name": "video_views_p_25", "comment": null}, "video_views_p_50": {"type": "INT64", "index": 18, "name": "video_views_p_50", "comment": null}, "video_views_p_75": {"type": "INT64", "index": 19, "name": "video_views_p_75", "comment": null}, "daily_cpc": {"type": "FLOAT64", "index": 20, "name": "daily_cpc", "comment": null}, "daily_cpm": {"type": "FLOAT64", "index": 21, "name": "daily_cpm", "comment": null}, "daily_ctr": {"type": "FLOAT64", "index": 22, "name": "daily_ctr", "comment": null}, "REAL_TIME_COST_PER_RESULT": {"type": "FLOAT64", "index": 23, "name": "REAL_TIME_COST_PER_RESULT", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 5.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 908.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads.tiktok_ads__account_report"}, "model.tiktok_ads.tiktok_ads__url_report": {"metadata": {"type": "table", "schema": "dbt_renee_tiktok_ads", "name": "tiktok_ads__url_report", "database": "database", "comment": null, "owner": null}, "columns": {"date_day": {"type": "DATE", "index": 1, "name": "date_day", "comment": null}, "advertiser_id": {"type": "INT64", "index": 2, "name": "advertiser_id", "comment": null}, "advertiser_name": {"type": "STRING", "index": 3, "name": "advertiser_name", "comment": null}, "campaign_id": {"type": "INT64", "index": 4, "name": "campaign_id", "comment": null}, "campaign_name": {"type": "STRING", "index": 5, "name": "campaign_name", "comment": null}, "ad_group_id": {"type": "INT64", "index": 6, "name": "ad_group_id", "comment": null}, "ad_group_name": {"type": "STRING", "index": 7, "name": "ad_group_name", "comment": null}, "ad_id": {"type": "INT64", "index": 8, "name": "ad_id", "comment": null}, "ad_name": {"type": "STRING", "index": 9, "name": "ad_name", "comment": null}, "base_url": {"type": "STRING", "index": 10, "name": "base_url", "comment": null}, "url_host": {"type": "STRING", "index": 11, "name": "url_host", "comment": null}, "url_path": {"type": "STRING", "index": 12, "name": "url_path", "comment": null}, "utm_source": {"type": "STRING", "index": 13, "name": "utm_source", "comment": null}, "utm_medium": {"type": "STRING", "index": 14, "name": "utm_medium", "comment": null}, "utm_campaign": {"type": "STRING", "index": 15, "name": "utm_campaign", "comment": null}, "utm_content": {"type": "STRING", "index": 16, "name": "utm_content", "comment": null}, "utm_term": {"type": "STRING", "index": 17, "name": "utm_term", "comment": null}, "currency": {"type": "STRING", "index": 18, "name": "currency", "comment": null}, "action_categories": {"type": "STRING", "index": 19, "name": "action_categories", "comment": null}, "category": {"type": "INT64", "index": 20, "name": "category", "comment": null}, "gender": {"type": "STRING", "index": 21, "name": "gender", "comment": null}, "audience_type": {"type": "STRING", "index": 22, "name": "audience_type", "comment": null}, "budget": {"type": "FLOAT64", "index": 23, "name": "budget", "comment": null}, "age": {"type": "STRING", "index": 24, "name": "age", "comment": null}, "languages": {"type": "STRING", "index": 25, "name": "languages", "comment": null}, "interest_category": {"type": "STRING", "index": 26, "name": "interest_category", "comment": null}, "impressions": {"type": "INT64", "index": 27, "name": "impressions", "comment": null}, "clicks": {"type": "INT64", "index": 28, "name": "clicks", "comment": null}, "spend": {"type": "FLOAT64", "index": 29, "name": "spend", "comment": null}, "reach": {"type": "INT64", "index": 30, "name": "reach", "comment": null}, "conversion": {"type": "INT64", "index": 31, "name": "conversion", "comment": null}, "likes": {"type": "INT64", "index": 32, "name": "likes", "comment": null}, "comments": {"type": "INT64", "index": 33, "name": "comments", "comment": null}, "shares": {"type": "INT64", "index": 34, "name": "shares", "comment": null}, "profile_visits": {"type": "INT64", "index": 35, "name": "profile_visits", "comment": null}, "follows": {"type": "INT64", "index": 36, "name": "follows", "comment": null}, "video_watched_2_s": {"type": "INT64", "index": 37, "name": "video_watched_2_s", "comment": null}, "video_watched_6_s": {"type": "INT64", "index": 38, "name": "video_watched_6_s", "comment": null}, "video_views_p_25": {"type": "INT64", "index": 39, "name": "video_views_p_25", "comment": null}, "video_views_p_50": {"type": "INT64", "index": 40, "name": "video_views_p_50", "comment": null}, "video_views_p_75": {"type": "INT64", "index": 41, "name": "video_views_p_75", "comment": null}, "daily_cpc": {"type": "FLOAT64", "index": 42, "name": "daily_cpc", "comment": null}, "daily_cpm": {"type": "FLOAT64", "index": 43, "name": "daily_cpm", "comment": null}, "daily_ctr": {"type": "FLOAT64", "index": 44, "name": "daily_ctr", "comment": null}, "REAL_TIME_COST_PER_RESULT": {"type": "FLOAT64", "index": 45, "name": "REAL_TIME_COST_PER_RESULT", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 5.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 2108.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads.tiktok_ads__url_report"}, "model.tiktok_ads.tiktok_ads__ad_group_report": {"metadata": {"type": "table", "schema": "dbt_renee_tiktok_ads", "name": "tiktok_ads__ad_group_report", "database": "database", "comment": null, "owner": null}, "columns": {"date_day": {"type": "DATE", "index": 1, "name": "date_day", "comment": null}, "advertiser_id": {"type": "INT64", "index": 2, "name": "advertiser_id", "comment": null}, "advertiser_name": {"type": "STRING", "index": 3, "name": "advertiser_name", "comment": null}, "campaign_id": {"type": "INT64", "index": 4, "name": "campaign_id", "comment": null}, "campaign_name": {"type": "STRING", "index": 5, "name": "campaign_name", "comment": null}, "ad_group_id": {"type": "INT64", "index": 6, "name": "ad_group_id", "comment": null}, "ad_group_name": {"type": "STRING", "index": 7, "name": "ad_group_name", "comment": null}, "currency": {"type": "STRING", "index": 8, "name": "currency", "comment": null}, "action_categories": {"type": "STRING", "index": 9, "name": "action_categories", "comment": null}, "category": {"type": "INT64", "index": 10, "name": "category", "comment": null}, "gender": {"type": "STRING", "index": 11, "name": "gender", "comment": null}, "audience_type": {"type": "STRING", "index": 12, "name": "audience_type", "comment": null}, "budget": {"type": "FLOAT64", "index": 13, "name": "budget", "comment": null}, "age": {"type": "STRING", "index": 14, "name": "age", "comment": null}, "languages": {"type": "STRING", "index": 15, "name": "languages", "comment": null}, "interest_category": {"type": "STRING", "index": 16, "name": "interest_category", "comment": null}, "impressions": {"type": "INT64", "index": 17, "name": "impressions", "comment": null}, "clicks": {"type": "INT64", "index": 18, "name": "clicks", "comment": null}, "spend": {"type": "FLOAT64", "index": 19, "name": "spend", "comment": null}, "reach": {"type": "INT64", "index": 20, "name": "reach", "comment": null}, "conversion": {"type": "INT64", "index": 21, "name": "conversion", "comment": null}, "likes": {"type": "INT64", "index": 22, "name": "likes", "comment": null}, "comments": {"type": "INT64", "index": 23, "name": "comments", "comment": null}, "shares": {"type": "INT64", "index": 24, "name": "shares", "comment": null}, "profile_visits": {"type": "INT64", "index": 25, "name": "profile_visits", "comment": null}, "follows": {"type": "INT64", "index": 26, "name": "follows", "comment": null}, "video_watched_2_s": {"type": "INT64", "index": 27, "name": "video_watched_2_s", "comment": null}, "video_watched_6_s": {"type": "INT64", "index": 28, "name": "video_watched_6_s", "comment": null}, "video_views_p_25": {"type": "INT64", "index": 29, "name": "video_views_p_25", "comment": null}, "video_views_p_50": {"type": "INT64", "index": 30, "name": "video_views_p_50", "comment": null}, "video_views_p_75": {"type": "INT64", "index": 31, "name": "video_views_p_75", "comment": null}, "daily_cpc": {"type": "FLOAT64", "index": 32, "name": "daily_cpc", "comment": null}, "daily_cpm": {"type": "FLOAT64", "index": 33, "name": "daily_cpm", "comment": null}, "daily_ctr": {"type": "FLOAT64", "index": 34, "name": "daily_ctr", "comment": null}, "result": {"type": "INT64", "index": 35, "name": "result", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 5.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 1578.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads.tiktok_ads__ad_group_report"}, "model.tiktok_ads.tiktok_ads__ad_report": {"metadata": {"type": "table", "schema": "dbt_renee_tiktok_ads", "name": "tiktok_ads__ad_report", "database": "database", "comment": null, "owner": null}, "columns": {"date_day": {"type": "DATE", "index": 1, "name": "date_day", "comment": null}, "advertiser_id": {"type": "INT64", "index": 2, "name": "advertiser_id", "comment": null}, "advertiser_name": {"type": "STRING", "index": 3, "name": "advertiser_name", "comment": null}, "campaign_id": {"type": "INT64", "index": 4, "name": "campaign_id", "comment": null}, "campaign_name": {"type": "STRING", "index": 5, "name": "campaign_name", "comment": null}, "ad_group_id": {"type": "INT64", "index": 6, "name": "ad_group_id", "comment": null}, "ad_group_name": {"type": "STRING", "index": 7, "name": "ad_group_name", "comment": null}, "ad_id": {"type": "INT64", "index": 8, "name": "ad_id", "comment": null}, "ad_name": {"type": "STRING", "index": 9, "name": "ad_name", "comment": null}, "currency": {"type": "STRING", "index": 10, "name": "currency", "comment": null}, "category": {"type": "INT64", "index": 11, "name": "category", "comment": null}, "action_categories": {"type": "STRING", "index": 12, "name": "action_categories", "comment": null}, "gender": {"type": "STRING", "index": 13, "name": "gender", "comment": null}, "audience_type": {"type": "STRING", "index": 14, "name": "audience_type", "comment": null}, "budget": {"type": "FLOAT64", "index": 15, "name": "budget", "comment": null}, "age": {"type": "STRING", "index": 16, "name": "age", "comment": null}, "languages": {"type": "STRING", "index": 17, "name": "languages", "comment": null}, "interest_category": {"type": "STRING", "index": 18, "name": "interest_category", "comment": null}, "impressions": {"type": "INT64", "index": 19, "name": "impressions", "comment": null}, "clicks": {"type": "INT64", "index": 20, "name": "clicks", "comment": null}, "spend": {"type": "FLOAT64", "index": 21, "name": "spend", "comment": null}, "reach": {"type": "INT64", "index": 22, "name": "reach", "comment": null}, "conversion": {"type": "INT64", "index": 23, "name": "conversion", "comment": null}, "likes": {"type": "INT64", "index": 24, "name": "likes", "comment": null}, "comments": {"type": "INT64", "index": 25, "name": "comments", "comment": null}, "shares": {"type": "INT64", "index": 26, "name": "shares", "comment": null}, "profile_visits": {"type": "INT64", "index": 27, "name": "profile_visits", "comment": null}, "follows": {"type": "INT64", "index": 28, "name": "follows", "comment": null}, "video_watched_2_s": {"type": "INT64", "index": 29, "name": "video_watched_2_s", "comment": null}, "video_watched_6_s": {"type": "INT64", "index": 30, "name": "video_watched_6_s", "comment": null}, "video_views_p_25": {"type": "INT64", "index": 31, "name": "video_views_p_25", "comment": null}, "video_views_p_50": {"type": "INT64", "index": 32, "name": "video_views_p_50", "comment": null}, "video_views_p_75": {"type": "INT64", "index": 33, "name": "video_views_p_75", "comment": null}, "daily_cpc": {"type": "FLOAT64", "index": 34, "name": "daily_cpc", "comment": null}, "daily_cpm": {"type": "FLOAT64", "index": 35, "name": "daily_cpm", "comment": null}, "daily_ctr": {"type": "FLOAT64", "index": 36, "name": "daily_ctr", "comment": null}, "REAL_TIME_COST_PER_RESULT": {"type": "FLOAT64", "index": 37, "name": "REAL_TIME_COST_PER_RESULT", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 5.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 1838.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads.tiktok_ads__ad_report"}, "model.tiktok_ads.tiktok_ads__campaign_report": {"metadata": {"type": "table", "schema": "dbt_renee_tiktok_ads", "name": "tiktok_ads__campaign_report", "database": "database", "comment": null, "owner": null}, "columns": {"date_day": {"type": "DATE", "index": 1, "name": "date_day", "comment": null}, "advertiser_id": {"type": "INT64", "index": 2, "name": "advertiser_id", "comment": null}, "advertiser_name": {"type": "STRING", "index": 3, "name": "advertiser_name", "comment": null}, "campaign_id": {"type": "INT64", "index": 4, "name": "campaign_id", "comment": null}, "campaign_name": {"type": "STRING", "index": 5, "name": "campaign_name", "comment": null}, "currency": {"type": "STRING", "index": 6, "name": "currency", "comment": null}, "impressions": {"type": "INT64", "index": 7, "name": "impressions", "comment": null}, "clicks": {"type": "INT64", "index": 8, "name": "clicks", "comment": null}, "spend": {"type": "FLOAT64", "index": 9, "name": "spend", "comment": null}, "reach": {"type": "INT64", "index": 10, "name": "reach", "comment": null}, "conversion": {"type": "INT64", "index": 11, "name": "conversion", "comment": null}, "likes": {"type": "INT64", "index": 12, "name": "likes", "comment": null}, "comments": {"type": "INT64", "index": 13, "name": "comments", "comment": null}, "shares": {"type": "INT64", "index": 14, "name": "shares", "comment": null}, "profile_visits": {"type": "INT64", "index": 15, "name": "profile_visits", "comment": null}, "follows": {"type": "INT64", "index": 16, "name": "follows", "comment": null}, "video_watched_2_s": {"type": "INT64", "index": 17, "name": "video_watched_2_s", "comment": null}, "video_watched_6_s": {"type": "INT64", "index": 18, "name": "video_watched_6_s", "comment": null}, "video_views_p_25": {"type": "INT64", "index": 19, "name": "video_views_p_25", "comment": null}, "video_views_p_50": {"type": "INT64", "index": 20, "name": "video_views_p_50", "comment": null}, "video_views_p_75": {"type": "INT64", "index": 21, "name": "video_views_p_75", "comment": null}, "daily_cpc": {"type": "FLOAT64", "index": 22, "name": "daily_cpc", "comment": null}, "daily_cpm": {"type": "FLOAT64", "index": 23, "name": "daily_cpm", "comment": null}, "daily_ctr": {"type": "FLOAT64", "index": 24, "name": "daily_ctr", "comment": null}, "result": {"type": "INT64", "index": 25, "name": "result", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 5.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 1043.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads.tiktok_ads__campaign_report"}}, "sources": {"source.tiktok_ads_source.tiktok_ads.campaign_history": {"metadata": {"type": "table", "schema": "tiktok_ads_joe", "name": "campaign_history", "database": "database", "comment": null, "owner": null}, "columns": {"campaign_id": {"type": "INT64", "index": 1, "name": "campaign_id", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 2, "name": "updated_at", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "advertiser_id": {"type": "INT64", "index": 4, "name": "advertiser_id", "comment": null}, "budget": {"type": "FLOAT64", "index": 5, "name": "budget", "comment": null}, "budget_mode": {"type": "STRING", "index": 6, "name": "budget_mode", "comment": null}, "campaign_name": {"type": "STRING", "index": 7, "name": "campaign_name", "comment": null}, "campaign_type": {"type": "STRING", "index": 8, "name": "campaign_type", "comment": null}, "create_time": {"type": "TIMESTAMP", "index": 9, "name": "create_time", "comment": null}, "is_new_structure": {"type": "STRING", "index": 10, "name": "is_new_structure", "comment": null}, "objective_type": {"type": "STRING", "index": 11, "name": "objective_type", "comment": null}, "opt_status": {"type": "STRING", "index": 12, "name": "opt_status", "comment": null}, "split_test_variable": {"type": "STRING", "index": 13, "name": "split_test_variable", "comment": null}, "status": {"type": "STRING", "index": 14, "name": "status", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 2.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 304.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.tiktok_ads_source.tiktok_ads.campaign_history"}, "source.tiktok_ads_source.tiktok_ads.advertiser": {"metadata": {"type": "table", "schema": "tiktok_ads_joe", "name": "advertiser", "database": "database", "comment": null, "owner": null}, "columns": {"id": {"type": "INT64", "index": 1, "name": "id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 2, "name": "_fivetran_synced", "comment": null}, "address": {"type": "STRING", "index": 3, "name": "address", "comment": null}, "balance": {"type": "FLOAT64", "index": 4, "name": "balance", "comment": null}, "company": {"type": "STRING", "index": 5, "name": "company", "comment": null}, "contacter": {"type": "STRING", "index": 6, "name": "contacter", "comment": null}, "country": {"type": "STRING", "index": 7, "name": "country", "comment": null}, "create_time": {"type": "TIMESTAMP", "index": 8, "name": "create_time", "comment": null}, "currency": {"type": "STRING", "index": 9, "name": "currency", "comment": null}, "description": {"type": "STRING", "index": 10, "name": "description", "comment": null}, "email": {"type": "STRING", "index": 11, "name": "email", "comment": null}, "industry": {"type": "STRING", "index": 12, "name": "industry", "comment": null}, "language": {"type": "STRING", "index": 13, "name": "language", "comment": null}, "license_no": {"type": "STRING", "index": 14, "name": "license_no", "comment": null}, "license_url": {"type": "STRING", "index": 15, "name": "license_url", "comment": null}, "name": {"type": "STRING", "index": 16, "name": "name", "comment": null}, "phone_number": {"type": "STRING", "index": 17, "name": "phone_number", "comment": null}, "promotion_area": {"type": "STRING", "index": 18, "name": "promotion_area", "comment": null}, "reason": {"type": "STRING", "index": 19, "name": "reason", "comment": null}, "role": {"type": "STRING", "index": 20, "name": "role", "comment": null}, "status": {"type": "STRING", "index": 21, "name": "status", "comment": null}, "telephone": {"type": "STRING", "index": 22, "name": "telephone", "comment": null}, "timezone": {"type": "STRING", "index": 23, "name": "timezone", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 1.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 223.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.tiktok_ads_source.tiktok_ads.advertiser"}, "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly": {"metadata": {"type": "table", "schema": "tiktok_ads_joe", "name": "campaign_report_hourly", "database": "database", "comment": null, "owner": null}, "columns": {"campaign_id": {"type": "INT64", "index": 1, "name": "campaign_id", "comment": null}, "stat_time_hour": {"type": "DATETIME", "index": 2, "name": "stat_time_hour", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "average_video_play": {"type": "FLOAT64", "index": 4, "name": "average_video_play", "comment": null}, "average_video_play_per_user": {"type": "FLOAT64", "index": 5, "name": "average_video_play_per_user", "comment": null}, "clicks": {"type": "INT64", "index": 6, "name": "clicks", "comment": null}, "comments": {"type": "INT64", "index": 7, "name": "comments", "comment": null}, "conversion": {"type": "INT64", "index": 8, "name": "conversion", "comment": null}, "conversion_rate": {"type": "FLOAT64", "index": 9, "name": "conversion_rate", "comment": null}, "cost_per_1000_reached": {"type": "FLOAT64", "index": 10, "name": "cost_per_1000_reached", "comment": null}, "cost_per_conversion": {"type": "FLOAT64", "index": 11, "name": "cost_per_conversion", "comment": null}, "cost_per_result": {"type": "FLOAT64", "index": 12, "name": "cost_per_result", "comment": null}, "cost_per_secondary_goal_result": {"type": "STRING", "index": 13, "name": "cost_per_secondary_goal_result", "comment": null}, "cpc": {"type": "FLOAT64", "index": 14, "name": "cpc", "comment": null}, "cpm": {"type": "FLOAT64", "index": 15, "name": "cpm", "comment": null}, "ctr": {"type": "FLOAT64", "index": 16, "name": "ctr", "comment": null}, "follows": {"type": "INT64", "index": 17, "name": "follows", "comment": null}, "impressions": {"type": "INT64", "index": 18, "name": "impressions", "comment": null}, "likes": {"type": "INT64", "index": 19, "name": "likes", "comment": null}, "profile_visits": {"type": "INT64", "index": 20, "name": "profile_visits", "comment": null}, "profile_visits_rate": {"type": "FLOAT64", "index": 21, "name": "profile_visits_rate", "comment": null}, "reach": {"type": "INT64", "index": 22, "name": "reach", "comment": null}, "real_time_conversion": {"type": "INT64", "index": 23, "name": "real_time_conversion", "comment": null}, "real_time_conversion_rate": {"type": "FLOAT64", "index": 24, "name": "real_time_conversion_rate", "comment": null}, "real_time_cost_per_conversion": {"type": "FLOAT64", "index": 25, "name": "real_time_cost_per_conversion", "comment": null}, "real_time_cost_per_result": {"type": "FLOAT64", "index": 26, "name": "real_time_cost_per_result", "comment": null}, "real_time_result": {"type": "INT64", "index": 27, "name": "real_time_result", "comment": null}, "real_time_result_rate": {"type": "FLOAT64", "index": 28, "name": "real_time_result_rate", "comment": null}, "result": {"type": "INT64", "index": 29, "name": "result", "comment": null}, "result_rate": {"type": "FLOAT64", "index": 30, "name": "result_rate", "comment": null}, "sales_lead": {"type": "FLOAT64", "index": 31, "name": "sales_lead", "comment": null}, "secondary_goal_result": {"type": "STRING", "index": 32, "name": "secondary_goal_result", "comment": null}, "secondary_goal_result_rate": {"type": "STRING", "index": 33, "name": "secondary_goal_result_rate", "comment": null}, "shares": {"type": "INT64", "index": 34, "name": "shares", "comment": null}, "spend": {"type": "FLOAT64", "index": 35, "name": "spend", "comment": null}, "total_purchase": {"type": "FLOAT64", "index": 36, "name": "total_purchase", "comment": null}, "total_purchase_value": {"type": "FLOAT64", "index": 37, "name": "total_purchase_value", "comment": null}, "total_sales_lead": {"type": "FLOAT64", "index": 38, "name": "total_sales_lead", "comment": null}, "total_sales_lead_value": {"type": "FLOAT64", "index": 39, "name": "total_sales_lead_value", "comment": null}, "video_play_actions": {"type": "INT64", "index": 40, "name": "video_play_actions", "comment": null}, "video_views_p_100": {"type": "INT64", "index": 41, "name": "video_views_p_100", "comment": null}, "video_views_p_25": {"type": "INT64", "index": 42, "name": "video_views_p_25", "comment": null}, "video_views_p_50": {"type": "INT64", "index": 43, "name": "video_views_p_50", "comment": null}, "video_views_p_75": {"type": "INT64", "index": 44, "name": "video_views_p_75", "comment": null}, "video_watched_2_s": {"type": "INT64", "index": 45, "name": "video_watched_2_s", "comment": null}, "video_watched_6_s": {"type": "INT64", "index": 46, "name": "video_watched_6_s", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 26.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 9178.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly"}, "source.tiktok_ads_source.tiktok_ads.ad_history": {"metadata": {"type": "table", "schema": "tiktok_ads_joe", "name": "ad_history", "database": "database", "comment": null, "owner": null}, "columns": {"ad_id": {"type": "INT64", "index": 1, "name": "ad_id", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 2, "name": "updated_at", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "ad_name": {"type": "STRING", "index": 4, "name": "ad_name", "comment": null}, "ad_text": {"type": "STRING", "index": 5, "name": "ad_text", "comment": null}, "adgroup_id": {"type": "INT64", "index": 6, "name": "adgroup_id", "comment": null}, "advertiser_id": {"type": "INT64", "index": 7, "name": "advertiser_id", "comment": null}, "app_name": {"type": "STRING", "index": 8, "name": "app_name", "comment": null}, "call_to_action": {"type": "STRING", "index": 9, "name": "call_to_action", "comment": null}, "campaign_id": {"type": "INT64", "index": 10, "name": "campaign_id", "comment": null}, "click_tracking_url": {"type": "STRING", "index": 11, "name": "click_tracking_url", "comment": null}, "create_time": {"type": "TIMESTAMP", "index": 12, "name": "create_time", "comment": null}, "display_name": {"type": "STRING", "index": 13, "name": "display_name", "comment": null}, "image_ids": {"type": "STRING", "index": 14, "name": "image_ids", "comment": null}, "impression_tracking_url": {"type": "STRING", "index": 15, "name": "impression_tracking_url", "comment": null}, "is_aco": {"type": "BOOL", "index": 16, "name": "is_aco", "comment": null}, "is_creative_authorized": {"type": "BOOL", "index": 17, "name": "is_creative_authorized", "comment": null}, "is_new_structure": {"type": "BOOL", "index": 18, "name": "is_new_structure", "comment": null}, "landing_page_url": {"type": "STRING", "index": 19, "name": "landing_page_url", "comment": null}, "open_url": {"type": "STRING", "index": 20, "name": "open_url", "comment": null}, "opt_status": {"type": "STRING", "index": 21, "name": "opt_status", "comment": null}, "playable_url": {"type": "STRING", "index": 22, "name": "playable_url", "comment": null}, "profile_image": {"type": "STRING", "index": 23, "name": "profile_image", "comment": null}, "status": {"type": "STRING", "index": 24, "name": "status", "comment": null}, "video_id": {"type": "STRING", "index": 25, "name": "video_id", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 1.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 309.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.tiktok_ads_source.tiktok_ads.ad_history"}, "source.tiktok_ads_source.tiktok_ads.adgroup_history": {"metadata": {"type": "table", "schema": "tiktok_ads_joe", "name": "adgroup_history", "database": "database", "comment": null, "owner": null}, "columns": {"adgroup_id": {"type": "INT64", "index": 1, "name": "adgroup_id", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 2, "name": "updated_at", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "action_categories": {"type": "STRING", "index": 4, "name": "action_categories", "comment": null}, "action_days": {"type": "INT64", "index": 5, "name": "action_days", "comment": null}, "adgroup_name": {"type": "STRING", "index": 6, "name": "adgroup_name", "comment": null}, "advertiser_id": {"type": "INT64", "index": 7, "name": "advertiser_id", "comment": null}, "age": {"type": "STRING", "index": 8, "name": "age", "comment": null}, "android_osv": {"type": "STRING", "index": 9, "name": "android_osv", "comment": null}, "app_download_url": {"type": "STRING", "index": 10, "name": "app_download_url", "comment": null}, "app_id": {"type": "INT64", "index": 11, "name": "app_id", "comment": null}, "app_name": {"type": "STRING", "index": 12, "name": "app_name", "comment": null}, "app_type": {"type": "STRING", "index": 13, "name": "app_type", "comment": null}, "audience": {"type": "STRING", "index": 14, "name": "audience", "comment": null}, "audience_type": {"type": "STRING", "index": 15, "name": "audience_type", "comment": null}, "bid": {"type": "FLOAT64", "index": 16, "name": "bid", "comment": null}, "bid_type": {"type": "STRING", "index": 17, "name": "bid_type", "comment": null}, "billing_event": {"type": "STRING", "index": 18, "name": "billing_event", "comment": null}, "budget": {"type": "FLOAT64", "index": 19, "name": "budget", "comment": null}, "budget_mode": {"type": "STRING", "index": 20, "name": "budget_mode", "comment": null}, "campaign_id": {"type": "INT64", "index": 21, "name": "campaign_id", "comment": null}, "carriers": {"type": "STRING", "index": 22, "name": "carriers", "comment": null}, "category": {"type": "INT64", "index": 23, "name": "category", "comment": null}, "click_tracking_url": {"type": "STRING", "index": 24, "name": "click_tracking_url", "comment": null}, "connection_type": {"type": "STRING", "index": 25, "name": "connection_type", "comment": null}, "conversion_bid": {"type": "FLOAT64", "index": 26, "name": "conversion_bid", "comment": null}, "cpv_video_duration": {"type": "STRING", "index": 27, "name": "cpv_video_duration", "comment": null}, "create_time": {"type": "TIMESTAMP", "index": 28, "name": "create_time", "comment": null}, "creative_material_mode": {"type": "STRING", "index": 29, "name": "creative_material_mode", "comment": null}, "dayparting": {"type": "STRING", "index": 30, "name": "dayparting", "comment": null}, "deep_bid_type": {"type": "STRING", "index": 31, "name": "deep_bid_type", "comment": null}, "deep_cpabid": {"type": "FLOAT64", "index": 32, "name": "deep_cpabid", "comment": null}, "deep_external_action": {"type": "STRING", "index": 33, "name": "deep_external_action", "comment": null}, "display_name": {"type": "STRING", "index": 34, "name": "display_name", "comment": null}, "enable_inventory_filter": {"type": "BOOL", "index": 35, "name": "enable_inventory_filter", "comment": null}, "excluded_audience": {"type": "STRING", "index": 36, "name": "excluded_audience", "comment": null}, "external_action": {"type": "STRING", "index": 37, "name": "external_action", "comment": null}, "fallback_type": {"type": "STRING", "index": 38, "name": "fallback_type", "comment": null}, "frequency": {"type": "INT64", "index": 39, "name": "frequency", "comment": null}, "frequency_schedule": {"type": "INT64", "index": 40, "name": "frequency_schedule", "comment": null}, "gender": {"type": "STRING", "index": 41, "name": "gender", "comment": null}, "impression_tracking_url": {"type": "STRING", "index": 42, "name": "impression_tracking_url", "comment": null}, "interest_category_v_2": {"type": "STRING", "index": 43, "name": "interest_category_v_2", "comment": null}, "ios_osv": {"type": "STRING", "index": 44, "name": "ios_osv", "comment": null}, "is_comment_disable": {"type": "INT64", "index": 45, "name": "is_comment_disable", "comment": null}, "is_hfss": {"type": "BOOL", "index": 46, "name": "is_hfss", "comment": null}, "is_new_structure": {"type": "BOOL", "index": 47, "name": "is_new_structure", "comment": null}, "keywords": {"type": "STRING", "index": 48, "name": "keywords", "comment": null}, "landing_page_url": {"type": "STRING", "index": 49, "name": "landing_page_url", "comment": null}, "languages": {"type": "STRING", "index": 50, "name": "languages", "comment": null}, "location": {"type": "STRING", "index": 51, "name": "location", "comment": null}, "open_url": {"type": "STRING", "index": 52, "name": "open_url", "comment": null}, "open_url_type": {"type": "STRING", "index": 53, "name": "open_url_type", "comment": null}, "operation_system": {"type": "STRING", "index": 54, "name": "operation_system", "comment": null}, "opt_status": {"type": "STRING", "index": 55, "name": "opt_status", "comment": null}, "optimize_goal": {"type": "STRING", "index": 56, "name": "optimize_goal", "comment": null}, "pacing": {"type": "STRING", "index": 57, "name": "pacing", "comment": null}, "package": {"type": "STRING", "index": 58, "name": "package", "comment": null}, "pangle_block_app_list_id": {"type": "STRING", "index": 59, "name": "pangle_block_app_list_id", "comment": null}, "pixel_id": {"type": "INT64", "index": 60, "name": "pixel_id", "comment": null}, "placement": {"type": "STRING", "index": 61, "name": "placement", "comment": null}, "placement_type": {"type": "STRING", "index": 62, "name": "placement_type", "comment": null}, "profile_image": {"type": "STRING", "index": 63, "name": "profile_image", "comment": null}, "schedule_end_time": {"type": "TIMESTAMP", "index": 64, "name": "schedule_end_time", "comment": null}, "schedule_start_time": {"type": "TIMESTAMP", "index": 65, "name": "schedule_start_time", "comment": null}, "schedule_type": {"type": "STRING", "index": 66, "name": "schedule_type", "comment": null}, "skip_learning_phase": {"type": "INT64", "index": 67, "name": "skip_learning_phase", "comment": null}, "statistic_type": {"type": "STRING", "index": 68, "name": "statistic_type", "comment": null}, "status": {"type": "STRING", "index": 69, "name": "status", "comment": null}, "video_actions": {"type": "STRING", "index": 70, "name": "video_actions", "comment": null}, "video_download": {"type": "STRING", "index": 71, "name": "video_download", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 2.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 1653.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.tiktok_ads_source.tiktok_ads.adgroup_history"}, "source.tiktok_ads_source.tiktok_ads.ad_report_hourly": {"metadata": {"type": "table", "schema": "tiktok_ads_joe", "name": "ad_report_hourly", "database": "database", "comment": null, "owner": null}, "columns": {"ad_id": {"type": "INT64", "index": 1, "name": "ad_id", "comment": null}, "stat_time_hour": {"type": "DATETIME", "index": 2, "name": "stat_time_hour", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "average_video_play": {"type": "FLOAT64", "index": 4, "name": "average_video_play", "comment": null}, "average_video_play_per_user": {"type": "FLOAT64", "index": 5, "name": "average_video_play_per_user", "comment": null}, "clicks": {"type": "INT64", "index": 6, "name": "clicks", "comment": null}, "comments": {"type": "INT64", "index": 7, "name": "comments", "comment": null}, "conversion": {"type": "INT64", "index": 8, "name": "conversion", "comment": null}, "conversion_rate": {"type": "FLOAT64", "index": 9, "name": "conversion_rate", "comment": null}, "cost_per_1000_reached": {"type": "FLOAT64", "index": 10, "name": "cost_per_1000_reached", "comment": null}, "cost_per_conversion": {"type": "FLOAT64", "index": 11, "name": "cost_per_conversion", "comment": null}, "cost_per_result": {"type": "FLOAT64", "index": 12, "name": "cost_per_result", "comment": null}, "cost_per_secondary_goal_result": {"type": "STRING", "index": 13, "name": "cost_per_secondary_goal_result", "comment": null}, "cpc": {"type": "FLOAT64", "index": 14, "name": "cpc", "comment": null}, "cpm": {"type": "FLOAT64", "index": 15, "name": "cpm", "comment": null}, "ctr": {"type": "FLOAT64", "index": 16, "name": "ctr", "comment": null}, "follows": {"type": "INT64", "index": 17, "name": "follows", "comment": null}, "impressions": {"type": "INT64", "index": 18, "name": "impressions", "comment": null}, "likes": {"type": "INT64", "index": 19, "name": "likes", "comment": null}, "profile_visits": {"type": "INT64", "index": 20, "name": "profile_visits", "comment": null}, "profile_visits_rate": {"type": "FLOAT64", "index": 21, "name": "profile_visits_rate", "comment": null}, "reach": {"type": "INT64", "index": 22, "name": "reach", "comment": null}, "real_time_conversion": {"type": "INT64", "index": 23, "name": "real_time_conversion", "comment": null}, "real_time_conversion_rate": {"type": "FLOAT64", "index": 24, "name": "real_time_conversion_rate", "comment": null}, "real_time_cost_per_conversion": {"type": "FLOAT64", "index": 25, "name": "real_time_cost_per_conversion", "comment": null}, "real_time_cost_per_result": {"type": "FLOAT64", "index": 26, "name": "real_time_cost_per_result", "comment": null}, "real_time_result": {"type": "INT64", "index": 27, "name": "real_time_result", "comment": null}, "real_time_result_rate": {"type": "FLOAT64", "index": 28, "name": "real_time_result_rate", "comment": null}, "result": {"type": "INT64", "index": 29, "name": "result", "comment": null}, "result_rate": {"type": "FLOAT64", "index": 30, "name": "result_rate", "comment": null}, "sales_lead": {"type": "FLOAT64", "index": 31, "name": "sales_lead", "comment": null}, "secondary_goal_result": {"type": "STRING", "index": 32, "name": "secondary_goal_result", "comment": null}, "secondary_goal_result_rate": {"type": "STRING", "index": 33, "name": "secondary_goal_result_rate", "comment": null}, "shares": {"type": "INT64", "index": 34, "name": "shares", "comment": null}, "spend": {"type": "FLOAT64", "index": 35, "name": "spend", "comment": null}, "total_purchase": {"type": "FLOAT64", "index": 36, "name": "total_purchase", "comment": null}, "total_purchase_value": {"type": "FLOAT64", "index": 37, "name": "total_purchase_value", "comment": null}, "total_sales_lead": {"type": "FLOAT64", "index": 38, "name": "total_sales_lead", "comment": null}, "total_sales_lead_value": {"type": "FLOAT64", "index": 39, "name": "total_sales_lead_value", "comment": null}, "video_play_actions": {"type": "INT64", "index": 40, "name": "video_play_actions", "comment": null}, "video_views_p_100": {"type": "INT64", "index": 41, "name": "video_views_p_100", "comment": null}, "video_views_p_25": {"type": "INT64", "index": 42, "name": "video_views_p_25", "comment": null}, "video_views_p_50": {"type": "INT64", "index": 43, "name": "video_views_p_50", "comment": null}, "video_views_p_75": {"type": "INT64", "index": 44, "name": "video_views_p_75", "comment": null}, "video_watched_2_s": {"type": "INT64", "index": 45, "name": "video_watched_2_s", "comment": null}, "video_watched_6_s": {"type": "INT64", "index": 46, "name": "video_watched_6_s", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 26.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 9178.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.tiktok_ads_source.tiktok_ads.ad_report_hourly"}, "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly": {"metadata": {"type": "table", "schema": "tiktok_ads_joe", "name": "adgroup_report_hourly", "database": "database", "comment": null, "owner": null}, "columns": {"adgroup_id": {"type": "INT64", "index": 1, "name": "adgroup_id", "comment": null}, "stat_time_hour": {"type": "DATETIME", "index": 2, "name": "stat_time_hour", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "average_video_play": {"type": "FLOAT64", "index": 4, "name": "average_video_play", "comment": null}, "average_video_play_per_user": {"type": "FLOAT64", "index": 5, "name": "average_video_play_per_user", "comment": null}, "clicks": {"type": "INT64", "index": 6, "name": "clicks", "comment": null}, "comments": {"type": "INT64", "index": 7, "name": "comments", "comment": null}, "conversion": {"type": "INT64", "index": 8, "name": "conversion", "comment": null}, "conversion_rate": {"type": "FLOAT64", "index": 9, "name": "conversion_rate", "comment": null}, "cost_per_1000_reached": {"type": "FLOAT64", "index": 10, "name": "cost_per_1000_reached", "comment": null}, "cost_per_conversion": {"type": "FLOAT64", "index": 11, "name": "cost_per_conversion", "comment": null}, "cost_per_result": {"type": "FLOAT64", "index": 12, "name": "cost_per_result", "comment": null}, "cost_per_secondary_goal_result": {"type": "STRING", "index": 13, "name": "cost_per_secondary_goal_result", "comment": null}, "cpc": {"type": "FLOAT64", "index": 14, "name": "cpc", "comment": null}, "cpm": {"type": "FLOAT64", "index": 15, "name": "cpm", "comment": null}, "ctr": {"type": "FLOAT64", "index": 16, "name": "ctr", "comment": null}, "follows": {"type": "INT64", "index": 17, "name": "follows", "comment": null}, "impressions": {"type": "INT64", "index": 18, "name": "impressions", "comment": null}, "likes": {"type": "INT64", "index": 19, "name": "likes", "comment": null}, "profile_visits": {"type": "INT64", "index": 20, "name": "profile_visits", "comment": null}, "profile_visits_rate": {"type": "FLOAT64", "index": 21, "name": "profile_visits_rate", "comment": null}, "reach": {"type": "INT64", "index": 22, "name": "reach", "comment": null}, "real_time_conversion": {"type": "INT64", "index": 23, "name": "real_time_conversion", "comment": null}, "real_time_conversion_rate": {"type": "FLOAT64", "index": 24, "name": "real_time_conversion_rate", "comment": null}, "real_time_cost_per_conversion": {"type": "FLOAT64", "index": 25, "name": "real_time_cost_per_conversion", "comment": null}, "real_time_cost_per_result": {"type": "FLOAT64", "index": 26, "name": "real_time_cost_per_result", "comment": null}, "real_time_result": {"type": "INT64", "index": 27, "name": "real_time_result", "comment": null}, "real_time_result_rate": {"type": "FLOAT64", "index": 28, "name": "real_time_result_rate", "comment": null}, "result": {"type": "INT64", "index": 29, "name": "result", "comment": null}, "result_rate": {"type": "FLOAT64", "index": 30, "name": "result_rate", "comment": null}, "sales_lead": {"type": "FLOAT64", "index": 31, "name": "sales_lead", "comment": null}, "secondary_goal_result": {"type": "STRING", "index": 32, "name": "secondary_goal_result", "comment": null}, "secondary_goal_result_rate": {"type": "STRING", "index": 33, "name": "secondary_goal_result_rate", "comment": null}, "shares": {"type": "INT64", "index": 34, "name": "shares", "comment": null}, "spend": {"type": "FLOAT64", "index": 35, "name": "spend", "comment": null}, "total_purchase": {"type": "FLOAT64", "index": 36, "name": "total_purchase", "comment": null}, "total_purchase_value": {"type": "FLOAT64", "index": 37, "name": "total_purchase_value", "comment": null}, "total_sales_lead": {"type": "FLOAT64", "index": 38, "name": "total_sales_lead", "comment": null}, "total_sales_lead_value": {"type": "FLOAT64", "index": 39, "name": "total_sales_lead_value", "comment": null}, "video_play_actions": {"type": "INT64", "index": 40, "name": "video_play_actions", "comment": null}, "video_views_p_100": {"type": "INT64", "index": 41, "name": "video_views_p_100", "comment": null}, "video_views_p_25": {"type": "INT64", "index": 42, "name": "video_views_p_25", "comment": null}, "video_views_p_50": {"type": "INT64", "index": 43, "name": "video_views_p_50", "comment": null}, "video_views_p_75": {"type": "INT64", "index": 44, "name": "video_views_p_75", "comment": null}, "video_watched_2_s": {"type": "INT64", "index": 45, "name": "video_watched_2_s", "comment": null}, "video_watched_6_s": {"type": "INT64", "index": 46, "name": "video_watched_6_s", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 26.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 9178.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly"}}, "errors": null} \ No newline at end of file diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..fa8b08b --- /dev/null +++ b/docs/index.html @@ -0,0 +1,102 @@ + + + + + + + dbt Docs + + + + + + + + + + + + + + + + + +
icons
+
+ + diff --git a/docs/manifest.json b/docs/manifest.json index 5726993..739593f 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -1 +1 @@ -{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v4.json", "dbt_version": "1.0.0", "generated_at": "2022-07-19T17:44:46.074116Z", "invocation_id": "6dabac40-7cab-45b6-976c-67e398be82f2", "env": {}, "project_id": "faebc42304447d4427374f806679ecb5", "user_id": "e607f749-4294-4b15-833b-0ae4a87d4d24", "send_anonymous_usage_stats": true, "adapter_type": "bigquery"}, "nodes": {"model.tiktok_ads.int_tiktok_ads__most_recent_campaign": {"raw_sql": "with base as (\n\n select *\n from {{ var('campaign_history') }}\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "ephemeral", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads", "intermediate", "int_tiktok_ads__most_recent_campaign"], "unique_id": "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "intermediate/int_tiktok_ads__most_recent_campaign.sql", "original_file_path": "models/intermediate/int_tiktok_ads__most_recent_campaign.sql", "name": "int_tiktok_ads__most_recent_campaign", "alias": "int_tiktok_ads__most_recent_campaign", "checksum": {"name": "sha256", "checksum": "6c395cfec3d0d6060d64883569154a087d790db7a438b72cea679e96e4fdd220"}, "tags": [], "refs": [["stg_tiktok_ads__campaign_history"]], "sources": [], "description": "Each record in this table represents the most recent data for each campaign.", "columns": {"campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_type": {"name": "campaign_type", "description": "Campaign Type, indicates the campaign is a regular campaign or iOS 14 campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "split_test_variable": {"name": "split_test_variable", "description": "Split Test variables. Optional values; TARGETING, BIDDING_OPTIMIZATION , CREATIVE.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/intermediate/intermediate.yml", "compiled_path": "target/compiled/tiktok_ads/models/intermediate/int_tiktok_ads__most_recent_campaign.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "ephemeral"}, "created_at": 1658244909.3519292, "compiled_sql": "with base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null}, "model.tiktok_ads.int_tiktok_ads__most_recent_ad": {"raw_sql": "with base as (\n\n select *\n from {{ var('ad_history') }}\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "ephemeral", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads", "intermediate", "int_tiktok_ads__most_recent_ad"], "unique_id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "intermediate/int_tiktok_ads__most_recent_ad.sql", "original_file_path": "models/intermediate/int_tiktok_ads__most_recent_ad.sql", "name": "int_tiktok_ads__most_recent_ad", "alias": "int_tiktok_ads__most_recent_ad", "checksum": {"name": "sha256", "checksum": "418d75ad47295f6fe67385f0c94e018602e4028dc4cf52a28e9f7006121ad7d7"}, "tags": [], "refs": [["stg_tiktok_ads__ad_history"]], "sources": [], "description": "Each record in this table represents the most recent data for each ad.", "columns": {"ad_id": {"name": "ad_id", "description": "Ad ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "base_url": {"name": "base_url", "description": "The base URL of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_name": {"name": "ad_name", "description": "Ad Name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_text": {"name": "ad_text", "description": "The ad text.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "call_to_action": {"name": "call_to_action", "description": "Call to action values.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "click_tracking_url": {"name": "click_tracking_url", "description": "Click monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impression_tracking_url": {"name": "impression_tracking_url", "description": "Display monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_host": {"name": "url_host", "description": "The URL host of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_path": {"name": "url_path", "description": "The URL path of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_source": {"name": "utm_source", "description": "The utm_source parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_medium": {"name": "utm_medium", "description": "The utm_medium parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_campaign": {"name": "utm_campaign", "description": "The utm_campaign parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_content": {"name": "utm_content", "description": "The utm_content parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_term": {"name": "utm_term", "description": "The utm_term parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_id": {"name": "video_id", "description": "The video ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/intermediate/intermediate.yml", "compiled_path": "target/compiled/tiktok_ads/models/intermediate/int_tiktok_ads__most_recent_ad.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "ephemeral"}, "created_at": 1658244909.348017, "compiled_sql": "with base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null}, "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group": {"raw_sql": "with base as (\n\n select *\n from {{ var('ad_group_history') }}\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "ephemeral", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads", "intermediate", "int_tiktok_ads__most_recent_ad_group"], "unique_id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "intermediate/int_tiktok_ads__most_recent_ad_group.sql", "original_file_path": "models/intermediate/int_tiktok_ads__most_recent_ad_group.sql", "name": "int_tiktok_ads__most_recent_ad_group", "alias": "int_tiktok_ads__most_recent_ad_group", "checksum": {"name": "sha256", "checksum": "a1d9693e48ac9773013bd17c70506c937b917254481075d677d7e989e9665358"}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_history"]], "sources": [], "description": "Each record in this table represents the most recent data for each ad group.", "columns": {"ad_group_id": {"name": "ad_group_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The Ad group's campaign ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_days": {"name": "action_days", "description": "Action days", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "Ad group name. Character limit is 512 and cannot contain emoji.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "age": {"name": "age", "description": "Age groups you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience_type": {"name": "audience_type", "description": "Audience Type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "category": {"name": "category", "description": "Ad group category.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "display_name": {"name": "display_name", "description": "Display name of ad group.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency": {"name": "frequency", "description": "frequency, together with frequency_schedule, controls how often people see your ad (only available for REACH ads). For example, frequency = 2 frequency_schedule = 3 means \"show ads no more than twice every 3 day\".\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency_schedule": {"name": "frequency_schedule", "description": "frequency, together with frequency, controls how often people see your ad (only available for REACH ads).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_download": {"name": "video_download", "description": "Whether the video is allowed to be downloaded.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "languages": {"name": "languages", "description": "Codes of the languages that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/intermediate/intermediate.yml", "compiled_path": "target/compiled/tiktok_ads/models/intermediate/int_tiktok_ads__most_recent_ad_group.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "ephemeral"}, "created_at": 1658244909.338349, "compiled_sql": "with base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__ad_group_history_tmp') }}\n\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__ad_group_history_tmp')),\n staging_columns=get_ad_group_history_columns()\n )\n }}\n\n from base\n\n), \n\nfinal as (\n\n select \n adgroup_id as ad_group_id,\n cast(updated_at as {{ dbt_utils.type_timestamp() }}) as updated_at,\n advertiser_id,\n campaign_id,\n action_days,\n action_categories,\n adgroup_name as ad_group_name,\n age,\n audience_type,\n budget,\n category,\n display_name,\n interest_category_v_2 as interest_category,\n frequency,\n frequency_schedule,\n gender,\n languages, \n landing_page_url,\n cast(_fivetran_synced as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced\n from fields\n\n), \n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by ad_group_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n\n)\n\nselect * from most_recent", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_ad_group_history_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.persist_docs"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__ad_group_history"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__ad_group_history.sql", "original_file_path": "models/stg_tiktok_ads__ad_group_history.sql", "name": "stg_tiktok_ads__ad_group_history", "alias": "stg_tiktok_ads__ad_group_history", "checksum": {"name": "sha256", "checksum": "4d843f63ac431a0500151055902258c50993aa9d985af1871c02a9c6acdf20ee"}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_history_tmp"], ["stg_tiktok_ads__ad_group_history_tmp"]], "sources": [], "description": "Each record represents data for each ad group.", "columns": {"ad_group_id": {"name": "ad_group_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_categories": {"name": "action_categories", "description": "IDs of the action categories (behaviors) that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The Ad group's campaign ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_days": {"name": "action_days", "description": "Action days", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "Ad group name. Character limit is 512 and cannot contain emoji.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "age": {"name": "age", "description": "Age groups you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience_type": {"name": "audience_type", "description": "Audience Type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget": {"name": "budget", "description": "Ad budget. Returns 0.0 when Campaign Budget Optimization (budget_optimize_switch) is on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "category": {"name": "category", "description": "Ad group category.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "display_name": {"name": "display_name", "description": "Display name of ad group.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "interest_category": {"name": "interest_category", "description": "Interest classification. If the interest is specified, users that do not meet interest target will be excluded during delivery.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency": {"name": "frequency", "description": "frequency, together with frequency_schedule, controls how often people see your ad (only available for REACH ads). For example, frequency = 2 frequency_schedule = 3 means \"show ads no more than twice every 3 day\".\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency_schedule": {"name": "frequency_schedule", "description": "frequency, together with frequency, controls how often people see your ad (only available for REACH ads).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "languages": {"name": "languages", "description": "Codes of the languages that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__ad_group_history.sql", "build_path": "target/run/tiktok_ads_source/models/stg_tiktok_ads__ad_group_history.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1658244909.520811, "compiled_sql": "with base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_group_history_tmp`\n\n), \n\nfields as (\n\n select\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n action_days\n \n as \n \n action_days\n \n, \n \n \n adgroup_id\n \n as \n \n adgroup_id\n \n, \n \n \n adgroup_name\n \n as \n \n adgroup_name\n \n, \n \n \n advertiser_id\n \n as \n \n advertiser_id\n \n, \n \n \n android_osv\n \n as \n \n android_osv\n \n, \n \n \n app_download_url\n \n as \n \n app_download_url\n \n, \n \n \n app_id\n \n as \n \n app_id\n \n, \n \n \n app_name\n \n as \n \n app_name\n \n, \n \n \n app_type\n \n as \n \n app_type\n \n, \n \n \n audience_type\n \n as \n \n audience_type\n \n, \n \n \n bid\n \n as \n \n bid\n \n, \n \n \n bid_type\n \n as \n \n bid_type\n \n, \n \n \n billing_event\n \n as \n \n billing_event\n \n, \n \n \n budget\n \n as \n \n budget\n \n, \n \n \n budget_mode\n \n as \n \n budget_mode\n \n, \n \n \n campaign_id\n \n as \n \n campaign_id\n \n, \n \n \n category\n \n as \n \n category\n \n, \n \n \n click_tracking_url\n \n as \n \n click_tracking_url\n \n, \n \n \n conversion_bid\n \n as \n \n conversion_bid\n \n, \n \n \n cpv_video_duration\n \n as \n \n cpv_video_duration\n \n, \n \n \n create_time\n \n as \n \n create_time\n \n, \n \n \n creative_material_mode\n \n as \n \n creative_material_mode\n \n, \n \n \n dayparting\n \n as \n \n dayparting\n \n, \n \n \n deep_bid_type\n \n as \n \n deep_bid_type\n \n, \n \n \n deep_cpabid\n \n as \n \n deep_cpabid\n \n, \n \n \n deep_external_action\n \n as \n \n deep_external_action\n \n, \n \n \n display_name\n \n as \n \n display_name\n \n, \n \n \n enable_inventory_filter\n \n as \n \n enable_inventory_filter\n \n, \n \n \n external_action\n \n as \n \n external_action\n \n, \n \n \n fallback_type\n \n as \n \n fallback_type\n \n, \n \n \n frequency\n \n as \n \n frequency\n \n, \n \n \n frequency_schedule\n \n as \n \n frequency_schedule\n \n, \n \n \n gender\n \n as \n \n gender\n \n, \n \n \n impression_tracking_url\n \n as \n \n impression_tracking_url\n \n, \n \n \n ios_osv\n \n as \n \n ios_osv\n \n, \n \n \n is_comment_disable\n \n as \n \n is_comment_disable\n \n, \n \n \n is_hfss\n \n as \n \n is_hfss\n \n, \n \n \n is_new_structure\n \n as \n \n is_new_structure\n \n, \n \n \n landing_page_url\n \n as \n \n landing_page_url\n \n, \n \n \n open_url\n \n as \n \n open_url\n \n, \n \n \n open_url_type\n \n as \n \n open_url_type\n \n, \n \n \n opt_status\n \n as \n \n opt_status\n \n, \n \n \n optimize_goal\n \n as \n \n optimize_goal\n \n, \n \n \n pacing\n \n as \n \n pacing\n \n, \n \n \n package\n \n as \n \n package\n \n, \n \n \n pixel_id\n \n as \n \n pixel_id\n \n, \n \n \n placement_type\n \n as \n \n placement_type\n \n, \n \n \n profile_image\n \n as \n \n profile_image\n \n, \n \n \n schedule_end_time\n \n as \n \n schedule_end_time\n \n, \n \n \n schedule_start_time\n \n as \n \n schedule_start_time\n \n, \n \n \n schedule_type\n \n as \n \n schedule_type\n \n, \n \n \n skip_learning_phase\n \n as \n \n skip_learning_phase\n \n, \n \n \n statistic_type\n \n as \n \n statistic_type\n \n, \n \n \n status\n \n as \n \n status\n \n, \n \n \n updated_at\n \n as \n \n updated_at\n \n, \n \n \n video_download\n \n as \n \n video_download\n \n, \n \n \n audience\n \n as \n \n audience\n \n, \n \n \n excluded_audience\n \n as \n \n excluded_audience\n \n, \n \n \n location\n \n as \n \n location\n \n, \n \n \n interest_category_v_2\n \n as \n \n interest_category_v_2\n \n, \n \n \n pangle_block_app_list_id\n \n as \n \n pangle_block_app_list_id\n \n, \n \n \n action_categories\n \n as \n \n action_categories\n \n, \n \n \n placement\n \n as \n \n placement\n \n, \n \n \n keywords\n \n as \n \n keywords\n \n, \n \n \n age\n \n as \n \n age\n \n, \n \n \n languages\n \n as \n \n languages\n \n\n\n\n\n from base\n\n), \n\nfinal as (\n\n select \n adgroup_id as ad_group_id,\n cast(updated_at as \n timestamp\n) as updated_at,\n advertiser_id,\n campaign_id,\n action_days,\n action_categories,\n adgroup_name as ad_group_name,\n age,\n audience_type,\n budget,\n category,\n display_name,\n interest_category_v_2 as interest_category,\n frequency,\n frequency_schedule,\n gender,\n languages, \n landing_page_url,\n cast(_fivetran_synced as \n timestamp\n) as _fivetran_synced\n from fields\n\n), \n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by ad_group_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n\n)\n\nselect * from most_recent", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_group_history`"}, "model.tiktok_ads_source.stg_tiktok_ads__advertiser": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__advertiser_tmp') }}\n\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__advertiser_tmp')),\n staging_columns=get_advertiser_columns()\n )\n }}\n\n from base\n\n), \n\nfinal as (\n\n select \n id as advertiser_id, \n address, \n balance, \n company, \n contacter, \n country, \n currency, \n description, \n email, \n industry, \n language,\n name as advertiser_name, \n phone_number, \n telephone, \n timezone,\n cast(_fivetran_synced as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced\n from fields\n\n)\n\nselect * from final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_advertiser_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.persist_docs"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp", "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__advertiser"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__advertiser.sql", "original_file_path": "models/stg_tiktok_ads__advertiser.sql", "name": "stg_tiktok_ads__advertiser", "alias": "stg_tiktok_ads__advertiser", "checksum": {"name": "sha256", "checksum": "ea57cac495f083449b4e4f35bd88581ac909156fdda0023a7a52ca0f43c6aa42"}, "tags": [], "refs": [["stg_tiktok_ads__advertiser_tmp"], ["stg_tiktok_ads__advertiser_tmp"]], "sources": [], "description": "Each record represents data for each advertiser.", "columns": {"advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "address": {"name": "address", "description": "Advertiser address information", "meta": {}, "data_type": null, "quote": null, "tags": []}, "balance": {"name": "balance", "description": "Account available balance", "meta": {}, "data_type": null, "quote": null, "tags": []}, "company": {"name": "company", "description": "Advertiser's company name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "contacter": {"name": "contacter", "description": "Contact Person", "meta": {}, "data_type": null, "quote": null, "tags": []}, "country": {"name": "country", "description": "The advertiser's country", "meta": {}, "data_type": null, "quote": null, "tags": []}, "create_time": {"name": "create_time", "description": "Advertiser's create time", "meta": {}, "data_type": null, "quote": null, "tags": []}, "currency": {"name": "currency", "description": "Type of currency used by advertisers", "meta": {}, "data_type": null, "quote": null, "tags": []}, "description": {"name": "description", "description": "Brand description, i.e. promotional content", "meta": {}, "data_type": null, "quote": null, "tags": []}, "email": {"name": "email", "description": "Advertiser contact email, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "industry": {"name": "industry", "description": "Advertiser industry category", "meta": {}, "data_type": null, "quote": null, "tags": []}, "language": {"name": "language", "description": "Language used by advertisers", "meta": {}, "data_type": null, "quote": null, "tags": []}, "license_no": {"name": "license_no", "description": "License number", "meta": {}, "data_type": null, "quote": null, "tags": []}, "license_url": {"name": "license_url", "description": "License preview address, the link is valid for an hour by default.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_name": {"name": "advertiser_name", "description": "Advertiser name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "phone_number": {"name": "phone_number", "description": "Contact mobile number, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "telephone": {"name": "telephone", "description": "Fixed phone number, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "timezone": {"name": "timezone", "description": "Ad account time zone including GMT offset", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__advertiser.sql", "build_path": "target/run/tiktok_ads_source/models/stg_tiktok_ads__advertiser.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1658244909.512266, "compiled_sql": "with base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__advertiser_tmp`\n\n), \n\nfields as (\n\n select\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n address\n \n as \n \n address\n \n, \n \n \n balance\n \n as \n \n balance\n \n, \n \n \n company\n \n as \n \n company\n \n, \n \n \n contacter\n \n as \n \n contacter\n \n, \n \n \n country\n \n as \n \n country\n \n, \n \n \n create_time\n \n as \n \n create_time\n \n, \n \n \n currency\n \n as \n \n currency\n \n, \n \n \n description\n \n as \n \n description\n \n, \n \n \n email\n \n as \n \n email\n \n, \n \n \n id\n \n as \n \n id\n \n, \n \n \n industry\n \n as \n \n industry\n \n, \n \n \n language\n \n as \n \n language\n \n, \n \n \n license_no\n \n as \n \n license_no\n \n, \n \n \n license_url\n \n as \n \n license_url\n \n, \n \n \n name\n \n as \n \n name\n \n, \n \n \n phone_number\n \n as \n \n phone_number\n \n, \n \n \n promotion_area\n \n as \n \n promotion_area\n \n, \n \n \n reason\n \n as \n \n reason\n \n, \n \n \n role\n \n as \n \n role\n \n, \n \n \n status\n \n as \n \n status\n \n, \n \n \n telephone\n \n as \n \n telephone\n \n, \n \n \n timezone\n \n as \n \n timezone\n \n\n\n\n\n from base\n\n), \n\nfinal as (\n\n select \n id as advertiser_id, \n address, \n balance, \n company, \n contacter, \n country, \n currency, \n description, \n email, \n industry, \n language,\n name as advertiser_name, \n phone_number, \n telephone, \n timezone,\n cast(_fivetran_synced as \n timestamp\n) as _fivetran_synced\n from fields\n\n)\n\nselect * from final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__advertiser`"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_history": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__ad_history_tmp') }}\n\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__ad_history_tmp')),\n staging_columns=get_ad_history_columns()\n )\n }}\n\n from base\n\n), \n\nfinal as (\n\n select \n ad_id,\n cast(updated_at as {{ dbt_utils.type_timestamp() }}) as updated_at,\n adgroup_id as ad_group_id,\n advertiser_id,\n campaign_id,\n ad_name,\n ad_text,\n call_to_action,\n click_tracking_url,\n impression_tracking_url,\n {{ dbt_utils.split_part('landing_page_url', \"'?'\", 1) }} as base_url,\n {{ dbt_utils.get_url_host('landing_page_url') }} as url_host,\n '/' || {{ dbt_utils.get_url_path('landing_page_url') }} as url_path,\n {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_source') }} as utm_source,\n {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_medium') }} as utm_medium,\n {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_campaign') }} as utm_campaign,\n {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_content') }} as utm_content,\n {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_term') }} as utm_term,\n landing_page_url,\n video_id,\n cast(_fivetran_synced as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced,\n from fields\n\n), \n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by ad_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n\n)\n\nselect * from most_recent", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_ad_history_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp", "macro.dbt_utils.split_part", "macro.dbt_utils.get_url_host", "macro.dbt_utils.get_url_path", "macro.dbt_utils.get_url_parameter", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.persist_docs"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__ad_history"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__ad_history.sql", "original_file_path": "models/stg_tiktok_ads__ad_history.sql", "name": "stg_tiktok_ads__ad_history", "alias": "stg_tiktok_ads__ad_history", "checksum": {"name": "sha256", "checksum": "0b295a3935ba7b401b8e8bec0a80f51ce4051c23a80416f981bdb90620e299a6"}, "tags": [], "refs": [["stg_tiktok_ads__ad_history_tmp"], ["stg_tiktok_ads__ad_history_tmp"]], "sources": [], "description": "Each record represents data for each ad.", "columns": {"ad_id": {"name": "ad_id", "description": "Ad ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "base_url": {"name": "base_url", "description": "The base URL of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_name": {"name": "ad_name", "description": "Ad Name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_text": {"name": "ad_text", "description": "The ad text.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "call_to_action": {"name": "call_to_action", "description": "Call to action values.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "click_tracking_url": {"name": "click_tracking_url", "description": "Click monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impression_tracking_url": {"name": "impression_tracking_url", "description": "Display monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_host": {"name": "url_host", "description": "The URL host of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_path": {"name": "url_path", "description": "The URL path of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_source": {"name": "utm_source", "description": "The utm_source parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_medium": {"name": "utm_medium", "description": "The utm_medium parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_campaign": {"name": "utm_campaign", "description": "The utm_campaign parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_content": {"name": "utm_content", "description": "The utm_content parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_term": {"name": "utm_term", "description": "The utm_term parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_id": {"name": "video_id", "description": "The video ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__ad_history.sql", "build_path": "target/run/tiktok_ads_source/models/stg_tiktok_ads__ad_history.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1658244909.5304372, "compiled_sql": "with base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_history_tmp`\n\n), \n\nfields as (\n\n select\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n ad_id\n \n as \n \n ad_id\n \n, \n \n \n ad_name\n \n as \n \n ad_name\n \n, \n \n \n ad_text\n \n as \n \n ad_text\n \n, \n \n \n adgroup_id\n \n as \n \n adgroup_id\n \n, \n \n \n advertiser_id\n \n as \n \n advertiser_id\n \n, \n \n \n app_name\n \n as \n \n app_name\n \n, \n \n \n call_to_action\n \n as \n \n call_to_action\n \n, \n \n \n campaign_id\n \n as \n \n campaign_id\n \n, \n \n \n click_tracking_url\n \n as \n \n click_tracking_url\n \n, \n \n \n create_time\n \n as \n \n create_time\n \n, \n \n \n display_name\n \n as \n \n display_name\n \n, \n \n \n impression_tracking_url\n \n as \n \n impression_tracking_url\n \n, \n \n \n is_aco\n \n as \n \n is_aco\n \n, \n \n \n is_creative_authorized\n \n as \n \n is_creative_authorized\n \n, \n \n \n is_new_structure\n \n as \n \n is_new_structure\n \n, \n \n \n landing_page_url\n \n as \n \n landing_page_url\n \n, \n \n \n open_url\n \n as \n \n open_url\n \n, \n \n \n opt_status\n \n as \n \n opt_status\n \n, \n \n \n playable_url\n \n as \n \n playable_url\n \n, \n \n \n profile_image\n \n as \n \n profile_image\n \n, \n \n \n status\n \n as \n \n status\n \n, \n \n \n updated_at\n \n as \n \n updated_at\n \n, \n \n \n video_id\n \n as \n \n video_id\n \n, \n \n \n image_ids\n \n as \n \n image_ids\n \n\n\n\n\n from base\n\n), \n\nfinal as (\n\n select \n ad_id,\n cast(updated_at as \n timestamp\n) as updated_at,\n adgroup_id as ad_group_id,\n advertiser_id,\n campaign_id,\n ad_name,\n ad_text,\n call_to_action,\n click_tracking_url,\n impression_tracking_url,\n \n\n \n split(\n landing_page_url,\n '?'\n )[safe_offset(0)]\n \n\n as base_url,\n \n safe_cast(\n\n \n split(\n \n\n \n split(\n \n\n replace(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'android-app://',\n ''\n )\n \n\n,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n '/'\n )[safe_offset(0)]\n \n\n,\n '?'\n )[safe_offset(0)]\n \n\n as \n string\n)\n as url_host,\n '/' || \n safe_cast(\n\n \n split(\n \n\n case when \n \n length(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n\n )-coalesce(\n nullif(\n\n strpos(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n '/'\n \n ), 0),\n \n\n strpos(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n '?'\n \n ) - 1\n ) = 0 \n then ''\n else \n substr(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n -1 * (\n \n length(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n\n )-coalesce(\n nullif(\n\n strpos(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n '/'\n \n ), 0),\n \n\n strpos(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n '?'\n \n ) - 1\n ))\n )\n end,\n '?'\n )[safe_offset(0)]\n \n\n as \n string\n)\n as url_path,\n nullif(\n\n \n split(\n \n\n \n split(\n landing_page_url,\n 'utm_source='\n )[safe_offset(1)]\n \n\n,\n '&'\n )[safe_offset(0)]\n \n\n,'') as utm_source,\n nullif(\n\n \n split(\n \n\n \n split(\n landing_page_url,\n 'utm_medium='\n )[safe_offset(1)]\n \n\n,\n '&'\n )[safe_offset(0)]\n \n\n,'') as utm_medium,\n nullif(\n\n \n split(\n \n\n \n split(\n landing_page_url,\n 'utm_campaign='\n )[safe_offset(1)]\n \n\n,\n '&'\n )[safe_offset(0)]\n \n\n,'') as utm_campaign,\n nullif(\n\n \n split(\n \n\n \n split(\n landing_page_url,\n 'utm_content='\n )[safe_offset(1)]\n \n\n,\n '&'\n )[safe_offset(0)]\n \n\n,'') as utm_content,\n nullif(\n\n \n split(\n \n\n \n split(\n landing_page_url,\n 'utm_term='\n )[safe_offset(1)]\n \n\n,\n '&'\n )[safe_offset(0)]\n \n\n,'') as utm_term,\n landing_page_url,\n video_id,\n cast(_fivetran_synced as \n timestamp\n) as _fivetran_synced,\n from fields\n\n), \n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by ad_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n\n)\n\nselect * from most_recent", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_history`"}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_history": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__campaign_history_tmp') }}\n\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__campaign_history_tmp')),\n staging_columns=get_campaign_history_columns()\n )\n }}\n \n from base\n\n), \n\nfinal as (\n\n select \n campaign_id, \n cast(updated_at as {{ dbt_utils.type_timestamp() }}) as updated_at,\n advertiser_id, \n campaign_name, \n campaign_type, \n split_test_variable,\n cast(_fivetran_synced as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced\n\n from fields\n\n), \n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by campaign_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n\n)\n\nselect * from most_recent", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_campaign_history_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.persist_docs"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__campaign_history"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__campaign_history.sql", "original_file_path": "models/stg_tiktok_ads__campaign_history.sql", "name": "stg_tiktok_ads__campaign_history", "alias": "stg_tiktok_ads__campaign_history", "checksum": {"name": "sha256", "checksum": "35a02027d9ca3690939568301f43e56471c777fbf33db541cf46d48626a7e8fe"}, "tags": [], "refs": [["stg_tiktok_ads__campaign_history_tmp"], ["stg_tiktok_ads__campaign_history_tmp"]], "sources": [], "description": "Each record represents data for each campaign.", "columns": {"campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_type": {"name": "campaign_type", "description": "Campaign Type, indicates the campaign is a regular campaign or iOS 14 campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "split_test_variable": {"name": "split_test_variable", "description": "Split Test variables. Optional values; TARGETING, BIDDING_OPTIMIZATION , CREATIVE.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__campaign_history.sql", "build_path": "target/run/tiktok_ads_source/models/stg_tiktok_ads__campaign_history.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1658244909.534303, "compiled_sql": "with base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_history_tmp`\n\n), \n\nfields as (\n\n select\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n advertiser_id\n \n as \n \n advertiser_id\n \n, \n \n \n budget\n \n as \n \n budget\n \n, \n \n \n budget_mode\n \n as \n \n budget_mode\n \n, \n \n \n campaign_id\n \n as \n \n campaign_id\n \n, \n \n \n campaign_name\n \n as \n \n campaign_name\n \n, \n \n \n campaign_type\n \n as \n \n campaign_type\n \n, \n \n \n create_time\n \n as \n \n create_time\n \n, \n \n \n is_new_structure\n \n as \n \n is_new_structure\n \n, \n \n \n objective_type\n \n as \n \n objective_type\n \n, \n \n \n opt_status\n \n as \n \n opt_status\n \n, \n \n \n split_test_variable\n \n as \n \n split_test_variable\n \n, \n \n \n updated_at\n \n as \n \n updated_at\n \n\n\n\n \n from base\n\n), \n\nfinal as (\n\n select \n campaign_id, \n cast(updated_at as \n timestamp\n) as updated_at,\n advertiser_id, \n campaign_name, \n campaign_type, \n split_test_variable,\n cast(_fivetran_synced as \n timestamp\n) as _fivetran_synced\n\n from fields\n\n), \n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by campaign_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n\n)\n\nselect * from most_recent", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_history`"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp": {"raw_sql": "select *\nfrom {{ var('ad_report_hourly') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt.create_or_replace_view", "macro.dbt.persist_docs"], "nodes": ["source.tiktok_ads_source.tiktok_ads.ad_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__ad_report_hourly_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__ad_report_hourly_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__ad_report_hourly_tmp.sql", "name": "stg_tiktok_ads__ad_report_hourly_tmp", "alias": "stg_tiktok_ads__ad_report_hourly_tmp", "checksum": {"name": "sha256", "checksum": "a487182a6ea56715aff4fb53a16e8e185223097096f8b06c53beeaf354bffb3f"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "ad_report_hourly"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_report_hourly_tmp.sql", "build_path": "target/run/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_report_hourly_tmp.sql", "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1658244909.106455, "compiled_sql": "select *\nfrom `database`.`tiktok_ads_joe`.`ad_report_hourly`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_report_hourly_tmp`"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp": {"raw_sql": "select *\nfrom {{ var('ad_history') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt.create_or_replace_view", "macro.dbt.persist_docs"], "nodes": ["source.tiktok_ads_source.tiktok_ads.ad_history"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__ad_history_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__ad_history_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__ad_history_tmp.sql", "name": "stg_tiktok_ads__ad_history_tmp", "alias": "stg_tiktok_ads__ad_history_tmp", "checksum": {"name": "sha256", "checksum": "a57ca2d986b3dbad7d2bbd8b0a0dd7c992c25bc5cda65daee19e3541f40b6890"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "ad_history"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_history_tmp.sql", "build_path": "target/run/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_history_tmp.sql", "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1658244909.114927, "compiled_sql": "select *\nfrom `database`.`tiktok_ads_joe`.`ad_history`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_history_tmp`"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp": {"raw_sql": "select *\nfrom {{ var('ad_group_history') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt.create_or_replace_view", "macro.dbt.persist_docs"], "nodes": ["source.tiktok_ads_source.tiktok_ads.adgroup_history"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__ad_group_history_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__ad_group_history_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__ad_group_history_tmp.sql", "name": "stg_tiktok_ads__ad_group_history_tmp", "alias": "stg_tiktok_ads__ad_group_history_tmp", "checksum": {"name": "sha256", "checksum": "b3d1b8772b0465ed063cfa1f77cb9384475c21fa4ac9f970065e3da5c327ad1a"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "adgroup_history"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_group_history_tmp.sql", "build_path": "target/run/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_group_history_tmp.sql", "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1658244909.122536, "compiled_sql": "select *\nfrom `database`.`tiktok_ads_joe`.`adgroup_history`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_group_history_tmp`"}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp": {"raw_sql": "select *\nfrom {{ var('campaign_report_hourly') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt.create_or_replace_view", "macro.dbt.persist_docs"], "nodes": ["source.tiktok_ads_source.tiktok_ads.campaign_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__campaign_report_hourly_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__campaign_report_hourly_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__campaign_report_hourly_tmp.sql", "name": "stg_tiktok_ads__campaign_report_hourly_tmp", "alias": "stg_tiktok_ads__campaign_report_hourly_tmp", "checksum": {"name": "sha256", "checksum": "198e8d143514167295dfe352776c5050850cb7bc60e46b122a6a0a0da08a14ce"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "campaign_report_hourly"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__campaign_report_hourly_tmp.sql", "build_path": "target/run/tiktok_ads_source/models/tmp/stg_tiktok_ads__campaign_report_hourly_tmp.sql", "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1658244909.13061, "compiled_sql": "select *\nfrom `database`.`tiktok_ads_joe`.`campaign_report_hourly`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_report_hourly_tmp`"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp": {"raw_sql": "select *\nfrom {{ var('ad_group_hourly') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt.create_or_replace_view", "macro.dbt.persist_docs"], "nodes": ["source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__ad_group_report_hourly_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__ad_group_report_hourly_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__ad_group_report_hourly_tmp.sql", "name": "stg_tiktok_ads__ad_group_report_hourly_tmp", "alias": "stg_tiktok_ads__ad_group_report_hourly_tmp", "checksum": {"name": "sha256", "checksum": "187c3f6f290dd9846646843a108714a51fff1700c838c4c7e58852db64a1edfd"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "adgroup_report_hourly"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_group_report_hourly_tmp.sql", "build_path": "target/run/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_group_report_hourly_tmp.sql", "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1658244909.138232, "compiled_sql": "select *\nfrom `database`.`tiktok_ads_joe`.`adgroup_report_hourly`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_group_report_hourly_tmp`"}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp": {"raw_sql": "select *\nfrom {{ var('campaign_history') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt.create_or_replace_view", "macro.dbt.persist_docs"], "nodes": ["source.tiktok_ads_source.tiktok_ads.campaign_history"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__campaign_history_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__campaign_history_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__campaign_history_tmp.sql", "name": "stg_tiktok_ads__campaign_history_tmp", "alias": "stg_tiktok_ads__campaign_history_tmp", "checksum": {"name": "sha256", "checksum": "d695c134485444137d663f41732085a5cfa81de49f3ec2676e9f8e58f1c62c02"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "campaign_history"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__campaign_history_tmp.sql", "build_path": "target/run/tiktok_ads_source/models/tmp/stg_tiktok_ads__campaign_history_tmp.sql", "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1658244909.14746, "compiled_sql": "select *\nfrom `database`.`tiktok_ads_joe`.`campaign_history`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_history_tmp`"}, "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp": {"raw_sql": "select *\nfrom {{ var('advertiser') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt.create_or_replace_view", "macro.dbt.persist_docs"], "nodes": ["source.tiktok_ads_source.tiktok_ads.advertiser"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__advertiser_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__advertiser_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__advertiser_tmp.sql", "name": "stg_tiktok_ads__advertiser_tmp", "alias": "stg_tiktok_ads__advertiser_tmp", "checksum": {"name": "sha256", "checksum": "2806a63477df7962ac6a4476e3e514a47ae56470e95f490e88b58696a99c2fcf"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "advertiser"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__advertiser_tmp.sql", "build_path": "target/run/tiktok_ads_source/models/tmp/stg_tiktok_ads__advertiser_tmp.sql", "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1658244909.176338, "compiled_sql": "select *\nfrom `database`.`tiktok_ads_joe`.`advertiser`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__advertiser_tmp`"}, "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.fcb8c561bc": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_group_id", "model": "{{ get_where_subquery(ref('int_tiktok_ads__most_recent_ad_group')) }}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad_group"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "intermediate", "not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id"], "unique_id": "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.fcb8c561bc", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.sql", "original_file_path": "models/intermediate/intermediate.yml", "name": "not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id", "alias": "not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["int_tiktok_ads__most_recent_ad_group"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1658244909.3530219, "column_name": "ad_group_id", "file_key_name": "models.int_tiktok_ads__most_recent_ad_group"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at.e2e9914076": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_7aae7967f01788b5ccce56d37f64c75b\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_group_id", "updated_at"], "model": "{{ get_where_subquery(ref('int_tiktok_ads__most_recent_ad_group')) }}"}, "namespace": "dbt_utils"}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad_group"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_7aae7967f01788b5ccce56d37f64c75b", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "intermediate", "dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at.e2e9914076", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_7aae7967f01788b5ccce56d37f64c75b.sql", "original_file_path": "models/intermediate/intermediate.yml", "name": "dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at", "alias": "dbt_utils_unique_combination_o_7aae7967f01788b5ccce56d37f64c75b", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["int_tiktok_ads__most_recent_ad_group"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_7aae7967f01788b5ccce56d37f64c75b"}, "created_at": 1658244909.355435, "column_name": null, "file_key_name": "models.int_tiktok_ads__most_recent_ad_group"}, "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_ad_id.14e9c145ca": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_id", "model": "{{ get_where_subquery(ref('int_tiktok_ads__most_recent_ad')) }}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "intermediate", "not_null_int_tiktok_ads__most_recent_ad_ad_id"], "unique_id": "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_ad_id.14e9c145ca", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_int_tiktok_ads__most_recent_ad_ad_id.sql", "original_file_path": "models/intermediate/intermediate.yml", "name": "not_null_int_tiktok_ads__most_recent_ad_ad_id", "alias": "not_null_int_tiktok_ads__most_recent_ad_ad_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["int_tiktok_ads__most_recent_ad"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1658244909.361087, "column_name": "ad_id", "file_key_name": "models.int_tiktok_ads__most_recent_ad"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at.f58d824f65": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_82db7b1c335645aabf3916a22992c42a\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_id", "updated_at"], "model": "{{ get_where_subquery(ref('int_tiktok_ads__most_recent_ad')) }}"}, "namespace": "dbt_utils"}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_82db7b1c335645aabf3916a22992c42a", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "intermediate", "dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at.f58d824f65", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_82db7b1c335645aabf3916a22992c42a.sql", "original_file_path": "models/intermediate/intermediate.yml", "name": "dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at", "alias": "dbt_utils_unique_combination_o_82db7b1c335645aabf3916a22992c42a", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["int_tiktok_ads__most_recent_ad"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_82db7b1c335645aabf3916a22992c42a"}, "created_at": 1658244909.363595, "column_name": null, "file_key_name": "models.int_tiktok_ads__most_recent_ad"}, "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_campaign_campaign_id.8cefa8981c": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "campaign_id", "model": "{{ get_where_subquery(ref('int_tiktok_ads__most_recent_campaign')) }}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.tiktok_ads.int_tiktok_ads__most_recent_campaign"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "intermediate", "not_null_int_tiktok_ads__most_recent_campaign_campaign_id"], "unique_id": "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_campaign_campaign_id.8cefa8981c", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_int_tiktok_ads__most_recent_campaign_campaign_id.sql", "original_file_path": "models/intermediate/intermediate.yml", "name": "not_null_int_tiktok_ads__most_recent_campaign_campaign_id", "alias": "not_null_int_tiktok_ads__most_recent_campaign_campaign_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["int_tiktok_ads__most_recent_campaign"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1658244909.3695822, "column_name": "campaign_id", "file_key_name": "models.int_tiktok_ads__most_recent_campaign"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at.39077adf71": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_8456719f1ebbe11b109db2e39e0239ce\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["campaign_id", "updated_at"], "model": "{{ get_where_subquery(ref('int_tiktok_ads__most_recent_campaign')) }}"}, "namespace": "dbt_utils"}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.int_tiktok_ads__most_recent_campaign"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_8456719f1ebbe11b109db2e39e0239ce", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "intermediate", "dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at.39077adf71", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_8456719f1ebbe11b109db2e39e0239ce.sql", "original_file_path": "models/intermediate/intermediate.yml", "name": "dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at", "alias": "dbt_utils_unique_combination_o_8456719f1ebbe11b109db2e39e0239ce", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["int_tiktok_ads__most_recent_campaign"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_8456719f1ebbe11b109db2e39e0239ce"}, "created_at": 1658244909.3716831, "column_name": null, "file_key_name": "models.int_tiktok_ads__most_recent_campaign"}, "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66": {"raw_sql": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "unique", "kwargs": {"column_name": "advertiser_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__advertiser')) }}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_unique"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "unique_stg_tiktok_ads__advertiser_advertiser_id"], "unique_id": "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "unique_stg_tiktok_ads__advertiser_advertiser_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "unique_stg_tiktok_ads__advertiser_advertiser_id", "alias": "unique_stg_tiktok_ads__advertiser_advertiser_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__advertiser"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1658244909.572356, "column_name": "advertiser_id", "file_key_name": "models.stg_tiktok_ads__advertiser"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "advertiser_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__advertiser')) }}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__advertiser_advertiser_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__advertiser_advertiser_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__advertiser_advertiser_id", "alias": "not_null_stg_tiktok_ads__advertiser_advertiser_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__advertiser"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1658244909.574541, "column_name": "advertiser_id", "file_key_name": "models.stg_tiktok_ads__advertiser"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_group_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_group_history')) }}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__ad_group_history_ad_group_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__ad_group_history_ad_group_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__ad_group_history_ad_group_id", "alias": "not_null_stg_tiktok_ads__ad_group_history_ad_group_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1658244909.576759, "column_name": "ad_group_id", "file_key_name": "models.stg_tiktok_ads__ad_group_history"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_group_id", "updated_at"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_group_history')) }}"}, "namespace": "dbt_utils"}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at", "alias": "dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8"}, "created_at": 1658244909.578942, "column_name": null, "file_key_name": "models.stg_tiktok_ads__ad_group_history"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_history')) }}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__ad_history_ad_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__ad_history_ad_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__ad_history_ad_id", "alias": "not_null_stg_tiktok_ads__ad_history_ad_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1658244909.585593, "column_name": "ad_id", "file_key_name": "models.stg_tiktok_ads__ad_history"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_id", "updated_at"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_history')) }}"}, "namespace": "dbt_utils"}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at", "alias": "dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f"}, "created_at": 1658244909.588042, "column_name": null, "file_key_name": "models.stg_tiktok_ads__ad_history"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "campaign_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__campaign_history')) }}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__campaign_history_campaign_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__campaign_history_campaign_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__campaign_history_campaign_id", "alias": "not_null_stg_tiktok_ads__campaign_history_campaign_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__campaign_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1658244909.593933, "column_name": "campaign_id", "file_key_name": "models.stg_tiktok_ads__campaign_history"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["campaign_id", "updated_at"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__campaign_history')) }}"}, "namespace": "dbt_utils"}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at", "alias": "dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__campaign_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000"}, "created_at": 1658244909.596266, "column_name": null, "file_key_name": "models.stg_tiktok_ads__campaign_history"}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__campaign_report_hourly_tmp') }}\n\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__campaign_report_hourly_tmp')),\n staging_columns=get_campaign_report_hourly_columns()\n )\n }}\n\n from base\n\n), \n\nfinal as (\n\n select \n campaign_id, \n cast(_fivetran_synced as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced,\n stat_time_hour, \n cpc, \n cpm, \n ctr, \n impressions, \n clicks, \n spend, \n reach, \n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n \n {% for metric in var('tiktok_ads__campaign_hourly_passthrough_metrics', []) %}\n , {{ metric }}\n {% endfor %}\n from fields\n\n)\n\nselect * from final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_campaign_report_hourly_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.persist_docs"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__campaign_report_hourly"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__campaign_report_hourly.sql", "original_file_path": "models/stg_tiktok_ads__campaign_report_hourly.sql", "name": "stg_tiktok_ads__campaign_report_hourly", "alias": "stg_tiktok_ads__campaign_report_hourly", "checksum": {"name": "sha256", "checksum": "36cebad79aa22bc918fc4519ead62167487f301b20b999adf52c0ce500c2d1ff"}, "tags": [], "refs": [["stg_tiktok_ads__campaign_report_hourly_tmp"], ["stg_tiktok_ads__campaign_report_hourly_tmp"]], "sources": [], "description": "Each record represent data for each campaign for each hour.", "columns": {"campaign_id": {"name": "campaign_id", "description": "Campaign id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time per user your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__campaign_report_hourly.sql", "build_path": "target/run/tiktok_ads_source/models/stg_tiktok_ads__campaign_report_hourly.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1658250907.4618518, "compiled_sql": "with base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_report_hourly_tmp`\n\n), \n\nfields as (\n\n select\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n average_video_play\n \n as \n \n average_video_play\n \n, \n \n \n average_video_play_per_user\n \n as \n \n average_video_play_per_user\n \n, \n \n \n campaign_id\n \n as \n \n campaign_id\n \n, \n \n \n clicks\n \n as \n \n clicks\n \n, \n \n \n comments\n \n as \n \n comments\n \n, \n \n \n conversion\n \n as \n \n conversion\n \n, \n \n \n conversion_rate\n \n as \n \n conversion_rate\n \n, \n \n \n cost_per_1000_reached\n \n as \n \n cost_per_1000_reached\n \n, \n \n \n cost_per_conversion\n \n as \n \n cost_per_conversion\n \n, \n \n \n cost_per_result\n \n as \n \n cost_per_result\n \n, \n \n \n cost_per_secondary_goal_result\n \n as \n \n cost_per_secondary_goal_result\n \n, \n \n \n cpc\n \n as \n \n cpc\n \n, \n \n \n cpm\n \n as \n \n cpm\n \n, \n \n \n ctr\n \n as \n \n ctr\n \n, \n \n \n follows\n \n as \n \n follows\n \n, \n \n \n impressions\n \n as \n \n impressions\n \n, \n \n \n likes\n \n as \n \n likes\n \n, \n \n \n profile_visits\n \n as \n \n profile_visits\n \n, \n \n \n profile_visits_rate\n \n as \n \n profile_visits_rate\n \n, \n \n \n reach\n \n as \n \n reach\n \n, \n \n \n real_time_conversion\n \n as \n \n real_time_conversion\n \n, \n \n \n real_time_conversion_rate\n \n as \n \n real_time_conversion_rate\n \n, \n \n \n real_time_cost_per_conversion\n \n as \n \n real_time_cost_per_conversion\n \n, \n \n \n real_time_cost_per_result\n \n as \n \n real_time_cost_per_result\n \n, \n \n \n real_time_result\n \n as \n \n real_time_result\n \n, \n \n \n real_time_result_rate\n \n as \n \n real_time_result_rate\n \n, \n \n \n result\n \n as \n \n result\n \n, \n \n \n result_rate\n \n as \n \n result_rate\n \n, \n \n \n secondary_goal_result\n \n as \n \n secondary_goal_result\n \n, \n \n \n secondary_goal_result_rate\n \n as \n \n secondary_goal_result_rate\n \n, \n \n \n shares\n \n as \n \n shares\n \n, \n \n \n spend\n \n as \n \n spend\n \n, \n \n \n stat_time_hour\n \n as \n \n stat_time_hour\n \n, \n \n \n video_play_actions\n \n as \n \n video_play_actions\n \n, \n \n \n video_views_p_100\n \n as \n \n video_views_p_100\n \n, \n \n \n video_views_p_25\n \n as \n \n video_views_p_25\n \n, \n \n \n video_views_p_50\n \n as \n \n video_views_p_50\n \n, \n \n \n video_views_p_75\n \n as \n \n video_views_p_75\n \n, \n \n \n video_watched_2_s\n \n as \n \n video_watched_2_s\n \n, \n \n \n video_watched_6_s\n \n as \n \n video_watched_6_s\n \n\n\n\n\n from base\n\n), \n\nfinal as (\n\n select \n campaign_id, \n cast(_fivetran_synced as \n timestamp\n) as _fivetran_synced,\n stat_time_hour, \n cpc, \n cpm, \n ctr, \n impressions, \n clicks, \n spend, \n reach, \n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n \n \n from fields\n\n)\n\nselect * from final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_report_hourly`"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__ad_group_report_hourly_tmp') }}\n\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__ad_group_report_hourly_tmp')),\n staging_columns=get_ad_group_report_hourly_columns()\n )\n }}\n\n from base\n\n), \n\nfinal as (\n\n select \n adgroup_id as ad_group_id, \n cast(_fivetran_synced as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced,\n stat_time_hour, \n cpc, \n cpm, \n ctr, \n impressions, \n clicks, \n spend, \n reach, \n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n \n {% for metric in var('tiktok_ads__ad_group_hourly_passthrough_metrics', []) %}\n , {{ metric }}\n {% endfor %}\n from fields\n\n) \n\nselect * from final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_ad_group_report_hourly_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.persist_docs"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__ad_group_report_hourly"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__ad_group_report_hourly.sql", "original_file_path": "models/stg_tiktok_ads__ad_group_report_hourly.sql", "name": "stg_tiktok_ads__ad_group_report_hourly", "alias": "stg_tiktok_ads__ad_group_report_hourly", "checksum": {"name": "sha256", "checksum": "2beb5b8fdc28d5e19f8dc9a15a966aab1b0d0836b74f2977d5360e061c1ff89a"}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_report_hourly_tmp"], ["stg_tiktok_ads__ad_group_report_hourly_tmp"]], "sources": [], "description": "Each record represents data for each ad group for each hour.", "columns": {"ad_group_id": {"name": "ad_group_id", "description": "Ad group id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time per user your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__ad_group_report_hourly.sql", "build_path": "target/run/tiktok_ads_source/models/stg_tiktok_ads__ad_group_report_hourly.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1658250907.474358, "compiled_sql": "with base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_group_report_hourly_tmp`\n\n), \n\nfields as (\n\n select\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n adgroup_id\n \n as \n \n adgroup_id\n \n, \n \n \n average_video_play\n \n as \n \n average_video_play\n \n, \n \n \n average_video_play_per_user\n \n as \n \n average_video_play_per_user\n \n, \n \n \n clicks\n \n as \n \n clicks\n \n, \n \n \n comments\n \n as \n \n comments\n \n, \n \n \n conversion\n \n as \n \n conversion\n \n, \n \n \n conversion_rate\n \n as \n \n conversion_rate\n \n, \n \n \n cost_per_1000_reached\n \n as \n \n cost_per_1000_reached\n \n, \n \n \n cost_per_conversion\n \n as \n \n cost_per_conversion\n \n, \n \n \n cost_per_result\n \n as \n \n cost_per_result\n \n, \n \n \n cost_per_secondary_goal_result\n \n as \n \n cost_per_secondary_goal_result\n \n, \n \n \n cpc\n \n as \n \n cpc\n \n, \n \n \n cpm\n \n as \n \n cpm\n \n, \n \n \n ctr\n \n as \n \n ctr\n \n, \n \n \n follows\n \n as \n \n follows\n \n, \n \n \n impressions\n \n as \n \n impressions\n \n, \n \n \n likes\n \n as \n \n likes\n \n, \n \n \n profile_visits\n \n as \n \n profile_visits\n \n, \n \n \n profile_visits_rate\n \n as \n \n profile_visits_rate\n \n, \n \n \n reach\n \n as \n \n reach\n \n, \n \n \n real_time_conversion\n \n as \n \n real_time_conversion\n \n, \n \n \n real_time_conversion_rate\n \n as \n \n real_time_conversion_rate\n \n, \n \n \n real_time_cost_per_conversion\n \n as \n \n real_time_cost_per_conversion\n \n, \n \n \n real_time_cost_per_result\n \n as \n \n real_time_cost_per_result\n \n, \n \n \n real_time_result\n \n as \n \n real_time_result\n \n, \n \n \n real_time_result_rate\n \n as \n \n real_time_result_rate\n \n, \n \n \n result\n \n as \n \n result\n \n, \n \n \n result_rate\n \n as \n \n result_rate\n \n, \n \n \n secondary_goal_result\n \n as \n \n secondary_goal_result\n \n, \n \n \n secondary_goal_result_rate\n \n as \n \n secondary_goal_result_rate\n \n, \n \n \n shares\n \n as \n \n shares\n \n, \n \n \n spend\n \n as \n \n spend\n \n, \n \n \n stat_time_hour\n \n as \n \n stat_time_hour\n \n, \n \n \n video_play_actions\n \n as \n \n video_play_actions\n \n, \n \n \n video_views_p_100\n \n as \n \n video_views_p_100\n \n, \n \n \n video_views_p_25\n \n as \n \n video_views_p_25\n \n, \n \n \n video_views_p_50\n \n as \n \n video_views_p_50\n \n, \n \n \n video_views_p_75\n \n as \n \n video_views_p_75\n \n, \n \n \n video_watched_2_s\n \n as \n \n video_watched_2_s\n \n, \n \n \n video_watched_6_s\n \n as \n \n video_watched_6_s\n \n\n\n\n\n from base\n\n), \n\nfinal as (\n\n select \n adgroup_id as ad_group_id, \n cast(_fivetran_synced as \n timestamp\n) as _fivetran_synced,\n stat_time_hour, \n cpc, \n cpm, \n ctr, \n impressions, \n clicks, \n spend, \n reach, \n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n \n \n from fields\n\n) \n\nselect * from final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_group_report_hourly`"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__ad_report_hourly_tmp') }}\n\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__ad_report_hourly_tmp')),\n staging_columns=get_ad_report_hourly_columns()\n )\n }}\n\n from base\n\n), \n\nfinal as (\n\n select \n ad_id, \n cast(_fivetran_synced as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced,\n stat_time_hour, \n cpc, \n cpm, \n ctr, \n impressions, \n clicks, \n spend, \n reach, \n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n \n {% for metric in var('tiktok_ads__ad_hourly_passthrough_metrics', []) %}\n , {{ metric }}\n {% endfor %}\n from fields\n\n)\n\nselect * from final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_ad_report_hourly_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.persist_docs"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__ad_report_hourly"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__ad_report_hourly.sql", "original_file_path": "models/stg_tiktok_ads__ad_report_hourly.sql", "name": "stg_tiktok_ads__ad_report_hourly", "alias": "stg_tiktok_ads__ad_report_hourly", "checksum": {"name": "sha256", "checksum": "cc0d2dff4f71cc11bb6d6a299b30737906acf14780bcadab2a52620a4d929ec4"}, "tags": [], "refs": [["stg_tiktok_ads__ad_report_hourly_tmp"], ["stg_tiktok_ads__ad_report_hourly_tmp"]], "sources": [], "description": "Each record represents data for each ad for each hour.", "columns": {"ad_id": {"name": "ad_id", "description": "Ad id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time per user your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__ad_report_hourly.sql", "build_path": "target/run/tiktok_ads_source/models/stg_tiktok_ads__ad_report_hourly.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1658250907.487308, "compiled_sql": "with base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_report_hourly_tmp`\n\n), \n\nfields as (\n\n select\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n ad_id\n \n as \n \n ad_id\n \n, \n \n \n average_video_play\n \n as \n \n average_video_play\n \n, \n \n \n average_video_play_per_user\n \n as \n \n average_video_play_per_user\n \n, \n \n \n clicks\n \n as \n \n clicks\n \n, \n \n \n comments\n \n as \n \n comments\n \n, \n \n \n conversion\n \n as \n \n conversion\n \n, \n \n \n conversion_rate\n \n as \n \n conversion_rate\n \n, \n \n \n cost_per_1000_reached\n \n as \n \n cost_per_1000_reached\n \n, \n \n \n cost_per_conversion\n \n as \n \n cost_per_conversion\n \n, \n \n \n cost_per_result\n \n as \n \n cost_per_result\n \n, \n \n \n cost_per_secondary_goal_result\n \n as \n \n cost_per_secondary_goal_result\n \n, \n \n \n cpc\n \n as \n \n cpc\n \n, \n \n \n cpm\n \n as \n \n cpm\n \n, \n \n \n ctr\n \n as \n \n ctr\n \n, \n \n \n follows\n \n as \n \n follows\n \n, \n \n \n impressions\n \n as \n \n impressions\n \n, \n \n \n likes\n \n as \n \n likes\n \n, \n \n \n profile_visits\n \n as \n \n profile_visits\n \n, \n \n \n profile_visits_rate\n \n as \n \n profile_visits_rate\n \n, \n \n \n reach\n \n as \n \n reach\n \n, \n \n \n real_time_conversion\n \n as \n \n real_time_conversion\n \n, \n \n \n real_time_conversion_rate\n \n as \n \n real_time_conversion_rate\n \n, \n \n \n real_time_cost_per_conversion\n \n as \n \n real_time_cost_per_conversion\n \n, \n \n \n real_time_cost_per_result\n \n as \n \n real_time_cost_per_result\n \n, \n \n \n real_time_result\n \n as \n \n real_time_result\n \n, \n \n \n real_time_result_rate\n \n as \n \n real_time_result_rate\n \n, \n \n \n result\n \n as \n \n result\n \n, \n \n \n result_rate\n \n as \n \n result_rate\n \n, \n \n \n secondary_goal_result\n \n as \n \n secondary_goal_result\n \n, \n \n \n secondary_goal_result_rate\n \n as \n \n secondary_goal_result_rate\n \n, \n \n \n shares\n \n as \n \n shares\n \n, \n \n \n spend\n \n as \n \n spend\n \n, \n \n \n stat_time_hour\n \n as \n \n stat_time_hour\n \n, \n \n \n video_play_actions\n \n as \n \n video_play_actions\n \n, \n \n \n video_views_p_100\n \n as \n \n video_views_p_100\n \n, \n \n \n video_views_p_25\n \n as \n \n video_views_p_25\n \n, \n \n \n video_views_p_50\n \n as \n \n video_views_p_50\n \n, \n \n \n video_views_p_75\n \n as \n \n video_views_p_75\n \n, \n \n \n video_watched_2_s\n \n as \n \n video_watched_2_s\n \n, \n \n \n video_watched_6_s\n \n as \n \n video_watched_6_s\n \n\n\n\n\n from base\n\n), \n\nfinal as (\n\n select \n ad_id, \n cast(_fivetran_synced as \n timestamp\n) as _fivetran_synced,\n stat_time_hour, \n cpc, \n cpm, \n ctr, \n impressions, \n clicks, \n spend, \n reach, \n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n \n \n from fields\n\n)\n\nselect * from final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_report_hourly`"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "campaign_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__campaign_report_hourly')) }}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id", "alias": "not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__campaign_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1658250907.496785, "column_name": "campaign_id", "file_key_name": "models.stg_tiktok_ads__campaign_report_hourly"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["campaign_id", "stat_time_hour"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__campaign_report_hourly')) }}"}, "namespace": "dbt_utils"}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour", "alias": "dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__campaign_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16"}, "created_at": 1658250907.499296, "column_name": null, "file_key_name": "models.stg_tiktok_ads__campaign_report_hourly"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_group_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_group_report_hourly')) }}"}, "namespace": null}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id", "alias": "not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1658250907.515866, "column_name": "ad_group_id", "file_key_name": "models.stg_tiktok_ads__ad_group_report_hourly"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_group_id", "stat_time_hour"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_group_report_hourly')) }}"}, "namespace": "dbt_utils"}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour", "alias": "dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60"}, "created_at": 1658250907.518048, "column_name": null, "file_key_name": "models.stg_tiktok_ads__ad_group_report_hourly"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_id", "stat_time_hour"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_report_hourly')) }}"}, "namespace": "dbt_utils"}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour", "alias": "dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc"}, "created_at": 1658250907.52393, "column_name": null, "file_key_name": "models.stg_tiktok_ads__ad_report_hourly"}, "model.tiktok_ads.tiktok_ads__campaign_report": {"raw_sql": "with hourly as (\n \n select *\n from {{ var('campaign_report_hourly') }}\n\n), campaigns as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_campaign') }}\n\n), advertiser as (\n\n select *\n from {{ var('advertiser') }}\n \n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n advertiser.advertiser_id,\n advertiser.advertiser_name,\n campaigns.campaign_id,\n campaigns.campaign_name,\n advertiser.currency,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n {% for metric in var('tiktok_ads__campaign_hourly_passthrough_metrics', []) %}\n , {{ metric }}\n {% endfor %}\n from hourly\n left join campaigns\n on hourly.campaign_id = campaigns.campaign_id\n left join advertiser\n on campaigns.advertiser_id = advertiser.advertiser_id\n {{ dbt_utils.group_by(6) }}\n\n)\n\nselect *\nfrom aggregated", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.group_by", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.persist_docs"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly", "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "model.tiktok_ads_source.stg_tiktok_ads__advertiser"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads", "tiktok_ads__campaign_report"], "unique_id": "model.tiktok_ads.tiktok_ads__campaign_report", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "tiktok_ads__campaign_report.sql", "original_file_path": "models/tiktok_ads__campaign_report.sql", "name": "tiktok_ads__campaign_report", "alias": "tiktok_ads__campaign_report", "checksum": {"name": "sha256", "checksum": "74332b261c90ffb6559548d8307099aa764b49548f70d686477a4ba9862bf55a"}, "tags": [], "refs": [["stg_tiktok_ads__campaign_report_hourly"], ["int_tiktok_ads__most_recent_campaign"], ["stg_tiktok_ads__advertiser"]], "sources": [], "description": "Each record in this table represents the daily performance at the campaign level.", "columns": {"date_day": {"name": "date_day", "description": "Day of record", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_name": {"name": "advertiser_name", "description": "Advertiser name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of impressions that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The amount of spend that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of follows that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpc": {"name": "daily_cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpm": {"name": "daily_cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_daily_ctr": {"name": "daily_daily_ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads__campaign_report.sql", "build_path": "target/run/tiktok_ads/models/tiktok_ads__campaign_report.sql", "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "table"}, "created_at": 1658252626.2299352, "compiled_sql": "with __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n),hourly as (\n \n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_report_hourly`\n\n), campaigns as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_campaign\n\n), advertiser as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__advertiser`\n \n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n advertiser.advertiser_id,\n advertiser.advertiser_name,\n campaigns.campaign_id,\n campaigns.campaign_name,\n advertiser.currency,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n \n from hourly\n left join campaigns\n on hourly.campaign_id = campaigns.campaign_id\n left join advertiser\n on campaigns.advertiser_id = advertiser.advertiser_id\n group by 1,2,3,4,5,6\n\n)\n\nselect *\nfrom aggregated", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "sql": " __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": "`database`.`schema`.`tiktok_ads__campaign_report`"}, "model.tiktok_ads.tiktok_ads__url_report": {"raw_sql": "with hourly as (\n \n select *\n from {{ var('ad_report_hourly') }}\n\n), ads as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_ad') }}\n\n), ad_groups as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_ad_group') }}\n\n), advertiser as (\n\n select *\n from {{ var('advertiser') }}\n\n), campaigns as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_campaign') }}\n\n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n ad_groups.advertiser_id,\n advertiser.advertiser_name,\n campaigns.campaign_id,\n campaigns.campaign_name,\n ad_groups.ad_group_id,\n ad_groups.ad_group_name,\n ads.ad_id,\n ads.ad_name,\n ads.base_url,\n ads.url_host,\n ads.url_path,\n ads.utm_source,\n ads.utm_medium,\n ads.utm_campaign,\n ads.utm_content,\n ads.utm_term,\n advertiser.currency,\n ad_groups.action_categories,\n ad_groups.category,\n ad_groups.gender,\n ad_groups.audience_type,\n ad_groups.budget,\n ad_groups.age,\n ad_groups.languages,\n ad_groups.interest_category,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n {% for metric in var('tiktok_ads__ad_hourly_passthrough_metrics', []) %}\n , {{ metric }}\n {% endfor %}\n from hourly\n left join ads\n on hourly.ad_id = ads.ad_id\n left join ad_groups \n on ads.ad_group_id = ad_groups.ad_group_id\n left join advertiser\n on ads.advertiser_id = advertiser.advertiser_id\n left join campaigns\n on ads.campaign_id = campaigns.campaign_id\n\n -- We only want utm ads to populate this report. Therefore, we filter where url ads are populated.\n where ads.landing_page_url is not null\n {{ dbt_utils.group_by(26) }}\n\n)\n\nselect *\nfrom aggregated", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.group_by", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.persist_docs"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "model.tiktok_ads_source.stg_tiktok_ads__advertiser", "model.tiktok_ads.int_tiktok_ads__most_recent_campaign"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads", "tiktok_ads__url_report"], "unique_id": "model.tiktok_ads.tiktok_ads__url_report", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "tiktok_ads__url_report.sql", "original_file_path": "models/tiktok_ads__url_report.sql", "name": "tiktok_ads__url_report", "alias": "tiktok_ads__url_report", "checksum": {"name": "sha256", "checksum": "49680f4cd1cb5608f77097399a90ef7e1f27e25549b4963f9003ed545edbe9dd"}, "tags": [], "refs": [["stg_tiktok_ads__ad_report_hourly"], ["int_tiktok_ads__most_recent_ad"], ["int_tiktok_ads__most_recent_ad_group"], ["stg_tiktok_ads__advertiser"], ["int_tiktok_ads__most_recent_campaign"]], "sources": [], "description": "Each record in this table represents the daily performance of ads at the ad level and URL level.", "columns": {"date_day": {"name": "date_day", "description": "Day of record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_id": {"name": "ad_id", "description": "Ad ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_name": {"name": "ad_name", "description": "Ad name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_name": {"name": "advertiser_name", "description": "Advertiser name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "Ad group ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "Ad group name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "base_url": {"name": "base_url", "description": "The base URL of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_host": {"name": "url_host", "description": "The URL host of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_path": {"name": "url_path", "description": "The URL path of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_source": {"name": "utm_source", "description": "The utm_source parameter of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_medium": {"name": "utm_medium", "description": "The utm_medium parameter of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_campaign": {"name": "utm_campaign", "description": "The utm_campaign parameter of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_content": {"name": "utm_content", "description": "The utm_content parameter of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_term": {"name": "utm_term", "description": "The utm_term parameter of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_categories": {"name": "action_categories", "description": "IDs of the action categories (behaviors) that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "age": {"name": "age", "description": "Age groups you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience_type": {"name": "audience_type", "description": "Audience Type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget": {"name": "budget", "description": "Ad budget. Returns 0.0 when Campaign Budget Optimization (budget_optimize_switch) is on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "category": {"name": "category", "description": "Ad group category.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "interest_category": {"name": "interest_category", "description": "Interest classification. If the interest is specified, users that do not meet interest target will be excluded during delivery.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "languages": {"name": "languages", "description": "Codes of the languages that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "currency": {"name": "currency", "description": "Advertiser's currency.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of impressions that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The amount of spend that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of follows that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpc": {"name": "daily_cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpm": {"name": "daily_cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_ctr": {"name": "daily_ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads__url_report.sql", "build_path": "target/run/tiktok_ads/models/tiktok_ads__url_report.sql", "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "table"}, "created_at": 1658252626.260878, "compiled_sql": "with __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n), __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n), __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n),hourly as (\n \n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_report_hourly`\n\n), ads as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_ad\n\n), ad_groups as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_ad_group\n\n), advertiser as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__advertiser`\n\n), campaigns as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_campaign\n\n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n ad_groups.advertiser_id,\n advertiser.advertiser_name,\n campaigns.campaign_id,\n campaigns.campaign_name,\n ad_groups.ad_group_id,\n ad_groups.ad_group_name,\n ads.ad_id,\n ads.ad_name,\n ads.base_url,\n ads.url_host,\n ads.url_path,\n ads.utm_source,\n ads.utm_medium,\n ads.utm_campaign,\n ads.utm_content,\n ads.utm_term,\n advertiser.currency,\n ad_groups.action_categories,\n ad_groups.category,\n ad_groups.gender,\n ad_groups.audience_type,\n ad_groups.budget,\n ad_groups.age,\n ad_groups.languages,\n ad_groups.interest_category,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n \n from hourly\n left join ads\n on hourly.ad_id = ads.ad_id\n left join ad_groups \n on ads.ad_group_id = ad_groups.ad_group_id\n left join advertiser\n on ads.advertiser_id = advertiser.advertiser_id\n left join campaigns\n on ads.campaign_id = campaigns.campaign_id\n\n -- We only want utm ads to populate this report. Therefore, we filter where url ads are populated.\n where ads.landing_page_url is not null\n group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26\n\n)\n\nselect *\nfrom aggregated", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}, {"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}, {"id": "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "sql": " __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": "`database`.`schema`.`tiktok_ads__url_report`"}, "model.tiktok_ads.tiktok_ads__ad_report": {"raw_sql": "with hourly as (\n \n select *\n from {{ var('ad_report_hourly') }}\n\n), ads as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_ad') }}\n\n), ad_groups as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_ad_group') }}\n\n), advertiser as (\n\n select *\n from {{ var('advertiser') }}\n\n), campaigns as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_campaign') }}\n\n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n ad_groups.advertiser_id,\n advertiser.advertiser_name,\n campaigns.campaign_id,\n campaigns.campaign_name,\n ad_groups.ad_group_id,\n ad_groups.ad_group_name,\n ads.ad_id,\n ads.ad_name,\n advertiser.currency,\n ad_groups.category,\n ad_groups.action_categories,\n ad_groups.gender,\n ad_groups.audience_type,\n ad_groups.budget,\n ad_groups.age,\n ad_groups.languages,\n ad_groups.interest_category,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n {% for metric in var('tiktok_ads__ad_hourly_passthrough_metrics', []) %}\n , {{ metric }}\n {% endfor %}\n from hourly\n left join ads\n on hourly.ad_id = ads.ad_id\n left join ad_groups \n on ads.ad_group_id = ad_groups.ad_group_id\n left join advertiser\n on ads.advertiser_id = advertiser.advertiser_id\n left join campaigns\n on ads.campaign_id = campaigns.campaign_id\n {{ dbt_utils.group_by(18) }}\n\n)\n\nselect *\nfrom aggregated", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.group_by", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.persist_docs"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "model.tiktok_ads_source.stg_tiktok_ads__advertiser", "model.tiktok_ads.int_tiktok_ads__most_recent_campaign"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads", "tiktok_ads__ad_report"], "unique_id": "model.tiktok_ads.tiktok_ads__ad_report", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "tiktok_ads__ad_report.sql", "original_file_path": "models/tiktok_ads__ad_report.sql", "name": "tiktok_ads__ad_report", "alias": "tiktok_ads__ad_report", "checksum": {"name": "sha256", "checksum": "d42e8279a49948b41e916c806ba2e7522134d1267e2352b1e356c593c941e397"}, "tags": [], "refs": [["stg_tiktok_ads__ad_report_hourly"], ["int_tiktok_ads__most_recent_ad"], ["int_tiktok_ads__most_recent_ad_group"], ["stg_tiktok_ads__advertiser"], ["int_tiktok_ads__most_recent_campaign"]], "sources": [], "description": "Each record in this table represents the daily performance of ads at the ad level and URL level.", "columns": {"date_day": {"name": "date_day", "description": "Day of record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_id": {"name": "ad_id", "description": "Ad ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_name": {"name": "ad_name", "description": "Ad name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_name": {"name": "advertiser_name", "description": "Advertiser name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "Ad group ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "Ad group name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_categories": {"name": "action_categories", "description": "IDs of the action categories (behaviors) that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "age": {"name": "age", "description": "Age groups you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience_type": {"name": "audience_type", "description": "Audience Type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget": {"name": "budget", "description": "Ad budget. Returns 0.0 when Campaign Budget Optimization (budget_optimize_switch) is on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "category": {"name": "category", "description": "Ad group category.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "interest_category": {"name": "interest_category", "description": "Interest classification. If the interest is specified, users that do not meet interest target will be excluded during delivery.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "languages": {"name": "languages", "description": "Codes of the languages that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "currency": {"name": "currency", "description": "Advertiser's currency.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of impressions that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The amount of spend that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of follows that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpc": {"name": "daily_cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpm": {"name": "daily_cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_ctr": {"name": "daily_ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads__ad_report.sql", "build_path": "target/run/tiktok_ads/models/tiktok_ads__ad_report.sql", "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "table"}, "created_at": 1658252626.244402, "compiled_sql": "with __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n), __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n), __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n),hourly as (\n \n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_report_hourly`\n\n), ads as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_ad\n\n), ad_groups as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_ad_group\n\n), advertiser as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__advertiser`\n\n), campaigns as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_campaign\n\n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n ad_groups.advertiser_id,\n advertiser.advertiser_name,\n campaigns.campaign_id,\n campaigns.campaign_name,\n ad_groups.ad_group_id,\n ad_groups.ad_group_name,\n ads.ad_id,\n ads.ad_name,\n advertiser.currency,\n ad_groups.category,\n ad_groups.action_categories,\n ad_groups.gender,\n ad_groups.audience_type,\n ad_groups.budget,\n ad_groups.age,\n ad_groups.languages,\n ad_groups.interest_category,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n \n from hourly\n left join ads\n on hourly.ad_id = ads.ad_id\n left join ad_groups \n on ads.ad_group_id = ad_groups.ad_group_id\n left join advertiser\n on ads.advertiser_id = advertiser.advertiser_id\n left join campaigns\n on ads.campaign_id = campaigns.campaign_id\n group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18\n\n)\n\nselect *\nfrom aggregated", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}, {"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}, {"id": "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "sql": " __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": "`database`.`schema`.`tiktok_ads__ad_report`"}, "model.tiktok_ads.tiktok_ads__account_report": {"raw_sql": "with hourly as (\n \n select *\n from {{ var('ad_report_hourly') }}\n\n), advertiser as (\n\n select *\n from {{ var('advertiser') }}\n\n), ads as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_ad') }}\n\n), joined as (\n\n select \n cast(hourly.stat_time_hour as date) as date_day,\n advertiser.advertiser_id,\n advertiser.advertiser_name,\n advertiser.currency,\n sum(hourly.clicks) as clicks,\n sum(hourly.impressions) as impressions,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s, \n sum(hourly.video_watched_6_s) as video_watched_6_s, \n sum(hourly.video_views_p_25) as video_views_p_25, \n sum(hourly.video_views_p_50) as video_views_p_50,\n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n {% for metric in var('tiktok_ads__ad_hourly_passthrough_metrics', []) %}\n , {{ metric }}\n {% endfor %}\n from hourly\n left join ads\n on hourly.ad_id = ads.ad_id\n left join advertiser\n on ads.advertiser_id = advertiser.advertiser_id\n {{ dbt_utils.group_by(4) }}\n \n\n\n)\n\nselect *\nfrom joined", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.group_by", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.persist_docs"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__advertiser", "model.tiktok_ads.int_tiktok_ads__most_recent_ad"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads", "tiktok_ads__account_report"], "unique_id": "model.tiktok_ads.tiktok_ads__account_report", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "tiktok_ads__account_report.sql", "original_file_path": "models/tiktok_ads__account_report.sql", "name": "tiktok_ads__account_report", "alias": "tiktok_ads__account_report", "checksum": {"name": "sha256", "checksum": "ce526838e287ff56ca0e097ce435bde857bc2bbd43d83e60f4f71f4a6c387a0e"}, "tags": [], "refs": [["stg_tiktok_ads__ad_report_hourly"], ["stg_tiktok_ads__advertiser"], ["int_tiktok_ads__most_recent_ad"]], "sources": [], "description": "Each record in this table represents the daily performance of ads at the ad level and URL level.", "columns": {"date_day": {"name": "date_day", "description": "Day of record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_name": {"name": "advertiser_name", "description": "Advertiser name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "currency": {"name": "currency", "description": "Advertiser's currency.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of impressions that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The amount of spend that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of follows that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpc": {"name": "daily_cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpm": {"name": "daily_cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_ctr": {"name": "daily_ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads__account_report.sql", "build_path": "target/run/tiktok_ads/models/tiktok_ads__account_report.sql", "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "table"}, "created_at": 1658252626.2716942, "compiled_sql": "with __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n),hourly as (\n \n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_report_hourly`\n\n), advertiser as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__advertiser`\n\n), ads as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_ad\n\n), joined as (\n\n select \n cast(hourly.stat_time_hour as date) as date_day,\n advertiser.advertiser_id,\n advertiser.advertiser_name,\n advertiser.currency,\n sum(hourly.clicks) as clicks,\n sum(hourly.impressions) as impressions,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s, \n sum(hourly.video_watched_6_s) as video_watched_6_s, \n sum(hourly.video_views_p_25) as video_views_p_25, \n sum(hourly.video_views_p_50) as video_views_p_50,\n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n \n from hourly\n left join ads\n on hourly.ad_id = ads.ad_id\n left join advertiser\n on ads.advertiser_id = advertiser.advertiser_id\n group by 1,2,3,4\n \n\n\n)\n\nselect *\nfrom joined", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": "`database`.`schema`.`tiktok_ads__account_report`"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day.cc5f756c69": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_48804305b042fff8fc9179671c157c13\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["campaign_id", "date_day"], "model": "{{ get_where_subquery(ref('tiktok_ads__campaign_report')) }}"}, "namespace": "dbt_utils"}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__campaign_report"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_48804305b042fff8fc9179671c157c13", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day.cc5f756c69", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_48804305b042fff8fc9179671c157c13.sql", "original_file_path": "models/tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day", "alias": "dbt_utils_unique_combination_o_48804305b042fff8fc9179671c157c13", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__campaign_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_48804305b042fff8fc9179671c157c13"}, "created_at": 1658252626.304491, "column_name": null, "file_key_name": "models.tiktok_ads__campaign_report"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_report_ad_id__date_day.15357fac89": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_056f22d77c1daa2b10c2ecadca5404c3\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_id", "date_day"], "model": "{{ get_where_subquery(ref('tiktok_ads__ad_report')) }}"}, "namespace": "dbt_utils"}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__ad_report"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_056f22d77c1daa2b10c2ecadca5404c3", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "dbt_utils_unique_combination_of_columns_tiktok_ads__ad_report_ad_id__date_day"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_report_ad_id__date_day.15357fac89", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_056f22d77c1daa2b10c2ecadca5404c3.sql", "original_file_path": "models/tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_tiktok_ads__ad_report_ad_id__date_day", "alias": "dbt_utils_unique_combination_o_056f22d77c1daa2b10c2ecadca5404c3", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__ad_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_056f22d77c1daa2b10c2ecadca5404c3"}, "created_at": 1658252626.311863, "column_name": null, "file_key_name": "models.tiktok_ads__ad_report"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__url_report_ad_id__date_day.8b73e512af": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_30d691e3772c912d1a7e5874b0b91854\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_id", "date_day"], "model": "{{ get_where_subquery(ref('tiktok_ads__url_report')) }}"}, "namespace": "dbt_utils"}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__url_report"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_30d691e3772c912d1a7e5874b0b91854", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "dbt_utils_unique_combination_of_columns_tiktok_ads__url_report_ad_id__date_day"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__url_report_ad_id__date_day.8b73e512af", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_30d691e3772c912d1a7e5874b0b91854.sql", "original_file_path": "models/tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_tiktok_ads__url_report_ad_id__date_day", "alias": "dbt_utils_unique_combination_o_30d691e3772c912d1a7e5874b0b91854", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__url_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_30d691e3772c912d1a7e5874b0b91854"}, "created_at": 1658252626.3190432, "column_name": null, "file_key_name": "models.tiktok_ads__url_report"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__account_report_advertiser_id__date_day.7b27a2f43b": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_e775e605c8835d2fdc47cf9d0cf5ee54\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["advertiser_id", "date_day"], "model": "{{ get_where_subquery(ref('tiktok_ads__account_report')) }}"}, "namespace": "dbt_utils"}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__account_report"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_e775e605c8835d2fdc47cf9d0cf5ee54", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "dbt_utils_unique_combination_of_columns_tiktok_ads__account_report_advertiser_id__date_day"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__account_report_advertiser_id__date_day.7b27a2f43b", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_e775e605c8835d2fdc47cf9d0cf5ee54.sql", "original_file_path": "models/tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_tiktok_ads__account_report_advertiser_id__date_day", "alias": "dbt_utils_unique_combination_o_e775e605c8835d2fdc47cf9d0cf5ee54", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__account_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_e775e605c8835d2fdc47cf9d0cf5ee54"}, "created_at": 1658252626.3259652, "column_name": null, "file_key_name": "models.tiktok_ads__account_report"}, "model.tiktok_ads.tiktok_ads__ad_group_report": {"raw_sql": "with hourly as (\n \n select *\n from {{ var('ad_group_report_hourly') }}\n\n), ad_groups as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_ad_group') }}\n\n), advertiser as (\n\n select *\n from {{ var('advertiser') }}\n\n), campaigns as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_campaign') }}\n\n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n ad_groups.advertiser_id,\n advertiser.advertiser_name,\n campaigns.campaign_id,\n campaigns.campaign_name,\n ad_groups.ad_group_id,\n ad_groups.ad_group_name,\n advertiser.currency,\n ad_groups.action_categories,\n ad_groups.category,\n ad_groups.gender,\n ad_groups.audience_type,\n ad_groups.budget,\n ad_groups.age,\n ad_groups.languages,\n ad_groups.interest_category,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n {% for metric in var('tiktok_ads__ad_group_hourly_passthrough_metrics', []) %}\n , {{ metric }}\n {% endfor %}\n from hourly\n left join ad_groups \n on hourly.ad_group_id = ad_groups.ad_group_id\n left join advertiser\n on ad_groups.advertiser_id = advertiser.advertiser_id\n left join campaigns\n on ad_groups.campaign_id = campaigns.campaign_id\n {{ dbt_utils.group_by(16) }}\n\n)\n\nselect *\nfrom aggregated", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.group_by", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.persist_docs"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly", "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "model.tiktok_ads_source.stg_tiktok_ads__advertiser", "model.tiktok_ads.int_tiktok_ads__most_recent_campaign"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads", "tiktok_ads__ad_group_report"], "unique_id": "model.tiktok_ads.tiktok_ads__ad_group_report", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "tiktok_ads__ad_group_report.sql", "original_file_path": "models/tiktok_ads__ad_group_report.sql", "name": "tiktok_ads__ad_group_report", "alias": "tiktok_ads__ad_group_report", "checksum": {"name": "sha256", "checksum": "56e4982c59d6d1fa1b6505ea507eca8bef5145ac7d82c69de61cac908c40201c"}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_report_hourly"], ["int_tiktok_ads__most_recent_ad_group"], ["stg_tiktok_ads__advertiser"], ["int_tiktok_ads__most_recent_campaign"]], "sources": [], "description": "Each record in this table represents the daily performance of ads at the ad group level.", "columns": {"date_day": {"name": "date_day", "description": "Day of record", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "Ad group name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_name": {"name": "advertiser_name", "description": "Advertiser name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "currency": {"name": "currency", "description": "Advertiser's currency.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_categories": {"name": "action_categories", "description": "IDs of the action categories (behaviors) that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "age": {"name": "age", "description": "Age groups you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience_type": {"name": "audience_type", "description": "Audience Type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget": {"name": "budget", "description": "Ad budget. Returns 0.0 when Campaign Budget Optimization (budget_optimize_switch) is on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "category": {"name": "category", "description": "Ad group category.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "interest_category": {"name": "interest_category", "description": "Interest classification. If the interest is specified, users that do not meet interest target will be excluded during delivery.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "languages": {"name": "languages", "description": "Codes of the languages that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of impressions that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The amount of spend that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of follows that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpc": {"name": "daily_cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpm": {"name": "daily_cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_ctr": {"name": "daily_ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads__ad_group_report.sql", "build_path": "target/run/tiktok_ads/models/tiktok_ads__ad_group_report.sql", "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "table"}, "created_at": 1658252686.271764, "compiled_sql": "with __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n), __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n),hourly as (\n \n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_group_report_hourly`\n\n), ad_groups as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_ad_group\n\n), advertiser as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__advertiser`\n\n), campaigns as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_campaign\n\n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n ad_groups.advertiser_id,\n advertiser.advertiser_name,\n campaigns.campaign_id,\n campaigns.campaign_name,\n ad_groups.ad_group_id,\n ad_groups.ad_group_name,\n advertiser.currency,\n ad_groups.action_categories,\n ad_groups.category,\n ad_groups.gender,\n ad_groups.audience_type,\n ad_groups.budget,\n ad_groups.age,\n ad_groups.languages,\n ad_groups.interest_category,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n \n from hourly\n left join ad_groups \n on hourly.ad_group_id = ad_groups.ad_group_id\n left join advertiser\n on ad_groups.advertiser_id = advertiser.advertiser_id\n left join campaigns\n on ad_groups.campaign_id = campaigns.campaign_id\n group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16\n\n)\n\nselect *\nfrom aggregated", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}, {"id": "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "sql": " __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`dbt_renee_stg_tiktok_ads`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": "`database`.`schema`.`tiktok_ads__ad_group_report`"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_adapter_ad_id__date_day.c70f86f560": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_9db65ce81760c299942d65ab5e7e6d4e\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_id", "date_day"], "model": "{{ get_where_subquery(ref('tiktok_ads__ad_adapter')) }}"}, "namespace": "dbt_utils"}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": []}, "config": {"enabled": false, "alias": "dbt_utils_unique_combination_o_9db65ce81760c299942d65ab5e7e6d4e", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "dbt_utils_unique_combination_of_columns_tiktok_ads__ad_adapter_ad_id__date_day"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_adapter_ad_id__date_day.c70f86f560", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_9db65ce81760c299942d65ab5e7e6d4e.sql", "original_file_path": "models/tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_tiktok_ads__ad_adapter_ad_id__date_day", "alias": "dbt_utils_unique_combination_o_9db65ce81760c299942d65ab5e7e6d4e", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__ad_adapter"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_9db65ce81760c299942d65ab5e7e6d4e"}, "created_at": 1658252686.281006, "column_name": null, "file_key_name": "models.tiktok_ads__ad_adapter"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day.2eb4c2ff6d": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_72fdc194de3164f205583879773e492a\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_group_id", "date_day"], "model": "{{ get_where_subquery(ref('tiktok_ads__ad_group_report')) }}"}, "namespace": "dbt_utils"}, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__ad_group_report"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_72fdc194de3164f205583879773e492a", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day.2eb4c2ff6d", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_72fdc194de3164f205583879773e492a.sql", "original_file_path": "models/tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day", "alias": "dbt_utils_unique_combination_o_72fdc194de3164f205583879773e492a", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__ad_group_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_72fdc194de3164f205583879773e492a"}, "created_at": 1658252686.296779, "column_name": null, "file_key_name": "models.tiktok_ads__ad_group_report"}}, "sources": {"source.tiktok_ads_source.tiktok_ads.advertiser": {"fqn": ["tiktok_ads_source", "tiktok_ads", "advertiser"], "database": "database", "schema": "tiktok_ads_joe", "unique_id": "source.tiktok_ads_source.tiktok_ads.advertiser", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "advertiser", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "advertiser", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents data for one advertiser.", "columns": {"id": {"name": "id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "address": {"name": "address", "description": "Advertiser address information", "meta": {}, "data_type": null, "quote": null, "tags": []}, "balance": {"name": "balance", "description": "Account available balance", "meta": {}, "data_type": null, "quote": null, "tags": []}, "company": {"name": "company", "description": "Advertiser's company name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "contacter": {"name": "contacter", "description": "Contact Person", "meta": {}, "data_type": null, "quote": null, "tags": []}, "country": {"name": "country", "description": "The advertiser's country", "meta": {}, "data_type": null, "quote": null, "tags": []}, "create_time": {"name": "create_time", "description": "Advertiser's create time", "meta": {}, "data_type": null, "quote": null, "tags": []}, "currency": {"name": "currency", "description": "Type of currency used by advertisers", "meta": {}, "data_type": null, "quote": null, "tags": []}, "description": {"name": "description", "description": "Brand description, i.e. promotional content", "meta": {}, "data_type": null, "quote": null, "tags": []}, "email": {"name": "email", "description": "Advertiser contact email, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "industry": {"name": "industry", "description": "Advertiser industry category", "meta": {}, "data_type": null, "quote": null, "tags": []}, "language": {"name": "language", "description": "Language used by advertisers", "meta": {}, "data_type": null, "quote": null, "tags": []}, "license_no": {"name": "license_no", "description": "License number", "meta": {}, "data_type": null, "quote": null, "tags": []}, "license_url": {"name": "license_url", "description": "License preview address, the link is valid for an hour by default.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "Advertiser name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "phone_number": {"name": "phone_number", "description": "Contact mobile number, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "promotion_area": {"name": "promotion_area", "description": "Operation area", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reason": {"name": "reason", "description": "Reason for rejection", "meta": {}, "data_type": null, "quote": null, "tags": []}, "role": {"name": "role", "description": "Advertiser role", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Advertiser status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "telephone": {"name": "telephone", "description": "Fixed phone number, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "timezone": {"name": "timezone", "description": "Ad account time zone including GMT offset", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`database`.`tiktok_ads_joe`.`advertiser`", "created_at": 1658244909.62709}, "source.tiktok_ads_source.tiktok_ads.campaign_history": {"fqn": ["tiktok_ads_source", "tiktok_ads", "campaign_history"], "database": "database", "schema": "tiktok_ads_joe", "unique_id": "source.tiktok_ads_source.tiktok_ads.campaign_history", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "campaign_history", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "campaign_history", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents a version of a TikTok campaign.", "columns": {"campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget": {"name": "budget", "description": "Campaign budget", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget_mode": {"name": "budget_mode", "description": "Budget type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_type": {"name": "campaign_type", "description": "Campaign Type, indicates the campaign is a regular campaign or iOS 14 campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "create_time": {"name": "create_time", "description": "Time at which the campaign was created.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_new_structure": {"name": "is_new_structure", "description": "Whether the campaign is a new structure (for the same campaign, the structure of campaign, adgroups and ads are the same)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "objective_type": {"name": "objective_type", "description": "Advertising objective.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "opt_status": {"name": "opt_status", "description": "Operation status.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Campaign status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "split_test_variable": {"name": "split_test_variable", "description": "Split Test variables. Optional values; TARGETING, BIDDING_OPTIMIZATION , CREATIVE.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`database`.`tiktok_ads_joe`.`campaign_history`", "created_at": 1658244909.627365}, "source.tiktok_ads_source.tiktok_ads.adgroup_history": {"fqn": ["tiktok_ads_source", "tiktok_ads", "adgroup_history"], "database": "database", "schema": "tiktok_ads_joe", "unique_id": "source.tiktok_ads_source.tiktok_ads.adgroup_history", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "adgroup_history", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "adgroup_history", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents a version of a TikTok ad group.", "columns": {"adgroup_id": {"name": "adgroup_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The Ad group's campaign ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_categories": {"name": "action_categories", "description": "IDs of the action categories (behaviors) that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_days": {"name": "action_days", "description": "The number of days of the time period to include action from.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "adgroup_name": {"name": "adgroup_name", "description": "Ad group name. Character limit is 512 and cannot contain emoji.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "age": {"name": "age", "description": "Age groups you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "android_osv": {"name": "android_osv", "description": "Minimum Android version.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "app_download_url": {"name": "app_download_url", "description": "App download link", "meta": {}, "data_type": null, "quote": null, "tags": []}, "app_id": {"name": "app_id", "description": "The Application id of the promoted app", "meta": {}, "data_type": null, "quote": null, "tags": []}, "app_name": {"name": "app_name", "description": "App name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "app_type": {"name": "app_type", "description": "App type.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience": {"name": "audience", "description": "A list of audience IDs.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience_type": {"name": "audience_type", "description": "Audience Type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "bid": {"name": "bid", "description": "CPC, CPM bidding, oCPM learning bidding", "meta": {}, "data_type": null, "quote": null, "tags": []}, "bid_type": {"name": "bid_type", "description": "Bidding Strategy", "meta": {}, "data_type": null, "quote": null, "tags": []}, "billing_event": {"name": "billing_event", "description": "Bid method.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget": {"name": "budget", "description": "Ad budget. Returns 0.0 when Campaign Budget Optimization (budget_optimize_switch) is on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget_mode": {"name": "budget_mode", "description": "Budget mode. This field will be ignored when Campaign Budget Optimization (budget_optimize_switch) is enabled.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "carriers": {"name": "carriers", "description": "Carriers that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "category": {"name": "category", "description": "Ad group category.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "click_tracking_url": {"name": "click_tracking_url", "description": "Click monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "connection_type": {"name": "connection_type", "description": "Device connection types that you want to target. Default; unlimited.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_bid": {"name": "conversion_bid", "description": "oCPM conversion bid", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpv_video_duration": {"name": "cpv_video_duration", "description": "Video playback duration, required if optimize_goal is VIDEO_VIEW. Allowed values; SIX_SECONDS (video playback 6s), TWO_SECONDS (video playback 2s)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "creative_material_mode": {"name": "creative_material_mode", "description": "Creative delivery mode.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "dayparting": {"name": "dayparting", "description": "Ad delivery period, the default is always and the format is 48 * 7 character string, represented by 0 or 1. > That is, with half an hour as the minimum granularity, a day (24 hours) is divided by the minimum granularity(30 mins) from Monday to Sunday. Resulting in a 48*7 format.0 represents not to be delivered, 1 represents delivery. no transmission, full transmission 0, full transmission 1 all represent full time delivery", "meta": {}, "data_type": null, "quote": null, "tags": []}, "deep_bid_type": {"name": "deep_bid_type", "description": "Bidding strategy for in-app events.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "deep_cpabid": {"name": "deep_cpabid", "description": "Deep bid", "meta": {}, "data_type": null, "quote": null, "tags": []}, "deep_external_action": {"name": "deep_external_action", "description": "Deep conversion event.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "display_name": {"name": "display_name", "description": "Display name of ad group.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "enable_inventory_filter": {"name": "enable_inventory_filter", "description": "Inventory filtering (Unsafe videos will not be displayed).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "excluded_audience": {"name": "excluded_audience", "description": "A list of audience ID to be excluded.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "external_action": {"name": "external_action", "description": "Conversion event for the ad group. It is required when the promoted object is an app with tracking urls, or when pixel_id is specified.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "fallback_type": {"name": "fallback_type", "description": "Fallback Type. If the audience do not have the app installed, you can have them fall back to install the app, or to view a specific web page. Not applicable for Deferred Deeplink. Allowed values; APP_INSTALL, WEBSITE, UNSET. If website is chosen, you need to specify the url via landing_page_url field.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency": {"name": "frequency", "description": "frequency, together with frequency_schedule, controls how often people see your ad (only available for REACH ads). For example, frequency = 2 frequency_schedule = 3 means \"show ads no more than twice every 3 day\".\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency_schedule": {"name": "frequency_schedule", "description": "frequency, together with frequency, controls how often people see your ad (only available for REACH ads).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impression_tracking_url": {"name": "impression_tracking_url", "description": "Display monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "interest_category_v2": {"name": "interest_category_v2", "description": "Interest classification. If the interest is specified, users that do not meet interest target will be excluded during delivery.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ios_osv": {"name": "ios_osv", "description": "Minimum iOS version.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_comment_disable": {"name": "is_comment_disable", "description": "Whether to allow comments on your ads on TikTok, Vigo, Helo.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_hfss": {"name": "is_hfss", "description": "Whether the promoted content is HFSS foods (foods that are high in fat, salt, or sugar).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_new_structure": {"name": "is_new_structure", "description": "Whether the campaign is a new structure.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "keywords": {"name": "keywords", "description": "Keywords used.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "languages": {"name": "languages", "description": "Codes of the languages that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "location": {"name": "location", "description": "IDs of the locations that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "open_url": {"name": "open_url", "description": "The specific location where you want your audience to go if they have your app installed.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "open_url_type": {"name": "open_url_type", "description": "The open URL type.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "operation_system": {"name": "operation_system", "description": "Device operating systems that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "opt_status": {"name": "opt_status", "description": "Operation status.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "optimize_goal": {"name": "optimize_goal", "description": "Optimization goal.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "pacing": {"name": "pacing", "description": "You can choose between PACING_MODE_SMOOTH and PACING_MODE_FAST. For PACING_MODE_SMOOTH, the budget is allocated evenly within the scheduled time. PACING_MODE_FAST would consume budget and produce results as soon as possible. \n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "package": {"name": "package", "description": "Package name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "pangle_block_app_list_id": {"name": "pangle_block_app_list_id", "description": "Pangle app block list ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "pixel_id": {"name": "pixel_id", "description": "Pixel ID. Only application for landing pages.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "placement": {"name": "placement", "description": "The apps where you want to deliver your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "placement_type": {"name": "placement_type", "description": "Placement type.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_image": {"name": "profile_image", "description": "Avatar URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "schedule_end_time": {"name": "schedule_end_time", "description": "Ad delivery end time (UTC+0). Format should be YYYY-MM-DD HH:MM:SS", "meta": {}, "data_type": null, "quote": null, "tags": []}, "schedule_start_time": {"name": "schedule_start_time", "description": "Ad delivery start time (UTC+0). Format should be YYYY-MM-DD HH:MM:SS", "meta": {}, "data_type": null, "quote": null, "tags": []}, "schedule_type": {"name": "schedule_type", "description": "The schedule type, which can be either SCHEDULE_START_END or SCHEDULE_FROM_NOW.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "skip_learning_phase": {"name": "skip_learning_phase", "description": "Whether to skip the learning stage.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "statistic_type": {"name": "statistic_type", "description": "conversion bid statistic type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Ad group status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_actions": {"name": "video_actions", "description": "Number of video actions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_download": {"name": "video_download", "description": "Whether users can download your video ads on TikTok(cannot be updated once created).", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`database`.`tiktok_ads_joe`.`adgroup_history`", "created_at": 1658244909.627717}, "source.tiktok_ads_source.tiktok_ads.ad_history": {"fqn": ["tiktok_ads_source", "tiktok_ads", "ad_history"], "database": "database", "schema": "tiktok_ads_joe", "unique_id": "source.tiktok_ads_source.tiktok_ads.ad_history", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "ad_history", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "ad_history", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents a version of a TikTok ad.", "columns": {"ad_id": {"name": "ad_id", "description": "Ad ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "adgroup_id": {"name": "adgroup_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_name": {"name": "ad_name", "description": "Ad Name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_text": {"name": "ad_text", "description": "The ad text.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "app_name": {"name": "app_name", "description": "The display name of app download ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "call_to_action": {"name": "call_to_action", "description": "Call to action values.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "click_tracking_url": {"name": "click_tracking_url", "description": "Click monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "create_time": {"name": "create_time", "description": "Time at which the ad was created.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "display_name": {"name": "display_name", "description": "The display name of landing page or pure exposure ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "image_ids": {"name": "image_ids", "description": "A list of image IDs.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impression_tracking_url": {"name": "impression_tracking_url", "description": "Display monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_aco": {"name": "is_aco", "description": "Whether the ad is an automated ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_creative_authorized": {"name": "is_creative_authorized", "description": "Whether you grant displaying some of your ads in our TikTok For Business Creative Center. Only valid for non-US advertisers, the default value is false.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_new_structure": {"name": "is_new_structure", "description": "Whether the campaign is a new structure.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "open_url": {"name": "open_url", "description": "The specific location where you want your audience to go if they have your app installed.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "opt_status": {"name": "opt_status", "description": "Operation status.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "playable_url": {"name": "playable_url", "description": "Playable material url.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_image": {"name": "profile_image", "description": "Avatar URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Ad status.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_id": {"name": "video_id", "description": "The video ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`database`.`tiktok_ads_joe`.`ad_history`", "created_at": 1658244909.6279502}, "source.tiktok_ads_source.tiktok_ads.ad_report_hourly": {"fqn": ["tiktok_ads_source", "tiktok_ads", "ad_report_hourly"], "database": "database", "schema": "tiktok_ads_joe", "unique_id": "source.tiktok_ads_source.tiktok_ads.ad_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "ad_report_hourly", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "ad_report_hourly", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents data for each ad for each hour.", "columns": {"ad_id": {"name": "ad_id", "description": "Ad id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion": {"name": "real_time_conversion", "description": "The number of times your ad achieved an outcome, based on the objective and settings you selected. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result": {"name": "result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the results. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_result": {"name": "real_time_cost_per_result", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now, please go to the ad group section to view the cost per Result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result": {"name": "real_time_result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As a campaign may have different optimization goals, the total number of result is not supported in campaign section now , Please go to the ad group section to view the result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_view_p_100": {"name": "video_view_p_100", "description": "The number of times your video was played at 100% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion_rate": {"name": "real_time_conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_secondary_goal_result": {"name": "cost_per_secondary_goal_result", "description": "The average cost for each secondary goal result from your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result_rate": {"name": "secondary_goal_result_rate", "description": "The percentage of secondary goal results you achieved out of all of the installs of your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. The total count is calculated based on the time each ad impression occurred.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_conversion": {"name": "real_time_cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result_rate": {"name": "result_rate", "description": "The percentage of results you achieved out of all of the views/clicks on your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the result rate. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result": {"name": "secondary_goal_result", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_result": {"name": "cost_per_result", "description": "The average cost for each result from your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the cost per result. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time your video was played per person, including any time spent replaying the video. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result_rate": {"name": "real_time_result_rate", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now ,Please go to the ad group section to view the Result Rate. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`database`.`tiktok_ads_joe`.`ad_report_hourly`", "created_at": 1658244909.6282392}, "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly": {"fqn": ["tiktok_ads_source", "tiktok_ads", "campaign_report_hourly"], "database": "database", "schema": "tiktok_ads_joe", "unique_id": "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "campaign_report_hourly", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "campaign_report_hourly", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents data for each campaign for each hour.", "columns": {"campaign_id": {"name": "campaign_id", "description": "Campaign id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion": {"name": "real_time_conversion", "description": "The number of times your ad achieved an outcome, based on the objective and settings you selected. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result": {"name": "result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the results. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_result": {"name": "real_time_cost_per_result", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now, please go to the ad group section to view the cost per Result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result": {"name": "real_time_result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As a campaign may have different optimization goals, the total number of result is not supported in campaign section now , Please go to the ad group section to view the result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_view_p_100": {"name": "video_view_p_100", "description": "The number of times your video was played at 100% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion_rate": {"name": "real_time_conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_secondary_goal_result": {"name": "cost_per_secondary_goal_result", "description": "The average cost for each secondary goal result from your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result_rate": {"name": "secondary_goal_result_rate", "description": "The percentage of secondary goal results you achieved out of all of the installs of your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. The total count is calculated based on the time each ad impression occurred.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_conversion": {"name": "real_time_cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result_rate": {"name": "result_rate", "description": "The percentage of results you achieved out of all of the views/clicks on your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the result rate. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result": {"name": "secondary_goal_result", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_result": {"name": "cost_per_result", "description": "The average cost for each result from your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the cost per result. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time your video was played per person, including any time spent replaying the video. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result_rate": {"name": "real_time_result_rate", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now ,Please go to the ad group section to view the Result Rate. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`database`.`tiktok_ads_joe`.`campaign_report_hourly`", "created_at": 1658244909.628515}, "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly": {"fqn": ["tiktok_ads_source", "tiktok_ads", "adgroup_report_hourly"], "database": "database", "schema": "tiktok_ads_joe", "unique_id": "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "adgroup_report_hourly", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "adgroup_report_hourly", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": null, "period": null}, "error_after": {"count": null, "period": null}, "filter": null}, "external": null, "description": "Each record represents data for each ad group for each hour.", "columns": {"adgroup_id": {"name": "adgroup_id", "description": "Ad group id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion": {"name": "real_time_conversion", "description": "The number of times your ad achieved an outcome, based on the objective and settings you selected. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result": {"name": "result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the results. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_result": {"name": "real_time_cost_per_result", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now, please go to the ad group section to view the cost per Result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result": {"name": "real_time_result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As a campaign may have different optimization goals, the total number of result is not supported in campaign section now , Please go to the ad group section to view the result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_view_p_100": {"name": "video_view_p_100", "description": "The number of times your video was played at 100% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion_rate": {"name": "real_time_conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_secondary_goal_result": {"name": "cost_per_secondary_goal_result", "description": "The average cost for each secondary goal result from your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result_rate": {"name": "secondary_goal_result_rate", "description": "The percentage of secondary goal results you achieved out of all of the installs of your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. The total count is calculated based on the time each ad impression occurred.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_conversion": {"name": "real_time_cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result_rate": {"name": "result_rate", "description": "The percentage of results you achieved out of all of the views/clicks on your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the result rate. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result": {"name": "secondary_goal_result", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_result": {"name": "cost_per_result", "description": "The average cost for each result from your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the cost per result. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time your video was played per person, including any time spent replaying the video. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result_rate": {"name": "real_time_result_rate", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now ,Please go to the ad group section to view the Result Rate. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`database`.`tiktok_ads_joe`.`adgroup_report_hourly`", "created_at": 1658244909.629567}}, "macros": {"macro.dbt_bigquery.date_sharded_table": {"unique_id": "macro.dbt_bigquery.date_sharded_table", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/etc.sql", "original_file_path": "macros/etc.sql", "name": "date_sharded_table", "macro_sql": "{% macro date_sharded_table(base_name) %}\n {{ return(base_name ~ \"[DBT__PARTITION_DATE]\") }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.9067001}, "macro.dbt_bigquery.grant_access_to": {"unique_id": "macro.dbt_bigquery.grant_access_to", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/etc.sql", "original_file_path": "macros/etc.sql", "name": "grant_access_to", "macro_sql": "{% macro grant_access_to(entity, entity_type, role, grant_target_dict) -%}\n {% do adapter.grant_access_to(entity, entity_type, role, grant_target_dict) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.907427}, "macro.dbt_bigquery.get_partitions_metadata": {"unique_id": "macro.dbt_bigquery.get_partitions_metadata", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/etc.sql", "original_file_path": "macros/etc.sql", "name": "get_partitions_metadata", "macro_sql": "\n\n{%- macro get_partitions_metadata(table) -%}\n {%- if execute -%}\n {%- set res = adapter.get_partitions_metadata(table) -%}\n {{- return(res) -}}\n {%- endif -%}\n {{- return(None) -}}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.908194}, "macro.dbt_bigquery.bigquery__get_catalog": {"unique_id": "macro.dbt_bigquery.bigquery__get_catalog", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "name": "bigquery__get_catalog", "macro_sql": "{% macro bigquery__get_catalog(information_schema, schemas) -%}\n\n {%- if (schemas | length) == 0 -%}\n {# Hopefully nothing cares about the columns we return when there are no rows #}\n {%- set query = \"select 1 as id limit 0\" -%}\n {%- else -%}\n\n {%- set query -%}\n with tables as (\n select\n project_id as table_database,\n dataset_id as table_schema,\n table_id as original_table_name,\n\n concat(project_id, '.', dataset_id, '.', table_id) as relation_id,\n\n row_count,\n size_bytes as size_bytes,\n case\n when type = 1 then 'table'\n when type = 2 then 'view'\n else 'external'\n end as table_type,\n\n REGEXP_CONTAINS(table_id, '^.+[0-9]{8}$') and coalesce(type, 0) = 1 as is_date_shard,\n REGEXP_EXTRACT(table_id, '^(.+)[0-9]{8}$') as shard_base_name,\n REGEXP_EXTRACT(table_id, '^.+([0-9]{8})$') as shard_name\n\n from {{ information_schema.replace(information_schema_view='__TABLES__') }}\n where (\n {%- for schema in schemas -%}\n upper(dataset_id) = upper('{{ schema }}'){%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n )\n ),\n\n extracted as (\n\n select *,\n case\n when is_date_shard then shard_base_name\n else original_table_name\n end as table_name\n\n from tables\n\n ),\n\n unsharded_tables as (\n\n select\n table_database,\n table_schema,\n table_name,\n coalesce(table_type, 'external') as table_type,\n is_date_shard,\n\n struct(\n min(shard_name) as shard_min,\n max(shard_name) as shard_max,\n count(*) as shard_count\n ) as table_shards,\n\n sum(size_bytes) as size_bytes,\n sum(row_count) as row_count,\n\n max(relation_id) as relation_id\n\n from extracted\n group by 1,2,3,4,5\n\n ),\n\n info_schema_columns as (\n\n select\n concat(table_catalog, '.', table_schema, '.', table_name) as relation_id,\n table_catalog as table_database,\n table_schema,\n table_name,\n\n -- use the \"real\" column name from the paths query below\n column_name as base_column_name,\n ordinal_position as column_index,\n\n is_partitioning_column,\n clustering_ordinal_position\n\n from {{ information_schema.replace(information_schema_view='COLUMNS') }}\n where ordinal_position is not null\n\n ),\n\n info_schema_column_paths as (\n\n select\n concat(table_catalog, '.', table_schema, '.', table_name) as relation_id,\n field_path as column_name,\n data_type as column_type,\n column_name as base_column_name,\n description as column_comment\n\n from {{ information_schema.replace(information_schema_view='COLUMN_FIELD_PATHS') }}\n\n ),\n\n columns as (\n\n select * except (base_column_name)\n from info_schema_columns\n join info_schema_column_paths using (relation_id, base_column_name)\n\n ),\n\n column_stats as (\n\n select\n table_database,\n table_schema,\n table_name,\n max(relation_id) as relation_id,\n max(case when is_partitioning_column = 'YES' then 1 else 0 end) = 1 as is_partitioned,\n max(case when is_partitioning_column = 'YES' then column_name else null end) as partition_column,\n max(case when clustering_ordinal_position is not null then 1 else 0 end) = 1 as is_clustered,\n array_to_string(\n array_agg(\n case\n when clustering_ordinal_position is not null then column_name\n else null\n end ignore nulls\n order by clustering_ordinal_position\n ), ', '\n ) as clustering_columns\n\n from columns\n group by 1,2,3\n\n )\n\n select\n unsharded_tables.table_database,\n unsharded_tables.table_schema,\n case\n when is_date_shard then concat(unsharded_tables.table_name, '*')\n else unsharded_tables.table_name\n end as table_name,\n unsharded_tables.table_type,\n\n -- coalesce name and type for External tables - these columns are not\n -- present in the COLUMN_FIELD_PATHS resultset\n coalesce(columns.column_name, '') as column_name,\n -- invent a row number to account for nested fields -- BQ does\n -- not treat these nested properties as independent fields\n row_number() over (\n partition by relation_id\n order by columns.column_index, columns.column_name\n ) as column_index,\n coalesce(columns.column_type, '') as column_type,\n columns.column_comment,\n\n 'Shard count' as `stats__date_shards__label`,\n table_shards.shard_count as `stats__date_shards__value`,\n 'The number of date shards in this table' as `stats__date_shards__description`,\n is_date_shard as `stats__date_shards__include`,\n\n 'Shard (min)' as `stats__date_shard_min__label`,\n table_shards.shard_min as `stats__date_shard_min__value`,\n 'The first date shard in this table' as `stats__date_shard_min__description`,\n is_date_shard as `stats__date_shard_min__include`,\n\n 'Shard (max)' as `stats__date_shard_max__label`,\n table_shards.shard_max as `stats__date_shard_max__value`,\n 'The last date shard in this table' as `stats__date_shard_max__description`,\n is_date_shard as `stats__date_shard_max__include`,\n\n '# Rows' as `stats__num_rows__label`,\n row_count as `stats__num_rows__value`,\n 'Approximate count of rows in this table' as `stats__num_rows__description`,\n (unsharded_tables.table_type = 'table') as `stats__num_rows__include`,\n\n 'Approximate Size' as `stats__num_bytes__label`,\n size_bytes as `stats__num_bytes__value`,\n 'Approximate size of table as reported by BigQuery' as `stats__num_bytes__description`,\n (unsharded_tables.table_type = 'table') as `stats__num_bytes__include`,\n\n 'Partitioned By' as `stats__partitioning_type__label`,\n partition_column as `stats__partitioning_type__value`,\n 'The partitioning column for this table' as `stats__partitioning_type__description`,\n is_partitioned as `stats__partitioning_type__include`,\n\n 'Clustered By' as `stats__clustering_fields__label`,\n clustering_columns as `stats__clustering_fields__value`,\n 'The clustering columns for this table' as `stats__clustering_fields__description`,\n is_clustered as `stats__clustering_fields__include`\n\n -- join using relation_id (an actual relation, not a shard prefix) to make\n -- sure that column metadata is picked up through the join. This will only\n -- return the column information for the \"max\" table in a date-sharded table set\n from unsharded_tables\n left join columns using (relation_id)\n left join column_stats using (relation_id)\n {%- endset -%}\n\n {%- endif -%}\n\n {{ return(run_query(query)) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.replace", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.915194}, "macro.dbt_bigquery.partition_by": {"unique_id": "macro.dbt_bigquery.partition_by", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "partition_by", "macro_sql": "{% macro partition_by(partition_config) -%}\n {%- if partition_config is none -%}\n {% do return('') %}\n {%- elif partition_config.data_type | lower in ('date','timestamp','datetime') -%}\n partition by {{ partition_config.render() }}\n {%- elif partition_config.data_type | lower in ('int64') -%}\n {%- set range = partition_config.range -%}\n partition by range_bucket(\n {{ partition_config.field }},\n generate_array({{ range.start}}, {{ range.end }}, {{ range.interval }})\n )\n {%- endif -%}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.92565}, "macro.dbt_bigquery.cluster_by": {"unique_id": "macro.dbt_bigquery.cluster_by", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "cluster_by", "macro_sql": "{% macro cluster_by(raw_cluster_by) %}\n {%- if raw_cluster_by is not none -%}\n cluster by {% if raw_cluster_by is string -%}\n {% set raw_cluster_by = [raw_cluster_by] %}\n {%- endif -%}\n {%- for cluster in raw_cluster_by -%}\n {{ cluster }}\n {%- if not loop.last -%}, {% endif -%}\n {%- endfor -%}\n\n {% endif %}\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.92669}, "macro.dbt_bigquery.bigquery_options": {"unique_id": "macro.dbt_bigquery.bigquery_options", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery_options", "macro_sql": "{% macro bigquery_options(opts) %}\n {% set options -%}\n OPTIONS({% for opt_key, opt_val in opts.items() %}\n {{ opt_key }}={{ opt_val }}{{ \",\" if not loop.last }}\n {% endfor %})\n {%- endset %}\n {%- do return(options) -%}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.927667}, "macro.dbt_bigquery.bigquery_table_options": {"unique_id": "macro.dbt_bigquery.bigquery_table_options", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery_table_options", "macro_sql": "{% macro bigquery_table_options(config, node, temporary) %}\n {% set opts = adapter.get_table_options(config, node, temporary) %}\n {%- do return(bigquery_options(opts)) -%}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery_options"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.928376}, "macro.dbt_bigquery.bigquery__create_table_as": {"unique_id": "macro.dbt_bigquery.bigquery__create_table_as", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__create_table_as", "macro_sql": "{% macro bigquery__create_table_as(temporary, relation, sql) -%}\n {%- set raw_partition_by = config.get('partition_by', none) -%}\n {%- set raw_cluster_by = config.get('cluster_by', none) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {%- set partition_config = adapter.parse_partition_by(raw_partition_by) -%}\n\n {{ sql_header if sql_header is not none }}\n\n create or replace table {{ relation }}\n {{ partition_by(partition_config) }}\n {{ cluster_by(raw_cluster_by) }}\n {{ bigquery_table_options(config, model, temporary) }}\n as (\n {{ sql }}\n );\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.partition_by", "macro.dbt_bigquery.cluster_by", "macro.dbt_bigquery.bigquery_table_options"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.930104}, "macro.dbt_bigquery.bigquery_view_options": {"unique_id": "macro.dbt_bigquery.bigquery_view_options", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery_view_options", "macro_sql": "{% macro bigquery_view_options(config, node) %}\n {% set opts = adapter.get_view_options(config, node) %}\n {%- do return(bigquery_options(opts)) -%}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery_options"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.930756}, "macro.dbt_bigquery.bigquery__create_view_as": {"unique_id": "macro.dbt_bigquery.bigquery__create_view_as", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__create_view_as", "macro_sql": "{% macro bigquery__create_view_as(relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n\n create or replace view {{ relation }}\n {{ bigquery_view_options(config, model) }}\n as {{ sql }};\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery_view_options"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.9316218}, "macro.dbt_bigquery.bigquery__create_schema": {"unique_id": "macro.dbt_bigquery.bigquery__create_schema", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__create_schema", "macro_sql": "{% macro bigquery__create_schema(relation) -%}\n {{ adapter.create_schema(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.931982}, "macro.dbt_bigquery.bigquery__drop_schema": {"unique_id": "macro.dbt_bigquery.bigquery__drop_schema", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__drop_schema", "macro_sql": "{% macro bigquery__drop_schema(relation) -%}\n {{ adapter.drop_schema(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.932333}, "macro.dbt_bigquery.bigquery__drop_relation": {"unique_id": "macro.dbt_bigquery.bigquery__drop_relation", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__drop_relation", "macro_sql": "{% macro bigquery__drop_relation(relation) -%}\n {% call statement('drop_relation') -%}\n drop {{ relation.type }} if exists {{ relation }}\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.932877}, "macro.dbt_bigquery.bigquery__get_columns_in_relation": {"unique_id": "macro.dbt_bigquery.bigquery__get_columns_in_relation", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__get_columns_in_relation", "macro_sql": "{% macro bigquery__get_columns_in_relation(relation) -%}\n {{ return(adapter.get_columns_in_relation(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.933287}, "macro.dbt_bigquery.bigquery__list_relations_without_caching": {"unique_id": "macro.dbt_bigquery.bigquery__list_relations_without_caching", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__list_relations_without_caching", "macro_sql": "{% macro bigquery__list_relations_without_caching(schema_relation) -%}\n {{ return(adapter.list_relations_without_caching(schema_relation)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.933685}, "macro.dbt_bigquery.bigquery__current_timestamp": {"unique_id": "macro.dbt_bigquery.bigquery__current_timestamp", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__current_timestamp", "macro_sql": "{% macro bigquery__current_timestamp() -%}\n CURRENT_TIMESTAMP()\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.9339}, "macro.dbt_bigquery.bigquery__snapshot_string_as_time": {"unique_id": "macro.dbt_bigquery.bigquery__snapshot_string_as_time", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__snapshot_string_as_time", "macro_sql": "{% macro bigquery__snapshot_string_as_time(timestamp) -%}\n {%- set result = 'TIMESTAMP(\"' ~ timestamp ~ '\")' -%}\n {{ return(result) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.9343848}, "macro.dbt_bigquery.bigquery__list_schemas": {"unique_id": "macro.dbt_bigquery.bigquery__list_schemas", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__list_schemas", "macro_sql": "{% macro bigquery__list_schemas(database) -%}\n {{ return(adapter.list_schemas(database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.93479}, "macro.dbt_bigquery.bigquery__check_schema_exists": {"unique_id": "macro.dbt_bigquery.bigquery__check_schema_exists", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__check_schema_exists", "macro_sql": "{% macro bigquery__check_schema_exists(information_schema, schema) %}\n {{ return(adapter.check_schema_exists(information_schema.database, schema)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.93545}, "macro.dbt_bigquery.bigquery__persist_docs": {"unique_id": "macro.dbt_bigquery.bigquery__persist_docs", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__persist_docs", "macro_sql": "{% macro bigquery__persist_docs(relation, model, for_relation, for_columns) -%}\n {% if for_columns and config.persist_column_docs() and model.columns %}\n {% do alter_column_comment(relation, model.columns) %}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.936215}, "macro.dbt_bigquery.bigquery__alter_column_comment": {"unique_id": "macro.dbt_bigquery.bigquery__alter_column_comment", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__alter_column_comment", "macro_sql": "{% macro bigquery__alter_column_comment(relation, column_dict) -%}\n {% do adapter.update_columns(relation, column_dict) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.936647}, "macro.dbt_bigquery.bigquery__rename_relation": {"unique_id": "macro.dbt_bigquery.bigquery__rename_relation", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__rename_relation", "macro_sql": "{% macro bigquery__rename_relation(from_relation, to_relation) -%}\n {% do adapter.rename_relation(from_relation, to_relation) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.937072}, "macro.dbt_bigquery.bigquery__alter_relation_add_columns": {"unique_id": "macro.dbt_bigquery.bigquery__alter_relation_add_columns", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__alter_relation_add_columns", "macro_sql": "{% macro bigquery__alter_relation_add_columns(relation, add_columns) %}\n \n {% set sql -%}\n \n alter {{ relation.type }} {{ relation }}\n {% for column in add_columns %}\n add column {{ column.name }} {{ column.data_type }}{{ ',' if not loop.last }}\n {% endfor %}\n \n {%- endset -%}\n\n {{ return(run_query(sql)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.938161}, "macro.dbt_bigquery.bigquery__alter_relation_drop_columns": {"unique_id": "macro.dbt_bigquery.bigquery__alter_relation_drop_columns", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__alter_relation_drop_columns", "macro_sql": "{% macro bigquery__alter_relation_drop_columns(relation, drop_columns) %}\n \n {% set sql -%}\n \n alter {{ relation.type }} {{ relation }}\n\n {% for column in drop_columns %}\n drop column {{ column.name }}{{ ',' if not loop.last }}\n {% endfor %}\n \n {%- endset -%}\n \n {{ return(run_query(sql)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.939177}, "macro.dbt_bigquery.bigquery__alter_column_type": {"unique_id": "macro.dbt_bigquery.bigquery__alter_column_type", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__alter_column_type", "macro_sql": "{% macro bigquery__alter_column_type(relation, column_name, new_column_type) -%}\n {#-- Changing a column's data type using a query requires you to scan the entire table.\n The query charges can be significant if the table is very large.\n\n https://cloud.google.com/bigquery/docs/manually-changing-schemas#changing_a_columns_data_type\n #}\n {% set relation_columns = get_columns_in_relation(relation) %}\n\n {% set sql %}\n select\n {%- for col in relation_columns -%}\n {% if col.column == column_name %}\n CAST({{ col.quoted }} AS {{ new_column_type }}) AS {{ col.quoted }}\n {%- else %}\n {{ col.quoted }}\n {%- endif %}\n {%- if not loop.last %},{% endif -%}\n {%- endfor %}\n from {{ relation }}\n {% endset %}\n\n {% call statement('alter_column_type') %}\n {{ create_table_as(False, relation, sql)}}\n {%- endcall %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_columns_in_relation", "macro.dbt.statement", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.9409652}, "macro.dbt_bigquery.bigquery__test_unique": {"unique_id": "macro.dbt_bigquery.bigquery__test_unique", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__test_unique", "macro_sql": "{% macro bigquery__test_unique(model, column_name) %}\n\nwith dbt_test__target as (\n \n select {{ column_name }} as unique_field\n from {{ model }}\n where {{ column_name }} is not null\n \n)\n\nselect\n unique_field,\n count(*) as n_records\n\nfrom dbt_test__target\ngroup by unique_field\nhaving count(*) > 1\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.941416}, "macro.dbt_bigquery.bigquery__create_csv_table": {"unique_id": "macro.dbt_bigquery.bigquery__create_csv_table", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "name": "bigquery__create_csv_table", "macro_sql": "{% macro bigquery__create_csv_table(model, agate_table) %}\n -- no-op\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.942343}, "macro.dbt_bigquery.bigquery__reset_csv_table": {"unique_id": "macro.dbt_bigquery.bigquery__reset_csv_table", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "name": "bigquery__reset_csv_table", "macro_sql": "{% macro bigquery__reset_csv_table(model, full_refresh, old_relation, agate_table) %}\n {{ adapter.drop_relation(old_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.9427788}, "macro.dbt_bigquery.bigquery__load_csv_rows": {"unique_id": "macro.dbt_bigquery.bigquery__load_csv_rows", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "name": "bigquery__load_csv_rows", "macro_sql": "{% macro bigquery__load_csv_rows(model, agate_table) %}\n\n {%- set column_override = model['config'].get('column_types', {}) -%}\n {{ adapter.load_dataframe(model['database'], model['schema'], model['alias'],\n \t\t\t\t\t\t\tagate_table, column_override) }}\n {% if config.persist_relation_docs() and 'description' in model %}\n\n \t{{ adapter.update_table_description(model['database'], model['schema'], model['alias'], model['description']) }}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.944406}, "macro.dbt_bigquery.bigquery__handle_existing_table": {"unique_id": "macro.dbt_bigquery.bigquery__handle_existing_table", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/view.sql", "original_file_path": "macros/materializations/view.sql", "name": "bigquery__handle_existing_table", "macro_sql": "{% macro bigquery__handle_existing_table(full_refresh, old_relation) %}\n {%- if full_refresh -%}\n {{ adapter.drop_relation(old_relation) }}\n {%- else -%}\n {{ exceptions.relation_wrong_type(old_relation, 'view') }}\n {%- endif -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.945806}, "macro.dbt_bigquery.materialization_view_bigquery": {"unique_id": "macro.dbt_bigquery.materialization_view_bigquery", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/view.sql", "original_file_path": "macros/materializations/view.sql", "name": "materialization_view_bigquery", "macro_sql": "{% materialization view, adapter='bigquery' -%}\n {% set to_return = create_or_replace_view() %}\n\n {% set target_relation = this.incorporate(type='view') %}\n {% do persist_docs(target_relation, model) %}\n\n {% if config.get('grant_access_to') %}\n {% for grant_target_dict in config.get('grant_access_to') %}\n {% do adapter.grant_access_to(this, 'view', None, grant_target_dict) %}\n {% endfor %}\n {% endif %}\n\n {% do return(to_return) %}\n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_or_replace_view", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.947392}, "macro.dbt_bigquery.materialization_table_bigquery": {"unique_id": "macro.dbt_bigquery.materialization_table_bigquery", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "name": "materialization_table_bigquery", "macro_sql": "{% materialization table, adapter='bigquery' -%}\n\n {%- set identifier = model['alias'] -%}\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set exists_not_as_table = (old_relation is not none and not old_relation.is_table) -%}\n {%- set target_relation = api.Relation.create(database=database, schema=schema, identifier=identifier, type='table') -%}\n\n {{ run_hooks(pre_hooks) }}\n\n {#\n We only need to drop this thing if it is not a table.\n If it _is_ already a table, then we can overwrite it without downtime\n Unlike table -> view, no need for `--full-refresh`: dropping a view is no big deal\n #}\n {%- if exists_not_as_table -%}\n {{ adapter.drop_relation(old_relation) }}\n {%- endif -%}\n\n -- build model\n {%- set raw_partition_by = config.get('partition_by', none) -%}\n {%- set partition_by = adapter.parse_partition_by(raw_partition_by) -%}\n {%- set cluster_by = config.get('cluster_by', none) -%}\n {% if not adapter.is_replaceable(old_relation, partition_by, cluster_by) %}\n {% do log(\"Hard refreshing \" ~ old_relation ~ \" because it is not replaceable\") %}\n {% do adapter.drop_relation(old_relation) %}\n {% endif %}\n {% call statement('main') -%}\n {{ create_table_as(False, target_relation, sql) }}\n {% endcall -%}\n\n {{ run_hooks(post_hooks) }}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.951961}, "macro.dbt_bigquery.materialization_copy_bigquery": {"unique_id": "macro.dbt_bigquery.materialization_copy_bigquery", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/copy.sql", "original_file_path": "macros/materializations/copy.sql", "name": "materialization_copy_bigquery", "macro_sql": "{% materialization copy, adapter='bigquery' -%}\n\n {# Setup #}\n {{ run_hooks(pre_hooks) }}\n\n {% set destination = this.incorporate(type='table') %}\n\n {# there can be several ref() or source() according to BQ copy API docs #}\n {# cycle over ref() and source() to create source tables array #}\n {% set source_array = [] %}\n {% for ref_table in model.refs %}\n {{ source_array.append(ref(*ref_table)) }}\n {% endfor %}\n\n {% for src_table in model.sources %}\n {{ source_array.append(source(*src_table)) }}\n {% endfor %}\n\n {# Call adapter's copy_table function #}\n {%- set result_str = adapter.copy_table(\n source_array,\n destination,\n config.get('copy_materialization', default = 'table')) -%}\n\n {{ store_result('main', response=result_str) }}\n\n {# Clean up #}\n {{ run_hooks(post_hooks) }}\n {{ adapter.commit() }}\n\n {{ return({'relations': [destination]}) }}\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.955111}, "macro.dbt_bigquery.declare_dbt_max_partition": {"unique_id": "macro.dbt_bigquery.declare_dbt_max_partition", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "name": "declare_dbt_max_partition", "macro_sql": "{% macro declare_dbt_max_partition(relation, partition_by, sql) %}\n\n {% if '_dbt_max_partition' in sql %}\n\n declare _dbt_max_partition {{ partition_by.data_type }} default (\n select max({{ partition_by.field }}) from {{ this }}\n where {{ partition_by.field }} is not null\n );\n \n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.959073}, "macro.dbt_bigquery.dbt_bigquery_validate_get_incremental_strategy": {"unique_id": "macro.dbt_bigquery.dbt_bigquery_validate_get_incremental_strategy", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "name": "dbt_bigquery_validate_get_incremental_strategy", "macro_sql": "{% macro dbt_bigquery_validate_get_incremental_strategy(config) %}\n {#-- Find and validate the incremental strategy #}\n {%- set strategy = config.get(\"incremental_strategy\", default=\"merge\") -%}\n\n {% set invalid_strategy_msg -%}\n Invalid incremental strategy provided: {{ strategy }}\n Expected one of: 'merge', 'insert_overwrite'\n {%- endset %}\n {% if strategy not in ['merge', 'insert_overwrite'] %}\n {% do exceptions.raise_compiler_error(invalid_strategy_msg) %}\n {% endif %}\n\n {% do return(strategy) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.9602828}, "macro.dbt_bigquery.bq_insert_overwrite": {"unique_id": "macro.dbt_bigquery.bq_insert_overwrite", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "name": "bq_insert_overwrite", "macro_sql": "{% macro bq_insert_overwrite(\n tmp_relation, target_relation, sql, unique_key, partition_by, partitions, dest_columns, tmp_relation_exists\n) %}\n\n {% if partitions is not none and partitions != [] %} {# static #}\n\n {% set predicate -%}\n {{ partition_by.render(alias='DBT_INTERNAL_DEST') }} in (\n {{ partitions | join (', ') }}\n )\n {%- endset %}\n\n {%- set source_sql -%}\n (\n {{sql}}\n )\n {%- endset -%}\n\n {{ get_insert_overwrite_merge_sql(target_relation, source_sql, dest_columns, [predicate], include_sql_header=true) }}\n\n {% else %} {# dynamic #}\n\n {% set predicate -%}\n {{ partition_by.render(alias='DBT_INTERNAL_DEST') }} in unnest(dbt_partitions_for_replacement)\n {%- endset %}\n\n {%- set source_sql -%}\n (\n select * from {{ tmp_relation }}\n )\n {%- endset -%}\n\n -- generated script to merge partitions into {{ target_relation }}\n declare dbt_partitions_for_replacement array<{{ partition_by.data_type }}>;\n\n {# have we already created the temp table to check for schema changes? #}\n {% if not tmp_relation_exists %}\n {{ declare_dbt_max_partition(this, partition_by, sql) }}\n \n -- 1. create a temp table\n {{ create_table_as(True, tmp_relation, sql) }}\n {% else %}\n -- 1. temp table already exists, we used it to check for schema changes\n {% endif %}\n\n -- 2. define partitions to update\n set (dbt_partitions_for_replacement) = (\n select as struct\n array_agg(distinct {{ partition_by.render() }})\n from {{ tmp_relation }}\n );\n\n {#\n TODO: include_sql_header is a hack; consider a better approach that includes\n the sql_header at the materialization-level instead\n #}\n -- 3. run the merge statement\n {{ get_insert_overwrite_merge_sql(target_relation, source_sql, dest_columns, [predicate], include_sql_header=false) }};\n\n -- 4. clean up the temp table\n drop table if exists {{ tmp_relation }}\n\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_insert_overwrite_merge_sql", "macro.dbt_bigquery.declare_dbt_max_partition", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.963743}, "macro.dbt_bigquery.bq_generate_incremental_build_sql": {"unique_id": "macro.dbt_bigquery.bq_generate_incremental_build_sql", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "name": "bq_generate_incremental_build_sql", "macro_sql": "{% macro bq_generate_incremental_build_sql(\n strategy, tmp_relation, target_relation, sql, unique_key, partition_by, partitions, dest_columns, tmp_relation_exists\n) %}\n {#-- if partitioned, use BQ scripting to get the range of partition values to be updated --#}\n {% if strategy == 'insert_overwrite' %}\n\n {% set missing_partition_msg -%}\n The 'insert_overwrite' strategy requires the `partition_by` config.\n {%- endset %}\n {% if partition_by is none %}\n {% do exceptions.raise_compiler_error(missing_partition_msg) %}\n {% endif %}\n\n {% set build_sql = bq_insert_overwrite(\n tmp_relation, target_relation, sql, unique_key, partition_by, partitions, dest_columns, on_schema_change\n ) %}\n\n {% else %} {# strategy == 'merge' #}\n {%- set source_sql -%}\n {%- if tmp_relation_exists -%}\n (\n select * from {{ tmp_relation }}\n )\n {%- else -%} {#-- wrap sql in parens to make it a subquery --#}\n (\n {{sql}}\n )\n {%- endif -%}\n {%- endset -%}\n\n {% set build_sql = get_merge_sql(target_relation, source_sql, unique_key, dest_columns) %}\n\n {% endif %}\n\n {{ return(build_sql) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bq_insert_overwrite", "macro.dbt.get_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.966035}, "macro.dbt_bigquery.materialization_incremental_bigquery": {"unique_id": "macro.dbt_bigquery.materialization_incremental_bigquery", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "name": "materialization_incremental_bigquery", "macro_sql": "{% materialization incremental, adapter='bigquery' -%}\n\n {%- set unique_key = config.get('unique_key') -%}\n {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n {%- set target_relation = this %}\n {%- set existing_relation = load_relation(this) %}\n {%- set tmp_relation = make_temp_relation(this) %}\n\n {#-- Validate early so we don't run SQL if the strategy is invalid --#}\n {% set strategy = dbt_bigquery_validate_get_incremental_strategy(config) -%}\n\n {%- set raw_partition_by = config.get('partition_by', none) -%}\n {%- set partition_by = adapter.parse_partition_by(raw_partition_by) -%}\n {%- set partitions = config.get('partitions', none) -%}\n {%- set cluster_by = config.get('cluster_by', none) -%}\n\n {% set on_schema_change = incremental_validate_on_schema_change(config.get('on_schema_change'), default='ignore') %}\n\n {{ run_hooks(pre_hooks) }}\n\n {% if existing_relation is none %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n \n {% elif existing_relation.is_view %}\n {#-- There's no way to atomically replace a view with a table on BQ --#}\n {{ adapter.drop_relation(existing_relation) }}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n \n {% elif full_refresh_mode %}\n {#-- If the partition/cluster config has changed, then we must drop and recreate --#}\n {% if not adapter.is_replaceable(existing_relation, partition_by, cluster_by) %}\n {% do log(\"Hard refreshing \" ~ existing_relation ~ \" because it is not replaceable\") %}\n {{ adapter.drop_relation(existing_relation) }}\n {% endif %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n \n {% else %}\n {% set tmp_relation_exists = false %}\n {% if on_schema_change != 'ignore' %} {# Check first, since otherwise we may not build a temp table #}\n {% do run_query(\n declare_dbt_max_partition(this, partition_by, sql) + create_table_as(True, tmp_relation, sql)\n ) %}\n {% set tmp_relation_exists = true %}\n {#-- Process schema changes. Returns dict of changes if successful. Use source columns for upserting/merging --#}\n {% set dest_columns = process_schema_changes(on_schema_change, tmp_relation, existing_relation) %}\n {% endif %}\n {% if not dest_columns %}\n {% set dest_columns = adapter.get_columns_in_relation(existing_relation) %}\n {% endif %}\n {% set build_sql = bq_generate_incremental_build_sql(\n strategy, tmp_relation, target_relation, sql, unique_key, partition_by, partitions, dest_columns, tmp_relation_exists\n ) %}\n\n {% endif %}\n\n {%- call statement('main') -%}\n {{ build_sql }}\n {% endcall %}\n\n {{ run_hooks(post_hooks) }}\n\n {% set target_relation = this.incorporate(type='table') %}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.load_relation", "macro.dbt.make_temp_relation", "macro.dbt_bigquery.dbt_bigquery_validate_get_incremental_strategy", "macro.dbt.incremental_validate_on_schema_change", "macro.dbt.run_hooks", "macro.dbt.create_table_as", "macro.dbt.run_query", "macro.dbt_bigquery.declare_dbt_max_partition", "macro.dbt.process_schema_changes", "macro.dbt_bigquery.bq_generate_incremental_build_sql", "macro.dbt.statement", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.974067}, "macro.dbt_bigquery.bigquery__snapshot_hash_arguments": {"unique_id": "macro.dbt_bigquery.bigquery__snapshot_hash_arguments", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/snapshot.sql", "original_file_path": "macros/materializations/snapshot.sql", "name": "bigquery__snapshot_hash_arguments", "macro_sql": "{% macro bigquery__snapshot_hash_arguments(args) -%}\n to_hex(md5(concat({%- for arg in args -%}\n coalesce(cast({{ arg }} as string), ''){% if not loop.last %}, '|',{% endif -%}\n {%- endfor -%}\n )))\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.97557}, "macro.dbt_bigquery.bigquery__create_columns": {"unique_id": "macro.dbt_bigquery.bigquery__create_columns", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/snapshot.sql", "original_file_path": "macros/materializations/snapshot.sql", "name": "bigquery__create_columns", "macro_sql": "{% macro bigquery__create_columns(relation, columns) %}\n {{ adapter.alter_table_add_columns(relation, columns) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.976353}, "macro.dbt_bigquery.bigquery__post_snapshot": {"unique_id": "macro.dbt_bigquery.bigquery__post_snapshot", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/snapshot.sql", "original_file_path": "macros/materializations/snapshot.sql", "name": "bigquery__post_snapshot", "macro_sql": "{% macro bigquery__post_snapshot(staging_relation) %}\n -- Clean up the snapshot temp table\n {% do drop_relation(staging_relation) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.drop_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.976852}, "macro.dbt.run_hooks": {"unique_id": "macro.dbt.run_hooks", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "run_hooks", "macro_sql": "{% macro run_hooks(hooks, inside_transaction=True) %}\n {% for hook in hooks | selectattr('transaction', 'equalto', inside_transaction) %}\n {% if not inside_transaction and loop.first %}\n {% call statement(auto_begin=inside_transaction) %}\n commit;\n {% endcall %}\n {% endif %}\n {% set rendered = render(hook.get('sql')) | trim %}\n {% if (rendered | length) > 0 %}\n {% call statement(auto_begin=inside_transaction) %}\n {{ rendered }}\n {% endcall %}\n {% endif %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.979854}, "macro.dbt.make_hook_config": {"unique_id": "macro.dbt.make_hook_config", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "make_hook_config", "macro_sql": "{% macro make_hook_config(sql, inside_transaction) %}\n {{ tojson({\"sql\": sql, \"transaction\": inside_transaction}) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.980416}, "macro.dbt.before_begin": {"unique_id": "macro.dbt.before_begin", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "before_begin", "macro_sql": "{% macro before_begin(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.9808261}, "macro.dbt.in_transaction": {"unique_id": "macro.dbt.in_transaction", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "in_transaction", "macro_sql": "{% macro in_transaction(sql) %}\n {{ make_hook_config(sql, inside_transaction=True) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.981245}, "macro.dbt.after_commit": {"unique_id": "macro.dbt.after_commit", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "after_commit", "macro_sql": "{% macro after_commit(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.9816582}, "macro.dbt.set_sql_header": {"unique_id": "macro.dbt.set_sql_header", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "name": "set_sql_header", "macro_sql": "{% macro set_sql_header(config) -%}\n {{ config.set('sql_header', caller()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.9828632}, "macro.dbt.should_full_refresh": {"unique_id": "macro.dbt.should_full_refresh", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "name": "should_full_refresh", "macro_sql": "{% macro should_full_refresh() %}\n {% set config_full_refresh = config.get('full_refresh') %}\n {% if config_full_refresh is none %}\n {% set config_full_refresh = flags.FULL_REFRESH %}\n {% endif %}\n {% do return(config_full_refresh) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.983711}, "macro.dbt.should_store_failures": {"unique_id": "macro.dbt.should_store_failures", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "name": "should_store_failures", "macro_sql": "{% macro should_store_failures() %}\n {% set config_store_failures = config.get('store_failures') %}\n {% if config_store_failures is none %}\n {% set config_store_failures = flags.STORE_FAILURES %}\n {% endif %}\n {% do return(config_store_failures) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.984548}, "macro.dbt.snapshot_merge_sql": {"unique_id": "macro.dbt.snapshot_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshots/snapshot_merge.sql", "name": "snapshot_merge_sql", "macro_sql": "{% macro snapshot_merge_sql(target, source, insert_cols) -%}\n {{ adapter.dispatch('snapshot_merge_sql', 'dbt')(target, source, insert_cols) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__snapshot_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.985753}, "macro.dbt.default__snapshot_merge_sql": {"unique_id": "macro.dbt.default__snapshot_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshots/snapshot_merge.sql", "name": "default__snapshot_merge_sql", "macro_sql": "{% macro default__snapshot_merge_sql(target, source, insert_cols) -%}\n {%- set insert_cols_csv = insert_cols | join(', ') -%}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on DBT_INTERNAL_SOURCE.dbt_scd_id = DBT_INTERNAL_DEST.dbt_scd_id\n\n when matched\n and DBT_INTERNAL_DEST.dbt_valid_to is null\n and DBT_INTERNAL_SOURCE.dbt_change_type in ('update', 'delete')\n then update\n set dbt_valid_to = DBT_INTERNAL_SOURCE.dbt_valid_to\n\n when not matched\n and DBT_INTERNAL_SOURCE.dbt_change_type = 'insert'\n then insert ({{ insert_cols_csv }})\n values ({{ insert_cols_csv }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.9864829}, "macro.dbt.strategy_dispatch": {"unique_id": "macro.dbt.strategy_dispatch", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "strategy_dispatch", "macro_sql": "{% macro strategy_dispatch(name) -%}\n{% set original_name = name %}\n {% if '.' in name %}\n {% set package_name, name = name.split(\".\", 1) %}\n {% else %}\n {% set package_name = none %}\n {% endif %}\n\n {% if package_name is none %}\n {% set package_context = context %}\n {% elif package_name in context %}\n {% set package_context = context[package_name] %}\n {% else %}\n {% set error_msg %}\n Could not find package '{{package_name}}', called with '{{original_name}}'\n {% endset %}\n {{ exceptions.raise_compiler_error(error_msg | trim) }}\n {% endif %}\n\n {%- set search_name = 'snapshot_' ~ name ~ '_strategy' -%}\n\n {% if search_name not in package_context %}\n {% set error_msg %}\n The specified strategy macro '{{name}}' was not found in package '{{ package_name }}'\n {% endset %}\n {{ exceptions.raise_compiler_error(error_msg | trim) }}\n {% endif %}\n {{ return(package_context[search_name]) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.993691}, "macro.dbt.snapshot_hash_arguments": {"unique_id": "macro.dbt.snapshot_hash_arguments", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_hash_arguments", "macro_sql": "{% macro snapshot_hash_arguments(args) -%}\n {{ adapter.dispatch('snapshot_hash_arguments', 'dbt')(args) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.994161}, "macro.dbt.default__snapshot_hash_arguments": {"unique_id": "macro.dbt.default__snapshot_hash_arguments", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "default__snapshot_hash_arguments", "macro_sql": "{% macro default__snapshot_hash_arguments(args) -%}\n md5({%- for arg in args -%}\n coalesce(cast({{ arg }} as varchar ), '')\n {% if not loop.last %} || '|' || {% endif %}\n {%- endfor -%})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.994768}, "macro.dbt.snapshot_get_time": {"unique_id": "macro.dbt.snapshot_get_time", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_get_time", "macro_sql": "{% macro snapshot_get_time() -%}\n {{ adapter.dispatch('snapshot_get_time', 'dbt')() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.9951591}, "macro.dbt.default__snapshot_get_time": {"unique_id": "macro.dbt.default__snapshot_get_time", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "default__snapshot_get_time", "macro_sql": "{% macro default__snapshot_get_time() -%}\n {{ current_timestamp() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.995428}, "macro.dbt.snapshot_timestamp_strategy": {"unique_id": "macro.dbt.snapshot_timestamp_strategy", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_timestamp_strategy", "macro_sql": "{% macro snapshot_timestamp_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n {% set primary_key = config['unique_key'] %}\n {% set updated_at = config['updated_at'] %}\n {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n\n {#/*\n The snapshot relation might not have an {{ updated_at }} value if the\n snapshot strategy is changed from `check` to `timestamp`. We\n should use a dbt-created column for the comparison in the snapshot\n table instead of assuming that the user-supplied {{ updated_at }}\n will be present in the historical data.\n\n See https://github.com/dbt-labs/dbt-core/issues/2350\n */ #}\n {% set row_changed_expr -%}\n ({{ snapshotted_rel }}.dbt_valid_from < {{ current_rel }}.{{ updated_at }})\n {%- endset %}\n\n {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n {% do return({\n \"unique_key\": primary_key,\n \"updated_at\": updated_at,\n \"row_changed\": row_changed_expr,\n \"scd_id\": scd_id_expr,\n \"invalidate_hard_deletes\": invalidate_hard_deletes\n }) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.997559}, "macro.dbt.snapshot_string_as_time": {"unique_id": "macro.dbt.snapshot_string_as_time", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_string_as_time", "macro_sql": "{% macro snapshot_string_as_time(timestamp) -%}\n {{ adapter.dispatch('snapshot_string_as_time', 'dbt')(timestamp) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__snapshot_string_as_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.998008}, "macro.dbt.default__snapshot_string_as_time": {"unique_id": "macro.dbt.default__snapshot_string_as_time", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "default__snapshot_string_as_time", "macro_sql": "{% macro default__snapshot_string_as_time(timestamp) %}\n {% do exceptions.raise_not_implemented(\n 'snapshot_string_as_time macro not implemented for adapter '+adapter.type()\n ) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244906.998471}, "macro.dbt.snapshot_check_all_get_existing_columns": {"unique_id": "macro.dbt.snapshot_check_all_get_existing_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_check_all_get_existing_columns", "macro_sql": "{% macro snapshot_check_all_get_existing_columns(node, target_exists) -%}\n {%- set query_columns = get_columns_in_query(node['compiled_sql']) -%}\n {%- if not target_exists -%}\n {# no table yet -> return whatever the query does #}\n {{ return([false, query_columns]) }}\n {%- endif -%}\n {# handle any schema changes #}\n {%- set target_table = node.get('alias', node.get('name')) -%}\n {%- set target_relation = adapter.get_relation(database=node.database, schema=node.schema, identifier=target_table) -%}\n {%- set existing_cols = get_columns_in_query('select * from ' ~ target_relation) -%}\n {%- set ns = namespace() -%} {# handle for-loop scoping with a namespace #}\n {%- set ns.column_added = false -%}\n\n {%- set intersection = [] -%}\n {%- for col in query_columns -%}\n {%- if col in existing_cols -%}\n {%- do intersection.append(col) -%}\n {%- else -%}\n {% set ns.column_added = true %}\n {%- endif -%}\n {%- endfor -%}\n {{ return([ns.column_added, intersection]) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.0011}, "macro.dbt.snapshot_check_strategy": {"unique_id": "macro.dbt.snapshot_check_strategy", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_check_strategy", "macro_sql": "{% macro snapshot_check_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n {% set check_cols_config = config['check_cols'] %}\n {% set primary_key = config['unique_key'] %}\n {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n \n {% set select_current_time -%}\n select {{ snapshot_get_time() }} as snapshot_start\n {%- endset %}\n\n {#-- don't access the column by name, to avoid dealing with casing issues on snowflake #}\n {%- set now = run_query(select_current_time)[0][0] -%}\n {% if now is none or now is undefined -%}\n {%- do exceptions.raise_compiler_error('Could not get a snapshot start time from the database') -%}\n {%- endif %}\n {% set updated_at = config.get('updated_at', snapshot_string_as_time(now)) %}\n\n {% set column_added = false %}\n\n {% if check_cols_config == 'all' %}\n {% set column_added, check_cols = snapshot_check_all_get_existing_columns(node, target_exists) %}\n {% elif check_cols_config is iterable and (check_cols_config | length) > 0 %}\n {% set check_cols = check_cols_config %}\n {% else %}\n {% do exceptions.raise_compiler_error(\"Invalid value for 'check_cols': \" ~ check_cols_config) %}\n {% endif %}\n\n {%- set row_changed_expr -%}\n (\n {%- if column_added -%}\n TRUE\n {%- else -%}\n {%- for col in check_cols -%}\n {{ snapshotted_rel }}.{{ col }} != {{ current_rel }}.{{ col }}\n or\n (\n (({{ snapshotted_rel }}.{{ col }} is null) and not ({{ current_rel }}.{{ col }} is null))\n or\n ((not {{ snapshotted_rel }}.{{ col }} is null) and ({{ current_rel }}.{{ col }} is null))\n )\n {%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n {%- endif -%}\n )\n {%- endset %}\n\n {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n {% do return({\n \"unique_key\": primary_key,\n \"updated_at\": updated_at,\n \"row_changed\": row_changed_expr,\n \"scd_id\": scd_id_expr,\n \"invalidate_hard_deletes\": invalidate_hard_deletes\n }) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.snapshot_get_time", "macro.dbt.run_query", "macro.dbt.snapshot_string_as_time", "macro.dbt.snapshot_check_all_get_existing_columns", "macro.dbt.snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.006127}, "macro.dbt.create_columns": {"unique_id": "macro.dbt.create_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "create_columns", "macro_sql": "{% macro create_columns(relation, columns) %}\n {{ adapter.dispatch('create_columns', 'dbt')(relation, columns) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_columns"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.012222}, "macro.dbt.default__create_columns": {"unique_id": "macro.dbt.default__create_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "default__create_columns", "macro_sql": "{% macro default__create_columns(relation, columns) %}\n {% for column in columns %}\n {% call statement() %}\n alter table {{ relation }} add column \"{{ column.name }}\" {{ column.data_type }};\n {% endcall %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.013012}, "macro.dbt.post_snapshot": {"unique_id": "macro.dbt.post_snapshot", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "post_snapshot", "macro_sql": "{% macro post_snapshot(staging_relation) %}\n {{ adapter.dispatch('post_snapshot', 'dbt')(staging_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.013479}, "macro.dbt.default__post_snapshot": {"unique_id": "macro.dbt.default__post_snapshot", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "default__post_snapshot", "macro_sql": "{% macro default__post_snapshot(staging_relation) %}\n {# no-op #}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.013728}, "macro.dbt.snapshot_staging_table": {"unique_id": "macro.dbt.snapshot_staging_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "snapshot_staging_table", "macro_sql": "{% macro snapshot_staging_table(strategy, source_sql, target_relation) -%}\n {{ adapter.dispatch('snapshot_staging_table', 'dbt')(strategy, source_sql, target_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__snapshot_staging_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.014283}, "macro.dbt.default__snapshot_staging_table": {"unique_id": "macro.dbt.default__snapshot_staging_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "default__snapshot_staging_table", "macro_sql": "{% macro default__snapshot_staging_table(strategy, source_sql, target_relation) -%}\n\n with snapshot_query as (\n\n {{ source_sql }}\n\n ),\n\n snapshotted_data as (\n\n select *,\n {{ strategy.unique_key }} as dbt_unique_key\n\n from {{ target_relation }}\n where dbt_valid_to is null\n\n ),\n\n insertions_source_data as (\n\n select\n *,\n {{ strategy.unique_key }} as dbt_unique_key,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to,\n {{ strategy.scd_id }} as dbt_scd_id\n\n from snapshot_query\n ),\n\n updates_source_data as (\n\n select\n *,\n {{ strategy.unique_key }} as dbt_unique_key,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n {{ strategy.updated_at }} as dbt_valid_to\n\n from snapshot_query\n ),\n\n {%- if strategy.invalidate_hard_deletes %}\n\n deletes_source_data as (\n\n select \n *,\n {{ strategy.unique_key }} as dbt_unique_key\n from snapshot_query\n ),\n {% endif %}\n\n insertions as (\n\n select\n 'insert' as dbt_change_type,\n source_data.*\n\n from insertions_source_data as source_data\n left outer join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where snapshotted_data.dbt_unique_key is null\n or (\n snapshotted_data.dbt_unique_key is not null\n and (\n {{ strategy.row_changed }}\n )\n )\n\n ),\n\n updates as (\n\n select\n 'update' as dbt_change_type,\n source_data.*,\n snapshotted_data.dbt_scd_id\n\n from updates_source_data as source_data\n join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where (\n {{ strategy.row_changed }}\n )\n )\n\n {%- if strategy.invalidate_hard_deletes -%}\n ,\n\n deletes as (\n \n select\n 'delete' as dbt_change_type,\n source_data.*,\n {{ snapshot_get_time() }} as dbt_valid_from,\n {{ snapshot_get_time() }} as dbt_updated_at,\n {{ snapshot_get_time() }} as dbt_valid_to,\n snapshotted_data.dbt_scd_id\n \n from snapshotted_data\n left join deletes_source_data as source_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where source_data.dbt_unique_key is null\n )\n {%- endif %}\n\n select * from insertions\n union all\n select * from updates\n {%- if strategy.invalidate_hard_deletes %}\n union all\n select * from deletes\n {%- endif %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.016578}, "macro.dbt.build_snapshot_table": {"unique_id": "macro.dbt.build_snapshot_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "build_snapshot_table", "macro_sql": "{% macro build_snapshot_table(strategy, sql) -%}\n {{ adapter.dispatch('build_snapshot_table', 'dbt')(strategy, sql) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__build_snapshot_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.0170932}, "macro.dbt.default__build_snapshot_table": {"unique_id": "macro.dbt.default__build_snapshot_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "default__build_snapshot_table", "macro_sql": "{% macro default__build_snapshot_table(strategy, sql) %}\n\n select *,\n {{ strategy.scd_id }} as dbt_scd_id,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to\n from (\n {{ sql }}\n ) sbq\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.01778}, "macro.dbt.build_snapshot_staging_table": {"unique_id": "macro.dbt.build_snapshot_staging_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "build_snapshot_staging_table", "macro_sql": "{% macro build_snapshot_staging_table(strategy, sql, target_relation) %}\n {% set tmp_relation = make_temp_relation(target_relation) %}\n\n {% set select = snapshot_staging_table(strategy, sql, target_relation) %}\n\n {% call statement('build_snapshot_staging_relation') %}\n {{ create_table_as(True, tmp_relation, select) }}\n {% endcall %}\n\n {% do return(tmp_relation) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_temp_relation", "macro.dbt.snapshot_staging_table", "macro.dbt.statement", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.018938}, "macro.dbt.materialization_snapshot_default": {"unique_id": "macro.dbt.materialization_snapshot_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/snapshot.sql", "original_file_path": "macros/materializations/snapshots/snapshot.sql", "name": "materialization_snapshot_default", "macro_sql": "{% materialization snapshot, default %}\n {%- set config = model['config'] -%}\n\n {%- set target_table = model.get('alias', model.get('name')) -%}\n\n {%- set strategy_name = config.get('strategy') -%}\n {%- set unique_key = config.get('unique_key') %}\n\n {% if not adapter.check_schema_exists(model.database, model.schema) %}\n {% do create_schema(model.database, model.schema) %}\n {% endif %}\n\n {% set target_relation_exists, target_relation = get_or_create_relation(\n database=model.database,\n schema=model.schema,\n identifier=target_table,\n type='table') -%}\n\n {%- if not target_relation.is_table -%}\n {% do exceptions.relation_wrong_type(target_relation, 'table') %}\n {%- endif -%}\n\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set strategy_macro = strategy_dispatch(strategy_name) %}\n {% set strategy = strategy_macro(model, \"snapshotted_data\", \"source_data\", config, target_relation_exists) %}\n\n {% if not target_relation_exists %}\n\n {% set build_sql = build_snapshot_table(strategy, model['compiled_sql']) %}\n {% set final_sql = create_table_as(False, target_relation, build_sql) %}\n\n {% else %}\n\n {{ adapter.valid_snapshot_target(target_relation) }}\n\n {% set staging_table = build_snapshot_staging_table(strategy, sql, target_relation) %}\n\n -- this may no-op if the database does not require column expansion\n {% do adapter.expand_target_column_types(from_relation=staging_table,\n to_relation=target_relation) %}\n\n {% set missing_columns = adapter.get_missing_columns(staging_table, target_relation)\n | rejectattr('name', 'equalto', 'dbt_change_type')\n | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n | rejectattr('name', 'equalto', 'dbt_unique_key')\n | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n | list %}\n\n {% do create_columns(target_relation, missing_columns) %}\n\n {% set source_columns = adapter.get_columns_in_relation(staging_table)\n | rejectattr('name', 'equalto', 'dbt_change_type')\n | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n | rejectattr('name', 'equalto', 'dbt_unique_key')\n | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n | list %}\n\n {% set quoted_source_columns = [] %}\n {% for column in source_columns %}\n {% do quoted_source_columns.append(adapter.quote(column.name)) %}\n {% endfor %}\n\n {% set final_sql = snapshot_merge_sql(\n target = target_relation,\n source = staging_table,\n insert_cols = quoted_source_columns\n )\n %}\n\n {% endif %}\n\n {% call statement('main') %}\n {{ final_sql }}\n {% endcall %}\n\n {% do persist_docs(target_relation, model) %}\n\n {% if not target_relation_exists %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {% if staging_table is defined %}\n {% do post_snapshot(staging_table) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_schema", "macro.dbt.get_or_create_relation", "macro.dbt.run_hooks", "macro.dbt.strategy_dispatch", "macro.dbt.build_snapshot_table", "macro.dbt.create_table_as", "macro.dbt.build_snapshot_staging_table", "macro.dbt.create_columns", "macro.dbt.snapshot_merge_sql", "macro.dbt.statement", "macro.dbt.persist_docs", "macro.dbt.create_indexes", "macro.dbt.post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.0325398}, "macro.dbt.materialization_test_default": {"unique_id": "macro.dbt.materialization_test_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/test.sql", "original_file_path": "macros/materializations/tests/test.sql", "name": "materialization_test_default", "macro_sql": "{%- materialization test, default -%}\n\n {% set relations = [] %}\n\n {% if should_store_failures() %}\n\n {% set identifier = model['alias'] %}\n {% set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n {% set target_relation = api.Relation.create(\n identifier=identifier, schema=schema, database=database, type='table') -%} %}\n \n {% if old_relation %}\n {% do adapter.drop_relation(old_relation) %}\n {% endif %}\n \n {% call statement(auto_begin=True) %}\n {{ create_table_as(False, target_relation, sql) }}\n {% endcall %}\n \n {% do relations.append(target_relation) %}\n \n {% set main_sql %}\n select *\n from {{ target_relation }}\n {% endset %}\n \n {{ adapter.commit() }}\n \n {% else %}\n\n {% set main_sql = sql %}\n \n {% endif %}\n\n {% set limit = config.get('limit') %}\n {% set fail_calc = config.get('fail_calc') %}\n {% set warn_if = config.get('warn_if') %}\n {% set error_if = config.get('error_if') %}\n\n {% call statement('main', fetch_result=True) -%}\n\n {{ get_test_sql(main_sql, fail_calc, warn_if, error_if, limit)}}\n\n {%- endcall %}\n \n {{ return({'relations': relations}) }}\n\n{%- endmaterialization -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.should_store_failures", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt.get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.037768}, "macro.dbt.get_test_sql": {"unique_id": "macro.dbt.get_test_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/helpers.sql", "original_file_path": "macros/materializations/tests/helpers.sql", "name": "get_test_sql", "macro_sql": "{% macro get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n {{ adapter.dispatch('get_test_sql', 'dbt')(main_sql, fail_calc, warn_if, error_if, limit) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.038992}, "macro.dbt.default__get_test_sql": {"unique_id": "macro.dbt.default__get_test_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/helpers.sql", "original_file_path": "macros/materializations/tests/helpers.sql", "name": "default__get_test_sql", "macro_sql": "{% macro default__get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n select\n {{ fail_calc }} as failures,\n {{ fail_calc }} {{ warn_if }} as should_warn,\n {{ fail_calc }} {{ error_if }} as should_error\n from (\n {{ main_sql }}\n {{ \"limit \" ~ limit if limit != none }}\n ) dbt_internal_test\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.039804}, "macro.dbt.get_where_subquery": {"unique_id": "macro.dbt.get_where_subquery", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/where_subquery.sql", "original_file_path": "macros/materializations/tests/where_subquery.sql", "name": "get_where_subquery", "macro_sql": "{% macro get_where_subquery(relation) -%}\n {% do return(adapter.dispatch('get_where_subquery', 'dbt')(relation)) %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_where_subquery"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.040861}, "macro.dbt.default__get_where_subquery": {"unique_id": "macro.dbt.default__get_where_subquery", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/where_subquery.sql", "original_file_path": "macros/materializations/tests/where_subquery.sql", "name": "default__get_where_subquery", "macro_sql": "{% macro default__get_where_subquery(relation) -%}\n {% set where = config.get('where', '') %}\n {% if where %}\n {%- set filtered -%}\n (select * from {{ relation }} where {{ where }}) dbt_subquery\n {%- endset -%}\n {% do return(filtered) %}\n {%- else -%}\n {% do return(relation) %}\n {%- endif -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.041891}, "macro.dbt.get_quoted_csv": {"unique_id": "macro.dbt.get_quoted_csv", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "name": "get_quoted_csv", "macro_sql": "{% macro get_quoted_csv(column_names) %}\n \n {% set quoted = [] %}\n {% for col in column_names -%}\n {%- do quoted.append(adapter.quote(col)) -%}\n {%- endfor %}\n\n {%- set dest_cols_csv = quoted | join(', ') -%}\n {{ return(dest_cols_csv) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.0438342}, "macro.dbt.diff_columns": {"unique_id": "macro.dbt.diff_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "name": "diff_columns", "macro_sql": "{% macro diff_columns(source_columns, target_columns) %}\n\n {% set result = [] %}\n {% set source_names = source_columns | map(attribute = 'column') | list %}\n {% set target_names = target_columns | map(attribute = 'column') | list %}\n \n {# --check whether the name attribute exists in the target - this does not perform a data type check #}\n {% for sc in source_columns %}\n {% if sc.name not in target_names %}\n {{ result.append(sc) }}\n {% endif %}\n {% endfor %}\n \n {{ return(result) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.0452769}, "macro.dbt.diff_column_data_types": {"unique_id": "macro.dbt.diff_column_data_types", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "name": "diff_column_data_types", "macro_sql": "{% macro diff_column_data_types(source_columns, target_columns) %}\n \n {% set result = [] %}\n {% for sc in source_columns %}\n {% set tc = target_columns | selectattr(\"name\", \"equalto\", sc.name) | list | first %}\n {% if tc %}\n {% if sc.data_type != tc.data_type %}\n {{ result.append( { 'column_name': tc.name, 'new_type': sc.data_type } ) }} \n {% endif %}\n {% endif %}\n {% endfor %}\n\n {{ return(result) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.0468931}, "macro.dbt.get_merge_sql": {"unique_id": "macro.dbt.get_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "get_merge_sql", "macro_sql": "{% macro get_merge_sql(target, source, unique_key, dest_columns, predicates=none) -%}\n {{ adapter.dispatch('get_merge_sql', 'dbt')(target, source, unique_key, dest_columns, predicates) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.05217}, "macro.dbt.default__get_merge_sql": {"unique_id": "macro.dbt.default__get_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "default__get_merge_sql", "macro_sql": "{% macro default__get_merge_sql(target, source, unique_key, dest_columns, predicates) -%}\n {%- set predicates = [] if predicates is none else [] + predicates -%}\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n {%- set update_columns = config.get('merge_update_columns', default = dest_columns | map(attribute=\"quoted\") | list) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {% if unique_key %}\n {% set unique_key_match %}\n DBT_INTERNAL_SOURCE.{{ unique_key }} = DBT_INTERNAL_DEST.{{ unique_key }}\n {% endset %}\n {% do predicates.append(unique_key_match) %}\n {% else %}\n {% do predicates.append('FALSE') %}\n {% endif %}\n\n {{ sql_header if sql_header is not none }}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on {{ predicates | join(' and ') }}\n\n {% if unique_key %}\n when matched then update set\n {% for column_name in update_columns -%}\n {{ column_name }} = DBT_INTERNAL_SOURCE.{{ column_name }}\n {%- if not loop.last %}, {%- endif %}\n {%- endfor %}\n {% endif %}\n\n when not matched then insert\n ({{ dest_cols_csv }})\n values\n ({{ dest_cols_csv }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.055203}, "macro.dbt.get_delete_insert_merge_sql": {"unique_id": "macro.dbt.get_delete_insert_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "get_delete_insert_merge_sql", "macro_sql": "{% macro get_delete_insert_merge_sql(target, source, unique_key, dest_columns) -%}\n {{ adapter.dispatch('get_delete_insert_merge_sql', 'dbt')(target, source, unique_key, dest_columns) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_delete_insert_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.055819}, "macro.dbt.default__get_delete_insert_merge_sql": {"unique_id": "macro.dbt.default__get_delete_insert_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "default__get_delete_insert_merge_sql", "macro_sql": "{% macro default__get_delete_insert_merge_sql(target, source, unique_key, dest_columns) -%}\n\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n {% if unique_key is not none %}\n delete from {{ target }}\n where ({{ unique_key }}) in (\n select ({{ unique_key }})\n from {{ source }}\n );\n {% endif %}\n\n insert into {{ target }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ source }}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.0569532}, "macro.dbt.get_insert_overwrite_merge_sql": {"unique_id": "macro.dbt.get_insert_overwrite_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "get_insert_overwrite_merge_sql", "macro_sql": "{% macro get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header=false) -%}\n {{ adapter.dispatch('get_insert_overwrite_merge_sql', 'dbt')(target, source, dest_columns, predicates, include_sql_header) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_insert_overwrite_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.057643}, "macro.dbt.default__get_insert_overwrite_merge_sql": {"unique_id": "macro.dbt.default__get_insert_overwrite_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "default__get_insert_overwrite_merge_sql", "macro_sql": "{% macro default__get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header) -%}\n {%- set predicates = [] if predicates is none else [] + predicates -%}\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none and include_sql_header }}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on FALSE\n\n when not matched by source\n {% if predicates %} and {{ predicates | join(' and ') }} {% endif %}\n then delete\n\n when not matched then insert\n ({{ dest_cols_csv }})\n values\n ({{ dest_cols_csv }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.059339}, "macro.dbt.is_incremental": {"unique_id": "macro.dbt.is_incremental", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/is_incremental.sql", "original_file_path": "macros/materializations/models/incremental/is_incremental.sql", "name": "is_incremental", "macro_sql": "{% macro is_incremental() %}\n {#-- do not run introspective queries in parsing #}\n {% if not execute %}\n {{ return(False) }}\n {% else %}\n {% set relation = adapter.get_relation(this.database, this.schema, this.table) %}\n {{ return(relation is not none\n and relation.type == 'table'\n and model.config.materialized == 'incremental'\n and not should_full_refresh()) }}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.should_full_refresh"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.0611022}, "macro.dbt.materialization_incremental_default": {"unique_id": "macro.dbt.materialization_incremental_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/incremental.sql", "original_file_path": "macros/materializations/models/incremental/incremental.sql", "name": "materialization_incremental_default", "macro_sql": "{% materialization incremental, default -%}\n\n {% set unique_key = config.get('unique_key') %}\n\n {% set target_relation = this.incorporate(type='table') %}\n {% set existing_relation = load_relation(this) %}\n {% set tmp_relation = make_temp_relation(target_relation) %}\n {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n {% set on_schema_change = incremental_validate_on_schema_change(config.get('on_schema_change'), default='ignore') %}\n\n {% set tmp_identifier = model['name'] + '__dbt_tmp' %}\n {% set backup_identifier = model['name'] + \"__dbt_backup\" %}\n\n -- the intermediate_ and backup_ relations should not already exist in the database; get_relation\n -- will return None in that case. Otherwise, we get a relation that we can drop\n -- later, before we try to use this name for the current operation. This has to happen before\n -- BEGIN, in a separate transaction\n {% set preexisting_intermediate_relation = adapter.get_relation(identifier=tmp_identifier, \n schema=schema,\n database=database) %} \n {% set preexisting_backup_relation = adapter.get_relation(identifier=backup_identifier,\n schema=schema,\n database=database) %}\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set to_drop = [] %}\n\n {# -- first check whether we want to full refresh for source view or config reasons #}\n {% set trigger_full_refresh = (full_refresh_mode or existing_relation.is_view) %}\n\n {% if existing_relation is none %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n{% elif trigger_full_refresh %}\n {#-- Make sure the backup doesn't exist so we don't encounter issues with the rename below #}\n {% set tmp_identifier = model['name'] + '__dbt_tmp' %}\n {% set backup_identifier = model['name'] + '__dbt_backup' %}\n {% set intermediate_relation = existing_relation.incorporate(path={\"identifier\": tmp_identifier}) %}\n {% set backup_relation = existing_relation.incorporate(path={\"identifier\": backup_identifier}) %}\n\n {% set build_sql = create_table_as(False, intermediate_relation, sql) %}\n {% set need_swap = true %}\n {% do to_drop.append(backup_relation) %}\n {% else %}\n {% do run_query(create_table_as(True, tmp_relation, sql)) %}\n {% do adapter.expand_target_column_types(\n from_relation=tmp_relation,\n to_relation=target_relation) %}\n {#-- Process schema changes. Returns dict of changes if successful. Use source columns for upserting/merging --#}\n {% set dest_columns = process_schema_changes(on_schema_change, tmp_relation, existing_relation) %}\n {% if not dest_columns %}\n {% set dest_columns = adapter.get_columns_in_relation(existing_relation) %}\n {% endif %}\n {% set build_sql = get_delete_insert_merge_sql(target_relation, tmp_relation, unique_key, dest_columns) %}\n \n {% endif %}\n\n {% call statement(\"main\") %}\n {{ build_sql }}\n {% endcall %}\n\n {% if need_swap %} \n {% do adapter.rename_relation(target_relation, backup_relation) %} \n {% do adapter.rename_relation(intermediate_relation, target_relation) %} \n {% endif %}\n\n {% do persist_docs(target_relation, model) %}\n\n {% if existing_relation is none or existing_relation.is_view or should_full_refresh() %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {% do adapter.commit() %}\n\n {% for rel in to_drop %}\n {% do adapter.drop_relation(rel) %}\n {% endfor %}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.load_relation", "macro.dbt.make_temp_relation", "macro.dbt.should_full_refresh", "macro.dbt.incremental_validate_on_schema_change", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.create_table_as", "macro.dbt.run_query", "macro.dbt.process_schema_changes", "macro.dbt.get_delete_insert_merge_sql", "macro.dbt.statement", "macro.dbt.persist_docs", "macro.dbt.create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.0728068}, "macro.dbt.incremental_validate_on_schema_change": {"unique_id": "macro.dbt.incremental_validate_on_schema_change", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "name": "incremental_validate_on_schema_change", "macro_sql": "{% macro incremental_validate_on_schema_change(on_schema_change, default='ignore') %}\n \n {% if on_schema_change not in ['sync_all_columns', 'append_new_columns', 'fail', 'ignore'] %}\n \n {% set log_message = 'Invalid value for on_schema_change (%s) specified. Setting default value of %s.' % (on_schema_change, default) %}\n {% do log(log_message) %}\n \n {{ return(default) }}\n\n {% else %}\n\n {{ return(on_schema_change) }}\n \n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.082229}, "macro.dbt.check_for_schema_changes": {"unique_id": "macro.dbt.check_for_schema_changes", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "name": "check_for_schema_changes", "macro_sql": "{% macro check_for_schema_changes(source_relation, target_relation) %}\n \n {% set schema_changed = False %}\n \n {%- set source_columns = adapter.get_columns_in_relation(source_relation) -%}\n {%- set target_columns = adapter.get_columns_in_relation(target_relation) -%}\n {%- set source_not_in_target = diff_columns(source_columns, target_columns) -%}\n {%- set target_not_in_source = diff_columns(target_columns, source_columns) -%}\n\n {% set new_target_types = diff_column_data_types(source_columns, target_columns) %}\n\n {% if source_not_in_target != [] %}\n {% set schema_changed = True %}\n {% elif target_not_in_source != [] or new_target_types != [] %}\n {% set schema_changed = True %}\n {% elif new_target_types != [] %}\n {% set schema_changed = True %}\n {% endif %}\n \n {% set changes_dict = {\n 'schema_changed': schema_changed,\n 'source_not_in_target': source_not_in_target,\n 'target_not_in_source': target_not_in_source,\n 'source_columns': source_columns,\n 'target_columns': target_columns,\n 'new_target_types': new_target_types\n } %}\n\n {% set msg %}\n In {{ target_relation }}:\n Schema changed: {{ schema_changed }}\n Source columns not in target: {{ source_not_in_target }}\n Target columns not in source: {{ target_not_in_source }}\n New column types: {{ new_target_types }}\n {% endset %}\n \n {% do log(msg) %}\n\n {{ return(changes_dict) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.diff_columns", "macro.dbt.diff_column_data_types"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.085539}, "macro.dbt.sync_column_schemas": {"unique_id": "macro.dbt.sync_column_schemas", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "name": "sync_column_schemas", "macro_sql": "{% macro sync_column_schemas(on_schema_change, target_relation, schema_changes_dict) %}\n \n {%- set add_to_target_arr = schema_changes_dict['source_not_in_target'] -%}\n\n {%- if on_schema_change == 'append_new_columns'-%}\n {%- if add_to_target_arr | length > 0 -%}\n {%- do alter_relation_add_remove_columns(target_relation, add_to_target_arr, none) -%}\n {%- endif -%}\n \n {% elif on_schema_change == 'sync_all_columns' %}\n {%- set remove_from_target_arr = schema_changes_dict['target_not_in_source'] -%}\n {%- set new_target_types = schema_changes_dict['new_target_types'] -%}\n \n {% if add_to_target_arr | length > 0 or remove_from_target_arr | length > 0 %} \n {%- do alter_relation_add_remove_columns(target_relation, add_to_target_arr, remove_from_target_arr) -%}\n {% endif %}\n\n {% if new_target_types != [] %}\n {% for ntt in new_target_types %}\n {% set column_name = ntt['column_name'] %}\n {% set new_type = ntt['new_type'] %}\n {% do alter_column_type(target_relation, column_name, new_type) %}\n {% endfor %}\n {% endif %}\n \n {% endif %}\n\n {% set schema_change_message %}\n In {{ target_relation }}:\n Schema change approach: {{ on_schema_change }}\n Columns added: {{ add_to_target_arr }}\n Columns removed: {{ remove_from_target_arr }}\n Data types changed: {{ new_target_types }}\n {% endset %}\n \n {% do log(schema_change_message) %}\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.alter_relation_add_remove_columns", "macro.dbt.alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.088779}, "macro.dbt.process_schema_changes": {"unique_id": "macro.dbt.process_schema_changes", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "name": "process_schema_changes", "macro_sql": "{% macro process_schema_changes(on_schema_change, source_relation, target_relation) %}\n \n {% if on_schema_change == 'ignore' %}\n\n {{ return({}) }}\n\n {% else %}\n \n {% set schema_changes_dict = check_for_schema_changes(source_relation, target_relation) %}\n \n {% if schema_changes_dict['schema_changed'] %}\n \n {% if on_schema_change == 'fail' %}\n \n {% set fail_msg %}\n The source and target schemas on this incremental model are out of sync!\n They can be reconciled in several ways: \n - set the `on_schema_change` config to either append_new_columns or sync_all_columns, depending on your situation.\n - Re-run the incremental model with `full_refresh: True` to update the target schema.\n - update the schema manually and re-run the process.\n {% endset %}\n \n {% do exceptions.raise_compiler_error(fail_msg) %}\n \n {# -- unless we ignore, run the sync operation per the config #}\n {% else %}\n \n {% do sync_column_schemas(on_schema_change, target_relation, schema_changes_dict) %}\n \n {% endif %}\n \n {% endif %}\n\n {{ return(schema_changes_dict['source_columns']) }}\n \n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.check_for_schema_changes", "macro.dbt.sync_column_schemas"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.090712}, "macro.dbt.materialization_table_default": {"unique_id": "macro.dbt.materialization_table_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/table.sql", "original_file_path": "macros/materializations/models/table/table.sql", "name": "materialization_table_default", "macro_sql": "{% materialization table, default %}\n {%- set identifier = model['alias'] -%}\n {%- set tmp_identifier = model['name'] + '__dbt_tmp' -%}\n {%- set backup_identifier = model['name'] + '__dbt_backup' -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier,\n schema=schema,\n database=database,\n type='table') -%}\n {%- set intermediate_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema,\n database=database,\n type='table') -%}\n -- the intermediate_relation should not already exist in the database; get_relation\n -- will return None in that case. Otherwise, we get a relation that we can drop\n -- later, before we try to use this name for the current operation\n {%- set preexisting_intermediate_relation = adapter.get_relation(identifier=tmp_identifier, \n schema=schema,\n database=database) -%}\n /*\n See ../view/view.sql for more information about this relation.\n */\n {%- set backup_relation_type = 'table' if old_relation is none else old_relation.type -%}\n {%- set backup_relation = api.Relation.create(identifier=backup_identifier,\n schema=schema,\n database=database,\n type=backup_relation_type) -%}\n -- as above, the backup_relation should not already exist\n {%- set preexisting_backup_relation = adapter.get_relation(identifier=backup_identifier,\n schema=schema,\n database=database) -%}\n\n\n -- drop the temp relations if they exist already in the database\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% call statement('main') -%}\n {{ get_create_table_as_sql(False, intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n {% if old_relation is not none %}\n {{ adapter.rename_relation(old_relation, backup_relation) }}\n {% endif %}\n\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {% do create_indexes(target_relation) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {% do persist_docs(target_relation, model) %}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n -- finally, drop the existing/backup relation after the commit\n {{ drop_relation_if_exists(backup_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.get_create_table_as_sql", "macro.dbt.create_indexes", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.099231}, "macro.dbt.get_create_table_as_sql": {"unique_id": "macro.dbt.get_create_table_as_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.sql", "name": "get_create_table_as_sql", "macro_sql": "{% macro get_create_table_as_sql(temporary, relation, sql) -%}\n {{ adapter.dispatch('get_create_table_as_sql', 'dbt')(temporary, relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_create_table_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.10042}, "macro.dbt.default__get_create_table_as_sql": {"unique_id": "macro.dbt.default__get_create_table_as_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.sql", "name": "default__get_create_table_as_sql", "macro_sql": "{% macro default__get_create_table_as_sql(temporary, relation, sql) -%}\n {{ return(create_table_as(temporary, relation, sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1009312}, "macro.dbt.create_table_as": {"unique_id": "macro.dbt.create_table_as", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.sql", "name": "create_table_as", "macro_sql": "{% macro create_table_as(temporary, relation, sql) -%}\n {{ adapter.dispatch('create_table_as', 'dbt')(temporary, relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.101475}, "macro.dbt.default__create_table_as": {"unique_id": "macro.dbt.default__create_table_as", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.sql", "name": "default__create_table_as", "macro_sql": "{% macro default__create_table_as(temporary, relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n \n {{ sql_header if sql_header is not none }}\n \n create {% if temporary: -%}temporary{%- endif %} table\n {{ relation.include(database=(not temporary), schema=(not temporary)) }}\n as (\n {{ sql }}\n );\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.102564}, "macro.dbt.materialization_view_default": {"unique_id": "macro.dbt.materialization_view_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/view.sql", "original_file_path": "macros/materializations/models/view/view.sql", "name": "materialization_view_default", "macro_sql": "{%- materialization view, default -%}\n\n {%- set identifier = model['alias'] -%}\n {%- set tmp_identifier = model['name'] + '__dbt_tmp' -%}\n {%- set backup_identifier = model['name'] + '__dbt_backup' -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier, schema=schema, database=database,\n type='view') -%}\n {%- set intermediate_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema, database=database, type='view') -%}\n -- the intermediate_relation should not already exist in the database; get_relation\n -- will return None in that case. Otherwise, we get a relation that we can drop\n -- later, before we try to use this name for the current operation\n {%- set preexisting_intermediate_relation = adapter.get_relation(identifier=tmp_identifier, \n schema=schema,\n database=database) -%}\n /*\n This relation (probably) doesn't exist yet. If it does exist, it's a leftover from\n a previous run, and we're going to try to drop it immediately. At the end of this\n materialization, we're going to rename the \"old_relation\" to this identifier,\n and then we're going to drop it. In order to make sure we run the correct one of:\n - drop view ...\n - drop table ...\n\n We need to set the type of this relation to be the type of the old_relation, if it exists,\n or else \"view\" as a sane default if it does not. Note that if the old_relation does not\n exist, then there is nothing to move out of the way and subsequentally drop. In that case,\n this relation will be effectively unused.\n */\n {%- set backup_relation_type = 'view' if old_relation is none else old_relation.type -%}\n {%- set backup_relation = api.Relation.create(identifier=backup_identifier,\n schema=schema, database=database,\n type=backup_relation_type) -%}\n -- as above, the backup_relation should not already exist\n {%- set preexisting_backup_relation = adapter.get_relation(identifier=backup_identifier,\n schema=schema,\n database=database) -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- drop the temp relations if they exist already in the database\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% call statement('main') -%}\n {{ create_view_as(intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n -- move the existing view out of the way\n {% if old_relation is not none %}\n {{ adapter.rename_relation(old_relation, backup_relation) }}\n {% endif %}\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {{ drop_relation_if_exists(backup_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt.create_view_as", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.110757}, "macro.dbt.handle_existing_table": {"unique_id": "macro.dbt.handle_existing_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/helpers.sql", "original_file_path": "macros/materializations/models/view/helpers.sql", "name": "handle_existing_table", "macro_sql": "{% macro handle_existing_table(full_refresh, old_relation) %}\n {{ adapter.dispatch('handle_existing_table', 'dbt')(full_refresh, old_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__handle_existing_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.111795}, "macro.dbt.default__handle_existing_table": {"unique_id": "macro.dbt.default__handle_existing_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/helpers.sql", "original_file_path": "macros/materializations/models/view/helpers.sql", "name": "default__handle_existing_table", "macro_sql": "{% macro default__handle_existing_table(full_refresh, old_relation) %}\n {{ log(\"Dropping relation \" ~ old_relation ~ \" because it is of type \" ~ old_relation.type) }}\n {{ adapter.drop_relation(old_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.112403}, "macro.dbt.create_or_replace_view": {"unique_id": "macro.dbt.create_or_replace_view", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_or_replace_view.sql", "original_file_path": "macros/materializations/models/view/create_or_replace_view.sql", "name": "create_or_replace_view", "macro_sql": "{% macro create_or_replace_view() %}\n {%- set identifier = model['alias'] -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {%- set target_relation = api.Relation.create(\n identifier=identifier, schema=schema, database=database,\n type='view') -%}\n\n {{ run_hooks(pre_hooks) }}\n\n -- If there's a table with the same name and we weren't told to full refresh,\n -- that's an error. If we were told to full refresh, drop it. This behavior differs\n -- for Snowflake and BigQuery, so multiple dispatch is used.\n {%- if old_relation is not none and old_relation.is_table -%}\n {{ handle_existing_table(should_full_refresh(), old_relation) }}\n {%- endif -%}\n\n -- build model\n {% call statement('main') -%}\n {{ get_create_view_as_sql(target_relation, sql) }}\n {%- endcall %}\n\n {{ run_hooks(post_hooks) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.handle_existing_table", "macro.dbt.should_full_refresh", "macro.dbt.statement", "macro.dbt.get_create_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.115532}, "macro.dbt.get_create_view_as_sql": {"unique_id": "macro.dbt.get_create_view_as_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.sql", "name": "get_create_view_as_sql", "macro_sql": "{% macro get_create_view_as_sql(relation, sql) -%}\n {{ adapter.dispatch('get_create_view_as_sql', 'dbt')(relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_create_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.116577}, "macro.dbt.default__get_create_view_as_sql": {"unique_id": "macro.dbt.default__get_create_view_as_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.sql", "name": "default__get_create_view_as_sql", "macro_sql": "{% macro default__get_create_view_as_sql(relation, sql) -%}\n {{ return(create_view_as(relation, sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1170251}, "macro.dbt.create_view_as": {"unique_id": "macro.dbt.create_view_as", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.sql", "name": "create_view_as", "macro_sql": "{% macro create_view_as(relation, sql) -%}\n {{ adapter.dispatch('create_view_as', 'dbt')(relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1175208}, "macro.dbt.default__create_view_as": {"unique_id": "macro.dbt.default__create_view_as", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.sql", "name": "default__create_view_as", "macro_sql": "{% macro default__create_view_as(relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n create view {{ relation }} as (\n {{ sql }}\n );\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.118241}, "macro.dbt.materialization_seed_default": {"unique_id": "macro.dbt.materialization_seed_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/seed.sql", "original_file_path": "macros/materializations/seeds/seed.sql", "name": "materialization_seed_default", "macro_sql": "{% materialization seed, default %}\n\n {%- set identifier = model['alias'] -%}\n {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n\n {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {%- set agate_table = load_agate_table() -%}\n {%- do store_result('agate_table', response='OK', agate_table=agate_table) -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% set create_table_sql = \"\" %}\n {% if exists_as_view %}\n {{ exceptions.raise_compiler_error(\"Cannot seed to '{}', it is a view\".format(old_relation)) }}\n {% elif exists_as_table %}\n {% set create_table_sql = reset_csv_table(model, full_refresh_mode, old_relation, agate_table) %}\n {% else %}\n {% set create_table_sql = create_csv_table(model, agate_table) %}\n {% endif %}\n\n {% set code = 'CREATE' if full_refresh_mode else 'INSERT' %}\n {% set rows_affected = (agate_table.rows | length) %}\n {% set sql = load_csv_rows(model, agate_table) %}\n\n {% call noop_statement('main', code ~ ' ' ~ rows_affected, code, rows_affected) %}\n {{ create_table_sql }};\n -- dbt seed --\n {{ sql }}\n {% endcall %}\n\n {% set target_relation = this.incorporate(type='table') %}\n {% do persist_docs(target_relation, model) %}\n\n {% if full_refresh_mode or not exists_as_table %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.run_hooks", "macro.dbt.reset_csv_table", "macro.dbt.create_csv_table", "macro.dbt.load_csv_rows", "macro.dbt.noop_statement", "macro.dbt.persist_docs", "macro.dbt.create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.125561}, "macro.dbt.create_csv_table": {"unique_id": "macro.dbt.create_csv_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "create_csv_table", "macro_sql": "{% macro create_csv_table(model, agate_table) -%}\n {{ adapter.dispatch('create_csv_table', 'dbt')(model, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.133514}, "macro.dbt.default__create_csv_table": {"unique_id": "macro.dbt.default__create_csv_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__create_csv_table", "macro_sql": "{% macro default__create_csv_table(model, agate_table) %}\n {%- set column_override = model['config'].get('column_types', {}) -%}\n {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n\n {% set sql %}\n create table {{ this.render() }} (\n {%- for col_name in agate_table.column_names -%}\n {%- set inferred_type = adapter.convert_type(agate_table, loop.index0) -%}\n {%- set type = column_override.get(col_name, inferred_type) -%}\n {%- set column_name = (col_name | string) -%}\n {{ adapter.quote_seed_column(column_name, quote_seed_column) }} {{ type }} {%- if not loop.last -%}, {%- endif -%}\n {%- endfor -%}\n )\n {% endset %}\n\n {% call statement('_') -%}\n {{ sql }}\n {%- endcall %}\n\n {{ return(sql) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.13602}, "macro.dbt.reset_csv_table": {"unique_id": "macro.dbt.reset_csv_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "reset_csv_table", "macro_sql": "{% macro reset_csv_table(model, full_refresh, old_relation, agate_table) -%}\n {{ adapter.dispatch('reset_csv_table', 'dbt')(model, full_refresh, old_relation, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__reset_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.136692}, "macro.dbt.default__reset_csv_table": {"unique_id": "macro.dbt.default__reset_csv_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__reset_csv_table", "macro_sql": "{% macro default__reset_csv_table(model, full_refresh, old_relation, agate_table) %}\n {% set sql = \"\" %}\n {% if full_refresh %}\n {{ adapter.drop_relation(old_relation) }}\n {% set sql = create_csv_table(model, agate_table) %}\n {% else %}\n {{ adapter.truncate_relation(old_relation) }}\n {% set sql = \"truncate table \" ~ old_relation %}\n {% endif %}\n\n {{ return(sql) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.137991}, "macro.dbt.get_binding_char": {"unique_id": "macro.dbt.get_binding_char", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "get_binding_char", "macro_sql": "{% macro get_binding_char() -%}\n {{ adapter.dispatch('get_binding_char', 'dbt')() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_binding_char"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1383822}, "macro.dbt.default__get_binding_char": {"unique_id": "macro.dbt.default__get_binding_char", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__get_binding_char", "macro_sql": "{% macro default__get_binding_char() %}\n {{ return('%s') }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1387148}, "macro.dbt.get_batch_size": {"unique_id": "macro.dbt.get_batch_size", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "get_batch_size", "macro_sql": "{% macro get_batch_size() -%}\n {{ return(adapter.dispatch('get_batch_size', 'dbt')()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_batch_size"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1392388}, "macro.dbt.default__get_batch_size": {"unique_id": "macro.dbt.default__get_batch_size", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__get_batch_size", "macro_sql": "{% macro default__get_batch_size() %}\n {{ return(10000) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.139574}, "macro.dbt.get_seed_column_quoted_csv": {"unique_id": "macro.dbt.get_seed_column_quoted_csv", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "get_seed_column_quoted_csv", "macro_sql": "{% macro get_seed_column_quoted_csv(model, column_names) %}\n {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n {% set quoted = [] %}\n {% for col in column_names -%}\n {%- do quoted.append(adapter.quote_seed_column(col, quote_seed_column)) -%}\n {%- endfor %}\n\n {%- set dest_cols_csv = quoted | join(', ') -%}\n {{ return(dest_cols_csv) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1410491}, "macro.dbt.load_csv_rows": {"unique_id": "macro.dbt.load_csv_rows", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "load_csv_rows", "macro_sql": "{% macro load_csv_rows(model, agate_table) -%}\n {{ adapter.dispatch('load_csv_rows', 'dbt')(model, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__load_csv_rows"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.141728}, "macro.dbt.default__load_csv_rows": {"unique_id": "macro.dbt.default__load_csv_rows", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__load_csv_rows", "macro_sql": "{% macro default__load_csv_rows(model, agate_table) %}\n\n {% set batch_size = get_batch_size() %}\n\n {% set cols_sql = get_seed_column_quoted_csv(model, agate_table.column_names) %}\n {% set bindings = [] %}\n\n {% set statements = [] %}\n\n {% for chunk in agate_table.rows | batch(batch_size) %}\n {% set bindings = [] %}\n\n {% for row in chunk %}\n {% do bindings.extend(row) %}\n {% endfor %}\n\n {% set sql %}\n insert into {{ this.render() }} ({{ cols_sql }}) values\n {% for row in chunk -%}\n ({%- for column in agate_table.column_names -%}\n {{ get_binding_char() }}\n {%- if not loop.last%},{%- endif %}\n {%- endfor -%})\n {%- if not loop.last%},{%- endif %}\n {%- endfor %}\n {% endset %}\n\n {% do adapter.add_query(sql, bindings=bindings, abridge_sql_log=True) %}\n\n {% if loop.index0 == 0 %}\n {% do statements.append(sql) %}\n {% endif %}\n {% endfor %}\n\n {# Return SQL so we can render it out into the compiled files #}\n {{ return(statements[0]) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_batch_size", "macro.dbt.get_seed_column_quoted_csv", "macro.dbt.get_binding_char"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.146574}, "macro.dbt.generate_alias_name": {"unique_id": "macro.dbt.generate_alias_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_alias.sql", "original_file_path": "macros/get_custom_name/get_custom_alias.sql", "name": "generate_alias_name", "macro_sql": "{% macro generate_alias_name(custom_alias_name=none, node=none) -%}\n {% do return(adapter.dispatch('generate_alias_name', 'dbt')(custom_alias_name, node)) %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__generate_alias_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1480231}, "macro.dbt.default__generate_alias_name": {"unique_id": "macro.dbt.default__generate_alias_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_alias.sql", "original_file_path": "macros/get_custom_name/get_custom_alias.sql", "name": "default__generate_alias_name", "macro_sql": "{% macro default__generate_alias_name(custom_alias_name=none, node=none) -%}\n\n {%- if custom_alias_name is none -%}\n\n {{ node.name }}\n\n {%- else -%}\n\n {{ custom_alias_name | trim }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.148864}, "macro.dbt.generate_schema_name": {"unique_id": "macro.dbt.generate_schema_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "name": "generate_schema_name", "macro_sql": "{% macro generate_schema_name(custom_schema_name=none, node=none) -%}\n {{ return(adapter.dispatch('generate_schema_name', 'dbt')(custom_schema_name, node)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__generate_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1508842}, "macro.dbt.default__generate_schema_name": {"unique_id": "macro.dbt.default__generate_schema_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "name": "default__generate_schema_name", "macro_sql": "{% macro default__generate_schema_name(custom_schema_name, node) -%}\n\n {%- set default_schema = target.schema -%}\n {%- if custom_schema_name is none -%}\n\n {{ default_schema }}\n\n {%- else -%}\n\n {{ default_schema }}_{{ custom_schema_name | trim }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.151943}, "macro.dbt.generate_schema_name_for_env": {"unique_id": "macro.dbt.generate_schema_name_for_env", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "name": "generate_schema_name_for_env", "macro_sql": "{% macro generate_schema_name_for_env(custom_schema_name, node) -%}\n\n {%- set default_schema = target.schema -%}\n {%- if target.name == 'prod' and custom_schema_name is not none -%}\n\n {{ custom_schema_name | trim }}\n\n {%- else -%}\n\n {{ default_schema }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.153335}, "macro.dbt.generate_database_name": {"unique_id": "macro.dbt.generate_database_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_database.sql", "original_file_path": "macros/get_custom_name/get_custom_database.sql", "name": "generate_database_name", "macro_sql": "{% macro generate_database_name(custom_database_name=none, node=none) -%}\n {% do return(adapter.dispatch('generate_database_name', 'dbt')(custom_database_name, node)) %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__generate_database_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.154808}, "macro.dbt.default__generate_database_name": {"unique_id": "macro.dbt.default__generate_database_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_database.sql", "original_file_path": "macros/get_custom_name/get_custom_database.sql", "name": "default__generate_database_name", "macro_sql": "{% macro default__generate_database_name(custom_database_name=none, node=none) -%}\n {%- set default_database = target.database -%}\n {%- if custom_database_name is none -%}\n\n {{ default_database }}\n\n {%- else -%}\n\n {{ custom_database_name }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1555278}, "macro.dbt.default__test_relationships": {"unique_id": "macro.dbt.default__test_relationships", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/generic_test_sql/relationships.sql", "original_file_path": "macros/generic_test_sql/relationships.sql", "name": "default__test_relationships", "macro_sql": "{% macro default__test_relationships(model, column_name, to, field) %}\n\nwith child as (\n select {{ column_name }} as from_field\n from {{ model }}\n where {{ column_name }} is not null\n),\n\nparent as (\n select {{ field }} as to_field\n from {{ to }}\n)\n\nselect\n from_field\n\nfrom child\nleft join parent\n on child.from_field = parent.to_field\n\nwhere parent.to_field is null\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1565912}, "macro.dbt.default__test_not_null": {"unique_id": "macro.dbt.default__test_not_null", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/generic_test_sql/not_null.sql", "original_file_path": "macros/generic_test_sql/not_null.sql", "name": "default__test_not_null", "macro_sql": "{% macro default__test_not_null(model, column_name) %}\n\nselect *\nfrom {{ model }}\nwhere {{ column_name }} is null\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1572402}, "macro.dbt.default__test_unique": {"unique_id": "macro.dbt.default__test_unique", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/generic_test_sql/unique.sql", "original_file_path": "macros/generic_test_sql/unique.sql", "name": "default__test_unique", "macro_sql": "{% macro default__test_unique(model, column_name) %}\n\nselect\n {{ column_name }} as unique_field,\n count(*) as n_records\n\nfrom {{ model }}\nwhere {{ column_name }} is not null\ngroup by {{ column_name }}\nhaving count(*) > 1\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.158035}, "macro.dbt.default__test_accepted_values": {"unique_id": "macro.dbt.default__test_accepted_values", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/generic_test_sql/accepted_values.sql", "original_file_path": "macros/generic_test_sql/accepted_values.sql", "name": "default__test_accepted_values", "macro_sql": "{% macro default__test_accepted_values(model, column_name, values, quote=True) %}\n\nwith all_values as (\n\n select\n {{ column_name }} as value_field,\n count(*) as n_records\n\n from {{ model }}\n group by {{ column_name }}\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n {% for value in values -%}\n {% if quote -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {%- endfor %}\n)\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.159806}, "macro.dbt.statement": {"unique_id": "macro.dbt.statement", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "name": "statement", "macro_sql": "{% macro statement(name=None, fetch_result=False, auto_begin=True) -%}\n {%- if execute: -%}\n {%- set sql = caller() -%}\n\n {%- if name == 'main' -%}\n {{ log('Writing runtime SQL for node \"{}\"'.format(model['unique_id'])) }}\n {{ write(sql) }}\n {%- endif -%}\n\n {%- set res, table = adapter.execute(sql, auto_begin=auto_begin, fetch=fetch_result) -%}\n {%- if name is not none -%}\n {{ store_result(name, response=res, agate_table=table) }}\n {%- endif -%}\n\n {%- endif -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.163162}, "macro.dbt.noop_statement": {"unique_id": "macro.dbt.noop_statement", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "name": "noop_statement", "macro_sql": "{% macro noop_statement(name=None, message=None, code=None, rows_affected=None, res=None) -%}\n {%- set sql = caller() -%}\n\n {%- if name == 'main' -%}\n {{ log('Writing runtime SQL for node \"{}\"'.format(model['unique_id'])) }}\n {{ write(sql) }}\n {%- endif -%}\n\n {%- if name is not none -%}\n {{ store_raw_result(name, message=message, code=code, rows_affected=rows_affected, agate_table=res) }}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.164746}, "macro.dbt.run_query": {"unique_id": "macro.dbt.run_query", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "name": "run_query", "macro_sql": "{% macro run_query(sql) %}\n {% call statement(\"run_query_statement\", fetch_result=true, auto_begin=false) %}\n {{ sql }}\n {% endcall %}\n\n {% do return(load_result(\"run_query_statement\").table) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.165555}, "macro.dbt.convert_datetime": {"unique_id": "macro.dbt.convert_datetime", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "convert_datetime", "macro_sql": "{% macro convert_datetime(date_str, date_fmt) %}\n\n {% set error_msg -%}\n The provided partition date '{{ date_str }}' does not match the expected format '{{ date_fmt }}'\n {%- endset %}\n\n {% set res = try_or_compiler_error(error_msg, modules.datetime.datetime.strptime, date_str.strip(), date_fmt) %}\n {{ return(res) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.170479}, "macro.dbt.dates_in_range": {"unique_id": "macro.dbt.dates_in_range", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "dates_in_range", "macro_sql": "{% macro dates_in_range(start_date_str, end_date_str=none, in_fmt=\"%Y%m%d\", out_fmt=\"%Y%m%d\") %}\n {% set end_date_str = start_date_str if end_date_str is none else end_date_str %}\n\n {% set start_date = convert_datetime(start_date_str, in_fmt) %}\n {% set end_date = convert_datetime(end_date_str, in_fmt) %}\n\n {% set day_count = (end_date - start_date).days %}\n {% if day_count < 0 %}\n {% set msg -%}\n Partiton start date is after the end date ({{ start_date }}, {{ end_date }})\n {%- endset %}\n\n {{ exceptions.raise_compiler_error(msg, model) }}\n {% endif %}\n\n {% set date_list = [] %}\n {% for i in range(0, day_count + 1) %}\n {% set the_date = (modules.datetime.timedelta(days=i) + start_date) %}\n {% if not out_fmt %}\n {% set _ = date_list.append(the_date) %}\n {% else %}\n {% set _ = date_list.append(the_date.strftime(out_fmt)) %}\n {% endif %}\n {% endfor %}\n\n {{ return(date_list) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.convert_datetime"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1739562}, "macro.dbt.partition_range": {"unique_id": "macro.dbt.partition_range", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "partition_range", "macro_sql": "{% macro partition_range(raw_partition_date, date_fmt='%Y%m%d') %}\n {% set partition_range = (raw_partition_date | string).split(\",\") %}\n\n {% if (partition_range | length) == 1 %}\n {% set start_date = partition_range[0] %}\n {% set end_date = none %}\n {% elif (partition_range | length) == 2 %}\n {% set start_date = partition_range[0] %}\n {% set end_date = partition_range[1] %}\n {% else %}\n {{ exceptions.raise_compiler_error(\"Invalid partition time. Expected format: {Start Date}[,{End Date}]. Got: \" ~ raw_partition_date) }}\n {% endif %}\n\n {{ return(dates_in_range(start_date, end_date, in_fmt=date_fmt)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.dates_in_range"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1761699}, "macro.dbt.py_current_timestring": {"unique_id": "macro.dbt.py_current_timestring", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "py_current_timestring", "macro_sql": "{% macro py_current_timestring() %}\n {% set dt = modules.datetime.datetime.now() %}\n {% do return(dt.strftime(\"%Y%m%d%H%M%S%f\")) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.176838}, "macro.dbt.create_schema": {"unique_id": "macro.dbt.create_schema", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "name": "create_schema", "macro_sql": "{% macro create_schema(relation) -%}\n {{ adapter.dispatch('create_schema', 'dbt')(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_schema"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1780841}, "macro.dbt.default__create_schema": {"unique_id": "macro.dbt.default__create_schema", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "name": "default__create_schema", "macro_sql": "{% macro default__create_schema(relation) -%}\n {%- call statement('create_schema') -%}\n create schema if not exists {{ relation.without_identifier() }}\n {% endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.178663}, "macro.dbt.drop_schema": {"unique_id": "macro.dbt.drop_schema", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "name": "drop_schema", "macro_sql": "{% macro drop_schema(relation) -%}\n {{ adapter.dispatch('drop_schema', 'dbt')(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__drop_schema"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1791282}, "macro.dbt.default__drop_schema": {"unique_id": "macro.dbt.default__drop_schema", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "name": "default__drop_schema", "macro_sql": "{% macro default__drop_schema(relation) -%}\n {%- call statement('drop_schema') -%}\n drop schema if exists {{ relation.without_identifier() }} cascade\n {% endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.179646}, "macro.dbt.get_create_index_sql": {"unique_id": "macro.dbt.get_create_index_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "name": "get_create_index_sql", "macro_sql": "{% macro get_create_index_sql(relation, index_dict) -%}\n {{ return(adapter.dispatch('get_create_index_sql', 'dbt')(relation, index_dict)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_create_index_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.180919}, "macro.dbt.default__get_create_index_sql": {"unique_id": "macro.dbt.default__get_create_index_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "name": "default__get_create_index_sql", "macro_sql": "{% macro default__get_create_index_sql(relation, index_dict) -%}\n {% do return(None) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1813078}, "macro.dbt.create_indexes": {"unique_id": "macro.dbt.create_indexes", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "name": "create_indexes", "macro_sql": "{% macro create_indexes(relation) -%}\n {{ adapter.dispatch('create_indexes', 'dbt')(relation) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.181806}, "macro.dbt.default__create_indexes": {"unique_id": "macro.dbt.default__create_indexes", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "name": "default__create_indexes", "macro_sql": "{% macro default__create_indexes(relation) -%}\n {%- set _indexes = config.get('indexes', default=[]) -%}\n\n {% for _index_dict in _indexes %}\n {% set create_index_sql = get_create_index_sql(relation, _index_dict) %}\n {% if create_index_sql %}\n {% do run_query(create_index_sql) %}\n {% endif %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_create_index_sql", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.18291}, "macro.dbt.make_temp_relation": {"unique_id": "macro.dbt.make_temp_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "make_temp_relation", "macro_sql": "{% macro make_temp_relation(base_relation, suffix='__dbt_tmp') %}\n {{ return(adapter.dispatch('make_temp_relation', 'dbt')(base_relation, suffix))}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__make_temp_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.186929}, "macro.dbt.default__make_temp_relation": {"unique_id": "macro.dbt.default__make_temp_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__make_temp_relation", "macro_sql": "{% macro default__make_temp_relation(base_relation, suffix) %}\n {% set tmp_identifier = base_relation.identifier ~ suffix %}\n {% set tmp_relation = base_relation.incorporate(\n path={\"identifier\": tmp_identifier}) -%}\n\n {% do return(tmp_relation) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1879108}, "macro.dbt.drop_relation": {"unique_id": "macro.dbt.drop_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "drop_relation", "macro_sql": "{% macro drop_relation(relation) -%}\n {{ return(adapter.dispatch('drop_relation', 'dbt')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__drop_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.188538}, "macro.dbt.default__drop_relation": {"unique_id": "macro.dbt.default__drop_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__drop_relation", "macro_sql": "{% macro default__drop_relation(relation) -%}\n {% call statement('drop_relation', auto_begin=False) -%}\n drop {{ relation.type }} if exists {{ relation }} cascade\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.18919}, "macro.dbt.truncate_relation": {"unique_id": "macro.dbt.truncate_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "truncate_relation", "macro_sql": "{% macro truncate_relation(relation) -%}\n {{ return(adapter.dispatch('truncate_relation', 'dbt')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__truncate_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.189704}, "macro.dbt.default__truncate_relation": {"unique_id": "macro.dbt.default__truncate_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__truncate_relation", "macro_sql": "{% macro default__truncate_relation(relation) -%}\n {% call statement('truncate_relation') -%}\n truncate table {{ relation }}\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.190154}, "macro.dbt.rename_relation": {"unique_id": "macro.dbt.rename_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "rename_relation", "macro_sql": "{% macro rename_relation(from_relation, to_relation) -%}\n {{ return(adapter.dispatch('rename_relation', 'dbt')(from_relation, to_relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__rename_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.190877}, "macro.dbt.default__rename_relation": {"unique_id": "macro.dbt.default__rename_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__rename_relation", "macro_sql": "{% macro default__rename_relation(from_relation, to_relation) -%}\n {% set target_name = adapter.quote_as_configured(to_relation.identifier, 'identifier') %}\n {% call statement('rename_relation') -%}\n alter table {{ from_relation }} rename to {{ target_name }}\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.191663}, "macro.dbt.get_or_create_relation": {"unique_id": "macro.dbt.get_or_create_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "get_or_create_relation", "macro_sql": "{% macro get_or_create_relation(database, schema, identifier, type) -%}\n {{ return(adapter.dispatch('get_or_create_relation', 'dbt')(database, schema, identifier, type)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_or_create_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.192343}, "macro.dbt.default__get_or_create_relation": {"unique_id": "macro.dbt.default__get_or_create_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__get_or_create_relation", "macro_sql": "{% macro default__get_or_create_relation(database, schema, identifier, type) %}\n {%- set target_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n\n {% if target_relation %}\n {% do return([true, target_relation]) %}\n {% endif %}\n\n {%- set new_relation = api.Relation.create(\n database=database,\n schema=schema,\n identifier=identifier,\n type=type\n ) -%}\n {% do return([false, new_relation]) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.193886}, "macro.dbt.load_relation": {"unique_id": "macro.dbt.load_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "load_relation", "macro_sql": "{% macro load_relation(relation) %}\n {% do return(adapter.get_relation(\n database=relation.database,\n schema=relation.schema,\n identifier=relation.identifier\n )) -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.194604}, "macro.dbt.drop_relation_if_exists": {"unique_id": "macro.dbt.drop_relation_if_exists", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "drop_relation_if_exists", "macro_sql": "{% macro drop_relation_if_exists(relation) %}\n {% if relation is not none %}\n {{ adapter.drop_relation(relation) }}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.195245}, "macro.dbt.current_timestamp": {"unique_id": "macro.dbt.current_timestamp", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "name": "current_timestamp", "macro_sql": "{% macro current_timestamp() -%}\n {{ adapter.dispatch('current_timestamp', 'dbt')() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1965382}, "macro.dbt.default__current_timestamp": {"unique_id": "macro.dbt.default__current_timestamp", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "name": "default__current_timestamp", "macro_sql": "{% macro default__current_timestamp() -%}\n {{ exceptions.raise_not_implemented(\n 'current_timestamp macro not implemented for adapter '+adapter.type()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1969368}, "macro.dbt.collect_freshness": {"unique_id": "macro.dbt.collect_freshness", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "name": "collect_freshness", "macro_sql": "{% macro collect_freshness(source, loaded_at_field, filter) %}\n {{ return(adapter.dispatch('collect_freshness', 'dbt')(source, loaded_at_field, filter))}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__collect_freshness"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.1975539}, "macro.dbt.default__collect_freshness": {"unique_id": "macro.dbt.default__collect_freshness", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "name": "default__collect_freshness", "macro_sql": "{% macro default__collect_freshness(source, loaded_at_field, filter) %}\n {% call statement('collect_freshness', fetch_result=True, auto_begin=False) -%}\n select\n max({{ loaded_at_field }}) as max_loaded_at,\n {{ current_timestamp() }} as snapshotted_at\n from {{ source }}\n {% if filter %}\n where {{ filter }}\n {% endif %}\n {% endcall %}\n {{ return(load_result('collect_freshness').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.198721}, "macro.dbt.alter_column_comment": {"unique_id": "macro.dbt.alter_column_comment", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "alter_column_comment", "macro_sql": "{% macro alter_column_comment(relation, column_dict) -%}\n {{ return(adapter.dispatch('alter_column_comment', 'dbt')(relation, column_dict)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.201047}, "macro.dbt.default__alter_column_comment": {"unique_id": "macro.dbt.default__alter_column_comment", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "default__alter_column_comment", "macro_sql": "{% macro default__alter_column_comment(relation, column_dict) -%}\n {{ exceptions.raise_not_implemented(\n 'alter_column_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2015061}, "macro.dbt.alter_relation_comment": {"unique_id": "macro.dbt.alter_relation_comment", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "alter_relation_comment", "macro_sql": "{% macro alter_relation_comment(relation, relation_comment) -%}\n {{ return(adapter.dispatch('alter_relation_comment', 'dbt')(relation, relation_comment)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__alter_relation_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.202059}, "macro.dbt.default__alter_relation_comment": {"unique_id": "macro.dbt.default__alter_relation_comment", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "default__alter_relation_comment", "macro_sql": "{% macro default__alter_relation_comment(relation, relation_comment) -%}\n {{ exceptions.raise_not_implemented(\n 'alter_relation_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.202517}, "macro.dbt.persist_docs": {"unique_id": "macro.dbt.persist_docs", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "persist_docs", "macro_sql": "{% macro persist_docs(relation, model, for_relation=true, for_columns=true) -%}\n {{ return(adapter.dispatch('persist_docs', 'dbt')(relation, model, for_relation, for_columns)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.203237}, "macro.dbt.default__persist_docs": {"unique_id": "macro.dbt.default__persist_docs", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "default__persist_docs", "macro_sql": "{% macro default__persist_docs(relation, model, for_relation, for_columns) -%}\n {% if for_relation and config.persist_relation_docs() and model.description %}\n {% do run_query(alter_relation_comment(relation, model.description)) %}\n {% endif %}\n\n {% if for_columns and config.persist_column_docs() and model.columns %}\n {% do run_query(alter_column_comment(relation, model.columns)) %}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query", "macro.dbt.alter_relation_comment", "macro.dbt.alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.204733}, "macro.dbt.get_catalog": {"unique_id": "macro.dbt.get_catalog", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "get_catalog", "macro_sql": "{% macro get_catalog(information_schema, schemas) -%}\n {{ return(adapter.dispatch('get_catalog', 'dbt')(information_schema, schemas)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_catalog"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.207857}, "macro.dbt.default__get_catalog": {"unique_id": "macro.dbt.default__get_catalog", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__get_catalog", "macro_sql": "{% macro default__get_catalog(information_schema, schemas) -%}\n\n {% set typename = adapter.type() %}\n {% set msg -%}\n get_catalog not implemented for {{ typename }}\n {%- endset %}\n\n {{ exceptions.raise_compiler_error(msg) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2086048}, "macro.dbt.information_schema_name": {"unique_id": "macro.dbt.information_schema_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "information_schema_name", "macro_sql": "{% macro information_schema_name(database) %}\n {{ return(adapter.dispatch('information_schema_name', 'dbt')(database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__information_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.209265}, "macro.dbt.default__information_schema_name": {"unique_id": "macro.dbt.default__information_schema_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__information_schema_name", "macro_sql": "{% macro default__information_schema_name(database) -%}\n {%- if database -%}\n {{ database }}.INFORMATION_SCHEMA\n {%- else -%}\n INFORMATION_SCHEMA\n {%- endif -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2097259}, "macro.dbt.list_schemas": {"unique_id": "macro.dbt.list_schemas", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "list_schemas", "macro_sql": "{% macro list_schemas(database) -%}\n {{ return(adapter.dispatch('list_schemas', 'dbt')(database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__list_schemas"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.210232}, "macro.dbt.default__list_schemas": {"unique_id": "macro.dbt.default__list_schemas", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__list_schemas", "macro_sql": "{% macro default__list_schemas(database) -%}\n {% set sql %}\n select distinct schema_name\n from {{ information_schema_name(database) }}.SCHEMATA\n where catalog_name ilike '{{ database }}'\n {% endset %}\n {{ return(run_query(sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.information_schema_name", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.210912}, "macro.dbt.check_schema_exists": {"unique_id": "macro.dbt.check_schema_exists", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "check_schema_exists", "macro_sql": "{% macro check_schema_exists(information_schema, schema) -%}\n {{ return(adapter.dispatch('check_schema_exists', 'dbt')(information_schema, schema)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__check_schema_exists"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.214667}, "macro.dbt.default__check_schema_exists": {"unique_id": "macro.dbt.default__check_schema_exists", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__check_schema_exists", "macro_sql": "{% macro default__check_schema_exists(information_schema, schema) -%}\n {% set sql -%}\n select count(*)\n from {{ information_schema.replace(information_schema_view='SCHEMATA') }}\n where catalog_name='{{ information_schema.database }}'\n and schema_name='{{ schema }}'\n {%- endset %}\n {{ return(run_query(sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.replace", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.215689}, "macro.dbt.list_relations_without_caching": {"unique_id": "macro.dbt.list_relations_without_caching", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "list_relations_without_caching", "macro_sql": "{% macro list_relations_without_caching(schema_relation) %}\n {{ return(adapter.dispatch('list_relations_without_caching', 'dbt')(schema_relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__list_relations_without_caching"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2162979}, "macro.dbt.default__list_relations_without_caching": {"unique_id": "macro.dbt.default__list_relations_without_caching", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__list_relations_without_caching", "macro_sql": "{% macro default__list_relations_without_caching(schema_relation) %}\n {{ exceptions.raise_not_implemented(\n 'list_relations_without_caching macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.216931}, "macro.dbt.get_columns_in_relation": {"unique_id": "macro.dbt.get_columns_in_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "get_columns_in_relation", "macro_sql": "{% macro get_columns_in_relation(relation) -%}\n {{ return(adapter.dispatch('get_columns_in_relation', 'dbt')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2208571}, "macro.dbt.default__get_columns_in_relation": {"unique_id": "macro.dbt.default__get_columns_in_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "default__get_columns_in_relation", "macro_sql": "{% macro default__get_columns_in_relation(relation) -%}\n {{ exceptions.raise_not_implemented(\n 'get_columns_in_relation macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.221295}, "macro.dbt.sql_convert_columns_in_relation": {"unique_id": "macro.dbt.sql_convert_columns_in_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "sql_convert_columns_in_relation", "macro_sql": "{% macro sql_convert_columns_in_relation(table) -%}\n {% set columns = [] %}\n {% for row in table %}\n {% do columns.append(api.Column(*row)) %}\n {% endfor %}\n {{ return(columns) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.222147}, "macro.dbt.get_columns_in_query": {"unique_id": "macro.dbt.get_columns_in_query", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "get_columns_in_query", "macro_sql": "{% macro get_columns_in_query(select_sql) -%}\n {{ return(adapter.dispatch('get_columns_in_query', 'dbt')(select_sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.22265}, "macro.dbt.default__get_columns_in_query": {"unique_id": "macro.dbt.default__get_columns_in_query", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "default__get_columns_in_query", "macro_sql": "{% macro default__get_columns_in_query(select_sql) %}\n {% call statement('get_columns_in_query', fetch_result=True, auto_begin=False) -%}\n select * from (\n {{ select_sql }}\n ) as __dbt_sbq\n where false\n limit 0\n {% endcall %}\n\n {{ return(load_result('get_columns_in_query').table.columns | map(attribute='name') | list) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.223556}, "macro.dbt.alter_column_type": {"unique_id": "macro.dbt.alter_column_type", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "alter_column_type", "macro_sql": "{% macro alter_column_type(relation, column_name, new_column_type) -%}\n {{ return(adapter.dispatch('alter_column_type', 'dbt')(relation, column_name, new_column_type)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2241752}, "macro.dbt.default__alter_column_type": {"unique_id": "macro.dbt.default__alter_column_type", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "default__alter_column_type", "macro_sql": "{% macro default__alter_column_type(relation, column_name, new_column_type) -%}\n {#\n 1. Create a new column (w/ temp name and correct type)\n 2. Copy data over to it\n 3. Drop the existing column (cascade!)\n 4. Rename the new column to existing column\n #}\n {%- set tmp_column = column_name + \"__dbt_alter\" -%}\n\n {% call statement('alter_column_type') %}\n alter table {{ relation }} add column {{ adapter.quote(tmp_column) }} {{ new_column_type }};\n update {{ relation }} set {{ adapter.quote(tmp_column) }} = {{ adapter.quote(column_name) }};\n alter table {{ relation }} drop column {{ adapter.quote(column_name) }} cascade;\n alter table {{ relation }} rename column {{ adapter.quote(tmp_column) }} to {{ adapter.quote(column_name) }}\n {% endcall %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2257988}, "macro.dbt.alter_relation_add_remove_columns": {"unique_id": "macro.dbt.alter_relation_add_remove_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "alter_relation_add_remove_columns", "macro_sql": "{% macro alter_relation_add_remove_columns(relation, add_columns = none, remove_columns = none) -%}\n {{ return(adapter.dispatch('alter_relation_add_remove_columns', 'dbt')(relation, add_columns, remove_columns)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__alter_relation_add_remove_columns"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.226581}, "macro.dbt.default__alter_relation_add_remove_columns": {"unique_id": "macro.dbt.default__alter_relation_add_remove_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "default__alter_relation_add_remove_columns", "macro_sql": "{% macro default__alter_relation_add_remove_columns(relation, add_columns, remove_columns) %}\n \n {% if add_columns is none %}\n {% set add_columns = [] %}\n {% endif %}\n {% if remove_columns is none %}\n {% set remove_columns = [] %}\n {% endif %}\n \n {% set sql -%}\n \n alter {{ relation.type }} {{ relation }}\n \n {% for column in add_columns %}\n add column {{ column.name }} {{ column.data_type }}{{ ',' if not loop.last }}\n {% endfor %}{{ ',' if add_columns and remove_columns }}\n \n {% for column in remove_columns %}\n drop column {{ column.name }}{{ ',' if not loop.last }}\n {% endfor %}\n \n {%- endset -%}\n\n {% do run_query(sql) %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.22914}, "macro.dbt.test_unique": {"unique_id": "macro.dbt.test_unique", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "name": "test_unique", "macro_sql": "{% test unique(model, column_name) %}\n {% set macro = adapter.dispatch('test_unique', 'dbt') %}\n {{ macro(model, column_name) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__test_unique"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2307148}, "macro.dbt.test_not_null": {"unique_id": "macro.dbt.test_not_null", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "name": "test_not_null", "macro_sql": "{% test not_null(model, column_name) %}\n {% set macro = adapter.dispatch('test_not_null', 'dbt') %}\n {{ macro(model, column_name) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__test_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.231359}, "macro.dbt.test_accepted_values": {"unique_id": "macro.dbt.test_accepted_values", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "name": "test_accepted_values", "macro_sql": "{% test accepted_values(model, column_name, values, quote=True) %}\n {% set macro = adapter.dispatch('test_accepted_values', 'dbt') %}\n {{ macro(model, column_name, values, quote) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__test_accepted_values"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.232146}, "macro.dbt.test_relationships": {"unique_id": "macro.dbt.test_relationships", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "name": "test_relationships", "macro_sql": "{% test relationships(model, column_name, to, field) %}\n {% set macro = adapter.dispatch('test_relationships', 'dbt') %}\n {{ macro(model, column_name, to, field) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__test_relationships"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2329001}, "macro.dbt_utils.except": {"unique_id": "macro.dbt_utils.except", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/except.sql", "original_file_path": "macros/cross_db_utils/except.sql", "name": "except", "macro_sql": "{% macro except() %}\n {{ return(adapter.dispatch('except', 'dbt_utils')()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__except"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2338188}, "macro.dbt_utils.default__except": {"unique_id": "macro.dbt_utils.default__except", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/except.sql", "original_file_path": "macros/cross_db_utils/except.sql", "name": "default__except", "macro_sql": "{% macro default__except() %}\n\n except\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.234048}, "macro.dbt_utils.bigquery__except": {"unique_id": "macro.dbt_utils.bigquery__except", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/except.sql", "original_file_path": "macros/cross_db_utils/except.sql", "name": "bigquery__except", "macro_sql": "{% macro bigquery__except() %}\n\n except distinct\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.234376}, "macro.dbt_utils.replace": {"unique_id": "macro.dbt_utils.replace", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/replace.sql", "original_file_path": "macros/cross_db_utils/replace.sql", "name": "replace", "macro_sql": "{% macro replace(field, old_chars, new_chars) -%}\n {{ return(adapter.dispatch('replace', 'dbt_utils') (field, old_chars, new_chars)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__replace"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.235466}, "macro.dbt_utils.default__replace": {"unique_id": "macro.dbt_utils.default__replace", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/replace.sql", "original_file_path": "macros/cross_db_utils/replace.sql", "name": "default__replace", "macro_sql": "{% macro default__replace(field, old_chars, new_chars) %}\n\n replace(\n {{ field }},\n {{ old_chars }},\n {{ new_chars }}\n )\n \n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.235924}, "macro.dbt_utils.concat": {"unique_id": "macro.dbt_utils.concat", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/concat.sql", "original_file_path": "macros/cross_db_utils/concat.sql", "name": "concat", "macro_sql": "{% macro concat(fields) -%}\n {{ return(adapter.dispatch('concat', 'dbt_utils')(fields)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__concat"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.23674}, "macro.dbt_utils.default__concat": {"unique_id": "macro.dbt_utils.default__concat", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/concat.sql", "original_file_path": "macros/cross_db_utils/concat.sql", "name": "default__concat", "macro_sql": "{% macro default__concat(fields) -%}\n {{ fields|join(' || ') }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.237141}, "macro.dbt_utils.type_string": {"unique_id": "macro.dbt_utils.type_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_string", "macro_sql": "\n\n{%- macro type_string() -%}\n {{ return(adapter.dispatch('type_string', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.238854}, "macro.dbt_utils.default__type_string": {"unique_id": "macro.dbt_utils.default__type_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_string", "macro_sql": "{% macro default__type_string() %}\n string\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.239648}, "macro.dbt_utils.redshift__type_string": {"unique_id": "macro.dbt_utils.redshift__type_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "redshift__type_string", "macro_sql": "\n\n{%- macro redshift__type_string() -%}\n varchar\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.239873}, "macro.dbt_utils.postgres__type_string": {"unique_id": "macro.dbt_utils.postgres__type_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "postgres__type_string", "macro_sql": "{% macro postgres__type_string() %}\n varchar\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.240088}, "macro.dbt_utils.snowflake__type_string": {"unique_id": "macro.dbt_utils.snowflake__type_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "snowflake__type_string", "macro_sql": "{% macro snowflake__type_string() %}\n varchar\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2403011}, "macro.dbt_utils.type_timestamp": {"unique_id": "macro.dbt_utils.type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_timestamp", "macro_sql": "\n\n{%- macro type_timestamp() -%}\n {{ return(adapter.dispatch('type_timestamp', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2408829}, "macro.dbt_utils.default__type_timestamp": {"unique_id": "macro.dbt_utils.default__type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_timestamp", "macro_sql": "{% macro default__type_timestamp() %}\n timestamp\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.241138}, "macro.dbt_utils.postgres__type_timestamp": {"unique_id": "macro.dbt_utils.postgres__type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "postgres__type_timestamp", "macro_sql": "{% macro postgres__type_timestamp() %}\n timestamp without time zone\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.241351}, "macro.dbt_utils.snowflake__type_timestamp": {"unique_id": "macro.dbt_utils.snowflake__type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "snowflake__type_timestamp", "macro_sql": "{% macro snowflake__type_timestamp() %}\n timestamp_ntz\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2415512}, "macro.dbt_utils.type_float": {"unique_id": "macro.dbt_utils.type_float", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_float", "macro_sql": "\n\n{%- macro type_float() -%}\n {{ return(adapter.dispatch('type_float', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__type_float"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.241982}, "macro.dbt_utils.default__type_float": {"unique_id": "macro.dbt_utils.default__type_float", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_float", "macro_sql": "{% macro default__type_float() %}\n float\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.242558}, "macro.dbt_utils.bigquery__type_float": {"unique_id": "macro.dbt_utils.bigquery__type_float", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_float", "macro_sql": "{% macro bigquery__type_float() %}\n float64\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.242769}, "macro.dbt_utils.type_numeric": {"unique_id": "macro.dbt_utils.type_numeric", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_numeric", "macro_sql": "\n\n{%- macro type_numeric() -%}\n {{ return(adapter.dispatch('type_numeric', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.243262}, "macro.dbt_utils.default__type_numeric": {"unique_id": "macro.dbt_utils.default__type_numeric", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_numeric", "macro_sql": "{% macro default__type_numeric() %}\n numeric(28, 6)\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.243488}, "macro.dbt_utils.bigquery__type_numeric": {"unique_id": "macro.dbt_utils.bigquery__type_numeric", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_numeric", "macro_sql": "{% macro bigquery__type_numeric() %}\n numeric\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.243692}, "macro.dbt_utils.type_bigint": {"unique_id": "macro.dbt_utils.type_bigint", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_bigint", "macro_sql": "\n\n{%- macro type_bigint() -%}\n {{ return(adapter.dispatch('type_bigint', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.244132}, "macro.dbt_utils.default__type_bigint": {"unique_id": "macro.dbt_utils.default__type_bigint", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_bigint", "macro_sql": "{% macro default__type_bigint() %}\n bigint\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.24434}, "macro.dbt_utils.bigquery__type_bigint": {"unique_id": "macro.dbt_utils.bigquery__type_bigint", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_bigint", "macro_sql": "{% macro bigquery__type_bigint() %}\n int64\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.244541}, "macro.dbt_utils.type_int": {"unique_id": "macro.dbt_utils.type_int", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_int", "macro_sql": "\n\n{%- macro type_int() -%}\n {{ return(adapter.dispatch('type_int', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__type_int"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.244976}, "macro.dbt_utils.default__type_int": {"unique_id": "macro.dbt_utils.default__type_int", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_int", "macro_sql": "{% macro default__type_int() %}\n int\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.245183}, "macro.dbt_utils.bigquery__type_int": {"unique_id": "macro.dbt_utils.bigquery__type_int", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_int", "macro_sql": "{% macro bigquery__type_int() %}\n int64\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.245385}, "macro.dbt_utils._is_relation": {"unique_id": "macro.dbt_utils._is_relation", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/_is_relation.sql", "original_file_path": "macros/cross_db_utils/_is_relation.sql", "name": "_is_relation", "macro_sql": "{% macro _is_relation(obj, macro) %}\n {%- if not (obj is mapping and obj.get('metadata', {}).get('type', '').endswith('Relation')) -%}\n {%- do exceptions.raise_compiler_error(\"Macro \" ~ macro ~ \" expected a Relation but received the value: \" ~ obj) -%}\n {%- endif -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.24677}, "macro.dbt_utils.cast_array_to_string": {"unique_id": "macro.dbt_utils.cast_array_to_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_array_to_string.sql", "original_file_path": "macros/cross_db_utils/cast_array_to_string.sql", "name": "cast_array_to_string", "macro_sql": "{% macro cast_array_to_string(array) %}\n {{ adapter.dispatch('cast_array_to_string', 'dbt_utils') (array) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__cast_array_to_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2479029}, "macro.dbt_utils.default__cast_array_to_string": {"unique_id": "macro.dbt_utils.default__cast_array_to_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_array_to_string.sql", "original_file_path": "macros/cross_db_utils/cast_array_to_string.sql", "name": "default__cast_array_to_string", "macro_sql": "{% macro default__cast_array_to_string(array) %}\n cast({{ array }} as {{ dbt_utils.type_string() }})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2483032}, "macro.dbt_utils.postgres__cast_array_to_string": {"unique_id": "macro.dbt_utils.postgres__cast_array_to_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_array_to_string.sql", "original_file_path": "macros/cross_db_utils/cast_array_to_string.sql", "name": "postgres__cast_array_to_string", "macro_sql": "{% macro postgres__cast_array_to_string(array) %}\n {%- set array_as_string -%}cast({{ array }} as {{ dbt_utils.type_string() }}){%- endset -%}\n {{ dbt_utils.replace(dbt_utils.replace(array_as_string,\"'}'\",\"']'\"),\"'{'\",\"'['\") }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string", "macro.dbt_utils.replace"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.249293}, "macro.dbt_utils.redshift__cast_array_to_string": {"unique_id": "macro.dbt_utils.redshift__cast_array_to_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_array_to_string.sql", "original_file_path": "macros/cross_db_utils/cast_array_to_string.sql", "name": "redshift__cast_array_to_string", "macro_sql": "{% macro redshift__cast_array_to_string(array) %}\n cast({{ array }} as {{ dbt_utils.type_string() }})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2496908}, "macro.dbt_utils.bigquery__cast_array_to_string": {"unique_id": "macro.dbt_utils.bigquery__cast_array_to_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_array_to_string.sql", "original_file_path": "macros/cross_db_utils/cast_array_to_string.sql", "name": "bigquery__cast_array_to_string", "macro_sql": "{% macro bigquery__cast_array_to_string(array) %}\n '['||(select string_agg(cast(element as string), ',') from unnest({{ array }}) element)||']'\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.249988}, "macro.dbt_utils.length": {"unique_id": "macro.dbt_utils.length", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/length.sql", "original_file_path": "macros/cross_db_utils/length.sql", "name": "length", "macro_sql": "{% macro length(expression) -%}\n {{ return(adapter.dispatch('length', 'dbt_utils') (expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__length"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.250944}, "macro.dbt_utils.default__length": {"unique_id": "macro.dbt_utils.default__length", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/length.sql", "original_file_path": "macros/cross_db_utils/length.sql", "name": "default__length", "macro_sql": "{% macro default__length(expression) %}\n \n length(\n {{ expression }}\n )\n \n{%- endmacro -%}\n\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2512589}, "macro.dbt_utils.redshift__length": {"unique_id": "macro.dbt_utils.redshift__length", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/length.sql", "original_file_path": "macros/cross_db_utils/length.sql", "name": "redshift__length", "macro_sql": "{% macro redshift__length(expression) %}\n\n len(\n {{ expression }}\n )\n \n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.251544}, "macro.dbt_utils.dateadd": {"unique_id": "macro.dbt_utils.dateadd", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "dateadd", "macro_sql": "{% macro dateadd(datepart, interval, from_date_or_timestamp) %}\n {{ return(adapter.dispatch('dateadd', 'dbt_utils')(datepart, interval, from_date_or_timestamp)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.252983}, "macro.dbt_utils.default__dateadd": {"unique_id": "macro.dbt_utils.default__dateadd", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "default__dateadd", "macro_sql": "{% macro default__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n dateadd(\n {{ datepart }},\n {{ interval }},\n {{ from_date_or_timestamp }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.253471}, "macro.dbt_utils.bigquery__dateadd": {"unique_id": "macro.dbt_utils.bigquery__dateadd", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "bigquery__dateadd", "macro_sql": "{% macro bigquery__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n datetime_add(\n cast( {{ from_date_or_timestamp }} as datetime),\n interval {{ interval }} {{ datepart }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.253951}, "macro.dbt_utils.postgres__dateadd": {"unique_id": "macro.dbt_utils.postgres__dateadd", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "postgres__dateadd", "macro_sql": "{% macro postgres__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n {{ from_date_or_timestamp }} + ((interval '1 {{ datepart }}') * ({{ interval }}))\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.254396}, "macro.dbt_utils.redshift__dateadd": {"unique_id": "macro.dbt_utils.redshift__dateadd", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "redshift__dateadd", "macro_sql": "{% macro redshift__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n {{ return(dbt_utils.default__dateadd(datepart, interval, from_date_or_timestamp)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.254923}, "macro.dbt_utils.intersect": {"unique_id": "macro.dbt_utils.intersect", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/intersect.sql", "original_file_path": "macros/cross_db_utils/intersect.sql", "name": "intersect", "macro_sql": "{% macro intersect() %}\n {{ return(adapter.dispatch('intersect', 'dbt_utils')()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__intersect"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.255754}, "macro.dbt_utils.default__intersect": {"unique_id": "macro.dbt_utils.default__intersect", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/intersect.sql", "original_file_path": "macros/cross_db_utils/intersect.sql", "name": "default__intersect", "macro_sql": "{% macro default__intersect() %}\n\n intersect\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.255967}, "macro.dbt_utils.bigquery__intersect": {"unique_id": "macro.dbt_utils.bigquery__intersect", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/intersect.sql", "original_file_path": "macros/cross_db_utils/intersect.sql", "name": "bigquery__intersect", "macro_sql": "{% macro bigquery__intersect() %}\n\n intersect distinct\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2561688}, "macro.dbt_utils.escape_single_quotes": {"unique_id": "macro.dbt_utils.escape_single_quotes", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/escape_single_quotes.sql", "original_file_path": "macros/cross_db_utils/escape_single_quotes.sql", "name": "escape_single_quotes", "macro_sql": "{% macro escape_single_quotes(expression) %}\n {{ return(adapter.dispatch('escape_single_quotes', 'dbt_utils') (expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__escape_single_quotes"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.261027}, "macro.dbt_utils.default__escape_single_quotes": {"unique_id": "macro.dbt_utils.default__escape_single_quotes", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/escape_single_quotes.sql", "original_file_path": "macros/cross_db_utils/escape_single_quotes.sql", "name": "default__escape_single_quotes", "macro_sql": "{% macro default__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\",\"''\") }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.261502}, "macro.dbt_utils.snowflake__escape_single_quotes": {"unique_id": "macro.dbt_utils.snowflake__escape_single_quotes", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/escape_single_quotes.sql", "original_file_path": "macros/cross_db_utils/escape_single_quotes.sql", "name": "snowflake__escape_single_quotes", "macro_sql": "{% macro snowflake__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\", \"\\\\'\") }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.262003}, "macro.dbt_utils.bigquery__escape_single_quotes": {"unique_id": "macro.dbt_utils.bigquery__escape_single_quotes", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/escape_single_quotes.sql", "original_file_path": "macros/cross_db_utils/escape_single_quotes.sql", "name": "bigquery__escape_single_quotes", "macro_sql": "{% macro bigquery__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\", \"\\\\'\") }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.26245}, "macro.dbt_utils.right": {"unique_id": "macro.dbt_utils.right", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "right", "macro_sql": "{% macro right(string_text, length_expression) -%}\n {{ return(adapter.dispatch('right', 'dbt_utils') (string_text, length_expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__right"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.263917}, "macro.dbt_utils.default__right": {"unique_id": "macro.dbt_utils.default__right", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "default__right", "macro_sql": "{% macro default__right(string_text, length_expression) %}\n\n right(\n {{ string_text }},\n {{ length_expression }}\n )\n \n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.264297}, "macro.dbt_utils.bigquery__right": {"unique_id": "macro.dbt_utils.bigquery__right", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "bigquery__right", "macro_sql": "{% macro bigquery__right(string_text, length_expression) %}\n\n case when {{ length_expression }} = 0 \n then ''\n else \n substr(\n {{ string_text }},\n -1 * ({{ length_expression }})\n )\n end\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.264728}, "macro.dbt_utils.snowflake__right": {"unique_id": "macro.dbt_utils.snowflake__right", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "snowflake__right", "macro_sql": "{% macro snowflake__right(string_text, length_expression) %}\n\n case when {{ length_expression }} = 0 \n then ''\n else \n right(\n {{ string_text }},\n {{ length_expression }}\n )\n end\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.265162}, "macro.dbt_utils.listagg": {"unique_id": "macro.dbt_utils.listagg", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/listagg.sql", "original_file_path": "macros/cross_db_utils/listagg.sql", "name": "listagg", "macro_sql": "{% macro listagg(measure, delimiter_text=\"','\", order_by_clause=none, limit_num=none) -%}\n {{ return(adapter.dispatch('listagg', 'dbt_utils') (measure, delimiter_text, order_by_clause, limit_num)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__listagg"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.27019}, "macro.dbt_utils.default__listagg": {"unique_id": "macro.dbt_utils.default__listagg", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/listagg.sql", "original_file_path": "macros/cross_db_utils/listagg.sql", "name": "default__listagg", "macro_sql": "{% macro default__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n\n {% if limit_num -%}\n array_to_string(\n array_slice(\n array_agg(\n {{ measure }}\n ){% if order_by_clause -%}\n within group ({{ order_by_clause }})\n {%- endif %}\n ,0\n ,{{ limit_num }}\n ),\n {{ delimiter_text }}\n )\n {%- else %}\n listagg(\n {{ measure }},\n {{ delimiter_text }}\n )\n {% if order_by_clause -%}\n within group ({{ order_by_clause }})\n {%- endif %}\n {%- endif %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.271602}, "macro.dbt_utils.bigquery__listagg": {"unique_id": "macro.dbt_utils.bigquery__listagg", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/listagg.sql", "original_file_path": "macros/cross_db_utils/listagg.sql", "name": "bigquery__listagg", "macro_sql": "{% macro bigquery__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n\n string_agg(\n {{ measure }},\n {{ delimiter_text }}\n {% if order_by_clause -%}\n {{ order_by_clause }}\n {%- endif %}\n {% if limit_num -%}\n limit {{ limit_num }}\n {%- endif %}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.272715}, "macro.dbt_utils.postgres__listagg": {"unique_id": "macro.dbt_utils.postgres__listagg", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/listagg.sql", "original_file_path": "macros/cross_db_utils/listagg.sql", "name": "postgres__listagg", "macro_sql": "{% macro postgres__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n \n {% if limit_num -%}\n array_to_string(\n (array_agg(\n {{ measure }}\n {% if order_by_clause -%}\n {{ order_by_clause }}\n {%- endif %}\n ))[1:{{ limit_num }}],\n {{ delimiter_text }}\n )\n {%- else %}\n string_agg(\n {{ measure }},\n {{ delimiter_text }}\n {% if order_by_clause -%}\n {{ order_by_clause }}\n {%- endif %}\n )\n {%- endif %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2740512}, "macro.dbt_utils.redshift__listagg": {"unique_id": "macro.dbt_utils.redshift__listagg", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/listagg.sql", "original_file_path": "macros/cross_db_utils/listagg.sql", "name": "redshift__listagg", "macro_sql": "{% macro redshift__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n\n {% if limit_num -%}\n {% set ns = namespace() %}\n {% set ns.delimiter_text_regex = delimiter_text|trim(\"'\") %}\n {% set special_chars %}\\,^,$,.,|,?,*,+,(,),[,],{,}{% endset %} \n {%- for char in special_chars.split(',') -%}\n {% set escape_char %}\\\\{{ char }}{% endset %}\n {% set ns.delimiter_text_regex = ns.delimiter_text_regex|replace(char,escape_char) %}\n {%- endfor -%}\n\n {% set regex %}'([^{{ ns.delimiter_text_regex }}]+{{ ns.delimiter_text_regex }}){1,{{ limit_num - 1}}}[^{{ ns.delimiter_text_regex }}]+'{% endset %}\n regexp_substr(\n listagg(\n {{ measure }},\n {{ delimiter_text }}\n )\n {% if order_by_clause -%}\n within group ({{ order_by_clause }})\n {%- endif %}\n ,{{ regex }}\n )\n {%- else %}\n listagg(\n {{ measure }},\n {{ delimiter_text }}\n )\n {% if order_by_clause -%}\n within group ({{ order_by_clause }})\n {%- endif %}\n {%- endif %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.276726}, "macro.dbt_utils.datediff": {"unique_id": "macro.dbt_utils.datediff", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "datediff", "macro_sql": "{% macro datediff(first_date, second_date, datepart) %}\n {{ return(adapter.dispatch('datediff', 'dbt_utils')(first_date, second_date, datepart)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2824068}, "macro.dbt_utils.default__datediff": {"unique_id": "macro.dbt_utils.default__datediff", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "default__datediff", "macro_sql": "{% macro default__datediff(first_date, second_date, datepart) -%}\n\n datediff(\n {{ datepart }},\n {{ first_date }},\n {{ second_date }}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2829561}, "macro.dbt_utils.bigquery__datediff": {"unique_id": "macro.dbt_utils.bigquery__datediff", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "bigquery__datediff", "macro_sql": "{% macro bigquery__datediff(first_date, second_date, datepart) -%}\n\n datetime_diff(\n cast({{second_date}} as datetime),\n cast({{first_date}} as datetime),\n {{datepart}}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.283515}, "macro.dbt_utils.postgres__datediff": {"unique_id": "macro.dbt_utils.postgres__datediff", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "postgres__datediff", "macro_sql": "{% macro postgres__datediff(first_date, second_date, datepart) -%}\n\n {% if datepart == 'year' %}\n (date_part('year', ({{second_date}})::date) - date_part('year', ({{first_date}})::date))\n {% elif datepart == 'quarter' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 4 + date_part('quarter', ({{second_date}})::date) - date_part('quarter', ({{first_date}})::date))\n {% elif datepart == 'month' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 12 + date_part('month', ({{second_date}})::date) - date_part('month', ({{first_date}})::date))\n {% elif datepart == 'day' %}\n (({{second_date}})::date - ({{first_date}})::date)\n {% elif datepart == 'week' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} / 7 + case\n when date_part('dow', ({{first_date}})::timestamp) <= date_part('dow', ({{second_date}})::timestamp) then\n case when {{first_date}} <= {{second_date}} then 0 else -1 end\n else\n case when {{first_date}} <= {{second_date}} then 1 else 0 end\n end)\n {% elif datepart == 'hour' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} * 24 + date_part('hour', ({{second_date}})::timestamp) - date_part('hour', ({{first_date}})::timestamp))\n {% elif datepart == 'minute' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'hour') }} * 60 + date_part('minute', ({{second_date}})::timestamp) - date_part('minute', ({{first_date}})::timestamp))\n {% elif datepart == 'second' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60 + floor(date_part('second', ({{second_date}})::timestamp)) - floor(date_part('second', ({{first_date}})::timestamp)))\n {% elif datepart == 'millisecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000 + floor(date_part('millisecond', ({{second_date}})::timestamp)) - floor(date_part('millisecond', ({{first_date}})::timestamp)))\n {% elif datepart == 'microsecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000000 + floor(date_part('microsecond', ({{second_date}})::timestamp)) - floor(date_part('microsecond', ({{first_date}})::timestamp)))\n {% else %}\n {{ exceptions.raise_compiler_error(\"Unsupported datepart for macro datediff in postgres: {!r}\".format(datepart)) }}\n {% endif %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.288387}, "macro.dbt_utils.redshift__datediff": {"unique_id": "macro.dbt_utils.redshift__datediff", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "redshift__datediff", "macro_sql": "{% macro redshift__datediff(first_date, second_date, datepart) -%}\n\n {{ return(dbt_utils.default__datediff(first_date, second_date, datepart)) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.28897}, "macro.dbt_utils.safe_cast": {"unique_id": "macro.dbt_utils.safe_cast", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "safe_cast", "macro_sql": "{% macro safe_cast(field, type) %}\n {{ return(adapter.dispatch('safe_cast', 'dbt_utils') (field, type)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__safe_cast"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.290348}, "macro.dbt_utils.default__safe_cast": {"unique_id": "macro.dbt_utils.default__safe_cast", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "default__safe_cast", "macro_sql": "{% macro default__safe_cast(field, type) %}\n {# most databases don't support this function yet\n so we just need to use cast #}\n cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.290751}, "macro.dbt_utils.snowflake__safe_cast": {"unique_id": "macro.dbt_utils.snowflake__safe_cast", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "snowflake__safe_cast", "macro_sql": "{% macro snowflake__safe_cast(field, type) %}\n try_cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.291112}, "macro.dbt_utils.bigquery__safe_cast": {"unique_id": "macro.dbt_utils.bigquery__safe_cast", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "bigquery__safe_cast", "macro_sql": "{% macro bigquery__safe_cast(field, type) %}\n safe_cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.291473}, "macro.dbt_utils.hash": {"unique_id": "macro.dbt_utils.hash", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/hash.sql", "original_file_path": "macros/cross_db_utils/hash.sql", "name": "hash", "macro_sql": "{% macro hash(field) -%}\n {{ return(adapter.dispatch('hash', 'dbt_utils') (field)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__hash"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.292476}, "macro.dbt_utils.default__hash": {"unique_id": "macro.dbt_utils.default__hash", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/hash.sql", "original_file_path": "macros/cross_db_utils/hash.sql", "name": "default__hash", "macro_sql": "{% macro default__hash(field) -%}\n md5(cast({{field}} as {{dbt_utils.type_string()}}))\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2929869}, "macro.dbt_utils.bigquery__hash": {"unique_id": "macro.dbt_utils.bigquery__hash", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/hash.sql", "original_file_path": "macros/cross_db_utils/hash.sql", "name": "bigquery__hash", "macro_sql": "{% macro bigquery__hash(field) -%}\n to_hex({{dbt_utils.default__hash(field)}})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__hash"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2934248}, "macro.dbt_utils.cast_bool_to_text": {"unique_id": "macro.dbt_utils.cast_bool_to_text", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_bool_to_text.sql", "original_file_path": "macros/cross_db_utils/cast_bool_to_text.sql", "name": "cast_bool_to_text", "macro_sql": "{% macro cast_bool_to_text(field) %}\n {{ adapter.dispatch('cast_bool_to_text', 'dbt_utils') (field) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2943811}, "macro.dbt_utils.default__cast_bool_to_text": {"unique_id": "macro.dbt_utils.default__cast_bool_to_text", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_bool_to_text.sql", "original_file_path": "macros/cross_db_utils/cast_bool_to_text.sql", "name": "default__cast_bool_to_text", "macro_sql": "{% macro default__cast_bool_to_text(field) %}\n cast({{ field }} as {{ dbt_utils.type_string() }})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2947788}, "macro.dbt_utils.redshift__cast_bool_to_text": {"unique_id": "macro.dbt_utils.redshift__cast_bool_to_text", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_bool_to_text.sql", "original_file_path": "macros/cross_db_utils/cast_bool_to_text.sql", "name": "redshift__cast_bool_to_text", "macro_sql": "{% macro redshift__cast_bool_to_text(field) %}\n case\n when {{ field }} is true then 'true'\n when {{ field }} is false then 'false'\n end::text\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.295192}, "macro.dbt_utils.identifier": {"unique_id": "macro.dbt_utils.identifier", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/identifier.sql", "original_file_path": "macros/cross_db_utils/identifier.sql", "name": "identifier", "macro_sql": "{% macro identifier(value) %}\t\n {%- set error_message = '\n Warning: the `identifier` macro is no longer supported and will be deprecated in a future release of dbt-utils. \\\n Use `adapter.quote` instead. The {}.{} model triggered this warning. \\\n '.format(model.package_name, model.name) -%}\n {%- do exceptions.warn(error_message) -%}\n {{ return(adapter.dispatch('identifier', 'dbt_utils') (value)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__identifier"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.296787}, "macro.dbt_utils.default__identifier": {"unique_id": "macro.dbt_utils.default__identifier", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/identifier.sql", "original_file_path": "macros/cross_db_utils/identifier.sql", "name": "default__identifier", "macro_sql": "{% macro default__identifier(value) -%}\t\n \"{{ value }}\"\t\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.297211}, "macro.dbt_utils.bigquery__identifier": {"unique_id": "macro.dbt_utils.bigquery__identifier", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/identifier.sql", "original_file_path": "macros/cross_db_utils/identifier.sql", "name": "bigquery__identifier", "macro_sql": "{% macro bigquery__identifier(value) -%}\t\n `{{ value }}`\t\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2975612}, "macro.dbt_utils.any_value": {"unique_id": "macro.dbt_utils.any_value", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/any_value.sql", "original_file_path": "macros/cross_db_utils/any_value.sql", "name": "any_value", "macro_sql": "{% macro any_value(expression) -%}\n {{ return(adapter.dispatch('any_value', 'dbt_utils') (expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__any_value"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.2985952}, "macro.dbt_utils.default__any_value": {"unique_id": "macro.dbt_utils.default__any_value", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/any_value.sql", "original_file_path": "macros/cross_db_utils/any_value.sql", "name": "default__any_value", "macro_sql": "{% macro default__any_value(expression) -%}\n \n any_value({{ expression }})\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.299057}, "macro.dbt_utils.postgres__any_value": {"unique_id": "macro.dbt_utils.postgres__any_value", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/any_value.sql", "original_file_path": "macros/cross_db_utils/any_value.sql", "name": "postgres__any_value", "macro_sql": "{% macro postgres__any_value(expression) -%}\n {#- /*Postgres doesn't support any_value, so we're using min() to get the same result*/ -#}\n min({{ expression }})\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.299446}, "macro.dbt_utils.position": {"unique_id": "macro.dbt_utils.position", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/position.sql", "original_file_path": "macros/cross_db_utils/position.sql", "name": "position", "macro_sql": "{% macro position(substring_text, string_text) -%}\n {{ return(adapter.dispatch('position', 'dbt_utils') (substring_text, string_text)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__position"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.301024}, "macro.dbt_utils.default__position": {"unique_id": "macro.dbt_utils.default__position", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/position.sql", "original_file_path": "macros/cross_db_utils/position.sql", "name": "default__position", "macro_sql": "{% macro default__position(substring_text, string_text) %}\n\n position(\n {{ substring_text }} in {{ string_text }}\n )\n \n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.301412}, "macro.dbt_utils.bigquery__position": {"unique_id": "macro.dbt_utils.bigquery__position", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/position.sql", "original_file_path": "macros/cross_db_utils/position.sql", "name": "bigquery__position", "macro_sql": "{% macro bigquery__position(substring_text, string_text) %}\n\n strpos(\n {{ string_text }},\n {{ substring_text }}\n \n )\n \n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3019679}, "macro.dbt_utils.string_literal": {"unique_id": "macro.dbt_utils.string_literal", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/literal.sql", "original_file_path": "macros/cross_db_utils/literal.sql", "name": "string_literal", "macro_sql": "{%- macro string_literal(value) -%}\n {{ return(adapter.dispatch('string_literal', 'dbt_utils') (value)) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__string_literal"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.303188}, "macro.dbt_utils.default__string_literal": {"unique_id": "macro.dbt_utils.default__string_literal", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/literal.sql", "original_file_path": "macros/cross_db_utils/literal.sql", "name": "default__string_literal", "macro_sql": "{% macro default__string_literal(value) -%}\n '{{ value }}'\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.303626}, "macro.dbt_utils.current_timestamp": {"unique_id": "macro.dbt_utils.current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "current_timestamp", "macro_sql": "{% macro current_timestamp() -%}\n {{ return(adapter.dispatch('current_timestamp', 'dbt_utils')()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.305344}, "macro.dbt_utils.default__current_timestamp": {"unique_id": "macro.dbt_utils.default__current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "default__current_timestamp", "macro_sql": "{% macro default__current_timestamp() %}\n current_timestamp::{{dbt_utils.type_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3062232}, "macro.dbt_utils.redshift__current_timestamp": {"unique_id": "macro.dbt_utils.redshift__current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "redshift__current_timestamp", "macro_sql": "{% macro redshift__current_timestamp() %}\n getdate()\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.306568}, "macro.dbt_utils.bigquery__current_timestamp": {"unique_id": "macro.dbt_utils.bigquery__current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "bigquery__current_timestamp", "macro_sql": "{% macro bigquery__current_timestamp() %}\n current_timestamp\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.307004}, "macro.dbt_utils.current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "current_timestamp_in_utc", "macro_sql": "{% macro current_timestamp_in_utc() -%}\n {{ return(adapter.dispatch('current_timestamp_in_utc', 'dbt_utils')()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__current_timestamp_in_utc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.307568}, "macro.dbt_utils.default__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.default__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "default__current_timestamp_in_utc", "macro_sql": "{% macro default__current_timestamp_in_utc() %}\n {{dbt_utils.current_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.307904}, "macro.dbt_utils.snowflake__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.snowflake__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "snowflake__current_timestamp_in_utc", "macro_sql": "{% macro snowflake__current_timestamp_in_utc() %}\n convert_timezone('UTC', {{dbt_utils.current_timestamp()}})::{{dbt_utils.type_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.current_timestamp", "macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.308321}, "macro.dbt_utils.postgres__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.postgres__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "postgres__current_timestamp_in_utc", "macro_sql": "{% macro postgres__current_timestamp_in_utc() %}\n (current_timestamp at time zone 'utc')::{{dbt_utils.type_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.308633}, "macro.dbt_utils.redshift__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.redshift__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "redshift__current_timestamp_in_utc", "macro_sql": "{% macro redshift__current_timestamp_in_utc() %}\n {{ return(dbt_utils.default__current_timestamp_in_utc()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__current_timestamp_in_utc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.309001}, "macro.dbt_utils.width_bucket": {"unique_id": "macro.dbt_utils.width_bucket", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "width_bucket", "macro_sql": "{% macro width_bucket(expr, min_value, max_value, num_buckets) %}\n {{ return(adapter.dispatch('width_bucket', 'dbt_utils') (expr, min_value, max_value, num_buckets)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__width_bucket"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.312084}, "macro.dbt_utils.default__width_bucket": {"unique_id": "macro.dbt_utils.default__width_bucket", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "default__width_bucket", "macro_sql": "{% macro default__width_bucket(expr, min_value, max_value, num_buckets) -%}\n\n {% set bin_size -%}\n (( {{ max_value }} - {{ min_value }} ) / {{ num_buckets }} )\n {%- endset %}\n (\n -- to break ties when the amount is eaxtly at the bucket egde\n case\n when\n mod(\n {{ dbt_utils.safe_cast(expr, dbt_utils.type_numeric() ) }},\n {{ dbt_utils.safe_cast(bin_size, dbt_utils.type_numeric() ) }}\n ) = 0\n then 1\n else 0\n end\n ) +\n -- Anything over max_value goes the N+1 bucket\n least(\n ceil(\n ({{ expr }} - {{ min_value }})/{{ bin_size }}\n ),\n {{ num_buckets }} + 1\n )\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.safe_cast", "macro.dbt_utils.type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.31343}, "macro.dbt_utils.redshift__width_bucket": {"unique_id": "macro.dbt_utils.redshift__width_bucket", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "redshift__width_bucket", "macro_sql": "{% macro redshift__width_bucket(expr, min_value, max_value, num_buckets) -%}\n\n {% set bin_size -%}\n (( {{ max_value }} - {{ min_value }} ) / {{ num_buckets }} )\n {%- endset %}\n (\n -- to break ties when the amount is exactly at the bucket edge\n case\n when\n {{ dbt_utils.safe_cast(expr, dbt_utils.type_numeric() ) }} %\n {{ dbt_utils.safe_cast(bin_size, dbt_utils.type_numeric() ) }}\n = 0\n then 1\n else 0\n end\n ) +\n -- Anything over max_value goes the N+1 bucket\n least(\n ceil(\n ({{ expr }} - {{ min_value }})/{{ bin_size }}\n ),\n {{ num_buckets }} + 1\n )\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.safe_cast", "macro.dbt_utils.type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3153868}, "macro.dbt_utils.snowflake__width_bucket": {"unique_id": "macro.dbt_utils.snowflake__width_bucket", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "snowflake__width_bucket", "macro_sql": "{% macro snowflake__width_bucket(expr, min_value, max_value, num_buckets) %}\n width_bucket({{ expr }}, {{ min_value }}, {{ max_value }}, {{ num_buckets }} )\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.315991}, "macro.dbt_utils.array_concat": {"unique_id": "macro.dbt_utils.array_concat", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_concat.sql", "original_file_path": "macros/cross_db_utils/array_concat.sql", "name": "array_concat", "macro_sql": "{% macro array_concat(array_1, array_2) -%}\n {{ return(adapter.dispatch('array_concat', 'dbt_utils')(array_1, array_2)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__array_concat"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.317375}, "macro.dbt_utils.default__array_concat": {"unique_id": "macro.dbt_utils.default__array_concat", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_concat.sql", "original_file_path": "macros/cross_db_utils/array_concat.sql", "name": "default__array_concat", "macro_sql": "{% macro default__array_concat(array_1, array_2) -%}\n array_cat({{ array_1 }}, {{ array_2 }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.317823}, "macro.dbt_utils.bigquery__array_concat": {"unique_id": "macro.dbt_utils.bigquery__array_concat", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_concat.sql", "original_file_path": "macros/cross_db_utils/array_concat.sql", "name": "bigquery__array_concat", "macro_sql": "{% macro bigquery__array_concat(array_1, array_2) -%}\n array_concat({{ array_1 }}, {{ array_2 }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.318197}, "macro.dbt_utils.redshift__array_concat": {"unique_id": "macro.dbt_utils.redshift__array_concat", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_concat.sql", "original_file_path": "macros/cross_db_utils/array_concat.sql", "name": "redshift__array_concat", "macro_sql": "{% macro redshift__array_concat(array_1, array_2) -%}\n array_concat({{ array_1 }}, {{ array_2 }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3185558}, "macro.dbt_utils.bool_or": {"unique_id": "macro.dbt_utils.bool_or", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/bool_or.sql", "original_file_path": "macros/cross_db_utils/bool_or.sql", "name": "bool_or", "macro_sql": "{% macro bool_or(expression) -%}\n {{ return(adapter.dispatch('bool_or', 'dbt_utils') (expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__bool_or"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3196108}, "macro.dbt_utils.default__bool_or": {"unique_id": "macro.dbt_utils.default__bool_or", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/bool_or.sql", "original_file_path": "macros/cross_db_utils/bool_or.sql", "name": "default__bool_or", "macro_sql": "{% macro default__bool_or(expression) -%}\n \n bool_or({{ expression }})\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3200169}, "macro.dbt_utils.snowflake__bool_or": {"unique_id": "macro.dbt_utils.snowflake__bool_or", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/bool_or.sql", "original_file_path": "macros/cross_db_utils/bool_or.sql", "name": "snowflake__bool_or", "macro_sql": "{% macro snowflake__bool_or(expression) -%}\n \n boolor_agg({{ expression }})\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3206131}, "macro.dbt_utils.bigquery__bool_or": {"unique_id": "macro.dbt_utils.bigquery__bool_or", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/bool_or.sql", "original_file_path": "macros/cross_db_utils/bool_or.sql", "name": "bigquery__bool_or", "macro_sql": "{% macro bigquery__bool_or(expression) -%}\n \n logical_or({{ expression }})\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.321001}, "macro.dbt_utils.last_day": {"unique_id": "macro.dbt_utils.last_day", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "last_day", "macro_sql": "{% macro last_day(date, datepart) %}\n {{ return(adapter.dispatch('last_day', 'dbt_utils') (date, datepart)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.323137}, "macro.dbt_utils.default_last_day": {"unique_id": "macro.dbt_utils.default_last_day", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "default_last_day", "macro_sql": "\n\n\n{%- macro default_last_day(date, datepart) -%}\n cast(\n {{dbt_utils.dateadd('day', '-1',\n dbt_utils.dateadd(datepart, '1', dbt_utils.date_trunc(datepart, date))\n )}}\n as date)\n{%- endmacro -%}\n\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd", "macro.dbt_utils.date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.324016}, "macro.dbt_utils.default__last_day": {"unique_id": "macro.dbt_utils.default__last_day", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "default__last_day", "macro_sql": "{% macro default__last_day(date, datepart) -%}\n {{dbt_utils.default_last_day(date, datepart)}}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default_last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.324447}, "macro.dbt_utils.postgres__last_day": {"unique_id": "macro.dbt_utils.postgres__last_day", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "postgres__last_day", "macro_sql": "{% macro postgres__last_day(date, datepart) -%}\n\n {%- if datepart == 'quarter' -%}\n -- postgres dateadd does not support quarter interval.\n cast(\n {{dbt_utils.dateadd('day', '-1',\n dbt_utils.dateadd('month', '3', dbt_utils.date_trunc(datepart, date))\n )}}\n as date)\n {%- else -%}\n {{dbt_utils.default_last_day(date, datepart)}}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd", "macro.dbt_utils.date_trunc", "macro.dbt_utils.default_last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3256378}, "macro.dbt_utils.redshift__last_day": {"unique_id": "macro.dbt_utils.redshift__last_day", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "redshift__last_day", "macro_sql": "{% macro redshift__last_day(date, datepart) %}\n\n {{ return(dbt_utils.default__last_day(date, datepart)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3261619}, "macro.dbt_utils.split_part": {"unique_id": "macro.dbt_utils.split_part", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "split_part", "macro_sql": "{% macro split_part(string_text, delimiter_text, part_number) %}\n {{ return(adapter.dispatch('split_part', 'dbt_utils') (string_text, delimiter_text, part_number)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__split_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.329513}, "macro.dbt_utils.default__split_part": {"unique_id": "macro.dbt_utils.default__split_part", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "default__split_part", "macro_sql": "{% macro default__split_part(string_text, delimiter_text, part_number) %}\n\n split_part(\n {{ string_text }},\n {{ delimiter_text }},\n {{ part_number }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3301032}, "macro.dbt_utils._split_part_negative": {"unique_id": "macro.dbt_utils._split_part_negative", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "_split_part_negative", "macro_sql": "{% macro _split_part_negative(string_text, delimiter_text, part_number) %}\n\n split_part(\n {{ string_text }},\n {{ delimiter_text }},\n length({{ string_text }}) \n - length(\n replace({{ string_text }}, {{ delimiter_text }}, '')\n ) + 2 {{ part_number }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3307462}, "macro.dbt_utils.postgres__split_part": {"unique_id": "macro.dbt_utils.postgres__split_part", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "postgres__split_part", "macro_sql": "{% macro postgres__split_part(string_text, delimiter_text, part_number) %}\n\n {% if part_number >= 0 %}\n {{ dbt_utils.default__split_part(string_text, delimiter_text, part_number) }}\n {% else %}\n {{ dbt_utils._split_part_negative(string_text, delimiter_text, part_number) }}\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__split_part", "macro.dbt_utils._split_part_negative"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.331667}, "macro.dbt_utils.redshift__split_part": {"unique_id": "macro.dbt_utils.redshift__split_part", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "redshift__split_part", "macro_sql": "{% macro redshift__split_part(string_text, delimiter_text, part_number) %}\n\n {% if part_number >= 0 %}\n {{ dbt_utils.default__split_part(string_text, delimiter_text, part_number) }}\n {% else %}\n {{ dbt_utils._split_part_negative(string_text, delimiter_text, part_number) }}\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__split_part", "macro.dbt_utils._split_part_negative"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.332761}, "macro.dbt_utils.bigquery__split_part": {"unique_id": "macro.dbt_utils.bigquery__split_part", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "bigquery__split_part", "macro_sql": "{% macro bigquery__split_part(string_text, delimiter_text, part_number) %}\n\n {% if part_number >= 0 %}\n split(\n {{ string_text }},\n {{ delimiter_text }}\n )[safe_offset({{ part_number - 1 }})]\n {% else %}\n split(\n {{ string_text }},\n {{ delimiter_text }}\n )[safe_offset(\n length({{ string_text }}) \n - length(\n replace({{ string_text }}, {{ delimiter_text }}, '')\n ) + 1\n )]\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3339741}, "macro.dbt_utils.date_trunc": {"unique_id": "macro.dbt_utils.date_trunc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/date_trunc.sql", "original_file_path": "macros/cross_db_utils/date_trunc.sql", "name": "date_trunc", "macro_sql": "{% macro date_trunc(datepart, date) -%}\n {{ return(adapter.dispatch('date_trunc', 'dbt_utils') (datepart, date)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.335432}, "macro.dbt_utils.default__date_trunc": {"unique_id": "macro.dbt_utils.default__date_trunc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/date_trunc.sql", "original_file_path": "macros/cross_db_utils/date_trunc.sql", "name": "default__date_trunc", "macro_sql": "{% macro default__date_trunc(datepart, date) -%}\n date_trunc('{{datepart}}', {{date}})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.335813}, "macro.dbt_utils.bigquery__date_trunc": {"unique_id": "macro.dbt_utils.bigquery__date_trunc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/date_trunc.sql", "original_file_path": "macros/cross_db_utils/date_trunc.sql", "name": "bigquery__date_trunc", "macro_sql": "{% macro bigquery__date_trunc(datepart, date) -%}\n timestamp_trunc(\n cast({{date}} as timestamp),\n {{datepart}}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.336267}, "macro.dbt_utils.array_construct": {"unique_id": "macro.dbt_utils.array_construct", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_construct.sql", "original_file_path": "macros/cross_db_utils/array_construct.sql", "name": "array_construct", "macro_sql": "{% macro array_construct(inputs = [], data_type = api.Column.translate_type('integer')) -%}\n {{ return(adapter.dispatch('array_construct', 'dbt_utils')(inputs, data_type)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__array_construct"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.337866}, "macro.dbt_utils.default__array_construct": {"unique_id": "macro.dbt_utils.default__array_construct", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_construct.sql", "original_file_path": "macros/cross_db_utils/array_construct.sql", "name": "default__array_construct", "macro_sql": "{% macro default__array_construct(inputs, data_type) -%}\n {% if inputs|length > 0 %}\n array[ {{ inputs|join(' , ') }} ]\n {% else %}\n array[]::{{data_type}}[]\n {% endif %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.338629}, "macro.dbt_utils.snowflake__array_construct": {"unique_id": "macro.dbt_utils.snowflake__array_construct", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_construct.sql", "original_file_path": "macros/cross_db_utils/array_construct.sql", "name": "snowflake__array_construct", "macro_sql": "{% macro snowflake__array_construct(inputs, data_type) -%}\n array_construct( {{ inputs|join(' , ') }} )\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.33903}, "macro.dbt_utils.redshift__array_construct": {"unique_id": "macro.dbt_utils.redshift__array_construct", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_construct.sql", "original_file_path": "macros/cross_db_utils/array_construct.sql", "name": "redshift__array_construct", "macro_sql": "{% macro redshift__array_construct(inputs, data_type) -%}\n array( {{ inputs|join(' , ') }} )\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3394828}, "macro.dbt_utils.bigquery__array_construct": {"unique_id": "macro.dbt_utils.bigquery__array_construct", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_construct.sql", "original_file_path": "macros/cross_db_utils/array_construct.sql", "name": "bigquery__array_construct", "macro_sql": "{% macro bigquery__array_construct(inputs, data_type) -%}\n [ {{ inputs|join(' , ') }} ]\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.339884}, "macro.dbt_utils._is_ephemeral": {"unique_id": "macro.dbt_utils._is_ephemeral", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/_is_ephemeral.sql", "original_file_path": "macros/cross_db_utils/_is_ephemeral.sql", "name": "_is_ephemeral", "macro_sql": "{% macro _is_ephemeral(obj, macro) %}\n {%- if obj.is_cte -%}\n {% set ephemeral_prefix = api.Relation.add_ephemeral_prefix('') %}\n {% if obj.name.startswith(ephemeral_prefix) %}\n {% set model_name = obj.name[(ephemeral_prefix|length):] %}\n {% else %}\n {% set model_name = obj.name %}\n {%- endif -%}\n {% set error_message %}\nThe `{{ macro }}` macro cannot be used with ephemeral models, as it relies on the information schema.\n\n`{{ model_name }}` is an ephemeral model. Consider making it a view or table instead.\n {% endset %}\n {%- do exceptions.raise_compiler_error(error_message) -%}\n {%- endif -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.342409}, "macro.dbt_utils.array_append": {"unique_id": "macro.dbt_utils.array_append", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_append.sql", "original_file_path": "macros/cross_db_utils/array_append.sql", "name": "array_append", "macro_sql": "{% macro array_append(array, new_element) -%}\n {{ return(adapter.dispatch('array_append', 'dbt_utils')(array, new_element)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__array_append"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.343581}, "macro.dbt_utils.default__array_append": {"unique_id": "macro.dbt_utils.default__array_append", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_append.sql", "original_file_path": "macros/cross_db_utils/array_append.sql", "name": "default__array_append", "macro_sql": "{% macro default__array_append(array, new_element) -%}\n array_append({{ array }}, {{ new_element }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.343997}, "macro.dbt_utils.bigquery__array_append": {"unique_id": "macro.dbt_utils.bigquery__array_append", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_append.sql", "original_file_path": "macros/cross_db_utils/array_append.sql", "name": "bigquery__array_append", "macro_sql": "{% macro bigquery__array_append(array, new_element) -%}\n {{ dbt_utils.array_concat(array, dbt_utils.array_construct([new_element])) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.array_concat", "macro.dbt_utils.array_construct"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3445382}, "macro.dbt_utils.redshift__array_append": {"unique_id": "macro.dbt_utils.redshift__array_append", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_append.sql", "original_file_path": "macros/cross_db_utils/array_append.sql", "name": "redshift__array_append", "macro_sql": "{% macro redshift__array_append(array, new_element) -%}\n {{ dbt_utils.array_concat(array, dbt_utils.array_construct([new_element])) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.array_concat", "macro.dbt_utils.array_construct"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.34523}, "macro.dbt_utils.get_period_boundaries": {"unique_id": "macro.dbt_utils.get_period_boundaries", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "get_period_boundaries", "macro_sql": "{% macro get_period_boundaries(target_schema, target_table, timestamp_field, start_date, stop_date, period) -%}\n {{ return(adapter.dispatch('get_period_boundaries', 'dbt_utils')(target_schema, target_table, timestamp_field, start_date, stop_date, period)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_period_boundaries"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.357065}, "macro.dbt_utils.default__get_period_boundaries": {"unique_id": "macro.dbt_utils.default__get_period_boundaries", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "default__get_period_boundaries", "macro_sql": "{% macro default__get_period_boundaries(target_schema, target_table, timestamp_field, start_date, stop_date, period) -%}\n\n {% call statement('period_boundaries', fetch_result=True) -%}\n with data as (\n select\n coalesce(max(\"{{timestamp_field}}\"), '{{start_date}}')::timestamp as start_timestamp,\n coalesce(\n {{dbt_utils.dateadd('millisecond',\n -1,\n \"nullif('\" ~ stop_date ~ \"','')::timestamp\")}},\n {{dbt_utils.current_timestamp()}}\n ) as stop_timestamp\n from \"{{target_schema}}\".\"{{target_table}}\"\n )\n\n select\n start_timestamp,\n stop_timestamp,\n {{dbt_utils.datediff('start_timestamp',\n 'stop_timestamp',\n period)}} + 1 as num_periods\n from data\n {%- endcall %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.dateadd", "macro.dbt_utils.current_timestamp", "macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.358463}, "macro.dbt_utils.get_period_sql": {"unique_id": "macro.dbt_utils.get_period_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "get_period_sql", "macro_sql": "{% macro get_period_sql(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset) -%}\n {{ return(adapter.dispatch('get_period_sql', 'dbt_utils')(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_period_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3593862}, "macro.dbt_utils.default__get_period_sql": {"unique_id": "macro.dbt_utils.default__get_period_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "default__get_period_sql", "macro_sql": "{% macro default__get_period_sql(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset) -%}\n\n {%- set period_filter -%}\n (\"{{timestamp_field}}\" > '{{start_timestamp}}'::timestamp + interval '{{offset}} {{period}}' and\n \"{{timestamp_field}}\" <= '{{start_timestamp}}'::timestamp + interval '{{offset}} {{period}}' + interval '1 {{period}}' and\n \"{{timestamp_field}}\" < '{{stop_timestamp}}'::timestamp)\n {%- endset -%}\n\n {%- set filtered_sql = sql | replace(\"__PERIOD_FILTER__\", period_filter) -%}\n\n select\n {{target_cols_csv}}\n from (\n {{filtered_sql}}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.361161}, "macro.dbt_utils.materialization_insert_by_period_default": {"unique_id": "macro.dbt_utils.materialization_insert_by_period_default", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "materialization_insert_by_period_default", "macro_sql": "{% materialization insert_by_period, default -%}\n {%- set timestamp_field = config.require('timestamp_field') -%}\n {%- set start_date = config.require('start_date') -%}\n {%- set stop_date = config.get('stop_date') or '' -%}\n {%- set period = config.get('period') or 'week' -%}\n\n {%- if sql.find('__PERIOD_FILTER__') == -1 -%}\n {%- set error_message -%}\n Model '{{ model.unique_id }}' does not include the required string '__PERIOD_FILTER__' in its sql\n {%- endset -%}\n {{ exceptions.raise_compiler_error(error_message) }}\n {%- endif -%}\n\n {%- set identifier = model['name'] -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier, schema=schema, type='table') -%}\n\n {%- set non_destructive_mode = (flags.NON_DESTRUCTIVE == True) -%}\n {%- set full_refresh_mode = (flags.FULL_REFRESH == True) -%}\n\n {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n {%- set exists_not_as_table = (old_relation is not none and not old_relation.is_table) -%}\n\n {%- set should_truncate = (non_destructive_mode and full_refresh_mode and exists_as_table) -%}\n {%- set should_drop = (not should_truncate and (full_refresh_mode or exists_not_as_table)) -%}\n {%- set force_create = (flags.FULL_REFRESH and not flags.NON_DESTRUCTIVE) -%}\n\n -- setup\n {% if old_relation is none -%}\n -- noop\n {%- elif should_truncate -%}\n {{adapter.truncate_relation(old_relation)}}\n {%- elif should_drop -%}\n {{adapter.drop_relation(old_relation)}}\n {%- set old_relation = none -%}\n {%- endif %}\n\n {{run_hooks(pre_hooks, inside_transaction=False)}}\n\n -- `begin` happens here, so `commit` after it to finish the transaction\n {{run_hooks(pre_hooks, inside_transaction=True)}}\n {% call statement() -%}\n begin; -- make extra sure we've closed out the transaction\n commit;\n {%- endcall %}\n\n -- build model\n {% if force_create or old_relation is none -%}\n {# Create an empty target table -#}\n {% call statement('main') -%}\n {%- set empty_sql = sql | replace(\"__PERIOD_FILTER__\", 'false') -%}\n {{create_table_as(False, target_relation, empty_sql)}}\n {%- endcall %}\n {%- endif %}\n\n {% set _ = dbt_utils.get_period_boundaries(schema,\n identifier,\n timestamp_field,\n start_date,\n stop_date,\n period) %}\n {%- set start_timestamp = load_result('period_boundaries')['data'][0][0] | string -%}\n {%- set stop_timestamp = load_result('period_boundaries')['data'][0][1] | string -%}\n {%- set num_periods = load_result('period_boundaries')['data'][0][2] | int -%}\n\n {% set target_columns = adapter.get_columns_in_relation(target_relation) %}\n {%- set target_cols_csv = target_columns | map(attribute='quoted') | join(', ') -%}\n {%- set loop_vars = {'sum_rows_inserted': 0} -%}\n\n -- commit each period as a separate transaction\n {% for i in range(num_periods) -%}\n {%- set msg = \"Running for \" ~ period ~ \" \" ~ (i + 1) ~ \" of \" ~ (num_periods) -%}\n {{ dbt_utils.log_info(msg) }}\n\n {%- set tmp_identifier = model['name'] ~ '__dbt_incremental_period' ~ i ~ '_tmp' -%}\n {%- set tmp_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema, type='table') -%}\n {% call statement() -%}\n {% set tmp_table_sql = dbt_utils.get_period_sql(target_cols_csv,\n sql,\n timestamp_field,\n period,\n start_timestamp,\n stop_timestamp,\n i) %}\n {{dbt.create_table_as(True, tmp_relation, tmp_table_sql)}}\n {%- endcall %}\n\n {{adapter.expand_target_column_types(from_relation=tmp_relation,\n to_relation=target_relation)}}\n {%- set name = 'main-' ~ i -%}\n {% call statement(name, fetch_result=True) -%}\n insert into {{target_relation}} ({{target_cols_csv}})\n (\n select\n {{target_cols_csv}}\n from {{tmp_relation.include(schema=False)}}\n );\n {%- endcall %}\n {% set result = load_result('main-' ~ i) %}\n {% if 'response' in result.keys() %} {# added in v0.19.0 #}\n {% set rows_inserted = result['response']['rows_affected'] %}\n {% else %} {# older versions #}\n {% set rows_inserted = result['status'].split(\" \")[2] | int %}\n {% endif %}\n \n {%- set sum_rows_inserted = loop_vars['sum_rows_inserted'] + rows_inserted -%}\n {%- if loop_vars.update({'sum_rows_inserted': sum_rows_inserted}) %} {% endif -%}\n\n {%- set msg = \"Ran for \" ~ period ~ \" \" ~ (i + 1) ~ \" of \" ~ (num_periods) ~ \"; \" ~ rows_inserted ~ \" records inserted\" -%}\n {{ dbt_utils.log_info(msg) }}\n\n {%- endfor %}\n\n {% call statement() -%}\n begin;\n {%- endcall %}\n\n {{run_hooks(post_hooks, inside_transaction=True)}}\n\n {% call statement() -%}\n commit;\n {%- endcall %}\n\n {{run_hooks(post_hooks, inside_transaction=False)}}\n\n {%- set status_string = \"INSERT \" ~ loop_vars['sum_rows_inserted'] -%}\n\n {% call noop_statement('main', status_string) -%}\n -- no-op\n {%- endcall %}\n\n -- Return the relations created in this materialization\n {{ return({'relations': [target_relation]}) }} \n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt_utils.get_period_boundaries", "macro.dbt_utils.log_info", "macro.dbt_utils.get_period_sql", "macro.dbt.noop_statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.376039}, "macro.dbt_utils.get_url_host": {"unique_id": "macro.dbt_utils.get_url_host", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "name": "get_url_host", "macro_sql": "{% macro get_url_host(field) -%}\n {{ return(adapter.dispatch('get_url_host', 'dbt_utils')(field)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_url_host"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.377228}, "macro.dbt_utils.default__get_url_host": {"unique_id": "macro.dbt_utils.default__get_url_host", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "name": "default__get_url_host", "macro_sql": "{% macro default__get_url_host(field) -%}\n\n{%- set parsed =\n dbt_utils.split_part(\n dbt_utils.split_part(\n dbt_utils.replace(\n dbt_utils.replace(\n dbt_utils.replace(field, \"'android-app://'\", \"''\"\n ), \"'http://'\", \"''\"\n ), \"'https://'\", \"''\"\n ), \"'/'\", 1\n ), \"'?'\", 1\n )\n\n-%}\n\n\n {{ dbt_utils.safe_cast(\n parsed,\n dbt_utils.type_string()\n )}}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.split_part", "macro.dbt_utils.replace", "macro.dbt_utils.safe_cast", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.37851}, "macro.dbt_utils.get_url_path": {"unique_id": "macro.dbt_utils.get_url_path", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "name": "get_url_path", "macro_sql": "{% macro get_url_path(field) -%}\n {{ return(adapter.dispatch('get_url_path', 'dbt_utils')(field)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_url_path"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3800051}, "macro.dbt_utils.default__get_url_path": {"unique_id": "macro.dbt_utils.default__get_url_path", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "name": "default__get_url_path", "macro_sql": "{% macro default__get_url_path(field) -%}\n\n {%- set stripped_url = \n dbt_utils.replace(\n dbt_utils.replace(field, \"'http://'\", \"''\"), \"'https://'\", \"''\")\n -%}\n\n {%- set first_slash_pos -%}\n coalesce(\n nullif({{dbt_utils.position(\"'/'\", stripped_url)}}, 0),\n {{dbt_utils.position(\"'?'\", stripped_url)}} - 1\n )\n {%- endset -%}\n\n {%- set parsed_path =\n dbt_utils.split_part(\n dbt_utils.right(\n stripped_url, \n dbt_utils.length(stripped_url) ~ \"-\" ~ first_slash_pos\n ), \n \"'?'\", 1\n )\n -%}\n\n {{ dbt_utils.safe_cast(\n parsed_path,\n dbt_utils.type_string()\n )}}\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.replace", "macro.dbt_utils.position", "macro.dbt_utils.split_part", "macro.dbt_utils.right", "macro.dbt_utils.length", "macro.dbt_utils.safe_cast", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.382074}, "macro.dbt_utils.get_url_parameter": {"unique_id": "macro.dbt_utils.get_url_parameter", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "name": "get_url_parameter", "macro_sql": "{% macro get_url_parameter(field, url_parameter) -%}\n {{ return(adapter.dispatch('get_url_parameter', 'dbt_utils')(field, url_parameter)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_url_parameter"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.383191}, "macro.dbt_utils.default__get_url_parameter": {"unique_id": "macro.dbt_utils.default__get_url_parameter", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "name": "default__get_url_parameter", "macro_sql": "{% macro default__get_url_parameter(field, url_parameter) -%}\n\n{%- set formatted_url_parameter = \"'\" + url_parameter + \"='\" -%}\n\n{%- set split = dbt_utils.split_part(dbt_utils.split_part(field, formatted_url_parameter, 2), \"'&'\", 1) -%}\n\nnullif({{ split }},'')\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.split_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.384266}, "macro.dbt_utils.test_fewer_rows_than": {"unique_id": "macro.dbt_utils.test_fewer_rows_than", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/fewer_rows_than.sql", "original_file_path": "macros/generic_tests/fewer_rows_than.sql", "name": "test_fewer_rows_than", "macro_sql": "{% test fewer_rows_than(model, compare_model) %}\n {{ return(adapter.dispatch('test_fewer_rows_than', 'dbt_utils')(model, compare_model)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_fewer_rows_than"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.386009}, "macro.dbt_utils.default__test_fewer_rows_than": {"unique_id": "macro.dbt_utils.default__test_fewer_rows_than", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/fewer_rows_than.sql", "original_file_path": "macros/generic_tests/fewer_rows_than.sql", "name": "default__test_fewer_rows_than", "macro_sql": "{% macro default__test_fewer_rows_than(model, compare_model) %}\n\n{{ config(fail_calc = 'coalesce(row_count_delta, 0)') }}\n\nwith a as (\n\n select count(*) as count_our_model from {{ model }}\n\n),\nb as (\n\n select count(*) as count_comparison_model from {{ compare_model }}\n\n),\ncounts as (\n\n select\n count_our_model,\n count_comparison_model\n from a\n cross join b\n\n),\nfinal as (\n\n select *,\n case\n -- fail the test if we have more rows than the reference model and return the row count delta\n when count_our_model > count_comparison_model then (count_our_model - count_comparison_model)\n -- fail the test if they are the same number\n when count_our_model = count_comparison_model then 1\n -- pass the test if the delta is positive (i.e. return the number 0)\n else 0\n end as row_count_delta\n from counts\n\n)\n\nselect * from final\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3867478}, "macro.dbt_utils.test_equal_rowcount": {"unique_id": "macro.dbt_utils.test_equal_rowcount", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/equal_rowcount.sql", "original_file_path": "macros/generic_tests/equal_rowcount.sql", "name": "test_equal_rowcount", "macro_sql": "{% test equal_rowcount(model, compare_model) %}\n {{ return(adapter.dispatch('test_equal_rowcount', 'dbt_utils')(model, compare_model)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_equal_rowcount"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.387882}, "macro.dbt_utils.default__test_equal_rowcount": {"unique_id": "macro.dbt_utils.default__test_equal_rowcount", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/equal_rowcount.sql", "original_file_path": "macros/generic_tests/equal_rowcount.sql", "name": "default__test_equal_rowcount", "macro_sql": "{% macro default__test_equal_rowcount(model, compare_model) %}\n\n{#-- Needs to be set at parse time, before we return '' below --#}\n{{ config(fail_calc = 'coalesce(diff_count, 0)') }}\n\n{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n{%- if not execute -%}\n {{ return('') }}\n{% endif %}\n\nwith a as (\n\n select count(*) as count_a from {{ model }}\n\n),\nb as (\n\n select count(*) as count_b from {{ compare_model }}\n\n),\nfinal as (\n\n select\n count_a,\n count_b,\n abs(count_a - count_b) as diff_count\n from a\n cross join b\n\n)\n\nselect * from final\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3886871}, "macro.dbt_utils.test_relationships_where": {"unique_id": "macro.dbt_utils.test_relationships_where", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/relationships_where.sql", "original_file_path": "macros/generic_tests/relationships_where.sql", "name": "test_relationships_where", "macro_sql": "{% test relationships_where(model, column_name, to, field, from_condition=\"1=1\", to_condition=\"1=1\") %}\n {{ return(adapter.dispatch('test_relationships_where', 'dbt_utils')(model, column_name, to, field, from_condition, to_condition)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_relationships_where"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.390313}, "macro.dbt_utils.default__test_relationships_where": {"unique_id": "macro.dbt_utils.default__test_relationships_where", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/relationships_where.sql", "original_file_path": "macros/generic_tests/relationships_where.sql", "name": "default__test_relationships_where", "macro_sql": "{% macro default__test_relationships_where(model, column_name, to, field, from_condition=\"1=1\", to_condition=\"1=1\") %}\n\n{# T-SQL has no boolean data type so we use 1=1 which returns TRUE #}\n{# ref https://stackoverflow.com/a/7170753/3842610 #}\n\nwith left_table as (\n\n select\n {{column_name}} as id\n\n from {{model}}\n\n where {{column_name}} is not null\n and {{from_condition}}\n\n),\n\nright_table as (\n\n select\n {{field}} as id\n\n from {{to}}\n\n where {{field}} is not null\n and {{to_condition}}\n\n),\n\nexceptions as (\n\n select\n left_table.id,\n right_table.id as right_id\n\n from left_table\n\n left join right_table\n on left_table.id = right_table.id\n\n where right_table.id is null\n\n)\n\nselect * from exceptions\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.391221}, "macro.dbt_utils.test_recency": {"unique_id": "macro.dbt_utils.test_recency", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/recency.sql", "original_file_path": "macros/generic_tests/recency.sql", "name": "test_recency", "macro_sql": "{% test recency(model, field, datepart, interval) %}\n {{ return(adapter.dispatch('test_recency', 'dbt_utils')(model, field, datepart, interval)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_recency"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3923671}, "macro.dbt_utils.default__test_recency": {"unique_id": "macro.dbt_utils.default__test_recency", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/recency.sql", "original_file_path": "macros/generic_tests/recency.sql", "name": "default__test_recency", "macro_sql": "{% macro default__test_recency(model, field, datepart, interval) %}\n\n{% set threshold = dbt_utils.dateadd(datepart, interval * -1, dbt_utils.current_timestamp()) %}\n\nwith recency as (\n\n select max({{field}}) as most_recent\n from {{ model }}\n\n)\n\nselect\n\n most_recent,\n {{ threshold }} as threshold\n\nfrom recency\nwhere most_recent < {{ threshold }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd", "macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.393327}, "macro.dbt_utils.test_not_constant": {"unique_id": "macro.dbt_utils.test_not_constant", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/not_constant.sql", "original_file_path": "macros/generic_tests/not_constant.sql", "name": "test_not_constant", "macro_sql": "{% test not_constant(model, column_name) %}\n {{ return(adapter.dispatch('test_not_constant', 'dbt_utils')(model, column_name)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_not_constant"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.394308}, "macro.dbt_utils.default__test_not_constant": {"unique_id": "macro.dbt_utils.default__test_not_constant", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/not_constant.sql", "original_file_path": "macros/generic_tests/not_constant.sql", "name": "default__test_not_constant", "macro_sql": "{% macro default__test_not_constant(model, column_name) %}\n\n\nselect\n {# In TSQL, subquery aggregate columns need aliases #}\n {# thus: a filler col name, 'filler_column' #}\n count(distinct {{ column_name }}) as filler_column\n\nfrom {{ model }}\n\nhaving count(distinct {{ column_name }}) = 1\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.3948438}, "macro.dbt_utils.test_accepted_range": {"unique_id": "macro.dbt_utils.test_accepted_range", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/accepted_range.sql", "original_file_path": "macros/generic_tests/accepted_range.sql", "name": "test_accepted_range", "macro_sql": "{% test accepted_range(model, column_name, min_value=none, max_value=none, inclusive=true) %}\n {{ return(adapter.dispatch('test_accepted_range', 'dbt_utils')(model, column_name, min_value, max_value, inclusive)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_accepted_range"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.396745}, "macro.dbt_utils.default__test_accepted_range": {"unique_id": "macro.dbt_utils.default__test_accepted_range", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/accepted_range.sql", "original_file_path": "macros/generic_tests/accepted_range.sql", "name": "default__test_accepted_range", "macro_sql": "{% macro default__test_accepted_range(model, column_name, min_value=none, max_value=none, inclusive=true) %}\n\nwith meet_condition as(\n select *\n from {{ model }}\n),\n\nvalidation_errors as (\n select *\n from meet_condition\n where\n -- never true, defaults to an empty result set. Exists to ensure any combo of the `or` clauses below succeeds\n 1 = 2\n\n {%- if min_value is not none %}\n -- records with a value >= min_value are permitted. The `not` flips this to find records that don't meet the rule.\n or not {{ column_name }} > {{- \"=\" if inclusive }} {{ min_value }}\n {%- endif %}\n\n {%- if max_value is not none %}\n -- records with a value <= max_value are permitted. The `not` flips this to find records that don't meet the rule.\n or not {{ column_name }} < {{- \"=\" if inclusive }} {{ max_value }}\n {%- endif %}\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.398196}, "macro.dbt_utils.test_not_accepted_values": {"unique_id": "macro.dbt_utils.test_not_accepted_values", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/not_accepted_values.sql", "original_file_path": "macros/generic_tests/not_accepted_values.sql", "name": "test_not_accepted_values", "macro_sql": "{% test not_accepted_values(model, column_name, values, quote=True) %}\n {{ return(adapter.dispatch('test_not_accepted_values', 'dbt_utils')(model, column_name, values, quote)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_not_accepted_values"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.399682}, "macro.dbt_utils.default__test_not_accepted_values": {"unique_id": "macro.dbt_utils.default__test_not_accepted_values", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/not_accepted_values.sql", "original_file_path": "macros/generic_tests/not_accepted_values.sql", "name": "default__test_not_accepted_values", "macro_sql": "{% macro default__test_not_accepted_values(model, column_name, values, quote=True) %}\nwith all_values as (\n\n select distinct\n {{ column_name }} as value_field\n\n from {{ model }}\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field in (\n {% for value in values -%}\n {% if quote -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {%- endfor %}\n )\n\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.401016}, "macro.dbt_utils.test_unique_where": {"unique_id": "macro.dbt_utils.test_unique_where", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/test_unique_where.sql", "original_file_path": "macros/generic_tests/test_unique_where.sql", "name": "test_unique_where", "macro_sql": "{% test unique_where(model, column_name) %}\r\n {%- set deprecation_warning = '\r\n Warning: `dbt_utils.unique_where` is no longer supported.\r\n Starting in dbt v0.20.0, the built-in `unique` test supports a `where` config.\r\n ' -%}\r\n {%- do exceptions.warn(deprecation_warning) -%}\r\n {{ return(adapter.dispatch('test_unique_where', 'dbt_utils')(model, column_name)) }}\r\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_unique_where"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.403647}, "macro.dbt_utils.default__test_unique_where": {"unique_id": "macro.dbt_utils.default__test_unique_where", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/test_unique_where.sql", "original_file_path": "macros/generic_tests/test_unique_where.sql", "name": "default__test_unique_where", "macro_sql": "{% macro default__test_unique_where(model, column_name) %}\r\n {{ return(test_unique(model, column_name)) }}\r\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.test_unique"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.404181}, "macro.dbt_utils.test_at_least_one": {"unique_id": "macro.dbt_utils.test_at_least_one", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/at_least_one.sql", "original_file_path": "macros/generic_tests/at_least_one.sql", "name": "test_at_least_one", "macro_sql": "{% test at_least_one(model, column_name) %}\n {{ return(adapter.dispatch('test_at_least_one', 'dbt_utils')(model, column_name)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_at_least_one"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.405217}, "macro.dbt_utils.default__test_at_least_one": {"unique_id": "macro.dbt_utils.default__test_at_least_one", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/at_least_one.sql", "original_file_path": "macros/generic_tests/at_least_one.sql", "name": "default__test_at_least_one", "macro_sql": "{% macro default__test_at_least_one(model, column_name) %}\n\nselect *\nfrom (\n select\n {# In TSQL, subquery aggregate columns need aliases #}\n {# thus: a filler col name, 'filler_column' #}\n count({{ column_name }}) as filler_column\n\n from {{ model }}\n\n having count({{ column_name }}) = 0\n\n) validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.40572}, "macro.dbt_utils.test_unique_combination_of_columns": {"unique_id": "macro.dbt_utils.test_unique_combination_of_columns", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/unique_combination_of_columns.sql", "original_file_path": "macros/generic_tests/unique_combination_of_columns.sql", "name": "test_unique_combination_of_columns", "macro_sql": "{% test unique_combination_of_columns(model, combination_of_columns, quote_columns=false) %}\n {{ return(adapter.dispatch('test_unique_combination_of_columns', 'dbt_utils')(model, combination_of_columns, quote_columns)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_unique_combination_of_columns"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.407243}, "macro.dbt_utils.default__test_unique_combination_of_columns": {"unique_id": "macro.dbt_utils.default__test_unique_combination_of_columns", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/unique_combination_of_columns.sql", "original_file_path": "macros/generic_tests/unique_combination_of_columns.sql", "name": "default__test_unique_combination_of_columns", "macro_sql": "{% macro default__test_unique_combination_of_columns(model, combination_of_columns, quote_columns=false) %}\n\n{% if not quote_columns %}\n {%- set column_list=combination_of_columns %}\n{% elif quote_columns %}\n {%- set column_list=[] %}\n {% for column in combination_of_columns -%}\n {% set column_list = column_list.append( adapter.quote(column) ) %}\n {%- endfor %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`quote_columns` argument for unique_combination_of_columns test must be one of [True, False] Got: '\" ~ quote ~\"'.'\"\n ) }}\n{% endif %}\n\n{%- set columns_csv=column_list | join(', ') %}\n\n\nwith validation_errors as (\n\n select\n {{ columns_csv }}\n from {{ model }}\n group by {{ columns_csv }}\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.409055}, "macro.dbt_utils.test_cardinality_equality": {"unique_id": "macro.dbt_utils.test_cardinality_equality", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/cardinality_equality.sql", "original_file_path": "macros/generic_tests/cardinality_equality.sql", "name": "test_cardinality_equality", "macro_sql": "{% test cardinality_equality(model, column_name, to, field) %}\n {{ return(adapter.dispatch('test_cardinality_equality', 'dbt_utils')(model, column_name, to, field)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_cardinality_equality"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.410665}, "macro.dbt_utils.default__test_cardinality_equality": {"unique_id": "macro.dbt_utils.default__test_cardinality_equality", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/cardinality_equality.sql", "original_file_path": "macros/generic_tests/cardinality_equality.sql", "name": "default__test_cardinality_equality", "macro_sql": "{% macro default__test_cardinality_equality(model, column_name, to, field) %}\n\n{# T-SQL does not let you use numbers as aliases for columns #}\n{# Thus, no \"GROUP BY 1\" #}\n\nwith table_a as (\nselect\n {{ column_name }},\n count(*) as num_rows\nfrom {{ model }}\ngroup by {{ column_name }}\n),\n\ntable_b as (\nselect\n {{ field }},\n count(*) as num_rows\nfrom {{ to }}\ngroup by {{ field }}\n),\n\nexcept_a as (\n select *\n from table_a\n {{ dbt_utils.except() }}\n select *\n from table_b\n),\n\nexcept_b as (\n select *\n from table_b\n {{ dbt_utils.except() }}\n select *\n from table_a\n),\n\nunioned as (\n select *\n from except_a\n union all\n select *\n from except_b\n)\n\nselect *\nfrom unioned\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.except"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.411595}, "macro.dbt_utils.test_expression_is_true": {"unique_id": "macro.dbt_utils.test_expression_is_true", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/expression_is_true.sql", "original_file_path": "macros/generic_tests/expression_is_true.sql", "name": "test_expression_is_true", "macro_sql": "{% test expression_is_true(model, expression, column_name=None, condition='1=1') %}\n{# T-SQL has no boolean data type so we use 1=1 which returns TRUE #}\n{# ref https://stackoverflow.com/a/7170753/3842610 #}\n {{ return(adapter.dispatch('test_expression_is_true', 'dbt_utils')(model, expression, column_name, condition)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.4130628}, "macro.dbt_utils.default__test_expression_is_true": {"unique_id": "macro.dbt_utils.default__test_expression_is_true", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/expression_is_true.sql", "original_file_path": "macros/generic_tests/expression_is_true.sql", "name": "default__test_expression_is_true", "macro_sql": "{% macro default__test_expression_is_true(model, expression, column_name, condition) %}\n\nwith meet_condition as (\n select * from {{ model }} where {{ condition }}\n)\n\nselect\n *\nfrom meet_condition\n{% if column_name is none %}\nwhere not({{ expression }})\n{%- else %}\nwhere not({{ column_name }} {{ expression }})\n{%- endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.4139771}, "macro.dbt_utils.test_not_null_proportion": {"unique_id": "macro.dbt_utils.test_not_null_proportion", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/not_null_proportion.sql", "original_file_path": "macros/generic_tests/not_null_proportion.sql", "name": "test_not_null_proportion", "macro_sql": "{% macro test_not_null_proportion(model) %}\n {{ return(adapter.dispatch('test_not_null_proportion', 'dbt_utils')(model, **kwargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_not_null_proportion"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.4152489}, "macro.dbt_utils.default__test_not_null_proportion": {"unique_id": "macro.dbt_utils.default__test_not_null_proportion", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/not_null_proportion.sql", "original_file_path": "macros/generic_tests/not_null_proportion.sql", "name": "default__test_not_null_proportion", "macro_sql": "{% macro default__test_not_null_proportion(model) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}\n{% set at_least = kwargs.get('at_least', kwargs.get('arg')) %}\n{% set at_most = kwargs.get('at_most', kwargs.get('arg', 1)) %}\n\nwith validation as (\n select\n sum(case when {{ column_name }} is null then 0 else 1 end) / cast(count(*) as numeric) as not_null_proportion\n from {{ model }}\n),\nvalidation_errors as (\n select\n not_null_proportion\n from validation\n where not_null_proportion < {{ at_least }} or not_null_proportion > {{ at_most }}\n)\nselect\n *\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.4174662}, "macro.dbt_utils.test_sequential_values": {"unique_id": "macro.dbt_utils.test_sequential_values", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/sequential_values.sql", "original_file_path": "macros/generic_tests/sequential_values.sql", "name": "test_sequential_values", "macro_sql": "{% test sequential_values(model, column_name, interval=1, datepart=None) %}\n\n {{ return(adapter.dispatch('test_sequential_values', 'dbt_utils')(model, column_name, interval, datepart)) }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_sequential_values"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.4197881}, "macro.dbt_utils.default__test_sequential_values": {"unique_id": "macro.dbt_utils.default__test_sequential_values", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/sequential_values.sql", "original_file_path": "macros/generic_tests/sequential_values.sql", "name": "default__test_sequential_values", "macro_sql": "{% macro default__test_sequential_values(model, column_name, interval=1, datepart=None) %}\n\n{% set previous_column_name = \"previous_\" ~ dbt_utils.slugify(column_name) %}\n\nwith windowed as (\n\n select\n {{ column_name }},\n lag({{ column_name }}) over (\n order by {{ column_name }}\n ) as {{ previous_column_name }}\n from {{ model }}\n),\n\nvalidation_errors as (\n select\n *\n from windowed\n {% if datepart %}\n where not(cast({{ column_name }} as {{ dbt_utils.type_timestamp() }})= cast({{ dbt_utils.dateadd(datepart, interval, previous_column_name) }} as {{ dbt_utils.type_timestamp() }}))\n {% else %}\n where not({{ column_name }} = {{ previous_column_name }} + {{ interval }})\n {% endif %}\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.slugify", "macro.dbt_utils.type_timestamp", "macro.dbt_utils.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.421862}, "macro.dbt_utils.test_not_null_where": {"unique_id": "macro.dbt_utils.test_not_null_where", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/test_not_null_where.sql", "original_file_path": "macros/generic_tests/test_not_null_where.sql", "name": "test_not_null_where", "macro_sql": "{% test not_null_where(model, column_name) %}\r\n {%- set deprecation_warning = '\r\n Warning: `dbt_utils.not_null_where` is no longer supported.\r\n Starting in dbt v0.20.0, the built-in `not_null` test supports a `where` config.\r\n ' -%}\r\n {%- do exceptions.warn(deprecation_warning) -%}\r\n {{ return(adapter.dispatch('test_not_null_where', 'dbt_utils')(model, column_name)) }}\r\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_not_null_where"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.423708}, "macro.dbt_utils.default__test_not_null_where": {"unique_id": "macro.dbt_utils.default__test_not_null_where", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/test_not_null_where.sql", "original_file_path": "macros/generic_tests/test_not_null_where.sql", "name": "default__test_not_null_where", "macro_sql": "{% macro default__test_not_null_where(model, column_name) %}\r\n {{ return(test_not_null(model, column_name)) }}\r\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.test_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.424621}, "macro.dbt_utils.test_equality": {"unique_id": "macro.dbt_utils.test_equality", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/equality.sql", "original_file_path": "macros/generic_tests/equality.sql", "name": "test_equality", "macro_sql": "{% test equality(model, compare_model, compare_columns=None) %}\n {{ return(adapter.dispatch('test_equality', 'dbt_utils')(model, compare_model, compare_columns)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_equality"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.427901}, "macro.dbt_utils.default__test_equality": {"unique_id": "macro.dbt_utils.default__test_equality", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/equality.sql", "original_file_path": "macros/generic_tests/equality.sql", "name": "default__test_equality", "macro_sql": "{% macro default__test_equality(model, compare_model, compare_columns=None) %}\n\n{% set set_diff %}\n count(*) + coalesce(abs(\n sum(case when which_diff = 'a_minus_b' then 1 else 0 end) -\n sum(case when which_diff = 'b_minus_a' then 1 else 0 end)\n ), 0)\n{% endset %}\n\n{#-- Needs to be set at parse time, before we return '' below --#}\n{{ config(fail_calc = set_diff) }}\n\n{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n{%- if not execute -%}\n {{ return('') }}\n{% endif %}\n\n-- setup\n{%- do dbt_utils._is_relation(model, 'test_equality') -%}\n\n{#-\nIf the compare_cols arg is provided, we can run this test without querying the\ninformation schema\u00a0\u2014 this allows the model to be an ephemeral model\n-#}\n\n{%- if not compare_columns -%}\n {%- do dbt_utils._is_ephemeral(model, 'test_equality') -%}\n {%- set compare_columns = adapter.get_columns_in_relation(model) | map(attribute='quoted') -%}\n{%- endif -%}\n\n{% set compare_cols_csv = compare_columns | join(', ') %}\n\nwith a as (\n\n select * from {{ model }}\n\n),\n\nb as (\n\n select * from {{ compare_model }}\n\n),\n\na_minus_b as (\n\n select {{compare_cols_csv}} from a\n {{ dbt_utils.except() }}\n select {{compare_cols_csv}} from b\n\n),\n\nb_minus_a as (\n\n select {{compare_cols_csv}} from b\n {{ dbt_utils.except() }}\n select {{compare_cols_csv}} from a\n\n),\n\nunioned as (\n\n select 'a_minus_b' as which_diff, a_minus_b.* from a_minus_b\n union all\n select 'b_minus_a' as which_diff, b_minus_a.* from b_minus_a\n\n)\n\nselect * from unioned\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.except"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.430897}, "macro.dbt_utils.test_mutually_exclusive_ranges": {"unique_id": "macro.dbt_utils.test_mutually_exclusive_ranges", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/mutually_exclusive_ranges.sql", "original_file_path": "macros/generic_tests/mutually_exclusive_ranges.sql", "name": "test_mutually_exclusive_ranges", "macro_sql": "{% test mutually_exclusive_ranges(model, lower_bound_column, upper_bound_column, partition_by=None, gaps='allowed', zero_length_range_allowed=False) %}\n {{ return(adapter.dispatch('test_mutually_exclusive_ranges', 'dbt_utils')(model, lower_bound_column, upper_bound_column, partition_by, gaps, zero_length_range_allowed)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_mutually_exclusive_ranges"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.437928}, "macro.dbt_utils.default__test_mutually_exclusive_ranges": {"unique_id": "macro.dbt_utils.default__test_mutually_exclusive_ranges", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/mutually_exclusive_ranges.sql", "original_file_path": "macros/generic_tests/mutually_exclusive_ranges.sql", "name": "default__test_mutually_exclusive_ranges", "macro_sql": "{% macro default__test_mutually_exclusive_ranges(model, lower_bound_column, upper_bound_column, partition_by=None, gaps='allowed', zero_length_range_allowed=False) %}\n{% if gaps == 'not_allowed' %}\n {% set allow_gaps_operator='=' %}\n {% set allow_gaps_operator_in_words='equal_to' %}\n{% elif gaps == 'allowed' %}\n {% set allow_gaps_operator='<=' %}\n {% set allow_gaps_operator_in_words='less_than_or_equal_to' %}\n{% elif gaps == 'required' %}\n {% set allow_gaps_operator='<' %}\n {% set allow_gaps_operator_in_words='less_than' %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`gaps` argument for mutually_exclusive_ranges test must be one of ['not_allowed', 'allowed', 'required'] Got: '\" ~ gaps ~\"'.'\"\n ) }}\n{% endif %}\n{% if not zero_length_range_allowed %}\n {% set allow_zero_length_operator='<' %}\n {% set allow_zero_length_operator_in_words='less_than' %}\n{% elif zero_length_range_allowed %}\n {% set allow_zero_length_operator='<=' %}\n {% set allow_zero_length_operator_in_words='less_than_or_equal_to' %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`zero_length_range_allowed` argument for mutually_exclusive_ranges test must be one of [true, false] Got: '\" ~ zero_length_range_allowed ~\"'.'\"\n ) }}\n{% endif %}\n\n{% set partition_clause=\"partition by \" ~ partition_by if partition_by else '' %}\n\nwith window_functions as (\n\n select\n {% if partition_by %}\n {{ partition_by }} as partition_by_col,\n {% endif %}\n {{ lower_bound_column }} as lower_bound,\n {{ upper_bound_column }} as upper_bound,\n\n lead({{ lower_bound_column }}) over (\n {{ partition_clause }}\n order by {{ lower_bound_column }}\n ) as next_lower_bound,\n\n row_number() over (\n {{ partition_clause }}\n order by {{ lower_bound_column }} desc\n ) = 1 as is_last_record\n\n from {{ model }}\n\n),\n\ncalc as (\n -- We want to return records where one of our assumptions fails, so we'll use\n -- the `not` function with `and` statements so we can write our assumptions nore cleanly\n select\n *,\n\n -- For each record: lower_bound should be < upper_bound.\n -- Coalesce it to return an error on the null case (implicit assumption\n -- these columns are not_null)\n coalesce(\n lower_bound {{ allow_zero_length_operator }} upper_bound,\n false\n ) as lower_bound_{{ allow_zero_length_operator_in_words }}_upper_bound,\n\n -- For each record: upper_bound {{ allow_gaps_operator }} the next lower_bound.\n -- Coalesce it to handle null cases for the last record.\n coalesce(\n upper_bound {{ allow_gaps_operator }} next_lower_bound,\n is_last_record,\n false\n ) as upper_bound_{{ allow_gaps_operator_in_words }}_next_lower_bound\n\n from window_functions\n\n),\n\nvalidation_errors as (\n\n select\n *\n from calc\n\n where not(\n -- THE FOLLOWING SHOULD BE TRUE --\n lower_bound_{{ allow_zero_length_operator_in_words }}_upper_bound\n and upper_bound_{{ allow_gaps_operator_in_words }}_next_lower_bound\n )\n)\n\nselect * from validation_errors\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.4421492}, "macro.dbt_utils.pretty_log_format": {"unique_id": "macro.dbt_utils.pretty_log_format", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_log_format.sql", "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", "name": "pretty_log_format", "macro_sql": "{% macro pretty_log_format(message) %}\n {{ return(adapter.dispatch('pretty_log_format', 'dbt_utils')(message)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__pretty_log_format"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.44335}, "macro.dbt_utils.default__pretty_log_format": {"unique_id": "macro.dbt_utils.default__pretty_log_format", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_log_format.sql", "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", "name": "default__pretty_log_format", "macro_sql": "{% macro default__pretty_log_format(message) %}\n {{ return( dbt_utils.pretty_time() ~ ' + ' ~ message) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.pretty_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.4440541}, "macro.dbt_utils.pretty_time": {"unique_id": "macro.dbt_utils.pretty_time", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_time.sql", "original_file_path": "macros/jinja_helpers/pretty_time.sql", "name": "pretty_time", "macro_sql": "{% macro pretty_time(format='%H:%M:%S') %}\n {{ return(adapter.dispatch('pretty_time', 'dbt_utils')(format)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__pretty_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.44515}, "macro.dbt_utils.default__pretty_time": {"unique_id": "macro.dbt_utils.default__pretty_time", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_time.sql", "original_file_path": "macros/jinja_helpers/pretty_time.sql", "name": "default__pretty_time", "macro_sql": "{% macro default__pretty_time(format='%H:%M:%S') %}\n {{ return(modules.datetime.datetime.now().strftime(format)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.4456909}, "macro.dbt_utils.log_info": {"unique_id": "macro.dbt_utils.log_info", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/log_info.sql", "original_file_path": "macros/jinja_helpers/log_info.sql", "name": "log_info", "macro_sql": "{% macro log_info(message) %}\n {{ return(adapter.dispatch('log_info', 'dbt_utils')(message)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__log_info"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.4465559}, "macro.dbt_utils.default__log_info": {"unique_id": "macro.dbt_utils.default__log_info", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/log_info.sql", "original_file_path": "macros/jinja_helpers/log_info.sql", "name": "default__log_info", "macro_sql": "{% macro default__log_info(message) %}\n {{ log(dbt_utils.pretty_log_format(message), info=True) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.pretty_log_format"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.447131}, "macro.dbt_utils.slugify": {"unique_id": "macro.dbt_utils.slugify", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/slugify.sql", "original_file_path": "macros/jinja_helpers/slugify.sql", "name": "slugify", "macro_sql": "{% macro slugify(string) %}\n\n{#- Lower case the string -#}\n{% set string = string | lower %}\n{#- Replace spaces and dashes with underscores -#}\n{% set string = modules.re.sub('[ -]+', '_', string) %}\n{#- Only take letters, numbers, and underscores -#}\n{% set string = modules.re.sub('[^a-z0-9_]+', '', string) %}\n\n{{ return(string) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.448692}, "macro.dbt_utils.get_intervals_between": {"unique_id": "macro.dbt_utils.get_intervals_between", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "get_intervals_between", "macro_sql": "{% macro get_intervals_between(start_date, end_date, datepart) -%}\n {{ return(adapter.dispatch('get_intervals_between', 'dbt_utils')(start_date, end_date, datepart)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_intervals_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.450985}, "macro.dbt_utils.default__get_intervals_between": {"unique_id": "macro.dbt_utils.default__get_intervals_between", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "default__get_intervals_between", "macro_sql": "{% macro default__get_intervals_between(start_date, end_date, datepart) -%}\n {%- call statement('get_intervals_between', fetch_result=True) %}\n\n select {{dbt_utils.datediff(start_date, end_date, datepart)}}\n\n {%- endcall -%}\n\n {%- set value_list = load_result('get_intervals_between') -%}\n\n {%- if value_list and value_list['data'] -%}\n {%- set values = value_list['data'] | map(attribute=0) | list %}\n {{ return(values[0]) }}\n {%- else -%}\n {{ return(1) }}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.452853}, "macro.dbt_utils.date_spine": {"unique_id": "macro.dbt_utils.date_spine", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "date_spine", "macro_sql": "{% macro date_spine(datepart, start_date, end_date) %}\n {{ return(adapter.dispatch('date_spine', 'dbt_utils')(datepart, start_date, end_date)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__date_spine"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.454018}, "macro.dbt_utils.default__date_spine": {"unique_id": "macro.dbt_utils.default__date_spine", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "default__date_spine", "macro_sql": "{% macro default__date_spine(datepart, start_date, end_date) %}\n\n\n{# call as follows:\n\ndate_spine(\n \"day\",\n \"to_date('01/01/2016', 'mm/dd/yyyy')\",\n \"dateadd(week, 1, current_date)\"\n) #}\n\n\nwith rawdata as (\n\n {{dbt_utils.generate_series(\n dbt_utils.get_intervals_between(start_date, end_date, datepart)\n )}}\n\n),\n\nall_periods as (\n\n select (\n {{\n dbt_utils.dateadd(\n datepart,\n \"row_number() over (order by 1) - 1\",\n start_date\n )\n }}\n ) as date_{{datepart}}\n from rawdata\n\n),\n\nfiltered as (\n\n select *\n from all_periods\n where date_{{datepart}} <= {{ end_date }}\n\n)\n\nselect * from filtered\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.generate_series", "macro.dbt_utils.get_intervals_between", "macro.dbt_utils.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.455335}, "macro.dbt_utils.nullcheck_table": {"unique_id": "macro.dbt_utils.nullcheck_table", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "name": "nullcheck_table", "macro_sql": "{% macro nullcheck_table(relation) %}\n {{ return(adapter.dispatch('nullcheck_table', 'dbt_utils')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__nullcheck_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.456583}, "macro.dbt_utils.default__nullcheck_table": {"unique_id": "macro.dbt_utils.default__nullcheck_table", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "name": "default__nullcheck_table", "macro_sql": "{% macro default__nullcheck_table(relation) %}\n\n {%- do dbt_utils._is_relation(relation, 'nullcheck_table') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'nullcheck_table') -%}\n {% set cols = adapter.get_columns_in_relation(relation) %}\n\n select {{ dbt_utils.nullcheck(cols) }}\n from {{relation}}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.nullcheck"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.4580429}, "macro.dbt_utils.get_relations_by_pattern": {"unique_id": "macro.dbt_utils.get_relations_by_pattern", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "name": "get_relations_by_pattern", "macro_sql": "{% macro get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_relations_by_pattern', 'dbt_utils')(schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.459852}, "macro.dbt_utils.default__get_relations_by_pattern": {"unique_id": "macro.dbt_utils.default__get_relations_by_pattern", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "name": "default__get_relations_by_pattern", "macro_sql": "{% macro default__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n {{ dbt_utils.get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude, database) }}\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=database,\n schema=row.table_schema,\n identifier=row.table_name,\n type=row.table_type\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.462634}, "macro.dbt_utils.get_powers_of_two": {"unique_id": "macro.dbt_utils.get_powers_of_two", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "get_powers_of_two", "macro_sql": "{% macro get_powers_of_two(upper_bound) %}\n {{ return(adapter.dispatch('get_powers_of_two', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.464576}, "macro.dbt_utils.default__get_powers_of_two": {"unique_id": "macro.dbt_utils.default__get_powers_of_two", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "default__get_powers_of_two", "macro_sql": "{% macro default__get_powers_of_two(upper_bound) %}\n\n {% if upper_bound <= 0 %}\n {{ exceptions.raise_compiler_error(\"upper bound must be positive\") }}\n {% endif %}\n\n {% for _ in range(1, 100) %}\n {% if upper_bound <= 2 ** loop.index %}{{ return(loop.index) }}{% endif %}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.465824}, "macro.dbt_utils.generate_series": {"unique_id": "macro.dbt_utils.generate_series", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "generate_series", "macro_sql": "{% macro generate_series(upper_bound) %}\n {{ return(adapter.dispatch('generate_series', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__generate_series"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.466347}, "macro.dbt_utils.default__generate_series": {"unique_id": "macro.dbt_utils.default__generate_series", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "default__generate_series", "macro_sql": "{% macro default__generate_series(upper_bound) %}\n\n {% set n = dbt_utils.get_powers_of_two(upper_bound) %}\n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n {% for i in range(n) %}\n p{{i}}.generated_number * power(2, {{i}})\n {% if not loop.last %} + {% endif %}\n {% endfor %}\n + 1\n as generated_number\n\n from\n\n {% for i in range(n) %}\n p as p{{i}}\n {% if not loop.last %} cross join {% endif %}\n {% endfor %}\n\n )\n\n select *\n from unioned\n where generated_number <= {{upper_bound}}\n order by generated_number\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.4677482}, "macro.dbt_utils.get_relations_by_prefix": {"unique_id": "macro.dbt_utils.get_relations_by_prefix", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "name": "get_relations_by_prefix", "macro_sql": "{% macro get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_relations_by_prefix', 'dbt_utils')(schema, prefix, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_relations_by_prefix"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.469434}, "macro.dbt_utils.default__get_relations_by_prefix": {"unique_id": "macro.dbt_utils.default__get_relations_by_prefix", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "name": "default__get_relations_by_prefix", "macro_sql": "{% macro default__get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n {{ dbt_utils.get_tables_by_prefix_sql(schema, prefix, exclude, database) }}\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=database,\n schema=row.table_schema,\n identifier=row.table_name,\n type=row.table_type\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.get_tables_by_prefix_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.471682}, "macro.dbt_utils.get_tables_by_prefix_sql": {"unique_id": "macro.dbt_utils.get_tables_by_prefix_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "name": "get_tables_by_prefix_sql", "macro_sql": "{% macro get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_tables_by_prefix_sql', 'dbt_utils')(schema, prefix, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_tables_by_prefix_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.472878}, "macro.dbt_utils.default__get_tables_by_prefix_sql": {"unique_id": "macro.dbt_utils.default__get_tables_by_prefix_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "name": "default__get_tables_by_prefix_sql", "macro_sql": "{% macro default__get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n\n {{ dbt_utils.get_tables_by_pattern_sql(\n schema_pattern = schema,\n table_pattern = prefix ~ '%',\n exclude = exclude,\n database = database\n ) }}\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.4736278}, "macro.dbt_utils.star": {"unique_id": "macro.dbt_utils.star", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "name": "star", "macro_sql": "{% macro star(from, relation_alias=False, except=[], prefix='', suffix='') -%}\n {{ return(adapter.dispatch('star', 'dbt_utils')(from, relation_alias, except, prefix, suffix)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__star"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.475368}, "macro.dbt_utils.default__star": {"unique_id": "macro.dbt_utils.default__star", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "name": "default__star", "macro_sql": "{% macro default__star(from, relation_alias=False, except=[], prefix='', suffix='') -%}\n {%- do dbt_utils._is_relation(from, 'star') -%}\n {%- do dbt_utils._is_ephemeral(from, 'star') -%}\n\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {{ return('*') }}\n {% endif %}\n\n {% set cols = dbt_utils.get_filtered_columns_in_relation(from, except) %}\n\n {%- if cols|length <= 0 -%}\n {{- return('*') -}}\n {%- else -%}\n {%- for col in cols %}\n {%- if relation_alias %}{{ relation_alias }}.{% else %}{%- endif -%}{{ adapter.quote(col)|trim }} {%- if prefix!='' or suffix!='' %} as {{ adapter.quote(prefix ~ col ~ suffix)|trim }} {%- endif -%}\n {%- if not loop.last %},{{ '\\n ' }}{% endif %}\n {%- endfor -%}\n {% endif %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.get_filtered_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.477987}, "macro.dbt_utils.unpivot": {"unique_id": "macro.dbt_utils.unpivot", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "name": "unpivot", "macro_sql": "{% macro unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value', table=none) -%}\n {{ return(adapter.dispatch('unpivot', 'dbt_utils')(relation, cast_to, exclude, remove, field_name, value_name, table)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__unpivot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.481627}, "macro.dbt_utils.default__unpivot": {"unique_id": "macro.dbt_utils.default__unpivot", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "name": "default__unpivot", "macro_sql": "{% macro default__unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value', table=none) -%}\n\n {% if table %}\n {%- set error_message = '\n Warning: the `unpivot` macro no longer accepts a `table` parameter. \\\n This parameter will be deprecated in a future release of dbt-utils. Use the `relation` parameter instead. \\\n The {}.{} model triggered this warning. \\\n '.format(model.package_name, model.name) -%}\n {%- do exceptions.warn(error_message) -%}\n {% endif %}\n\n {% if relation and table %}\n {{ exceptions.raise_compiler_error(\"Error: both the `relation` and `table` parameters were provided to `unpivot` macro. Choose one only (we recommend `relation`).\") }}\n {% elif not relation and table %}\n {% set relation=table %}\n {% elif not relation and not table %}\n {{ exceptions.raise_compiler_error(\"Error: argument `relation` is required for `unpivot` macro.\") }}\n {% endif %}\n\n {%- set exclude = exclude if exclude is not none else [] %}\n {%- set remove = remove if remove is not none else [] %}\n\n {%- set include_cols = [] %}\n\n {%- set table_columns = {} %}\n\n {%- do table_columns.update({relation: []}) %}\n\n {%- do dbt_utils._is_relation(relation, 'unpivot') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'unpivot') -%}\n {%- set cols = adapter.get_columns_in_relation(relation) %}\n\n {%- for col in cols -%}\n {%- if col.column.lower() not in remove|map('lower') and col.column.lower() not in exclude|map('lower') -%}\n {% do include_cols.append(col) %}\n {%- endif %}\n {%- endfor %}\n\n\n {%- for col in include_cols -%}\n select\n {%- for exclude_col in exclude %}\n {{ exclude_col }},\n {%- endfor %}\n\n cast('{{ col.column }}' as {{ dbt_utils.type_string() }}) as {{ field_name }},\n cast( {% if col.data_type == 'boolean' %}\n {{ dbt_utils.cast_bool_to_text(col.column) }}\n {% else %}\n {{ col.column }}\n {% endif %}\n as {{ cast_to }}) as {{ value_name }}\n\n from {{ relation }}\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n {%- endfor -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.type_string", "macro.dbt_utils.cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.487097}, "macro.dbt_utils.union_relations": {"unique_id": "macro.dbt_utils.union_relations", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "name": "union_relations", "macro_sql": "{%- macro union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation', where=none) -%}\n {{ return(adapter.dispatch('union_relations', 'dbt_utils')(relations, column_override, include, exclude, source_column_name, where)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__union_relations"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.493441}, "macro.dbt_utils.default__union_relations": {"unique_id": "macro.dbt_utils.default__union_relations", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "name": "default__union_relations", "macro_sql": "\n\n{%- macro default__union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation', where=none) -%}\n\n {%- if exclude and include -%}\n {{ exceptions.raise_compiler_error(\"Both an exclude and include list were provided to the `union` macro. Only one is allowed\") }}\n {%- endif -%}\n\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. -#}\n {%- if not execute %}\n {{ return('') }}\n {% endif -%}\n\n {%- set column_override = column_override if column_override is not none else {} -%}\n\n {%- set relation_columns = {} -%}\n {%- set column_superset = {} -%}\n\n {%- for relation in relations -%}\n\n {%- do relation_columns.update({relation: []}) -%}\n\n {%- do dbt_utils._is_relation(relation, 'union_relations') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'union_relations') -%}\n {%- set cols = adapter.get_columns_in_relation(relation) -%}\n {%- for col in cols -%}\n\n {#- If an exclude list was provided and the column is in the list, do nothing -#}\n {%- if exclude and col.column in exclude -%}\n\n {#- If an include list was provided and the column is not in the list, do nothing -#}\n {%- elif include and col.column not in include -%}\n\n {#- Otherwise add the column to the column superset -#}\n {%- else -%}\n\n {#- update the list of columns in this relation -#}\n {%- do relation_columns[relation].append(col.column) -%}\n\n {%- if col.column in column_superset -%}\n\n {%- set stored = column_superset[col.column] -%}\n {%- if col.is_string() and stored.is_string() and col.string_size() > stored.string_size() -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif %}\n\n {%- else -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif -%}\n\n {%- endif -%}\n\n {%- endfor -%}\n {%- endfor -%}\n\n {%- set ordered_column_names = column_superset.keys() -%}\n {%- set dbt_command = flags.WHICH -%}\n\n\n {% if dbt_command in ['run', 'build'] %}\n {% if (include | length > 0 or exclude | length > 0) and not column_superset.keys() %}\n {%- set relations_string -%}\n {%- for relation in relations -%}\n {{ relation.name }}\n {%- if not loop.last %}, {% endif -%}\n {%- endfor -%}\n {%- endset -%}\n\n {%- set error_message -%}\n There were no columns found to union for relations {{ relations_string }}\n {%- endset -%}\n\n {{ exceptions.raise_compiler_error(error_message) }}\n {%- endif -%}\n {%- endif -%}\n\n {%- for relation in relations %}\n\n (\n select\n\n cast({{ dbt_utils.string_literal(relation) }} as {{ dbt_utils.type_string() }}) as {{ source_column_name }},\n {% for col_name in ordered_column_names -%}\n\n {%- set col = column_superset[col_name] %}\n {%- set col_type = column_override.get(col.column, col.data_type) %}\n {%- set col_name = adapter.quote(col_name) if col_name in relation_columns[relation] else 'null' %}\n cast({{ col_name }} as {{ col_type }}) as {{ col.quoted }} {% if not loop.last %},{% endif -%}\n\n {%- endfor %}\n\n from {{ relation }}\n\n {% if where -%}\n where {{ where }}\n {%- endif %}\n )\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n\n {%- endfor -%}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.string_literal", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.503598}, "macro.dbt_utils.group_by": {"unique_id": "macro.dbt_utils.group_by", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "name": "group_by", "macro_sql": "{%- macro group_by(n) -%}\n {{ return(adapter.dispatch('group_by', 'dbt_utils')(n)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__group_by"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.504651}, "macro.dbt_utils.default__group_by": {"unique_id": "macro.dbt_utils.default__group_by", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "name": "default__group_by", "macro_sql": "\n\n{%- macro default__group_by(n) -%}\n\n group by {% for i in range(1, n + 1) -%}\n {{ i }}{{ ',' if not loop.last }} \n {%- endfor -%}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.5053282}, "macro.dbt_utils.deduplicate": {"unique_id": "macro.dbt_utils.deduplicate", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "name": "deduplicate", "macro_sql": "{%- macro deduplicate(relation, partition_by, order_by=none, relation_alias=none) -%}\n\n {%- set error_message_group_by -%}\nWarning: the `group_by` parameter of the `deduplicate` macro is no longer supported and will be deprecated in a future release of dbt-utils.\nUse `partition_by` instead.\nThe {{ model.package_name }}.{{ model.name }} model triggered this warning.\n {%- endset -%}\n\n {% if kwargs.get('group_by') %}\n {%- do exceptions.warn(error_message_group_by) -%}\n {%- endif -%}\n\n {%- set error_message_order_by -%}\nWarning: `order_by` as an optional parameter of the `deduplicate` macro is no longer supported and will be deprecated in a future release of dbt-utils.\nSupply a non-null value for `order_by` instead.\nThe {{ model.package_name }}.{{ model.name }} model triggered this warning.\n {%- endset -%}\n\n {% if not order_by %}\n {%- do exceptions.warn(error_message_order_by) -%}\n {%- endif -%}\n\n {%- set error_message_alias -%}\nWarning: the `relation_alias` parameter of the `deduplicate` macro is no longer supported and will be deprecated in a future release of dbt-utils.\nIf you were using `relation_alias` to point to a CTE previously then you can now pass the alias directly to `relation` instead.\nThe {{ model.package_name }}.{{ model.name }} model triggered this warning.\n {%- endset -%}\n\n {% if relation_alias %}\n {%- do exceptions.warn(error_message_alias) -%}\n {%- endif -%}\n\n {% set partition_by = partition_by or kwargs.get('group_by') %}\n {% set relation = relation_alias or relation %}\n {% set order_by = order_by or \"'1'\" %}\n\n {{ return(adapter.dispatch('deduplicate', 'dbt_utils')(relation, partition_by, order_by)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__deduplicate"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.5111392}, "macro.dbt_utils.default__deduplicate": {"unique_id": "macro.dbt_utils.default__deduplicate", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "name": "default__deduplicate", "macro_sql": "\n\n{%- macro default__deduplicate(relation, partition_by, order_by) -%}\n\n with row_numbered as (\n select\n _inner.*,\n row_number() over (\n partition by {{ partition_by }}\n order by {{ order_by }}\n ) as rn\n from {{ relation }} as _inner\n )\n\n select\n distinct data.*\n from {{ relation }} as data\n {#\n -- Not all DBs will support natural joins but the ones that do include:\n -- Oracle, MySQL, SQLite, Redshift, Teradata, Materialize, Databricks\n -- Apache Spark, SingleStore, Vertica\n -- Those that do not appear to support natural joins include:\n -- SQLServer, Trino, Presto, Rockset, Athena\n #}\n natural join row_numbered\n where row_numbered.rn = 1\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.511758}, "macro.dbt_utils.redshift__deduplicate": {"unique_id": "macro.dbt_utils.redshift__deduplicate", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "name": "redshift__deduplicate", "macro_sql": "{% macro redshift__deduplicate(relation, partition_by, order_by) -%}\n\n {{ return(dbt_utils.default__deduplicate(relation, partition_by, order_by=order_by)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__deduplicate"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.512318}, "macro.dbt_utils.postgres__deduplicate": {"unique_id": "macro.dbt_utils.postgres__deduplicate", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "name": "postgres__deduplicate", "macro_sql": "\n{%- macro postgres__deduplicate(relation, partition_by, order_by) -%}\n\n select\n distinct on ({{ partition_by }}) *\n from {{ relation }}\n order by {{ partition_by }}{{ ',' ~ order_by }}\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.51289}, "macro.dbt_utils.snowflake__deduplicate": {"unique_id": "macro.dbt_utils.snowflake__deduplicate", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "name": "snowflake__deduplicate", "macro_sql": "\n{%- macro snowflake__deduplicate(relation, partition_by, order_by) -%}\n\n select *\n from {{ relation }}\n qualify\n row_number() over (\n partition by {{ partition_by }}\n order by {{ order_by }}\n ) = 1\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.5135748}, "macro.dbt_utils.bigquery__deduplicate": {"unique_id": "macro.dbt_utils.bigquery__deduplicate", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "name": "bigquery__deduplicate", "macro_sql": "\n{%- macro bigquery__deduplicate(relation, partition_by, order_by) -%}\n\n select unique.*\n from (\n select\n array_agg (\n original\n order by {{ order_by }}\n limit 1\n )[offset(0)] unique\n from {{ relation }} original\n group by {{ partition_by }}\n )\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.514087}, "macro.dbt_utils.surrogate_key": {"unique_id": "macro.dbt_utils.surrogate_key", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "name": "surrogate_key", "macro_sql": "{%- macro surrogate_key(field_list) -%}\n {# needed for safe_add to allow for non-keyword arguments see SO post #}\n {# https://stackoverflow.com/questions/13944751/args-kwargs-in-jinja2-macros #}\n {% set frustrating_jinja_feature = varargs %}\n {{ return(adapter.dispatch('surrogate_key', 'dbt_utils')(field_list, *varargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__surrogate_key"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.515969}, "macro.dbt_utils.default__surrogate_key": {"unique_id": "macro.dbt_utils.default__surrogate_key", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "name": "default__surrogate_key", "macro_sql": "\n\n{%- macro default__surrogate_key(field_list) -%}\n\n{%- if varargs|length >= 1 or field_list is string %}\n\n{%- set error_message = '\nWarning: the `surrogate_key` macro now takes a single list argument instead of \\\nmultiple string arguments. Support for multiple string arguments will be \\\ndeprecated in a future release of dbt-utils. The {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.warn(error_message) -%}\n\n{# first argument is not included in varargs, so add first element to field_list_xf #}\n{%- set field_list_xf = [field_list] -%}\n\n{%- for field in varargs %}\n{%- set _ = field_list_xf.append(field) -%}\n{%- endfor -%}\n\n{%- else -%}\n\n{# if using list, just set field_list_xf as field_list #}\n{%- set field_list_xf = field_list -%}\n\n{%- endif -%}\n\n\n{%- set fields = [] -%}\n\n{%- for field in field_list_xf -%}\n\n {%- set _ = fields.append(\n \"coalesce(cast(\" ~ field ~ \" as \" ~ dbt_utils.type_string() ~ \"), '')\"\n ) -%}\n\n {%- if not loop.last %}\n {%- set _ = fields.append(\"'-'\") -%}\n {%- endif -%}\n\n{%- endfor -%}\n\n{{dbt_utils.hash(dbt_utils.concat(fields))}}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string", "macro.dbt_utils.hash", "macro.dbt_utils.concat"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.518479}, "macro.dbt_utils.safe_add": {"unique_id": "macro.dbt_utils.safe_add", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "name": "safe_add", "macro_sql": "{%- macro safe_add() -%}\n {# needed for safe_add to allow for non-keyword arguments see SO post #}\n {# https://stackoverflow.com/questions/13944751/args-kwargs-in-jinja2-macros #}\n {% set frustrating_jinja_feature = varargs %}\n {{ return(adapter.dispatch('safe_add', 'dbt_utils')(*varargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__safe_add"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.519664}, "macro.dbt_utils.default__safe_add": {"unique_id": "macro.dbt_utils.default__safe_add", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "name": "default__safe_add", "macro_sql": "\n\n{%- macro default__safe_add() -%}\n\n{% set fields = [] %}\n\n{%- for field in varargs -%}\n\n {% do fields.append(\"coalesce(\" ~ field ~ \", 0)\") %}\n\n{%- endfor -%}\n\n{{ fields|join(' +\\n ') }}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.520515}, "macro.dbt_utils.nullcheck": {"unique_id": "macro.dbt_utils.nullcheck", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "name": "nullcheck", "macro_sql": "{% macro nullcheck(cols) %}\n {{ return(adapter.dispatch('nullcheck', 'dbt_utils')(cols)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__nullcheck"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.521593}, "macro.dbt_utils.default__nullcheck": {"unique_id": "macro.dbt_utils.default__nullcheck", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "name": "default__nullcheck", "macro_sql": "{% macro default__nullcheck(cols) %}\n{%- for col in cols %}\n\n {% if col.is_string() -%}\n\n nullif({{col.name}},'') as {{col.name}}\n\n {%- else -%}\n\n {{col.name}}\n\n {%- endif -%}\n\n{%- if not loop.last -%} , {%- endif -%}\n\n{%- endfor -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.5229409}, "macro.dbt_utils.get_tables_by_pattern_sql": {"unique_id": "macro.dbt_utils.get_tables_by_pattern_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "get_tables_by_pattern_sql", "macro_sql": "{% macro get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_tables_by_pattern_sql', 'dbt_utils')\n (schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.526874}, "macro.dbt_utils.default__get_tables_by_pattern_sql": {"unique_id": "macro.dbt_utils.default__get_tables_by_pattern_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "default__get_tables_by_pattern_sql", "macro_sql": "{% macro default__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n select distinct\n table_schema as \"table_schema\",\n table_name as \"table_name\",\n {{ dbt_utils.get_table_types_sql() }}\n from {{ database }}.information_schema.tables\n where table_schema ilike '{{ schema_pattern }}'\n and table_name ilike '{{ table_pattern }}'\n and table_name not ilike '{{ exclude }}'\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.527719}, "macro.dbt_utils.bigquery__get_tables_by_pattern_sql": {"unique_id": "macro.dbt_utils.bigquery__get_tables_by_pattern_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "bigquery__get_tables_by_pattern_sql", "macro_sql": "{% macro bigquery__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {% if '%' in schema_pattern %}\n {% set schemata=dbt_utils._bigquery__get_matching_schemata(schema_pattern, database) %}\n {% else %}\n {% set schemata=[schema_pattern] %}\n {% endif %}\n\n {% set sql %}\n {% for schema in schemata %}\n select distinct\n table_schema,\n table_name,\n {{ dbt_utils.get_table_types_sql() }}\n\n from {{ adapter.quote(database) }}.{{ schema }}.INFORMATION_SCHEMA.TABLES\n where lower(table_name) like lower ('{{ table_pattern }}')\n and lower(table_name) not like lower ('{{ exclude }}')\n\n {% if not loop.last %} union all {% endif %}\n\n {% endfor %}\n {% endset %}\n\n {{ return(sql) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._bigquery__get_matching_schemata", "macro.dbt_utils.get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.52998}, "macro.dbt_utils._bigquery__get_matching_schemata": {"unique_id": "macro.dbt_utils._bigquery__get_matching_schemata", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "_bigquery__get_matching_schemata", "macro_sql": "{% macro _bigquery__get_matching_schemata(schema_pattern, database) %}\n {% if execute %}\n\n {% set sql %}\n select schema_name from {{ adapter.quote(database) }}.INFORMATION_SCHEMA.SCHEMATA\n where lower(schema_name) like lower('{{ schema_pattern }}')\n {% endset %}\n\n {% set results=run_query(sql) %}\n\n {% set schemata=results.columns['schema_name'].values() %}\n\n {{ return(schemata) }}\n\n {% else %}\n\n {{ return([]) }}\n\n {% endif %}\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.5314949}, "macro.dbt_utils.get_column_values": {"unique_id": "macro.dbt_utils.get_column_values", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "name": "get_column_values", "macro_sql": "{% macro get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none, where=none) -%}\n {{ return(adapter.dispatch('get_column_values', 'dbt_utils')(table, column, order_by, max_records, default, where)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_column_values"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.5340958}, "macro.dbt_utils.default__get_column_values": {"unique_id": "macro.dbt_utils.default__get_column_values", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "name": "default__get_column_values", "macro_sql": "{% macro default__get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none, where=none) -%}\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {% set default = [] if not default %}\n {{ return(default) }}\n {% endif %}\n\n {%- do dbt_utils._is_ephemeral(table, 'get_column_values') -%}\n\n {# Not all relations are tables. Renaming for internal clarity without breaking functionality for anyone using named arguments #}\n {# TODO: Change the method signature in a future 0.x.0 release #}\n {%- set target_relation = table -%}\n\n {# adapter.load_relation is a convenience wrapper to avoid building a Relation when we already have one #}\n {% set relation_exists = (load_relation(target_relation)) is not none %}\n\n {%- call statement('get_column_values', fetch_result=true) %}\n\n {%- if not relation_exists and default is none -%}\n\n {{ exceptions.raise_compiler_error(\"In get_column_values(): relation \" ~ target_relation ~ \" does not exist and no default value was provided.\") }}\n\n {%- elif not relation_exists and default is not none -%}\n\n {{ log(\"Relation \" ~ target_relation ~ \" does not exist. Returning the default value: \" ~ default) }}\n\n {{ return(default) }}\n\n {%- else -%}\n\n\n select\n {{ column }} as value\n\n from {{ target_relation }}\n\n {% if where is not none %}\n where {{ where }}\n {% endif %}\n\n group by {{ column }}\n order by {{ order_by }}\n\n {% if max_records is not none %}\n limit {{ max_records }}\n {% endif %}\n\n {% endif %}\n\n {%- endcall -%}\n\n {%- set value_list = load_result('get_column_values') -%}\n\n {%- if value_list and value_list['data'] -%}\n {%- set values = value_list['data'] | map(attribute=0) | list %}\n {{ return(values) }}\n {%- else -%}\n {{ return(default) }}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_ephemeral", "macro.dbt.load_relation", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.53823}, "macro.dbt_utils.pivot": {"unique_id": "macro.dbt_utils.pivot", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "name": "pivot", "macro_sql": "{% macro pivot(column,\n values,\n alias=True,\n agg='sum',\n cmp='=',\n prefix='',\n suffix='',\n then_value=1,\n else_value=0,\n quote_identifiers=True,\n distinct=False) %}\n {{ return(adapter.dispatch('pivot', 'dbt_utils')(column, values, alias, agg, cmp, prefix, suffix, then_value, else_value, quote_identifiers, distinct)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__pivot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.5410361}, "macro.dbt_utils.default__pivot": {"unique_id": "macro.dbt_utils.default__pivot", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "name": "default__pivot", "macro_sql": "{% macro default__pivot(column,\n values,\n alias=True,\n agg='sum',\n cmp='=',\n prefix='',\n suffix='',\n then_value=1,\n else_value=0,\n quote_identifiers=True,\n distinct=False) %}\n {% for value in values %}\n {{ agg }}(\n {% if distinct %} distinct {% endif %}\n case\n when {{ column }} {{ cmp }} '{{ dbt_utils.escape_single_quotes(value) }}'\n then {{ then_value }}\n else {{ else_value }}\n end\n )\n {% if alias %}\n {% if quote_identifiers %}\n as {{ adapter.quote(prefix ~ value ~ suffix) }}\n {% else %}\n as {{ dbt_utils.slugify(prefix ~ value ~ suffix) }}\n {% endif %}\n {% endif %}\n {% if not loop.last %},{% endif %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.escape_single_quotes", "macro.dbt_utils.slugify"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.543369}, "macro.dbt_utils.get_filtered_columns_in_relation": {"unique_id": "macro.dbt_utils.get_filtered_columns_in_relation", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_filtered_columns_in_relation.sql", "original_file_path": "macros/sql/get_filtered_columns_in_relation.sql", "name": "get_filtered_columns_in_relation", "macro_sql": "{% macro get_filtered_columns_in_relation(from, except=[]) -%}\n {{ return(adapter.dispatch('get_filtered_columns_in_relation', 'dbt_utils')(from, except)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_filtered_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.544885}, "macro.dbt_utils.default__get_filtered_columns_in_relation": {"unique_id": "macro.dbt_utils.default__get_filtered_columns_in_relation", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_filtered_columns_in_relation.sql", "original_file_path": "macros/sql/get_filtered_columns_in_relation.sql", "name": "default__get_filtered_columns_in_relation", "macro_sql": "{% macro default__get_filtered_columns_in_relation(from, except=[]) -%}\n {%- do dbt_utils._is_relation(from, 'get_filtered_columns_in_relation') -%}\n {%- do dbt_utils._is_ephemeral(from, 'get_filtered_columns_in_relation') -%}\n\n {# -- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {{ return('') }}\n {% endif %}\n\n {%- set include_cols = [] %}\n {%- set cols = adapter.get_columns_in_relation(from) -%}\n {%- set except = except | map(\"lower\") | list %}\n {%- for col in cols -%}\n {%- if col.column|lower not in except -%}\n {% do include_cols.append(col.column) %}\n {%- endif %}\n {%- endfor %}\n\n {{ return(include_cols) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.5470011}, "macro.dbt_utils.get_query_results_as_dict": {"unique_id": "macro.dbt_utils.get_query_results_as_dict", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "name": "get_query_results_as_dict", "macro_sql": "{% macro get_query_results_as_dict(query) %}\n {{ return(adapter.dispatch('get_query_results_as_dict', 'dbt_utils')(query)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_query_results_as_dict"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.548364}, "macro.dbt_utils.default__get_query_results_as_dict": {"unique_id": "macro.dbt_utils.default__get_query_results_as_dict", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "name": "default__get_query_results_as_dict", "macro_sql": "{% macro default__get_query_results_as_dict(query) %}\n\n{# This macro returns a dictionary of the form {column_name: (tuple_of_results)} #}\n\n {%- call statement('get_query_results', fetch_result=True,auto_begin=false) -%}\n\n {{ query }}\n\n {%- endcall -%}\n\n {% set sql_results={} %}\n\n {%- if execute -%}\n {% set sql_results_table = load_result('get_query_results').table.columns %}\n {% for column_name, column in sql_results_table.items() %}\n {% do sql_results.update({column_name: column.values()}) %}\n {% endfor %}\n {%- endif -%}\n\n {{ return(sql_results) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.550088}, "macro.dbt_utils.get_table_types_sql": {"unique_id": "macro.dbt_utils.get_table_types_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "name": "get_table_types_sql", "macro_sql": "{%- macro get_table_types_sql() -%}\n {{ return(adapter.dispatch('get_table_types_sql', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.55138}, "macro.dbt_utils.default__get_table_types_sql": {"unique_id": "macro.dbt_utils.default__get_table_types_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "name": "default__get_table_types_sql", "macro_sql": "{% macro default__get_table_types_sql() %}\n case table_type\n when 'BASE TABLE' then 'table'\n when 'EXTERNAL TABLE' then 'external'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as \"table_type\"\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.551641}, "macro.dbt_utils.postgres__get_table_types_sql": {"unique_id": "macro.dbt_utils.postgres__get_table_types_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "name": "postgres__get_table_types_sql", "macro_sql": "{% macro postgres__get_table_types_sql() %}\n case table_type\n when 'BASE TABLE' then 'table'\n when 'FOREIGN' then 'external'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as \"table_type\"\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.551872}, "macro.dbt_utils.bigquery__get_table_types_sql": {"unique_id": "macro.dbt_utils.bigquery__get_table_types_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "name": "bigquery__get_table_types_sql", "macro_sql": "{% macro bigquery__get_table_types_sql() %}\n case table_type\n when 'BASE TABLE' then 'table'\n when 'EXTERNAL TABLE' then 'external'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as `table_type`\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.552096}, "macro.dbt_utils.degrees_to_radians": {"unique_id": "macro.dbt_utils.degrees_to_radians", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "degrees_to_radians", "macro_sql": "{% macro degrees_to_radians(degrees) -%}\n acos(-1) * {{degrees}} / 180\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.55547}, "macro.dbt_utils.haversine_distance": {"unique_id": "macro.dbt_utils.haversine_distance", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "haversine_distance", "macro_sql": "{% macro haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n {{ return(adapter.dispatch('haversine_distance', 'dbt_utils')(lat1,lon1,lat2,lon2,unit)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__haversine_distance"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.5562801}, "macro.dbt_utils.default__haversine_distance": {"unique_id": "macro.dbt_utils.default__haversine_distance", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "default__haversine_distance", "macro_sql": "{% macro default__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{%- if unit == 'mi' %}\n {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n {% set conversion_rate = 1.60934 %}\n{% else %}\n {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n\n 2 * 3961 * asin(sqrt(power((sin(radians(({{ lat2 }} - {{ lat1 }}) / 2))), 2) +\n cos(radians({{lat1}})) * cos(radians({{lat2}})) *\n power((sin(radians(({{ lon2 }} - {{ lon1 }}) / 2))), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.558584}, "macro.dbt_utils.bigquery__haversine_distance": {"unique_id": "macro.dbt_utils.bigquery__haversine_distance", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "bigquery__haversine_distance", "macro_sql": "{% macro bigquery__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{% set radians_lat1 = dbt_utils.degrees_to_radians(lat1) %}\n{% set radians_lat2 = dbt_utils.degrees_to_radians(lat2) %}\n{% set radians_lon1 = dbt_utils.degrees_to_radians(lon1) %}\n{% set radians_lon2 = dbt_utils.degrees_to_radians(lon2) %}\n{%- if unit == 'mi' %}\n {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n {% set conversion_rate = 1.60934 %}\n{% else %}\n {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n 2 * 3961 * asin(sqrt(power(sin(({{ radians_lat2 }} - {{ radians_lat1 }}) / 2), 2) +\n cos({{ radians_lat1 }}) * cos({{ radians_lat2 }}) *\n power(sin(({{ radians_lon2 }} - {{ radians_lon1 }}) / 2), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.degrees_to_radians"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.561258}, "macro.spark_utils.get_tables": {"unique_id": "macro.spark_utils.get_tables", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "get_tables", "macro_sql": "{% macro get_tables(table_regex_pattern='.*') %}\n\n {% set tables = [] %}\n {% for database in spark__list_schemas('not_used') %}\n {% for table in spark__list_relations_without_caching(database[0]) %}\n {% set db_tablename = database[0] ~ \".\" ~ table[1] %}\n {% set is_match = modules.re.match(table_regex_pattern, db_tablename) %}\n {% if is_match %}\n {% call statement('table_detail', fetch_result=True) -%}\n describe extended {{ db_tablename }}\n {% endcall %}\n\n {% set table_type = load_result('table_detail').table|reverse|selectattr(0, 'in', ('type', 'TYPE', 'Type'))|first %}\n {% if table_type[1]|lower != 'view' %}\n {{ tables.append(db_tablename) }}\n {% endif %}\n {% endif %}\n {% endfor %}\n {% endfor %}\n {{ return(tables) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.573875}, "macro.spark_utils.get_delta_tables": {"unique_id": "macro.spark_utils.get_delta_tables", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "get_delta_tables", "macro_sql": "{% macro get_delta_tables(table_regex_pattern='.*') %}\n\n {% set delta_tables = [] %}\n {% for db_tablename in get_tables(table_regex_pattern) %}\n {% call statement('table_detail', fetch_result=True) -%}\n describe extended {{ db_tablename }}\n {% endcall %}\n\n {% set table_type = load_result('table_detail').table|reverse|selectattr(0, 'in', ('provider', 'PROVIDER', 'Provider'))|first %}\n {% if table_type[1]|lower == 'delta' %}\n {{ delta_tables.append(db_tablename) }}\n {% endif %}\n {% endfor %}\n {{ return(delta_tables) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_tables", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.575775}, "macro.spark_utils.get_statistic_columns": {"unique_id": "macro.spark_utils.get_statistic_columns", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "get_statistic_columns", "macro_sql": "{% macro get_statistic_columns(table) %}\n\n {% call statement('input_columns', fetch_result=True) %}\n SHOW COLUMNS IN {{ table }}\n {% endcall %}\n {% set input_columns = load_result('input_columns').table %}\n\n {% set output_columns = [] %}\n {% for column in input_columns %}\n {% call statement('column_information', fetch_result=True) %}\n DESCRIBE TABLE {{ table }} `{{ column[0] }}`\n {% endcall %}\n {% if not load_result('column_information').table[1][1].startswith('struct') and not load_result('column_information').table[1][1].startswith('array') %}\n {{ output_columns.append('`' ~ column[0] ~ '`') }}\n {% endif %}\n {% endfor %}\n {{ return(output_columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.5782678}, "macro.spark_utils.spark_optimize_delta_tables": {"unique_id": "macro.spark_utils.spark_optimize_delta_tables", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "spark_optimize_delta_tables", "macro_sql": "{% macro spark_optimize_delta_tables(table_regex_pattern='.*') %}\n\n {% for table in get_delta_tables(table_regex_pattern) %}\n {% set start=modules.datetime.datetime.now() %}\n {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n {{ dbt_utils.log_info(message_prefix ~ \" Optimizing \" ~ table) }}\n {% do run_query(\"optimize \" ~ table) %}\n {% set end=modules.datetime.datetime.now() %}\n {% set total_seconds = (end - start).total_seconds() | round(2) %}\n {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_delta_tables", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.580319}, "macro.spark_utils.spark_vacuum_delta_tables": {"unique_id": "macro.spark_utils.spark_vacuum_delta_tables", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "spark_vacuum_delta_tables", "macro_sql": "{% macro spark_vacuum_delta_tables(table_regex_pattern='.*') %}\n\n {% for table in get_delta_tables(table_regex_pattern) %}\n {% set start=modules.datetime.datetime.now() %}\n {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n {{ dbt_utils.log_info(message_prefix ~ \" Vacuuming \" ~ table) }}\n {% do run_query(\"vacuum \" ~ table) %}\n {% set end=modules.datetime.datetime.now() %}\n {% set total_seconds = (end - start).total_seconds() | round(2) %}\n {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_delta_tables", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.582368}, "macro.spark_utils.spark_analyze_tables": {"unique_id": "macro.spark_utils.spark_analyze_tables", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "spark_analyze_tables", "macro_sql": "{% macro spark_analyze_tables(table_regex_pattern='.*') %}\n\n {% for table in get_tables(table_regex_pattern) %}\n {% set start=modules.datetime.datetime.now() %}\n {% set columns = get_statistic_columns(table) | join(',') %}\n {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n {{ dbt_utils.log_info(message_prefix ~ \" Analyzing \" ~ table) }}\n {% if columns != '' %}\n {% do run_query(\"analyze table \" ~ table ~ \" compute statistics for columns \" ~ columns) %}\n {% endif %}\n {% set end=modules.datetime.datetime.now() %}\n {% set total_seconds = (end - start).total_seconds() | round(2) %}\n {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_tables", "macro.spark_utils.get_statistic_columns", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.584821}, "macro.spark_utils.spark__concat": {"unique_id": "macro.spark_utils.spark__concat", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/concat.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/concat.sql", "name": "spark__concat", "macro_sql": "{% macro spark__concat(fields) -%}\n concat({{ fields|join(', ') }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.585639}, "macro.spark_utils.spark__type_numeric": {"unique_id": "macro.spark_utils.spark__type_numeric", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/datatypes.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/datatypes.sql", "name": "spark__type_numeric", "macro_sql": "{% macro spark__type_numeric() %}\n decimal(28, 6)\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.5861928}, "macro.spark_utils.spark__dateadd": {"unique_id": "macro.spark_utils.spark__dateadd", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/dateadd.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/dateadd.sql", "name": "spark__dateadd", "macro_sql": "{% macro spark__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n {%- set clock_component -%}\n {# make sure the dates + timestamps are real, otherwise raise an error asap #}\n to_unix_timestamp({{ spark_utils.assert_not_null('to_timestamp', from_date_or_timestamp) }})\n - to_unix_timestamp({{ spark_utils.assert_not_null('date', from_date_or_timestamp) }})\n {%- endset -%}\n\n {%- if datepart in ['day', 'week'] -%}\n \n {%- set multiplier = 7 if datepart == 'week' else 1 -%}\n\n to_timestamp(\n to_unix_timestamp(\n date_add(\n {{ spark_utils.assert_not_null('date', from_date_or_timestamp) }},\n cast({{interval}} * {{multiplier}} as int)\n )\n ) + {{clock_component}}\n )\n\n {%- elif datepart in ['month', 'quarter', 'year'] -%}\n \n {%- set multiplier -%} \n {%- if datepart == 'month' -%} 1\n {%- elif datepart == 'quarter' -%} 3\n {%- elif datepart == 'year' -%} 12\n {%- endif -%}\n {%- endset -%}\n\n to_timestamp(\n to_unix_timestamp(\n add_months(\n {{ spark_utils.assert_not_null('date', from_date_or_timestamp) }},\n cast({{interval}} * {{multiplier}} as int)\n )\n ) + {{clock_component}}\n )\n\n {%- elif datepart in ('hour', 'minute', 'second', 'millisecond', 'microsecond') -%}\n \n {%- set multiplier -%} \n {%- if datepart == 'hour' -%} 3600\n {%- elif datepart == 'minute' -%} 60\n {%- elif datepart == 'second' -%} 1\n {%- elif datepart == 'millisecond' -%} (1/1000000)\n {%- elif datepart == 'microsecond' -%} (1/1000000)\n {%- endif -%}\n {%- endset -%}\n\n to_timestamp(\n {{ spark_utils.assert_not_null('to_unix_timestamp', from_date_or_timestamp) }}\n + cast({{interval}} * {{multiplier}} as int)\n )\n\n {%- else -%}\n\n {{ exceptions.raise_compiler_error(\"macro dateadd not implemented for datepart ~ '\" ~ datepart ~ \"' ~ on Spark\") }}\n\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.59291}, "macro.spark_utils.spark__datediff": {"unique_id": "macro.spark_utils.spark__datediff", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/datediff.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/datediff.sql", "name": "spark__datediff", "macro_sql": "{% macro spark__datediff(first_date, second_date, datepart) %}\n\n {%- if datepart in ['day', 'week', 'month', 'quarter', 'year'] -%}\n \n {# make sure the dates are real, otherwise raise an error asap #}\n {% set first_date = spark_utils.assert_not_null('date', first_date) %}\n {% set second_date = spark_utils.assert_not_null('date', second_date) %}\n \n {%- endif -%}\n \n {%- if datepart == 'day' -%}\n \n datediff({{second_date}}, {{first_date}})\n \n {%- elif datepart == 'week' -%}\n \n case when {{first_date}} < {{second_date}}\n then floor(datediff({{second_date}}, {{first_date}})/7)\n else ceil(datediff({{second_date}}, {{first_date}})/7)\n end\n \n -- did we cross a week boundary (Sunday)?\n + case\n when {{first_date}} < {{second_date}} and dayofweek({{second_date}}) < dayofweek({{first_date}}) then 1\n when {{first_date}} > {{second_date}} and dayofweek({{second_date}}) > dayofweek({{first_date}}) then -1\n else 0 end\n\n {%- elif datepart == 'month' -%}\n\n case when {{first_date}} < {{second_date}}\n then floor(months_between(date({{second_date}}), date({{first_date}})))\n else ceil(months_between(date({{second_date}}), date({{first_date}})))\n end\n \n -- did we cross a month boundary?\n + case\n when {{first_date}} < {{second_date}} and dayofmonth({{second_date}}) < dayofmonth({{first_date}}) then 1\n when {{first_date}} > {{second_date}} and dayofmonth({{second_date}}) > dayofmonth({{first_date}}) then -1\n else 0 end\n \n {%- elif datepart == 'quarter' -%}\n \n case when {{first_date}} < {{second_date}}\n then floor(months_between(date({{second_date}}), date({{first_date}}))/3)\n else ceil(months_between(date({{second_date}}), date({{first_date}}))/3)\n end\n \n -- did we cross a quarter boundary?\n + case\n when {{first_date}} < {{second_date}} and (\n (dayofyear({{second_date}}) - (quarter({{second_date}}) * 365/4))\n < (dayofyear({{first_date}}) - (quarter({{first_date}}) * 365/4))\n ) then 1\n when {{first_date}} > {{second_date}} and (\n (dayofyear({{second_date}}) - (quarter({{second_date}}) * 365/4))\n > (dayofyear({{first_date}}) - (quarter({{first_date}}) * 365/4))\n ) then -1\n else 0 end\n\n {%- elif datepart == 'year' -%}\n \n year({{second_date}}) - year({{first_date}})\n\n {%- elif datepart in ('hour', 'minute', 'second', 'millisecond', 'microsecond') -%}\n \n {%- set divisor -%} \n {%- if datepart == 'hour' -%} 3600\n {%- elif datepart == 'minute' -%} 60\n {%- elif datepart == 'second' -%} 1\n {%- elif datepart == 'millisecond' -%} (1/1000)\n {%- elif datepart == 'microsecond' -%} (1/1000000)\n {%- endif -%}\n {%- endset -%}\n\n case when {{first_date}} < {{second_date}}\n then ceil((\n {# make sure the timestamps are real, otherwise raise an error asap #}\n {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', second_date)) }}\n - {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', first_date)) }}\n ) / {{divisor}})\n else floor((\n {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', second_date)) }}\n - {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', first_date)) }}\n ) / {{divisor}})\n end\n \n {% if datepart == 'millisecond' %}\n + cast(date_format({{second_date}}, 'SSS') as int)\n - cast(date_format({{first_date}}, 'SSS') as int)\n {% endif %}\n \n {% if datepart == 'microsecond' %} \n {% set capture_str = '[0-9]{4}-[0-9]{2}-[0-9]{2}.[0-9]{2}:[0-9]{2}:[0-9]{2}.([0-9]{6})' %}\n -- Spark doesn't really support microseconds, so this is a massive hack!\n -- It will only work if the timestamp-string is of the format\n -- 'yyyy-MM-dd-HH mm.ss.SSSSSS'\n + cast(regexp_extract({{second_date}}, '{{capture_str}}', 1) as int)\n - cast(regexp_extract({{first_date}}, '{{capture_str}}', 1) as int) \n {% endif %}\n\n {%- else -%}\n\n {{ exceptions.raise_compiler_error(\"macro datediff not implemented for datepart ~ '\" ~ datepart ~ \"' ~ on Spark\") }}\n\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.609067}, "macro.spark_utils.spark__current_timestamp": {"unique_id": "macro.spark_utils.spark__current_timestamp", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "name": "spark__current_timestamp", "macro_sql": "{% macro spark__current_timestamp() %}\n current_timestamp()\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.609689}, "macro.spark_utils.spark__current_timestamp_in_utc": {"unique_id": "macro.spark_utils.spark__current_timestamp_in_utc", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "name": "spark__current_timestamp_in_utc", "macro_sql": "{% macro spark__current_timestamp_in_utc() %}\n unix_timestamp()\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.609897}, "macro.spark_utils.spark__split_part": {"unique_id": "macro.spark_utils.spark__split_part", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/split_part.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/split_part.sql", "name": "spark__split_part", "macro_sql": "{% macro spark__split_part(string_text, delimiter_text, part_number) %}\n\n {% set delimiter_expr %}\n \n -- escape if starts with a special character\n case when regexp_extract({{ delimiter_text }}, '([^A-Za-z0-9])(.*)', 1) != '_'\n then concat('\\\\', {{ delimiter_text }})\n else {{ delimiter_text }} end\n \n {% endset %}\n\n {% set split_part_expr %}\n \n split(\n {{ string_text }},\n {{ delimiter_expr }}\n )[({{ part_number - 1 }})]\n \n {% endset %}\n \n {{ return(split_part_expr) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6114292}, "macro.spark_utils.spark__get_relations_by_pattern": {"unique_id": "macro.spark_utils.spark__get_relations_by_pattern", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_relations_by_pattern", "macro_sql": "{% macro spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n show table extended in {{ schema_pattern }} like '{{ table_pattern }}'\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=None,\n schema=row[0],\n identifier=row[1],\n type=('view' if 'Type: VIEW' in row[3] else 'table')\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6153579}, "macro.spark_utils.spark__get_relations_by_prefix": {"unique_id": "macro.spark_utils.spark__get_relations_by_prefix", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_relations_by_prefix", "macro_sql": "{% macro spark__get_relations_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {% set table_pattern = table_pattern ~ '*' %}\n {{ return(spark_utils.spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.616321}, "macro.spark_utils.spark__get_tables_by_pattern": {"unique_id": "macro.spark_utils.spark__get_tables_by_pattern", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_tables_by_pattern", "macro_sql": "{% macro spark__get_tables_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(spark_utils.spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.617082}, "macro.spark_utils.spark__get_tables_by_prefix": {"unique_id": "macro.spark_utils.spark__get_tables_by_prefix", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_tables_by_prefix", "macro_sql": "{% macro spark__get_tables_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(spark_utils.spark__get_relations_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_prefix"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.617841}, "macro.spark_utils.assert_not_null": {"unique_id": "macro.spark_utils.assert_not_null", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/etc/assert_not_null.sql", "original_file_path": "macros/etc/assert_not_null.sql", "name": "assert_not_null", "macro_sql": "{% macro assert_not_null(function, arg) -%}\n {{ return(adapter.dispatch('assert_not_null', 'spark_utils')(function, arg)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.default__assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.61887}, "macro.spark_utils.default__assert_not_null": {"unique_id": "macro.spark_utils.default__assert_not_null", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/etc/assert_not_null.sql", "original_file_path": "macros/etc/assert_not_null.sql", "name": "default__assert_not_null", "macro_sql": "{% macro default__assert_not_null(function, arg) %}\n\n coalesce({{function}}({{arg}}), nvl2({{function}}({{arg}}), assert_true({{function}}({{arg}}) is not null), null))\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.619458}, "macro.spark_utils.spark__convert_timezone": {"unique_id": "macro.spark_utils.spark__convert_timezone", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/snowplow/convert_timezone.sql", "original_file_path": "macros/snowplow/convert_timezone.sql", "name": "spark__convert_timezone", "macro_sql": "{% macro spark__convert_timezone(in_tz, out_tz, in_timestamp) %}\n from_utc_timestamp(to_utc_timestamp({{in_timestamp}}, {{in_tz}}), {{out_tz}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.620199}, "macro.fivetran_utils.enabled_vars": {"unique_id": "macro.fivetran_utils.enabled_vars", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/enabled_vars.sql", "original_file_path": "macros/enabled_vars.sql", "name": "enabled_vars", "macro_sql": "{% macro enabled_vars(vars) %}\n\n{% for v in vars %}\n \n {% if var(v, True) == False %}\n {{ return(False) }}\n {% endif %}\n\n{% endfor %}\n\n{{ return(True) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.621526}, "macro.fivetran_utils.percentile": {"unique_id": "macro.fivetran_utils.percentile", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "percentile", "macro_sql": "{% macro percentile(percentile_field, partition_field, percent) -%}\n\n{{ adapter.dispatch('percentile', 'fivetran_utils') (percentile_field, partition_field, percent) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.bigquery__percentile"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.623894}, "macro.fivetran_utils.default__percentile": {"unique_id": "macro.fivetran_utils.default__percentile", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "default__percentile", "macro_sql": "{% macro default__percentile(percentile_field, partition_field, percent) %}\n\n percentile_cont( \n {{ percent }} )\n within group ( order by {{ percentile_field }} )\n over ( partition by {{ partition_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.624385}, "macro.fivetran_utils.redshift__percentile": {"unique_id": "macro.fivetran_utils.redshift__percentile", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "redshift__percentile", "macro_sql": "{% macro redshift__percentile(percentile_field, partition_field, percent) %}\n\n percentile_cont( \n {{ percent }} )\n within group ( order by {{ percentile_field }} )\n over ( partition by {{ partition_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6248882}, "macro.fivetran_utils.bigquery__percentile": {"unique_id": "macro.fivetran_utils.bigquery__percentile", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "bigquery__percentile", "macro_sql": "{% macro bigquery__percentile(percentile_field, partition_field, percent) %}\n\n percentile_cont( \n {{ percentile_field }}, \n {{ percent }}) \n over (partition by {{ partition_field }} \n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.625521}, "macro.fivetran_utils.postgres__percentile": {"unique_id": "macro.fivetran_utils.postgres__percentile", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "postgres__percentile", "macro_sql": "{% macro postgres__percentile(percentile_field, partition_field, percent) %}\n\n percentile_cont( \n {{ percent }} )\n within group ( order by {{ percentile_field }} )\n /* have to group by partition field */\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.625945}, "macro.fivetran_utils.spark__percentile": {"unique_id": "macro.fivetran_utils.spark__percentile", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "spark__percentile", "macro_sql": "{% macro spark__percentile(percentile_field, partition_field, percent) %}\n\n percentile( \n {{ percentile_field }}, \n {{ percent }}) \n over (partition by {{ partition_field }} \n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6264188}, "macro.fivetran_utils.pivot_json_extract": {"unique_id": "macro.fivetran_utils.pivot_json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/pivot_json_extract.sql", "original_file_path": "macros/pivot_json_extract.sql", "name": "pivot_json_extract", "macro_sql": "{% macro pivot_json_extract(string, list_of_properties) %}\n\n{%- for property in list_of_properties -%}\n\nreplace( {{ fivetran_utils.json_extract(string, property) }}, '\"', '') as {{ property | replace(' ', '_') | lower }}\n\n{%- if not loop.last -%},{%- endif %}\n{% endfor -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.json_extract"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.627744}, "macro.fivetran_utils.persist_pass_through_columns": {"unique_id": "macro.fivetran_utils.persist_pass_through_columns", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/persist_pass_through_columns.sql", "original_file_path": "macros/persist_pass_through_columns.sql", "name": "persist_pass_through_columns", "macro_sql": "{% macro persist_pass_through_columns(pass_through_variable) %}\n\n{% if var(pass_through_variable, none) %}\n {% for field in var(pass_through_variable) %}\n , {{ field.alias if field.alias else field.name }}\n {% endfor %}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6289868}, "macro.fivetran_utils.json_parse": {"unique_id": "macro.fivetran_utils.json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "json_parse", "macro_sql": "{% macro json_parse(string, string_path) -%}\n\n{{ adapter.dispatch('json_parse', 'fivetran_utils') (string, string_path) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.bigquery__json_parse"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.631362}, "macro.fivetran_utils.default__json_parse": {"unique_id": "macro.fivetran_utils.default__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "default__json_parse", "macro_sql": "{% macro default__json_parse(string, string_path) %}\n\n json_extract_path_text({{string}}, {%- for s in string_path -%}'{{ s }}'{%- if not loop.last -%},{%- endif -%}{%- endfor -%} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.632394}, "macro.fivetran_utils.redshift__json_parse": {"unique_id": "macro.fivetran_utils.redshift__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "redshift__json_parse", "macro_sql": "{% macro redshift__json_parse(string, string_path) %}\n\n json_extract_path_text({{string}}, {%- for s in string_path -%}'{{ s }}'{%- if not loop.last -%},{%- endif -%}{%- endfor -%} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.633257}, "macro.fivetran_utils.bigquery__json_parse": {"unique_id": "macro.fivetran_utils.bigquery__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "bigquery__json_parse", "macro_sql": "{% macro bigquery__json_parse(string, string_path) %}\n\n \n json_extract_scalar({{string}}, '$.{%- for s in string_path -%}{{ s }}{%- if not loop.last -%}.{%- endif -%}{%- endfor -%} ')\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.63396}, "macro.fivetran_utils.postgres__json_parse": {"unique_id": "macro.fivetran_utils.postgres__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "postgres__json_parse", "macro_sql": "{% macro postgres__json_parse(string, string_path) %}\n\n {{string}}::json #>> '{ {%- for s in string_path -%}{{ s }}{%- if not loop.last -%},{%- endif -%}{%- endfor -%} }'\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.634639}, "macro.fivetran_utils.snowflake__json_parse": {"unique_id": "macro.fivetran_utils.snowflake__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "snowflake__json_parse", "macro_sql": "{% macro snowflake__json_parse(string, string_path) %}\n\n parse_json( {{string}} ) {%- for s in string_path -%}{% if s is number %}[{{ s }}]{% else %}['{{ s }}']{% endif %}{%- endfor -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.635408}, "macro.fivetran_utils.spark__json_parse": {"unique_id": "macro.fivetran_utils.spark__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "spark__json_parse", "macro_sql": "{% macro spark__json_parse(string, string_path) %}\n\n {{string}} : {%- for s in string_path -%}{% if s is number %}[{{ s }}]{% else %}['{{ s }}']{% endif %}{%- endfor -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.636168}, "macro.fivetran_utils.max_bool": {"unique_id": "macro.fivetran_utils.max_bool", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "name": "max_bool", "macro_sql": "{% macro max_bool(boolean_field) -%}\n\n{{ adapter.dispatch('max_bool', 'fivetran_utils') (boolean_field) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.bigquery__max_bool"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.637154}, "macro.fivetran_utils.default__max_bool": {"unique_id": "macro.fivetran_utils.default__max_bool", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "name": "default__max_bool", "macro_sql": "{% macro default__max_bool(boolean_field) %}\n\n bool_or( {{ boolean_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6374452}, "macro.fivetran_utils.snowflake__max_bool": {"unique_id": "macro.fivetran_utils.snowflake__max_bool", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "name": "snowflake__max_bool", "macro_sql": "{% macro snowflake__max_bool(boolean_field) %}\n\n max( {{ boolean_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.637726}, "macro.fivetran_utils.bigquery__max_bool": {"unique_id": "macro.fivetran_utils.bigquery__max_bool", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "name": "bigquery__max_bool", "macro_sql": "{% macro bigquery__max_bool(boolean_field) %}\n\n max( {{ boolean_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.638013}, "macro.fivetran_utils.calculated_fields": {"unique_id": "macro.fivetran_utils.calculated_fields", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/calculated_fields.sql", "original_file_path": "macros/calculated_fields.sql", "name": "calculated_fields", "macro_sql": "{% macro calculated_fields(variable) -%}\n\n{% if var(variable, none) %}\n {% for field in var(variable) %}\n , {{ field.transform_sql }} as {{ field.name }} \n {% endfor %}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.639183}, "macro.fivetran_utils.seed_data_helper": {"unique_id": "macro.fivetran_utils.seed_data_helper", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/seed_data_helper.sql", "original_file_path": "macros/seed_data_helper.sql", "name": "seed_data_helper", "macro_sql": "{% macro seed_data_helper(seed_name, warehouses) %}\n\n{% if target.type in warehouses %}\n {% for w in warehouses %}\n {% if target.type == w %}\n {{ return(ref(seed_name ~ \"_\" ~ w ~ \"\")) }}\n {% endif %}\n {% endfor %}\n{% else %}\n{{ return(ref(seed_name)) }}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.640896}, "macro.fivetran_utils.fill_pass_through_columns": {"unique_id": "macro.fivetran_utils.fill_pass_through_columns", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/fill_pass_through_columns.sql", "original_file_path": "macros/fill_pass_through_columns.sql", "name": "fill_pass_through_columns", "macro_sql": "{% macro fill_pass_through_columns(pass_through_variable) %}\n\n{% if var(pass_through_variable) %}\n {% for field in var(pass_through_variable) %}\n {% if field.transform_sql %}\n , {{ field.transform_sql }} as {{ field.alias if field.alias else field.name }}\n {% else %}\n , {{ field.alias if field.alias else field.name }}\n {% endif %}\n {% endfor %}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.642686}, "macro.fivetran_utils.string_agg": {"unique_id": "macro.fivetran_utils.string_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "string_agg", "macro_sql": "{% macro string_agg(field_to_agg, delimiter) -%}\n\n{{ adapter.dispatch('string_agg', 'fivetran_utils') (field_to_agg, delimiter) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__string_agg"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.643894}, "macro.fivetran_utils.default__string_agg": {"unique_id": "macro.fivetran_utils.default__string_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "default__string_agg", "macro_sql": "{% macro default__string_agg(field_to_agg, delimiter) %}\n string_agg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6442611}, "macro.fivetran_utils.snowflake__string_agg": {"unique_id": "macro.fivetran_utils.snowflake__string_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "snowflake__string_agg", "macro_sql": "{% macro snowflake__string_agg(field_to_agg, delimiter) %}\n listagg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.644675}, "macro.fivetran_utils.redshift__string_agg": {"unique_id": "macro.fivetran_utils.redshift__string_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "redshift__string_agg", "macro_sql": "{% macro redshift__string_agg(field_to_agg, delimiter) %}\n listagg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.645063}, "macro.fivetran_utils.spark__string_agg": {"unique_id": "macro.fivetran_utils.spark__string_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "spark__string_agg", "macro_sql": "{% macro spark__string_agg(field_to_agg, delimiter) %}\n -- collect set will remove duplicates\n replace(replace(replace(cast( collect_set({{ field_to_agg }}) as string), '[', ''), ']', ''), ', ', {{ delimiter }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6454349}, "macro.fivetran_utils.timestamp_diff": {"unique_id": "macro.fivetran_utils.timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "timestamp_diff", "macro_sql": "{% macro timestamp_diff(first_date, second_date, datepart) %}\n {{ adapter.dispatch('timestamp_diff', 'fivetran_utils')(first_date, second_date, datepart) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.bigquery__timestamp_diff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6514251}, "macro.fivetran_utils.default__timestamp_diff": {"unique_id": "macro.fivetran_utils.default__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "default__timestamp_diff", "macro_sql": "{% macro default__timestamp_diff(first_date, second_date, datepart) %}\n\n datediff(\n {{ datepart }},\n {{ first_date }},\n {{ second_date }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.651885}, "macro.fivetran_utils.redshift__timestamp_diff": {"unique_id": "macro.fivetran_utils.redshift__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "redshift__timestamp_diff", "macro_sql": "{% macro redshift__timestamp_diff(first_date, second_date, datepart) %}\n\n datediff(\n {{ datepart }},\n {{ first_date }},\n {{ second_date }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.652338}, "macro.fivetran_utils.bigquery__timestamp_diff": {"unique_id": "macro.fivetran_utils.bigquery__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "bigquery__timestamp_diff", "macro_sql": "{% macro bigquery__timestamp_diff(first_date, second_date, datepart) %}\n\n timestamp_diff(\n {{second_date}},\n {{first_date}},\n {{datepart}}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.65279}, "macro.fivetran_utils.postgres__timestamp_diff": {"unique_id": "macro.fivetran_utils.postgres__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "postgres__timestamp_diff", "macro_sql": "{% macro postgres__timestamp_diff(first_date, second_date, datepart) %}\n\n {% if datepart == 'year' %}\n (date_part('year', ({{second_date}})::date) - date_part('year', ({{first_date}})::date))\n {% elif datepart == 'quarter' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 4 + date_part('quarter', ({{second_date}})::date) - date_part('quarter', ({{first_date}})::date))\n {% elif datepart == 'month' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 12 + date_part('month', ({{second_date}})::date) - date_part('month', ({{first_date}})::date))\n {% elif datepart == 'day' %}\n (({{second_date}})::date - ({{first_date}})::date)\n {% elif datepart == 'week' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} / 7 + case\n when date_part('dow', ({{first_date}})::timestamp) <= date_part('dow', ({{second_date}})::timestamp) then\n case when {{first_date}} <= {{second_date}} then 0 else -1 end\n else\n case when {{first_date}} <= {{second_date}} then 1 else 0 end\n end)\n {% elif datepart == 'hour' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} * 24 + date_part('hour', ({{second_date}})::timestamp) - date_part('hour', ({{first_date}})::timestamp))\n {% elif datepart == 'minute' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'hour') }} * 60 + date_part('minute', ({{second_date}})::timestamp) - date_part('minute', ({{first_date}})::timestamp))\n {% elif datepart == 'second' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60 + floor(date_part('second', ({{second_date}})::timestamp)) - floor(date_part('second', ({{first_date}})::timestamp)))\n {% elif datepart == 'millisecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000 + floor(date_part('millisecond', ({{second_date}})::timestamp)) - floor(date_part('millisecond', ({{first_date}})::timestamp)))\n {% elif datepart == 'microsecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000000 + floor(date_part('microsecond', ({{second_date}})::timestamp)) - floor(date_part('microsecond', ({{first_date}})::timestamp)))\n {% else %}\n {{ exceptions.raise_compiler_error(\"Unsupported datepart for macro datediff in postgres: {!r}\".format(datepart)) }}\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.657823}, "macro.fivetran_utils.try_cast": {"unique_id": "macro.fivetran_utils.try_cast", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "try_cast", "macro_sql": "{% macro try_cast(field, type) %}\n {{ adapter.dispatch('try_cast', 'fivetran_utils') (field, type) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.bigquery__try_cast"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.659924}, "macro.fivetran_utils.default__safe_cast": {"unique_id": "macro.fivetran_utils.default__safe_cast", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "default__safe_cast", "macro_sql": "{% macro default__safe_cast(field, type) %}\n {# most databases don't support this function yet\n so we just need to use cast #}\n cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6603148}, "macro.fivetran_utils.redshift__try_cast": {"unique_id": "macro.fivetran_utils.redshift__try_cast", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "redshift__try_cast", "macro_sql": "{% macro redshift__try_cast(field, type) %}\n{%- if type == 'numeric' -%}\n\n case\n when trim({{field}}) ~ '^(0|[1-9][0-9]*)$' then trim({{field}})\n else null\n end::{{type}}\n\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"non-numeric datatypes are not currently supported\") }}\n\n{% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6610749}, "macro.fivetran_utils.postgres__try_cast": {"unique_id": "macro.fivetran_utils.postgres__try_cast", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "postgres__try_cast", "macro_sql": "{% macro postgres__try_cast(field, type) %}\n{%- if type == 'numeric' -%}\n\n case\n when replace(cast({{field}} as varchar),cast(' ' as varchar),cast('' as varchar)) ~ '^(0|[1-9][0-9]*)$' \n then replace(cast({{field}} as varchar),cast(' ' as varchar),cast('' as varchar))\n else null\n end::{{type}}\n\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"non-numeric datatypes are not currently supported\") }}\n\n{% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.661935}, "macro.fivetran_utils.snowflake__try_cast": {"unique_id": "macro.fivetran_utils.snowflake__try_cast", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "snowflake__try_cast", "macro_sql": "{% macro snowflake__try_cast(field, type) %}\n try_cast(cast({{field}} as varchar) as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.662313}, "macro.fivetran_utils.bigquery__try_cast": {"unique_id": "macro.fivetran_utils.bigquery__try_cast", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "bigquery__try_cast", "macro_sql": "{% macro bigquery__try_cast(field, type) %}\n safe_cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.662673}, "macro.fivetran_utils.spark__try_cast": {"unique_id": "macro.fivetran_utils.spark__try_cast", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "spark__try_cast", "macro_sql": "{% macro spark__try_cast(field, type) %}\n try_cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.663033}, "macro.fivetran_utils.source_relation": {"unique_id": "macro.fivetran_utils.source_relation", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/source_relation.sql", "original_file_path": "macros/source_relation.sql", "name": "source_relation", "macro_sql": "{% macro source_relation(union_schema_variable='union_schemas', union_database_variable='union_databases') -%}\n\n{{ adapter.dispatch('source_relation', 'fivetran_utils') (union_schema_variable, union_database_variable) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__source_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.664484}, "macro.fivetran_utils.default__source_relation": {"unique_id": "macro.fivetran_utils.default__source_relation", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/source_relation.sql", "original_file_path": "macros/source_relation.sql", "name": "default__source_relation", "macro_sql": "{% macro default__source_relation(union_schema_variable, union_database_variable) %}\n\n{% if var(union_schema_variable, none) %}\n, case\n {% for schema in var(union_schema_variable) %}\n when lower(replace(replace(_dbt_source_relation,'\"',''),'`','')) like '%.{{ schema|lower }}.%' then '{{ schema|lower }}'\n {% endfor %}\n end as source_relation\n{% elif var(union_database_variable, none) %}\n, case\n {% for database in var(union_database_variable) %}\n when lower(replace(replace(_dbt_source_relation,'\"',''),'`','')) like '%{{ database|lower }}.%' then '{{ database|lower }}'\n {% endfor %}\n end as source_relation\n{% else %}\n, cast('' as {{ dbt_utils.type_string() }}) as source_relation\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.666095}, "macro.fivetran_utils.first_value": {"unique_id": "macro.fivetran_utils.first_value", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "name": "first_value", "macro_sql": "{% macro first_value(first_value_field, partition_field, order_by_field, order=\"asc\") -%}\n\n{{ adapter.dispatch('first_value', 'fivetran_utils') (first_value_field, partition_field, order_by_field, order) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__first_value"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.667427}, "macro.fivetran_utils.default__first_value": {"unique_id": "macro.fivetran_utils.default__first_value", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "name": "default__first_value", "macro_sql": "{% macro default__first_value(first_value_field, partition_field, order_by_field, order=\"asc\") %}\n\n first_value( {{ first_value_field }} ignore nulls ) over (partition by {{ partition_field }} order by {{ order_by_field }} {{ order }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.66799}, "macro.fivetran_utils.redshift__first_value": {"unique_id": "macro.fivetran_utils.redshift__first_value", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "name": "redshift__first_value", "macro_sql": "{% macro redshift__first_value(first_value_field, partition_field, order_by_field, order=\"asc\") %}\n\n first_value( {{ first_value_field }} ignore nulls ) over (partition by {{ partition_field }} order by {{ order_by_field }} {{ order }} , {{ partition_field }} rows unbounded preceding )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.66861}, "macro.fivetran_utils.add_dbt_source_relation": {"unique_id": "macro.fivetran_utils.add_dbt_source_relation", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/add_dbt_source_relation.sql", "original_file_path": "macros/add_dbt_source_relation.sql", "name": "add_dbt_source_relation", "macro_sql": "{% macro add_dbt_source_relation() %}\n\n{% if var('union_schemas', none) or var('union_databases', none) %}\n, _dbt_source_relation\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6694698}, "macro.fivetran_utils.add_pass_through_columns": {"unique_id": "macro.fivetran_utils.add_pass_through_columns", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/add_pass_through_columns.sql", "original_file_path": "macros/add_pass_through_columns.sql", "name": "add_pass_through_columns", "macro_sql": "{% macro add_pass_through_columns(base_columns, pass_through_var) %}\n\n {% if pass_through_var %}\n\n {% for column in pass_through_var %}\n\n {% if column.alias %}\n\n {% do base_columns.append({ \"name\": column.name, \"alias\": column.alias, \"datatype\": column.datatype if column.datatype else dbt_utils.type_string()}) %}\n\n {% else %}\n\n {% do base_columns.append({ \"name\": column.name, \"datatype\": column.datatype if column.datatype else dbt_utils.type_string()}) %}\n \n {% endif %}\n\n {% endfor %}\n\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.671725}, "macro.fivetran_utils.union_relations": {"unique_id": "macro.fivetran_utils.union_relations", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/union_relations.sql", "original_file_path": "macros/union_relations.sql", "name": "union_relations", "macro_sql": "{%- macro union_relations(relations, aliases=none, column_override=none, include=[], exclude=[], source_column_name=none) -%}\n\n {%- if exclude and include -%}\n {{ exceptions.raise_compiler_error(\"Both an exclude and include list were provided to the `union` macro. Only one is allowed\") }}\n {%- endif -%}\n\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. -#}\n {%- if not execute %}\n {{ return('') }}\n {% endif -%}\n\n {%- set column_override = column_override if column_override is not none else {} -%}\n {%- set source_column_name = source_column_name if source_column_name is not none else '_dbt_source_relation' -%}\n\n {%- set relation_columns = {} -%}\n {%- set column_superset = {} -%}\n\n {%- for relation in relations -%}\n\n {%- do relation_columns.update({relation: []}) -%}\n\n {%- do dbt_utils._is_relation(relation, 'union_relations') -%}\n {%- set cols = adapter.get_columns_in_relation(relation) -%}\n {%- for col in cols -%}\n\n {#- If an exclude list was provided and the column is in the list, do nothing -#}\n {%- if exclude and col.column in exclude -%}\n\n {#- If an include list was provided and the column is not in the list, do nothing -#}\n {%- elif include and col.column not in include -%}\n\n {#- Otherwise add the column to the column superset -#}\n {%- else -%}\n\n {#- update the list of columns in this relation -#}\n {%- do relation_columns[relation].append(col.column) -%}\n\n {%- if col.column in column_superset -%}\n\n {%- set stored = column_superset[col.column] -%}\n {%- if col.is_string() and stored.is_string() and col.string_size() > stored.string_size() -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif %}\n\n {%- else -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif -%}\n\n {%- endif -%}\n\n {%- endfor -%}\n {%- endfor -%}\n\n {%- set ordered_column_names = column_superset.keys() -%}\n\n {%- for relation in relations %}\n\n (\n select\n\n cast({{ dbt_utils.string_literal(relation) }} as {{ dbt_utils.type_string() }}) as {{ source_column_name }},\n {% for col_name in ordered_column_names -%}\n\n {%- set col = column_superset[col_name] %}\n {%- set col_type = column_override.get(col.column, col.data_type) %}\n {%- set col_name = adapter.quote(col_name) if col_name in relation_columns[relation] else 'null' %}\n cast({{ col_name }} as {{ col_type }}) as {{ col.quoted }} {% if not loop.last %},{% endif -%}\n\n {%- endfor %}\n\n from {{ aliases[loop.index0] if aliases else relation }}\n )\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n\n {%- endfor -%}\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils.string_literal", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6812952}, "macro.fivetran_utils.union_tables": {"unique_id": "macro.fivetran_utils.union_tables", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/union_relations.sql", "original_file_path": "macros/union_relations.sql", "name": "union_tables", "macro_sql": "{%- macro union_tables(tables, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_table') -%}\n\n {%- do exceptions.warn(\"Warning: the `union_tables` macro is no longer supported and will be deprecated in a future release of dbt-utils. Use the `union_relations` macro instead\") -%}\n\n {{ return(dbt_utils.union_relations(tables, column_override, include, exclude, source_column_name)) }}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.union_relations"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.68226}, "macro.fivetran_utils.snowflake_seed_data": {"unique_id": "macro.fivetran_utils.snowflake_seed_data", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/snowflake_seed_data.sql", "original_file_path": "macros/snowflake_seed_data.sql", "name": "snowflake_seed_data", "macro_sql": "{% macro snowflake_seed_data(seed_name) %}\n\n{% if target.type == 'snowflake' %}\n{{ return(ref(seed_name ~ '_snowflake')) }}\n{% else %}\n{{ return(ref(seed_name)) }}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6834738}, "macro.fivetran_utils.fill_staging_columns": {"unique_id": "macro.fivetran_utils.fill_staging_columns", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/fill_staging_columns.sql", "original_file_path": "macros/fill_staging_columns.sql", "name": "fill_staging_columns", "macro_sql": "{% macro fill_staging_columns(source_columns, staging_columns) -%}\n\n{%- set source_column_names = source_columns|map(attribute='name')|map('lower')|list -%}\n\n{%- for column in staging_columns %}\n {% if column.name|lower in source_column_names -%}\n {{ fivetran_utils.quote_column(column) }} as \n {%- if 'alias' in column %} {{ column.alias }} {% else %} {{ fivetran_utils.quote_column(column) }} {%- endif -%}\n {%- else -%}\n cast(null as {{ column.datatype }})\n {%- if 'alias' in column %} as {{ column.alias }} {% else %} as {{ fivetran_utils.quote_column(column) }} {% endif -%}\n {%- endif -%}\n {%- if not loop.last -%} , {% endif -%}\n{% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.quote_column"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.687086}, "macro.fivetran_utils.quote_column": {"unique_id": "macro.fivetran_utils.quote_column", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/fill_staging_columns.sql", "original_file_path": "macros/fill_staging_columns.sql", "name": "quote_column", "macro_sql": "{% macro quote_column(column) %}\n {% if 'quote' in column %}\n {% if column.quote %}\n {% if target.type in ('bigquery', 'spark') %}\n `{{ column.name }}`\n {% elif target.type == 'snowflake' %}\n \"{{ column.name | upper }}\"\n {% else %}\n \"{{ column.name }}\"\n {% endif %}\n {% else %}\n {{ column.name }}\n {% endif %}\n {% else %}\n {{ column.name }}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.689054}, "macro.fivetran_utils.json_extract": {"unique_id": "macro.fivetran_utils.json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "json_extract", "macro_sql": "{% macro json_extract(string, string_path) -%}\n\n{{ adapter.dispatch('json_extract', 'fivetran_utils') (string, string_path) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.bigquery__json_extract"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.691005}, "macro.fivetran_utils.default__json_extract": {"unique_id": "macro.fivetran_utils.default__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "default__json_extract", "macro_sql": "{% macro default__json_extract(string, string_path) %}\n\n json_extract_path_text({{string}}, {{ \"'\" ~ string_path ~ \"'\" }} )\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.691655}, "macro.fivetran_utils.snowflake__json_extract": {"unique_id": "macro.fivetran_utils.snowflake__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "snowflake__json_extract", "macro_sql": "{% macro snowflake__json_extract(string, string_path) %}\n\n json_extract_path_text(try_parse_json( {{string}} ), {{ \"'\" ~ string_path ~ \"'\" }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.692363}, "macro.fivetran_utils.redshift__json_extract": {"unique_id": "macro.fivetran_utils.redshift__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "redshift__json_extract", "macro_sql": "{% macro redshift__json_extract(string, string_path) %}\n\n case when is_valid_json( {{string}} ) then json_extract_path_text({{string}}, {{ \"'\" ~ string_path ~ \"'\" }} ) else null end\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6929631}, "macro.fivetran_utils.bigquery__json_extract": {"unique_id": "macro.fivetran_utils.bigquery__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "bigquery__json_extract", "macro_sql": "{% macro bigquery__json_extract(string, string_path) %}\n\n json_extract_scalar({{string}}, {{ \"'$.\" ~ string_path ~ \"'\" }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.6935139}, "macro.fivetran_utils.postgres__json_extract": {"unique_id": "macro.fivetran_utils.postgres__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "postgres__json_extract", "macro_sql": "{% macro postgres__json_extract(string, string_path) %}\n\n {{string}}::json->>{{\"'\" ~ string_path ~ \"'\" }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.69395}, "macro.fivetran_utils.collect_freshness": {"unique_id": "macro.fivetran_utils.collect_freshness", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/collect_freshness.sql", "original_file_path": "macros/collect_freshness.sql", "name": "collect_freshness", "macro_sql": "{% macro collect_freshness(source, loaded_at_field, filter) %}\n {{ return(adapter.dispatch('collect_freshness')(source, loaded_at_field, filter))}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__collect_freshness"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.695863}, "macro.fivetran_utils.default__collect_freshness": {"unique_id": "macro.fivetran_utils.default__collect_freshness", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/collect_freshness.sql", "original_file_path": "macros/collect_freshness.sql", "name": "default__collect_freshness", "macro_sql": "{% macro default__collect_freshness(source, loaded_at_field, filter) %}\n {% call statement('collect_freshness', fetch_result=True, auto_begin=False) -%}\n\n {%- set enabled_array = [] -%}\n {% for node in graph.sources.values() %}\n {% if node.identifier == source.identifier %}\n {% if (node.meta['is_enabled'] | default(true)) %}\n {%- do enabled_array.append(1) -%}\n {% endif %}\n {% endif %}\n {% endfor %}\n {% set is_enabled = (enabled_array != []) %}\n\n select\n {% if is_enabled %}\n max({{ loaded_at_field }})\n {% else %} \n {{ current_timestamp() }} {% endif %} as max_loaded_at,\n {{ current_timestamp() }} as snapshotted_at\n\n {% if is_enabled %}\n from {{ source }}\n {% if filter %}\n where {{ filter }}\n {% endif %}\n {% endif %}\n\n {% endcall %}\n {{ return(load_result('collect_freshness').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.698679}, "macro.fivetran_utils.timestamp_add": {"unique_id": "macro.fivetran_utils.timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "timestamp_add", "macro_sql": "{% macro timestamp_add(datepart, interval, from_timestamp) -%}\n\n{{ adapter.dispatch('timestamp_add', 'fivetran_utils') (datepart, interval, from_timestamp) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.bigquery__timestamp_add"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.7005591}, "macro.fivetran_utils.default__timestamp_add": {"unique_id": "macro.fivetran_utils.default__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "default__timestamp_add", "macro_sql": "{% macro default__timestamp_add(datepart, interval, from_timestamp) %}\n\n timestampadd(\n {{ datepart }},\n {{ interval }},\n {{ from_timestamp }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.701091}, "macro.fivetran_utils.bigquery__timestamp_add": {"unique_id": "macro.fivetran_utils.bigquery__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "bigquery__timestamp_add", "macro_sql": "{% macro bigquery__timestamp_add(datepart, interval, from_timestamp) %}\n\n timestamp_add({{ from_timestamp }}, interval {{ interval }} {{ datepart }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.701615}, "macro.fivetran_utils.redshift__timestamp_add": {"unique_id": "macro.fivetran_utils.redshift__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "redshift__timestamp_add", "macro_sql": "{% macro redshift__timestamp_add(datepart, interval, from_timestamp) %}\n\n dateadd(\n {{ datepart }},\n {{ interval }},\n {{ from_timestamp }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.702077}, "macro.fivetran_utils.postgres__timestamp_add": {"unique_id": "macro.fivetran_utils.postgres__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "postgres__timestamp_add", "macro_sql": "{% macro postgres__timestamp_add(datepart, interval, from_timestamp) %}\n\n {{ from_timestamp }} + ((interval '1 {{ datepart }}') * ({{ interval }}))\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.7025359}, "macro.fivetran_utils.spark__timestamp_add": {"unique_id": "macro.fivetran_utils.spark__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "spark__timestamp_add", "macro_sql": "{% macro spark__timestamp_add(datepart, interval, from_timestamp) %}\n\n {{ dbt_utils.dateadd(datepart, interval, from_timestamp) }}\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.703081}, "macro.fivetran_utils.ceiling": {"unique_id": "macro.fivetran_utils.ceiling", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "name": "ceiling", "macro_sql": "{% macro ceiling(num) -%}\n\n{{ adapter.dispatch('ceiling', 'fivetran_utils') (num) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__ceiling"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.704004}, "macro.fivetran_utils.default__ceiling": {"unique_id": "macro.fivetran_utils.default__ceiling", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "name": "default__ceiling", "macro_sql": "{% macro default__ceiling(num) %}\n ceiling({{ num }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.704363}, "macro.fivetran_utils.snowflake__ceiling": {"unique_id": "macro.fivetran_utils.snowflake__ceiling", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "name": "snowflake__ceiling", "macro_sql": "{% macro snowflake__ceiling(num) %}\n ceil({{ num }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.704691}, "macro.fivetran_utils.remove_prefix_from_columns": {"unique_id": "macro.fivetran_utils.remove_prefix_from_columns", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/remove_prefix_from_columns.sql", "original_file_path": "macros/remove_prefix_from_columns.sql", "name": "remove_prefix_from_columns", "macro_sql": "{% macro remove_prefix_from_columns(columns, prefix='', exclude=[]) %}\n\n {%- for col in columns if col.name not in exclude -%}\n {%- if col.name[:prefix|length]|lower == prefix -%}\n {{ col.name }} as {{ col.name[prefix|length:] }}\n {%- else -%}\n {{ col.name }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {% endfor -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.7074711}, "macro.fivetran_utils.union_data": {"unique_id": "macro.fivetran_utils.union_data", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/union_data.sql", "original_file_path": "macros/union_data.sql", "name": "union_data", "macro_sql": "{% macro union_data(table_identifier, database_variable, schema_variable, default_database, default_schema, default_variable, union_schema_variable='union_schemas', union_database_variable='union_databases') -%}\n\n{{ adapter.dispatch('union_data', 'fivetran_utils') (\n table_identifier, \n database_variable, \n schema_variable, \n default_database, \n default_schema, \n default_variable,\n union_schema_variable,\n union_database_variable\n ) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__union_data"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.710659}, "macro.fivetran_utils.default__union_data": {"unique_id": "macro.fivetran_utils.default__union_data", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/union_data.sql", "original_file_path": "macros/union_data.sql", "name": "default__union_data", "macro_sql": "{% macro default__union_data(\n table_identifier, \n database_variable, \n schema_variable, \n default_database, \n default_schema, \n default_variable,\n union_schema_variable,\n union_database_variable\n ) %}\n\n{% if var(union_schema_variable, none) %}\n\n {% set relations = [] %}\n \n {% if var(union_schema_variable) is string %}\n {% set trimmed = var(union_schema_variable)|trim('[')|trim(']') %}\n {% set schemas = trimmed.split(',')|map('trim',\" \")|map('trim','\"')|map('trim',\"'\") %}\n {% else %}\n {% set schemas = var(union_schema_variable) %}\n {% endif %}\n\n {% for schema in var(union_schema_variable) %}\n\n {% set relation=adapter.get_relation(\n database=var(database_variable, default_database),\n schema=schema,\n identifier=table_identifier\n ) -%}\n \n {% set relation_exists=relation is not none %}\n\n {% if relation_exists %}\n\n {% do relations.append(relation) %}\n \n {% endif %}\n\n {% endfor %}\n\n {{ dbt_utils.union_relations(relations) }}\n\n{% elif var(union_database_variable, none) %}\n\n {% set relations = [] %}\n\n {% for database in var(union_database_variable) %}\n\n {% set relation=adapter.get_relation(\n database=database,\n schema=var(schema_variable, default_schema),\n identifier=table_identifier\n ) -%}\n\n {% set relation_exists=relation is not none %}\n\n {% if relation_exists %}\n\n {% do relations.append(relation) %}\n \n {% endif %}\n\n {% endfor %}\n\n {{ dbt_utils.union_relations(relations) }}\n\n{% else %}\n\n select * \n from {{ var(default_variable) }}\n\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.union_relations"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.715785}, "macro.fivetran_utils.dummy_coalesce_value": {"unique_id": "macro.fivetran_utils.dummy_coalesce_value", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/dummy_coalesce_value.sql", "original_file_path": "macros/dummy_coalesce_value.sql", "name": "dummy_coalesce_value", "macro_sql": "{% macro dummy_coalesce_value(column) %}\n\n{% set coalesce_value = {\n 'STRING': \"'DUMMY_STRING'\",\n 'BOOLEAN': 'null',\n 'INT': 999999999,\n 'FLOAT': 999999999.99,\n 'TIMESTAMP': 'cast(\"2099-12-31\" as timestamp)',\n 'DATE': 'cast(\"2099-12-31\" as date)',\n} %}\n\n{% if column.is_float() %}\n{{ return(coalesce_value['FLOAT']) }}\n\n{% elif column.is_numeric() %}\n{{ return(coalesce_value['INT']) }}\n\n{% elif column.is_string() %}\n{{ return(coalesce_value['STRING']) }}\n\n{% elif column.data_type|lower == 'boolean' %}\n{{ return(coalesce_value['BOOLEAN']) }}\n\n{% elif 'timestamp' in column.data_type|lower %}\n{{ return(coalesce_value['TIMESTAMP']) }}\n\n{% elif 'date' in column.data_type|lower %}\n{{ return(coalesce_value['DATE']) }}\n\n{% elif 'int' in column.data_type|lower %}\n{{ return(coalesce_value['INT']) }}\n\n{% endif %}\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.719852}, "macro.fivetran_utils.array_agg": {"unique_id": "macro.fivetran_utils.array_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "name": "array_agg", "macro_sql": "{% macro array_agg(field_to_agg) -%}\n\n{{ adapter.dispatch('array_agg', 'fivetran_utils') (field_to_agg) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__array_agg"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.720824}, "macro.fivetran_utils.default__array_agg": {"unique_id": "macro.fivetran_utils.default__array_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "name": "default__array_agg", "macro_sql": "{% macro default__array_agg(field_to_agg) %}\n array_agg({{ field_to_agg }})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.7211242}, "macro.fivetran_utils.redshift__array_agg": {"unique_id": "macro.fivetran_utils.redshift__array_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "name": "redshift__array_agg", "macro_sql": "{% macro redshift__array_agg(field_to_agg) %}\n listagg({{ field_to_agg }}, ',')\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.721515}, "macro.fivetran_utils.empty_variable_warning": {"unique_id": "macro.fivetran_utils.empty_variable_warning", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/empty_variable_warning.sql", "original_file_path": "macros/empty_variable_warning.sql", "name": "empty_variable_warning", "macro_sql": "{% macro empty_variable_warning(variable, downstream_model) %}\n\n{% if not var(variable) %}\n{{ log(\n \"\"\"\n Warning: You have passed an empty list to the \"\"\" ~ variable ~ \"\"\".\n As a result, you won't see the history of any columns in the \"\"\" ~ downstream_model ~ \"\"\" model.\n \"\"\",\n info=True\n) }}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.722732}, "macro.fivetran_utils.enabled_vars_one_true": {"unique_id": "macro.fivetran_utils.enabled_vars_one_true", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/enabled_vars_one_true.sql", "original_file_path": "macros/enabled_vars_one_true.sql", "name": "enabled_vars_one_true", "macro_sql": "{% macro enabled_vars_one_true(vars) %}\n\n{% for v in vars %}\n \n {% if var(v, False) == True %}\n {{ return(True) }}\n {% endif %}\n\n{% endfor %}\n\n{{ return(False) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.723952}, "macro.tiktok_ads_source.get_ad_group_history_columns": {"unique_id": "macro.tiktok_ads_source.get_ad_group_history_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_ad_group_history_columns.sql", "original_file_path": "macros/get_ad_group_history_columns.sql", "name": "get_ad_group_history_columns", "macro_sql": "{% macro get_ad_group_history_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"action_days\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"adgroup_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"adgroup_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"advertiser_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"android_osv\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"app_download_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"app_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"app_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"app_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"audience_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"bid\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"bid_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"billing_event\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"budget\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"budget_mode\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"category\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"click_tracking_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"conversion_bid\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cpv_video_duration\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"create_time\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"creative_material_mode\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"dayparting\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"deep_bid_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"deep_cpabid\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"deep_external_action\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"display_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"enable_inventory_filter\", \"datatype\": \"boolean\"},\n {\"name\": \"external_action\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"fallback_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"frequency\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"frequency_schedule\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"gender\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"impression_tracking_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"ios_osv\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"is_comment_disable\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"is_hfss\", \"datatype\": \"boolean\"},\n {\"name\": \"is_new_structure\", \"datatype\": \"boolean\"},\n {\"name\": \"landing_page_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"open_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"open_url_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"opt_status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"optimize_goal\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"pacing\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"package\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"pixel_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"placement_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"profile_image\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"schedule_end_time\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"schedule_start_time\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"schedule_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"skip_learning_phase\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"statistic_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"updated_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"video_download\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"audience\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"excluded_audience\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"location\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"interest_category_v_2\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"pangle_block_app_list_id\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"action_categories\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"placement\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"keywords\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"age\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"languages\", \"datatype\": dbt_utils.type_string()}\n\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_numeric", "macro.dbt_utils.type_string", "macro.dbt_utils.type_float"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.7445319}, "macro.tiktok_ads_source.get_ad_group_report_hourly_columns": {"unique_id": "macro.tiktok_ads_source.get_ad_group_report_hourly_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_ad_group_report_hourly_columns.sql", "original_file_path": "macros/get_ad_group_report_hourly_columns.sql", "name": "get_ad_group_report_hourly_columns", "macro_sql": "{% macro get_ad_group_report_hourly_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"adgroup_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"average_video_play\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"average_video_play_per_user\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"clicks\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"comments\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_1000_reached\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_conversion\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_result\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_secondary_goal_result\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"cpc\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cpm\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"ctr\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"follows\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"impressions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"likes\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"profile_visits\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"profile_visits_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"reach\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"real_time_conversion\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"real_time_conversion_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"real_time_cost_per_conversion\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"real_time_cost_per_result\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"real_time_result\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"real_time_result_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"result\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"result_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"secondary_goal_result\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"secondary_goal_result_rate\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"shares\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"spend\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"stat_time_hour\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"video_play_actions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_100\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_25\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_50\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_75\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_2_s\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_6_s\", \"datatype\": dbt_utils.type_numeric()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_numeric", "macro.dbt_utils.type_float", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.756104}, "macro.tiktok_ads_source.get_advertiser_columns": {"unique_id": "macro.tiktok_ads_source.get_advertiser_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_advertiser_columns.sql", "original_file_path": "macros/get_advertiser_columns.sql", "name": "get_advertiser_columns", "macro_sql": "{% macro get_advertiser_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"address\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"balance\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"company\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"contacter\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"country\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"create_time\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"currency\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"description\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"email\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"industry\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"language\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"license_no\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"license_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"phone_number\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"promotion_area\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"reason\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"role\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"telephone\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"timezone\", \"datatype\": dbt_utils.type_string()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_string", "macro.dbt_utils.type_float", "macro.dbt_utils.type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.762691}, "macro.tiktok_ads_source.get_campaign_history_columns": {"unique_id": "macro.tiktok_ads_source.get_campaign_history_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_campaign_history_columns.sql", "original_file_path": "macros/get_campaign_history_columns.sql", "name": "get_campaign_history_columns", "macro_sql": "{% macro get_campaign_history_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"advertiser_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"budget\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"budget_mode\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"campaign_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"create_time\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"is_new_structure\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"objective_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"opt_status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"split_test_variable\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"updated_at\", \"datatype\": dbt_utils.type_timestamp()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_numeric", "macro.dbt_utils.type_float", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.766666}, "macro.tiktok_ads_source.get_campaign_report_hourly_columns": {"unique_id": "macro.tiktok_ads_source.get_campaign_report_hourly_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_campaign_report_hourly_columns.sql", "original_file_path": "macros/get_campaign_report_hourly_columns.sql", "name": "get_campaign_report_hourly_columns", "macro_sql": "{% macro get_campaign_report_hourly_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"average_video_play\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"average_video_play_per_user\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"clicks\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"comments\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_1000_reached\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_conversion\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_result\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_secondary_goal_result\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"cpc\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cpm\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"ctr\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"follows\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"impressions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"likes\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"profile_visits\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"profile_visits_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"reach\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"real_time_conversion\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"real_time_conversion_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"real_time_cost_per_conversion\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"real_time_cost_per_result\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"real_time_result\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"real_time_result_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"result\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"result_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"secondary_goal_result\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"secondary_goal_result_rate\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"shares\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"spend\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"stat_time_hour\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"video_play_actions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_100\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_25\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_50\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_75\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_2_s\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_6_s\", \"datatype\": dbt_utils.type_numeric()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_float", "macro.dbt_utils.type_numeric", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.7784178}, "macro.tiktok_ads_source.get_ad_history_columns": {"unique_id": "macro.tiktok_ads_source.get_ad_history_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_ad_history_columns.sql", "original_file_path": "macros/get_ad_history_columns.sql", "name": "get_ad_history_columns", "macro_sql": "{% macro get_ad_history_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"ad_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"ad_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"ad_text\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"adgroup_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"advertiser_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"app_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"call_to_action\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"click_tracking_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"create_time\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"display_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"impression_tracking_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"is_aco\", \"datatype\": \"boolean\"},\n {\"name\": \"is_creative_authorized\", \"datatype\": \"boolean\"},\n {\"name\": \"is_new_structure\", \"datatype\": \"boolean\"},\n {\"name\": \"landing_page_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"open_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"opt_status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"playable_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"profile_image\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"updated_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"video_id\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"image_ids\", \"datatype\": dbt_utils.type_string()}\n\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_numeric", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.7856908}, "macro.tiktok_ads_source.get_ad_report_hourly_columns": {"unique_id": "macro.tiktok_ads_source.get_ad_report_hourly_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_ad_report_hourly_columns.sql", "original_file_path": "macros/get_ad_report_hourly_columns.sql", "name": "get_ad_report_hourly_columns", "macro_sql": "{% macro get_ad_report_hourly_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"ad_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"average_video_play\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"average_video_play_per_user\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"clicks\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"comments\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_1000_reached\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_conversion\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_result\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_secondary_goal_result\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"cpc\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cpm\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"ctr\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"follows\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"impressions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"likes\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"profile_visits\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"profile_visits_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"reach\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"real_time_conversion\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"real_time_conversion_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"real_time_cost_per_conversion\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"real_time_cost_per_result\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"real_time_result\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"real_time_result_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"result\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"result_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"secondary_goal_result\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"secondary_goal_result_rate\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"shares\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"spend\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"stat_time_hour\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"video_play_actions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_100\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_25\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_50\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_75\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_2_s\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_6_s\", \"datatype\": dbt_utils.type_numeric()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_numeric", "macro.dbt_utils.type_float", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1658244907.797817}}, "docs": {"dbt.__overview__": {"unique_id": "dbt.__overview__", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "overview.md", "original_file_path": "docs/overview.md", "name": "__overview__", "block_contents": "### Welcome!\n\nWelcome to the auto-generated documentation for your dbt project!\n\n### Navigation\n\nYou can use the `Project` and `Database` navigation tabs on the left side of the window to explore the models\nin your project.\n\n#### Project Tab\nThe `Project` tab mirrors the directory structure of your dbt project. In this tab, you can see all of the\nmodels defined in your dbt project, as well as models imported from dbt packages.\n\n#### Database Tab\nThe `Database` tab also exposes your models, but in a format that looks more like a database explorer. This view\nshows relations (tables and views) grouped into database schemas. Note that ephemeral models are _not_ shown\nin this interface, as they do not exist in the database.\n\n### Graph Exploration\nYou can click the blue icon on the bottom-right corner of the page to view the lineage graph of your models.\n\nOn model pages, you'll see the immediate parents and children of the model you're exploring. By clicking the `Expand`\nbutton at the top-right of this lineage pane, you'll be able to see all of the models that are used to build,\nor are built from, the model you're exploring.\n\nOnce expanded, you'll be able to use the `--select` and `--exclude` model selection syntax to filter the\nmodels in the graph. For more information on model selection, check out the [dbt docs](https://docs.getdbt.com/docs/model-selection-syntax).\n\nNote that you can also right-click on models to interactively filter and explore the graph.\n\n---\n\n### More information\n\n- [What is dbt](https://docs.getdbt.com/docs/overview)?\n- Read the [dbt viewpoint](https://docs.getdbt.com/docs/viewpoint)\n- [Installation](https://docs.getdbt.com/docs/installation)\n- Join the [dbt Community](https://www.getdbt.com/community/) for questions and discussion"}}, "exposures": {}, "metrics": {}, "selectors": {}, "disabled": {}, "parent_map": {"model.tiktok_ads.int_tiktok_ads__most_recent_campaign": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"], "model.tiktok_ads.int_tiktok_ads__most_recent_ad": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"], "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__advertiser": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp", "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__ad_history": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_history": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp": ["source.tiktok_ads_source.tiktok_ads.ad_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp": ["source.tiktok_ads_source.tiktok_ads.ad_history"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp": ["source.tiktok_ads_source.tiktok_ads.adgroup_history"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp": ["source.tiktok_ads_source.tiktok_ads.campaign_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp": ["source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp": ["source.tiktok_ads_source.tiktok_ads.campaign_history"], "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp": ["source.tiktok_ads_source.tiktok_ads.advertiser"], "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.fcb8c561bc": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad_group"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at.e2e9914076": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad_group"], "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_ad_id.14e9c145ca": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at.f58d824f65": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad"], "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_campaign_campaign_id.8cefa8981c": ["model.tiktok_ads.int_tiktok_ads__most_recent_campaign"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at.39077adf71": ["model.tiktok_ads.int_tiktok_ads__most_recent_campaign"], "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"], "model.tiktok_ads.tiktok_ads__campaign_report": ["model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "model.tiktok_ads_source.stg_tiktok_ads__advertiser", "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"], "model.tiktok_ads.tiktok_ads__url_report": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad", "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "model.tiktok_ads.tiktok_ads__ad_report": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad", "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "model.tiktok_ads.tiktok_ads__account_report": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad", "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day.cc5f756c69": ["model.tiktok_ads.tiktok_ads__campaign_report"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_report_ad_id__date_day.15357fac89": ["model.tiktok_ads.tiktok_ads__ad_report"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__url_report_ad_id__date_day.8b73e512af": ["model.tiktok_ads.tiktok_ads__url_report"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__account_report_advertiser_id__date_day.7b27a2f43b": ["model.tiktok_ads.tiktok_ads__account_report"], "model.tiktok_ads.tiktok_ads__ad_group_report": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_adapter_ad_id__date_day.c70f86f560": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day.2eb4c2ff6d": ["model.tiktok_ads.tiktok_ads__ad_group_report"], "source.tiktok_ads_source.tiktok_ads.advertiser": [], "source.tiktok_ads_source.tiktok_ads.campaign_history": [], "source.tiktok_ads_source.tiktok_ads.adgroup_history": [], "source.tiktok_ads_source.tiktok_ads.ad_history": [], "source.tiktok_ads_source.tiktok_ads.ad_report_hourly": [], "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly": [], "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly": []}, "child_map": {"model.tiktok_ads.int_tiktok_ads__most_recent_campaign": ["model.tiktok_ads.tiktok_ads__ad_group_report", "model.tiktok_ads.tiktok_ads__ad_report", "model.tiktok_ads.tiktok_ads__campaign_report", "model.tiktok_ads.tiktok_ads__url_report", "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at.39077adf71", "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_campaign_campaign_id.8cefa8981c"], "model.tiktok_ads.int_tiktok_ads__most_recent_ad": ["model.tiktok_ads.tiktok_ads__account_report", "model.tiktok_ads.tiktok_ads__ad_report", "model.tiktok_ads.tiktok_ads__url_report", "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at.f58d824f65", "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_ad_id.14e9c145ca"], "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group": ["model.tiktok_ads.tiktok_ads__ad_group_report", "model.tiktok_ads.tiktok_ads__ad_report", "model.tiktok_ads.tiktok_ads__url_report", "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at.e2e9914076", "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.fcb8c561bc"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de", "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad"], "model.tiktok_ads_source.stg_tiktok_ads__advertiser": ["model.tiktok_ads.tiktok_ads__account_report", "model.tiktok_ads.tiktok_ads__ad_group_report", "model.tiktok_ads.tiktok_ads__ad_report", "model.tiktok_ads.tiktok_ads__campaign_report", "model.tiktok_ads.tiktok_ads__url_report", "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def", "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66"], "model.tiktok_ads_source.stg_tiktok_ads__ad_history": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad", "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1", "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_history": ["model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b", "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1"], "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history", "model.tiktok_ads_source.stg_tiktok_ads__ad_history"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history", "model.tiktok_ads_source.stg_tiktok_ads__campaign_history"], "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser", "model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.fcb8c561bc": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at.e2e9914076": [], "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_ad_id.14e9c145ca": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at.f58d824f65": [], "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_campaign_campaign_id.8cefa8981c": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at.39077adf71": [], "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b": [], "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly": ["model.tiktok_ads.tiktok_ads__campaign_report", "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34", "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly": ["model.tiktok_ads.tiktok_ads__ad_group_report", "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad", "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1"], "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly": ["model.tiktok_ads.tiktok_ads__account_report", "model.tiktok_ads.tiktok_ads__ad_report", "model.tiktok_ads.tiktok_ads__url_report", "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d": [], "model.tiktok_ads.tiktok_ads__campaign_report": ["test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day.cc5f756c69"], "model.tiktok_ads.tiktok_ads__url_report": ["test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__url_report_ad_id__date_day.8b73e512af"], "model.tiktok_ads.tiktok_ads__ad_report": ["test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_report_ad_id__date_day.15357fac89"], "model.tiktok_ads.tiktok_ads__account_report": ["test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__account_report_advertiser_id__date_day.7b27a2f43b"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day.cc5f756c69": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_report_ad_id__date_day.15357fac89": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__url_report_ad_id__date_day.8b73e512af": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__account_report_advertiser_id__date_day.7b27a2f43b": [], "model.tiktok_ads.tiktok_ads__ad_group_report": ["test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day.2eb4c2ff6d"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_adapter_ad_id__date_day.c70f86f560": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day.2eb4c2ff6d": [], "source.tiktok_ads_source.tiktok_ads.advertiser": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp"], "source.tiktok_ads_source.tiktok_ads.campaign_history": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp"], "source.tiktok_ads_source.tiktok_ads.adgroup_history": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp"], "source.tiktok_ads_source.tiktok_ads.ad_history": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp"], "source.tiktok_ads_source.tiktok_ads.ad_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp"], "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp"], "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp"]}} \ No newline at end of file +{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v4.json", "dbt_version": "1.0.0", "generated_at": "2022-07-28T16:21:10.068522Z", "invocation_id": "73d9028b-4406-406d-9101-01780cecfbb9", "env": {}, "project_id": "faebc42304447d4427374f806679ecb5", "user_id": "e607f749-4294-4b15-833b-0ae4a87d4d24", "send_anonymous_usage_stats": true, "adapter_type": "bigquery"}, "nodes": {"model.tiktok_ads.tiktok_ads__ad_group_report": {"raw_sql": "with hourly as (\n \n select *\n from {{ var('ad_group_report_hourly') }}\n\n), ad_groups as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_ad_group') }}\n\n), advertiser as (\n\n select *\n from {{ var('advertiser') }}\n\n), campaigns as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_campaign') }}\n\n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n ad_groups.advertiser_id,\n advertiser.advertiser_name,\n campaigns.campaign_id,\n campaigns.campaign_name,\n hourly.ad_group_id,\n ad_groups.ad_group_name,\n advertiser.currency,\n ad_groups.action_categories,\n ad_groups.category,\n ad_groups.gender,\n ad_groups.audience_type,\n ad_groups.budget,\n ad_groups.age,\n ad_groups.languages,\n ad_groups.interest_category,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n {% for metric in var('tiktok_ads__ad_group_hourly_passthrough_metrics', []) %}\n , sum(hourly.{{ metric }}) as {{ metric }}\n {% endfor %}\n from hourly\n left join ad_groups \n on hourly.ad_group_id = ad_groups.ad_group_id\n left join advertiser\n on ad_groups.advertiser_id = advertiser.advertiser_id\n left join campaigns\n on ad_groups.campaign_id = campaigns.campaign_id\n {{ dbt_utils.group_by(16) }}\n\n)\n\nselect *\nfrom aggregated", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.group_by"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly", "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "model.tiktok_ads_source.stg_tiktok_ads__advertiser", "model.tiktok_ads.int_tiktok_ads__most_recent_campaign"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_tiktok_ads", "fqn": ["tiktok_ads", "tiktok_ads__ad_group_report"], "unique_id": "model.tiktok_ads.tiktok_ads__ad_group_report", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "tiktok_ads__ad_group_report.sql", "original_file_path": "models/tiktok_ads__ad_group_report.sql", "name": "tiktok_ads__ad_group_report", "alias": "tiktok_ads__ad_group_report", "checksum": {"name": "sha256", "checksum": "4d9c652cfe378018869cfdd831056ec099d46848e7a30007fdb1b9c8d3ca0a62"}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_report_hourly"], ["int_tiktok_ads__most_recent_ad_group"], ["stg_tiktok_ads__advertiser"], ["int_tiktok_ads__most_recent_campaign"]], "sources": [], "description": "Each record in this table represents the daily performance of ads at the ad group level.", "columns": {"date_day": {"name": "date_day", "description": "Day of record", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "Ad group name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_name": {"name": "advertiser_name", "description": "Advertiser name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "currency": {"name": "currency", "description": "Advertiser's currency.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_categories": {"name": "action_categories", "description": "IDs of the action categories (behaviors) that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "age": {"name": "age", "description": "Age groups you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience_type": {"name": "audience_type", "description": "Audience Type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget": {"name": "budget", "description": "Ad budget. Returns 0.0 when Campaign Budget Optimization (budget_optimize_switch) is on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "category": {"name": "category", "description": "Ad group category.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "interest_category": {"name": "interest_category", "description": "Interest classification. If the interest is specified, users that do not meet interest target will be excluded during delivery.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "languages": {"name": "languages", "description": "Codes of the languages that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of impressions that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The amount of spend that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of follows that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpc": {"name": "daily_cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpm": {"name": "daily_cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_ctr": {"name": "daily_ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads__ad_group_report.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "table"}, "created_at": 1659025250.225373, "compiled_sql": "with __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n), __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n),hourly as (\n \n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_group_report_hourly`\n\n), ad_groups as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_ad_group\n\n), advertiser as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__advertiser`\n\n), campaigns as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_campaign\n\n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n ad_groups.advertiser_id,\n advertiser.advertiser_name,\n campaigns.campaign_id,\n campaigns.campaign_name,\n hourly.ad_group_id,\n ad_groups.ad_group_name,\n advertiser.currency,\n ad_groups.action_categories,\n ad_groups.category,\n ad_groups.gender,\n ad_groups.audience_type,\n ad_groups.budget,\n ad_groups.age,\n ad_groups.languages,\n ad_groups.interest_category,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n \n , sum(hourly.result) as result\n \n from hourly\n left join ad_groups \n on hourly.ad_group_id = ad_groups.ad_group_id\n left join advertiser\n on ad_groups.advertiser_id = advertiser.advertiser_id\n left join campaigns\n on ad_groups.campaign_id = campaigns.campaign_id\n group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16\n\n)\n\nselect *\nfrom aggregated", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}, {"id": "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "sql": " __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": "`database`.`dbt_renee_tiktok_ads`.`tiktok_ads__ad_group_report`"}, "model.tiktok_ads.tiktok_ads__url_report": {"raw_sql": "with hourly as (\n \n select *\n from {{ var('ad_report_hourly') }}\n\n), ads as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_ad') }}\n\n), ad_groups as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_ad_group') }}\n\n), advertiser as (\n\n select *\n from {{ var('advertiser') }}\n\n), campaigns as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_campaign') }}\n\n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n ad_groups.advertiser_id,\n advertiser.advertiser_name,\n campaigns.campaign_id,\n campaigns.campaign_name,\n ad_groups.ad_group_id,\n ad_groups.ad_group_name,\n hourly.ad_id,\n ads.ad_name,\n ads.base_url,\n ads.url_host,\n ads.url_path,\n ads.utm_source,\n ads.utm_medium,\n ads.utm_campaign,\n ads.utm_content,\n ads.utm_term,\n advertiser.currency,\n ad_groups.action_categories,\n ad_groups.category,\n ad_groups.gender,\n ad_groups.audience_type,\n ad_groups.budget,\n ad_groups.age,\n ad_groups.languages,\n ad_groups.interest_category,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n {% for metric in var('tiktok_ads__ad_hourly_passthrough_metrics', []) %}\n , sum(hourly.{{ metric }}) as {{ metric }}\n {% endfor %}\n from hourly\n left join ads\n on hourly.ad_id = ads.ad_id\n left join ad_groups \n on ads.ad_group_id = ad_groups.ad_group_id\n left join advertiser\n on ads.advertiser_id = advertiser.advertiser_id\n left join campaigns\n on ads.campaign_id = campaigns.campaign_id\n\n -- We only want utm ads to populate this report. Therefore, we filter where url ads are populated.\n where ads.landing_page_url is not null\n {{ dbt_utils.group_by(26) }}\n\n)\n\nselect *\nfrom aggregated", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.group_by"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "model.tiktok_ads_source.stg_tiktok_ads__advertiser", "model.tiktok_ads.int_tiktok_ads__most_recent_campaign"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_tiktok_ads", "fqn": ["tiktok_ads", "tiktok_ads__url_report"], "unique_id": "model.tiktok_ads.tiktok_ads__url_report", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "tiktok_ads__url_report.sql", "original_file_path": "models/tiktok_ads__url_report.sql", "name": "tiktok_ads__url_report", "alias": "tiktok_ads__url_report", "checksum": {"name": "sha256", "checksum": "43277aa326650ef818aa44cfa4fe00ef71d07bf523ec08a608ca7309f85a3af4"}, "tags": [], "refs": [["stg_tiktok_ads__ad_report_hourly"], ["int_tiktok_ads__most_recent_ad"], ["int_tiktok_ads__most_recent_ad_group"], ["stg_tiktok_ads__advertiser"], ["int_tiktok_ads__most_recent_campaign"]], "sources": [], "description": "Each record in this table represents the daily performance of ads at the URL level.", "columns": {"date_day": {"name": "date_day", "description": "Day of record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_id": {"name": "ad_id", "description": "Ad ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_name": {"name": "ad_name", "description": "Ad name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_name": {"name": "advertiser_name", "description": "Advertiser name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "Ad group ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "Ad group name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "base_url": {"name": "base_url", "description": "The base URL of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_host": {"name": "url_host", "description": "The URL host of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_path": {"name": "url_path", "description": "The URL path of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_source": {"name": "utm_source", "description": "The utm_source parameter of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_medium": {"name": "utm_medium", "description": "The utm_medium parameter of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_campaign": {"name": "utm_campaign", "description": "The utm_campaign parameter of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_content": {"name": "utm_content", "description": "The utm_content parameter of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_term": {"name": "utm_term", "description": "The utm_term parameter of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_categories": {"name": "action_categories", "description": "IDs of the action categories (behaviors) that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "age": {"name": "age", "description": "Age groups you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience_type": {"name": "audience_type", "description": "Audience Type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget": {"name": "budget", "description": "Ad budget. Returns 0.0 when Campaign Budget Optimization (budget_optimize_switch) is on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "category": {"name": "category", "description": "Ad group category.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "interest_category": {"name": "interest_category", "description": "Interest classification. If the interest is specified, users that do not meet interest target will be excluded during delivery.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "languages": {"name": "languages", "description": "Codes of the languages that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "currency": {"name": "currency", "description": "Advertiser's currency.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of impressions that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The amount of spend that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of follows that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpc": {"name": "daily_cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpm": {"name": "daily_cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_ctr": {"name": "daily_ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads__url_report.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "table"}, "created_at": 1659025250.249853, "compiled_sql": "with __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n), __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n), __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n),hourly as (\n \n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_report_hourly`\n\n), ads as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_ad\n\n), ad_groups as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_ad_group\n\n), advertiser as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__advertiser`\n\n), campaigns as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_campaign\n\n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n ad_groups.advertiser_id,\n advertiser.advertiser_name,\n campaigns.campaign_id,\n campaigns.campaign_name,\n ad_groups.ad_group_id,\n ad_groups.ad_group_name,\n hourly.ad_id,\n ads.ad_name,\n ads.base_url,\n ads.url_host,\n ads.url_path,\n ads.utm_source,\n ads.utm_medium,\n ads.utm_campaign,\n ads.utm_content,\n ads.utm_term,\n advertiser.currency,\n ad_groups.action_categories,\n ad_groups.category,\n ad_groups.gender,\n ad_groups.audience_type,\n ad_groups.budget,\n ad_groups.age,\n ad_groups.languages,\n ad_groups.interest_category,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n \n , sum(hourly.REAL_TIME_COST_PER_RESULT) as REAL_TIME_COST_PER_RESULT\n \n from hourly\n left join ads\n on hourly.ad_id = ads.ad_id\n left join ad_groups \n on ads.ad_group_id = ad_groups.ad_group_id\n left join advertiser\n on ads.advertiser_id = advertiser.advertiser_id\n left join campaigns\n on ads.campaign_id = campaigns.campaign_id\n\n -- We only want utm ads to populate this report. Therefore, we filter where url ads are populated.\n where ads.landing_page_url is not null\n group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26\n\n)\n\nselect *\nfrom aggregated", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}, {"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}, {"id": "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "sql": " __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": "`database`.`dbt_renee_tiktok_ads`.`tiktok_ads__url_report`"}, "model.tiktok_ads.tiktok_ads__account_report": {"raw_sql": "with hourly as (\n \n select *\n from {{ var('ad_report_hourly') }}\n\n), advertiser as (\n\n select *\n from {{ var('advertiser') }}\n\n), ads as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_ad') }}\n\n), joined as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n ads.advertiser_id,\n advertiser.advertiser_name,\n advertiser.currency,\n sum(hourly.clicks) as clicks,\n sum(hourly.impressions) as impressions,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s, \n sum(hourly.video_watched_6_s) as video_watched_6_s, \n sum(hourly.video_views_p_25) as video_views_p_25, \n sum(hourly.video_views_p_50) as video_views_p_50,\n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n {% for metric in var('tiktok_ads__ad_hourly_passthrough_metrics', []) %}\n , sum(hourly.{{ metric }}) as {{ metric }}\n {% endfor %}\n from hourly\n left join ads\n on hourly.ad_id = ads.ad_id\n left join advertiser\n on ads.advertiser_id = advertiser.advertiser_id\n {{ dbt_utils.group_by(4) }}\n \n\n\n)\n\nselect *\nfrom joined", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.group_by"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__advertiser", "model.tiktok_ads.int_tiktok_ads__most_recent_ad"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_tiktok_ads", "fqn": ["tiktok_ads", "tiktok_ads__account_report"], "unique_id": "model.tiktok_ads.tiktok_ads__account_report", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "tiktok_ads__account_report.sql", "original_file_path": "models/tiktok_ads__account_report.sql", "name": "tiktok_ads__account_report", "alias": "tiktok_ads__account_report", "checksum": {"name": "sha256", "checksum": "4d92af604bb91482ca33af0f21c0dcce9ba18fa0d93744f4bc42023e93f0f756"}, "tags": [], "refs": [["stg_tiktok_ads__ad_report_hourly"], ["stg_tiktok_ads__advertiser"], ["int_tiktok_ads__most_recent_ad"]], "sources": [], "description": "Each record in this table represents the daily performance of ads at the account level.", "columns": {"date_day": {"name": "date_day", "description": "Day of record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_name": {"name": "advertiser_name", "description": "Advertiser name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "currency": {"name": "currency", "description": "Advertiser's currency.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of impressions that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The amount of spend that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of follows that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpc": {"name": "daily_cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpm": {"name": "daily_cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_ctr": {"name": "daily_ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads__account_report.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "table"}, "created_at": 1659025250.1962502, "compiled_sql": "with __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n),hourly as (\n \n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_report_hourly`\n\n), advertiser as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__advertiser`\n\n), ads as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_ad\n\n), joined as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n ads.advertiser_id,\n advertiser.advertiser_name,\n advertiser.currency,\n sum(hourly.clicks) as clicks,\n sum(hourly.impressions) as impressions,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s, \n sum(hourly.video_watched_6_s) as video_watched_6_s, \n sum(hourly.video_views_p_25) as video_views_p_25, \n sum(hourly.video_views_p_50) as video_views_p_50,\n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n \n , sum(hourly.REAL_TIME_COST_PER_RESULT) as REAL_TIME_COST_PER_RESULT\n \n from hourly\n left join ads\n on hourly.ad_id = ads.ad_id\n left join advertiser\n on ads.advertiser_id = advertiser.advertiser_id\n group by 1,2,3,4\n \n\n\n)\n\nselect *\nfrom joined", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": "`database`.`dbt_renee_tiktok_ads`.`tiktok_ads__account_report`"}, "model.tiktok_ads.tiktok_ads__campaign_report": {"raw_sql": "with hourly as (\n \n select *\n from {{ var('campaign_report_hourly') }}\n\n), campaigns as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_campaign') }}\n\n), advertiser as (\n\n select *\n from {{ var('advertiser') }}\n \n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n advertiser.advertiser_id,\n advertiser.advertiser_name,\n hourly.campaign_id,\n campaigns.campaign_name,\n advertiser.currency,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n {% for metric in var('tiktok_ads__campaign_hourly_passthrough_metrics', []) %}\n , sum(hourly.{{ metric }}) as {{ metric }}\n {% endfor %}\n from hourly\n left join campaigns\n on hourly.campaign_id = campaigns.campaign_id\n left join advertiser\n on campaigns.advertiser_id = advertiser.advertiser_id\n {{ dbt_utils.group_by(6) }}\n\n)\n\nselect *\nfrom aggregated", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.group_by"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly", "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "model.tiktok_ads_source.stg_tiktok_ads__advertiser"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_tiktok_ads", "fqn": ["tiktok_ads", "tiktok_ads__campaign_report"], "unique_id": "model.tiktok_ads.tiktok_ads__campaign_report", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "tiktok_ads__campaign_report.sql", "original_file_path": "models/tiktok_ads__campaign_report.sql", "name": "tiktok_ads__campaign_report", "alias": "tiktok_ads__campaign_report", "checksum": {"name": "sha256", "checksum": "705a629feb32d1c01ed4a276f0a9cc2e232049e0a155229954075ff50e552aa4"}, "tags": [], "refs": [["stg_tiktok_ads__campaign_report_hourly"], ["int_tiktok_ads__most_recent_campaign"], ["stg_tiktok_ads__advertiser"]], "sources": [], "description": "Each record in this table represents the daily performance at the campaign level.", "columns": {"date_day": {"name": "date_day", "description": "Day of record", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_name": {"name": "advertiser_name", "description": "Advertiser name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of impressions that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The amount of spend that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of follows that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpc": {"name": "daily_cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpm": {"name": "daily_cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_daily_ctr": {"name": "daily_daily_ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads__campaign_report.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "table"}, "created_at": 1659025250.234406, "compiled_sql": "with __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n),hourly as (\n \n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_report_hourly`\n\n), campaigns as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_campaign\n\n), advertiser as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__advertiser`\n \n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n advertiser.advertiser_id,\n advertiser.advertiser_name,\n hourly.campaign_id,\n campaigns.campaign_name,\n advertiser.currency,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n \n , sum(hourly.result) as result\n \n from hourly\n left join campaigns\n on hourly.campaign_id = campaigns.campaign_id\n left join advertiser\n on campaigns.advertiser_id = advertiser.advertiser_id\n group by 1,2,3,4,5,6\n\n)\n\nselect *\nfrom aggregated", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "sql": " __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": "`database`.`dbt_renee_tiktok_ads`.`tiktok_ads__campaign_report`"}, "model.tiktok_ads.tiktok_ads__ad_report": {"raw_sql": "with hourly as (\n \n select *\n from {{ var('ad_report_hourly') }}\n\n), ads as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_ad') }}\n\n), ad_groups as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_ad_group') }}\n\n), advertiser as (\n\n select *\n from {{ var('advertiser') }}\n\n), campaigns as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_campaign') }}\n\n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n ad_groups.advertiser_id,\n advertiser.advertiser_name,\n campaigns.campaign_id,\n campaigns.campaign_name,\n ad_groups.ad_group_id,\n ad_groups.ad_group_name,\n hourly.ad_id,\n ads.ad_name,\n advertiser.currency,\n ad_groups.category,\n ad_groups.action_categories,\n ad_groups.gender,\n ad_groups.audience_type,\n ad_groups.budget,\n ad_groups.age,\n ad_groups.languages,\n ad_groups.interest_category,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n {% for metric in var('tiktok_ads__ad_hourly_passthrough_metrics', []) %}\n , sum(hourly.{{ metric }}) as {{ metric }}\n {% endfor %}\n from hourly\n left join ads\n on hourly.ad_id = ads.ad_id\n left join ad_groups \n on ads.ad_group_id = ad_groups.ad_group_id\n left join advertiser\n on ads.advertiser_id = advertiser.advertiser_id\n left join campaigns\n on ads.campaign_id = campaigns.campaign_id\n {{ dbt_utils.group_by(18) }}\n\n)\n\nselect *\nfrom aggregated", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.group_by"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "model.tiktok_ads_source.stg_tiktok_ads__advertiser", "model.tiktok_ads.int_tiktok_ads__most_recent_campaign"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_tiktok_ads", "fqn": ["tiktok_ads", "tiktok_ads__ad_report"], "unique_id": "model.tiktok_ads.tiktok_ads__ad_report", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "tiktok_ads__ad_report.sql", "original_file_path": "models/tiktok_ads__ad_report.sql", "name": "tiktok_ads__ad_report", "alias": "tiktok_ads__ad_report", "checksum": {"name": "sha256", "checksum": "425bd8283f1e154b54fe51145ff1b9b337107ac840efcbfbadabdf5930d6f7e7"}, "tags": [], "refs": [["stg_tiktok_ads__ad_report_hourly"], ["int_tiktok_ads__most_recent_ad"], ["int_tiktok_ads__most_recent_ad_group"], ["stg_tiktok_ads__advertiser"], ["int_tiktok_ads__most_recent_campaign"]], "sources": [], "description": "Each record in this table represents the daily performance of ads at the ad level.", "columns": {"date_day": {"name": "date_day", "description": "Day of record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_id": {"name": "ad_id", "description": "Ad ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_name": {"name": "ad_name", "description": "Ad name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_name": {"name": "advertiser_name", "description": "Advertiser name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "Ad group ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "Ad group name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_categories": {"name": "action_categories", "description": "IDs of the action categories (behaviors) that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "age": {"name": "age", "description": "Age groups you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience_type": {"name": "audience_type", "description": "Audience Type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget": {"name": "budget", "description": "Ad budget. Returns 0.0 when Campaign Budget Optimization (budget_optimize_switch) is on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "category": {"name": "category", "description": "Ad group category.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "interest_category": {"name": "interest_category", "description": "Interest classification. If the interest is specified, users that do not meet interest target will be excluded during delivery.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "languages": {"name": "languages", "description": "Codes of the languages that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "currency": {"name": "currency", "description": "Advertiser's currency.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of impressions that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The amount of spend that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of follows that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpc": {"name": "daily_cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpm": {"name": "daily_cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_ctr": {"name": "daily_ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads__ad_report.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "table"}, "created_at": 1659025250.211673, "compiled_sql": "with __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n), __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n), __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n),hourly as (\n \n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_report_hourly`\n\n), ads as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_ad\n\n), ad_groups as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_ad_group\n\n), advertiser as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__advertiser`\n\n), campaigns as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_campaign\n\n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n ad_groups.advertiser_id,\n advertiser.advertiser_name,\n campaigns.campaign_id,\n campaigns.campaign_name,\n ad_groups.ad_group_id,\n ad_groups.ad_group_name,\n hourly.ad_id,\n ads.ad_name,\n advertiser.currency,\n ad_groups.category,\n ad_groups.action_categories,\n ad_groups.gender,\n ad_groups.audience_type,\n ad_groups.budget,\n ad_groups.age,\n ad_groups.languages,\n ad_groups.interest_category,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n \n , sum(hourly.REAL_TIME_COST_PER_RESULT) as REAL_TIME_COST_PER_RESULT\n \n from hourly\n left join ads\n on hourly.ad_id = ads.ad_id\n left join ad_groups \n on ads.ad_group_id = ad_groups.ad_group_id\n left join advertiser\n on ads.advertiser_id = advertiser.advertiser_id\n left join campaigns\n on ads.campaign_id = campaigns.campaign_id\n group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18\n\n)\n\nselect *\nfrom aggregated", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}, {"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}, {"id": "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "sql": " __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": "`database`.`dbt_renee_tiktok_ads`.`tiktok_ads__ad_report`"}, "model.tiktok_ads.int_tiktok_ads__most_recent_campaign": {"raw_sql": "with base as (\n\n select *\n from {{ var('campaign_history') }}\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "ephemeral", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_tiktok_ads", "fqn": ["tiktok_ads", "intermediate", "int_tiktok_ads__most_recent_campaign"], "unique_id": "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "intermediate/int_tiktok_ads__most_recent_campaign.sql", "original_file_path": "models/intermediate/int_tiktok_ads__most_recent_campaign.sql", "name": "int_tiktok_ads__most_recent_campaign", "alias": "int_tiktok_ads__most_recent_campaign", "checksum": {"name": "sha256", "checksum": "6c395cfec3d0d6060d64883569154a087d790db7a438b72cea679e96e4fdd220"}, "tags": [], "refs": [["stg_tiktok_ads__campaign_history"]], "sources": [], "description": "Each record in this table represents the most recent data for each campaign.", "columns": {"campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_type": {"name": "campaign_type", "description": "Campaign Type, indicates the campaign is a regular campaign or iOS 14 campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "split_test_variable": {"name": "split_test_variable", "description": "Split Test variables. Optional values; TARGETING, BIDDING_OPTIMIZATION , CREATIVE.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/intermediate/intermediate.yml", "compiled_path": "target/compiled/tiktok_ads/models/intermediate/int_tiktok_ads__most_recent_campaign.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "ephemeral"}, "created_at": 1659025250.331912, "compiled_sql": "with base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null}, "model.tiktok_ads.int_tiktok_ads__most_recent_ad": {"raw_sql": "with base as (\n\n select *\n from {{ var('ad_history') }}\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "ephemeral", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_tiktok_ads", "fqn": ["tiktok_ads", "intermediate", "int_tiktok_ads__most_recent_ad"], "unique_id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "intermediate/int_tiktok_ads__most_recent_ad.sql", "original_file_path": "models/intermediate/int_tiktok_ads__most_recent_ad.sql", "name": "int_tiktok_ads__most_recent_ad", "alias": "int_tiktok_ads__most_recent_ad", "checksum": {"name": "sha256", "checksum": "418d75ad47295f6fe67385f0c94e018602e4028dc4cf52a28e9f7006121ad7d7"}, "tags": [], "refs": [["stg_tiktok_ads__ad_history"]], "sources": [], "description": "Each record in this table represents the most recent data for each ad.", "columns": {"ad_id": {"name": "ad_id", "description": "Ad ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "base_url": {"name": "base_url", "description": "The base URL of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_name": {"name": "ad_name", "description": "Ad Name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_text": {"name": "ad_text", "description": "The ad text.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "call_to_action": {"name": "call_to_action", "description": "Call to action values.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "click_tracking_url": {"name": "click_tracking_url", "description": "Click monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impression_tracking_url": {"name": "impression_tracking_url", "description": "Display monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_host": {"name": "url_host", "description": "The URL host of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_path": {"name": "url_path", "description": "The URL path of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_source": {"name": "utm_source", "description": "The utm_source parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_medium": {"name": "utm_medium", "description": "The utm_medium parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_campaign": {"name": "utm_campaign", "description": "The utm_campaign parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_content": {"name": "utm_content", "description": "The utm_content parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_term": {"name": "utm_term", "description": "The utm_term parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_id": {"name": "video_id", "description": "The video ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/intermediate/intermediate.yml", "compiled_path": "target/compiled/tiktok_ads/models/intermediate/int_tiktok_ads__most_recent_ad.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "ephemeral"}, "created_at": 1659025250.327927, "compiled_sql": "with base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null}, "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group": {"raw_sql": "with base as (\n\n select *\n from {{ var('ad_group_history') }}\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "ephemeral", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_tiktok_ads", "fqn": ["tiktok_ads", "intermediate", "int_tiktok_ads__most_recent_ad_group"], "unique_id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "intermediate/int_tiktok_ads__most_recent_ad_group.sql", "original_file_path": "models/intermediate/int_tiktok_ads__most_recent_ad_group.sql", "name": "int_tiktok_ads__most_recent_ad_group", "alias": "int_tiktok_ads__most_recent_ad_group", "checksum": {"name": "sha256", "checksum": "a1d9693e48ac9773013bd17c70506c937b917254481075d677d7e989e9665358"}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_history"]], "sources": [], "description": "Each record in this table represents the most recent data for each ad group.", "columns": {"ad_group_id": {"name": "ad_group_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The Ad group's campaign ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_days": {"name": "action_days", "description": "Action days", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "Ad group name. Character limit is 512 and cannot contain emoji.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "age": {"name": "age", "description": "Age groups you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience_type": {"name": "audience_type", "description": "Audience Type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "category": {"name": "category", "description": "Ad group category.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "display_name": {"name": "display_name", "description": "Display name of ad group.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency": {"name": "frequency", "description": "frequency, together with frequency_schedule, controls how often people see your ad (only available for REACH ads). For example, frequency = 2 frequency_schedule = 3 means \"show ads no more than twice every 3 day\".\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency_schedule": {"name": "frequency_schedule", "description": "frequency, together with frequency, controls how often people see your ad (only available for REACH ads).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_download": {"name": "video_download", "description": "Whether the video is allowed to be downloaded.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "languages": {"name": "languages", "description": "Codes of the languages that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/intermediate/intermediate.yml", "compiled_path": "target/compiled/tiktok_ads/models/intermediate/int_tiktok_ads__most_recent_ad_group.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "ephemeral"}, "created_at": 1659025250.3184938, "compiled_sql": "with base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__campaign_report_hourly_tmp') }}\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__campaign_report_hourly_tmp')),\n staging_columns=get_campaign_report_hourly_columns()\n )\n }}\n \n {% for metric in var('tiktok_ads__campaign_hourly_passthrough_metrics', []) %}\n , {{ metric }}\n {% endfor %}\n\n from base\n), \n\nfinal as (\n\n select \n campaign_id,\n cast(stat_time_hour as {{ dbt_utils.type_timestamp() }}) as stat_time_hour,\n cpc, \n cpm,\n ctr, \n impressions, \n clicks, \n spend, \n reach,\n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n \n {% for metric in var('tiktok_ads__campaign_hourly_passthrough_metrics', []) %}\n , {{ metric }}\n {% endfor %}\n from fields\n)\n\nselect *\nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_campaign_report_hourly_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__campaign_report_hourly"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__campaign_report_hourly.sql", "original_file_path": "models/stg_tiktok_ads__campaign_report_hourly.sql", "name": "stg_tiktok_ads__campaign_report_hourly", "alias": "stg_tiktok_ads__campaign_report_hourly", "checksum": {"name": "sha256", "checksum": "c3d7ffdd7ed412450d0cbc955713f686de19fcb3daea3d911adebfa999afa3d8"}, "tags": [], "refs": [["stg_tiktok_ads__campaign_report_hourly_tmp"], ["stg_tiktok_ads__campaign_report_hourly_tmp"]], "sources": [], "description": "Each record represent data for each campaign for each hour.", "columns": {"campaign_id": {"name": "campaign_id", "description": "Campaign id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time per user your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__campaign_report_hourly.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1659025250.605123, "compiled_sql": "with base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_report_hourly_tmp`\n), \n\nfields as (\n\n select\n \n \n \n campaign_id\n \n as \n \n campaign_id\n \n, \n cast(null as \n numeric\n) as \n \n ad_id\n \n , \n \n \n average_video_play\n \n as \n \n average_video_play\n \n, \n \n \n average_video_play_per_user\n \n as \n \n average_video_play_per_user\n \n, \n \n \n clicks\n \n as \n \n clicks\n \n, \n \n \n comments\n \n as \n \n comments\n \n, \n \n \n conversion\n \n as \n \n conversion\n \n, \n \n \n conversion_rate\n \n as \n \n conversion_rate\n \n, \n \n \n cost_per_conversion\n \n as \n \n cost_per_conversion\n \n, \n \n \n cpc\n \n as \n \n cpc\n \n, \n \n \n cpm\n \n as \n \n cpm\n \n, \n \n \n ctr\n \n as \n \n ctr\n \n, \n \n \n follows\n \n as \n \n follows\n \n, \n \n \n impressions\n \n as \n \n impressions\n \n, \n \n \n likes\n \n as \n \n likes\n \n, \n \n \n profile_visits\n \n as \n \n profile_visits\n \n, \n \n \n reach\n \n as \n \n reach\n \n, \n \n \n shares\n \n as \n \n shares\n \n, \n \n \n spend\n \n as \n \n spend\n \n, \n \n \n stat_time_hour\n \n as \n \n stat_time_hour\n \n, \n \n \n video_play_actions\n \n as \n \n video_play_actions\n \n, \n \n \n video_views_p_25\n \n as \n \n video_views_p_25\n \n, \n \n \n video_views_p_50\n \n as \n \n video_views_p_50\n \n, \n \n \n video_views_p_75\n \n as \n \n video_views_p_75\n \n, \n \n \n video_watched_2_s\n \n as \n \n video_watched_2_s\n \n, \n \n \n video_watched_6_s\n \n as \n \n video_watched_6_s\n \n\n\n\n \n \n , result\n \n\n from base\n), \n\nfinal as (\n\n select \n campaign_id,\n cast(stat_time_hour as \n timestamp\n) as stat_time_hour,\n cpc, \n cpm,\n ctr, \n impressions, \n clicks, \n spend, \n reach,\n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n \n \n , result\n \n from fields\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`schema`.`stg_tiktok_ads__campaign_report_hourly`"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__ad_group_report_hourly_tmp') }}\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__ad_group_report_hourly_tmp')),\n staging_columns=get_ad_group_report_hourly_columns()\n )\n }}\n \n {% for metric in var('tiktok_ads__ad_group_hourly_passthrough_metrics', []) %}\n , {{ metric }}\n {% endfor %}\n\n from base\n), \n\nfinal as (\n\n select \n adgroup_id as ad_group_id,\n cast(stat_time_hour as {{ dbt_utils.type_timestamp() }}) as stat_time_hour, \n cpc, \n cpm, \n ctr, \n impressions, \n clicks, \n spend, \n reach, \n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n \n {% for metric in var('tiktok_ads__ad_group_hourly_passthrough_metrics', []) %}\n , {{ metric }}\n {% endfor %}\n from fields\n) \n\nselect *\nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_ad_group_report_hourly_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__ad_group_report_hourly"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__ad_group_report_hourly.sql", "original_file_path": "models/stg_tiktok_ads__ad_group_report_hourly.sql", "name": "stg_tiktok_ads__ad_group_report_hourly", "alias": "stg_tiktok_ads__ad_group_report_hourly", "checksum": {"name": "sha256", "checksum": "764429f47a8429332b579f7283748ef905957598d215522ec8d85a2c666fed0f"}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_report_hourly_tmp"], ["stg_tiktok_ads__ad_group_report_hourly_tmp"]], "sources": [], "description": "Each record represents data for each ad group for each hour.", "columns": {"ad_group_id": {"name": "ad_group_id", "description": "Ad group id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time per user your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__ad_group_report_hourly.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1659025250.591536, "compiled_sql": "with base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_group_report_hourly_tmp`\n), \n\nfields as (\n\n select\n \n \n \n adgroup_id\n \n as \n \n adgroup_id\n \n, \n \n \n average_video_play\n \n as \n \n average_video_play\n \n, \n \n \n average_video_play_per_user\n \n as \n \n average_video_play_per_user\n \n, \n \n \n clicks\n \n as \n \n clicks\n \n, \n \n \n comments\n \n as \n \n comments\n \n, \n \n \n conversion\n \n as \n \n conversion\n \n, \n \n \n conversion_rate\n \n as \n \n conversion_rate\n \n, \n \n \n cost_per_conversion\n \n as \n \n cost_per_conversion\n \n, \n \n \n cpc\n \n as \n \n cpc\n \n, \n \n \n cpm\n \n as \n \n cpm\n \n, \n \n \n ctr\n \n as \n \n ctr\n \n, \n \n \n follows\n \n as \n \n follows\n \n, \n \n \n impressions\n \n as \n \n impressions\n \n, \n \n \n likes\n \n as \n \n likes\n \n, \n \n \n profile_visits\n \n as \n \n profile_visits\n \n, \n \n \n reach\n \n as \n \n reach\n \n, \n \n \n shares\n \n as \n \n shares\n \n, \n \n \n spend\n \n as \n \n spend\n \n, \n \n \n stat_time_hour\n \n as \n \n stat_time_hour\n \n, \n \n \n video_play_actions\n \n as \n \n video_play_actions\n \n, \n \n \n video_views_p_25\n \n as \n \n video_views_p_25\n \n, \n \n \n video_views_p_50\n \n as \n \n video_views_p_50\n \n, \n \n \n video_views_p_75\n \n as \n \n video_views_p_75\n \n, \n \n \n video_watched_2_s\n \n as \n \n video_watched_2_s\n \n, \n \n \n video_watched_6_s\n \n as \n \n video_watched_6_s\n \n\n\n\n \n \n , result\n \n\n from base\n), \n\nfinal as (\n\n select \n adgroup_id as ad_group_id,\n cast(stat_time_hour as \n timestamp\n) as stat_time_hour, \n cpc, \n cpm, \n ctr, \n impressions, \n clicks, \n spend, \n reach, \n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n \n \n , result\n \n from fields\n) \n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`schema`.`stg_tiktok_ads__ad_group_report_hourly`"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__ad_group_history_tmp') }}\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__ad_group_history_tmp')),\n staging_columns=get_ad_group_history_columns()\n )\n }}\n\n from base\n), \n\nfinal as (\n\n select\n adgroup_id as ad_group_id,\n cast(updated_at as {{ dbt_utils.type_timestamp() }}) as updated_at,\n advertiser_id,\n campaign_id,\n action_days,\n action_categories,\n adgroup_name as ad_group_name,\n age,\n audience_type,\n budget,\n category,\n display_name,\n interest_category_v_2 as interest_category,\n frequency,\n frequency_schedule,\n gender,\n languages, \n landing_page_url\n from fields\n), \n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by ad_group_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n)\n\nselect * from most_recent", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_ad_group_history_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__ad_group_history"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__ad_group_history.sql", "original_file_path": "models/stg_tiktok_ads__ad_group_history.sql", "name": "stg_tiktok_ads__ad_group_history", "alias": "stg_tiktok_ads__ad_group_history", "checksum": {"name": "sha256", "checksum": "9175d821a78b78d0aa0a1d79455563d95dd7ef8276aa6fb986257d4c4acd0a36"}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_history_tmp"], ["stg_tiktok_ads__ad_group_history_tmp"]], "sources": [], "description": "Each record represents data for each ad group.", "columns": {"ad_group_id": {"name": "ad_group_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_categories": {"name": "action_categories", "description": "IDs of the action categories (behaviors) that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The Ad group's campaign ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_days": {"name": "action_days", "description": "Action days", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "Ad group name. Character limit is 512 and cannot contain emoji.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "age": {"name": "age", "description": "Age groups you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience_type": {"name": "audience_type", "description": "Audience Type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget": {"name": "budget", "description": "Ad budget. Returns 0.0 when Campaign Budget Optimization (budget_optimize_switch) is on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "category": {"name": "category", "description": "Ad group category.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "display_name": {"name": "display_name", "description": "Display name of ad group.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "interest_category": {"name": "interest_category", "description": "Interest classification. If the interest is specified, users that do not meet interest target will be excluded during delivery.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency": {"name": "frequency", "description": "frequency, together with frequency_schedule, controls how often people see your ad (only available for REACH ads). For example, frequency = 2 frequency_schedule = 3 means \"show ads no more than twice every 3 day\".\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency_schedule": {"name": "frequency_schedule", "description": "frequency, together with frequency, controls how often people see your ad (only available for REACH ads).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "languages": {"name": "languages", "description": "Codes of the languages that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__ad_group_history.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1659025250.542208, "compiled_sql": "with base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_group_history_tmp`\n), \n\nfields as (\n\n select\n \n \n \n action_days\n \n as \n \n action_days\n \n, \n \n \n adgroup_id\n \n as \n \n adgroup_id\n \n, \n \n \n adgroup_name\n \n as \n \n adgroup_name\n \n, \n \n \n advertiser_id\n \n as \n \n advertiser_id\n \n, \n \n \n audience_type\n \n as \n \n audience_type\n \n, \n \n \n budget\n \n as \n \n budget\n \n, \n \n \n campaign_id\n \n as \n \n campaign_id\n \n, \n \n \n category\n \n as \n \n category\n \n, \n \n \n display_name\n \n as \n \n display_name\n \n, \n \n \n frequency\n \n as \n \n frequency\n \n, \n \n \n frequency_schedule\n \n as \n \n frequency_schedule\n \n, \n \n \n gender\n \n as \n \n gender\n \n, \n \n \n landing_page_url\n \n as \n \n landing_page_url\n \n, \n \n \n updated_at\n \n as \n \n updated_at\n \n, \n \n \n interest_category_v_2\n \n as \n \n interest_category_v_2\n \n, \n \n \n action_categories\n \n as \n \n action_categories\n \n, \n \n \n age\n \n as \n \n age\n \n, \n \n \n languages\n \n as \n \n languages\n \n\n\n\n\n from base\n), \n\nfinal as (\n\n select\n adgroup_id as ad_group_id,\n cast(updated_at as \n timestamp\n) as updated_at,\n advertiser_id,\n campaign_id,\n action_days,\n action_categories,\n adgroup_name as ad_group_name,\n age,\n audience_type,\n budget,\n category,\n display_name,\n interest_category_v_2 as interest_category,\n frequency,\n frequency_schedule,\n gender,\n languages, \n landing_page_url\n from fields\n), \n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by ad_group_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n)\n\nselect * from most_recent", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`schema`.`stg_tiktok_ads__ad_group_history`"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__ad_report_hourly_tmp') }}\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__ad_report_hourly_tmp')),\n staging_columns=get_ad_report_hourly_columns()\n )\n }}\n \n {% for metric in var('tiktok_ads__ad_hourly_passthrough_metrics', []) %}\n , {{ metric }}\n {% endfor %}\n\n from base\n), \n\nfinal as (\n\n select \n ad_id, \n cast(stat_time_hour as {{ dbt_utils.type_timestamp() }}) as stat_time_hour, \n cpc, \n cpm, \n ctr, \n impressions, \n clicks, \n spend, \n reach, \n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n \n {% for metric in var('tiktok_ads__ad_hourly_passthrough_metrics', []) %}\n , {{ metric }}\n {% endfor %}\n from fields\n)\n\nselect * \nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_ad_report_hourly_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__ad_report_hourly"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__ad_report_hourly.sql", "original_file_path": "models/stg_tiktok_ads__ad_report_hourly.sql", "name": "stg_tiktok_ads__ad_report_hourly", "alias": "stg_tiktok_ads__ad_report_hourly", "checksum": {"name": "sha256", "checksum": "c6433e7e84959d7da8a1262126ef554a23eee701cf551f21306f5ac08af7d1da"}, "tags": [], "refs": [["stg_tiktok_ads__ad_report_hourly_tmp"], ["stg_tiktok_ads__ad_report_hourly_tmp"]], "sources": [], "description": "Each record represents data for each ad for each hour.", "columns": {"ad_id": {"name": "ad_id", "description": "Ad id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time per user your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__ad_report_hourly.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1659025250.5772932, "compiled_sql": "with base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_report_hourly_tmp`\n), \n\nfields as (\n\n select\n \n \n \n ad_id\n \n as \n \n ad_id\n \n, \n \n \n average_video_play\n \n as \n \n average_video_play\n \n, \n \n \n average_video_play_per_user\n \n as \n \n average_video_play_per_user\n \n, \n \n \n clicks\n \n as \n \n clicks\n \n, \n \n \n comments\n \n as \n \n comments\n \n, \n \n \n conversion\n \n as \n \n conversion\n \n, \n \n \n conversion_rate\n \n as \n \n conversion_rate\n \n, \n \n \n cost_per_conversion\n \n as \n \n cost_per_conversion\n \n, \n \n \n cpc\n \n as \n \n cpc\n \n, \n \n \n cpm\n \n as \n \n cpm\n \n, \n \n \n ctr\n \n as \n \n ctr\n \n, \n \n \n follows\n \n as \n \n follows\n \n, \n \n \n impressions\n \n as \n \n impressions\n \n, \n \n \n likes\n \n as \n \n likes\n \n, \n \n \n profile_visits\n \n as \n \n profile_visits\n \n, \n \n \n reach\n \n as \n \n reach\n \n, \n \n \n shares\n \n as \n \n shares\n \n, \n \n \n spend\n \n as \n \n spend\n \n, \n \n \n stat_time_hour\n \n as \n \n stat_time_hour\n \n, \n \n \n video_play_actions\n \n as \n \n video_play_actions\n \n, \n \n \n video_views_p_25\n \n as \n \n video_views_p_25\n \n, \n \n \n video_views_p_50\n \n as \n \n video_views_p_50\n \n, \n \n \n video_views_p_75\n \n as \n \n video_views_p_75\n \n, \n \n \n video_watched_2_s\n \n as \n \n video_watched_2_s\n \n, \n \n \n video_watched_6_s\n \n as \n \n video_watched_6_s\n \n\n\n\n \n \n , REAL_TIME_COST_PER_RESULT\n \n\n from base\n), \n\nfinal as (\n\n select \n ad_id, \n cast(stat_time_hour as \n timestamp\n) as stat_time_hour, \n cpc, \n cpm, \n ctr, \n impressions, \n clicks, \n spend, \n reach, \n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n \n \n , REAL_TIME_COST_PER_RESULT\n \n from fields\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`schema`.`stg_tiktok_ads__ad_report_hourly`"}, "model.tiktok_ads_source.stg_tiktok_ads__advertiser": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__advertiser_tmp') }}\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__advertiser_tmp')),\n staging_columns=get_advertiser_columns()\n )\n }}\n\n from base\n),\n\nfinal as (\n\n select \n id as advertiser_id, \n address, \n balance, \n company, \n contacter, \n country, \n currency, \n description, \n email, \n industry, \n language,\n name as advertiser_name, \n phone_number, \n telephone, \n timezone\n from fields\n)\n\nselect *\nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_advertiser_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp", "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__advertiser"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__advertiser.sql", "original_file_path": "models/stg_tiktok_ads__advertiser.sql", "name": "stg_tiktok_ads__advertiser", "alias": "stg_tiktok_ads__advertiser", "checksum": {"name": "sha256", "checksum": "300666e61406b8816159808ea46adfc61484cf4f9e46a171255e6f7db94bd8f5"}, "tags": [], "refs": [["stg_tiktok_ads__advertiser_tmp"], ["stg_tiktok_ads__advertiser_tmp"]], "sources": [], "description": "Each record represents data for each advertiser.", "columns": {"advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "address": {"name": "address", "description": "Advertiser address information", "meta": {}, "data_type": null, "quote": null, "tags": []}, "balance": {"name": "balance", "description": "Account available balance", "meta": {}, "data_type": null, "quote": null, "tags": []}, "company": {"name": "company", "description": "Advertiser's company name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "contacter": {"name": "contacter", "description": "Contact Person", "meta": {}, "data_type": null, "quote": null, "tags": []}, "country": {"name": "country", "description": "The advertiser's country", "meta": {}, "data_type": null, "quote": null, "tags": []}, "create_time": {"name": "create_time", "description": "Advertiser's create time", "meta": {}, "data_type": null, "quote": null, "tags": []}, "currency": {"name": "currency", "description": "Type of currency used by advertisers", "meta": {}, "data_type": null, "quote": null, "tags": []}, "description": {"name": "description", "description": "Brand description, i.e. promotional content", "meta": {}, "data_type": null, "quote": null, "tags": []}, "email": {"name": "email", "description": "Advertiser contact email, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "industry": {"name": "industry", "description": "Advertiser industry category", "meta": {}, "data_type": null, "quote": null, "tags": []}, "language": {"name": "language", "description": "Language used by advertisers", "meta": {}, "data_type": null, "quote": null, "tags": []}, "license_no": {"name": "license_no", "description": "License number", "meta": {}, "data_type": null, "quote": null, "tags": []}, "license_url": {"name": "license_url", "description": "License preview address, the link is valid for an hour by default.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_name": {"name": "advertiser_name", "description": "Advertiser name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "phone_number": {"name": "phone_number", "description": "Contact mobile number, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "telephone": {"name": "telephone", "description": "Fixed phone number, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "timezone": {"name": "timezone", "description": "Ad account time zone including GMT offset", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__advertiser.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1659025250.53167, "compiled_sql": "with base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__advertiser_tmp`\n), \n\nfields as (\n\n select\n \n \n \n address\n \n as \n \n address\n \n, \n \n \n balance\n \n as \n \n balance\n \n, \n \n \n company\n \n as \n \n company\n \n, \n \n \n contacter\n \n as \n \n contacter\n \n, \n \n \n country\n \n as \n \n country\n \n, \n \n \n currency\n \n as \n \n currency\n \n, \n \n \n description\n \n as \n \n description\n \n, \n \n \n email\n \n as \n \n email\n \n, \n \n \n id\n \n as \n \n id\n \n, \n \n \n industry\n \n as \n \n industry\n \n, \n \n \n language\n \n as \n \n language\n \n, \n \n \n name\n \n as \n \n name\n \n, \n \n \n phone_number\n \n as \n \n phone_number\n \n, \n \n \n telephone\n \n as \n \n telephone\n \n, \n \n \n timezone\n \n as \n \n timezone\n \n\n\n\n\n from base\n),\n\nfinal as (\n\n select \n id as advertiser_id, \n address, \n balance, \n company, \n contacter, \n country, \n currency, \n description, \n email, \n industry, \n language,\n name as advertiser_name, \n phone_number, \n telephone, \n timezone\n from fields\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`schema`.`stg_tiktok_ads__advertiser`"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_history": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__ad_history_tmp') }}\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__ad_history_tmp')),\n staging_columns=get_ad_history_columns()\n )\n }}\n\n from base\n), \n\nfinal as (\n\n select \n ad_id,\n cast(updated_at as {{ dbt_utils.type_timestamp() }}) as updated_at,\n adgroup_id as ad_group_id,\n advertiser_id,\n campaign_id,\n ad_name,\n call_to_action,\n click_tracking_url,\n impression_tracking_url,\n {{ dbt_utils.split_part('landing_page_url', \"'?'\", 1) }} as base_url,\n {{ dbt_utils.get_url_host('landing_page_url') }} as url_host,\n '/' || {{ dbt_utils.get_url_path('landing_page_url') }} as url_path,\n {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_source') }} as utm_source,\n {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_medium') }} as utm_medium,\n {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_campaign') }} as utm_campaign,\n {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_content') }} as utm_content,\n {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_term') }} as utm_term,\n landing_page_url\n from fields\n), \n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by ad_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n)\n\nselect * \nfrom most_recent", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_ad_history_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp", "macro.dbt_utils.split_part", "macro.dbt_utils.get_url_host", "macro.dbt_utils.get_url_path", "macro.dbt_utils.get_url_parameter"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__ad_history"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__ad_history.sql", "original_file_path": "models/stg_tiktok_ads__ad_history.sql", "name": "stg_tiktok_ads__ad_history", "alias": "stg_tiktok_ads__ad_history", "checksum": {"name": "sha256", "checksum": "8d980a128704aea99662ccd2b8face0d3290e428948cee76a082aaea2d43cc64"}, "tags": [], "refs": [["stg_tiktok_ads__ad_history_tmp"], ["stg_tiktok_ads__ad_history_tmp"]], "sources": [], "description": "Each record represents data for each ad.", "columns": {"ad_id": {"name": "ad_id", "description": "Ad ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "base_url": {"name": "base_url", "description": "The base URL of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_name": {"name": "ad_name", "description": "Ad Name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "call_to_action": {"name": "call_to_action", "description": "Call to action values.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "click_tracking_url": {"name": "click_tracking_url", "description": "Click monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impression_tracking_url": {"name": "impression_tracking_url", "description": "Display monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_host": {"name": "url_host", "description": "The URL host of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_path": {"name": "url_path", "description": "The URL path of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_source": {"name": "utm_source", "description": "The utm_source parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_medium": {"name": "utm_medium", "description": "The utm_medium parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_campaign": {"name": "utm_campaign", "description": "The utm_campaign parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_content": {"name": "utm_content", "description": "The utm_content parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_term": {"name": "utm_term", "description": "The utm_term parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__ad_history.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1659025250.558231, "compiled_sql": "with base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_history_tmp`\n), \n\nfields as (\n\n select\n \n \n \n ad_id\n \n as \n \n ad_id\n \n, \n \n \n ad_name\n \n as \n \n ad_name\n \n, \n \n \n adgroup_id\n \n as \n \n adgroup_id\n \n, \n \n \n advertiser_id\n \n as \n \n advertiser_id\n \n, \n \n \n call_to_action\n \n as \n \n call_to_action\n \n, \n \n \n campaign_id\n \n as \n \n campaign_id\n \n, \n \n \n click_tracking_url\n \n as \n \n click_tracking_url\n \n, \n \n \n impression_tracking_url\n \n as \n \n impression_tracking_url\n \n, \n \n \n landing_page_url\n \n as \n \n landing_page_url\n \n, \n \n \n updated_at\n \n as \n \n updated_at\n \n\n\n\n\n from base\n), \n\nfinal as (\n\n select \n ad_id,\n cast(updated_at as \n timestamp\n) as updated_at,\n adgroup_id as ad_group_id,\n advertiser_id,\n campaign_id,\n ad_name,\n call_to_action,\n click_tracking_url,\n impression_tracking_url,\n \n\n \n split(\n landing_page_url,\n '?'\n )[safe_offset(0)]\n \n\n as base_url,\n \n safe_cast(\n\n \n split(\n \n\n \n split(\n \n\n replace(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'android-app://',\n ''\n )\n \n\n,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n '/'\n )[safe_offset(0)]\n \n\n,\n '?'\n )[safe_offset(0)]\n \n\n as \n string\n)\n as url_host,\n '/' || \n safe_cast(\n\n \n split(\n \n\n case when \n \n length(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n\n )-coalesce(\n nullif(\n\n strpos(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n '/'\n \n ), 0),\n \n\n strpos(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n '?'\n \n ) - 1\n ) = 0 \n then ''\n else \n substr(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n -1 * (\n \n length(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n\n )-coalesce(\n nullif(\n\n strpos(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n '/'\n \n ), 0),\n \n\n strpos(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n '?'\n \n ) - 1\n ))\n )\n end,\n '?'\n )[safe_offset(0)]\n \n\n as \n string\n)\n as url_path,\n nullif(\n\n \n split(\n \n\n \n split(\n landing_page_url,\n 'utm_source='\n )[safe_offset(1)]\n \n\n,\n '&'\n )[safe_offset(0)]\n \n\n,'') as utm_source,\n nullif(\n\n \n split(\n \n\n \n split(\n landing_page_url,\n 'utm_medium='\n )[safe_offset(1)]\n \n\n,\n '&'\n )[safe_offset(0)]\n \n\n,'') as utm_medium,\n nullif(\n\n \n split(\n \n\n \n split(\n landing_page_url,\n 'utm_campaign='\n )[safe_offset(1)]\n \n\n,\n '&'\n )[safe_offset(0)]\n \n\n,'') as utm_campaign,\n nullif(\n\n \n split(\n \n\n \n split(\n landing_page_url,\n 'utm_content='\n )[safe_offset(1)]\n \n\n,\n '&'\n )[safe_offset(0)]\n \n\n,'') as utm_content,\n nullif(\n\n \n split(\n \n\n \n split(\n landing_page_url,\n 'utm_term='\n )[safe_offset(1)]\n \n\n,\n '&'\n )[safe_offset(0)]\n \n\n,'') as utm_term,\n landing_page_url\n from fields\n), \n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by ad_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n)\n\nselect * \nfrom most_recent", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`schema`.`stg_tiktok_ads__ad_history`"}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_history": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__campaign_history_tmp') }}\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__campaign_history_tmp')),\n staging_columns=get_campaign_history_columns()\n )\n }}\n \n from base\n), \n\nfinal as (\n\n select \n campaign_id, \n cast(updated_at as {{ dbt_utils.type_timestamp() }}) as updated_at,\n advertiser_id, \n campaign_name, \n campaign_type, \n split_test_variable\n from fields\n), \n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by campaign_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n)\n\nselect *\nfrom most_recent", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_campaign_history_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__campaign_history"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__campaign_history.sql", "original_file_path": "models/stg_tiktok_ads__campaign_history.sql", "name": "stg_tiktok_ads__campaign_history", "alias": "stg_tiktok_ads__campaign_history", "checksum": {"name": "sha256", "checksum": "ba45d9210281370b9d7245597425dbaa1b356f95baa788c44579abbb0fc835ad"}, "tags": [], "refs": [["stg_tiktok_ads__campaign_history_tmp"], ["stg_tiktok_ads__campaign_history_tmp"]], "sources": [], "description": "Each record represents data for each campaign.", "columns": {"campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_type": {"name": "campaign_type", "description": "Campaign Type, indicates the campaign is a regular campaign or iOS 14 campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "split_test_variable": {"name": "split_test_variable", "description": "Split Test variables. Optional values; TARGETING, BIDDING_OPTIMIZATION , CREATIVE.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__campaign_history.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1659025250.562881, "compiled_sql": "with base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_history_tmp`\n), \n\nfields as (\n\n select\n \n \n \n advertiser_id\n \n as \n \n advertiser_id\n \n, \n \n \n campaign_id\n \n as \n \n campaign_id\n \n, \n \n \n campaign_name\n \n as \n \n campaign_name\n \n, \n \n \n campaign_type\n \n as \n \n campaign_type\n \n, \n \n \n split_test_variable\n \n as \n \n split_test_variable\n \n, \n \n \n updated_at\n \n as \n \n updated_at\n \n\n\n\n \n from base\n), \n\nfinal as (\n\n select \n campaign_id, \n cast(updated_at as \n timestamp\n) as updated_at,\n advertiser_id, \n campaign_name, \n campaign_type, \n split_test_variable\n from fields\n), \n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by campaign_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n)\n\nselect *\nfrom most_recent", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`schema`.`stg_tiktok_ads__campaign_history`"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp": {"raw_sql": "select *\nfrom {{ var('ad_report_hourly') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.tiktok_ads_source.tiktok_ads.ad_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__ad_report_hourly_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__ad_report_hourly_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__ad_report_hourly_tmp.sql", "name": "stg_tiktok_ads__ad_report_hourly_tmp", "alias": "stg_tiktok_ads__ad_report_hourly_tmp", "checksum": {"name": "sha256", "checksum": "a487182a6ea56715aff4fb53a16e8e185223097096f8b06c53beeaf354bffb3f"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "ad_report_hourly"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_report_hourly_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1659025250.136051, "compiled_sql": "select *\nfrom `database`.`tiktok_ads_joe`.`ad_report_hourly`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`schema`.`stg_tiktok_ads__ad_report_hourly_tmp`"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp": {"raw_sql": "select *\nfrom {{ var('ad_history') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.tiktok_ads_source.tiktok_ads.ad_history"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__ad_history_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__ad_history_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__ad_history_tmp.sql", "name": "stg_tiktok_ads__ad_history_tmp", "alias": "stg_tiktok_ads__ad_history_tmp", "checksum": {"name": "sha256", "checksum": "a57ca2d986b3dbad7d2bbd8b0a0dd7c992c25bc5cda65daee19e3541f40b6890"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "ad_history"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_history_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1659025250.141647, "compiled_sql": "select *\nfrom `database`.`tiktok_ads_joe`.`ad_history`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`schema`.`stg_tiktok_ads__ad_history_tmp`"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp": {"raw_sql": "select *\nfrom {{ var('ad_group_history') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.tiktok_ads_source.tiktok_ads.adgroup_history"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__ad_group_history_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__ad_group_history_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__ad_group_history_tmp.sql", "name": "stg_tiktok_ads__ad_group_history_tmp", "alias": "stg_tiktok_ads__ad_group_history_tmp", "checksum": {"name": "sha256", "checksum": "b3d1b8772b0465ed063cfa1f77cb9384475c21fa4ac9f970065e3da5c327ad1a"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "adgroup_history"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_group_history_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1659025250.146827, "compiled_sql": "select *\nfrom `database`.`tiktok_ads_joe`.`adgroup_history`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`schema`.`stg_tiktok_ads__ad_group_history_tmp`"}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp": {"raw_sql": "select *\nfrom {{ var('campaign_report_hourly') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.tiktok_ads_source.tiktok_ads.campaign_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__campaign_report_hourly_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__campaign_report_hourly_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__campaign_report_hourly_tmp.sql", "name": "stg_tiktok_ads__campaign_report_hourly_tmp", "alias": "stg_tiktok_ads__campaign_report_hourly_tmp", "checksum": {"name": "sha256", "checksum": "198e8d143514167295dfe352776c5050850cb7bc60e46b122a6a0a0da08a14ce"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "campaign_report_hourly"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__campaign_report_hourly_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1659025250.1522691, "compiled_sql": "select *\nfrom `database`.`tiktok_ads_joe`.`campaign_report_hourly`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`schema`.`stg_tiktok_ads__campaign_report_hourly_tmp`"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp": {"raw_sql": "select *\nfrom {{ var('ad_group_hourly') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__ad_group_report_hourly_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__ad_group_report_hourly_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__ad_group_report_hourly_tmp.sql", "name": "stg_tiktok_ads__ad_group_report_hourly_tmp", "alias": "stg_tiktok_ads__ad_group_report_hourly_tmp", "checksum": {"name": "sha256", "checksum": "187c3f6f290dd9846646843a108714a51fff1700c838c4c7e58852db64a1edfd"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "adgroup_report_hourly"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_group_report_hourly_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1659025250.157234, "compiled_sql": "select *\nfrom `database`.`tiktok_ads_joe`.`adgroup_report_hourly`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`schema`.`stg_tiktok_ads__ad_group_report_hourly_tmp`"}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp": {"raw_sql": "select *\nfrom {{ var('campaign_history') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.tiktok_ads_source.tiktok_ads.campaign_history"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__campaign_history_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__campaign_history_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__campaign_history_tmp.sql", "name": "stg_tiktok_ads__campaign_history_tmp", "alias": "stg_tiktok_ads__campaign_history_tmp", "checksum": {"name": "sha256", "checksum": "d695c134485444137d663f41732085a5cfa81de49f3ec2676e9f8e58f1c62c02"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "campaign_history"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__campaign_history_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1659025250.162176, "compiled_sql": "select *\nfrom `database`.`tiktok_ads_joe`.`campaign_history`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`schema`.`stg_tiktok_ads__campaign_history_tmp`"}, "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp": {"raw_sql": "select *\nfrom {{ var('advertiser') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.tiktok_ads_source.tiktok_ads.advertiser"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__advertiser_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__advertiser_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__advertiser_tmp.sql", "name": "stg_tiktok_ads__advertiser_tmp", "alias": "stg_tiktok_ads__advertiser_tmp", "checksum": {"name": "sha256", "checksum": "2806a63477df7962ac6a4476e3e514a47ae56470e95f490e88b58696a99c2fcf"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "advertiser"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__advertiser_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1659025250.166961, "compiled_sql": "select *\nfrom `database`.`tiktok_ads_joe`.`advertiser`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`schema`.`stg_tiktok_ads__advertiser_tmp`"}, "test.tiktok_ads.not_null_tiktok_ads__account_report_date_day.5a77812746": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "date_day", "model": "{{ get_where_subquery(ref('tiktok_ads__account_report')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__account_report"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "not_null_tiktok_ads__account_report_date_day"], "unique_id": "test.tiktok_ads.not_null_tiktok_ads__account_report_date_day.5a77812746", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_tiktok_ads__account_report_date_day.sql", "original_file_path": "models/tiktok_ads.yml", "name": "not_null_tiktok_ads__account_report_date_day", "alias": "not_null_tiktok_ads__account_report_date_day", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__account_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/not_null_tiktok_ads__account_report_date_day.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.257969, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`dbt_renee_tiktok_ads`.`tiktok_ads__account_report`\nwhere date_day is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "date_day", "file_key_name": "models.tiktok_ads__account_report"}, "test.tiktok_ads.not_null_tiktok_ads__account_report_advertiser_id.bbeabada6f": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "advertiser_id", "model": "{{ get_where_subquery(ref('tiktok_ads__account_report')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__account_report"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "not_null_tiktok_ads__account_report_advertiser_id"], "unique_id": "test.tiktok_ads.not_null_tiktok_ads__account_report_advertiser_id.bbeabada6f", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_tiktok_ads__account_report_advertiser_id.sql", "original_file_path": "models/tiktok_ads.yml", "name": "not_null_tiktok_ads__account_report_advertiser_id", "alias": "not_null_tiktok_ads__account_report_advertiser_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__account_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/not_null_tiktok_ads__account_report_advertiser_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.260212, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`dbt_renee_tiktok_ads`.`tiktok_ads__account_report`\nwhere advertiser_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "advertiser_id", "file_key_name": "models.tiktok_ads__account_report"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__account_report_advertiser_id__date_day.7b27a2f43b": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_e775e605c8835d2fdc47cf9d0cf5ee54\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["advertiser_id", "date_day"], "model": "{{ get_where_subquery(ref('tiktok_ads__account_report')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__account_report"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_e775e605c8835d2fdc47cf9d0cf5ee54", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "dbt_utils_unique_combination_of_columns_tiktok_ads__account_report_advertiser_id__date_day"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__account_report_advertiser_id__date_day.7b27a2f43b", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_e775e605c8835d2fdc47cf9d0cf5ee54.sql", "original_file_path": "models/tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_tiktok_ads__account_report_advertiser_id__date_day", "alias": "dbt_utils_unique_combination_o_e775e605c8835d2fdc47cf9d0cf5ee54", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__account_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/dbt_utils_unique_combination_o_e775e605c8835d2fdc47cf9d0cf5ee54.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_e775e605c8835d2fdc47cf9d0cf5ee54"}, "created_at": 1659025250.26227, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n advertiser_id, date_day\n from `database`.`dbt_renee_tiktok_ads`.`tiktok_ads__account_report`\n group by advertiser_id, date_day\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.tiktok_ads__account_report"}, "test.tiktok_ads.not_null_tiktok_ads__ad_report_date_day.d61ee4a5ed": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "date_day", "model": "{{ get_where_subquery(ref('tiktok_ads__ad_report')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__ad_report"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "not_null_tiktok_ads__ad_report_date_day"], "unique_id": "test.tiktok_ads.not_null_tiktok_ads__ad_report_date_day.d61ee4a5ed", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_tiktok_ads__ad_report_date_day.sql", "original_file_path": "models/tiktok_ads.yml", "name": "not_null_tiktok_ads__ad_report_date_day", "alias": "not_null_tiktok_ads__ad_report_date_day", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__ad_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/not_null_tiktok_ads__ad_report_date_day.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.275629, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`dbt_renee_tiktok_ads`.`tiktok_ads__ad_report`\nwhere date_day is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "date_day", "file_key_name": "models.tiktok_ads__ad_report"}, "test.tiktok_ads.not_null_tiktok_ads__ad_report_ad_id.2d8166e707": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_id", "model": "{{ get_where_subquery(ref('tiktok_ads__ad_report')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__ad_report"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "not_null_tiktok_ads__ad_report_ad_id"], "unique_id": "test.tiktok_ads.not_null_tiktok_ads__ad_report_ad_id.2d8166e707", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_tiktok_ads__ad_report_ad_id.sql", "original_file_path": "models/tiktok_ads.yml", "name": "not_null_tiktok_ads__ad_report_ad_id", "alias": "not_null_tiktok_ads__ad_report_ad_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__ad_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/not_null_tiktok_ads__ad_report_ad_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.27732, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`dbt_renee_tiktok_ads`.`tiktok_ads__ad_report`\nwhere ad_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ad_id", "file_key_name": "models.tiktok_ads__ad_report"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_report_ad_id__date_day.15357fac89": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_056f22d77c1daa2b10c2ecadca5404c3\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_id", "date_day"], "model": "{{ get_where_subquery(ref('tiktok_ads__ad_report')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__ad_report"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_056f22d77c1daa2b10c2ecadca5404c3", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "dbt_utils_unique_combination_of_columns_tiktok_ads__ad_report_ad_id__date_day"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_report_ad_id__date_day.15357fac89", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_056f22d77c1daa2b10c2ecadca5404c3.sql", "original_file_path": "models/tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_tiktok_ads__ad_report_ad_id__date_day", "alias": "dbt_utils_unique_combination_o_056f22d77c1daa2b10c2ecadca5404c3", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__ad_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/dbt_utils_unique_combination_o_056f22d77c1daa2b10c2ecadca5404c3.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_056f22d77c1daa2b10c2ecadca5404c3"}, "created_at": 1659025250.2791302, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n ad_id, date_day\n from `database`.`dbt_renee_tiktok_ads`.`tiktok_ads__ad_report`\n group by ad_id, date_day\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.tiktok_ads__ad_report"}, "test.tiktok_ads.not_null_tiktok_ads__ad_group_report_date_day.e39164964e": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "date_day", "model": "{{ get_where_subquery(ref('tiktok_ads__ad_group_report')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__ad_group_report"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "not_null_tiktok_ads__ad_group_report_date_day"], "unique_id": "test.tiktok_ads.not_null_tiktok_ads__ad_group_report_date_day.e39164964e", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_tiktok_ads__ad_group_report_date_day.sql", "original_file_path": "models/tiktok_ads.yml", "name": "not_null_tiktok_ads__ad_group_report_date_day", "alias": "not_null_tiktok_ads__ad_group_report_date_day", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__ad_group_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/not_null_tiktok_ads__ad_group_report_date_day.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.283883, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`dbt_renee_tiktok_ads`.`tiktok_ads__ad_group_report`\nwhere date_day is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "date_day", "file_key_name": "models.tiktok_ads__ad_group_report"}, "test.tiktok_ads.not_null_tiktok_ads__ad_group_report_ad_group_id.17fb8710f4": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_group_id", "model": "{{ get_where_subquery(ref('tiktok_ads__ad_group_report')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__ad_group_report"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "not_null_tiktok_ads__ad_group_report_ad_group_id"], "unique_id": "test.tiktok_ads.not_null_tiktok_ads__ad_group_report_ad_group_id.17fb8710f4", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_tiktok_ads__ad_group_report_ad_group_id.sql", "original_file_path": "models/tiktok_ads.yml", "name": "not_null_tiktok_ads__ad_group_report_ad_group_id", "alias": "not_null_tiktok_ads__ad_group_report_ad_group_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__ad_group_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/not_null_tiktok_ads__ad_group_report_ad_group_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.285575, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`dbt_renee_tiktok_ads`.`tiktok_ads__ad_group_report`\nwhere ad_group_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ad_group_id", "file_key_name": "models.tiktok_ads__ad_group_report"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day.2eb4c2ff6d": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_72fdc194de3164f205583879773e492a\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_group_id", "date_day"], "model": "{{ get_where_subquery(ref('tiktok_ads__ad_group_report')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__ad_group_report"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_72fdc194de3164f205583879773e492a", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day.2eb4c2ff6d", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_72fdc194de3164f205583879773e492a.sql", "original_file_path": "models/tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day", "alias": "dbt_utils_unique_combination_o_72fdc194de3164f205583879773e492a", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__ad_group_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/dbt_utils_unique_combination_o_72fdc194de3164f205583879773e492a.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_72fdc194de3164f205583879773e492a"}, "created_at": 1659025250.287495, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n ad_group_id, date_day\n from `database`.`dbt_renee_tiktok_ads`.`tiktok_ads__ad_group_report`\n group by ad_group_id, date_day\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.tiktok_ads__ad_group_report"}, "test.tiktok_ads.not_null_tiktok_ads__campaign_report_date_day.3807b0e836": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "date_day", "model": "{{ get_where_subquery(ref('tiktok_ads__campaign_report')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__campaign_report"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "not_null_tiktok_ads__campaign_report_date_day"], "unique_id": "test.tiktok_ads.not_null_tiktok_ads__campaign_report_date_day.3807b0e836", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_tiktok_ads__campaign_report_date_day.sql", "original_file_path": "models/tiktok_ads.yml", "name": "not_null_tiktok_ads__campaign_report_date_day", "alias": "not_null_tiktok_ads__campaign_report_date_day", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__campaign_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/not_null_tiktok_ads__campaign_report_date_day.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.292518, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`dbt_renee_tiktok_ads`.`tiktok_ads__campaign_report`\nwhere date_day is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "date_day", "file_key_name": "models.tiktok_ads__campaign_report"}, "test.tiktok_ads.not_null_tiktok_ads__campaign_report_campaign_id.8a2b0c8ef8": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "campaign_id", "model": "{{ get_where_subquery(ref('tiktok_ads__campaign_report')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__campaign_report"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "not_null_tiktok_ads__campaign_report_campaign_id"], "unique_id": "test.tiktok_ads.not_null_tiktok_ads__campaign_report_campaign_id.8a2b0c8ef8", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_tiktok_ads__campaign_report_campaign_id.sql", "original_file_path": "models/tiktok_ads.yml", "name": "not_null_tiktok_ads__campaign_report_campaign_id", "alias": "not_null_tiktok_ads__campaign_report_campaign_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__campaign_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/not_null_tiktok_ads__campaign_report_campaign_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.2955399, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`dbt_renee_tiktok_ads`.`tiktok_ads__campaign_report`\nwhere campaign_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "campaign_id", "file_key_name": "models.tiktok_ads__campaign_report"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day.cc5f756c69": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_48804305b042fff8fc9179671c157c13\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["campaign_id", "date_day"], "model": "{{ get_where_subquery(ref('tiktok_ads__campaign_report')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__campaign_report"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_48804305b042fff8fc9179671c157c13", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day.cc5f756c69", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_48804305b042fff8fc9179671c157c13.sql", "original_file_path": "models/tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day", "alias": "dbt_utils_unique_combination_o_48804305b042fff8fc9179671c157c13", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__campaign_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/dbt_utils_unique_combination_o_48804305b042fff8fc9179671c157c13.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_48804305b042fff8fc9179671c157c13"}, "created_at": 1659025250.297539, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n campaign_id, date_day\n from `database`.`dbt_renee_tiktok_ads`.`tiktok_ads__campaign_report`\n group by campaign_id, date_day\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.tiktok_ads__campaign_report"}, "test.tiktok_ads.not_null_tiktok_ads__url_report_date_day.d593573eff": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "date_day", "model": "{{ get_where_subquery(ref('tiktok_ads__url_report')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__url_report"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "not_null_tiktok_ads__url_report_date_day"], "unique_id": "test.tiktok_ads.not_null_tiktok_ads__url_report_date_day.d593573eff", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_tiktok_ads__url_report_date_day.sql", "original_file_path": "models/tiktok_ads.yml", "name": "not_null_tiktok_ads__url_report_date_day", "alias": "not_null_tiktok_ads__url_report_date_day", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__url_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/not_null_tiktok_ads__url_report_date_day.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.302998, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`dbt_renee_tiktok_ads`.`tiktok_ads__url_report`\nwhere date_day is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "date_day", "file_key_name": "models.tiktok_ads__url_report"}, "test.tiktok_ads.not_null_tiktok_ads__url_report_ad_id.6c41067bd0": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_id", "model": "{{ get_where_subquery(ref('tiktok_ads__url_report')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__url_report"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "not_null_tiktok_ads__url_report_ad_id"], "unique_id": "test.tiktok_ads.not_null_tiktok_ads__url_report_ad_id.6c41067bd0", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_tiktok_ads__url_report_ad_id.sql", "original_file_path": "models/tiktok_ads.yml", "name": "not_null_tiktok_ads__url_report_ad_id", "alias": "not_null_tiktok_ads__url_report_ad_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__url_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/not_null_tiktok_ads__url_report_ad_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.3052008, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`dbt_renee_tiktok_ads`.`tiktok_ads__url_report`\nwhere ad_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ad_id", "file_key_name": "models.tiktok_ads__url_report"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__url_report_ad_id__date_day.8b73e512af": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_30d691e3772c912d1a7e5874b0b91854\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_id", "date_day"], "model": "{{ get_where_subquery(ref('tiktok_ads__url_report')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__url_report"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_30d691e3772c912d1a7e5874b0b91854", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "dbt_utils_unique_combination_of_columns_tiktok_ads__url_report_ad_id__date_day"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__url_report_ad_id__date_day.8b73e512af", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_30d691e3772c912d1a7e5874b0b91854.sql", "original_file_path": "models/tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_tiktok_ads__url_report_ad_id__date_day", "alias": "dbt_utils_unique_combination_o_30d691e3772c912d1a7e5874b0b91854", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__url_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/dbt_utils_unique_combination_o_30d691e3772c912d1a7e5874b0b91854.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_30d691e3772c912d1a7e5874b0b91854"}, "created_at": 1659025250.3070238, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n ad_id, date_day\n from `database`.`dbt_renee_tiktok_ads`.`tiktok_ads__url_report`\n group by ad_id, date_day\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.tiktok_ads__url_report"}, "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.fcb8c561bc": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_group_id", "model": "{{ get_where_subquery(ref('int_tiktok_ads__most_recent_ad_group')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad_group"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "intermediate", "not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id"], "unique_id": "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.fcb8c561bc", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.sql", "original_file_path": "models/intermediate/intermediate.yml", "name": "not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id", "alias": "not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["int_tiktok_ads__most_recent_ad_group"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/intermediate/intermediate.yml/not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.3331132, "compiled_sql": "\n \n \n\nwith __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)select *\nfrom __dbt__cte__int_tiktok_ads__most_recent_ad_group\nwhere ad_group_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": null, "column_name": "ad_group_id", "file_key_name": "models.int_tiktok_ads__most_recent_ad_group"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at.e2e9914076": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_7aae7967f01788b5ccce56d37f64c75b\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_group_id", "updated_at"], "model": "{{ get_where_subquery(ref('int_tiktok_ads__most_recent_ad_group')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad_group"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_7aae7967f01788b5ccce56d37f64c75b", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "intermediate", "dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at.e2e9914076", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_7aae7967f01788b5ccce56d37f64c75b.sql", "original_file_path": "models/intermediate/intermediate.yml", "name": "dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at", "alias": "dbt_utils_unique_combination_o_7aae7967f01788b5ccce56d37f64c75b", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["int_tiktok_ads__most_recent_ad_group"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/intermediate/intermediate.yml/dbt_utils_unique_combination_o_7aae7967f01788b5ccce56d37f64c75b.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_7aae7967f01788b5ccce56d37f64c75b"}, "created_at": 1659025250.3351848, "compiled_sql": "\n\n\n\n\n\nwith __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n),validation_errors as (\n\n select\n ad_group_id, updated_at\n from __dbt__cte__int_tiktok_ads__most_recent_ad_group\n group by ad_group_id, updated_at\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": null, "column_name": null, "file_key_name": "models.int_tiktok_ads__most_recent_ad_group"}, "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_ad_id.14e9c145ca": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_id", "model": "{{ get_where_subquery(ref('int_tiktok_ads__most_recent_ad')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "intermediate", "not_null_int_tiktok_ads__most_recent_ad_ad_id"], "unique_id": "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_ad_id.14e9c145ca", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_int_tiktok_ads__most_recent_ad_ad_id.sql", "original_file_path": "models/intermediate/intermediate.yml", "name": "not_null_int_tiktok_ads__most_recent_ad_ad_id", "alias": "not_null_int_tiktok_ads__most_recent_ad_ad_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["int_tiktok_ads__most_recent_ad"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/intermediate/intermediate.yml/not_null_int_tiktok_ads__most_recent_ad_ad_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.340708, "compiled_sql": "\n \n \n\nwith __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)select *\nfrom __dbt__cte__int_tiktok_ads__most_recent_ad\nwhere ad_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": null, "column_name": "ad_id", "file_key_name": "models.int_tiktok_ads__most_recent_ad"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at.f58d824f65": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_82db7b1c335645aabf3916a22992c42a\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_id", "updated_at"], "model": "{{ get_where_subquery(ref('int_tiktok_ads__most_recent_ad')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_82db7b1c335645aabf3916a22992c42a", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "intermediate", "dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at.f58d824f65", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_82db7b1c335645aabf3916a22992c42a.sql", "original_file_path": "models/intermediate/intermediate.yml", "name": "dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at", "alias": "dbt_utils_unique_combination_o_82db7b1c335645aabf3916a22992c42a", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["int_tiktok_ads__most_recent_ad"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/intermediate/intermediate.yml/dbt_utils_unique_combination_o_82db7b1c335645aabf3916a22992c42a.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_82db7b1c335645aabf3916a22992c42a"}, "created_at": 1659025250.342508, "compiled_sql": "\n\n\n\n\n\nwith __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n),validation_errors as (\n\n select\n ad_id, updated_at\n from __dbt__cte__int_tiktok_ads__most_recent_ad\n group by ad_id, updated_at\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": null, "column_name": null, "file_key_name": "models.int_tiktok_ads__most_recent_ad"}, "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_campaign_campaign_id.8cefa8981c": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "campaign_id", "model": "{{ get_where_subquery(ref('int_tiktok_ads__most_recent_campaign')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.int_tiktok_ads__most_recent_campaign"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "intermediate", "not_null_int_tiktok_ads__most_recent_campaign_campaign_id"], "unique_id": "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_campaign_campaign_id.8cefa8981c", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_int_tiktok_ads__most_recent_campaign_campaign_id.sql", "original_file_path": "models/intermediate/intermediate.yml", "name": "not_null_int_tiktok_ads__most_recent_campaign_campaign_id", "alias": "not_null_int_tiktok_ads__most_recent_campaign_campaign_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["int_tiktok_ads__most_recent_campaign"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/intermediate/intermediate.yml/not_null_int_tiktok_ads__most_recent_campaign_campaign_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.3478642, "compiled_sql": "\n \n \n\nwith __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)select *\nfrom __dbt__cte__int_tiktok_ads__most_recent_campaign\nwhere campaign_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "sql": " __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": null, "column_name": "campaign_id", "file_key_name": "models.int_tiktok_ads__most_recent_campaign"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at.39077adf71": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_8456719f1ebbe11b109db2e39e0239ce\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["campaign_id", "updated_at"], "model": "{{ get_where_subquery(ref('int_tiktok_ads__most_recent_campaign')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.int_tiktok_ads__most_recent_campaign"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_8456719f1ebbe11b109db2e39e0239ce", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "intermediate", "dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at.39077adf71", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_8456719f1ebbe11b109db2e39e0239ce.sql", "original_file_path": "models/intermediate/intermediate.yml", "name": "dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at", "alias": "dbt_utils_unique_combination_o_8456719f1ebbe11b109db2e39e0239ce", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["int_tiktok_ads__most_recent_campaign"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/intermediate/intermediate.yml/dbt_utils_unique_combination_o_8456719f1ebbe11b109db2e39e0239ce.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_8456719f1ebbe11b109db2e39e0239ce"}, "created_at": 1659025250.349807, "compiled_sql": "\n\n\n\n\n\nwith __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n),validation_errors as (\n\n select\n campaign_id, updated_at\n from __dbt__cte__int_tiktok_ads__most_recent_campaign\n group by campaign_id, updated_at\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "sql": " __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": null, "column_name": null, "file_key_name": "models.int_tiktok_ads__most_recent_campaign"}, "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66": {"raw_sql": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "unique", "kwargs": {"column_name": "advertiser_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__advertiser')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "unique_stg_tiktok_ads__advertiser_advertiser_id"], "unique_id": "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "unique_stg_tiktok_ads__advertiser_advertiser_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "unique_stg_tiktok_ads__advertiser_advertiser_id", "alias": "unique_stg_tiktok_ads__advertiser_advertiser_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__advertiser"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/unique_stg_tiktok_ads__advertiser_advertiser_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.606677, "compiled_sql": "\n \n \n\nwith dbt_test__target as (\n \n select advertiser_id as unique_field\n from `database`.`schema`.`stg_tiktok_ads__advertiser`\n where advertiser_id is not null\n \n)\n\nselect\n unique_field,\n count(*) as n_records\n\nfrom dbt_test__target\ngroup by unique_field\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "advertiser_id", "file_key_name": "models.stg_tiktok_ads__advertiser"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "advertiser_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__advertiser')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__advertiser_advertiser_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__advertiser_advertiser_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__advertiser_advertiser_id", "alias": "not_null_stg_tiktok_ads__advertiser_advertiser_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__advertiser"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__advertiser_advertiser_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.609247, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`schema`.`stg_tiktok_ads__advertiser`\nwhere advertiser_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "advertiser_id", "file_key_name": "models.stg_tiktok_ads__advertiser"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_group_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_group_history')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__ad_group_history_ad_group_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__ad_group_history_ad_group_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__ad_group_history_ad_group_id", "alias": "not_null_stg_tiktok_ads__ad_group_history_ad_group_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__ad_group_history_ad_group_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.611615, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`schema`.`stg_tiktok_ads__ad_group_history`\nwhere ad_group_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ad_group_id", "file_key_name": "models.stg_tiktok_ads__ad_group_history"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_group_id", "updated_at"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_group_history')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at", "alias": "dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8"}, "created_at": 1659025250.613982, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n ad_group_id, updated_at\n from `database`.`schema`.`stg_tiktok_ads__ad_group_history`\n group by ad_group_id, updated_at\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.stg_tiktok_ads__ad_group_history"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_history')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__ad_history_ad_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__ad_history_ad_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__ad_history_ad_id", "alias": "not_null_stg_tiktok_ads__ad_history_ad_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__ad_history_ad_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.620536, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`schema`.`stg_tiktok_ads__ad_history`\nwhere ad_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ad_id", "file_key_name": "models.stg_tiktok_ads__ad_history"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_id", "updated_at"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_history')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at", "alias": "dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f"}, "created_at": 1659025250.622965, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n ad_id, updated_at\n from `database`.`schema`.`stg_tiktok_ads__ad_history`\n group by ad_id, updated_at\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.stg_tiktok_ads__ad_history"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "campaign_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__campaign_history')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__campaign_history_campaign_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__campaign_history_campaign_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__campaign_history_campaign_id", "alias": "not_null_stg_tiktok_ads__campaign_history_campaign_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__campaign_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__campaign_history_campaign_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.6292312, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`schema`.`stg_tiktok_ads__campaign_history`\nwhere campaign_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "campaign_id", "file_key_name": "models.stg_tiktok_ads__campaign_history"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["campaign_id", "updated_at"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__campaign_history')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at", "alias": "dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__campaign_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000"}, "created_at": 1659025250.631393, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n campaign_id, updated_at\n from `database`.`schema`.`stg_tiktok_ads__campaign_history`\n group by campaign_id, updated_at\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.stg_tiktok_ads__campaign_history"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_ad_id.ee84d783ed": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_report_hourly')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__ad_report_hourly_ad_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_ad_id.ee84d783ed", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__ad_report_hourly_ad_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__ad_report_hourly_ad_id", "alias": "not_null_stg_tiktok_ads__ad_report_hourly_ad_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__ad_report_hourly_ad_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.636872, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`schema`.`stg_tiktok_ads__ad_report_hourly`\nwhere ad_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ad_id", "file_key_name": "models.stg_tiktok_ads__ad_report_hourly"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour.9e2a2dca81": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "stat_time_hour", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_report_hourly')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour.9e2a2dca81", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour", "alias": "not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.638859, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`schema`.`stg_tiktok_ads__ad_report_hourly`\nwhere stat_time_hour is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "stat_time_hour", "file_key_name": "models.stg_tiktok_ads__ad_report_hourly"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_id", "stat_time_hour"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_report_hourly')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour", "alias": "dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc"}, "created_at": 1659025250.6413739, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n ad_id, stat_time_hour\n from `database`.`schema`.`stg_tiktok_ads__ad_report_hourly`\n group by ad_id, stat_time_hour\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.stg_tiktok_ads__ad_report_hourly"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_group_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_group_report_hourly')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id", "alias": "not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.64688, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`schema`.`stg_tiktok_ads__ad_group_report_hourly`\nwhere ad_group_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ad_group_id", "file_key_name": "models.stg_tiktok_ads__ad_group_report_hourly"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour.ca4b495127": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "stat_time_hour", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_group_report_hourly')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour.ca4b495127", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour", "alias": "not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.6488671, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`schema`.`stg_tiktok_ads__ad_group_report_hourly`\nwhere stat_time_hour is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "stat_time_hour", "file_key_name": "models.stg_tiktok_ads__ad_group_report_hourly"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_group_id", "stat_time_hour"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_group_report_hourly')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour", "alias": "dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60"}, "created_at": 1659025250.651117, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n ad_group_id, stat_time_hour\n from `database`.`schema`.`stg_tiktok_ads__ad_group_report_hourly`\n group by ad_group_id, stat_time_hour\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.stg_tiktok_ads__ad_group_report_hourly"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "campaign_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__campaign_report_hourly')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id", "alias": "not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__campaign_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.657023, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`schema`.`stg_tiktok_ads__campaign_report_hourly`\nwhere campaign_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "campaign_id", "file_key_name": "models.stg_tiktok_ads__campaign_report_hourly"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour.e75e13184c": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "stat_time_hour", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__campaign_report_hourly')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour.e75e13184c", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour", "alias": "not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__campaign_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.6591501, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`schema`.`stg_tiktok_ads__campaign_report_hourly`\nwhere stat_time_hour is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "stat_time_hour", "file_key_name": "models.stg_tiktok_ads__campaign_report_hourly"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["campaign_id", "stat_time_hour"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__campaign_report_hourly')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour", "alias": "dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__campaign_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16"}, "created_at": 1659025250.661264, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n campaign_id, stat_time_hour\n from `database`.`schema`.`stg_tiktok_ads__campaign_report_hourly`\n group by campaign_id, stat_time_hour\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.stg_tiktok_ads__campaign_report_hourly"}}, "sources": {"source.tiktok_ads_source.tiktok_ads.advertiser": {"fqn": ["tiktok_ads_source", "tiktok_ads", "advertiser"], "database": "database", "schema": "tiktok_ads_joe", "unique_id": "source.tiktok_ads_source.tiktok_ads.advertiser", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "advertiser", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "advertiser", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 48, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Each record represents data for one advertiser.", "columns": {"id": {"name": "id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "address": {"name": "address", "description": "Advertiser address information", "meta": {}, "data_type": null, "quote": null, "tags": []}, "balance": {"name": "balance", "description": "Account available balance", "meta": {}, "data_type": null, "quote": null, "tags": []}, "company": {"name": "company", "description": "Advertiser's company name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "contacter": {"name": "contacter", "description": "Contact Person", "meta": {}, "data_type": null, "quote": null, "tags": []}, "country": {"name": "country", "description": "The advertiser's country", "meta": {}, "data_type": null, "quote": null, "tags": []}, "create_time": {"name": "create_time", "description": "Advertiser's create time", "meta": {}, "data_type": null, "quote": null, "tags": []}, "currency": {"name": "currency", "description": "Type of currency used by advertisers", "meta": {}, "data_type": null, "quote": null, "tags": []}, "description": {"name": "description", "description": "Brand description, i.e. promotional content", "meta": {}, "data_type": null, "quote": null, "tags": []}, "email": {"name": "email", "description": "Advertiser contact email, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "industry": {"name": "industry", "description": "Advertiser industry category", "meta": {}, "data_type": null, "quote": null, "tags": []}, "language": {"name": "language", "description": "Language used by advertisers", "meta": {}, "data_type": null, "quote": null, "tags": []}, "license_no": {"name": "license_no", "description": "License number", "meta": {}, "data_type": null, "quote": null, "tags": []}, "license_url": {"name": "license_url", "description": "License preview address, the link is valid for an hour by default.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "Advertiser name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "phone_number": {"name": "phone_number", "description": "Contact mobile number, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "promotion_area": {"name": "promotion_area", "description": "Operation area", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reason": {"name": "reason", "description": "Reason for rejection", "meta": {}, "data_type": null, "quote": null, "tags": []}, "role": {"name": "role", "description": "Advertiser role", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Advertiser status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "telephone": {"name": "telephone", "description": "Fixed phone number, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "timezone": {"name": "timezone", "description": "Ad account time zone including GMT offset", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`database`.`tiktok_ads_joe`.`advertiser`", "created_at": 1659025250.666205}, "source.tiktok_ads_source.tiktok_ads.campaign_history": {"fqn": ["tiktok_ads_source", "tiktok_ads", "campaign_history"], "database": "database", "schema": "tiktok_ads_joe", "unique_id": "source.tiktok_ads_source.tiktok_ads.campaign_history", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "campaign_history", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "campaign_history", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 48, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Each record represents a version of a TikTok campaign.", "columns": {"campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget": {"name": "budget", "description": "Campaign budget", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget_mode": {"name": "budget_mode", "description": "Budget type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_type": {"name": "campaign_type", "description": "Campaign Type, indicates the campaign is a regular campaign or iOS 14 campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "create_time": {"name": "create_time", "description": "Time at which the campaign was created.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_new_structure": {"name": "is_new_structure", "description": "Whether the campaign is a new structure (for the same campaign, the structure of campaign, adgroups and ads are the same)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "objective_type": {"name": "objective_type", "description": "Advertising objective.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "opt_status": {"name": "opt_status", "description": "Operation status.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Campaign status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "split_test_variable": {"name": "split_test_variable", "description": "Split Test variables. Optional values; TARGETING, BIDDING_OPTIMIZATION , CREATIVE.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`database`.`tiktok_ads_joe`.`campaign_history`", "created_at": 1659025250.6664262}, "source.tiktok_ads_source.tiktok_ads.adgroup_history": {"fqn": ["tiktok_ads_source", "tiktok_ads", "adgroup_history"], "database": "database", "schema": "tiktok_ads_joe", "unique_id": "source.tiktok_ads_source.tiktok_ads.adgroup_history", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "adgroup_history", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "adgroup_history", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 48, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Each record represents a version of a TikTok ad group.", "columns": {"adgroup_id": {"name": "adgroup_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The Ad group's campaign ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_categories": {"name": "action_categories", "description": "IDs of the action categories (behaviors) that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_days": {"name": "action_days", "description": "The number of days of the time period to include action from.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "adgroup_name": {"name": "adgroup_name", "description": "Ad group name. Character limit is 512 and cannot contain emoji.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "age": {"name": "age", "description": "Age groups you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "android_osv": {"name": "android_osv", "description": "Minimum Android version.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "app_download_url": {"name": "app_download_url", "description": "App download link", "meta": {}, "data_type": null, "quote": null, "tags": []}, "app_id": {"name": "app_id", "description": "The Application id of the promoted app", "meta": {}, "data_type": null, "quote": null, "tags": []}, "app_name": {"name": "app_name", "description": "App name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "app_type": {"name": "app_type", "description": "App type.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience": {"name": "audience", "description": "A list of audience IDs.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience_type": {"name": "audience_type", "description": "Audience Type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "bid": {"name": "bid", "description": "CPC, CPM bidding, oCPM learning bidding", "meta": {}, "data_type": null, "quote": null, "tags": []}, "bid_type": {"name": "bid_type", "description": "Bidding Strategy", "meta": {}, "data_type": null, "quote": null, "tags": []}, "billing_event": {"name": "billing_event", "description": "Bid method.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget": {"name": "budget", "description": "Ad budget. Returns 0.0 when Campaign Budget Optimization (budget_optimize_switch) is on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget_mode": {"name": "budget_mode", "description": "Budget mode. This field will be ignored when Campaign Budget Optimization (budget_optimize_switch) is enabled.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "carriers": {"name": "carriers", "description": "Carriers that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "category": {"name": "category", "description": "Ad group category.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "click_tracking_url": {"name": "click_tracking_url", "description": "Click monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "connection_type": {"name": "connection_type", "description": "Device connection types that you want to target. Default; unlimited.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_bid": {"name": "conversion_bid", "description": "oCPM conversion bid", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpv_video_duration": {"name": "cpv_video_duration", "description": "Video playback duration, required if optimize_goal is VIDEO_VIEW. Allowed values; SIX_SECONDS (video playback 6s), TWO_SECONDS (video playback 2s)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "creative_material_mode": {"name": "creative_material_mode", "description": "Creative delivery mode.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "dayparting": {"name": "dayparting", "description": "Ad delivery period, the default is always and the format is 48 * 7 character string, represented by 0 or 1. > That is, with half an hour as the minimum granularity, a day (24 hours) is divided by the minimum granularity(30 mins) from Monday to Sunday. Resulting in a 48*7 format.0 represents not to be delivered, 1 represents delivery. no transmission, full transmission 0, full transmission 1 all represent full time delivery", "meta": {}, "data_type": null, "quote": null, "tags": []}, "deep_bid_type": {"name": "deep_bid_type", "description": "Bidding strategy for in-app events.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "deep_cpabid": {"name": "deep_cpabid", "description": "Deep bid", "meta": {}, "data_type": null, "quote": null, "tags": []}, "deep_external_action": {"name": "deep_external_action", "description": "Deep conversion event.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "display_name": {"name": "display_name", "description": "Display name of ad group.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "enable_inventory_filter": {"name": "enable_inventory_filter", "description": "Inventory filtering (Unsafe videos will not be displayed).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "excluded_audience": {"name": "excluded_audience", "description": "A list of audience ID to be excluded.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "external_action": {"name": "external_action", "description": "Conversion event for the ad group. It is required when the promoted object is an app with tracking urls, or when pixel_id is specified.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "fallback_type": {"name": "fallback_type", "description": "Fallback Type. If the audience do not have the app installed, you can have them fall back to install the app, or to view a specific web page. Not applicable for Deferred Deeplink. Allowed values; APP_INSTALL, WEBSITE, UNSET. If website is chosen, you need to specify the url via landing_page_url field.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency": {"name": "frequency", "description": "frequency, together with frequency_schedule, controls how often people see your ad (only available for REACH ads). For example, frequency = 2 frequency_schedule = 3 means \"show ads no more than twice every 3 day\".\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency_schedule": {"name": "frequency_schedule", "description": "frequency, together with frequency, controls how often people see your ad (only available for REACH ads).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impression_tracking_url": {"name": "impression_tracking_url", "description": "Display monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "interest_category_v2": {"name": "interest_category_v2", "description": "Interest classification. If the interest is specified, users that do not meet interest target will be excluded during delivery.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ios_osv": {"name": "ios_osv", "description": "Minimum iOS version.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_comment_disable": {"name": "is_comment_disable", "description": "Whether to allow comments on your ads on TikTok, Vigo, Helo.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_hfss": {"name": "is_hfss", "description": "Whether the promoted content is HFSS foods (foods that are high in fat, salt, or sugar).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_new_structure": {"name": "is_new_structure", "description": "Whether the campaign is a new structure.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "keywords": {"name": "keywords", "description": "Keywords used.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "languages": {"name": "languages", "description": "Codes of the languages that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "location": {"name": "location", "description": "IDs of the locations that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "open_url": {"name": "open_url", "description": "The specific location where you want your audience to go if they have your app installed.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "open_url_type": {"name": "open_url_type", "description": "The open URL type.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "operation_system": {"name": "operation_system", "description": "Device operating systems that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "opt_status": {"name": "opt_status", "description": "Operation status.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "optimize_goal": {"name": "optimize_goal", "description": "Optimization goal.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "pacing": {"name": "pacing", "description": "You can choose between PACING_MODE_SMOOTH and PACING_MODE_FAST. For PACING_MODE_SMOOTH, the budget is allocated evenly within the scheduled time. PACING_MODE_FAST would consume budget and produce results as soon as possible. \n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "package": {"name": "package", "description": "Package name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "pangle_block_app_list_id": {"name": "pangle_block_app_list_id", "description": "Pangle app block list ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "pixel_id": {"name": "pixel_id", "description": "Pixel ID. Only application for landing pages.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "placement": {"name": "placement", "description": "The apps where you want to deliver your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "placement_type": {"name": "placement_type", "description": "Placement type.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_image": {"name": "profile_image", "description": "Avatar URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "schedule_end_time": {"name": "schedule_end_time", "description": "Ad delivery end time (UTC+0). Format should be YYYY-MM-DD HH:MM:SS", "meta": {}, "data_type": null, "quote": null, "tags": []}, "schedule_start_time": {"name": "schedule_start_time", "description": "Ad delivery start time (UTC+0). Format should be YYYY-MM-DD HH:MM:SS", "meta": {}, "data_type": null, "quote": null, "tags": []}, "schedule_type": {"name": "schedule_type", "description": "The schedule type, which can be either SCHEDULE_START_END or SCHEDULE_FROM_NOW.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "skip_learning_phase": {"name": "skip_learning_phase", "description": "Whether to skip the learning stage.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "statistic_type": {"name": "statistic_type", "description": "conversion bid statistic type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Ad group status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_actions": {"name": "video_actions", "description": "Number of video actions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_download": {"name": "video_download", "description": "Whether users can download your video ads on TikTok(cannot be updated once created).", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`database`.`tiktok_ads_joe`.`adgroup_history`", "created_at": 1659025250.6667461}, "source.tiktok_ads_source.tiktok_ads.ad_history": {"fqn": ["tiktok_ads_source", "tiktok_ads", "ad_history"], "database": "database", "schema": "tiktok_ads_joe", "unique_id": "source.tiktok_ads_source.tiktok_ads.ad_history", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "ad_history", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "ad_history", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 48, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Each record represents a version of a TikTok ad.", "columns": {"ad_id": {"name": "ad_id", "description": "Ad ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "adgroup_id": {"name": "adgroup_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_name": {"name": "ad_name", "description": "Ad Name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_text": {"name": "ad_text", "description": "The ad text.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "app_name": {"name": "app_name", "description": "The display name of app download ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "call_to_action": {"name": "call_to_action", "description": "Call to action values.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "click_tracking_url": {"name": "click_tracking_url", "description": "Click monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "create_time": {"name": "create_time", "description": "Time at which the ad was created.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "display_name": {"name": "display_name", "description": "The display name of landing page or pure exposure ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "image_ids": {"name": "image_ids", "description": "A list of image IDs.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impression_tracking_url": {"name": "impression_tracking_url", "description": "Display monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_aco": {"name": "is_aco", "description": "Whether the ad is an automated ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_creative_authorized": {"name": "is_creative_authorized", "description": "Whether you grant displaying some of your ads in our TikTok For Business Creative Center. Only valid for non-US advertisers, the default value is false.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_new_structure": {"name": "is_new_structure", "description": "Whether the campaign is a new structure.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "open_url": {"name": "open_url", "description": "The specific location where you want your audience to go if they have your app installed.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "opt_status": {"name": "opt_status", "description": "Operation status.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "playable_url": {"name": "playable_url", "description": "Playable material url.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_image": {"name": "profile_image", "description": "Avatar URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Ad status.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_id": {"name": "video_id", "description": "The video ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`database`.`tiktok_ads_joe`.`ad_history`", "created_at": 1659025250.6669629}, "source.tiktok_ads_source.tiktok_ads.ad_report_hourly": {"fqn": ["tiktok_ads_source", "tiktok_ads", "ad_report_hourly"], "database": "database", "schema": "tiktok_ads_joe", "unique_id": "source.tiktok_ads_source.tiktok_ads.ad_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "ad_report_hourly", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "ad_report_hourly", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 48, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Each record represents data for each ad for each hour.", "columns": {"ad_id": {"name": "ad_id", "description": "Ad id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion": {"name": "real_time_conversion", "description": "The number of times your ad achieved an outcome, based on the objective and settings you selected. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result": {"name": "result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the results. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_result": {"name": "real_time_cost_per_result", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now, please go to the ad group section to view the cost per Result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result": {"name": "real_time_result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As a campaign may have different optimization goals, the total number of result is not supported in campaign section now , Please go to the ad group section to view the result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_view_p_100": {"name": "video_view_p_100", "description": "The number of times your video was played at 100% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion_rate": {"name": "real_time_conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_secondary_goal_result": {"name": "cost_per_secondary_goal_result", "description": "The average cost for each secondary goal result from your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result_rate": {"name": "secondary_goal_result_rate", "description": "The percentage of secondary goal results you achieved out of all of the installs of your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. The total count is calculated based on the time each ad impression occurred.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_conversion": {"name": "real_time_cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result_rate": {"name": "result_rate", "description": "The percentage of results you achieved out of all of the views/clicks on your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the result rate. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result": {"name": "secondary_goal_result", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_result": {"name": "cost_per_result", "description": "The average cost for each result from your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the cost per result. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time your video was played per person, including any time spent replaying the video. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result_rate": {"name": "real_time_result_rate", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now ,Please go to the ad group section to view the Result Rate. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`database`.`tiktok_ads_joe`.`ad_report_hourly`", "created_at": 1659025250.667213}, "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly": {"fqn": ["tiktok_ads_source", "tiktok_ads", "campaign_report_hourly"], "database": "database", "schema": "tiktok_ads_joe", "unique_id": "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "campaign_report_hourly", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "campaign_report_hourly", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 48, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Each record represents data for each campaign for each hour.", "columns": {"campaign_id": {"name": "campaign_id", "description": "Campaign id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion": {"name": "real_time_conversion", "description": "The number of times your ad achieved an outcome, based on the objective and settings you selected. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result": {"name": "result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the results. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_result": {"name": "real_time_cost_per_result", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now, please go to the ad group section to view the cost per Result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result": {"name": "real_time_result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As a campaign may have different optimization goals, the total number of result is not supported in campaign section now , Please go to the ad group section to view the result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_view_p_100": {"name": "video_view_p_100", "description": "The number of times your video was played at 100% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion_rate": {"name": "real_time_conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_secondary_goal_result": {"name": "cost_per_secondary_goal_result", "description": "The average cost for each secondary goal result from your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result_rate": {"name": "secondary_goal_result_rate", "description": "The percentage of secondary goal results you achieved out of all of the installs of your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. The total count is calculated based on the time each ad impression occurred.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_conversion": {"name": "real_time_cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result_rate": {"name": "result_rate", "description": "The percentage of results you achieved out of all of the views/clicks on your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the result rate. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result": {"name": "secondary_goal_result", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_result": {"name": "cost_per_result", "description": "The average cost for each result from your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the cost per result. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time your video was played per person, including any time spent replaying the video. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result_rate": {"name": "real_time_result_rate", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now ,Please go to the ad group section to view the Result Rate. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`database`.`tiktok_ads_joe`.`campaign_report_hourly`", "created_at": 1659025250.667466}, "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly": {"fqn": ["tiktok_ads_source", "tiktok_ads", "adgroup_report_hourly"], "database": "database", "schema": "tiktok_ads_joe", "unique_id": "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "adgroup_report_hourly", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "adgroup_report_hourly", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 48, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Each record represents data for each ad group for each hour.", "columns": {"adgroup_id": {"name": "adgroup_id", "description": "Ad group id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion": {"name": "real_time_conversion", "description": "The number of times your ad achieved an outcome, based on the objective and settings you selected. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result": {"name": "result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the results. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_result": {"name": "real_time_cost_per_result", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now, please go to the ad group section to view the cost per Result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result": {"name": "real_time_result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As a campaign may have different optimization goals, the total number of result is not supported in campaign section now , Please go to the ad group section to view the result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_view_p_100": {"name": "video_view_p_100", "description": "The number of times your video was played at 100% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion_rate": {"name": "real_time_conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_secondary_goal_result": {"name": "cost_per_secondary_goal_result", "description": "The average cost for each secondary goal result from your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result_rate": {"name": "secondary_goal_result_rate", "description": "The percentage of secondary goal results you achieved out of all of the installs of your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. The total count is calculated based on the time each ad impression occurred.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_conversion": {"name": "real_time_cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result_rate": {"name": "result_rate", "description": "The percentage of results you achieved out of all of the views/clicks on your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the result rate. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result": {"name": "secondary_goal_result", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_result": {"name": "cost_per_result", "description": "The average cost for each result from your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the cost per result. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time your video was played per person, including any time spent replaying the video. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result_rate": {"name": "real_time_result_rate", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now ,Please go to the ad group section to view the Result Rate. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`database`.`tiktok_ads_joe`.`adgroup_report_hourly`", "created_at": 1659025250.667936}}, "macros": {"macro.dbt_bigquery.date_sharded_table": {"unique_id": "macro.dbt_bigquery.date_sharded_table", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/etc.sql", "original_file_path": "macros/etc.sql", "name": "date_sharded_table", "macro_sql": "{% macro date_sharded_table(base_name) %}\n {{ return(base_name ~ \"[DBT__PARTITION_DATE]\") }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.559489}, "macro.dbt_bigquery.grant_access_to": {"unique_id": "macro.dbt_bigquery.grant_access_to", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/etc.sql", "original_file_path": "macros/etc.sql", "name": "grant_access_to", "macro_sql": "{% macro grant_access_to(entity, entity_type, role, grant_target_dict) -%}\n {% do adapter.grant_access_to(entity, entity_type, role, grant_target_dict) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.5600598}, "macro.dbt_bigquery.get_partitions_metadata": {"unique_id": "macro.dbt_bigquery.get_partitions_metadata", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/etc.sql", "original_file_path": "macros/etc.sql", "name": "get_partitions_metadata", "macro_sql": "\n\n{%- macro get_partitions_metadata(table) -%}\n {%- if execute -%}\n {%- set res = adapter.get_partitions_metadata(table) -%}\n {{- return(res) -}}\n {%- endif -%}\n {{- return(None) -}}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.560735}, "macro.dbt_bigquery.bigquery__get_catalog": {"unique_id": "macro.dbt_bigquery.bigquery__get_catalog", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "name": "bigquery__get_catalog", "macro_sql": "{% macro bigquery__get_catalog(information_schema, schemas) -%}\n\n {%- if (schemas | length) == 0 -%}\n {# Hopefully nothing cares about the columns we return when there are no rows #}\n {%- set query = \"select 1 as id limit 0\" -%}\n {%- else -%}\n\n {%- set query -%}\n with tables as (\n select\n project_id as table_database,\n dataset_id as table_schema,\n table_id as original_table_name,\n\n concat(project_id, '.', dataset_id, '.', table_id) as relation_id,\n\n row_count,\n size_bytes as size_bytes,\n case\n when type = 1 then 'table'\n when type = 2 then 'view'\n else 'external'\n end as table_type,\n\n REGEXP_CONTAINS(table_id, '^.+[0-9]{8}$') and coalesce(type, 0) = 1 as is_date_shard,\n REGEXP_EXTRACT(table_id, '^(.+)[0-9]{8}$') as shard_base_name,\n REGEXP_EXTRACT(table_id, '^.+([0-9]{8})$') as shard_name\n\n from {{ information_schema.replace(information_schema_view='__TABLES__') }}\n where (\n {%- for schema in schemas -%}\n upper(dataset_id) = upper('{{ schema }}'){%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n )\n ),\n\n extracted as (\n\n select *,\n case\n when is_date_shard then shard_base_name\n else original_table_name\n end as table_name\n\n from tables\n\n ),\n\n unsharded_tables as (\n\n select\n table_database,\n table_schema,\n table_name,\n coalesce(table_type, 'external') as table_type,\n is_date_shard,\n\n struct(\n min(shard_name) as shard_min,\n max(shard_name) as shard_max,\n count(*) as shard_count\n ) as table_shards,\n\n sum(size_bytes) as size_bytes,\n sum(row_count) as row_count,\n\n max(relation_id) as relation_id\n\n from extracted\n group by 1,2,3,4,5\n\n ),\n\n info_schema_columns as (\n\n select\n concat(table_catalog, '.', table_schema, '.', table_name) as relation_id,\n table_catalog as table_database,\n table_schema,\n table_name,\n\n -- use the \"real\" column name from the paths query below\n column_name as base_column_name,\n ordinal_position as column_index,\n\n is_partitioning_column,\n clustering_ordinal_position\n\n from {{ information_schema.replace(information_schema_view='COLUMNS') }}\n where ordinal_position is not null\n\n ),\n\n info_schema_column_paths as (\n\n select\n concat(table_catalog, '.', table_schema, '.', table_name) as relation_id,\n field_path as column_name,\n data_type as column_type,\n column_name as base_column_name,\n description as column_comment\n\n from {{ information_schema.replace(information_schema_view='COLUMN_FIELD_PATHS') }}\n\n ),\n\n columns as (\n\n select * except (base_column_name)\n from info_schema_columns\n join info_schema_column_paths using (relation_id, base_column_name)\n\n ),\n\n column_stats as (\n\n select\n table_database,\n table_schema,\n table_name,\n max(relation_id) as relation_id,\n max(case when is_partitioning_column = 'YES' then 1 else 0 end) = 1 as is_partitioned,\n max(case when is_partitioning_column = 'YES' then column_name else null end) as partition_column,\n max(case when clustering_ordinal_position is not null then 1 else 0 end) = 1 as is_clustered,\n array_to_string(\n array_agg(\n case\n when clustering_ordinal_position is not null then column_name\n else null\n end ignore nulls\n order by clustering_ordinal_position\n ), ', '\n ) as clustering_columns\n\n from columns\n group by 1,2,3\n\n )\n\n select\n unsharded_tables.table_database,\n unsharded_tables.table_schema,\n case\n when is_date_shard then concat(unsharded_tables.table_name, '*')\n else unsharded_tables.table_name\n end as table_name,\n unsharded_tables.table_type,\n\n -- coalesce name and type for External tables - these columns are not\n -- present in the COLUMN_FIELD_PATHS resultset\n coalesce(columns.column_name, '') as column_name,\n -- invent a row number to account for nested fields -- BQ does\n -- not treat these nested properties as independent fields\n row_number() over (\n partition by relation_id\n order by columns.column_index, columns.column_name\n ) as column_index,\n coalesce(columns.column_type, '') as column_type,\n columns.column_comment,\n\n 'Shard count' as `stats__date_shards__label`,\n table_shards.shard_count as `stats__date_shards__value`,\n 'The number of date shards in this table' as `stats__date_shards__description`,\n is_date_shard as `stats__date_shards__include`,\n\n 'Shard (min)' as `stats__date_shard_min__label`,\n table_shards.shard_min as `stats__date_shard_min__value`,\n 'The first date shard in this table' as `stats__date_shard_min__description`,\n is_date_shard as `stats__date_shard_min__include`,\n\n 'Shard (max)' as `stats__date_shard_max__label`,\n table_shards.shard_max as `stats__date_shard_max__value`,\n 'The last date shard in this table' as `stats__date_shard_max__description`,\n is_date_shard as `stats__date_shard_max__include`,\n\n '# Rows' as `stats__num_rows__label`,\n row_count as `stats__num_rows__value`,\n 'Approximate count of rows in this table' as `stats__num_rows__description`,\n (unsharded_tables.table_type = 'table') as `stats__num_rows__include`,\n\n 'Approximate Size' as `stats__num_bytes__label`,\n size_bytes as `stats__num_bytes__value`,\n 'Approximate size of table as reported by BigQuery' as `stats__num_bytes__description`,\n (unsharded_tables.table_type = 'table') as `stats__num_bytes__include`,\n\n 'Partitioned By' as `stats__partitioning_type__label`,\n partition_column as `stats__partitioning_type__value`,\n 'The partitioning column for this table' as `stats__partitioning_type__description`,\n is_partitioned as `stats__partitioning_type__include`,\n\n 'Clustered By' as `stats__clustering_fields__label`,\n clustering_columns as `stats__clustering_fields__value`,\n 'The clustering columns for this table' as `stats__clustering_fields__description`,\n is_clustered as `stats__clustering_fields__include`\n\n -- join using relation_id (an actual relation, not a shard prefix) to make\n -- sure that column metadata is picked up through the join. This will only\n -- return the column information for the \"max\" table in a date-sharded table set\n from unsharded_tables\n left join columns using (relation_id)\n left join column_stats using (relation_id)\n {%- endset -%}\n\n {%- endif -%}\n\n {{ return(run_query(query)) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.replace", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.5665238}, "macro.dbt_bigquery.partition_by": {"unique_id": "macro.dbt_bigquery.partition_by", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "partition_by", "macro_sql": "{% macro partition_by(partition_config) -%}\n {%- if partition_config is none -%}\n {% do return('') %}\n {%- elif partition_config.data_type | lower in ('date','timestamp','datetime') -%}\n partition by {{ partition_config.render() }}\n {%- elif partition_config.data_type | lower in ('int64') -%}\n {%- set range = partition_config.range -%}\n partition by range_bucket(\n {{ partition_config.field }},\n generate_array({{ range.start}}, {{ range.end }}, {{ range.interval }})\n )\n {%- endif -%}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.575375}, "macro.dbt_bigquery.cluster_by": {"unique_id": "macro.dbt_bigquery.cluster_by", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "cluster_by", "macro_sql": "{% macro cluster_by(raw_cluster_by) %}\n {%- if raw_cluster_by is not none -%}\n cluster by {% if raw_cluster_by is string -%}\n {% set raw_cluster_by = [raw_cluster_by] %}\n {%- endif -%}\n {%- for cluster in raw_cluster_by -%}\n {{ cluster }}\n {%- if not loop.last -%}, {% endif -%}\n {%- endfor -%}\n\n {% endif %}\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.576308}, "macro.dbt_bigquery.bigquery_options": {"unique_id": "macro.dbt_bigquery.bigquery_options", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery_options", "macro_sql": "{% macro bigquery_options(opts) %}\n {% set options -%}\n OPTIONS({% for opt_key, opt_val in opts.items() %}\n {{ opt_key }}={{ opt_val }}{{ \",\" if not loop.last }}\n {% endfor %})\n {%- endset %}\n {%- do return(options) -%}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.5771232}, "macro.dbt_bigquery.bigquery_table_options": {"unique_id": "macro.dbt_bigquery.bigquery_table_options", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery_table_options", "macro_sql": "{% macro bigquery_table_options(config, node, temporary) %}\n {% set opts = adapter.get_table_options(config, node, temporary) %}\n {%- do return(bigquery_options(opts)) -%}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery_options"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.5777018}, "macro.dbt_bigquery.bigquery__create_table_as": {"unique_id": "macro.dbt_bigquery.bigquery__create_table_as", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__create_table_as", "macro_sql": "{% macro bigquery__create_table_as(temporary, relation, sql) -%}\n {%- set raw_partition_by = config.get('partition_by', none) -%}\n {%- set raw_cluster_by = config.get('cluster_by', none) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {%- set partition_config = adapter.parse_partition_by(raw_partition_by) -%}\n\n {{ sql_header if sql_header is not none }}\n\n create or replace table {{ relation }}\n {{ partition_by(partition_config) }}\n {{ cluster_by(raw_cluster_by) }}\n {{ bigquery_table_options(config, model, temporary) }}\n as (\n {{ sql }}\n );\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.partition_by", "macro.dbt_bigquery.cluster_by", "macro.dbt_bigquery.bigquery_table_options"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.579099}, "macro.dbt_bigquery.bigquery_view_options": {"unique_id": "macro.dbt_bigquery.bigquery_view_options", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery_view_options", "macro_sql": "{% macro bigquery_view_options(config, node) %}\n {% set opts = adapter.get_view_options(config, node) %}\n {%- do return(bigquery_options(opts)) -%}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery_options"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.5798368}, "macro.dbt_bigquery.bigquery__create_view_as": {"unique_id": "macro.dbt_bigquery.bigquery__create_view_as", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__create_view_as", "macro_sql": "{% macro bigquery__create_view_as(relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n\n create or replace view {{ relation }}\n {{ bigquery_view_options(config, model) }}\n as {{ sql }};\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery_view_options"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.580534}, "macro.dbt_bigquery.bigquery__create_schema": {"unique_id": "macro.dbt_bigquery.bigquery__create_schema", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__create_schema", "macro_sql": "{% macro bigquery__create_schema(relation) -%}\n {{ adapter.create_schema(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.580823}, "macro.dbt_bigquery.bigquery__drop_schema": {"unique_id": "macro.dbt_bigquery.bigquery__drop_schema", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__drop_schema", "macro_sql": "{% macro bigquery__drop_schema(relation) -%}\n {{ adapter.drop_schema(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.581107}, "macro.dbt_bigquery.bigquery__drop_relation": {"unique_id": "macro.dbt_bigquery.bigquery__drop_relation", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__drop_relation", "macro_sql": "{% macro bigquery__drop_relation(relation) -%}\n {% call statement('drop_relation') -%}\n drop {{ relation.type }} if exists {{ relation }}\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.581578}, "macro.dbt_bigquery.bigquery__get_columns_in_relation": {"unique_id": "macro.dbt_bigquery.bigquery__get_columns_in_relation", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__get_columns_in_relation", "macro_sql": "{% macro bigquery__get_columns_in_relation(relation) -%}\n {{ return(adapter.get_columns_in_relation(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.58202}, "macro.dbt_bigquery.bigquery__list_relations_without_caching": {"unique_id": "macro.dbt_bigquery.bigquery__list_relations_without_caching", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__list_relations_without_caching", "macro_sql": "{% macro bigquery__list_relations_without_caching(schema_relation) -%}\n {{ return(adapter.list_relations_without_caching(schema_relation)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.582551}, "macro.dbt_bigquery.bigquery__current_timestamp": {"unique_id": "macro.dbt_bigquery.bigquery__current_timestamp", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__current_timestamp", "macro_sql": "{% macro bigquery__current_timestamp() -%}\n CURRENT_TIMESTAMP()\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.582869}, "macro.dbt_bigquery.bigquery__snapshot_string_as_time": {"unique_id": "macro.dbt_bigquery.bigquery__snapshot_string_as_time", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__snapshot_string_as_time", "macro_sql": "{% macro bigquery__snapshot_string_as_time(timestamp) -%}\n {%- set result = 'TIMESTAMP(\"' ~ timestamp ~ '\")' -%}\n {{ return(result) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.583254}, "macro.dbt_bigquery.bigquery__list_schemas": {"unique_id": "macro.dbt_bigquery.bigquery__list_schemas", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__list_schemas", "macro_sql": "{% macro bigquery__list_schemas(database) -%}\n {{ return(adapter.list_schemas(database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.5838091}, "macro.dbt_bigquery.bigquery__check_schema_exists": {"unique_id": "macro.dbt_bigquery.bigquery__check_schema_exists", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__check_schema_exists", "macro_sql": "{% macro bigquery__check_schema_exists(information_schema, schema) %}\n {{ return(adapter.check_schema_exists(information_schema.database, schema)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.584695}, "macro.dbt_bigquery.bigquery__persist_docs": {"unique_id": "macro.dbt_bigquery.bigquery__persist_docs", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__persist_docs", "macro_sql": "{% macro bigquery__persist_docs(relation, model, for_relation, for_columns) -%}\n {% if for_columns and config.persist_column_docs() and model.columns %}\n {% do alter_column_comment(relation, model.columns) %}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.5856}, "macro.dbt_bigquery.bigquery__alter_column_comment": {"unique_id": "macro.dbt_bigquery.bigquery__alter_column_comment", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__alter_column_comment", "macro_sql": "{% macro bigquery__alter_column_comment(relation, column_dict) -%}\n {% do adapter.update_columns(relation, column_dict) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.585968}, "macro.dbt_bigquery.bigquery__rename_relation": {"unique_id": "macro.dbt_bigquery.bigquery__rename_relation", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__rename_relation", "macro_sql": "{% macro bigquery__rename_relation(from_relation, to_relation) -%}\n {% do adapter.rename_relation(from_relation, to_relation) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.586335}, "macro.dbt_bigquery.bigquery__alter_relation_add_columns": {"unique_id": "macro.dbt_bigquery.bigquery__alter_relation_add_columns", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__alter_relation_add_columns", "macro_sql": "{% macro bigquery__alter_relation_add_columns(relation, add_columns) %}\n \n {% set sql -%}\n \n alter {{ relation.type }} {{ relation }}\n {% for column in add_columns %}\n add column {{ column.name }} {{ column.data_type }}{{ ',' if not loop.last }}\n {% endfor %}\n \n {%- endset -%}\n\n {{ return(run_query(sql)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.587254}, "macro.dbt_bigquery.bigquery__alter_relation_drop_columns": {"unique_id": "macro.dbt_bigquery.bigquery__alter_relation_drop_columns", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__alter_relation_drop_columns", "macro_sql": "{% macro bigquery__alter_relation_drop_columns(relation, drop_columns) %}\n \n {% set sql -%}\n \n alter {{ relation.type }} {{ relation }}\n\n {% for column in drop_columns %}\n drop column {{ column.name }}{{ ',' if not loop.last }}\n {% endfor %}\n \n {%- endset -%}\n \n {{ return(run_query(sql)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.5881789}, "macro.dbt_bigquery.bigquery__alter_column_type": {"unique_id": "macro.dbt_bigquery.bigquery__alter_column_type", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__alter_column_type", "macro_sql": "{% macro bigquery__alter_column_type(relation, column_name, new_column_type) -%}\n {#-- Changing a column's data type using a query requires you to scan the entire table.\n The query charges can be significant if the table is very large.\n\n https://cloud.google.com/bigquery/docs/manually-changing-schemas#changing_a_columns_data_type\n #}\n {% set relation_columns = get_columns_in_relation(relation) %}\n\n {% set sql %}\n select\n {%- for col in relation_columns -%}\n {% if col.column == column_name %}\n CAST({{ col.quoted }} AS {{ new_column_type }}) AS {{ col.quoted }}\n {%- else %}\n {{ col.quoted }}\n {%- endif %}\n {%- if not loop.last %},{% endif -%}\n {%- endfor %}\n from {{ relation }}\n {% endset %}\n\n {% call statement('alter_column_type') %}\n {{ create_table_as(False, relation, sql)}}\n {%- endcall %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_columns_in_relation", "macro.dbt.statement", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.5898502}, "macro.dbt_bigquery.bigquery__test_unique": {"unique_id": "macro.dbt_bigquery.bigquery__test_unique", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__test_unique", "macro_sql": "{% macro bigquery__test_unique(model, column_name) %}\n\nwith dbt_test__target as (\n \n select {{ column_name }} as unique_field\n from {{ model }}\n where {{ column_name }} is not null\n \n)\n\nselect\n unique_field,\n count(*) as n_records\n\nfrom dbt_test__target\ngroup by unique_field\nhaving count(*) > 1\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.590223}, "macro.dbt_bigquery.bigquery__create_csv_table": {"unique_id": "macro.dbt_bigquery.bigquery__create_csv_table", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "name": "bigquery__create_csv_table", "macro_sql": "{% macro bigquery__create_csv_table(model, agate_table) %}\n -- no-op\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.590954}, "macro.dbt_bigquery.bigquery__reset_csv_table": {"unique_id": "macro.dbt_bigquery.bigquery__reset_csv_table", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "name": "bigquery__reset_csv_table", "macro_sql": "{% macro bigquery__reset_csv_table(model, full_refresh, old_relation, agate_table) %}\n {{ adapter.drop_relation(old_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.591389}, "macro.dbt_bigquery.bigquery__load_csv_rows": {"unique_id": "macro.dbt_bigquery.bigquery__load_csv_rows", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "name": "bigquery__load_csv_rows", "macro_sql": "{% macro bigquery__load_csv_rows(model, agate_table) %}\n\n {%- set column_override = model['config'].get('column_types', {}) -%}\n {{ adapter.load_dataframe(model['database'], model['schema'], model['alias'],\n \t\t\t\t\t\t\tagate_table, column_override) }}\n {% if config.persist_relation_docs() and 'description' in model %}\n\n \t{{ adapter.update_table_description(model['database'], model['schema'], model['alias'], model['description']) }}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.593206}, "macro.dbt_bigquery.bigquery__handle_existing_table": {"unique_id": "macro.dbt_bigquery.bigquery__handle_existing_table", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/view.sql", "original_file_path": "macros/materializations/view.sql", "name": "bigquery__handle_existing_table", "macro_sql": "{% macro bigquery__handle_existing_table(full_refresh, old_relation) %}\n {%- if full_refresh -%}\n {{ adapter.drop_relation(old_relation) }}\n {%- else -%}\n {{ exceptions.relation_wrong_type(old_relation, 'view') }}\n {%- endif -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.594513}, "macro.dbt_bigquery.materialization_view_bigquery": {"unique_id": "macro.dbt_bigquery.materialization_view_bigquery", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/view.sql", "original_file_path": "macros/materializations/view.sql", "name": "materialization_view_bigquery", "macro_sql": "{% materialization view, adapter='bigquery' -%}\n {% set to_return = create_or_replace_view() %}\n\n {% set target_relation = this.incorporate(type='view') %}\n {% do persist_docs(target_relation, model) %}\n\n {% if config.get('grant_access_to') %}\n {% for grant_target_dict in config.get('grant_access_to') %}\n {% do adapter.grant_access_to(this, 'view', None, grant_target_dict) %}\n {% endfor %}\n {% endif %}\n\n {% do return(to_return) %}\n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_or_replace_view", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.596042}, "macro.dbt_bigquery.materialization_table_bigquery": {"unique_id": "macro.dbt_bigquery.materialization_table_bigquery", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "name": "materialization_table_bigquery", "macro_sql": "{% materialization table, adapter='bigquery' -%}\n\n {%- set identifier = model['alias'] -%}\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set exists_not_as_table = (old_relation is not none and not old_relation.is_table) -%}\n {%- set target_relation = api.Relation.create(database=database, schema=schema, identifier=identifier, type='table') -%}\n\n {{ run_hooks(pre_hooks) }}\n\n {#\n We only need to drop this thing if it is not a table.\n If it _is_ already a table, then we can overwrite it without downtime\n Unlike table -> view, no need for `--full-refresh`: dropping a view is no big deal\n #}\n {%- if exists_not_as_table -%}\n {{ adapter.drop_relation(old_relation) }}\n {%- endif -%}\n\n -- build model\n {%- set raw_partition_by = config.get('partition_by', none) -%}\n {%- set partition_by = adapter.parse_partition_by(raw_partition_by) -%}\n {%- set cluster_by = config.get('cluster_by', none) -%}\n {% if not adapter.is_replaceable(old_relation, partition_by, cluster_by) %}\n {% do log(\"Hard refreshing \" ~ old_relation ~ \" because it is not replaceable\") %}\n {% do adapter.drop_relation(old_relation) %}\n {% endif %}\n {% call statement('main') -%}\n {{ create_table_as(False, target_relation, sql) }}\n {% endcall -%}\n\n {{ run_hooks(post_hooks) }}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.599952}, "macro.dbt_bigquery.materialization_copy_bigquery": {"unique_id": "macro.dbt_bigquery.materialization_copy_bigquery", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/copy.sql", "original_file_path": "macros/materializations/copy.sql", "name": "materialization_copy_bigquery", "macro_sql": "{% materialization copy, adapter='bigquery' -%}\n\n {# Setup #}\n {{ run_hooks(pre_hooks) }}\n\n {% set destination = this.incorporate(type='table') %}\n\n {# there can be several ref() or source() according to BQ copy API docs #}\n {# cycle over ref() and source() to create source tables array #}\n {% set source_array = [] %}\n {% for ref_table in model.refs %}\n {{ source_array.append(ref(*ref_table)) }}\n {% endfor %}\n\n {% for src_table in model.sources %}\n {{ source_array.append(source(*src_table)) }}\n {% endfor %}\n\n {# Call adapter's copy_table function #}\n {%- set result_str = adapter.copy_table(\n source_array,\n destination,\n config.get('copy_materialization', default = 'table')) -%}\n\n {{ store_result('main', response=result_str) }}\n\n {# Clean up #}\n {{ run_hooks(post_hooks) }}\n {{ adapter.commit() }}\n\n {{ return({'relations': [destination]}) }}\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6024902}, "macro.dbt_bigquery.declare_dbt_max_partition": {"unique_id": "macro.dbt_bigquery.declare_dbt_max_partition", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "name": "declare_dbt_max_partition", "macro_sql": "{% macro declare_dbt_max_partition(relation, partition_by, sql) %}\n\n {% if '_dbt_max_partition' in sql %}\n\n declare _dbt_max_partition {{ partition_by.data_type }} default (\n select max({{ partition_by.field }}) from {{ this }}\n where {{ partition_by.field }} is not null\n );\n \n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.606169}, "macro.dbt_bigquery.dbt_bigquery_validate_get_incremental_strategy": {"unique_id": "macro.dbt_bigquery.dbt_bigquery_validate_get_incremental_strategy", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "name": "dbt_bigquery_validate_get_incremental_strategy", "macro_sql": "{% macro dbt_bigquery_validate_get_incremental_strategy(config) %}\n {#-- Find and validate the incremental strategy #}\n {%- set strategy = config.get(\"incremental_strategy\", default=\"merge\") -%}\n\n {% set invalid_strategy_msg -%}\n Invalid incremental strategy provided: {{ strategy }}\n Expected one of: 'merge', 'insert_overwrite'\n {%- endset %}\n {% if strategy not in ['merge', 'insert_overwrite'] %}\n {% do exceptions.raise_compiler_error(invalid_strategy_msg) %}\n {% endif %}\n\n {% do return(strategy) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6072152}, "macro.dbt_bigquery.bq_insert_overwrite": {"unique_id": "macro.dbt_bigquery.bq_insert_overwrite", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "name": "bq_insert_overwrite", "macro_sql": "{% macro bq_insert_overwrite(\n tmp_relation, target_relation, sql, unique_key, partition_by, partitions, dest_columns, tmp_relation_exists\n) %}\n\n {% if partitions is not none and partitions != [] %} {# static #}\n\n {% set predicate -%}\n {{ partition_by.render(alias='DBT_INTERNAL_DEST') }} in (\n {{ partitions | join (', ') }}\n )\n {%- endset %}\n\n {%- set source_sql -%}\n (\n {{sql}}\n )\n {%- endset -%}\n\n {{ get_insert_overwrite_merge_sql(target_relation, source_sql, dest_columns, [predicate], include_sql_header=true) }}\n\n {% else %} {# dynamic #}\n\n {% set predicate -%}\n {{ partition_by.render(alias='DBT_INTERNAL_DEST') }} in unnest(dbt_partitions_for_replacement)\n {%- endset %}\n\n {%- set source_sql -%}\n (\n select * from {{ tmp_relation }}\n )\n {%- endset -%}\n\n -- generated script to merge partitions into {{ target_relation }}\n declare dbt_partitions_for_replacement array<{{ partition_by.data_type }}>;\n\n {# have we already created the temp table to check for schema changes? #}\n {% if not tmp_relation_exists %}\n {{ declare_dbt_max_partition(this, partition_by, sql) }}\n \n -- 1. create a temp table\n {{ create_table_as(True, tmp_relation, sql) }}\n {% else %}\n -- 1. temp table already exists, we used it to check for schema changes\n {% endif %}\n\n -- 2. define partitions to update\n set (dbt_partitions_for_replacement) = (\n select as struct\n array_agg(distinct {{ partition_by.render() }})\n from {{ tmp_relation }}\n );\n\n {#\n TODO: include_sql_header is a hack; consider a better approach that includes\n the sql_header at the materialization-level instead\n #}\n -- 3. run the merge statement\n {{ get_insert_overwrite_merge_sql(target_relation, source_sql, dest_columns, [predicate], include_sql_header=false) }};\n\n -- 4. clean up the temp table\n drop table if exists {{ tmp_relation }}\n\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_insert_overwrite_merge_sql", "macro.dbt_bigquery.declare_dbt_max_partition", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.610614}, "macro.dbt_bigquery.bq_generate_incremental_build_sql": {"unique_id": "macro.dbt_bigquery.bq_generate_incremental_build_sql", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "name": "bq_generate_incremental_build_sql", "macro_sql": "{% macro bq_generate_incremental_build_sql(\n strategy, tmp_relation, target_relation, sql, unique_key, partition_by, partitions, dest_columns, tmp_relation_exists\n) %}\n {#-- if partitioned, use BQ scripting to get the range of partition values to be updated --#}\n {% if strategy == 'insert_overwrite' %}\n\n {% set missing_partition_msg -%}\n The 'insert_overwrite' strategy requires the `partition_by` config.\n {%- endset %}\n {% if partition_by is none %}\n {% do exceptions.raise_compiler_error(missing_partition_msg) %}\n {% endif %}\n\n {% set build_sql = bq_insert_overwrite(\n tmp_relation, target_relation, sql, unique_key, partition_by, partitions, dest_columns, on_schema_change\n ) %}\n\n {% else %} {# strategy == 'merge' #}\n {%- set source_sql -%}\n {%- if tmp_relation_exists -%}\n (\n select * from {{ tmp_relation }}\n )\n {%- else -%} {#-- wrap sql in parens to make it a subquery --#}\n (\n {{sql}}\n )\n {%- endif -%}\n {%- endset -%}\n\n {% set build_sql = get_merge_sql(target_relation, source_sql, unique_key, dest_columns) %}\n\n {% endif %}\n\n {{ return(build_sql) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bq_insert_overwrite", "macro.dbt.get_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6128929}, "macro.dbt_bigquery.materialization_incremental_bigquery": {"unique_id": "macro.dbt_bigquery.materialization_incremental_bigquery", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "name": "materialization_incremental_bigquery", "macro_sql": "{% materialization incremental, adapter='bigquery' -%}\n\n {%- set unique_key = config.get('unique_key') -%}\n {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n {%- set target_relation = this %}\n {%- set existing_relation = load_relation(this) %}\n {%- set tmp_relation = make_temp_relation(this) %}\n\n {#-- Validate early so we don't run SQL if the strategy is invalid --#}\n {% set strategy = dbt_bigquery_validate_get_incremental_strategy(config) -%}\n\n {%- set raw_partition_by = config.get('partition_by', none) -%}\n {%- set partition_by = adapter.parse_partition_by(raw_partition_by) -%}\n {%- set partitions = config.get('partitions', none) -%}\n {%- set cluster_by = config.get('cluster_by', none) -%}\n\n {% set on_schema_change = incremental_validate_on_schema_change(config.get('on_schema_change'), default='ignore') %}\n\n {{ run_hooks(pre_hooks) }}\n\n {% if existing_relation is none %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n \n {% elif existing_relation.is_view %}\n {#-- There's no way to atomically replace a view with a table on BQ --#}\n {{ adapter.drop_relation(existing_relation) }}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n \n {% elif full_refresh_mode %}\n {#-- If the partition/cluster config has changed, then we must drop and recreate --#}\n {% if not adapter.is_replaceable(existing_relation, partition_by, cluster_by) %}\n {% do log(\"Hard refreshing \" ~ existing_relation ~ \" because it is not replaceable\") %}\n {{ adapter.drop_relation(existing_relation) }}\n {% endif %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n \n {% else %}\n {% set tmp_relation_exists = false %}\n {% if on_schema_change != 'ignore' %} {# Check first, since otherwise we may not build a temp table #}\n {% do run_query(\n declare_dbt_max_partition(this, partition_by, sql) + create_table_as(True, tmp_relation, sql)\n ) %}\n {% set tmp_relation_exists = true %}\n {#-- Process schema changes. Returns dict of changes if successful. Use source columns for upserting/merging --#}\n {% set dest_columns = process_schema_changes(on_schema_change, tmp_relation, existing_relation) %}\n {% endif %}\n {% if not dest_columns %}\n {% set dest_columns = adapter.get_columns_in_relation(existing_relation) %}\n {% endif %}\n {% set build_sql = bq_generate_incremental_build_sql(\n strategy, tmp_relation, target_relation, sql, unique_key, partition_by, partitions, dest_columns, tmp_relation_exists\n ) %}\n\n {% endif %}\n\n {%- call statement('main') -%}\n {{ build_sql }}\n {% endcall %}\n\n {{ run_hooks(post_hooks) }}\n\n {% set target_relation = this.incorporate(type='table') %}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.load_relation", "macro.dbt.make_temp_relation", "macro.dbt_bigquery.dbt_bigquery_validate_get_incremental_strategy", "macro.dbt.incremental_validate_on_schema_change", "macro.dbt.run_hooks", "macro.dbt.create_table_as", "macro.dbt.run_query", "macro.dbt_bigquery.declare_dbt_max_partition", "macro.dbt.process_schema_changes", "macro.dbt_bigquery.bq_generate_incremental_build_sql", "macro.dbt.statement", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.619224}, "macro.dbt_bigquery.bigquery__snapshot_hash_arguments": {"unique_id": "macro.dbt_bigquery.bigquery__snapshot_hash_arguments", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/snapshot.sql", "original_file_path": "macros/materializations/snapshot.sql", "name": "bigquery__snapshot_hash_arguments", "macro_sql": "{% macro bigquery__snapshot_hash_arguments(args) -%}\n to_hex(md5(concat({%- for arg in args -%}\n coalesce(cast({{ arg }} as string), ''){% if not loop.last %}, '|',{% endif -%}\n {%- endfor -%}\n )))\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.620119}, "macro.dbt_bigquery.bigquery__create_columns": {"unique_id": "macro.dbt_bigquery.bigquery__create_columns", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/snapshot.sql", "original_file_path": "macros/materializations/snapshot.sql", "name": "bigquery__create_columns", "macro_sql": "{% macro bigquery__create_columns(relation, columns) %}\n {{ adapter.alter_table_add_columns(relation, columns) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6204631}, "macro.dbt_bigquery.bigquery__post_snapshot": {"unique_id": "macro.dbt_bigquery.bigquery__post_snapshot", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/snapshot.sql", "original_file_path": "macros/materializations/snapshot.sql", "name": "bigquery__post_snapshot", "macro_sql": "{% macro bigquery__post_snapshot(staging_relation) %}\n -- Clean up the snapshot temp table\n {% do drop_relation(staging_relation) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.drop_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.620758}, "macro.dbt.run_hooks": {"unique_id": "macro.dbt.run_hooks", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "run_hooks", "macro_sql": "{% macro run_hooks(hooks, inside_transaction=True) %}\n {% for hook in hooks | selectattr('transaction', 'equalto', inside_transaction) %}\n {% if not inside_transaction and loop.first %}\n {% call statement(auto_begin=inside_transaction) %}\n commit;\n {% endcall %}\n {% endif %}\n {% set rendered = render(hook.get('sql')) | trim %}\n {% if (rendered | length) > 0 %}\n {% call statement(auto_begin=inside_transaction) %}\n {{ rendered }}\n {% endcall %}\n {% endif %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.623059}, "macro.dbt.make_hook_config": {"unique_id": "macro.dbt.make_hook_config", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "make_hook_config", "macro_sql": "{% macro make_hook_config(sql, inside_transaction) %}\n {{ tojson({\"sql\": sql, \"transaction\": inside_transaction}) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6234891}, "macro.dbt.before_begin": {"unique_id": "macro.dbt.before_begin", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "before_begin", "macro_sql": "{% macro before_begin(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.623808}, "macro.dbt.in_transaction": {"unique_id": "macro.dbt.in_transaction", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "in_transaction", "macro_sql": "{% macro in_transaction(sql) %}\n {{ make_hook_config(sql, inside_transaction=True) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.62433}, "macro.dbt.after_commit": {"unique_id": "macro.dbt.after_commit", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "after_commit", "macro_sql": "{% macro after_commit(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.624646}, "macro.dbt.set_sql_header": {"unique_id": "macro.dbt.set_sql_header", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "name": "set_sql_header", "macro_sql": "{% macro set_sql_header(config) -%}\n {{ config.set('sql_header', caller()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.625519}, "macro.dbt.should_full_refresh": {"unique_id": "macro.dbt.should_full_refresh", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "name": "should_full_refresh", "macro_sql": "{% macro should_full_refresh() %}\n {% set config_full_refresh = config.get('full_refresh') %}\n {% if config_full_refresh is none %}\n {% set config_full_refresh = flags.FULL_REFRESH %}\n {% endif %}\n {% do return(config_full_refresh) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6262531}, "macro.dbt.should_store_failures": {"unique_id": "macro.dbt.should_store_failures", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "name": "should_store_failures", "macro_sql": "{% macro should_store_failures() %}\n {% set config_store_failures = config.get('store_failures') %}\n {% if config_store_failures is none %}\n {% set config_store_failures = flags.STORE_FAILURES %}\n {% endif %}\n {% do return(config_store_failures) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6269178}, "macro.dbt.snapshot_merge_sql": {"unique_id": "macro.dbt.snapshot_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshots/snapshot_merge.sql", "name": "snapshot_merge_sql", "macro_sql": "{% macro snapshot_merge_sql(target, source, insert_cols) -%}\n {{ adapter.dispatch('snapshot_merge_sql', 'dbt')(target, source, insert_cols) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__snapshot_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.627841}, "macro.dbt.default__snapshot_merge_sql": {"unique_id": "macro.dbt.default__snapshot_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshots/snapshot_merge.sql", "name": "default__snapshot_merge_sql", "macro_sql": "{% macro default__snapshot_merge_sql(target, source, insert_cols) -%}\n {%- set insert_cols_csv = insert_cols | join(', ') -%}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on DBT_INTERNAL_SOURCE.dbt_scd_id = DBT_INTERNAL_DEST.dbt_scd_id\n\n when matched\n and DBT_INTERNAL_DEST.dbt_valid_to is null\n and DBT_INTERNAL_SOURCE.dbt_change_type in ('update', 'delete')\n then update\n set dbt_valid_to = DBT_INTERNAL_SOURCE.dbt_valid_to\n\n when not matched\n and DBT_INTERNAL_SOURCE.dbt_change_type = 'insert'\n then insert ({{ insert_cols_csv }})\n values ({{ insert_cols_csv }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6284218}, "macro.dbt.strategy_dispatch": {"unique_id": "macro.dbt.strategy_dispatch", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "strategy_dispatch", "macro_sql": "{% macro strategy_dispatch(name) -%}\n{% set original_name = name %}\n {% if '.' in name %}\n {% set package_name, name = name.split(\".\", 1) %}\n {% else %}\n {% set package_name = none %}\n {% endif %}\n\n {% if package_name is none %}\n {% set package_context = context %}\n {% elif package_name in context %}\n {% set package_context = context[package_name] %}\n {% else %}\n {% set error_msg %}\n Could not find package '{{package_name}}', called with '{{original_name}}'\n {% endset %}\n {{ exceptions.raise_compiler_error(error_msg | trim) }}\n {% endif %}\n\n {%- set search_name = 'snapshot_' ~ name ~ '_strategy' -%}\n\n {% if search_name not in package_context %}\n {% set error_msg %}\n The specified strategy macro '{{name}}' was not found in package '{{ package_name }}'\n {% endset %}\n {{ exceptions.raise_compiler_error(error_msg | trim) }}\n {% endif %}\n {{ return(package_context[search_name]) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.634329}, "macro.dbt.snapshot_hash_arguments": {"unique_id": "macro.dbt.snapshot_hash_arguments", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_hash_arguments", "macro_sql": "{% macro snapshot_hash_arguments(args) -%}\n {{ adapter.dispatch('snapshot_hash_arguments', 'dbt')(args) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.634702}, "macro.dbt.default__snapshot_hash_arguments": {"unique_id": "macro.dbt.default__snapshot_hash_arguments", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "default__snapshot_hash_arguments", "macro_sql": "{% macro default__snapshot_hash_arguments(args) -%}\n md5({%- for arg in args -%}\n coalesce(cast({{ arg }} as varchar ), '')\n {% if not loop.last %} || '|' || {% endif %}\n {%- endfor -%})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.635193}, "macro.dbt.snapshot_get_time": {"unique_id": "macro.dbt.snapshot_get_time", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_get_time", "macro_sql": "{% macro snapshot_get_time() -%}\n {{ adapter.dispatch('snapshot_get_time', 'dbt')() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.635556}, "macro.dbt.default__snapshot_get_time": {"unique_id": "macro.dbt.default__snapshot_get_time", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "default__snapshot_get_time", "macro_sql": "{% macro default__snapshot_get_time() -%}\n {{ current_timestamp() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.635833}, "macro.dbt.snapshot_timestamp_strategy": {"unique_id": "macro.dbt.snapshot_timestamp_strategy", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_timestamp_strategy", "macro_sql": "{% macro snapshot_timestamp_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n {% set primary_key = config['unique_key'] %}\n {% set updated_at = config['updated_at'] %}\n {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n\n {#/*\n The snapshot relation might not have an {{ updated_at }} value if the\n snapshot strategy is changed from `check` to `timestamp`. We\n should use a dbt-created column for the comparison in the snapshot\n table instead of assuming that the user-supplied {{ updated_at }}\n will be present in the historical data.\n\n See https://github.com/dbt-labs/dbt-core/issues/2350\n */ #}\n {% set row_changed_expr -%}\n ({{ snapshotted_rel }}.dbt_valid_from < {{ current_rel }}.{{ updated_at }})\n {%- endset %}\n\n {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n {% do return({\n \"unique_key\": primary_key,\n \"updated_at\": updated_at,\n \"row_changed\": row_changed_expr,\n \"scd_id\": scd_id_expr,\n \"invalidate_hard_deletes\": invalidate_hard_deletes\n }) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.637905}, "macro.dbt.snapshot_string_as_time": {"unique_id": "macro.dbt.snapshot_string_as_time", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_string_as_time", "macro_sql": "{% macro snapshot_string_as_time(timestamp) -%}\n {{ adapter.dispatch('snapshot_string_as_time', 'dbt')(timestamp) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__snapshot_string_as_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6383722}, "macro.dbt.default__snapshot_string_as_time": {"unique_id": "macro.dbt.default__snapshot_string_as_time", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "default__snapshot_string_as_time", "macro_sql": "{% macro default__snapshot_string_as_time(timestamp) %}\n {% do exceptions.raise_not_implemented(\n 'snapshot_string_as_time macro not implemented for adapter '+adapter.type()\n ) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.638856}, "macro.dbt.snapshot_check_all_get_existing_columns": {"unique_id": "macro.dbt.snapshot_check_all_get_existing_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_check_all_get_existing_columns", "macro_sql": "{% macro snapshot_check_all_get_existing_columns(node, target_exists) -%}\n {%- set query_columns = get_columns_in_query(node['compiled_sql']) -%}\n {%- if not target_exists -%}\n {# no table yet -> return whatever the query does #}\n {{ return([false, query_columns]) }}\n {%- endif -%}\n {# handle any schema changes #}\n {%- set target_table = node.get('alias', node.get('name')) -%}\n {%- set target_relation = adapter.get_relation(database=node.database, schema=node.schema, identifier=target_table) -%}\n {%- set existing_cols = get_columns_in_query('select * from ' ~ target_relation) -%}\n {%- set ns = namespace() -%} {# handle for-loop scoping with a namespace #}\n {%- set ns.column_added = false -%}\n\n {%- set intersection = [] -%}\n {%- for col in query_columns -%}\n {%- if col in existing_cols -%}\n {%- do intersection.append(col) -%}\n {%- else -%}\n {% set ns.column_added = true %}\n {%- endif -%}\n {%- endfor -%}\n {{ return([ns.column_added, intersection]) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.64127}, "macro.dbt.snapshot_check_strategy": {"unique_id": "macro.dbt.snapshot_check_strategy", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_check_strategy", "macro_sql": "{% macro snapshot_check_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n {% set check_cols_config = config['check_cols'] %}\n {% set primary_key = config['unique_key'] %}\n {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n \n {% set select_current_time -%}\n select {{ snapshot_get_time() }} as snapshot_start\n {%- endset %}\n\n {#-- don't access the column by name, to avoid dealing with casing issues on snowflake #}\n {%- set now = run_query(select_current_time)[0][0] -%}\n {% if now is none or now is undefined -%}\n {%- do exceptions.raise_compiler_error('Could not get a snapshot start time from the database') -%}\n {%- endif %}\n {% set updated_at = config.get('updated_at', snapshot_string_as_time(now)) %}\n\n {% set column_added = false %}\n\n {% if check_cols_config == 'all' %}\n {% set column_added, check_cols = snapshot_check_all_get_existing_columns(node, target_exists) %}\n {% elif check_cols_config is iterable and (check_cols_config | length) > 0 %}\n {% set check_cols = check_cols_config %}\n {% else %}\n {% do exceptions.raise_compiler_error(\"Invalid value for 'check_cols': \" ~ check_cols_config) %}\n {% endif %}\n\n {%- set row_changed_expr -%}\n (\n {%- if column_added -%}\n TRUE\n {%- else -%}\n {%- for col in check_cols -%}\n {{ snapshotted_rel }}.{{ col }} != {{ current_rel }}.{{ col }}\n or\n (\n (({{ snapshotted_rel }}.{{ col }} is null) and not ({{ current_rel }}.{{ col }} is null))\n or\n ((not {{ snapshotted_rel }}.{{ col }} is null) and ({{ current_rel }}.{{ col }} is null))\n )\n {%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n {%- endif -%}\n )\n {%- endset %}\n\n {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n {% do return({\n \"unique_key\": primary_key,\n \"updated_at\": updated_at,\n \"row_changed\": row_changed_expr,\n \"scd_id\": scd_id_expr,\n \"invalidate_hard_deletes\": invalidate_hard_deletes\n }) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.snapshot_get_time", "macro.dbt.run_query", "macro.dbt.snapshot_string_as_time", "macro.dbt.snapshot_check_all_get_existing_columns", "macro.dbt.snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6458821}, "macro.dbt.create_columns": {"unique_id": "macro.dbt.create_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "create_columns", "macro_sql": "{% macro create_columns(relation, columns) %}\n {{ adapter.dispatch('create_columns', 'dbt')(relation, columns) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_columns"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.650947}, "macro.dbt.default__create_columns": {"unique_id": "macro.dbt.default__create_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "default__create_columns", "macro_sql": "{% macro default__create_columns(relation, columns) %}\n {% for column in columns %}\n {% call statement() %}\n alter table {{ relation }} add column \"{{ column.name }}\" {{ column.data_type }};\n {% endcall %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.651618}, "macro.dbt.post_snapshot": {"unique_id": "macro.dbt.post_snapshot", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "post_snapshot", "macro_sql": "{% macro post_snapshot(staging_relation) %}\n {{ adapter.dispatch('post_snapshot', 'dbt')(staging_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.652004}, "macro.dbt.default__post_snapshot": {"unique_id": "macro.dbt.default__post_snapshot", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "default__post_snapshot", "macro_sql": "{% macro default__post_snapshot(staging_relation) %}\n {# no-op #}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6522188}, "macro.dbt.snapshot_staging_table": {"unique_id": "macro.dbt.snapshot_staging_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "snapshot_staging_table", "macro_sql": "{% macro snapshot_staging_table(strategy, source_sql, target_relation) -%}\n {{ adapter.dispatch('snapshot_staging_table', 'dbt')(strategy, source_sql, target_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__snapshot_staging_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.652673}, "macro.dbt.default__snapshot_staging_table": {"unique_id": "macro.dbt.default__snapshot_staging_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "default__snapshot_staging_table", "macro_sql": "{% macro default__snapshot_staging_table(strategy, source_sql, target_relation) -%}\n\n with snapshot_query as (\n\n {{ source_sql }}\n\n ),\n\n snapshotted_data as (\n\n select *,\n {{ strategy.unique_key }} as dbt_unique_key\n\n from {{ target_relation }}\n where dbt_valid_to is null\n\n ),\n\n insertions_source_data as (\n\n select\n *,\n {{ strategy.unique_key }} as dbt_unique_key,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to,\n {{ strategy.scd_id }} as dbt_scd_id\n\n from snapshot_query\n ),\n\n updates_source_data as (\n\n select\n *,\n {{ strategy.unique_key }} as dbt_unique_key,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n {{ strategy.updated_at }} as dbt_valid_to\n\n from snapshot_query\n ),\n\n {%- if strategy.invalidate_hard_deletes %}\n\n deletes_source_data as (\n\n select \n *,\n {{ strategy.unique_key }} as dbt_unique_key\n from snapshot_query\n ),\n {% endif %}\n\n insertions as (\n\n select\n 'insert' as dbt_change_type,\n source_data.*\n\n from insertions_source_data as source_data\n left outer join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where snapshotted_data.dbt_unique_key is null\n or (\n snapshotted_data.dbt_unique_key is not null\n and (\n {{ strategy.row_changed }}\n )\n )\n\n ),\n\n updates as (\n\n select\n 'update' as dbt_change_type,\n source_data.*,\n snapshotted_data.dbt_scd_id\n\n from updates_source_data as source_data\n join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where (\n {{ strategy.row_changed }}\n )\n )\n\n {%- if strategy.invalidate_hard_deletes -%}\n ,\n\n deletes as (\n \n select\n 'delete' as dbt_change_type,\n source_data.*,\n {{ snapshot_get_time() }} as dbt_valid_from,\n {{ snapshot_get_time() }} as dbt_updated_at,\n {{ snapshot_get_time() }} as dbt_valid_to,\n snapshotted_data.dbt_scd_id\n \n from snapshotted_data\n left join deletes_source_data as source_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where source_data.dbt_unique_key is null\n )\n {%- endif %}\n\n select * from insertions\n union all\n select * from updates\n {%- if strategy.invalidate_hard_deletes %}\n union all\n select * from deletes\n {%- endif %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.654573}, "macro.dbt.build_snapshot_table": {"unique_id": "macro.dbt.build_snapshot_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "build_snapshot_table", "macro_sql": "{% macro build_snapshot_table(strategy, sql) -%}\n {{ adapter.dispatch('build_snapshot_table', 'dbt')(strategy, sql) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__build_snapshot_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.654986}, "macro.dbt.default__build_snapshot_table": {"unique_id": "macro.dbt.default__build_snapshot_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "default__build_snapshot_table", "macro_sql": "{% macro default__build_snapshot_table(strategy, sql) %}\n\n select *,\n {{ strategy.scd_id }} as dbt_scd_id,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to\n from (\n {{ sql }}\n ) sbq\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6555688}, "macro.dbt.build_snapshot_staging_table": {"unique_id": "macro.dbt.build_snapshot_staging_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "build_snapshot_staging_table", "macro_sql": "{% macro build_snapshot_staging_table(strategy, sql, target_relation) %}\n {% set tmp_relation = make_temp_relation(target_relation) %}\n\n {% set select = snapshot_staging_table(strategy, sql, target_relation) %}\n\n {% call statement('build_snapshot_staging_relation') %}\n {{ create_table_as(True, tmp_relation, select) }}\n {% endcall %}\n\n {% do return(tmp_relation) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_temp_relation", "macro.dbt.snapshot_staging_table", "macro.dbt.statement", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6565309}, "macro.dbt.materialization_snapshot_default": {"unique_id": "macro.dbt.materialization_snapshot_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/snapshot.sql", "original_file_path": "macros/materializations/snapshots/snapshot.sql", "name": "materialization_snapshot_default", "macro_sql": "{% materialization snapshot, default %}\n {%- set config = model['config'] -%}\n\n {%- set target_table = model.get('alias', model.get('name')) -%}\n\n {%- set strategy_name = config.get('strategy') -%}\n {%- set unique_key = config.get('unique_key') %}\n\n {% if not adapter.check_schema_exists(model.database, model.schema) %}\n {% do create_schema(model.database, model.schema) %}\n {% endif %}\n\n {% set target_relation_exists, target_relation = get_or_create_relation(\n database=model.database,\n schema=model.schema,\n identifier=target_table,\n type='table') -%}\n\n {%- if not target_relation.is_table -%}\n {% do exceptions.relation_wrong_type(target_relation, 'table') %}\n {%- endif -%}\n\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set strategy_macro = strategy_dispatch(strategy_name) %}\n {% set strategy = strategy_macro(model, \"snapshotted_data\", \"source_data\", config, target_relation_exists) %}\n\n {% if not target_relation_exists %}\n\n {% set build_sql = build_snapshot_table(strategy, model['compiled_sql']) %}\n {% set final_sql = create_table_as(False, target_relation, build_sql) %}\n\n {% else %}\n\n {{ adapter.valid_snapshot_target(target_relation) }}\n\n {% set staging_table = build_snapshot_staging_table(strategy, sql, target_relation) %}\n\n -- this may no-op if the database does not require column expansion\n {% do adapter.expand_target_column_types(from_relation=staging_table,\n to_relation=target_relation) %}\n\n {% set missing_columns = adapter.get_missing_columns(staging_table, target_relation)\n | rejectattr('name', 'equalto', 'dbt_change_type')\n | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n | rejectattr('name', 'equalto', 'dbt_unique_key')\n | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n | list %}\n\n {% do create_columns(target_relation, missing_columns) %}\n\n {% set source_columns = adapter.get_columns_in_relation(staging_table)\n | rejectattr('name', 'equalto', 'dbt_change_type')\n | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n | rejectattr('name', 'equalto', 'dbt_unique_key')\n | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n | list %}\n\n {% set quoted_source_columns = [] %}\n {% for column in source_columns %}\n {% do quoted_source_columns.append(adapter.quote(column.name)) %}\n {% endfor %}\n\n {% set final_sql = snapshot_merge_sql(\n target = target_relation,\n source = staging_table,\n insert_cols = quoted_source_columns\n )\n %}\n\n {% endif %}\n\n {% call statement('main') %}\n {{ final_sql }}\n {% endcall %}\n\n {% do persist_docs(target_relation, model) %}\n\n {% if not target_relation_exists %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {% if staging_table is defined %}\n {% do post_snapshot(staging_table) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_schema", "macro.dbt.get_or_create_relation", "macro.dbt.run_hooks", "macro.dbt.strategy_dispatch", "macro.dbt.build_snapshot_table", "macro.dbt.create_table_as", "macro.dbt.build_snapshot_staging_table", "macro.dbt.create_columns", "macro.dbt.snapshot_merge_sql", "macro.dbt.statement", "macro.dbt.persist_docs", "macro.dbt.create_indexes", "macro.dbt.post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.668413}, "macro.dbt.materialization_test_default": {"unique_id": "macro.dbt.materialization_test_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/test.sql", "original_file_path": "macros/materializations/tests/test.sql", "name": "materialization_test_default", "macro_sql": "{%- materialization test, default -%}\n\n {% set relations = [] %}\n\n {% if should_store_failures() %}\n\n {% set identifier = model['alias'] %}\n {% set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n {% set target_relation = api.Relation.create(\n identifier=identifier, schema=schema, database=database, type='table') -%} %}\n \n {% if old_relation %}\n {% do adapter.drop_relation(old_relation) %}\n {% endif %}\n \n {% call statement(auto_begin=True) %}\n {{ create_table_as(False, target_relation, sql) }}\n {% endcall %}\n \n {% do relations.append(target_relation) %}\n \n {% set main_sql %}\n select *\n from {{ target_relation }}\n {% endset %}\n \n {{ adapter.commit() }}\n \n {% else %}\n\n {% set main_sql = sql %}\n \n {% endif %}\n\n {% set limit = config.get('limit') %}\n {% set fail_calc = config.get('fail_calc') %}\n {% set warn_if = config.get('warn_if') %}\n {% set error_if = config.get('error_if') %}\n\n {% call statement('main', fetch_result=True) -%}\n\n {{ get_test_sql(main_sql, fail_calc, warn_if, error_if, limit)}}\n\n {%- endcall %}\n \n {{ return({'relations': relations}) }}\n\n{%- endmaterialization -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.should_store_failures", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt.get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6734989}, "macro.dbt.get_test_sql": {"unique_id": "macro.dbt.get_test_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/helpers.sql", "original_file_path": "macros/materializations/tests/helpers.sql", "name": "get_test_sql", "macro_sql": "{% macro get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n {{ adapter.dispatch('get_test_sql', 'dbt')(main_sql, fail_calc, warn_if, error_if, limit) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6745942}, "macro.dbt.default__get_test_sql": {"unique_id": "macro.dbt.default__get_test_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/helpers.sql", "original_file_path": "macros/materializations/tests/helpers.sql", "name": "default__get_test_sql", "macro_sql": "{% macro default__get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n select\n {{ fail_calc }} as failures,\n {{ fail_calc }} {{ warn_if }} as should_warn,\n {{ fail_calc }} {{ error_if }} as should_error\n from (\n {{ main_sql }}\n {{ \"limit \" ~ limit if limit != none }}\n ) dbt_internal_test\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.675461}, "macro.dbt.get_where_subquery": {"unique_id": "macro.dbt.get_where_subquery", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/where_subquery.sql", "original_file_path": "macros/materializations/tests/where_subquery.sql", "name": "get_where_subquery", "macro_sql": "{% macro get_where_subquery(relation) -%}\n {% do return(adapter.dispatch('get_where_subquery', 'dbt')(relation)) %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_where_subquery"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.676608}, "macro.dbt.default__get_where_subquery": {"unique_id": "macro.dbt.default__get_where_subquery", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/where_subquery.sql", "original_file_path": "macros/materializations/tests/where_subquery.sql", "name": "default__get_where_subquery", "macro_sql": "{% macro default__get_where_subquery(relation) -%}\n {% set where = config.get('where', '') %}\n {% if where %}\n {%- set filtered -%}\n (select * from {{ relation }} where {{ where }}) dbt_subquery\n {%- endset -%}\n {% do return(filtered) %}\n {%- else -%}\n {% do return(relation) %}\n {%- endif -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6774778}, "macro.dbt.get_quoted_csv": {"unique_id": "macro.dbt.get_quoted_csv", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "name": "get_quoted_csv", "macro_sql": "{% macro get_quoted_csv(column_names) %}\n \n {% set quoted = [] %}\n {% for col in column_names -%}\n {%- do quoted.append(adapter.quote(col)) -%}\n {%- endfor %}\n\n {%- set dest_cols_csv = quoted | join(', ') -%}\n {{ return(dest_cols_csv) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.679115}, "macro.dbt.diff_columns": {"unique_id": "macro.dbt.diff_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "name": "diff_columns", "macro_sql": "{% macro diff_columns(source_columns, target_columns) %}\n\n {% set result = [] %}\n {% set source_names = source_columns | map(attribute = 'column') | list %}\n {% set target_names = target_columns | map(attribute = 'column') | list %}\n \n {# --check whether the name attribute exists in the target - this does not perform a data type check #}\n {% for sc in source_columns %}\n {% if sc.name not in target_names %}\n {{ result.append(sc) }}\n {% endif %}\n {% endfor %}\n \n {{ return(result) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.68033}, "macro.dbt.diff_column_data_types": {"unique_id": "macro.dbt.diff_column_data_types", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "name": "diff_column_data_types", "macro_sql": "{% macro diff_column_data_types(source_columns, target_columns) %}\n \n {% set result = [] %}\n {% for sc in source_columns %}\n {% set tc = target_columns | selectattr(\"name\", \"equalto\", sc.name) | list | first %}\n {% if tc %}\n {% if sc.data_type != tc.data_type %}\n {{ result.append( { 'column_name': tc.name, 'new_type': sc.data_type } ) }} \n {% endif %}\n {% endif %}\n {% endfor %}\n\n {{ return(result) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.681699}, "macro.dbt.get_merge_sql": {"unique_id": "macro.dbt.get_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "get_merge_sql", "macro_sql": "{% macro get_merge_sql(target, source, unique_key, dest_columns, predicates=none) -%}\n {{ adapter.dispatch('get_merge_sql', 'dbt')(target, source, unique_key, dest_columns, predicates) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.686409}, "macro.dbt.default__get_merge_sql": {"unique_id": "macro.dbt.default__get_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "default__get_merge_sql", "macro_sql": "{% macro default__get_merge_sql(target, source, unique_key, dest_columns, predicates) -%}\n {%- set predicates = [] if predicates is none else [] + predicates -%}\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n {%- set update_columns = config.get('merge_update_columns', default = dest_columns | map(attribute=\"quoted\") | list) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {% if unique_key %}\n {% set unique_key_match %}\n DBT_INTERNAL_SOURCE.{{ unique_key }} = DBT_INTERNAL_DEST.{{ unique_key }}\n {% endset %}\n {% do predicates.append(unique_key_match) %}\n {% else %}\n {% do predicates.append('FALSE') %}\n {% endif %}\n\n {{ sql_header if sql_header is not none }}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on {{ predicates | join(' and ') }}\n\n {% if unique_key %}\n when matched then update set\n {% for column_name in update_columns -%}\n {{ column_name }} = DBT_INTERNAL_SOURCE.{{ column_name }}\n {%- if not loop.last %}, {%- endif %}\n {%- endfor %}\n {% endif %}\n\n when not matched then insert\n ({{ dest_cols_csv }})\n values\n ({{ dest_cols_csv }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.689673}, "macro.dbt.get_delete_insert_merge_sql": {"unique_id": "macro.dbt.get_delete_insert_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "get_delete_insert_merge_sql", "macro_sql": "{% macro get_delete_insert_merge_sql(target, source, unique_key, dest_columns) -%}\n {{ adapter.dispatch('get_delete_insert_merge_sql', 'dbt')(target, source, unique_key, dest_columns) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_delete_insert_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6902}, "macro.dbt.default__get_delete_insert_merge_sql": {"unique_id": "macro.dbt.default__get_delete_insert_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "default__get_delete_insert_merge_sql", "macro_sql": "{% macro default__get_delete_insert_merge_sql(target, source, unique_key, dest_columns) -%}\n\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n {% if unique_key is not none %}\n delete from {{ target }}\n where ({{ unique_key }}) in (\n select ({{ unique_key }})\n from {{ source }}\n );\n {% endif %}\n\n insert into {{ target }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ source }}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6914}, "macro.dbt.get_insert_overwrite_merge_sql": {"unique_id": "macro.dbt.get_insert_overwrite_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "get_insert_overwrite_merge_sql", "macro_sql": "{% macro get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header=false) -%}\n {{ adapter.dispatch('get_insert_overwrite_merge_sql', 'dbt')(target, source, dest_columns, predicates, include_sql_header) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_insert_overwrite_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.692064}, "macro.dbt.default__get_insert_overwrite_merge_sql": {"unique_id": "macro.dbt.default__get_insert_overwrite_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "default__get_insert_overwrite_merge_sql", "macro_sql": "{% macro default__get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header) -%}\n {%- set predicates = [] if predicates is none else [] + predicates -%}\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none and include_sql_header }}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on FALSE\n\n when not matched by source\n {% if predicates %} and {{ predicates | join(' and ') }} {% endif %}\n then delete\n\n when not matched then insert\n ({{ dest_cols_csv }})\n values\n ({{ dest_cols_csv }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.693449}, "macro.dbt.is_incremental": {"unique_id": "macro.dbt.is_incremental", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/is_incremental.sql", "original_file_path": "macros/materializations/models/incremental/is_incremental.sql", "name": "is_incremental", "macro_sql": "{% macro is_incremental() %}\n {#-- do not run introspective queries in parsing #}\n {% if not execute %}\n {{ return(False) }}\n {% else %}\n {% set relation = adapter.get_relation(this.database, this.schema, this.table) %}\n {{ return(relation is not none\n and relation.type == 'table'\n and model.config.materialized == 'incremental'\n and not should_full_refresh()) }}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.should_full_refresh"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.694926}, "macro.dbt.materialization_incremental_default": {"unique_id": "macro.dbt.materialization_incremental_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/incremental.sql", "original_file_path": "macros/materializations/models/incremental/incremental.sql", "name": "materialization_incremental_default", "macro_sql": "{% materialization incremental, default -%}\n\n {% set unique_key = config.get('unique_key') %}\n\n {% set target_relation = this.incorporate(type='table') %}\n {% set existing_relation = load_relation(this) %}\n {% set tmp_relation = make_temp_relation(target_relation) %}\n {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n {% set on_schema_change = incremental_validate_on_schema_change(config.get('on_schema_change'), default='ignore') %}\n\n {% set tmp_identifier = model['name'] + '__dbt_tmp' %}\n {% set backup_identifier = model['name'] + \"__dbt_backup\" %}\n\n -- the intermediate_ and backup_ relations should not already exist in the database; get_relation\n -- will return None in that case. Otherwise, we get a relation that we can drop\n -- later, before we try to use this name for the current operation. This has to happen before\n -- BEGIN, in a separate transaction\n {% set preexisting_intermediate_relation = adapter.get_relation(identifier=tmp_identifier, \n schema=schema,\n database=database) %} \n {% set preexisting_backup_relation = adapter.get_relation(identifier=backup_identifier,\n schema=schema,\n database=database) %}\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set to_drop = [] %}\n\n {# -- first check whether we want to full refresh for source view or config reasons #}\n {% set trigger_full_refresh = (full_refresh_mode or existing_relation.is_view) %}\n\n {% if existing_relation is none %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n{% elif trigger_full_refresh %}\n {#-- Make sure the backup doesn't exist so we don't encounter issues with the rename below #}\n {% set tmp_identifier = model['name'] + '__dbt_tmp' %}\n {% set backup_identifier = model['name'] + '__dbt_backup' %}\n {% set intermediate_relation = existing_relation.incorporate(path={\"identifier\": tmp_identifier}) %}\n {% set backup_relation = existing_relation.incorporate(path={\"identifier\": backup_identifier}) %}\n\n {% set build_sql = create_table_as(False, intermediate_relation, sql) %}\n {% set need_swap = true %}\n {% do to_drop.append(backup_relation) %}\n {% else %}\n {% do run_query(create_table_as(True, tmp_relation, sql)) %}\n {% do adapter.expand_target_column_types(\n from_relation=tmp_relation,\n to_relation=target_relation) %}\n {#-- Process schema changes. Returns dict of changes if successful. Use source columns for upserting/merging --#}\n {% set dest_columns = process_schema_changes(on_schema_change, tmp_relation, existing_relation) %}\n {% if not dest_columns %}\n {% set dest_columns = adapter.get_columns_in_relation(existing_relation) %}\n {% endif %}\n {% set build_sql = get_delete_insert_merge_sql(target_relation, tmp_relation, unique_key, dest_columns) %}\n \n {% endif %}\n\n {% call statement(\"main\") %}\n {{ build_sql }}\n {% endcall %}\n\n {% if need_swap %} \n {% do adapter.rename_relation(target_relation, backup_relation) %} \n {% do adapter.rename_relation(intermediate_relation, target_relation) %} \n {% endif %}\n\n {% do persist_docs(target_relation, model) %}\n\n {% if existing_relation is none or existing_relation.is_view or should_full_refresh() %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {% do adapter.commit() %}\n\n {% for rel in to_drop %}\n {% do adapter.drop_relation(rel) %}\n {% endfor %}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.load_relation", "macro.dbt.make_temp_relation", "macro.dbt.should_full_refresh", "macro.dbt.incremental_validate_on_schema_change", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.create_table_as", "macro.dbt.run_query", "macro.dbt.process_schema_changes", "macro.dbt.get_delete_insert_merge_sql", "macro.dbt.statement", "macro.dbt.persist_docs", "macro.dbt.create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.705695}, "macro.dbt.incremental_validate_on_schema_change": {"unique_id": "macro.dbt.incremental_validate_on_schema_change", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "name": "incremental_validate_on_schema_change", "macro_sql": "{% macro incremental_validate_on_schema_change(on_schema_change, default='ignore') %}\n \n {% if on_schema_change not in ['sync_all_columns', 'append_new_columns', 'fail', 'ignore'] %}\n \n {% set log_message = 'Invalid value for on_schema_change (%s) specified. Setting default value of %s.' % (on_schema_change, default) %}\n {% do log(log_message) %}\n \n {{ return(default) }}\n\n {% else %}\n\n {{ return(on_schema_change) }}\n \n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.714394}, "macro.dbt.check_for_schema_changes": {"unique_id": "macro.dbt.check_for_schema_changes", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "name": "check_for_schema_changes", "macro_sql": "{% macro check_for_schema_changes(source_relation, target_relation) %}\n \n {% set schema_changed = False %}\n \n {%- set source_columns = adapter.get_columns_in_relation(source_relation) -%}\n {%- set target_columns = adapter.get_columns_in_relation(target_relation) -%}\n {%- set source_not_in_target = diff_columns(source_columns, target_columns) -%}\n {%- set target_not_in_source = diff_columns(target_columns, source_columns) -%}\n\n {% set new_target_types = diff_column_data_types(source_columns, target_columns) %}\n\n {% if source_not_in_target != [] %}\n {% set schema_changed = True %}\n {% elif target_not_in_source != [] or new_target_types != [] %}\n {% set schema_changed = True %}\n {% elif new_target_types != [] %}\n {% set schema_changed = True %}\n {% endif %}\n \n {% set changes_dict = {\n 'schema_changed': schema_changed,\n 'source_not_in_target': source_not_in_target,\n 'target_not_in_source': target_not_in_source,\n 'source_columns': source_columns,\n 'target_columns': target_columns,\n 'new_target_types': new_target_types\n } %}\n\n {% set msg %}\n In {{ target_relation }}:\n Schema changed: {{ schema_changed }}\n Source columns not in target: {{ source_not_in_target }}\n Target columns not in source: {{ target_not_in_source }}\n New column types: {{ new_target_types }}\n {% endset %}\n \n {% do log(msg) %}\n\n {{ return(changes_dict) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.diff_columns", "macro.dbt.diff_column_data_types"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7172182}, "macro.dbt.sync_column_schemas": {"unique_id": "macro.dbt.sync_column_schemas", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "name": "sync_column_schemas", "macro_sql": "{% macro sync_column_schemas(on_schema_change, target_relation, schema_changes_dict) %}\n \n {%- set add_to_target_arr = schema_changes_dict['source_not_in_target'] -%}\n\n {%- if on_schema_change == 'append_new_columns'-%}\n {%- if add_to_target_arr | length > 0 -%}\n {%- do alter_relation_add_remove_columns(target_relation, add_to_target_arr, none) -%}\n {%- endif -%}\n \n {% elif on_schema_change == 'sync_all_columns' %}\n {%- set remove_from_target_arr = schema_changes_dict['target_not_in_source'] -%}\n {%- set new_target_types = schema_changes_dict['new_target_types'] -%}\n \n {% if add_to_target_arr | length > 0 or remove_from_target_arr | length > 0 %} \n {%- do alter_relation_add_remove_columns(target_relation, add_to_target_arr, remove_from_target_arr) -%}\n {% endif %}\n\n {% if new_target_types != [] %}\n {% for ntt in new_target_types %}\n {% set column_name = ntt['column_name'] %}\n {% set new_type = ntt['new_type'] %}\n {% do alter_column_type(target_relation, column_name, new_type) %}\n {% endfor %}\n {% endif %}\n \n {% endif %}\n\n {% set schema_change_message %}\n In {{ target_relation }}:\n Schema change approach: {{ on_schema_change }}\n Columns added: {{ add_to_target_arr }}\n Columns removed: {{ remove_from_target_arr }}\n Data types changed: {{ new_target_types }}\n {% endset %}\n \n {% do log(schema_change_message) %}\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.alter_relation_add_remove_columns", "macro.dbt.alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.720057}, "macro.dbt.process_schema_changes": {"unique_id": "macro.dbt.process_schema_changes", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "name": "process_schema_changes", "macro_sql": "{% macro process_schema_changes(on_schema_change, source_relation, target_relation) %}\n \n {% if on_schema_change == 'ignore' %}\n\n {{ return({}) }}\n\n {% else %}\n \n {% set schema_changes_dict = check_for_schema_changes(source_relation, target_relation) %}\n \n {% if schema_changes_dict['schema_changed'] %}\n \n {% if on_schema_change == 'fail' %}\n \n {% set fail_msg %}\n The source and target schemas on this incremental model are out of sync!\n They can be reconciled in several ways: \n - set the `on_schema_change` config to either append_new_columns or sync_all_columns, depending on your situation.\n - Re-run the incremental model with `full_refresh: True` to update the target schema.\n - update the schema manually and re-run the process.\n {% endset %}\n \n {% do exceptions.raise_compiler_error(fail_msg) %}\n \n {# -- unless we ignore, run the sync operation per the config #}\n {% else %}\n \n {% do sync_column_schemas(on_schema_change, target_relation, schema_changes_dict) %}\n \n {% endif %}\n \n {% endif %}\n\n {{ return(schema_changes_dict['source_columns']) }}\n \n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.check_for_schema_changes", "macro.dbt.sync_column_schemas"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.721715}, "macro.dbt.materialization_table_default": {"unique_id": "macro.dbt.materialization_table_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/table.sql", "original_file_path": "macros/materializations/models/table/table.sql", "name": "materialization_table_default", "macro_sql": "{% materialization table, default %}\n {%- set identifier = model['alias'] -%}\n {%- set tmp_identifier = model['name'] + '__dbt_tmp' -%}\n {%- set backup_identifier = model['name'] + '__dbt_backup' -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier,\n schema=schema,\n database=database,\n type='table') -%}\n {%- set intermediate_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema,\n database=database,\n type='table') -%}\n -- the intermediate_relation should not already exist in the database; get_relation\n -- will return None in that case. Otherwise, we get a relation that we can drop\n -- later, before we try to use this name for the current operation\n {%- set preexisting_intermediate_relation = adapter.get_relation(identifier=tmp_identifier, \n schema=schema,\n database=database) -%}\n /*\n See ../view/view.sql for more information about this relation.\n */\n {%- set backup_relation_type = 'table' if old_relation is none else old_relation.type -%}\n {%- set backup_relation = api.Relation.create(identifier=backup_identifier,\n schema=schema,\n database=database,\n type=backup_relation_type) -%}\n -- as above, the backup_relation should not already exist\n {%- set preexisting_backup_relation = adapter.get_relation(identifier=backup_identifier,\n schema=schema,\n database=database) -%}\n\n\n -- drop the temp relations if they exist already in the database\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% call statement('main') -%}\n {{ get_create_table_as_sql(False, intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n {% if old_relation is not none %}\n {{ adapter.rename_relation(old_relation, backup_relation) }}\n {% endif %}\n\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {% do create_indexes(target_relation) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {% do persist_docs(target_relation, model) %}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n -- finally, drop the existing/backup relation after the commit\n {{ drop_relation_if_exists(backup_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.get_create_table_as_sql", "macro.dbt.create_indexes", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.729088}, "macro.dbt.get_create_table_as_sql": {"unique_id": "macro.dbt.get_create_table_as_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.sql", "name": "get_create_table_as_sql", "macro_sql": "{% macro get_create_table_as_sql(temporary, relation, sql) -%}\n {{ adapter.dispatch('get_create_table_as_sql', 'dbt')(temporary, relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_create_table_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.730059}, "macro.dbt.default__get_create_table_as_sql": {"unique_id": "macro.dbt.default__get_create_table_as_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.sql", "name": "default__get_create_table_as_sql", "macro_sql": "{% macro default__get_create_table_as_sql(temporary, relation, sql) -%}\n {{ return(create_table_as(temporary, relation, sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7304902}, "macro.dbt.create_table_as": {"unique_id": "macro.dbt.create_table_as", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.sql", "name": "create_table_as", "macro_sql": "{% macro create_table_as(temporary, relation, sql) -%}\n {{ adapter.dispatch('create_table_as', 'dbt')(temporary, relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7309608}, "macro.dbt.default__create_table_as": {"unique_id": "macro.dbt.default__create_table_as", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.sql", "name": "default__create_table_as", "macro_sql": "{% macro default__create_table_as(temporary, relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n \n {{ sql_header if sql_header is not none }}\n \n create {% if temporary: -%}temporary{%- endif %} table\n {{ relation.include(database=(not temporary), schema=(not temporary)) }}\n as (\n {{ sql }}\n );\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.731889}, "macro.dbt.materialization_view_default": {"unique_id": "macro.dbt.materialization_view_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/view.sql", "original_file_path": "macros/materializations/models/view/view.sql", "name": "materialization_view_default", "macro_sql": "{%- materialization view, default -%}\n\n {%- set identifier = model['alias'] -%}\n {%- set tmp_identifier = model['name'] + '__dbt_tmp' -%}\n {%- set backup_identifier = model['name'] + '__dbt_backup' -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier, schema=schema, database=database,\n type='view') -%}\n {%- set intermediate_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema, database=database, type='view') -%}\n -- the intermediate_relation should not already exist in the database; get_relation\n -- will return None in that case. Otherwise, we get a relation that we can drop\n -- later, before we try to use this name for the current operation\n {%- set preexisting_intermediate_relation = adapter.get_relation(identifier=tmp_identifier, \n schema=schema,\n database=database) -%}\n /*\n This relation (probably) doesn't exist yet. If it does exist, it's a leftover from\n a previous run, and we're going to try to drop it immediately. At the end of this\n materialization, we're going to rename the \"old_relation\" to this identifier,\n and then we're going to drop it. In order to make sure we run the correct one of:\n - drop view ...\n - drop table ...\n\n We need to set the type of this relation to be the type of the old_relation, if it exists,\n or else \"view\" as a sane default if it does not. Note that if the old_relation does not\n exist, then there is nothing to move out of the way and subsequentally drop. In that case,\n this relation will be effectively unused.\n */\n {%- set backup_relation_type = 'view' if old_relation is none else old_relation.type -%}\n {%- set backup_relation = api.Relation.create(identifier=backup_identifier,\n schema=schema, database=database,\n type=backup_relation_type) -%}\n -- as above, the backup_relation should not already exist\n {%- set preexisting_backup_relation = adapter.get_relation(identifier=backup_identifier,\n schema=schema,\n database=database) -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- drop the temp relations if they exist already in the database\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% call statement('main') -%}\n {{ create_view_as(intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n -- move the existing view out of the way\n {% if old_relation is not none %}\n {{ adapter.rename_relation(old_relation, backup_relation) }}\n {% endif %}\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {{ drop_relation_if_exists(backup_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt.create_view_as", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7398348}, "macro.dbt.handle_existing_table": {"unique_id": "macro.dbt.handle_existing_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/helpers.sql", "original_file_path": "macros/materializations/models/view/helpers.sql", "name": "handle_existing_table", "macro_sql": "{% macro handle_existing_table(full_refresh, old_relation) %}\n {{ adapter.dispatch('handle_existing_table', 'dbt')(full_refresh, old_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__handle_existing_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.741197}, "macro.dbt.default__handle_existing_table": {"unique_id": "macro.dbt.default__handle_existing_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/helpers.sql", "original_file_path": "macros/materializations/models/view/helpers.sql", "name": "default__handle_existing_table", "macro_sql": "{% macro default__handle_existing_table(full_refresh, old_relation) %}\n {{ log(\"Dropping relation \" ~ old_relation ~ \" because it is of type \" ~ old_relation.type) }}\n {{ adapter.drop_relation(old_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.741759}, "macro.dbt.create_or_replace_view": {"unique_id": "macro.dbt.create_or_replace_view", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_or_replace_view.sql", "original_file_path": "macros/materializations/models/view/create_or_replace_view.sql", "name": "create_or_replace_view", "macro_sql": "{% macro create_or_replace_view() %}\n {%- set identifier = model['alias'] -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {%- set target_relation = api.Relation.create(\n identifier=identifier, schema=schema, database=database,\n type='view') -%}\n\n {{ run_hooks(pre_hooks) }}\n\n -- If there's a table with the same name and we weren't told to full refresh,\n -- that's an error. If we were told to full refresh, drop it. This behavior differs\n -- for Snowflake and BigQuery, so multiple dispatch is used.\n {%- if old_relation is not none and old_relation.is_table -%}\n {{ handle_existing_table(should_full_refresh(), old_relation) }}\n {%- endif -%}\n\n -- build model\n {% call statement('main') -%}\n {{ get_create_view_as_sql(target_relation, sql) }}\n {%- endcall %}\n\n {{ run_hooks(post_hooks) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.handle_existing_table", "macro.dbt.should_full_refresh", "macro.dbt.statement", "macro.dbt.get_create_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.745218}, "macro.dbt.get_create_view_as_sql": {"unique_id": "macro.dbt.get_create_view_as_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.sql", "name": "get_create_view_as_sql", "macro_sql": "{% macro get_create_view_as_sql(relation, sql) -%}\n {{ adapter.dispatch('get_create_view_as_sql', 'dbt')(relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_create_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7462971}, "macro.dbt.default__get_create_view_as_sql": {"unique_id": "macro.dbt.default__get_create_view_as_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.sql", "name": "default__get_create_view_as_sql", "macro_sql": "{% macro default__get_create_view_as_sql(relation, sql) -%}\n {{ return(create_view_as(relation, sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.74679}, "macro.dbt.create_view_as": {"unique_id": "macro.dbt.create_view_as", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.sql", "name": "create_view_as", "macro_sql": "{% macro create_view_as(relation, sql) -%}\n {{ adapter.dispatch('create_view_as', 'dbt')(relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.747294}, "macro.dbt.default__create_view_as": {"unique_id": "macro.dbt.default__create_view_as", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.sql", "name": "default__create_view_as", "macro_sql": "{% macro default__create_view_as(relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n create view {{ relation }} as (\n {{ sql }}\n );\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7483032}, "macro.dbt.materialization_seed_default": {"unique_id": "macro.dbt.materialization_seed_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/seed.sql", "original_file_path": "macros/materializations/seeds/seed.sql", "name": "materialization_seed_default", "macro_sql": "{% materialization seed, default %}\n\n {%- set identifier = model['alias'] -%}\n {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n\n {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {%- set agate_table = load_agate_table() -%}\n {%- do store_result('agate_table', response='OK', agate_table=agate_table) -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% set create_table_sql = \"\" %}\n {% if exists_as_view %}\n {{ exceptions.raise_compiler_error(\"Cannot seed to '{}', it is a view\".format(old_relation)) }}\n {% elif exists_as_table %}\n {% set create_table_sql = reset_csv_table(model, full_refresh_mode, old_relation, agate_table) %}\n {% else %}\n {% set create_table_sql = create_csv_table(model, agate_table) %}\n {% endif %}\n\n {% set code = 'CREATE' if full_refresh_mode else 'INSERT' %}\n {% set rows_affected = (agate_table.rows | length) %}\n {% set sql = load_csv_rows(model, agate_table) %}\n\n {% call noop_statement('main', code ~ ' ' ~ rows_affected, code, rows_affected) %}\n {{ create_table_sql }};\n -- dbt seed --\n {{ sql }}\n {% endcall %}\n\n {% set target_relation = this.incorporate(type='table') %}\n {% do persist_docs(target_relation, model) %}\n\n {% if full_refresh_mode or not exists_as_table %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.run_hooks", "macro.dbt.reset_csv_table", "macro.dbt.create_csv_table", "macro.dbt.load_csv_rows", "macro.dbt.noop_statement", "macro.dbt.persist_docs", "macro.dbt.create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.75549}, "macro.dbt.create_csv_table": {"unique_id": "macro.dbt.create_csv_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "create_csv_table", "macro_sql": "{% macro create_csv_table(model, agate_table) -%}\n {{ adapter.dispatch('create_csv_table', 'dbt')(model, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7621398}, "macro.dbt.default__create_csv_table": {"unique_id": "macro.dbt.default__create_csv_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__create_csv_table", "macro_sql": "{% macro default__create_csv_table(model, agate_table) %}\n {%- set column_override = model['config'].get('column_types', {}) -%}\n {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n\n {% set sql %}\n create table {{ this.render() }} (\n {%- for col_name in agate_table.column_names -%}\n {%- set inferred_type = adapter.convert_type(agate_table, loop.index0) -%}\n {%- set type = column_override.get(col_name, inferred_type) -%}\n {%- set column_name = (col_name | string) -%}\n {{ adapter.quote_seed_column(column_name, quote_seed_column) }} {{ type }} {%- if not loop.last -%}, {%- endif -%}\n {%- endfor -%}\n )\n {% endset %}\n\n {% call statement('_') -%}\n {{ sql }}\n {%- endcall %}\n\n {{ return(sql) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.764229}, "macro.dbt.reset_csv_table": {"unique_id": "macro.dbt.reset_csv_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "reset_csv_table", "macro_sql": "{% macro reset_csv_table(model, full_refresh, old_relation, agate_table) -%}\n {{ adapter.dispatch('reset_csv_table', 'dbt')(model, full_refresh, old_relation, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__reset_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.76475}, "macro.dbt.default__reset_csv_table": {"unique_id": "macro.dbt.default__reset_csv_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__reset_csv_table", "macro_sql": "{% macro default__reset_csv_table(model, full_refresh, old_relation, agate_table) %}\n {% set sql = \"\" %}\n {% if full_refresh %}\n {{ adapter.drop_relation(old_relation) }}\n {% set sql = create_csv_table(model, agate_table) %}\n {% else %}\n {{ adapter.truncate_relation(old_relation) }}\n {% set sql = \"truncate table \" ~ old_relation %}\n {% endif %}\n\n {{ return(sql) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.765895}, "macro.dbt.get_binding_char": {"unique_id": "macro.dbt.get_binding_char", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "get_binding_char", "macro_sql": "{% macro get_binding_char() -%}\n {{ adapter.dispatch('get_binding_char', 'dbt')() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_binding_char"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.766253}, "macro.dbt.default__get_binding_char": {"unique_id": "macro.dbt.default__get_binding_char", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__get_binding_char", "macro_sql": "{% macro default__get_binding_char() %}\n {{ return('%s') }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.766529}, "macro.dbt.get_batch_size": {"unique_id": "macro.dbt.get_batch_size", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "get_batch_size", "macro_sql": "{% macro get_batch_size() -%}\n {{ return(adapter.dispatch('get_batch_size', 'dbt')()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_batch_size"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.766898}, "macro.dbt.default__get_batch_size": {"unique_id": "macro.dbt.default__get_batch_size", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__get_batch_size", "macro_sql": "{% macro default__get_batch_size() %}\n {{ return(10000) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.76717}, "macro.dbt.get_seed_column_quoted_csv": {"unique_id": "macro.dbt.get_seed_column_quoted_csv", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "get_seed_column_quoted_csv", "macro_sql": "{% macro get_seed_column_quoted_csv(model, column_names) %}\n {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n {% set quoted = [] %}\n {% for col in column_names -%}\n {%- do quoted.append(adapter.quote_seed_column(col, quote_seed_column)) -%}\n {%- endfor %}\n\n {%- set dest_cols_csv = quoted | join(', ') -%}\n {{ return(dest_cols_csv) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.768275}, "macro.dbt.load_csv_rows": {"unique_id": "macro.dbt.load_csv_rows", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "load_csv_rows", "macro_sql": "{% macro load_csv_rows(model, agate_table) -%}\n {{ adapter.dispatch('load_csv_rows', 'dbt')(model, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__load_csv_rows"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.768702}, "macro.dbt.default__load_csv_rows": {"unique_id": "macro.dbt.default__load_csv_rows", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__load_csv_rows", "macro_sql": "{% macro default__load_csv_rows(model, agate_table) %}\n\n {% set batch_size = get_batch_size() %}\n\n {% set cols_sql = get_seed_column_quoted_csv(model, agate_table.column_names) %}\n {% set bindings = [] %}\n\n {% set statements = [] %}\n\n {% for chunk in agate_table.rows | batch(batch_size) %}\n {% set bindings = [] %}\n\n {% for row in chunk %}\n {% do bindings.extend(row) %}\n {% endfor %}\n\n {% set sql %}\n insert into {{ this.render() }} ({{ cols_sql }}) values\n {% for row in chunk -%}\n ({%- for column in agate_table.column_names -%}\n {{ get_binding_char() }}\n {%- if not loop.last%},{%- endif %}\n {%- endfor -%})\n {%- if not loop.last%},{%- endif %}\n {%- endfor %}\n {% endset %}\n\n {% do adapter.add_query(sql, bindings=bindings, abridge_sql_log=True) %}\n\n {% if loop.index0 == 0 %}\n {% do statements.append(sql) %}\n {% endif %}\n {% endfor %}\n\n {# Return SQL so we can render it out into the compiled files #}\n {{ return(statements[0]) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_batch_size", "macro.dbt.get_seed_column_quoted_csv", "macro.dbt.get_binding_char"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.77159}, "macro.dbt.generate_alias_name": {"unique_id": "macro.dbt.generate_alias_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_alias.sql", "original_file_path": "macros/get_custom_name/get_custom_alias.sql", "name": "generate_alias_name", "macro_sql": "{% macro generate_alias_name(custom_alias_name=none, node=none) -%}\n {% do return(adapter.dispatch('generate_alias_name', 'dbt')(custom_alias_name, node)) %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__generate_alias_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.772518}, "macro.dbt.default__generate_alias_name": {"unique_id": "macro.dbt.default__generate_alias_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_alias.sql", "original_file_path": "macros/get_custom_name/get_custom_alias.sql", "name": "default__generate_alias_name", "macro_sql": "{% macro default__generate_alias_name(custom_alias_name=none, node=none) -%}\n\n {%- if custom_alias_name is none -%}\n\n {{ node.name }}\n\n {%- else -%}\n\n {{ custom_alias_name | trim }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7730508}, "macro.dbt.generate_schema_name": {"unique_id": "macro.dbt.generate_schema_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "name": "generate_schema_name", "macro_sql": "{% macro generate_schema_name(custom_schema_name=none, node=none) -%}\n {{ return(adapter.dispatch('generate_schema_name', 'dbt')(custom_schema_name, node)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__generate_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7741902}, "macro.dbt.default__generate_schema_name": {"unique_id": "macro.dbt.default__generate_schema_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "name": "default__generate_schema_name", "macro_sql": "{% macro default__generate_schema_name(custom_schema_name, node) -%}\n\n {%- set default_schema = target.schema -%}\n {%- if custom_schema_name is none -%}\n\n {{ default_schema }}\n\n {%- else -%}\n\n {{ default_schema }}_{{ custom_schema_name | trim }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.774806}, "macro.dbt.generate_schema_name_for_env": {"unique_id": "macro.dbt.generate_schema_name_for_env", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "name": "generate_schema_name_for_env", "macro_sql": "{% macro generate_schema_name_for_env(custom_schema_name, node) -%}\n\n {%- set default_schema = target.schema -%}\n {%- if target.name == 'prod' and custom_schema_name is not none -%}\n\n {{ custom_schema_name | trim }}\n\n {%- else -%}\n\n {{ default_schema }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7754948}, "macro.dbt.generate_database_name": {"unique_id": "macro.dbt.generate_database_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_database.sql", "original_file_path": "macros/get_custom_name/get_custom_database.sql", "name": "generate_database_name", "macro_sql": "{% macro generate_database_name(custom_database_name=none, node=none) -%}\n {% do return(adapter.dispatch('generate_database_name', 'dbt')(custom_database_name, node)) %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__generate_database_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.776464}, "macro.dbt.default__generate_database_name": {"unique_id": "macro.dbt.default__generate_database_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_database.sql", "original_file_path": "macros/get_custom_name/get_custom_database.sql", "name": "default__generate_database_name", "macro_sql": "{% macro default__generate_database_name(custom_database_name=none, node=none) -%}\n {%- set default_database = target.database -%}\n {%- if custom_database_name is none -%}\n\n {{ default_database }}\n\n {%- else -%}\n\n {{ custom_database_name }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7770722}, "macro.dbt.default__test_relationships": {"unique_id": "macro.dbt.default__test_relationships", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/generic_test_sql/relationships.sql", "original_file_path": "macros/generic_test_sql/relationships.sql", "name": "default__test_relationships", "macro_sql": "{% macro default__test_relationships(model, column_name, to, field) %}\n\nwith child as (\n select {{ column_name }} as from_field\n from {{ model }}\n where {{ column_name }} is not null\n),\n\nparent as (\n select {{ field }} as to_field\n from {{ to }}\n)\n\nselect\n from_field\n\nfrom child\nleft join parent\n on child.from_field = parent.to_field\n\nwhere parent.to_field is null\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7780669}, "macro.dbt.default__test_not_null": {"unique_id": "macro.dbt.default__test_not_null", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/generic_test_sql/not_null.sql", "original_file_path": "macros/generic_test_sql/not_null.sql", "name": "default__test_not_null", "macro_sql": "{% macro default__test_not_null(model, column_name) %}\n\nselect *\nfrom {{ model }}\nwhere {{ column_name }} is null\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7786188}, "macro.dbt.default__test_unique": {"unique_id": "macro.dbt.default__test_unique", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/generic_test_sql/unique.sql", "original_file_path": "macros/generic_test_sql/unique.sql", "name": "default__test_unique", "macro_sql": "{% macro default__test_unique(model, column_name) %}\n\nselect\n {{ column_name }} as unique_field,\n count(*) as n_records\n\nfrom {{ model }}\nwhere {{ column_name }} is not null\ngroup by {{ column_name }}\nhaving count(*) > 1\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7793448}, "macro.dbt.default__test_accepted_values": {"unique_id": "macro.dbt.default__test_accepted_values", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/generic_test_sql/accepted_values.sql", "original_file_path": "macros/generic_test_sql/accepted_values.sql", "name": "default__test_accepted_values", "macro_sql": "{% macro default__test_accepted_values(model, column_name, values, quote=True) %}\n\nwith all_values as (\n\n select\n {{ column_name }} as value_field,\n count(*) as n_records\n\n from {{ model }}\n group by {{ column_name }}\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n {% for value in values -%}\n {% if quote -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {%- endfor %}\n)\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.78078}, "macro.dbt.statement": {"unique_id": "macro.dbt.statement", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "name": "statement", "macro_sql": "{% macro statement(name=None, fetch_result=False, auto_begin=True) -%}\n {%- if execute: -%}\n {%- set sql = caller() -%}\n\n {%- if name == 'main' -%}\n {{ log('Writing runtime SQL for node \"{}\"'.format(model['unique_id'])) }}\n {{ write(sql) }}\n {%- endif -%}\n\n {%- set res, table = adapter.execute(sql, auto_begin=auto_begin, fetch=fetch_result) -%}\n {%- if name is not none -%}\n {{ store_result(name, response=res, agate_table=table) }}\n {%- endif -%}\n\n {%- endif -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.783254}, "macro.dbt.noop_statement": {"unique_id": "macro.dbt.noop_statement", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "name": "noop_statement", "macro_sql": "{% macro noop_statement(name=None, message=None, code=None, rows_affected=None, res=None) -%}\n {%- set sql = caller() -%}\n\n {%- if name == 'main' -%}\n {{ log('Writing runtime SQL for node \"{}\"'.format(model['unique_id'])) }}\n {{ write(sql) }}\n {%- endif -%}\n\n {%- if name is not none -%}\n {{ store_raw_result(name, message=message, code=code, rows_affected=rows_affected, agate_table=res) }}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7847638}, "macro.dbt.run_query": {"unique_id": "macro.dbt.run_query", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "name": "run_query", "macro_sql": "{% macro run_query(sql) %}\n {% call statement(\"run_query_statement\", fetch_result=true, auto_begin=false) %}\n {{ sql }}\n {% endcall %}\n\n {% do return(load_result(\"run_query_statement\").table) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7854028}, "macro.dbt.convert_datetime": {"unique_id": "macro.dbt.convert_datetime", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "convert_datetime", "macro_sql": "{% macro convert_datetime(date_str, date_fmt) %}\n\n {% set error_msg -%}\n The provided partition date '{{ date_str }}' does not match the expected format '{{ date_fmt }}'\n {%- endset %}\n\n {% set res = try_or_compiler_error(error_msg, modules.datetime.datetime.strptime, date_str.strip(), date_fmt) %}\n {{ return(res) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.788404}, "macro.dbt.dates_in_range": {"unique_id": "macro.dbt.dates_in_range", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "dates_in_range", "macro_sql": "{% macro dates_in_range(start_date_str, end_date_str=none, in_fmt=\"%Y%m%d\", out_fmt=\"%Y%m%d\") %}\n {% set end_date_str = start_date_str if end_date_str is none else end_date_str %}\n\n {% set start_date = convert_datetime(start_date_str, in_fmt) %}\n {% set end_date = convert_datetime(end_date_str, in_fmt) %}\n\n {% set day_count = (end_date - start_date).days %}\n {% if day_count < 0 %}\n {% set msg -%}\n Partiton start date is after the end date ({{ start_date }}, {{ end_date }})\n {%- endset %}\n\n {{ exceptions.raise_compiler_error(msg, model) }}\n {% endif %}\n\n {% set date_list = [] %}\n {% for i in range(0, day_count + 1) %}\n {% set the_date = (modules.datetime.timedelta(days=i) + start_date) %}\n {% if not out_fmt %}\n {% set _ = date_list.append(the_date) %}\n {% else %}\n {% set _ = date_list.append(the_date.strftime(out_fmt)) %}\n {% endif %}\n {% endfor %}\n\n {{ return(date_list) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.convert_datetime"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.791596}, "macro.dbt.partition_range": {"unique_id": "macro.dbt.partition_range", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "partition_range", "macro_sql": "{% macro partition_range(raw_partition_date, date_fmt='%Y%m%d') %}\n {% set partition_range = (raw_partition_date | string).split(\",\") %}\n\n {% if (partition_range | length) == 1 %}\n {% set start_date = partition_range[0] %}\n {% set end_date = none %}\n {% elif (partition_range | length) == 2 %}\n {% set start_date = partition_range[0] %}\n {% set end_date = partition_range[1] %}\n {% else %}\n {{ exceptions.raise_compiler_error(\"Invalid partition time. Expected format: {Start Date}[,{End Date}]. Got: \" ~ raw_partition_date) }}\n {% endif %}\n\n {{ return(dates_in_range(start_date, end_date, in_fmt=date_fmt)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.dates_in_range"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.793637}, "macro.dbt.py_current_timestring": {"unique_id": "macro.dbt.py_current_timestring", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "py_current_timestring", "macro_sql": "{% macro py_current_timestring() %}\n {% set dt = modules.datetime.datetime.now() %}\n {% do return(dt.strftime(\"%Y%m%d%H%M%S%f\")) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.794369}, "macro.dbt.create_schema": {"unique_id": "macro.dbt.create_schema", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "name": "create_schema", "macro_sql": "{% macro create_schema(relation) -%}\n {{ adapter.dispatch('create_schema', 'dbt')(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_schema"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.795937}, "macro.dbt.default__create_schema": {"unique_id": "macro.dbt.default__create_schema", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "name": "default__create_schema", "macro_sql": "{% macro default__create_schema(relation) -%}\n {%- call statement('create_schema') -%}\n create schema if not exists {{ relation.without_identifier() }}\n {% endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.796397}, "macro.dbt.drop_schema": {"unique_id": "macro.dbt.drop_schema", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "name": "drop_schema", "macro_sql": "{% macro drop_schema(relation) -%}\n {{ adapter.dispatch('drop_schema', 'dbt')(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__drop_schema"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.796787}, "macro.dbt.default__drop_schema": {"unique_id": "macro.dbt.default__drop_schema", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "name": "default__drop_schema", "macro_sql": "{% macro default__drop_schema(relation) -%}\n {%- call statement('drop_schema') -%}\n drop schema if exists {{ relation.without_identifier() }} cascade\n {% endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.797187}, "macro.dbt.get_create_index_sql": {"unique_id": "macro.dbt.get_create_index_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "name": "get_create_index_sql", "macro_sql": "{% macro get_create_index_sql(relation, index_dict) -%}\n {{ return(adapter.dispatch('get_create_index_sql', 'dbt')(relation, index_dict)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_create_index_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.798153}, "macro.dbt.default__get_create_index_sql": {"unique_id": "macro.dbt.default__get_create_index_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "name": "default__get_create_index_sql", "macro_sql": "{% macro default__get_create_index_sql(relation, index_dict) -%}\n {% do return(None) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.798452}, "macro.dbt.create_indexes": {"unique_id": "macro.dbt.create_indexes", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "name": "create_indexes", "macro_sql": "{% macro create_indexes(relation) -%}\n {{ adapter.dispatch('create_indexes', 'dbt')(relation) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.798799}, "macro.dbt.default__create_indexes": {"unique_id": "macro.dbt.default__create_indexes", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "name": "default__create_indexes", "macro_sql": "{% macro default__create_indexes(relation) -%}\n {%- set _indexes = config.get('indexes', default=[]) -%}\n\n {% for _index_dict in _indexes %}\n {% set create_index_sql = get_create_index_sql(relation, _index_dict) %}\n {% if create_index_sql %}\n {% do run_query(create_index_sql) %}\n {% endif %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_create_index_sql", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7997172}, "macro.dbt.make_temp_relation": {"unique_id": "macro.dbt.make_temp_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "make_temp_relation", "macro_sql": "{% macro make_temp_relation(base_relation, suffix='__dbt_tmp') %}\n {{ return(adapter.dispatch('make_temp_relation', 'dbt')(base_relation, suffix))}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__make_temp_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.802512}, "macro.dbt.default__make_temp_relation": {"unique_id": "macro.dbt.default__make_temp_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__make_temp_relation", "macro_sql": "{% macro default__make_temp_relation(base_relation, suffix) %}\n {% set tmp_identifier = base_relation.identifier ~ suffix %}\n {% set tmp_relation = base_relation.incorporate(\n path={\"identifier\": tmp_identifier}) -%}\n\n {% do return(tmp_relation) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.803516}, "macro.dbt.drop_relation": {"unique_id": "macro.dbt.drop_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "drop_relation", "macro_sql": "{% macro drop_relation(relation) -%}\n {{ return(adapter.dispatch('drop_relation', 'dbt')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__drop_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8039129}, "macro.dbt.default__drop_relation": {"unique_id": "macro.dbt.default__drop_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__drop_relation", "macro_sql": "{% macro default__drop_relation(relation) -%}\n {% call statement('drop_relation', auto_begin=False) -%}\n drop {{ relation.type }} if exists {{ relation }} cascade\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.804424}, "macro.dbt.truncate_relation": {"unique_id": "macro.dbt.truncate_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "truncate_relation", "macro_sql": "{% macro truncate_relation(relation) -%}\n {{ return(adapter.dispatch('truncate_relation', 'dbt')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__truncate_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.804822}, "macro.dbt.default__truncate_relation": {"unique_id": "macro.dbt.default__truncate_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__truncate_relation", "macro_sql": "{% macro default__truncate_relation(relation) -%}\n {% call statement('truncate_relation') -%}\n truncate table {{ relation }}\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.805177}, "macro.dbt.rename_relation": {"unique_id": "macro.dbt.rename_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "rename_relation", "macro_sql": "{% macro rename_relation(from_relation, to_relation) -%}\n {{ return(adapter.dispatch('rename_relation', 'dbt')(from_relation, to_relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__rename_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.805724}, "macro.dbt.default__rename_relation": {"unique_id": "macro.dbt.default__rename_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__rename_relation", "macro_sql": "{% macro default__rename_relation(from_relation, to_relation) -%}\n {% set target_name = adapter.quote_as_configured(to_relation.identifier, 'identifier') %}\n {% call statement('rename_relation') -%}\n alter table {{ from_relation }} rename to {{ target_name }}\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8063428}, "macro.dbt.get_or_create_relation": {"unique_id": "macro.dbt.get_or_create_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "get_or_create_relation", "macro_sql": "{% macro get_or_create_relation(database, schema, identifier, type) -%}\n {{ return(adapter.dispatch('get_or_create_relation', 'dbt')(database, schema, identifier, type)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_or_create_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8069298}, "macro.dbt.default__get_or_create_relation": {"unique_id": "macro.dbt.default__get_or_create_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__get_or_create_relation", "macro_sql": "{% macro default__get_or_create_relation(database, schema, identifier, type) %}\n {%- set target_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n\n {% if target_relation %}\n {% do return([true, target_relation]) %}\n {% endif %}\n\n {%- set new_relation = api.Relation.create(\n database=database,\n schema=schema,\n identifier=identifier,\n type=type\n ) -%}\n {% do return([false, new_relation]) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.808249}, "macro.dbt.load_relation": {"unique_id": "macro.dbt.load_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "load_relation", "macro_sql": "{% macro load_relation(relation) %}\n {% do return(adapter.get_relation(\n database=relation.database,\n schema=relation.schema,\n identifier=relation.identifier\n )) -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.80883}, "macro.dbt.drop_relation_if_exists": {"unique_id": "macro.dbt.drop_relation_if_exists", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "drop_relation_if_exists", "macro_sql": "{% macro drop_relation_if_exists(relation) %}\n {% if relation is not none %}\n {{ adapter.drop_relation(relation) }}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8095849}, "macro.dbt.current_timestamp": {"unique_id": "macro.dbt.current_timestamp", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "name": "current_timestamp", "macro_sql": "{% macro current_timestamp() -%}\n {{ adapter.dispatch('current_timestamp', 'dbt')() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.810751}, "macro.dbt.default__current_timestamp": {"unique_id": "macro.dbt.default__current_timestamp", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "name": "default__current_timestamp", "macro_sql": "{% macro default__current_timestamp() -%}\n {{ exceptions.raise_not_implemented(\n 'current_timestamp macro not implemented for adapter '+adapter.type()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8110762}, "macro.dbt.collect_freshness": {"unique_id": "macro.dbt.collect_freshness", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "name": "collect_freshness", "macro_sql": "{% macro collect_freshness(source, loaded_at_field, filter) %}\n {{ return(adapter.dispatch('collect_freshness', 'dbt')(source, loaded_at_field, filter))}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__collect_freshness"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.811571}, "macro.dbt.default__collect_freshness": {"unique_id": "macro.dbt.default__collect_freshness", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "name": "default__collect_freshness", "macro_sql": "{% macro default__collect_freshness(source, loaded_at_field, filter) %}\n {% call statement('collect_freshness', fetch_result=True, auto_begin=False) -%}\n select\n max({{ loaded_at_field }}) as max_loaded_at,\n {{ current_timestamp() }} as snapshotted_at\n from {{ source }}\n {% if filter %}\n where {{ filter }}\n {% endif %}\n {% endcall %}\n {{ return(load_result('collect_freshness').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8124769}, "macro.dbt.alter_column_comment": {"unique_id": "macro.dbt.alter_column_comment", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "alter_column_comment", "macro_sql": "{% macro alter_column_comment(relation, column_dict) -%}\n {{ return(adapter.dispatch('alter_column_comment', 'dbt')(relation, column_dict)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.813783}, "macro.dbt.default__alter_column_comment": {"unique_id": "macro.dbt.default__alter_column_comment", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "default__alter_column_comment", "macro_sql": "{% macro default__alter_column_comment(relation, column_dict) -%}\n {{ exceptions.raise_not_implemented(\n 'alter_column_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.814156}, "macro.dbt.alter_relation_comment": {"unique_id": "macro.dbt.alter_relation_comment", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "alter_relation_comment", "macro_sql": "{% macro alter_relation_comment(relation, relation_comment) -%}\n {{ return(adapter.dispatch('alter_relation_comment', 'dbt')(relation, relation_comment)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__alter_relation_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.814604}, "macro.dbt.default__alter_relation_comment": {"unique_id": "macro.dbt.default__alter_relation_comment", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "default__alter_relation_comment", "macro_sql": "{% macro default__alter_relation_comment(relation, relation_comment) -%}\n {{ exceptions.raise_not_implemented(\n 'alter_relation_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.814971}, "macro.dbt.persist_docs": {"unique_id": "macro.dbt.persist_docs", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "persist_docs", "macro_sql": "{% macro persist_docs(relation, model, for_relation=true, for_columns=true) -%}\n {{ return(adapter.dispatch('persist_docs', 'dbt')(relation, model, for_relation, for_columns)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.815559}, "macro.dbt.default__persist_docs": {"unique_id": "macro.dbt.default__persist_docs", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "default__persist_docs", "macro_sql": "{% macro default__persist_docs(relation, model, for_relation, for_columns) -%}\n {% if for_relation and config.persist_relation_docs() and model.description %}\n {% do run_query(alter_relation_comment(relation, model.description)) %}\n {% endif %}\n\n {% if for_columns and config.persist_column_docs() and model.columns %}\n {% do run_query(alter_column_comment(relation, model.columns)) %}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query", "macro.dbt.alter_relation_comment", "macro.dbt.alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.816597}, "macro.dbt.get_catalog": {"unique_id": "macro.dbt.get_catalog", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "get_catalog", "macro_sql": "{% macro get_catalog(information_schema, schemas) -%}\n {{ return(adapter.dispatch('get_catalog', 'dbt')(information_schema, schemas)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_catalog"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.820811}, "macro.dbt.default__get_catalog": {"unique_id": "macro.dbt.default__get_catalog", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__get_catalog", "macro_sql": "{% macro default__get_catalog(information_schema, schemas) -%}\n\n {% set typename = adapter.type() %}\n {% set msg -%}\n get_catalog not implemented for {{ typename }}\n {%- endset %}\n\n {{ exceptions.raise_compiler_error(msg) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8215091}, "macro.dbt.information_schema_name": {"unique_id": "macro.dbt.information_schema_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "information_schema_name", "macro_sql": "{% macro information_schema_name(database) %}\n {{ return(adapter.dispatch('information_schema_name', 'dbt')(database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__information_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.821953}, "macro.dbt.default__information_schema_name": {"unique_id": "macro.dbt.default__information_schema_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__information_schema_name", "macro_sql": "{% macro default__information_schema_name(database) -%}\n {%- if database -%}\n {{ database }}.INFORMATION_SCHEMA\n {%- else -%}\n INFORMATION_SCHEMA\n {%- endif -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8223622}, "macro.dbt.list_schemas": {"unique_id": "macro.dbt.list_schemas", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "list_schemas", "macro_sql": "{% macro list_schemas(database) -%}\n {{ return(adapter.dispatch('list_schemas', 'dbt')(database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__list_schemas"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.822835}, "macro.dbt.default__list_schemas": {"unique_id": "macro.dbt.default__list_schemas", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__list_schemas", "macro_sql": "{% macro default__list_schemas(database) -%}\n {% set sql %}\n select distinct schema_name\n from {{ information_schema_name(database) }}.SCHEMATA\n where catalog_name ilike '{{ database }}'\n {% endset %}\n {{ return(run_query(sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.information_schema_name", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8234382}, "macro.dbt.check_schema_exists": {"unique_id": "macro.dbt.check_schema_exists", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "check_schema_exists", "macro_sql": "{% macro check_schema_exists(information_schema, schema) -%}\n {{ return(adapter.dispatch('check_schema_exists', 'dbt')(information_schema, schema)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__check_schema_exists"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.823937}, "macro.dbt.default__check_schema_exists": {"unique_id": "macro.dbt.default__check_schema_exists", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__check_schema_exists", "macro_sql": "{% macro default__check_schema_exists(information_schema, schema) -%}\n {% set sql -%}\n select count(*)\n from {{ information_schema.replace(information_schema_view='SCHEMATA') }}\n where catalog_name='{{ information_schema.database }}'\n and schema_name='{{ schema }}'\n {%- endset %}\n {{ return(run_query(sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.replace", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.824768}, "macro.dbt.list_relations_without_caching": {"unique_id": "macro.dbt.list_relations_without_caching", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "list_relations_without_caching", "macro_sql": "{% macro list_relations_without_caching(schema_relation) %}\n {{ return(adapter.dispatch('list_relations_without_caching', 'dbt')(schema_relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__list_relations_without_caching"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.825184}, "macro.dbt.default__list_relations_without_caching": {"unique_id": "macro.dbt.default__list_relations_without_caching", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__list_relations_without_caching", "macro_sql": "{% macro default__list_relations_without_caching(schema_relation) %}\n {{ exceptions.raise_not_implemented(\n 'list_relations_without_caching macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.825543}, "macro.dbt.get_columns_in_relation": {"unique_id": "macro.dbt.get_columns_in_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "get_columns_in_relation", "macro_sql": "{% macro get_columns_in_relation(relation) -%}\n {{ return(adapter.dispatch('get_columns_in_relation', 'dbt')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.828556}, "macro.dbt.default__get_columns_in_relation": {"unique_id": "macro.dbt.default__get_columns_in_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "default__get_columns_in_relation", "macro_sql": "{% macro default__get_columns_in_relation(relation) -%}\n {{ exceptions.raise_not_implemented(\n 'get_columns_in_relation macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.828906}, "macro.dbt.sql_convert_columns_in_relation": {"unique_id": "macro.dbt.sql_convert_columns_in_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "sql_convert_columns_in_relation", "macro_sql": "{% macro sql_convert_columns_in_relation(table) -%}\n {% set columns = [] %}\n {% for row in table %}\n {% do columns.append(api.Column(*row)) %}\n {% endfor %}\n {{ return(columns) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.829576}, "macro.dbt.get_columns_in_query": {"unique_id": "macro.dbt.get_columns_in_query", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "get_columns_in_query", "macro_sql": "{% macro get_columns_in_query(select_sql) -%}\n {{ return(adapter.dispatch('get_columns_in_query', 'dbt')(select_sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.82998}, "macro.dbt.default__get_columns_in_query": {"unique_id": "macro.dbt.default__get_columns_in_query", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "default__get_columns_in_query", "macro_sql": "{% macro default__get_columns_in_query(select_sql) %}\n {% call statement('get_columns_in_query', fetch_result=True, auto_begin=False) -%}\n select * from (\n {{ select_sql }}\n ) as __dbt_sbq\n where false\n limit 0\n {% endcall %}\n\n {{ return(load_result('get_columns_in_query').table.columns | map(attribute='name') | list) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.830781}, "macro.dbt.alter_column_type": {"unique_id": "macro.dbt.alter_column_type", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "alter_column_type", "macro_sql": "{% macro alter_column_type(relation, column_name, new_column_type) -%}\n {{ return(adapter.dispatch('alter_column_type', 'dbt')(relation, column_name, new_column_type)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.831276}, "macro.dbt.default__alter_column_type": {"unique_id": "macro.dbt.default__alter_column_type", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "default__alter_column_type", "macro_sql": "{% macro default__alter_column_type(relation, column_name, new_column_type) -%}\n {#\n 1. Create a new column (w/ temp name and correct type)\n 2. Copy data over to it\n 3. Drop the existing column (cascade!)\n 4. Rename the new column to existing column\n #}\n {%- set tmp_column = column_name + \"__dbt_alter\" -%}\n\n {% call statement('alter_column_type') %}\n alter table {{ relation }} add column {{ adapter.quote(tmp_column) }} {{ new_column_type }};\n update {{ relation }} set {{ adapter.quote(tmp_column) }} = {{ adapter.quote(column_name) }};\n alter table {{ relation }} drop column {{ adapter.quote(column_name) }} cascade;\n alter table {{ relation }} rename column {{ adapter.quote(tmp_column) }} to {{ adapter.quote(column_name) }}\n {% endcall %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.832623}, "macro.dbt.alter_relation_add_remove_columns": {"unique_id": "macro.dbt.alter_relation_add_remove_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "alter_relation_add_remove_columns", "macro_sql": "{% macro alter_relation_add_remove_columns(relation, add_columns = none, remove_columns = none) -%}\n {{ return(adapter.dispatch('alter_relation_add_remove_columns', 'dbt')(relation, add_columns, remove_columns)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__alter_relation_add_remove_columns"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.833177}, "macro.dbt.default__alter_relation_add_remove_columns": {"unique_id": "macro.dbt.default__alter_relation_add_remove_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "default__alter_relation_add_remove_columns", "macro_sql": "{% macro default__alter_relation_add_remove_columns(relation, add_columns, remove_columns) %}\n \n {% if add_columns is none %}\n {% set add_columns = [] %}\n {% endif %}\n {% if remove_columns is none %}\n {% set remove_columns = [] %}\n {% endif %}\n \n {% set sql -%}\n \n alter {{ relation.type }} {{ relation }}\n \n {% for column in add_columns %}\n add column {{ column.name }} {{ column.data_type }}{{ ',' if not loop.last }}\n {% endfor %}{{ ',' if add_columns and remove_columns }}\n \n {% for column in remove_columns %}\n drop column {{ column.name }}{{ ',' if not loop.last }}\n {% endfor %}\n \n {%- endset -%}\n\n {% do run_query(sql) %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.836224}, "macro.dbt.test_unique": {"unique_id": "macro.dbt.test_unique", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "name": "test_unique", "macro_sql": "{% test unique(model, column_name) %}\n {% set macro = adapter.dispatch('test_unique', 'dbt') %}\n {{ macro(model, column_name) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__test_unique"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.838303}, "macro.dbt.test_not_null": {"unique_id": "macro.dbt.test_not_null", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "name": "test_not_null", "macro_sql": "{% test not_null(model, column_name) %}\n {% set macro = adapter.dispatch('test_not_null', 'dbt') %}\n {{ macro(model, column_name) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__test_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8388531}, "macro.dbt.test_accepted_values": {"unique_id": "macro.dbt.test_accepted_values", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "name": "test_accepted_values", "macro_sql": "{% test accepted_values(model, column_name, values, quote=True) %}\n {% set macro = adapter.dispatch('test_accepted_values', 'dbt') %}\n {{ macro(model, column_name, values, quote) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__test_accepted_values"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.839527}, "macro.dbt.test_relationships": {"unique_id": "macro.dbt.test_relationships", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "name": "test_relationships", "macro_sql": "{% test relationships(model, column_name, to, field) %}\n {% set macro = adapter.dispatch('test_relationships', 'dbt') %}\n {{ macro(model, column_name, to, field) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__test_relationships"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.840215}, "macro.dbt_utils.except": {"unique_id": "macro.dbt_utils.except", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/except.sql", "original_file_path": "macros/cross_db_utils/except.sql", "name": "except", "macro_sql": "{% macro except() %}\n {{ return(adapter.dispatch('except', 'dbt_utils')()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__except"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.841411}, "macro.dbt_utils.default__except": {"unique_id": "macro.dbt_utils.default__except", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/except.sql", "original_file_path": "macros/cross_db_utils/except.sql", "name": "default__except", "macro_sql": "{% macro default__except() %}\n\n except\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.841585}, "macro.dbt_utils.bigquery__except": {"unique_id": "macro.dbt_utils.bigquery__except", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/except.sql", "original_file_path": "macros/cross_db_utils/except.sql", "name": "bigquery__except", "macro_sql": "{% macro bigquery__except() %}\n\n except distinct\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8418188}, "macro.dbt_utils.replace": {"unique_id": "macro.dbt_utils.replace", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/replace.sql", "original_file_path": "macros/cross_db_utils/replace.sql", "name": "replace", "macro_sql": "{% macro replace(field, old_chars, new_chars) -%}\n {{ return(adapter.dispatch('replace', 'dbt_utils') (field, old_chars, new_chars)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__replace"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.842864}, "macro.dbt_utils.default__replace": {"unique_id": "macro.dbt_utils.default__replace", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/replace.sql", "original_file_path": "macros/cross_db_utils/replace.sql", "name": "default__replace", "macro_sql": "{% macro default__replace(field, old_chars, new_chars) %}\n\n replace(\n {{ field }},\n {{ old_chars }},\n {{ new_chars }}\n )\n \n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.843256}, "macro.dbt_utils.concat": {"unique_id": "macro.dbt_utils.concat", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/concat.sql", "original_file_path": "macros/cross_db_utils/concat.sql", "name": "concat", "macro_sql": "{% macro concat(fields) -%}\n {{ return(adapter.dispatch('concat', 'dbt_utils')(fields)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__concat"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.843929}, "macro.dbt_utils.default__concat": {"unique_id": "macro.dbt_utils.default__concat", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/concat.sql", "original_file_path": "macros/cross_db_utils/concat.sql", "name": "default__concat", "macro_sql": "{% macro default__concat(fields) -%}\n {{ fields|join(' || ') }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.84422}, "macro.dbt_utils.type_string": {"unique_id": "macro.dbt_utils.type_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_string", "macro_sql": "\n\n{%- macro type_string() -%}\n {{ return(adapter.dispatch('type_string', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.845669}, "macro.dbt_utils.default__type_string": {"unique_id": "macro.dbt_utils.default__type_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_string", "macro_sql": "{% macro default__type_string() %}\n string\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8459468}, "macro.dbt_utils.redshift__type_string": {"unique_id": "macro.dbt_utils.redshift__type_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "redshift__type_string", "macro_sql": "\n\n{%- macro redshift__type_string() -%}\n varchar\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.846113}, "macro.dbt_utils.postgres__type_string": {"unique_id": "macro.dbt_utils.postgres__type_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "postgres__type_string", "macro_sql": "{% macro postgres__type_string() %}\n varchar\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.846275}, "macro.dbt_utils.snowflake__type_string": {"unique_id": "macro.dbt_utils.snowflake__type_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "snowflake__type_string", "macro_sql": "{% macro snowflake__type_string() %}\n varchar\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.846435}, "macro.dbt_utils.type_timestamp": {"unique_id": "macro.dbt_utils.type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_timestamp", "macro_sql": "\n\n{%- macro type_timestamp() -%}\n {{ return(adapter.dispatch('type_timestamp', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.846783}, "macro.dbt_utils.default__type_timestamp": {"unique_id": "macro.dbt_utils.default__type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_timestamp", "macro_sql": "{% macro default__type_timestamp() %}\n timestamp\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8469481}, "macro.dbt_utils.postgres__type_timestamp": {"unique_id": "macro.dbt_utils.postgres__type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "postgres__type_timestamp", "macro_sql": "{% macro postgres__type_timestamp() %}\n timestamp without time zone\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.847109}, "macro.dbt_utils.snowflake__type_timestamp": {"unique_id": "macro.dbt_utils.snowflake__type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "snowflake__type_timestamp", "macro_sql": "{% macro snowflake__type_timestamp() %}\n timestamp_ntz\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.847266}, "macro.dbt_utils.type_float": {"unique_id": "macro.dbt_utils.type_float", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_float", "macro_sql": "\n\n{%- macro type_float() -%}\n {{ return(adapter.dispatch('type_float', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__type_float"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.84761}, "macro.dbt_utils.default__type_float": {"unique_id": "macro.dbt_utils.default__type_float", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_float", "macro_sql": "{% macro default__type_float() %}\n float\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8477728}, "macro.dbt_utils.bigquery__type_float": {"unique_id": "macro.dbt_utils.bigquery__type_float", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_float", "macro_sql": "{% macro bigquery__type_float() %}\n float64\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.847934}, "macro.dbt_utils.type_numeric": {"unique_id": "macro.dbt_utils.type_numeric", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_numeric", "macro_sql": "\n\n{%- macro type_numeric() -%}\n {{ return(adapter.dispatch('type_numeric', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.84848}, "macro.dbt_utils.default__type_numeric": {"unique_id": "macro.dbt_utils.default__type_numeric", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_numeric", "macro_sql": "{% macro default__type_numeric() %}\n numeric(28, 6)\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.848825}, "macro.dbt_utils.bigquery__type_numeric": {"unique_id": "macro.dbt_utils.bigquery__type_numeric", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_numeric", "macro_sql": "{% macro bigquery__type_numeric() %}\n numeric\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.849045}, "macro.dbt_utils.type_bigint": {"unique_id": "macro.dbt_utils.type_bigint", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_bigint", "macro_sql": "\n\n{%- macro type_bigint() -%}\n {{ return(adapter.dispatch('type_bigint', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8496158}, "macro.dbt_utils.default__type_bigint": {"unique_id": "macro.dbt_utils.default__type_bigint", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_bigint", "macro_sql": "{% macro default__type_bigint() %}\n bigint\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.849791}, "macro.dbt_utils.bigquery__type_bigint": {"unique_id": "macro.dbt_utils.bigquery__type_bigint", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_bigint", "macro_sql": "{% macro bigquery__type_bigint() %}\n int64\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.850076}, "macro.dbt_utils.type_int": {"unique_id": "macro.dbt_utils.type_int", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_int", "macro_sql": "\n\n{%- macro type_int() -%}\n {{ return(adapter.dispatch('type_int', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__type_int"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.85044}, "macro.dbt_utils.default__type_int": {"unique_id": "macro.dbt_utils.default__type_int", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_int", "macro_sql": "{% macro default__type_int() %}\n int\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.850611}, "macro.dbt_utils.bigquery__type_int": {"unique_id": "macro.dbt_utils.bigquery__type_int", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_int", "macro_sql": "{% macro bigquery__type_int() %}\n int64\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.850801}, "macro.dbt_utils._is_relation": {"unique_id": "macro.dbt_utils._is_relation", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/_is_relation.sql", "original_file_path": "macros/cross_db_utils/_is_relation.sql", "name": "_is_relation", "macro_sql": "{% macro _is_relation(obj, macro) %}\n {%- if not (obj is mapping and obj.get('metadata', {}).get('type', '').endswith('Relation')) -%}\n {%- do exceptions.raise_compiler_error(\"Macro \" ~ macro ~ \" expected a Relation but received the value: \" ~ obj) -%}\n {%- endif -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.852258}, "macro.dbt_utils.cast_array_to_string": {"unique_id": "macro.dbt_utils.cast_array_to_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_array_to_string.sql", "original_file_path": "macros/cross_db_utils/cast_array_to_string.sql", "name": "cast_array_to_string", "macro_sql": "{% macro cast_array_to_string(array) %}\n {{ adapter.dispatch('cast_array_to_string', 'dbt_utils') (array) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__cast_array_to_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.853392}, "macro.dbt_utils.default__cast_array_to_string": {"unique_id": "macro.dbt_utils.default__cast_array_to_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_array_to_string.sql", "original_file_path": "macros/cross_db_utils/cast_array_to_string.sql", "name": "default__cast_array_to_string", "macro_sql": "{% macro default__cast_array_to_string(array) %}\n cast({{ array }} as {{ dbt_utils.type_string() }})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8537269}, "macro.dbt_utils.postgres__cast_array_to_string": {"unique_id": "macro.dbt_utils.postgres__cast_array_to_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_array_to_string.sql", "original_file_path": "macros/cross_db_utils/cast_array_to_string.sql", "name": "postgres__cast_array_to_string", "macro_sql": "{% macro postgres__cast_array_to_string(array) %}\n {%- set array_as_string -%}cast({{ array }} as {{ dbt_utils.type_string() }}){%- endset -%}\n {{ dbt_utils.replace(dbt_utils.replace(array_as_string,\"'}'\",\"']'\"),\"'{'\",\"'['\") }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string", "macro.dbt_utils.replace"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.854899}, "macro.dbt_utils.redshift__cast_array_to_string": {"unique_id": "macro.dbt_utils.redshift__cast_array_to_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_array_to_string.sql", "original_file_path": "macros/cross_db_utils/cast_array_to_string.sql", "name": "redshift__cast_array_to_string", "macro_sql": "{% macro redshift__cast_array_to_string(array) %}\n cast({{ array }} as {{ dbt_utils.type_string() }})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.855371}, "macro.dbt_utils.bigquery__cast_array_to_string": {"unique_id": "macro.dbt_utils.bigquery__cast_array_to_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_array_to_string.sql", "original_file_path": "macros/cross_db_utils/cast_array_to_string.sql", "name": "bigquery__cast_array_to_string", "macro_sql": "{% macro bigquery__cast_array_to_string(array) %}\n '['||(select string_agg(cast(element as string), ',') from unnest({{ array }}) element)||']'\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8556118}, "macro.dbt_utils.length": {"unique_id": "macro.dbt_utils.length", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/length.sql", "original_file_path": "macros/cross_db_utils/length.sql", "name": "length", "macro_sql": "{% macro length(expression) -%}\n {{ return(adapter.dispatch('length', 'dbt_utils') (expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__length"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.856446}, "macro.dbt_utils.default__length": {"unique_id": "macro.dbt_utils.default__length", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/length.sql", "original_file_path": "macros/cross_db_utils/length.sql", "name": "default__length", "macro_sql": "{% macro default__length(expression) %}\n \n length(\n {{ expression }}\n )\n \n{%- endmacro -%}\n\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.85669}, "macro.dbt_utils.redshift__length": {"unique_id": "macro.dbt_utils.redshift__length", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/length.sql", "original_file_path": "macros/cross_db_utils/length.sql", "name": "redshift__length", "macro_sql": "{% macro redshift__length(expression) %}\n\n len(\n {{ expression }}\n )\n \n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.856944}, "macro.dbt_utils.dateadd": {"unique_id": "macro.dbt_utils.dateadd", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "dateadd", "macro_sql": "{% macro dateadd(datepart, interval, from_date_or_timestamp) %}\n {{ return(adapter.dispatch('dateadd', 'dbt_utils')(datepart, interval, from_date_or_timestamp)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.858359}, "macro.dbt_utils.default__dateadd": {"unique_id": "macro.dbt_utils.default__dateadd", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "default__dateadd", "macro_sql": "{% macro default__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n dateadd(\n {{ datepart }},\n {{ interval }},\n {{ from_date_or_timestamp }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.858839}, "macro.dbt_utils.bigquery__dateadd": {"unique_id": "macro.dbt_utils.bigquery__dateadd", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "bigquery__dateadd", "macro_sql": "{% macro bigquery__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n datetime_add(\n cast( {{ from_date_or_timestamp }} as datetime),\n interval {{ interval }} {{ datepart }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.859356}, "macro.dbt_utils.postgres__dateadd": {"unique_id": "macro.dbt_utils.postgres__dateadd", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "postgres__dateadd", "macro_sql": "{% macro postgres__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n {{ from_date_or_timestamp }} + ((interval '1 {{ datepart }}') * ({{ interval }}))\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8597271}, "macro.dbt_utils.redshift__dateadd": {"unique_id": "macro.dbt_utils.redshift__dateadd", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "redshift__dateadd", "macro_sql": "{% macro redshift__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n {{ return(dbt_utils.default__dateadd(datepart, interval, from_date_or_timestamp)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.860342}, "macro.dbt_utils.intersect": {"unique_id": "macro.dbt_utils.intersect", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/intersect.sql", "original_file_path": "macros/cross_db_utils/intersect.sql", "name": "intersect", "macro_sql": "{% macro intersect() %}\n {{ return(adapter.dispatch('intersect', 'dbt_utils')()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__intersect"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.861022}, "macro.dbt_utils.default__intersect": {"unique_id": "macro.dbt_utils.default__intersect", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/intersect.sql", "original_file_path": "macros/cross_db_utils/intersect.sql", "name": "default__intersect", "macro_sql": "{% macro default__intersect() %}\n\n intersect\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8612669}, "macro.dbt_utils.bigquery__intersect": {"unique_id": "macro.dbt_utils.bigquery__intersect", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/intersect.sql", "original_file_path": "macros/cross_db_utils/intersect.sql", "name": "bigquery__intersect", "macro_sql": "{% macro bigquery__intersect() %}\n\n intersect distinct\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8615491}, "macro.dbt_utils.escape_single_quotes": {"unique_id": "macro.dbt_utils.escape_single_quotes", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/escape_single_quotes.sql", "original_file_path": "macros/cross_db_utils/escape_single_quotes.sql", "name": "escape_single_quotes", "macro_sql": "{% macro escape_single_quotes(expression) %}\n {{ return(adapter.dispatch('escape_single_quotes', 'dbt_utils') (expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__escape_single_quotes"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.862447}, "macro.dbt_utils.default__escape_single_quotes": {"unique_id": "macro.dbt_utils.default__escape_single_quotes", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/escape_single_quotes.sql", "original_file_path": "macros/cross_db_utils/escape_single_quotes.sql", "name": "default__escape_single_quotes", "macro_sql": "{% macro default__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\",\"''\") }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.862766}, "macro.dbt_utils.snowflake__escape_single_quotes": {"unique_id": "macro.dbt_utils.snowflake__escape_single_quotes", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/escape_single_quotes.sql", "original_file_path": "macros/cross_db_utils/escape_single_quotes.sql", "name": "snowflake__escape_single_quotes", "macro_sql": "{% macro snowflake__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\", \"\\\\'\") }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8631308}, "macro.dbt_utils.bigquery__escape_single_quotes": {"unique_id": "macro.dbt_utils.bigquery__escape_single_quotes", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/escape_single_quotes.sql", "original_file_path": "macros/cross_db_utils/escape_single_quotes.sql", "name": "bigquery__escape_single_quotes", "macro_sql": "{% macro bigquery__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\", \"\\\\'\") }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.863439}, "macro.dbt_utils.right": {"unique_id": "macro.dbt_utils.right", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "right", "macro_sql": "{% macro right(string_text, length_expression) -%}\n {{ return(adapter.dispatch('right', 'dbt_utils') (string_text, length_expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__right"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.864588}, "macro.dbt_utils.default__right": {"unique_id": "macro.dbt_utils.default__right", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "default__right", "macro_sql": "{% macro default__right(string_text, length_expression) %}\n\n right(\n {{ string_text }},\n {{ length_expression }}\n )\n \n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.86489}, "macro.dbt_utils.bigquery__right": {"unique_id": "macro.dbt_utils.bigquery__right", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "bigquery__right", "macro_sql": "{% macro bigquery__right(string_text, length_expression) %}\n\n case when {{ length_expression }} = 0 \n then ''\n else \n substr(\n {{ string_text }},\n -1 * ({{ length_expression }})\n )\n end\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8653288}, "macro.dbt_utils.snowflake__right": {"unique_id": "macro.dbt_utils.snowflake__right", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "snowflake__right", "macro_sql": "{% macro snowflake__right(string_text, length_expression) %}\n\n case when {{ length_expression }} = 0 \n then ''\n else \n right(\n {{ string_text }},\n {{ length_expression }}\n )\n end\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8656719}, "macro.dbt_utils.listagg": {"unique_id": "macro.dbt_utils.listagg", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/listagg.sql", "original_file_path": "macros/cross_db_utils/listagg.sql", "name": "listagg", "macro_sql": "{% macro listagg(measure, delimiter_text=\"','\", order_by_clause=none, limit_num=none) -%}\n {{ return(adapter.dispatch('listagg', 'dbt_utils') (measure, delimiter_text, order_by_clause, limit_num)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__listagg"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8695521}, "macro.dbt_utils.default__listagg": {"unique_id": "macro.dbt_utils.default__listagg", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/listagg.sql", "original_file_path": "macros/cross_db_utils/listagg.sql", "name": "default__listagg", "macro_sql": "{% macro default__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n\n {% if limit_num -%}\n array_to_string(\n array_slice(\n array_agg(\n {{ measure }}\n ){% if order_by_clause -%}\n within group ({{ order_by_clause }})\n {%- endif %}\n ,0\n ,{{ limit_num }}\n ),\n {{ delimiter_text }}\n )\n {%- else %}\n listagg(\n {{ measure }},\n {{ delimiter_text }}\n )\n {% if order_by_clause -%}\n within group ({{ order_by_clause }})\n {%- endif %}\n {%- endif %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.870634}, "macro.dbt_utils.bigquery__listagg": {"unique_id": "macro.dbt_utils.bigquery__listagg", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/listagg.sql", "original_file_path": "macros/cross_db_utils/listagg.sql", "name": "bigquery__listagg", "macro_sql": "{% macro bigquery__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n\n string_agg(\n {{ measure }},\n {{ delimiter_text }}\n {% if order_by_clause -%}\n {{ order_by_clause }}\n {%- endif %}\n {% if limit_num -%}\n limit {{ limit_num }}\n {%- endif %}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.87133}, "macro.dbt_utils.postgres__listagg": {"unique_id": "macro.dbt_utils.postgres__listagg", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/listagg.sql", "original_file_path": "macros/cross_db_utils/listagg.sql", "name": "postgres__listagg", "macro_sql": "{% macro postgres__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n \n {% if limit_num -%}\n array_to_string(\n (array_agg(\n {{ measure }}\n {% if order_by_clause -%}\n {{ order_by_clause }}\n {%- endif %}\n ))[1:{{ limit_num }}],\n {{ delimiter_text }}\n )\n {%- else %}\n string_agg(\n {{ measure }},\n {{ delimiter_text }}\n {% if order_by_clause -%}\n {{ order_by_clause }}\n {%- endif %}\n )\n {%- endif %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8723001}, "macro.dbt_utils.redshift__listagg": {"unique_id": "macro.dbt_utils.redshift__listagg", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/listagg.sql", "original_file_path": "macros/cross_db_utils/listagg.sql", "name": "redshift__listagg", "macro_sql": "{% macro redshift__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n\n {% if limit_num -%}\n {% set ns = namespace() %}\n {% set ns.delimiter_text_regex = delimiter_text|trim(\"'\") %}\n {% set special_chars %}\\,^,$,.,|,?,*,+,(,),[,],{,}{% endset %} \n {%- for char in special_chars.split(',') -%}\n {% set escape_char %}\\\\{{ char }}{% endset %}\n {% set ns.delimiter_text_regex = ns.delimiter_text_regex|replace(char,escape_char) %}\n {%- endfor -%}\n\n {% set regex %}'([^{{ ns.delimiter_text_regex }}]+{{ ns.delimiter_text_regex }}){1,{{ limit_num - 1}}}[^{{ ns.delimiter_text_regex }}]+'{% endset %}\n regexp_substr(\n listagg(\n {{ measure }},\n {{ delimiter_text }}\n )\n {% if order_by_clause -%}\n within group ({{ order_by_clause }})\n {%- endif %}\n ,{{ regex }}\n )\n {%- else %}\n listagg(\n {{ measure }},\n {{ delimiter_text }}\n )\n {% if order_by_clause -%}\n within group ({{ order_by_clause }})\n {%- endif %}\n {%- endif %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.874482}, "macro.dbt_utils.datediff": {"unique_id": "macro.dbt_utils.datediff", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "datediff", "macro_sql": "{% macro datediff(first_date, second_date, datepart) %}\n {{ return(adapter.dispatch('datediff', 'dbt_utils')(first_date, second_date, datepart)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.878845}, "macro.dbt_utils.default__datediff": {"unique_id": "macro.dbt_utils.default__datediff", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "default__datediff", "macro_sql": "{% macro default__datediff(first_date, second_date, datepart) -%}\n\n datediff(\n {{ datepart }},\n {{ first_date }},\n {{ second_date }}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.879251}, "macro.dbt_utils.bigquery__datediff": {"unique_id": "macro.dbt_utils.bigquery__datediff", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "bigquery__datediff", "macro_sql": "{% macro bigquery__datediff(first_date, second_date, datepart) -%}\n\n datetime_diff(\n cast({{second_date}} as datetime),\n cast({{first_date}} as datetime),\n {{datepart}}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.879638}, "macro.dbt_utils.postgres__datediff": {"unique_id": "macro.dbt_utils.postgres__datediff", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "postgres__datediff", "macro_sql": "{% macro postgres__datediff(first_date, second_date, datepart) -%}\n\n {% if datepart == 'year' %}\n (date_part('year', ({{second_date}})::date) - date_part('year', ({{first_date}})::date))\n {% elif datepart == 'quarter' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 4 + date_part('quarter', ({{second_date}})::date) - date_part('quarter', ({{first_date}})::date))\n {% elif datepart == 'month' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 12 + date_part('month', ({{second_date}})::date) - date_part('month', ({{first_date}})::date))\n {% elif datepart == 'day' %}\n (({{second_date}})::date - ({{first_date}})::date)\n {% elif datepart == 'week' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} / 7 + case\n when date_part('dow', ({{first_date}})::timestamp) <= date_part('dow', ({{second_date}})::timestamp) then\n case when {{first_date}} <= {{second_date}} then 0 else -1 end\n else\n case when {{first_date}} <= {{second_date}} then 1 else 0 end\n end)\n {% elif datepart == 'hour' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} * 24 + date_part('hour', ({{second_date}})::timestamp) - date_part('hour', ({{first_date}})::timestamp))\n {% elif datepart == 'minute' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'hour') }} * 60 + date_part('minute', ({{second_date}})::timestamp) - date_part('minute', ({{first_date}})::timestamp))\n {% elif datepart == 'second' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60 + floor(date_part('second', ({{second_date}})::timestamp)) - floor(date_part('second', ({{first_date}})::timestamp)))\n {% elif datepart == 'millisecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000 + floor(date_part('millisecond', ({{second_date}})::timestamp)) - floor(date_part('millisecond', ({{first_date}})::timestamp)))\n {% elif datepart == 'microsecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000000 + floor(date_part('microsecond', ({{second_date}})::timestamp)) - floor(date_part('microsecond', ({{first_date}})::timestamp)))\n {% else %}\n {{ exceptions.raise_compiler_error(\"Unsupported datepart for macro datediff in postgres: {!r}\".format(datepart)) }}\n {% endif %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.88371}, "macro.dbt_utils.redshift__datediff": {"unique_id": "macro.dbt_utils.redshift__datediff", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "redshift__datediff", "macro_sql": "{% macro redshift__datediff(first_date, second_date, datepart) -%}\n\n {{ return(dbt_utils.default__datediff(first_date, second_date, datepart)) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8842502}, "macro.dbt_utils.safe_cast": {"unique_id": "macro.dbt_utils.safe_cast", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "safe_cast", "macro_sql": "{% macro safe_cast(field, type) %}\n {{ return(adapter.dispatch('safe_cast', 'dbt_utils') (field, type)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__safe_cast"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.88512}, "macro.dbt_utils.default__safe_cast": {"unique_id": "macro.dbt_utils.default__safe_cast", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "default__safe_cast", "macro_sql": "{% macro default__safe_cast(field, type) %}\n {# most databases don't support this function yet\n so we just need to use cast #}\n cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.885442}, "macro.dbt_utils.snowflake__safe_cast": {"unique_id": "macro.dbt_utils.snowflake__safe_cast", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "snowflake__safe_cast", "macro_sql": "{% macro snowflake__safe_cast(field, type) %}\n try_cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.885739}, "macro.dbt_utils.bigquery__safe_cast": {"unique_id": "macro.dbt_utils.bigquery__safe_cast", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "bigquery__safe_cast", "macro_sql": "{% macro bigquery__safe_cast(field, type) %}\n safe_cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8860328}, "macro.dbt_utils.hash": {"unique_id": "macro.dbt_utils.hash", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/hash.sql", "original_file_path": "macros/cross_db_utils/hash.sql", "name": "hash", "macro_sql": "{% macro hash(field) -%}\n {{ return(adapter.dispatch('hash', 'dbt_utils') (field)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__hash"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.886764}, "macro.dbt_utils.default__hash": {"unique_id": "macro.dbt_utils.default__hash", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/hash.sql", "original_file_path": "macros/cross_db_utils/hash.sql", "name": "default__hash", "macro_sql": "{% macro default__hash(field) -%}\n md5(cast({{field}} as {{dbt_utils.type_string()}}))\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.887085}, "macro.dbt_utils.bigquery__hash": {"unique_id": "macro.dbt_utils.bigquery__hash", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/hash.sql", "original_file_path": "macros/cross_db_utils/hash.sql", "name": "bigquery__hash", "macro_sql": "{% macro bigquery__hash(field) -%}\n to_hex({{dbt_utils.default__hash(field)}})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__hash"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.887383}, "macro.dbt_utils.cast_bool_to_text": {"unique_id": "macro.dbt_utils.cast_bool_to_text", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_bool_to_text.sql", "original_file_path": "macros/cross_db_utils/cast_bool_to_text.sql", "name": "cast_bool_to_text", "macro_sql": "{% macro cast_bool_to_text(field) %}\n {{ adapter.dispatch('cast_bool_to_text', 'dbt_utils') (field) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.888136}, "macro.dbt_utils.default__cast_bool_to_text": {"unique_id": "macro.dbt_utils.default__cast_bool_to_text", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_bool_to_text.sql", "original_file_path": "macros/cross_db_utils/cast_bool_to_text.sql", "name": "default__cast_bool_to_text", "macro_sql": "{% macro default__cast_bool_to_text(field) %}\n cast({{ field }} as {{ dbt_utils.type_string() }})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.888463}, "macro.dbt_utils.redshift__cast_bool_to_text": {"unique_id": "macro.dbt_utils.redshift__cast_bool_to_text", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_bool_to_text.sql", "original_file_path": "macros/cross_db_utils/cast_bool_to_text.sql", "name": "redshift__cast_bool_to_text", "macro_sql": "{% macro redshift__cast_bool_to_text(field) %}\n case\n when {{ field }} is true then 'true'\n when {{ field }} is false then 'false'\n end::text\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.888872}, "macro.dbt_utils.identifier": {"unique_id": "macro.dbt_utils.identifier", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/identifier.sql", "original_file_path": "macros/cross_db_utils/identifier.sql", "name": "identifier", "macro_sql": "{% macro identifier(value) %}\t\n {%- set error_message = '\n Warning: the `identifier` macro is no longer supported and will be deprecated in a future release of dbt-utils. \\\n Use `adapter.quote` instead. The {}.{} model triggered this warning. \\\n '.format(model.package_name, model.name) -%}\n {%- do exceptions.warn(error_message) -%}\n {{ return(adapter.dispatch('identifier', 'dbt_utils') (value)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__identifier"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.889976}, "macro.dbt_utils.default__identifier": {"unique_id": "macro.dbt_utils.default__identifier", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/identifier.sql", "original_file_path": "macros/cross_db_utils/identifier.sql", "name": "default__identifier", "macro_sql": "{% macro default__identifier(value) -%}\t\n \"{{ value }}\"\t\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.890269}, "macro.dbt_utils.bigquery__identifier": {"unique_id": "macro.dbt_utils.bigquery__identifier", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/identifier.sql", "original_file_path": "macros/cross_db_utils/identifier.sql", "name": "bigquery__identifier", "macro_sql": "{% macro bigquery__identifier(value) -%}\t\n `{{ value }}`\t\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.890504}, "macro.dbt_utils.any_value": {"unique_id": "macro.dbt_utils.any_value", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/any_value.sql", "original_file_path": "macros/cross_db_utils/any_value.sql", "name": "any_value", "macro_sql": "{% macro any_value(expression) -%}\n {{ return(adapter.dispatch('any_value', 'dbt_utils') (expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__any_value"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.891444}, "macro.dbt_utils.default__any_value": {"unique_id": "macro.dbt_utils.default__any_value", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/any_value.sql", "original_file_path": "macros/cross_db_utils/any_value.sql", "name": "default__any_value", "macro_sql": "{% macro default__any_value(expression) -%}\n \n any_value({{ expression }})\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.89169}, "macro.dbt_utils.postgres__any_value": {"unique_id": "macro.dbt_utils.postgres__any_value", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/any_value.sql", "original_file_path": "macros/cross_db_utils/any_value.sql", "name": "postgres__any_value", "macro_sql": "{% macro postgres__any_value(expression) -%}\n {#- /*Postgres doesn't support any_value, so we're using min() to get the same result*/ -#}\n min({{ expression }})\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.89194}, "macro.dbt_utils.position": {"unique_id": "macro.dbt_utils.position", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/position.sql", "original_file_path": "macros/cross_db_utils/position.sql", "name": "position", "macro_sql": "{% macro position(substring_text, string_text) -%}\n {{ return(adapter.dispatch('position', 'dbt_utils') (substring_text, string_text)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__position"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.892998}, "macro.dbt_utils.default__position": {"unique_id": "macro.dbt_utils.default__position", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/position.sql", "original_file_path": "macros/cross_db_utils/position.sql", "name": "default__position", "macro_sql": "{% macro default__position(substring_text, string_text) %}\n\n position(\n {{ substring_text }} in {{ string_text }}\n )\n \n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.893316}, "macro.dbt_utils.bigquery__position": {"unique_id": "macro.dbt_utils.bigquery__position", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/position.sql", "original_file_path": "macros/cross_db_utils/position.sql", "name": "bigquery__position", "macro_sql": "{% macro bigquery__position(substring_text, string_text) %}\n\n strpos(\n {{ string_text }},\n {{ substring_text }}\n \n )\n \n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.89363}, "macro.dbt_utils.string_literal": {"unique_id": "macro.dbt_utils.string_literal", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/literal.sql", "original_file_path": "macros/cross_db_utils/literal.sql", "name": "string_literal", "macro_sql": "{%- macro string_literal(value) -%}\n {{ return(adapter.dispatch('string_literal', 'dbt_utils') (value)) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__string_literal"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8942962}, "macro.dbt_utils.default__string_literal": {"unique_id": "macro.dbt_utils.default__string_literal", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/literal.sql", "original_file_path": "macros/cross_db_utils/literal.sql", "name": "default__string_literal", "macro_sql": "{% macro default__string_literal(value) -%}\n '{{ value }}'\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.894537}, "macro.dbt_utils.current_timestamp": {"unique_id": "macro.dbt_utils.current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "current_timestamp", "macro_sql": "{% macro current_timestamp() -%}\n {{ return(adapter.dispatch('current_timestamp', 'dbt_utils')()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8957179}, "macro.dbt_utils.default__current_timestamp": {"unique_id": "macro.dbt_utils.default__current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "default__current_timestamp", "macro_sql": "{% macro default__current_timestamp() %}\n current_timestamp::{{dbt_utils.type_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.896032}, "macro.dbt_utils.redshift__current_timestamp": {"unique_id": "macro.dbt_utils.redshift__current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "redshift__current_timestamp", "macro_sql": "{% macro redshift__current_timestamp() %}\n getdate()\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.896242}, "macro.dbt_utils.bigquery__current_timestamp": {"unique_id": "macro.dbt_utils.bigquery__current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "bigquery__current_timestamp", "macro_sql": "{% macro bigquery__current_timestamp() %}\n current_timestamp\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.896422}, "macro.dbt_utils.current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "current_timestamp_in_utc", "macro_sql": "{% macro current_timestamp_in_utc() -%}\n {{ return(adapter.dispatch('current_timestamp_in_utc', 'dbt_utils')()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__current_timestamp_in_utc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8968031}, "macro.dbt_utils.default__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.default__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "default__current_timestamp_in_utc", "macro_sql": "{% macro default__current_timestamp_in_utc() %}\n {{dbt_utils.current_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.897119}, "macro.dbt_utils.snowflake__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.snowflake__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "snowflake__current_timestamp_in_utc", "macro_sql": "{% macro snowflake__current_timestamp_in_utc() %}\n convert_timezone('UTC', {{dbt_utils.current_timestamp()}})::{{dbt_utils.type_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.current_timestamp", "macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.897513}, "macro.dbt_utils.postgres__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.postgres__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "postgres__current_timestamp_in_utc", "macro_sql": "{% macro postgres__current_timestamp_in_utc() %}\n (current_timestamp at time zone 'utc')::{{dbt_utils.type_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8977642}, "macro.dbt_utils.redshift__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.redshift__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "redshift__current_timestamp_in_utc", "macro_sql": "{% macro redshift__current_timestamp_in_utc() %}\n {{ return(dbt_utils.default__current_timestamp_in_utc()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__current_timestamp_in_utc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.898277}, "macro.dbt_utils.width_bucket": {"unique_id": "macro.dbt_utils.width_bucket", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "width_bucket", "macro_sql": "{% macro width_bucket(expr, min_value, max_value, num_buckets) %}\n {{ return(adapter.dispatch('width_bucket', 'dbt_utils') (expr, min_value, max_value, num_buckets)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__width_bucket"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.900964}, "macro.dbt_utils.default__width_bucket": {"unique_id": "macro.dbt_utils.default__width_bucket", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "default__width_bucket", "macro_sql": "{% macro default__width_bucket(expr, min_value, max_value, num_buckets) -%}\n\n {% set bin_size -%}\n (( {{ max_value }} - {{ min_value }} ) / {{ num_buckets }} )\n {%- endset %}\n (\n -- to break ties when the amount is eaxtly at the bucket egde\n case\n when\n mod(\n {{ dbt_utils.safe_cast(expr, dbt_utils.type_numeric() ) }},\n {{ dbt_utils.safe_cast(bin_size, dbt_utils.type_numeric() ) }}\n ) = 0\n then 1\n else 0\n end\n ) +\n -- Anything over max_value goes the N+1 bucket\n least(\n ceil(\n ({{ expr }} - {{ min_value }})/{{ bin_size }}\n ),\n {{ num_buckets }} + 1\n )\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.safe_cast", "macro.dbt_utils.type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.902099}, "macro.dbt_utils.redshift__width_bucket": {"unique_id": "macro.dbt_utils.redshift__width_bucket", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "redshift__width_bucket", "macro_sql": "{% macro redshift__width_bucket(expr, min_value, max_value, num_buckets) -%}\n\n {% set bin_size -%}\n (( {{ max_value }} - {{ min_value }} ) / {{ num_buckets }} )\n {%- endset %}\n (\n -- to break ties when the amount is exactly at the bucket edge\n case\n when\n {{ dbt_utils.safe_cast(expr, dbt_utils.type_numeric() ) }} %\n {{ dbt_utils.safe_cast(bin_size, dbt_utils.type_numeric() ) }}\n = 0\n then 1\n else 0\n end\n ) +\n -- Anything over max_value goes the N+1 bucket\n least(\n ceil(\n ({{ expr }} - {{ min_value }})/{{ bin_size }}\n ),\n {{ num_buckets }} + 1\n )\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.safe_cast", "macro.dbt_utils.type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9031801}, "macro.dbt_utils.snowflake__width_bucket": {"unique_id": "macro.dbt_utils.snowflake__width_bucket", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "snowflake__width_bucket", "macro_sql": "{% macro snowflake__width_bucket(expr, min_value, max_value, num_buckets) %}\n width_bucket({{ expr }}, {{ min_value }}, {{ max_value }}, {{ num_buckets }} )\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.903709}, "macro.dbt_utils.array_concat": {"unique_id": "macro.dbt_utils.array_concat", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_concat.sql", "original_file_path": "macros/cross_db_utils/array_concat.sql", "name": "array_concat", "macro_sql": "{% macro array_concat(array_1, array_2) -%}\n {{ return(adapter.dispatch('array_concat', 'dbt_utils')(array_1, array_2)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__array_concat"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.904598}, "macro.dbt_utils.default__array_concat": {"unique_id": "macro.dbt_utils.default__array_concat", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_concat.sql", "original_file_path": "macros/cross_db_utils/array_concat.sql", "name": "default__array_concat", "macro_sql": "{% macro default__array_concat(array_1, array_2) -%}\n array_cat({{ array_1 }}, {{ array_2 }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9049401}, "macro.dbt_utils.bigquery__array_concat": {"unique_id": "macro.dbt_utils.bigquery__array_concat", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_concat.sql", "original_file_path": "macros/cross_db_utils/array_concat.sql", "name": "bigquery__array_concat", "macro_sql": "{% macro bigquery__array_concat(array_1, array_2) -%}\n array_concat({{ array_1 }}, {{ array_2 }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9052339}, "macro.dbt_utils.redshift__array_concat": {"unique_id": "macro.dbt_utils.redshift__array_concat", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_concat.sql", "original_file_path": "macros/cross_db_utils/array_concat.sql", "name": "redshift__array_concat", "macro_sql": "{% macro redshift__array_concat(array_1, array_2) -%}\n array_concat({{ array_1 }}, {{ array_2 }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9056718}, "macro.dbt_utils.bool_or": {"unique_id": "macro.dbt_utils.bool_or", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/bool_or.sql", "original_file_path": "macros/cross_db_utils/bool_or.sql", "name": "bool_or", "macro_sql": "{% macro bool_or(expression) -%}\n {{ return(adapter.dispatch('bool_or', 'dbt_utils') (expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__bool_or"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9065652}, "macro.dbt_utils.default__bool_or": {"unique_id": "macro.dbt_utils.default__bool_or", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/bool_or.sql", "original_file_path": "macros/cross_db_utils/bool_or.sql", "name": "default__bool_or", "macro_sql": "{% macro default__bool_or(expression) -%}\n \n bool_or({{ expression }})\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.906803}, "macro.dbt_utils.snowflake__bool_or": {"unique_id": "macro.dbt_utils.snowflake__bool_or", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/bool_or.sql", "original_file_path": "macros/cross_db_utils/bool_or.sql", "name": "snowflake__bool_or", "macro_sql": "{% macro snowflake__bool_or(expression) -%}\n \n boolor_agg({{ expression }})\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.907153}, "macro.dbt_utils.bigquery__bool_or": {"unique_id": "macro.dbt_utils.bigquery__bool_or", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/bool_or.sql", "original_file_path": "macros/cross_db_utils/bool_or.sql", "name": "bigquery__bool_or", "macro_sql": "{% macro bigquery__bool_or(expression) -%}\n \n logical_or({{ expression }})\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.907391}, "macro.dbt_utils.last_day": {"unique_id": "macro.dbt_utils.last_day", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "last_day", "macro_sql": "{% macro last_day(date, datepart) %}\n {{ return(adapter.dispatch('last_day', 'dbt_utils') (date, datepart)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.908513}, "macro.dbt_utils.default_last_day": {"unique_id": "macro.dbt_utils.default_last_day", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "default_last_day", "macro_sql": "\n\n\n{%- macro default_last_day(date, datepart) -%}\n cast(\n {{dbt_utils.dateadd('day', '-1',\n dbt_utils.dateadd(datepart, '1', dbt_utils.date_trunc(datepart, date))\n )}}\n as date)\n{%- endmacro -%}\n\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd", "macro.dbt_utils.date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.90909}, "macro.dbt_utils.default__last_day": {"unique_id": "macro.dbt_utils.default__last_day", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "default__last_day", "macro_sql": "{% macro default__last_day(date, datepart) -%}\n {{dbt_utils.default_last_day(date, datepart)}}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default_last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.909568}, "macro.dbt_utils.postgres__last_day": {"unique_id": "macro.dbt_utils.postgres__last_day", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "postgres__last_day", "macro_sql": "{% macro postgres__last_day(date, datepart) -%}\n\n {%- if datepart == 'quarter' -%}\n -- postgres dateadd does not support quarter interval.\n cast(\n {{dbt_utils.dateadd('day', '-1',\n dbt_utils.dateadd('month', '3', dbt_utils.date_trunc(datepart, date))\n )}}\n as date)\n {%- else -%}\n {{dbt_utils.default_last_day(date, datepart)}}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd", "macro.dbt_utils.date_trunc", "macro.dbt_utils.default_last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9107032}, "macro.dbt_utils.redshift__last_day": {"unique_id": "macro.dbt_utils.redshift__last_day", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "redshift__last_day", "macro_sql": "{% macro redshift__last_day(date, datepart) %}\n\n {{ return(dbt_utils.default__last_day(date, datepart)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.911197}, "macro.dbt_utils.split_part": {"unique_id": "macro.dbt_utils.split_part", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "split_part", "macro_sql": "{% macro split_part(string_text, delimiter_text, part_number) %}\n {{ return(adapter.dispatch('split_part', 'dbt_utils') (string_text, delimiter_text, part_number)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__split_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.914127}, "macro.dbt_utils.default__split_part": {"unique_id": "macro.dbt_utils.default__split_part", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "default__split_part", "macro_sql": "{% macro default__split_part(string_text, delimiter_text, part_number) %}\n\n split_part(\n {{ string_text }},\n {{ delimiter_text }},\n {{ part_number }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.914508}, "macro.dbt_utils._split_part_negative": {"unique_id": "macro.dbt_utils._split_part_negative", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "_split_part_negative", "macro_sql": "{% macro _split_part_negative(string_text, delimiter_text, part_number) %}\n\n split_part(\n {{ string_text }},\n {{ delimiter_text }},\n length({{ string_text }}) \n - length(\n replace({{ string_text }}, {{ delimiter_text }}, '')\n ) + 2 {{ part_number }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9150279}, "macro.dbt_utils.postgres__split_part": {"unique_id": "macro.dbt_utils.postgres__split_part", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "postgres__split_part", "macro_sql": "{% macro postgres__split_part(string_text, delimiter_text, part_number) %}\n\n {% if part_number >= 0 %}\n {{ dbt_utils.default__split_part(string_text, delimiter_text, part_number) }}\n {% else %}\n {{ dbt_utils._split_part_negative(string_text, delimiter_text, part_number) }}\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__split_part", "macro.dbt_utils._split_part_negative"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.915762}, "macro.dbt_utils.redshift__split_part": {"unique_id": "macro.dbt_utils.redshift__split_part", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "redshift__split_part", "macro_sql": "{% macro redshift__split_part(string_text, delimiter_text, part_number) %}\n\n {% if part_number >= 0 %}\n {{ dbt_utils.default__split_part(string_text, delimiter_text, part_number) }}\n {% else %}\n {{ dbt_utils._split_part_negative(string_text, delimiter_text, part_number) }}\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__split_part", "macro.dbt_utils._split_part_negative"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.916502}, "macro.dbt_utils.bigquery__split_part": {"unique_id": "macro.dbt_utils.bigquery__split_part", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "bigquery__split_part", "macro_sql": "{% macro bigquery__split_part(string_text, delimiter_text, part_number) %}\n\n {% if part_number >= 0 %}\n split(\n {{ string_text }},\n {{ delimiter_text }}\n )[safe_offset({{ part_number - 1 }})]\n {% else %}\n split(\n {{ string_text }},\n {{ delimiter_text }}\n )[safe_offset(\n length({{ string_text }}) \n - length(\n replace({{ string_text }}, {{ delimiter_text }}, '')\n ) + 1\n )]\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9174259}, "macro.dbt_utils.date_trunc": {"unique_id": "macro.dbt_utils.date_trunc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/date_trunc.sql", "original_file_path": "macros/cross_db_utils/date_trunc.sql", "name": "date_trunc", "macro_sql": "{% macro date_trunc(datepart, date) -%}\n {{ return(adapter.dispatch('date_trunc', 'dbt_utils') (datepart, date)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.918459}, "macro.dbt_utils.default__date_trunc": {"unique_id": "macro.dbt_utils.default__date_trunc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/date_trunc.sql", "original_file_path": "macros/cross_db_utils/date_trunc.sql", "name": "default__date_trunc", "macro_sql": "{% macro default__date_trunc(datepart, date) -%}\n date_trunc('{{datepart}}', {{date}})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.918753}, "macro.dbt_utils.bigquery__date_trunc": {"unique_id": "macro.dbt_utils.bigquery__date_trunc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/date_trunc.sql", "original_file_path": "macros/cross_db_utils/date_trunc.sql", "name": "bigquery__date_trunc", "macro_sql": "{% macro bigquery__date_trunc(datepart, date) -%}\n timestamp_trunc(\n cast({{date}} as timestamp),\n {{datepart}}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9190478}, "macro.dbt_utils.array_construct": {"unique_id": "macro.dbt_utils.array_construct", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_construct.sql", "original_file_path": "macros/cross_db_utils/array_construct.sql", "name": "array_construct", "macro_sql": "{% macro array_construct(inputs = [], data_type = api.Column.translate_type('integer')) -%}\n {{ return(adapter.dispatch('array_construct', 'dbt_utils')(inputs, data_type)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__array_construct"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9205031}, "macro.dbt_utils.default__array_construct": {"unique_id": "macro.dbt_utils.default__array_construct", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_construct.sql", "original_file_path": "macros/cross_db_utils/array_construct.sql", "name": "default__array_construct", "macro_sql": "{% macro default__array_construct(inputs, data_type) -%}\n {% if inputs|length > 0 %}\n array[ {{ inputs|join(' , ') }} ]\n {% else %}\n array[]::{{data_type}}[]\n {% endif %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.921035}, "macro.dbt_utils.snowflake__array_construct": {"unique_id": "macro.dbt_utils.snowflake__array_construct", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_construct.sql", "original_file_path": "macros/cross_db_utils/array_construct.sql", "name": "snowflake__array_construct", "macro_sql": "{% macro snowflake__array_construct(inputs, data_type) -%}\n array_construct( {{ inputs|join(' , ') }} )\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.92144}, "macro.dbt_utils.redshift__array_construct": {"unique_id": "macro.dbt_utils.redshift__array_construct", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_construct.sql", "original_file_path": "macros/cross_db_utils/array_construct.sql", "name": "redshift__array_construct", "macro_sql": "{% macro redshift__array_construct(inputs, data_type) -%}\n array( {{ inputs|join(' , ') }} )\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9217489}, "macro.dbt_utils.bigquery__array_construct": {"unique_id": "macro.dbt_utils.bigquery__array_construct", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_construct.sql", "original_file_path": "macros/cross_db_utils/array_construct.sql", "name": "bigquery__array_construct", "macro_sql": "{% macro bigquery__array_construct(inputs, data_type) -%}\n [ {{ inputs|join(' , ') }} ]\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.922132}, "macro.dbt_utils._is_ephemeral": {"unique_id": "macro.dbt_utils._is_ephemeral", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/_is_ephemeral.sql", "original_file_path": "macros/cross_db_utils/_is_ephemeral.sql", "name": "_is_ephemeral", "macro_sql": "{% macro _is_ephemeral(obj, macro) %}\n {%- if obj.is_cte -%}\n {% set ephemeral_prefix = api.Relation.add_ephemeral_prefix('') %}\n {% if obj.name.startswith(ephemeral_prefix) %}\n {% set model_name = obj.name[(ephemeral_prefix|length):] %}\n {% else %}\n {% set model_name = obj.name %}\n {%- endif -%}\n {% set error_message %}\nThe `{{ macro }}` macro cannot be used with ephemeral models, as it relies on the information schema.\n\n`{{ model_name }}` is an ephemeral model. Consider making it a view or table instead.\n {% endset %}\n {%- do exceptions.raise_compiler_error(error_message) -%}\n {%- endif -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.924188}, "macro.dbt_utils.array_append": {"unique_id": "macro.dbt_utils.array_append", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_append.sql", "original_file_path": "macros/cross_db_utils/array_append.sql", "name": "array_append", "macro_sql": "{% macro array_append(array, new_element) -%}\n {{ return(adapter.dispatch('array_append', 'dbt_utils')(array, new_element)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__array_append"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.92538}, "macro.dbt_utils.default__array_append": {"unique_id": "macro.dbt_utils.default__array_append", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_append.sql", "original_file_path": "macros/cross_db_utils/array_append.sql", "name": "default__array_append", "macro_sql": "{% macro default__array_append(array, new_element) -%}\n array_append({{ array }}, {{ new_element }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.925693}, "macro.dbt_utils.bigquery__array_append": {"unique_id": "macro.dbt_utils.bigquery__array_append", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_append.sql", "original_file_path": "macros/cross_db_utils/array_append.sql", "name": "bigquery__array_append", "macro_sql": "{% macro bigquery__array_append(array, new_element) -%}\n {{ dbt_utils.array_concat(array, dbt_utils.array_construct([new_element])) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.array_concat", "macro.dbt_utils.array_construct"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.926136}, "macro.dbt_utils.redshift__array_append": {"unique_id": "macro.dbt_utils.redshift__array_append", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_append.sql", "original_file_path": "macros/cross_db_utils/array_append.sql", "name": "redshift__array_append", "macro_sql": "{% macro redshift__array_append(array, new_element) -%}\n {{ dbt_utils.array_concat(array, dbt_utils.array_construct([new_element])) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.array_concat", "macro.dbt_utils.array_construct"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9265401}, "macro.dbt_utils.get_period_boundaries": {"unique_id": "macro.dbt_utils.get_period_boundaries", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "get_period_boundaries", "macro_sql": "{% macro get_period_boundaries(target_schema, target_table, timestamp_field, start_date, stop_date, period) -%}\n {{ return(adapter.dispatch('get_period_boundaries', 'dbt_utils')(target_schema, target_table, timestamp_field, start_date, stop_date, period)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_period_boundaries"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.937341}, "macro.dbt_utils.default__get_period_boundaries": {"unique_id": "macro.dbt_utils.default__get_period_boundaries", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "default__get_period_boundaries", "macro_sql": "{% macro default__get_period_boundaries(target_schema, target_table, timestamp_field, start_date, stop_date, period) -%}\n\n {% call statement('period_boundaries', fetch_result=True) -%}\n with data as (\n select\n coalesce(max(\"{{timestamp_field}}\"), '{{start_date}}')::timestamp as start_timestamp,\n coalesce(\n {{dbt_utils.dateadd('millisecond',\n -1,\n \"nullif('\" ~ stop_date ~ \"','')::timestamp\")}},\n {{dbt_utils.current_timestamp()}}\n ) as stop_timestamp\n from \"{{target_schema}}\".\"{{target_table}}\"\n )\n\n select\n start_timestamp,\n stop_timestamp,\n {{dbt_utils.datediff('start_timestamp',\n 'stop_timestamp',\n period)}} + 1 as num_periods\n from data\n {%- endcall %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.dateadd", "macro.dbt_utils.current_timestamp", "macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9388}, "macro.dbt_utils.get_period_sql": {"unique_id": "macro.dbt_utils.get_period_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "get_period_sql", "macro_sql": "{% macro get_period_sql(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset) -%}\n {{ return(adapter.dispatch('get_period_sql', 'dbt_utils')(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_period_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.939666}, "macro.dbt_utils.default__get_period_sql": {"unique_id": "macro.dbt_utils.default__get_period_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "default__get_period_sql", "macro_sql": "{% macro default__get_period_sql(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset) -%}\n\n {%- set period_filter -%}\n (\"{{timestamp_field}}\" > '{{start_timestamp}}'::timestamp + interval '{{offset}} {{period}}' and\n \"{{timestamp_field}}\" <= '{{start_timestamp}}'::timestamp + interval '{{offset}} {{period}}' + interval '1 {{period}}' and\n \"{{timestamp_field}}\" < '{{stop_timestamp}}'::timestamp)\n {%- endset -%}\n\n {%- set filtered_sql = sql | replace(\"__PERIOD_FILTER__\", period_filter) -%}\n\n select\n {{target_cols_csv}}\n from (\n {{filtered_sql}}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.940771}, "macro.dbt_utils.materialization_insert_by_period_default": {"unique_id": "macro.dbt_utils.materialization_insert_by_period_default", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "materialization_insert_by_period_default", "macro_sql": "{% materialization insert_by_period, default -%}\n {%- set timestamp_field = config.require('timestamp_field') -%}\n {%- set start_date = config.require('start_date') -%}\n {%- set stop_date = config.get('stop_date') or '' -%}\n {%- set period = config.get('period') or 'week' -%}\n\n {%- if sql.find('__PERIOD_FILTER__') == -1 -%}\n {%- set error_message -%}\n Model '{{ model.unique_id }}' does not include the required string '__PERIOD_FILTER__' in its sql\n {%- endset -%}\n {{ exceptions.raise_compiler_error(error_message) }}\n {%- endif -%}\n\n {%- set identifier = model['name'] -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier, schema=schema, type='table') -%}\n\n {%- set non_destructive_mode = (flags.NON_DESTRUCTIVE == True) -%}\n {%- set full_refresh_mode = (flags.FULL_REFRESH == True) -%}\n\n {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n {%- set exists_not_as_table = (old_relation is not none and not old_relation.is_table) -%}\n\n {%- set should_truncate = (non_destructive_mode and full_refresh_mode and exists_as_table) -%}\n {%- set should_drop = (not should_truncate and (full_refresh_mode or exists_not_as_table)) -%}\n {%- set force_create = (flags.FULL_REFRESH and not flags.NON_DESTRUCTIVE) -%}\n\n -- setup\n {% if old_relation is none -%}\n -- noop\n {%- elif should_truncate -%}\n {{adapter.truncate_relation(old_relation)}}\n {%- elif should_drop -%}\n {{adapter.drop_relation(old_relation)}}\n {%- set old_relation = none -%}\n {%- endif %}\n\n {{run_hooks(pre_hooks, inside_transaction=False)}}\n\n -- `begin` happens here, so `commit` after it to finish the transaction\n {{run_hooks(pre_hooks, inside_transaction=True)}}\n {% call statement() -%}\n begin; -- make extra sure we've closed out the transaction\n commit;\n {%- endcall %}\n\n -- build model\n {% if force_create or old_relation is none -%}\n {# Create an empty target table -#}\n {% call statement('main') -%}\n {%- set empty_sql = sql | replace(\"__PERIOD_FILTER__\", 'false') -%}\n {{create_table_as(False, target_relation, empty_sql)}}\n {%- endcall %}\n {%- endif %}\n\n {% set _ = dbt_utils.get_period_boundaries(schema,\n identifier,\n timestamp_field,\n start_date,\n stop_date,\n period) %}\n {%- set start_timestamp = load_result('period_boundaries')['data'][0][0] | string -%}\n {%- set stop_timestamp = load_result('period_boundaries')['data'][0][1] | string -%}\n {%- set num_periods = load_result('period_boundaries')['data'][0][2] | int -%}\n\n {% set target_columns = adapter.get_columns_in_relation(target_relation) %}\n {%- set target_cols_csv = target_columns | map(attribute='quoted') | join(', ') -%}\n {%- set loop_vars = {'sum_rows_inserted': 0} -%}\n\n -- commit each period as a separate transaction\n {% for i in range(num_periods) -%}\n {%- set msg = \"Running for \" ~ period ~ \" \" ~ (i + 1) ~ \" of \" ~ (num_periods) -%}\n {{ dbt_utils.log_info(msg) }}\n\n {%- set tmp_identifier = model['name'] ~ '__dbt_incremental_period' ~ i ~ '_tmp' -%}\n {%- set tmp_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema, type='table') -%}\n {% call statement() -%}\n {% set tmp_table_sql = dbt_utils.get_period_sql(target_cols_csv,\n sql,\n timestamp_field,\n period,\n start_timestamp,\n stop_timestamp,\n i) %}\n {{dbt.create_table_as(True, tmp_relation, tmp_table_sql)}}\n {%- endcall %}\n\n {{adapter.expand_target_column_types(from_relation=tmp_relation,\n to_relation=target_relation)}}\n {%- set name = 'main-' ~ i -%}\n {% call statement(name, fetch_result=True) -%}\n insert into {{target_relation}} ({{target_cols_csv}})\n (\n select\n {{target_cols_csv}}\n from {{tmp_relation.include(schema=False)}}\n );\n {%- endcall %}\n {% set result = load_result('main-' ~ i) %}\n {% if 'response' in result.keys() %} {# added in v0.19.0 #}\n {% set rows_inserted = result['response']['rows_affected'] %}\n {% else %} {# older versions #}\n {% set rows_inserted = result['status'].split(\" \")[2] | int %}\n {% endif %}\n \n {%- set sum_rows_inserted = loop_vars['sum_rows_inserted'] + rows_inserted -%}\n {%- if loop_vars.update({'sum_rows_inserted': sum_rows_inserted}) %} {% endif -%}\n\n {%- set msg = \"Ran for \" ~ period ~ \" \" ~ (i + 1) ~ \" of \" ~ (num_periods) ~ \"; \" ~ rows_inserted ~ \" records inserted\" -%}\n {{ dbt_utils.log_info(msg) }}\n\n {%- endfor %}\n\n {% call statement() -%}\n begin;\n {%- endcall %}\n\n {{run_hooks(post_hooks, inside_transaction=True)}}\n\n {% call statement() -%}\n commit;\n {%- endcall %}\n\n {{run_hooks(post_hooks, inside_transaction=False)}}\n\n {%- set status_string = \"INSERT \" ~ loop_vars['sum_rows_inserted'] -%}\n\n {% call noop_statement('main', status_string) -%}\n -- no-op\n {%- endcall %}\n\n -- Return the relations created in this materialization\n {{ return({'relations': [target_relation]}) }} \n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt_utils.get_period_boundaries", "macro.dbt_utils.log_info", "macro.dbt_utils.get_period_sql", "macro.dbt.noop_statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9539251}, "macro.dbt_utils.get_url_host": {"unique_id": "macro.dbt_utils.get_url_host", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "name": "get_url_host", "macro_sql": "{% macro get_url_host(field) -%}\n {{ return(adapter.dispatch('get_url_host', 'dbt_utils')(field)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_url_host"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.954814}, "macro.dbt_utils.default__get_url_host": {"unique_id": "macro.dbt_utils.default__get_url_host", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "name": "default__get_url_host", "macro_sql": "{% macro default__get_url_host(field) -%}\n\n{%- set parsed =\n dbt_utils.split_part(\n dbt_utils.split_part(\n dbt_utils.replace(\n dbt_utils.replace(\n dbt_utils.replace(field, \"'android-app://'\", \"''\"\n ), \"'http://'\", \"''\"\n ), \"'https://'\", \"''\"\n ), \"'/'\", 1\n ), \"'?'\", 1\n )\n\n-%}\n\n\n {{ dbt_utils.safe_cast(\n parsed,\n dbt_utils.type_string()\n )}}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.split_part", "macro.dbt_utils.replace", "macro.dbt_utils.safe_cast", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.955887}, "macro.dbt_utils.get_url_path": {"unique_id": "macro.dbt_utils.get_url_path", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "name": "get_url_path", "macro_sql": "{% macro get_url_path(field) -%}\n {{ return(adapter.dispatch('get_url_path', 'dbt_utils')(field)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_url_path"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.956893}, "macro.dbt_utils.default__get_url_path": {"unique_id": "macro.dbt_utils.default__get_url_path", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "name": "default__get_url_path", "macro_sql": "{% macro default__get_url_path(field) -%}\n\n {%- set stripped_url = \n dbt_utils.replace(\n dbt_utils.replace(field, \"'http://'\", \"''\"), \"'https://'\", \"''\")\n -%}\n\n {%- set first_slash_pos -%}\n coalesce(\n nullif({{dbt_utils.position(\"'/'\", stripped_url)}}, 0),\n {{dbt_utils.position(\"'?'\", stripped_url)}} - 1\n )\n {%- endset -%}\n\n {%- set parsed_path =\n dbt_utils.split_part(\n dbt_utils.right(\n stripped_url, \n dbt_utils.length(stripped_url) ~ \"-\" ~ first_slash_pos\n ), \n \"'?'\", 1\n )\n -%}\n\n {{ dbt_utils.safe_cast(\n parsed_path,\n dbt_utils.type_string()\n )}}\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.replace", "macro.dbt_utils.position", "macro.dbt_utils.split_part", "macro.dbt_utils.right", "macro.dbt_utils.length", "macro.dbt_utils.safe_cast", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9583611}, "macro.dbt_utils.get_url_parameter": {"unique_id": "macro.dbt_utils.get_url_parameter", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "name": "get_url_parameter", "macro_sql": "{% macro get_url_parameter(field, url_parameter) -%}\n {{ return(adapter.dispatch('get_url_parameter', 'dbt_utils')(field, url_parameter)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_url_parameter"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9591732}, "macro.dbt_utils.default__get_url_parameter": {"unique_id": "macro.dbt_utils.default__get_url_parameter", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "name": "default__get_url_parameter", "macro_sql": "{% macro default__get_url_parameter(field, url_parameter) -%}\n\n{%- set formatted_url_parameter = \"'\" + url_parameter + \"='\" -%}\n\n{%- set split = dbt_utils.split_part(dbt_utils.split_part(field, formatted_url_parameter, 2), \"'&'\", 1) -%}\n\nnullif({{ split }},'')\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.split_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.960279}, "macro.dbt_utils.test_fewer_rows_than": {"unique_id": "macro.dbt_utils.test_fewer_rows_than", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/fewer_rows_than.sql", "original_file_path": "macros/generic_tests/fewer_rows_than.sql", "name": "test_fewer_rows_than", "macro_sql": "{% test fewer_rows_than(model, compare_model) %}\n {{ return(adapter.dispatch('test_fewer_rows_than', 'dbt_utils')(model, compare_model)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_fewer_rows_than"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.961407}, "macro.dbt_utils.default__test_fewer_rows_than": {"unique_id": "macro.dbt_utils.default__test_fewer_rows_than", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/fewer_rows_than.sql", "original_file_path": "macros/generic_tests/fewer_rows_than.sql", "name": "default__test_fewer_rows_than", "macro_sql": "{% macro default__test_fewer_rows_than(model, compare_model) %}\n\n{{ config(fail_calc = 'coalesce(row_count_delta, 0)') }}\n\nwith a as (\n\n select count(*) as count_our_model from {{ model }}\n\n),\nb as (\n\n select count(*) as count_comparison_model from {{ compare_model }}\n\n),\ncounts as (\n\n select\n count_our_model,\n count_comparison_model\n from a\n cross join b\n\n),\nfinal as (\n\n select *,\n case\n -- fail the test if we have more rows than the reference model and return the row count delta\n when count_our_model > count_comparison_model then (count_our_model - count_comparison_model)\n -- fail the test if they are the same number\n when count_our_model = count_comparison_model then 1\n -- pass the test if the delta is positive (i.e. return the number 0)\n else 0\n end as row_count_delta\n from counts\n\n)\n\nselect * from final\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.961885}, "macro.dbt_utils.test_equal_rowcount": {"unique_id": "macro.dbt_utils.test_equal_rowcount", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/equal_rowcount.sql", "original_file_path": "macros/generic_tests/equal_rowcount.sql", "name": "test_equal_rowcount", "macro_sql": "{% test equal_rowcount(model, compare_model) %}\n {{ return(adapter.dispatch('test_equal_rowcount', 'dbt_utils')(model, compare_model)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_equal_rowcount"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9628632}, "macro.dbt_utils.default__test_equal_rowcount": {"unique_id": "macro.dbt_utils.default__test_equal_rowcount", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/equal_rowcount.sql", "original_file_path": "macros/generic_tests/equal_rowcount.sql", "name": "default__test_equal_rowcount", "macro_sql": "{% macro default__test_equal_rowcount(model, compare_model) %}\n\n{#-- Needs to be set at parse time, before we return '' below --#}\n{{ config(fail_calc = 'coalesce(diff_count, 0)') }}\n\n{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n{%- if not execute -%}\n {{ return('') }}\n{% endif %}\n\nwith a as (\n\n select count(*) as count_a from {{ model }}\n\n),\nb as (\n\n select count(*) as count_b from {{ compare_model }}\n\n),\nfinal as (\n\n select\n count_a,\n count_b,\n abs(count_a - count_b) as diff_count\n from a\n cross join b\n\n)\n\nselect * from final\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.963586}, "macro.dbt_utils.test_relationships_where": {"unique_id": "macro.dbt_utils.test_relationships_where", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/relationships_where.sql", "original_file_path": "macros/generic_tests/relationships_where.sql", "name": "test_relationships_where", "macro_sql": "{% test relationships_where(model, column_name, to, field, from_condition=\"1=1\", to_condition=\"1=1\") %}\n {{ return(adapter.dispatch('test_relationships_where', 'dbt_utils')(model, column_name, to, field, from_condition, to_condition)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_relationships_where"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.96519}, "macro.dbt_utils.default__test_relationships_where": {"unique_id": "macro.dbt_utils.default__test_relationships_where", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/relationships_where.sql", "original_file_path": "macros/generic_tests/relationships_where.sql", "name": "default__test_relationships_where", "macro_sql": "{% macro default__test_relationships_where(model, column_name, to, field, from_condition=\"1=1\", to_condition=\"1=1\") %}\n\n{# T-SQL has no boolean data type so we use 1=1 which returns TRUE #}\n{# ref https://stackoverflow.com/a/7170753/3842610 #}\n\nwith left_table as (\n\n select\n {{column_name}} as id\n\n from {{model}}\n\n where {{column_name}} is not null\n and {{from_condition}}\n\n),\n\nright_table as (\n\n select\n {{field}} as id\n\n from {{to}}\n\n where {{field}} is not null\n and {{to_condition}}\n\n),\n\nexceptions as (\n\n select\n left_table.id,\n right_table.id as right_id\n\n from left_table\n\n left join right_table\n on left_table.id = right_table.id\n\n where right_table.id is null\n\n)\n\nselect * from exceptions\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9659982}, "macro.dbt_utils.test_recency": {"unique_id": "macro.dbt_utils.test_recency", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/recency.sql", "original_file_path": "macros/generic_tests/recency.sql", "name": "test_recency", "macro_sql": "{% test recency(model, field, datepart, interval) %}\n {{ return(adapter.dispatch('test_recency', 'dbt_utils')(model, field, datepart, interval)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_recency"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.966948}, "macro.dbt_utils.default__test_recency": {"unique_id": "macro.dbt_utils.default__test_recency", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/recency.sql", "original_file_path": "macros/generic_tests/recency.sql", "name": "default__test_recency", "macro_sql": "{% macro default__test_recency(model, field, datepart, interval) %}\n\n{% set threshold = dbt_utils.dateadd(datepart, interval * -1, dbt_utils.current_timestamp()) %}\n\nwith recency as (\n\n select max({{field}}) as most_recent\n from {{ model }}\n\n)\n\nselect\n\n most_recent,\n {{ threshold }} as threshold\n\nfrom recency\nwhere most_recent < {{ threshold }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd", "macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.967665}, "macro.dbt_utils.test_not_constant": {"unique_id": "macro.dbt_utils.test_not_constant", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/not_constant.sql", "original_file_path": "macros/generic_tests/not_constant.sql", "name": "test_not_constant", "macro_sql": "{% test not_constant(model, column_name) %}\n {{ return(adapter.dispatch('test_not_constant', 'dbt_utils')(model, column_name)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_not_constant"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.968647}, "macro.dbt_utils.default__test_not_constant": {"unique_id": "macro.dbt_utils.default__test_not_constant", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/not_constant.sql", "original_file_path": "macros/generic_tests/not_constant.sql", "name": "default__test_not_constant", "macro_sql": "{% macro default__test_not_constant(model, column_name) %}\n\n\nselect\n {# In TSQL, subquery aggregate columns need aliases #}\n {# thus: a filler col name, 'filler_column' #}\n count(distinct {{ column_name }}) as filler_column\n\nfrom {{ model }}\n\nhaving count(distinct {{ column_name }}) = 1\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.969538}, "macro.dbt_utils.test_accepted_range": {"unique_id": "macro.dbt_utils.test_accepted_range", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/accepted_range.sql", "original_file_path": "macros/generic_tests/accepted_range.sql", "name": "test_accepted_range", "macro_sql": "{% test accepted_range(model, column_name, min_value=none, max_value=none, inclusive=true) %}\n {{ return(adapter.dispatch('test_accepted_range', 'dbt_utils')(model, column_name, min_value, max_value, inclusive)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_accepted_range"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.971262}, "macro.dbt_utils.default__test_accepted_range": {"unique_id": "macro.dbt_utils.default__test_accepted_range", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/accepted_range.sql", "original_file_path": "macros/generic_tests/accepted_range.sql", "name": "default__test_accepted_range", "macro_sql": "{% macro default__test_accepted_range(model, column_name, min_value=none, max_value=none, inclusive=true) %}\n\nwith meet_condition as(\n select *\n from {{ model }}\n),\n\nvalidation_errors as (\n select *\n from meet_condition\n where\n -- never true, defaults to an empty result set. Exists to ensure any combo of the `or` clauses below succeeds\n 1 = 2\n\n {%- if min_value is not none %}\n -- records with a value >= min_value are permitted. The `not` flips this to find records that don't meet the rule.\n or not {{ column_name }} > {{- \"=\" if inclusive }} {{ min_value }}\n {%- endif %}\n\n {%- if max_value is not none %}\n -- records with a value <= max_value are permitted. The `not` flips this to find records that don't meet the rule.\n or not {{ column_name }} < {{- \"=\" if inclusive }} {{ max_value }}\n {%- endif %}\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.972639}, "macro.dbt_utils.test_not_accepted_values": {"unique_id": "macro.dbt_utils.test_not_accepted_values", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/not_accepted_values.sql", "original_file_path": "macros/generic_tests/not_accepted_values.sql", "name": "test_not_accepted_values", "macro_sql": "{% test not_accepted_values(model, column_name, values, quote=True) %}\n {{ return(adapter.dispatch('test_not_accepted_values', 'dbt_utils')(model, column_name, values, quote)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_not_accepted_values"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.973919}, "macro.dbt_utils.default__test_not_accepted_values": {"unique_id": "macro.dbt_utils.default__test_not_accepted_values", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/not_accepted_values.sql", "original_file_path": "macros/generic_tests/not_accepted_values.sql", "name": "default__test_not_accepted_values", "macro_sql": "{% macro default__test_not_accepted_values(model, column_name, values, quote=True) %}\nwith all_values as (\n\n select distinct\n {{ column_name }} as value_field\n\n from {{ model }}\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field in (\n {% for value in values -%}\n {% if quote -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {%- endfor %}\n )\n\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.974889}, "macro.dbt_utils.test_unique_where": {"unique_id": "macro.dbt_utils.test_unique_where", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/test_unique_where.sql", "original_file_path": "macros/generic_tests/test_unique_where.sql", "name": "test_unique_where", "macro_sql": "{% test unique_where(model, column_name) %}\r\n {%- set deprecation_warning = '\r\n Warning: `dbt_utils.unique_where` is no longer supported.\r\n Starting in dbt v0.20.0, the built-in `unique` test supports a `where` config.\r\n ' -%}\r\n {%- do exceptions.warn(deprecation_warning) -%}\r\n {{ return(adapter.dispatch('test_unique_where', 'dbt_utils')(model, column_name)) }}\r\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_unique_where"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.975876}, "macro.dbt_utils.default__test_unique_where": {"unique_id": "macro.dbt_utils.default__test_unique_where", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/test_unique_where.sql", "original_file_path": "macros/generic_tests/test_unique_where.sql", "name": "default__test_unique_where", "macro_sql": "{% macro default__test_unique_where(model, column_name) %}\r\n {{ return(test_unique(model, column_name)) }}\r\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.test_unique"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.976248}, "macro.dbt_utils.test_at_least_one": {"unique_id": "macro.dbt_utils.test_at_least_one", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/at_least_one.sql", "original_file_path": "macros/generic_tests/at_least_one.sql", "name": "test_at_least_one", "macro_sql": "{% test at_least_one(model, column_name) %}\n {{ return(adapter.dispatch('test_at_least_one', 'dbt_utils')(model, column_name)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_at_least_one"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.97712}, "macro.dbt_utils.default__test_at_least_one": {"unique_id": "macro.dbt_utils.default__test_at_least_one", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/at_least_one.sql", "original_file_path": "macros/generic_tests/at_least_one.sql", "name": "default__test_at_least_one", "macro_sql": "{% macro default__test_at_least_one(model, column_name) %}\n\nselect *\nfrom (\n select\n {# In TSQL, subquery aggregate columns need aliases #}\n {# thus: a filler col name, 'filler_column' #}\n count({{ column_name }}) as filler_column\n\n from {{ model }}\n\n having count({{ column_name }}) = 0\n\n) validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.977612}, "macro.dbt_utils.test_unique_combination_of_columns": {"unique_id": "macro.dbt_utils.test_unique_combination_of_columns", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/unique_combination_of_columns.sql", "original_file_path": "macros/generic_tests/unique_combination_of_columns.sql", "name": "test_unique_combination_of_columns", "macro_sql": "{% test unique_combination_of_columns(model, combination_of_columns, quote_columns=false) %}\n {{ return(adapter.dispatch('test_unique_combination_of_columns', 'dbt_utils')(model, combination_of_columns, quote_columns)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_unique_combination_of_columns"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.979168}, "macro.dbt_utils.default__test_unique_combination_of_columns": {"unique_id": "macro.dbt_utils.default__test_unique_combination_of_columns", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/unique_combination_of_columns.sql", "original_file_path": "macros/generic_tests/unique_combination_of_columns.sql", "name": "default__test_unique_combination_of_columns", "macro_sql": "{% macro default__test_unique_combination_of_columns(model, combination_of_columns, quote_columns=false) %}\n\n{% if not quote_columns %}\n {%- set column_list=combination_of_columns %}\n{% elif quote_columns %}\n {%- set column_list=[] %}\n {% for column in combination_of_columns -%}\n {% set column_list = column_list.append( adapter.quote(column) ) %}\n {%- endfor %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`quote_columns` argument for unique_combination_of_columns test must be one of [True, False] Got: '\" ~ quote ~\"'.'\"\n ) }}\n{% endif %}\n\n{%- set columns_csv=column_list | join(', ') %}\n\n\nwith validation_errors as (\n\n select\n {{ columns_csv }}\n from {{ model }}\n group by {{ columns_csv }}\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.980979}, "macro.dbt_utils.test_cardinality_equality": {"unique_id": "macro.dbt_utils.test_cardinality_equality", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/cardinality_equality.sql", "original_file_path": "macros/generic_tests/cardinality_equality.sql", "name": "test_cardinality_equality", "macro_sql": "{% test cardinality_equality(model, column_name, to, field) %}\n {{ return(adapter.dispatch('test_cardinality_equality', 'dbt_utils')(model, column_name, to, field)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_cardinality_equality"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9823868}, "macro.dbt_utils.default__test_cardinality_equality": {"unique_id": "macro.dbt_utils.default__test_cardinality_equality", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/cardinality_equality.sql", "original_file_path": "macros/generic_tests/cardinality_equality.sql", "name": "default__test_cardinality_equality", "macro_sql": "{% macro default__test_cardinality_equality(model, column_name, to, field) %}\n\n{# T-SQL does not let you use numbers as aliases for columns #}\n{# Thus, no \"GROUP BY 1\" #}\n\nwith table_a as (\nselect\n {{ column_name }},\n count(*) as num_rows\nfrom {{ model }}\ngroup by {{ column_name }}\n),\n\ntable_b as (\nselect\n {{ field }},\n count(*) as num_rows\nfrom {{ to }}\ngroup by {{ field }}\n),\n\nexcept_a as (\n select *\n from table_a\n {{ dbt_utils.except() }}\n select *\n from table_b\n),\n\nexcept_b as (\n select *\n from table_b\n {{ dbt_utils.except() }}\n select *\n from table_a\n),\n\nunioned as (\n select *\n from except_a\n union all\n select *\n from except_b\n)\n\nselect *\nfrom unioned\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.except"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.983357}, "macro.dbt_utils.test_expression_is_true": {"unique_id": "macro.dbt_utils.test_expression_is_true", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/expression_is_true.sql", "original_file_path": "macros/generic_tests/expression_is_true.sql", "name": "test_expression_is_true", "macro_sql": "{% test expression_is_true(model, expression, column_name=None, condition='1=1') %}\n{# T-SQL has no boolean data type so we use 1=1 which returns TRUE #}\n{# ref https://stackoverflow.com/a/7170753/3842610 #}\n {{ return(adapter.dispatch('test_expression_is_true', 'dbt_utils')(model, expression, column_name, condition)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.984442}, "macro.dbt_utils.default__test_expression_is_true": {"unique_id": "macro.dbt_utils.default__test_expression_is_true", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/expression_is_true.sql", "original_file_path": "macros/generic_tests/expression_is_true.sql", "name": "default__test_expression_is_true", "macro_sql": "{% macro default__test_expression_is_true(model, expression, column_name, condition) %}\n\nwith meet_condition as (\n select * from {{ model }} where {{ condition }}\n)\n\nselect\n *\nfrom meet_condition\n{% if column_name is none %}\nwhere not({{ expression }})\n{%- else %}\nwhere not({{ column_name }} {{ expression }})\n{%- endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.985152}, "macro.dbt_utils.test_not_null_proportion": {"unique_id": "macro.dbt_utils.test_not_null_proportion", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/not_null_proportion.sql", "original_file_path": "macros/generic_tests/not_null_proportion.sql", "name": "test_not_null_proportion", "macro_sql": "{% macro test_not_null_proportion(model) %}\n {{ return(adapter.dispatch('test_not_null_proportion', 'dbt_utils')(model, **kwargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_not_null_proportion"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.986133}, "macro.dbt_utils.default__test_not_null_proportion": {"unique_id": "macro.dbt_utils.default__test_not_null_proportion", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/not_null_proportion.sql", "original_file_path": "macros/generic_tests/not_null_proportion.sql", "name": "default__test_not_null_proportion", "macro_sql": "{% macro default__test_not_null_proportion(model) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}\n{% set at_least = kwargs.get('at_least', kwargs.get('arg')) %}\n{% set at_most = kwargs.get('at_most', kwargs.get('arg', 1)) %}\n\nwith validation as (\n select\n sum(case when {{ column_name }} is null then 0 else 1 end) / cast(count(*) as numeric) as not_null_proportion\n from {{ model }}\n),\nvalidation_errors as (\n select\n not_null_proportion\n from validation\n where not_null_proportion < {{ at_least }} or not_null_proportion > {{ at_most }}\n)\nselect\n *\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.987484}, "macro.dbt_utils.test_sequential_values": {"unique_id": "macro.dbt_utils.test_sequential_values", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/sequential_values.sql", "original_file_path": "macros/generic_tests/sequential_values.sql", "name": "test_sequential_values", "macro_sql": "{% test sequential_values(model, column_name, interval=1, datepart=None) %}\n\n {{ return(adapter.dispatch('test_sequential_values', 'dbt_utils')(model, column_name, interval, datepart)) }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_sequential_values"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9894311}, "macro.dbt_utils.default__test_sequential_values": {"unique_id": "macro.dbt_utils.default__test_sequential_values", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/sequential_values.sql", "original_file_path": "macros/generic_tests/sequential_values.sql", "name": "default__test_sequential_values", "macro_sql": "{% macro default__test_sequential_values(model, column_name, interval=1, datepart=None) %}\n\n{% set previous_column_name = \"previous_\" ~ dbt_utils.slugify(column_name) %}\n\nwith windowed as (\n\n select\n {{ column_name }},\n lag({{ column_name }}) over (\n order by {{ column_name }}\n ) as {{ previous_column_name }}\n from {{ model }}\n),\n\nvalidation_errors as (\n select\n *\n from windowed\n {% if datepart %}\n where not(cast({{ column_name }} as {{ dbt_utils.type_timestamp() }})= cast({{ dbt_utils.dateadd(datepart, interval, previous_column_name) }} as {{ dbt_utils.type_timestamp() }}))\n {% else %}\n where not({{ column_name }} = {{ previous_column_name }} + {{ interval }})\n {% endif %}\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.slugify", "macro.dbt_utils.type_timestamp", "macro.dbt_utils.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.990914}, "macro.dbt_utils.test_not_null_where": {"unique_id": "macro.dbt_utils.test_not_null_where", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/test_not_null_where.sql", "original_file_path": "macros/generic_tests/test_not_null_where.sql", "name": "test_not_null_where", "macro_sql": "{% test not_null_where(model, column_name) %}\r\n {%- set deprecation_warning = '\r\n Warning: `dbt_utils.not_null_where` is no longer supported.\r\n Starting in dbt v0.20.0, the built-in `not_null` test supports a `where` config.\r\n ' -%}\r\n {%- do exceptions.warn(deprecation_warning) -%}\r\n {{ return(adapter.dispatch('test_not_null_where', 'dbt_utils')(model, column_name)) }}\r\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_not_null_where"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.992269}, "macro.dbt_utils.default__test_not_null_where": {"unique_id": "macro.dbt_utils.default__test_not_null_where", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/test_not_null_where.sql", "original_file_path": "macros/generic_tests/test_not_null_where.sql", "name": "default__test_not_null_where", "macro_sql": "{% macro default__test_not_null_where(model, column_name) %}\r\n {{ return(test_not_null(model, column_name)) }}\r\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.test_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.992722}, "macro.dbt_utils.test_equality": {"unique_id": "macro.dbt_utils.test_equality", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/equality.sql", "original_file_path": "macros/generic_tests/equality.sql", "name": "test_equality", "macro_sql": "{% test equality(model, compare_model, compare_columns=None) %}\n {{ return(adapter.dispatch('test_equality', 'dbt_utils')(model, compare_model, compare_columns)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_equality"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9944441}, "macro.dbt_utils.default__test_equality": {"unique_id": "macro.dbt_utils.default__test_equality", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/equality.sql", "original_file_path": "macros/generic_tests/equality.sql", "name": "default__test_equality", "macro_sql": "{% macro default__test_equality(model, compare_model, compare_columns=None) %}\n\n{% set set_diff %}\n count(*) + coalesce(abs(\n sum(case when which_diff = 'a_minus_b' then 1 else 0 end) -\n sum(case when which_diff = 'b_minus_a' then 1 else 0 end)\n ), 0)\n{% endset %}\n\n{#-- Needs to be set at parse time, before we return '' below --#}\n{{ config(fail_calc = set_diff) }}\n\n{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n{%- if not execute -%}\n {{ return('') }}\n{% endif %}\n\n-- setup\n{%- do dbt_utils._is_relation(model, 'test_equality') -%}\n\n{#-\nIf the compare_cols arg is provided, we can run this test without querying the\ninformation schema\u00a0\u2014 this allows the model to be an ephemeral model\n-#}\n\n{%- if not compare_columns -%}\n {%- do dbt_utils._is_ephemeral(model, 'test_equality') -%}\n {%- set compare_columns = adapter.get_columns_in_relation(model) | map(attribute='quoted') -%}\n{%- endif -%}\n\n{% set compare_cols_csv = compare_columns | join(', ') %}\n\nwith a as (\n\n select * from {{ model }}\n\n),\n\nb as (\n\n select * from {{ compare_model }}\n\n),\n\na_minus_b as (\n\n select {{compare_cols_csv}} from a\n {{ dbt_utils.except() }}\n select {{compare_cols_csv}} from b\n\n),\n\nb_minus_a as (\n\n select {{compare_cols_csv}} from b\n {{ dbt_utils.except() }}\n select {{compare_cols_csv}} from a\n\n),\n\nunioned as (\n\n select 'a_minus_b' as which_diff, a_minus_b.* from a_minus_b\n union all\n select 'b_minus_a' as which_diff, b_minus_a.* from b_minus_a\n\n)\n\nselect * from unioned\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.except"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9968488}, "macro.dbt_utils.test_mutually_exclusive_ranges": {"unique_id": "macro.dbt_utils.test_mutually_exclusive_ranges", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/mutually_exclusive_ranges.sql", "original_file_path": "macros/generic_tests/mutually_exclusive_ranges.sql", "name": "test_mutually_exclusive_ranges", "macro_sql": "{% test mutually_exclusive_ranges(model, lower_bound_column, upper_bound_column, partition_by=None, gaps='allowed', zero_length_range_allowed=False) %}\n {{ return(adapter.dispatch('test_mutually_exclusive_ranges', 'dbt_utils')(model, lower_bound_column, upper_bound_column, partition_by, gaps, zero_length_range_allowed)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_mutually_exclusive_ranges"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.003118}, "macro.dbt_utils.default__test_mutually_exclusive_ranges": {"unique_id": "macro.dbt_utils.default__test_mutually_exclusive_ranges", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/mutually_exclusive_ranges.sql", "original_file_path": "macros/generic_tests/mutually_exclusive_ranges.sql", "name": "default__test_mutually_exclusive_ranges", "macro_sql": "{% macro default__test_mutually_exclusive_ranges(model, lower_bound_column, upper_bound_column, partition_by=None, gaps='allowed', zero_length_range_allowed=False) %}\n{% if gaps == 'not_allowed' %}\n {% set allow_gaps_operator='=' %}\n {% set allow_gaps_operator_in_words='equal_to' %}\n{% elif gaps == 'allowed' %}\n {% set allow_gaps_operator='<=' %}\n {% set allow_gaps_operator_in_words='less_than_or_equal_to' %}\n{% elif gaps == 'required' %}\n {% set allow_gaps_operator='<' %}\n {% set allow_gaps_operator_in_words='less_than' %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`gaps` argument for mutually_exclusive_ranges test must be one of ['not_allowed', 'allowed', 'required'] Got: '\" ~ gaps ~\"'.'\"\n ) }}\n{% endif %}\n{% if not zero_length_range_allowed %}\n {% set allow_zero_length_operator='<' %}\n {% set allow_zero_length_operator_in_words='less_than' %}\n{% elif zero_length_range_allowed %}\n {% set allow_zero_length_operator='<=' %}\n {% set allow_zero_length_operator_in_words='less_than_or_equal_to' %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`zero_length_range_allowed` argument for mutually_exclusive_ranges test must be one of [true, false] Got: '\" ~ zero_length_range_allowed ~\"'.'\"\n ) }}\n{% endif %}\n\n{% set partition_clause=\"partition by \" ~ partition_by if partition_by else '' %}\n\nwith window_functions as (\n\n select\n {% if partition_by %}\n {{ partition_by }} as partition_by_col,\n {% endif %}\n {{ lower_bound_column }} as lower_bound,\n {{ upper_bound_column }} as upper_bound,\n\n lead({{ lower_bound_column }}) over (\n {{ partition_clause }}\n order by {{ lower_bound_column }}\n ) as next_lower_bound,\n\n row_number() over (\n {{ partition_clause }}\n order by {{ lower_bound_column }} desc\n ) = 1 as is_last_record\n\n from {{ model }}\n\n),\n\ncalc as (\n -- We want to return records where one of our assumptions fails, so we'll use\n -- the `not` function with `and` statements so we can write our assumptions nore cleanly\n select\n *,\n\n -- For each record: lower_bound should be < upper_bound.\n -- Coalesce it to return an error on the null case (implicit assumption\n -- these columns are not_null)\n coalesce(\n lower_bound {{ allow_zero_length_operator }} upper_bound,\n false\n ) as lower_bound_{{ allow_zero_length_operator_in_words }}_upper_bound,\n\n -- For each record: upper_bound {{ allow_gaps_operator }} the next lower_bound.\n -- Coalesce it to handle null cases for the last record.\n coalesce(\n upper_bound {{ allow_gaps_operator }} next_lower_bound,\n is_last_record,\n false\n ) as upper_bound_{{ allow_gaps_operator_in_words }}_next_lower_bound\n\n from window_functions\n\n),\n\nvalidation_errors as (\n\n select\n *\n from calc\n\n where not(\n -- THE FOLLOWING SHOULD BE TRUE --\n lower_bound_{{ allow_zero_length_operator_in_words }}_upper_bound\n and upper_bound_{{ allow_gaps_operator_in_words }}_next_lower_bound\n )\n)\n\nselect * from validation_errors\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.007039}, "macro.dbt_utils.pretty_log_format": {"unique_id": "macro.dbt_utils.pretty_log_format", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_log_format.sql", "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", "name": "pretty_log_format", "macro_sql": "{% macro pretty_log_format(message) %}\n {{ return(adapter.dispatch('pretty_log_format', 'dbt_utils')(message)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__pretty_log_format"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.007905}, "macro.dbt_utils.default__pretty_log_format": {"unique_id": "macro.dbt_utils.default__pretty_log_format", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_log_format.sql", "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", "name": "default__pretty_log_format", "macro_sql": "{% macro default__pretty_log_format(message) %}\n {{ return( dbt_utils.pretty_time() ~ ' + ' ~ message) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.pretty_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.008466}, "macro.dbt_utils.pretty_time": {"unique_id": "macro.dbt_utils.pretty_time", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_time.sql", "original_file_path": "macros/jinja_helpers/pretty_time.sql", "name": "pretty_time", "macro_sql": "{% macro pretty_time(format='%H:%M:%S') %}\n {{ return(adapter.dispatch('pretty_time', 'dbt_utils')(format)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__pretty_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0092978}, "macro.dbt_utils.default__pretty_time": {"unique_id": "macro.dbt_utils.default__pretty_time", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_time.sql", "original_file_path": "macros/jinja_helpers/pretty_time.sql", "name": "default__pretty_time", "macro_sql": "{% macro default__pretty_time(format='%H:%M:%S') %}\n {{ return(modules.datetime.datetime.now().strftime(format)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.009784}, "macro.dbt_utils.log_info": {"unique_id": "macro.dbt_utils.log_info", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/log_info.sql", "original_file_path": "macros/jinja_helpers/log_info.sql", "name": "log_info", "macro_sql": "{% macro log_info(message) %}\n {{ return(adapter.dispatch('log_info', 'dbt_utils')(message)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__log_info"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.010505}, "macro.dbt_utils.default__log_info": {"unique_id": "macro.dbt_utils.default__log_info", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/log_info.sql", "original_file_path": "macros/jinja_helpers/log_info.sql", "name": "default__log_info", "macro_sql": "{% macro default__log_info(message) %}\n {{ log(dbt_utils.pretty_log_format(message), info=True) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.pretty_log_format"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.01089}, "macro.dbt_utils.slugify": {"unique_id": "macro.dbt_utils.slugify", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/slugify.sql", "original_file_path": "macros/jinja_helpers/slugify.sql", "name": "slugify", "macro_sql": "{% macro slugify(string) %}\n\n{#- Lower case the string -#}\n{% set string = string | lower %}\n{#- Replace spaces and dashes with underscores -#}\n{% set string = modules.re.sub('[ -]+', '_', string) %}\n{#- Only take letters, numbers, and underscores -#}\n{% set string = modules.re.sub('[^a-z0-9_]+', '', string) %}\n\n{{ return(string) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.012007}, "macro.dbt_utils.get_intervals_between": {"unique_id": "macro.dbt_utils.get_intervals_between", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "get_intervals_between", "macro_sql": "{% macro get_intervals_between(start_date, end_date, datepart) -%}\n {{ return(adapter.dispatch('get_intervals_between', 'dbt_utils')(start_date, end_date, datepart)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_intervals_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.013667}, "macro.dbt_utils.default__get_intervals_between": {"unique_id": "macro.dbt_utils.default__get_intervals_between", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "default__get_intervals_between", "macro_sql": "{% macro default__get_intervals_between(start_date, end_date, datepart) -%}\n {%- call statement('get_intervals_between', fetch_result=True) %}\n\n select {{dbt_utils.datediff(start_date, end_date, datepart)}}\n\n {%- endcall -%}\n\n {%- set value_list = load_result('get_intervals_between') -%}\n\n {%- if value_list and value_list['data'] -%}\n {%- set values = value_list['data'] | map(attribute=0) | list %}\n {{ return(values[0]) }}\n {%- else -%}\n {{ return(1) }}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.01524}, "macro.dbt_utils.date_spine": {"unique_id": "macro.dbt_utils.date_spine", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "date_spine", "macro_sql": "{% macro date_spine(datepart, start_date, end_date) %}\n {{ return(adapter.dispatch('date_spine', 'dbt_utils')(datepart, start_date, end_date)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__date_spine"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.015785}, "macro.dbt_utils.default__date_spine": {"unique_id": "macro.dbt_utils.default__date_spine", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "default__date_spine", "macro_sql": "{% macro default__date_spine(datepart, start_date, end_date) %}\n\n\n{# call as follows:\n\ndate_spine(\n \"day\",\n \"to_date('01/01/2016', 'mm/dd/yyyy')\",\n \"dateadd(week, 1, current_date)\"\n) #}\n\n\nwith rawdata as (\n\n {{dbt_utils.generate_series(\n dbt_utils.get_intervals_between(start_date, end_date, datepart)\n )}}\n\n),\n\nall_periods as (\n\n select (\n {{\n dbt_utils.dateadd(\n datepart,\n \"row_number() over (order by 1) - 1\",\n start_date\n )\n }}\n ) as date_{{datepart}}\n from rawdata\n\n),\n\nfiltered as (\n\n select *\n from all_periods\n where date_{{datepart}} <= {{ end_date }}\n\n)\n\nselect * from filtered\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.generate_series", "macro.dbt_utils.get_intervals_between", "macro.dbt_utils.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0165749}, "macro.dbt_utils.nullcheck_table": {"unique_id": "macro.dbt_utils.nullcheck_table", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "name": "nullcheck_table", "macro_sql": "{% macro nullcheck_table(relation) %}\n {{ return(adapter.dispatch('nullcheck_table', 'dbt_utils')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__nullcheck_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.017339}, "macro.dbt_utils.default__nullcheck_table": {"unique_id": "macro.dbt_utils.default__nullcheck_table", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "name": "default__nullcheck_table", "macro_sql": "{% macro default__nullcheck_table(relation) %}\n\n {%- do dbt_utils._is_relation(relation, 'nullcheck_table') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'nullcheck_table') -%}\n {% set cols = adapter.get_columns_in_relation(relation) %}\n\n select {{ dbt_utils.nullcheck(cols) }}\n from {{relation}}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.nullcheck"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.018104}, "macro.dbt_utils.get_relations_by_pattern": {"unique_id": "macro.dbt_utils.get_relations_by_pattern", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "name": "get_relations_by_pattern", "macro_sql": "{% macro get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_relations_by_pattern', 'dbt_utils')(schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.019514}, "macro.dbt_utils.default__get_relations_by_pattern": {"unique_id": "macro.dbt_utils.default__get_relations_by_pattern", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "name": "default__get_relations_by_pattern", "macro_sql": "{% macro default__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n {{ dbt_utils.get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude, database) }}\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=database,\n schema=row.table_schema,\n identifier=row.table_name,\n type=row.table_type\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0215948}, "macro.dbt_utils.get_powers_of_two": {"unique_id": "macro.dbt_utils.get_powers_of_two", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "get_powers_of_two", "macro_sql": "{% macro get_powers_of_two(upper_bound) %}\n {{ return(adapter.dispatch('get_powers_of_two', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0231218}, "macro.dbt_utils.default__get_powers_of_two": {"unique_id": "macro.dbt_utils.default__get_powers_of_two", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "default__get_powers_of_two", "macro_sql": "{% macro default__get_powers_of_two(upper_bound) %}\n\n {% if upper_bound <= 0 %}\n {{ exceptions.raise_compiler_error(\"upper bound must be positive\") }}\n {% endif %}\n\n {% for _ in range(1, 100) %}\n {% if upper_bound <= 2 ** loop.index %}{{ return(loop.index) }}{% endif %}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.024134}, "macro.dbt_utils.generate_series": {"unique_id": "macro.dbt_utils.generate_series", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "generate_series", "macro_sql": "{% macro generate_series(upper_bound) %}\n {{ return(adapter.dispatch('generate_series', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__generate_series"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.024555}, "macro.dbt_utils.default__generate_series": {"unique_id": "macro.dbt_utils.default__generate_series", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "default__generate_series", "macro_sql": "{% macro default__generate_series(upper_bound) %}\n\n {% set n = dbt_utils.get_powers_of_two(upper_bound) %}\n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n {% for i in range(n) %}\n p{{i}}.generated_number * power(2, {{i}})\n {% if not loop.last %} + {% endif %}\n {% endfor %}\n + 1\n as generated_number\n\n from\n\n {% for i in range(n) %}\n p as p{{i}}\n {% if not loop.last %} cross join {% endif %}\n {% endfor %}\n\n )\n\n select *\n from unioned\n where generated_number <= {{upper_bound}}\n order by generated_number\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.025716}, "macro.dbt_utils.get_relations_by_prefix": {"unique_id": "macro.dbt_utils.get_relations_by_prefix", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "name": "get_relations_by_prefix", "macro_sql": "{% macro get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_relations_by_prefix', 'dbt_utils')(schema, prefix, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_relations_by_prefix"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.027084}, "macro.dbt_utils.default__get_relations_by_prefix": {"unique_id": "macro.dbt_utils.default__get_relations_by_prefix", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "name": "default__get_relations_by_prefix", "macro_sql": "{% macro default__get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n {{ dbt_utils.get_tables_by_prefix_sql(schema, prefix, exclude, database) }}\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=database,\n schema=row.table_schema,\n identifier=row.table_name,\n type=row.table_type\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.get_tables_by_prefix_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0290701}, "macro.dbt_utils.get_tables_by_prefix_sql": {"unique_id": "macro.dbt_utils.get_tables_by_prefix_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "name": "get_tables_by_prefix_sql", "macro_sql": "{% macro get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_tables_by_prefix_sql', 'dbt_utils')(schema, prefix, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_tables_by_prefix_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.030064}, "macro.dbt_utils.default__get_tables_by_prefix_sql": {"unique_id": "macro.dbt_utils.default__get_tables_by_prefix_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "name": "default__get_tables_by_prefix_sql", "macro_sql": "{% macro default__get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n\n {{ dbt_utils.get_tables_by_pattern_sql(\n schema_pattern = schema,\n table_pattern = prefix ~ '%',\n exclude = exclude,\n database = database\n ) }}\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.030706}, "macro.dbt_utils.star": {"unique_id": "macro.dbt_utils.star", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "name": "star", "macro_sql": "{% macro star(from, relation_alias=False, except=[], prefix='', suffix='') -%}\n {{ return(adapter.dispatch('star', 'dbt_utils')(from, relation_alias, except, prefix, suffix)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__star"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.032268}, "macro.dbt_utils.default__star": {"unique_id": "macro.dbt_utils.default__star", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "name": "default__star", "macro_sql": "{% macro default__star(from, relation_alias=False, except=[], prefix='', suffix='') -%}\n {%- do dbt_utils._is_relation(from, 'star') -%}\n {%- do dbt_utils._is_ephemeral(from, 'star') -%}\n\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {{ return('*') }}\n {% endif %}\n\n {% set cols = dbt_utils.get_filtered_columns_in_relation(from, except) %}\n\n {%- if cols|length <= 0 -%}\n {{- return('*') -}}\n {%- else -%}\n {%- for col in cols %}\n {%- if relation_alias %}{{ relation_alias }}.{% else %}{%- endif -%}{{ adapter.quote(col)|trim }} {%- if prefix!='' or suffix!='' %} as {{ adapter.quote(prefix ~ col ~ suffix)|trim }} {%- endif -%}\n {%- if not loop.last %},{{ '\\n ' }}{% endif %}\n {%- endfor -%}\n {% endif %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.get_filtered_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.034687}, "macro.dbt_utils.unpivot": {"unique_id": "macro.dbt_utils.unpivot", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "name": "unpivot", "macro_sql": "{% macro unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value', table=none) -%}\n {{ return(adapter.dispatch('unpivot', 'dbt_utils')(relation, cast_to, exclude, remove, field_name, value_name, table)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__unpivot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0376298}, "macro.dbt_utils.default__unpivot": {"unique_id": "macro.dbt_utils.default__unpivot", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "name": "default__unpivot", "macro_sql": "{% macro default__unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value', table=none) -%}\n\n {% if table %}\n {%- set error_message = '\n Warning: the `unpivot` macro no longer accepts a `table` parameter. \\\n This parameter will be deprecated in a future release of dbt-utils. Use the `relation` parameter instead. \\\n The {}.{} model triggered this warning. \\\n '.format(model.package_name, model.name) -%}\n {%- do exceptions.warn(error_message) -%}\n {% endif %}\n\n {% if relation and table %}\n {{ exceptions.raise_compiler_error(\"Error: both the `relation` and `table` parameters were provided to `unpivot` macro. Choose one only (we recommend `relation`).\") }}\n {% elif not relation and table %}\n {% set relation=table %}\n {% elif not relation and not table %}\n {{ exceptions.raise_compiler_error(\"Error: argument `relation` is required for `unpivot` macro.\") }}\n {% endif %}\n\n {%- set exclude = exclude if exclude is not none else [] %}\n {%- set remove = remove if remove is not none else [] %}\n\n {%- set include_cols = [] %}\n\n {%- set table_columns = {} %}\n\n {%- do table_columns.update({relation: []}) %}\n\n {%- do dbt_utils._is_relation(relation, 'unpivot') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'unpivot') -%}\n {%- set cols = adapter.get_columns_in_relation(relation) %}\n\n {%- for col in cols -%}\n {%- if col.column.lower() not in remove|map('lower') and col.column.lower() not in exclude|map('lower') -%}\n {% do include_cols.append(col) %}\n {%- endif %}\n {%- endfor %}\n\n\n {%- for col in include_cols -%}\n select\n {%- for exclude_col in exclude %}\n {{ exclude_col }},\n {%- endfor %}\n\n cast('{{ col.column }}' as {{ dbt_utils.type_string() }}) as {{ field_name }},\n cast( {% if col.data_type == 'boolean' %}\n {{ dbt_utils.cast_bool_to_text(col.column) }}\n {% else %}\n {{ col.column }}\n {% endif %}\n as {{ cast_to }}) as {{ value_name }}\n\n from {{ relation }}\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n {%- endfor -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.type_string", "macro.dbt_utils.cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.042538}, "macro.dbt_utils.union_relations": {"unique_id": "macro.dbt_utils.union_relations", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "name": "union_relations", "macro_sql": "{%- macro union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation', where=none) -%}\n {{ return(adapter.dispatch('union_relations', 'dbt_utils')(relations, column_override, include, exclude, source_column_name, where)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__union_relations"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0480692}, "macro.dbt_utils.default__union_relations": {"unique_id": "macro.dbt_utils.default__union_relations", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "name": "default__union_relations", "macro_sql": "\n\n{%- macro default__union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation', where=none) -%}\n\n {%- if exclude and include -%}\n {{ exceptions.raise_compiler_error(\"Both an exclude and include list were provided to the `union` macro. Only one is allowed\") }}\n {%- endif -%}\n\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. -#}\n {%- if not execute %}\n {{ return('') }}\n {% endif -%}\n\n {%- set column_override = column_override if column_override is not none else {} -%}\n\n {%- set relation_columns = {} -%}\n {%- set column_superset = {} -%}\n\n {%- for relation in relations -%}\n\n {%- do relation_columns.update({relation: []}) -%}\n\n {%- do dbt_utils._is_relation(relation, 'union_relations') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'union_relations') -%}\n {%- set cols = adapter.get_columns_in_relation(relation) -%}\n {%- for col in cols -%}\n\n {#- If an exclude list was provided and the column is in the list, do nothing -#}\n {%- if exclude and col.column in exclude -%}\n\n {#- If an include list was provided and the column is not in the list, do nothing -#}\n {%- elif include and col.column not in include -%}\n\n {#- Otherwise add the column to the column superset -#}\n {%- else -%}\n\n {#- update the list of columns in this relation -#}\n {%- do relation_columns[relation].append(col.column) -%}\n\n {%- if col.column in column_superset -%}\n\n {%- set stored = column_superset[col.column] -%}\n {%- if col.is_string() and stored.is_string() and col.string_size() > stored.string_size() -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif %}\n\n {%- else -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif -%}\n\n {%- endif -%}\n\n {%- endfor -%}\n {%- endfor -%}\n\n {%- set ordered_column_names = column_superset.keys() -%}\n {%- set dbt_command = flags.WHICH -%}\n\n\n {% if dbt_command in ['run', 'build'] %}\n {% if (include | length > 0 or exclude | length > 0) and not column_superset.keys() %}\n {%- set relations_string -%}\n {%- for relation in relations -%}\n {{ relation.name }}\n {%- if not loop.last %}, {% endif -%}\n {%- endfor -%}\n {%- endset -%}\n\n {%- set error_message -%}\n There were no columns found to union for relations {{ relations_string }}\n {%- endset -%}\n\n {{ exceptions.raise_compiler_error(error_message) }}\n {%- endif -%}\n {%- endif -%}\n\n {%- for relation in relations %}\n\n (\n select\n\n cast({{ dbt_utils.string_literal(relation) }} as {{ dbt_utils.type_string() }}) as {{ source_column_name }},\n {% for col_name in ordered_column_names -%}\n\n {%- set col = column_superset[col_name] %}\n {%- set col_type = column_override.get(col.column, col.data_type) %}\n {%- set col_name = adapter.quote(col_name) if col_name in relation_columns[relation] else 'null' %}\n cast({{ col_name }} as {{ col_type }}) as {{ col.quoted }} {% if not loop.last %},{% endif -%}\n\n {%- endfor %}\n\n from {{ relation }}\n\n {% if where -%}\n where {{ where }}\n {%- endif %}\n )\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n\n {%- endfor -%}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.string_literal", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0561988}, "macro.dbt_utils.group_by": {"unique_id": "macro.dbt_utils.group_by", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "name": "group_by", "macro_sql": "{%- macro group_by(n) -%}\n {{ return(adapter.dispatch('group_by', 'dbt_utils')(n)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__group_by"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.056979}, "macro.dbt_utils.default__group_by": {"unique_id": "macro.dbt_utils.default__group_by", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "name": "default__group_by", "macro_sql": "\n\n{%- macro default__group_by(n) -%}\n\n group by {% for i in range(1, n + 1) -%}\n {{ i }}{{ ',' if not loop.last }} \n {%- endfor -%}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.057527}, "macro.dbt_utils.deduplicate": {"unique_id": "macro.dbt_utils.deduplicate", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "name": "deduplicate", "macro_sql": "{%- macro deduplicate(relation, partition_by, order_by=none, relation_alias=none) -%}\n\n {%- set error_message_group_by -%}\nWarning: the `group_by` parameter of the `deduplicate` macro is no longer supported and will be deprecated in a future release of dbt-utils.\nUse `partition_by` instead.\nThe {{ model.package_name }}.{{ model.name }} model triggered this warning.\n {%- endset -%}\n\n {% if kwargs.get('group_by') %}\n {%- do exceptions.warn(error_message_group_by) -%}\n {%- endif -%}\n\n {%- set error_message_order_by -%}\nWarning: `order_by` as an optional parameter of the `deduplicate` macro is no longer supported and will be deprecated in a future release of dbt-utils.\nSupply a non-null value for `order_by` instead.\nThe {{ model.package_name }}.{{ model.name }} model triggered this warning.\n {%- endset -%}\n\n {% if not order_by %}\n {%- do exceptions.warn(error_message_order_by) -%}\n {%- endif -%}\n\n {%- set error_message_alias -%}\nWarning: the `relation_alias` parameter of the `deduplicate` macro is no longer supported and will be deprecated in a future release of dbt-utils.\nIf you were using `relation_alias` to point to a CTE previously then you can now pass the alias directly to `relation` instead.\nThe {{ model.package_name }}.{{ model.name }} model triggered this warning.\n {%- endset -%}\n\n {% if relation_alias %}\n {%- do exceptions.warn(error_message_alias) -%}\n {%- endif -%}\n\n {% set partition_by = partition_by or kwargs.get('group_by') %}\n {% set relation = relation_alias or relation %}\n {% set order_by = order_by or \"'1'\" %}\n\n {{ return(adapter.dispatch('deduplicate', 'dbt_utils')(relation, partition_by, order_by)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__deduplicate"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.062219}, "macro.dbt_utils.default__deduplicate": {"unique_id": "macro.dbt_utils.default__deduplicate", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "name": "default__deduplicate", "macro_sql": "\n\n{%- macro default__deduplicate(relation, partition_by, order_by) -%}\n\n with row_numbered as (\n select\n _inner.*,\n row_number() over (\n partition by {{ partition_by }}\n order by {{ order_by }}\n ) as rn\n from {{ relation }} as _inner\n )\n\n select\n distinct data.*\n from {{ relation }} as data\n {#\n -- Not all DBs will support natural joins but the ones that do include:\n -- Oracle, MySQL, SQLite, Redshift, Teradata, Materialize, Databricks\n -- Apache Spark, SingleStore, Vertica\n -- Those that do not appear to support natural joins include:\n -- SQLServer, Trino, Presto, Rockset, Athena\n #}\n natural join row_numbered\n where row_numbered.rn = 1\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.06283}, "macro.dbt_utils.redshift__deduplicate": {"unique_id": "macro.dbt_utils.redshift__deduplicate", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "name": "redshift__deduplicate", "macro_sql": "{% macro redshift__deduplicate(relation, partition_by, order_by) -%}\n\n {{ return(dbt_utils.default__deduplicate(relation, partition_by, order_by=order_by)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__deduplicate"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.063283}, "macro.dbt_utils.postgres__deduplicate": {"unique_id": "macro.dbt_utils.postgres__deduplicate", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "name": "postgres__deduplicate", "macro_sql": "\n{%- macro postgres__deduplicate(relation, partition_by, order_by) -%}\n\n select\n distinct on ({{ partition_by }}) *\n from {{ relation }}\n order by {{ partition_by }}{{ ',' ~ order_by }}\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0637271}, "macro.dbt_utils.snowflake__deduplicate": {"unique_id": "macro.dbt_utils.snowflake__deduplicate", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "name": "snowflake__deduplicate", "macro_sql": "\n{%- macro snowflake__deduplicate(relation, partition_by, order_by) -%}\n\n select *\n from {{ relation }}\n qualify\n row_number() over (\n partition by {{ partition_by }}\n order by {{ order_by }}\n ) = 1\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0642061}, "macro.dbt_utils.bigquery__deduplicate": {"unique_id": "macro.dbt_utils.bigquery__deduplicate", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "name": "bigquery__deduplicate", "macro_sql": "\n{%- macro bigquery__deduplicate(relation, partition_by, order_by) -%}\n\n select unique.*\n from (\n select\n array_agg (\n original\n order by {{ order_by }}\n limit 1\n )[offset(0)] unique\n from {{ relation }} original\n group by {{ partition_by }}\n )\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.064629}, "macro.dbt_utils.surrogate_key": {"unique_id": "macro.dbt_utils.surrogate_key", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "name": "surrogate_key", "macro_sql": "{%- macro surrogate_key(field_list) -%}\n {# needed for safe_add to allow for non-keyword arguments see SO post #}\n {# https://stackoverflow.com/questions/13944751/args-kwargs-in-jinja2-macros #}\n {% set frustrating_jinja_feature = varargs %}\n {{ return(adapter.dispatch('surrogate_key', 'dbt_utils')(field_list, *varargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__surrogate_key"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.065831}, "macro.dbt_utils.default__surrogate_key": {"unique_id": "macro.dbt_utils.default__surrogate_key", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "name": "default__surrogate_key", "macro_sql": "\n\n{%- macro default__surrogate_key(field_list) -%}\n\n{%- if varargs|length >= 1 or field_list is string %}\n\n{%- set error_message = '\nWarning: the `surrogate_key` macro now takes a single list argument instead of \\\nmultiple string arguments. Support for multiple string arguments will be \\\ndeprecated in a future release of dbt-utils. The {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.warn(error_message) -%}\n\n{# first argument is not included in varargs, so add first element to field_list_xf #}\n{%- set field_list_xf = [field_list] -%}\n\n{%- for field in varargs %}\n{%- set _ = field_list_xf.append(field) -%}\n{%- endfor -%}\n\n{%- else -%}\n\n{# if using list, just set field_list_xf as field_list #}\n{%- set field_list_xf = field_list -%}\n\n{%- endif -%}\n\n\n{%- set fields = [] -%}\n\n{%- for field in field_list_xf -%}\n\n {%- set _ = fields.append(\n \"coalesce(cast(\" ~ field ~ \" as \" ~ dbt_utils.type_string() ~ \"), '')\"\n ) -%}\n\n {%- if not loop.last %}\n {%- set _ = fields.append(\"'-'\") -%}\n {%- endif -%}\n\n{%- endfor -%}\n\n{{dbt_utils.hash(dbt_utils.concat(fields))}}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string", "macro.dbt_utils.hash", "macro.dbt_utils.concat"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.068005}, "macro.dbt_utils.safe_add": {"unique_id": "macro.dbt_utils.safe_add", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "name": "safe_add", "macro_sql": "{%- macro safe_add() -%}\n {# needed for safe_add to allow for non-keyword arguments see SO post #}\n {# https://stackoverflow.com/questions/13944751/args-kwargs-in-jinja2-macros #}\n {% set frustrating_jinja_feature = varargs %}\n {{ return(adapter.dispatch('safe_add', 'dbt_utils')(*varargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__safe_add"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.069272}, "macro.dbt_utils.default__safe_add": {"unique_id": "macro.dbt_utils.default__safe_add", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "name": "default__safe_add", "macro_sql": "\n\n{%- macro default__safe_add() -%}\n\n{% set fields = [] %}\n\n{%- for field in varargs -%}\n\n {% do fields.append(\"coalesce(\" ~ field ~ \", 0)\") %}\n\n{%- endfor -%}\n\n{{ fields|join(' +\\n ') }}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.070057}, "macro.dbt_utils.nullcheck": {"unique_id": "macro.dbt_utils.nullcheck", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "name": "nullcheck", "macro_sql": "{% macro nullcheck(cols) %}\n {{ return(adapter.dispatch('nullcheck', 'dbt_utils')(cols)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__nullcheck"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0709069}, "macro.dbt_utils.default__nullcheck": {"unique_id": "macro.dbt_utils.default__nullcheck", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "name": "default__nullcheck", "macro_sql": "{% macro default__nullcheck(cols) %}\n{%- for col in cols %}\n\n {% if col.is_string() -%}\n\n nullif({{col.name}},'') as {{col.name}}\n\n {%- else -%}\n\n {{col.name}}\n\n {%- endif -%}\n\n{%- if not loop.last -%} , {%- endif -%}\n\n{%- endfor -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0716622}, "macro.dbt_utils.get_tables_by_pattern_sql": {"unique_id": "macro.dbt_utils.get_tables_by_pattern_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "get_tables_by_pattern_sql", "macro_sql": "{% macro get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_tables_by_pattern_sql', 'dbt_utils')\n (schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.074296}, "macro.dbt_utils.default__get_tables_by_pattern_sql": {"unique_id": "macro.dbt_utils.default__get_tables_by_pattern_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "default__get_tables_by_pattern_sql", "macro_sql": "{% macro default__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n select distinct\n table_schema as \"table_schema\",\n table_name as \"table_name\",\n {{ dbt_utils.get_table_types_sql() }}\n from {{ database }}.information_schema.tables\n where table_schema ilike '{{ schema_pattern }}'\n and table_name ilike '{{ table_pattern }}'\n and table_name not ilike '{{ exclude }}'\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0749362}, "macro.dbt_utils.bigquery__get_tables_by_pattern_sql": {"unique_id": "macro.dbt_utils.bigquery__get_tables_by_pattern_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "bigquery__get_tables_by_pattern_sql", "macro_sql": "{% macro bigquery__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {% if '%' in schema_pattern %}\n {% set schemata=dbt_utils._bigquery__get_matching_schemata(schema_pattern, database) %}\n {% else %}\n {% set schemata=[schema_pattern] %}\n {% endif %}\n\n {% set sql %}\n {% for schema in schemata %}\n select distinct\n table_schema,\n table_name,\n {{ dbt_utils.get_table_types_sql() }}\n\n from {{ adapter.quote(database) }}.{{ schema }}.INFORMATION_SCHEMA.TABLES\n where lower(table_name) like lower ('{{ table_pattern }}')\n and lower(table_name) not like lower ('{{ exclude }}')\n\n {% if not loop.last %} union all {% endif %}\n\n {% endfor %}\n {% endset %}\n\n {{ return(sql) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._bigquery__get_matching_schemata", "macro.dbt_utils.get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.076882}, "macro.dbt_utils._bigquery__get_matching_schemata": {"unique_id": "macro.dbt_utils._bigquery__get_matching_schemata", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "_bigquery__get_matching_schemata", "macro_sql": "{% macro _bigquery__get_matching_schemata(schema_pattern, database) %}\n {% if execute %}\n\n {% set sql %}\n select schema_name from {{ adapter.quote(database) }}.INFORMATION_SCHEMA.SCHEMATA\n where lower(schema_name) like lower('{{ schema_pattern }}')\n {% endset %}\n\n {% set results=run_query(sql) %}\n\n {% set schemata=results.columns['schema_name'].values() %}\n\n {{ return(schemata) }}\n\n {% else %}\n\n {{ return([]) }}\n\n {% endif %}\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.078059}, "macro.dbt_utils.get_column_values": {"unique_id": "macro.dbt_utils.get_column_values", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "name": "get_column_values", "macro_sql": "{% macro get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none, where=none) -%}\n {{ return(adapter.dispatch('get_column_values', 'dbt_utils')(table, column, order_by, max_records, default, where)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_column_values"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.080377}, "macro.dbt_utils.default__get_column_values": {"unique_id": "macro.dbt_utils.default__get_column_values", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "name": "default__get_column_values", "macro_sql": "{% macro default__get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none, where=none) -%}\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {% set default = [] if not default %}\n {{ return(default) }}\n {% endif %}\n\n {%- do dbt_utils._is_ephemeral(table, 'get_column_values') -%}\n\n {# Not all relations are tables. Renaming for internal clarity without breaking functionality for anyone using named arguments #}\n {# TODO: Change the method signature in a future 0.x.0 release #}\n {%- set target_relation = table -%}\n\n {# adapter.load_relation is a convenience wrapper to avoid building a Relation when we already have one #}\n {% set relation_exists = (load_relation(target_relation)) is not none %}\n\n {%- call statement('get_column_values', fetch_result=true) %}\n\n {%- if not relation_exists and default is none -%}\n\n {{ exceptions.raise_compiler_error(\"In get_column_values(): relation \" ~ target_relation ~ \" does not exist and no default value was provided.\") }}\n\n {%- elif not relation_exists and default is not none -%}\n\n {{ log(\"Relation \" ~ target_relation ~ \" does not exist. Returning the default value: \" ~ default) }}\n\n {{ return(default) }}\n\n {%- else -%}\n\n\n select\n {{ column }} as value\n\n from {{ target_relation }}\n\n {% if where is not none %}\n where {{ where }}\n {% endif %}\n\n group by {{ column }}\n order by {{ order_by }}\n\n {% if max_records is not none %}\n limit {{ max_records }}\n {% endif %}\n\n {% endif %}\n\n {%- endcall -%}\n\n {%- set value_list = load_result('get_column_values') -%}\n\n {%- if value_list and value_list['data'] -%}\n {%- set values = value_list['data'] | map(attribute=0) | list %}\n {{ return(values) }}\n {%- else -%}\n {{ return(default) }}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_ephemeral", "macro.dbt.load_relation", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.08389}, "macro.dbt_utils.pivot": {"unique_id": "macro.dbt_utils.pivot", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "name": "pivot", "macro_sql": "{% macro pivot(column,\n values,\n alias=True,\n agg='sum',\n cmp='=',\n prefix='',\n suffix='',\n then_value=1,\n else_value=0,\n quote_identifiers=True,\n distinct=False) %}\n {{ return(adapter.dispatch('pivot', 'dbt_utils')(column, values, alias, agg, cmp, prefix, suffix, then_value, else_value, quote_identifiers, distinct)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__pivot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.086101}, "macro.dbt_utils.default__pivot": {"unique_id": "macro.dbt_utils.default__pivot", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "name": "default__pivot", "macro_sql": "{% macro default__pivot(column,\n values,\n alias=True,\n agg='sum',\n cmp='=',\n prefix='',\n suffix='',\n then_value=1,\n else_value=0,\n quote_identifiers=True,\n distinct=False) %}\n {% for value in values %}\n {{ agg }}(\n {% if distinct %} distinct {% endif %}\n case\n when {{ column }} {{ cmp }} '{{ dbt_utils.escape_single_quotes(value) }}'\n then {{ then_value }}\n else {{ else_value }}\n end\n )\n {% if alias %}\n {% if quote_identifiers %}\n as {{ adapter.quote(prefix ~ value ~ suffix) }}\n {% else %}\n as {{ dbt_utils.slugify(prefix ~ value ~ suffix) }}\n {% endif %}\n {% endif %}\n {% if not loop.last %},{% endif %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.escape_single_quotes", "macro.dbt_utils.slugify"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.088104}, "macro.dbt_utils.get_filtered_columns_in_relation": {"unique_id": "macro.dbt_utils.get_filtered_columns_in_relation", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_filtered_columns_in_relation.sql", "original_file_path": "macros/sql/get_filtered_columns_in_relation.sql", "name": "get_filtered_columns_in_relation", "macro_sql": "{% macro get_filtered_columns_in_relation(from, except=[]) -%}\n {{ return(adapter.dispatch('get_filtered_columns_in_relation', 'dbt_utils')(from, except)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_filtered_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0892491}, "macro.dbt_utils.default__get_filtered_columns_in_relation": {"unique_id": "macro.dbt_utils.default__get_filtered_columns_in_relation", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_filtered_columns_in_relation.sql", "original_file_path": "macros/sql/get_filtered_columns_in_relation.sql", "name": "default__get_filtered_columns_in_relation", "macro_sql": "{% macro default__get_filtered_columns_in_relation(from, except=[]) -%}\n {%- do dbt_utils._is_relation(from, 'get_filtered_columns_in_relation') -%}\n {%- do dbt_utils._is_ephemeral(from, 'get_filtered_columns_in_relation') -%}\n\n {# -- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {{ return('') }}\n {% endif %}\n\n {%- set include_cols = [] %}\n {%- set cols = adapter.get_columns_in_relation(from) -%}\n {%- set except = except | map(\"lower\") | list %}\n {%- for col in cols -%}\n {%- if col.column|lower not in except -%}\n {% do include_cols.append(col.column) %}\n {%- endif %}\n {%- endfor %}\n\n {{ return(include_cols) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.091028}, "macro.dbt_utils.get_query_results_as_dict": {"unique_id": "macro.dbt_utils.get_query_results_as_dict", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "name": "get_query_results_as_dict", "macro_sql": "{% macro get_query_results_as_dict(query) %}\n {{ return(adapter.dispatch('get_query_results_as_dict', 'dbt_utils')(query)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_query_results_as_dict"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.091972}, "macro.dbt_utils.default__get_query_results_as_dict": {"unique_id": "macro.dbt_utils.default__get_query_results_as_dict", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "name": "default__get_query_results_as_dict", "macro_sql": "{% macro default__get_query_results_as_dict(query) %}\n\n{# This macro returns a dictionary of the form {column_name: (tuple_of_results)} #}\n\n {%- call statement('get_query_results', fetch_result=True,auto_begin=false) -%}\n\n {{ query }}\n\n {%- endcall -%}\n\n {% set sql_results={} %}\n\n {%- if execute -%}\n {% set sql_results_table = load_result('get_query_results').table.columns %}\n {% for column_name, column in sql_results_table.items() %}\n {% do sql_results.update({column_name: column.values()}) %}\n {% endfor %}\n {%- endif -%}\n\n {{ return(sql_results) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.093353}, "macro.dbt_utils.get_table_types_sql": {"unique_id": "macro.dbt_utils.get_table_types_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "name": "get_table_types_sql", "macro_sql": "{%- macro get_table_types_sql() -%}\n {{ return(adapter.dispatch('get_table_types_sql', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.094377}, "macro.dbt_utils.default__get_table_types_sql": {"unique_id": "macro.dbt_utils.default__get_table_types_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "name": "default__get_table_types_sql", "macro_sql": "{% macro default__get_table_types_sql() %}\n case table_type\n when 'BASE TABLE' then 'table'\n when 'EXTERNAL TABLE' then 'external'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as \"table_type\"\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.09459}, "macro.dbt_utils.postgres__get_table_types_sql": {"unique_id": "macro.dbt_utils.postgres__get_table_types_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "name": "postgres__get_table_types_sql", "macro_sql": "{% macro postgres__get_table_types_sql() %}\n case table_type\n when 'BASE TABLE' then 'table'\n when 'FOREIGN' then 'external'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as \"table_type\"\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0947998}, "macro.dbt_utils.bigquery__get_table_types_sql": {"unique_id": "macro.dbt_utils.bigquery__get_table_types_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "name": "bigquery__get_table_types_sql", "macro_sql": "{% macro bigquery__get_table_types_sql() %}\n case table_type\n when 'BASE TABLE' then 'table'\n when 'EXTERNAL TABLE' then 'external'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as `table_type`\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.094996}, "macro.dbt_utils.degrees_to_radians": {"unique_id": "macro.dbt_utils.degrees_to_radians", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "degrees_to_radians", "macro_sql": "{% macro degrees_to_radians(degrees) -%}\n acos(-1) * {{degrees}} / 180\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0968928}, "macro.dbt_utils.haversine_distance": {"unique_id": "macro.dbt_utils.haversine_distance", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "haversine_distance", "macro_sql": "{% macro haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n {{ return(adapter.dispatch('haversine_distance', 'dbt_utils')(lat1,lon1,lat2,lon2,unit)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__haversine_distance"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.097564}, "macro.dbt_utils.default__haversine_distance": {"unique_id": "macro.dbt_utils.default__haversine_distance", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "default__haversine_distance", "macro_sql": "{% macro default__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{%- if unit == 'mi' %}\n {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n {% set conversion_rate = 1.60934 %}\n{% else %}\n {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n\n 2 * 3961 * asin(sqrt(power((sin(radians(({{ lat2 }} - {{ lat1 }}) / 2))), 2) +\n cos(radians({{lat1}})) * cos(radians({{lat2}})) *\n power((sin(radians(({{ lon2 }} - {{ lon1 }}) / 2))), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.098939}, "macro.dbt_utils.bigquery__haversine_distance": {"unique_id": "macro.dbt_utils.bigquery__haversine_distance", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "bigquery__haversine_distance", "macro_sql": "{% macro bigquery__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{% set radians_lat1 = dbt_utils.degrees_to_radians(lat1) %}\n{% set radians_lat2 = dbt_utils.degrees_to_radians(lat2) %}\n{% set radians_lon1 = dbt_utils.degrees_to_radians(lon1) %}\n{% set radians_lon2 = dbt_utils.degrees_to_radians(lon2) %}\n{%- if unit == 'mi' %}\n {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n {% set conversion_rate = 1.60934 %}\n{% else %}\n {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n 2 * 3961 * asin(sqrt(power(sin(({{ radians_lat2 }} - {{ radians_lat1 }}) / 2), 2) +\n cos({{ radians_lat1 }}) * cos({{ radians_lat2 }}) *\n power(sin(({{ radians_lon2 }} - {{ radians_lon1 }}) / 2), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.degrees_to_radians"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.101043}, "macro.spark_utils.get_tables": {"unique_id": "macro.spark_utils.get_tables", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "get_tables", "macro_sql": "{% macro get_tables(table_regex_pattern='.*') %}\n\n {% set tables = [] %}\n {% for database in spark__list_schemas('not_used') %}\n {% for table in spark__list_relations_without_caching(database[0]) %}\n {% set db_tablename = database[0] ~ \".\" ~ table[1] %}\n {% set is_match = modules.re.match(table_regex_pattern, db_tablename) %}\n {% if is_match %}\n {% call statement('table_detail', fetch_result=True) -%}\n describe extended {{ db_tablename }}\n {% endcall %}\n\n {% set table_type = load_result('table_detail').table|reverse|selectattr(0, 'in', ('type', 'TYPE', 'Type'))|first %}\n {% if table_type[1]|lower != 'view' %}\n {{ tables.append(db_tablename) }}\n {% endif %}\n {% endif %}\n {% endfor %}\n {% endfor %}\n {{ return(tables) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.110191}, "macro.spark_utils.get_delta_tables": {"unique_id": "macro.spark_utils.get_delta_tables", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "get_delta_tables", "macro_sql": "{% macro get_delta_tables(table_regex_pattern='.*') %}\n\n {% set delta_tables = [] %}\n {% for db_tablename in get_tables(table_regex_pattern) %}\n {% call statement('table_detail', fetch_result=True) -%}\n describe extended {{ db_tablename }}\n {% endcall %}\n\n {% set table_type = load_result('table_detail').table|reverse|selectattr(0, 'in', ('provider', 'PROVIDER', 'Provider'))|first %}\n {% if table_type[1]|lower == 'delta' %}\n {{ delta_tables.append(db_tablename) }}\n {% endif %}\n {% endfor %}\n {{ return(delta_tables) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_tables", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1120079}, "macro.spark_utils.get_statistic_columns": {"unique_id": "macro.spark_utils.get_statistic_columns", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "get_statistic_columns", "macro_sql": "{% macro get_statistic_columns(table) %}\n\n {% call statement('input_columns', fetch_result=True) %}\n SHOW COLUMNS IN {{ table }}\n {% endcall %}\n {% set input_columns = load_result('input_columns').table %}\n\n {% set output_columns = [] %}\n {% for column in input_columns %}\n {% call statement('column_information', fetch_result=True) %}\n DESCRIBE TABLE {{ table }} `{{ column[0] }}`\n {% endcall %}\n {% if not load_result('column_information').table[1][1].startswith('struct') and not load_result('column_information').table[1][1].startswith('array') %}\n {{ output_columns.append('`' ~ column[0] ~ '`') }}\n {% endif %}\n {% endfor %}\n {{ return(output_columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.114054}, "macro.spark_utils.spark_optimize_delta_tables": {"unique_id": "macro.spark_utils.spark_optimize_delta_tables", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "spark_optimize_delta_tables", "macro_sql": "{% macro spark_optimize_delta_tables(table_regex_pattern='.*') %}\n\n {% for table in get_delta_tables(table_regex_pattern) %}\n {% set start=modules.datetime.datetime.now() %}\n {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n {{ dbt_utils.log_info(message_prefix ~ \" Optimizing \" ~ table) }}\n {% do run_query(\"optimize \" ~ table) %}\n {% set end=modules.datetime.datetime.now() %}\n {% set total_seconds = (end - start).total_seconds() | round(2) %}\n {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_delta_tables", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.116299}, "macro.spark_utils.spark_vacuum_delta_tables": {"unique_id": "macro.spark_utils.spark_vacuum_delta_tables", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "spark_vacuum_delta_tables", "macro_sql": "{% macro spark_vacuum_delta_tables(table_regex_pattern='.*') %}\n\n {% for table in get_delta_tables(table_regex_pattern) %}\n {% set start=modules.datetime.datetime.now() %}\n {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n {{ dbt_utils.log_info(message_prefix ~ \" Vacuuming \" ~ table) }}\n {% do run_query(\"vacuum \" ~ table) %}\n {% set end=modules.datetime.datetime.now() %}\n {% set total_seconds = (end - start).total_seconds() | round(2) %}\n {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_delta_tables", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.118128}, "macro.spark_utils.spark_analyze_tables": {"unique_id": "macro.spark_utils.spark_analyze_tables", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "spark_analyze_tables", "macro_sql": "{% macro spark_analyze_tables(table_regex_pattern='.*') %}\n\n {% for table in get_tables(table_regex_pattern) %}\n {% set start=modules.datetime.datetime.now() %}\n {% set columns = get_statistic_columns(table) | join(',') %}\n {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n {{ dbt_utils.log_info(message_prefix ~ \" Analyzing \" ~ table) }}\n {% if columns != '' %}\n {% do run_query(\"analyze table \" ~ table ~ \" compute statistics for columns \" ~ columns) %}\n {% endif %}\n {% set end=modules.datetime.datetime.now() %}\n {% set total_seconds = (end - start).total_seconds() | round(2) %}\n {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_tables", "macro.spark_utils.get_statistic_columns", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1203442}, "macro.spark_utils.spark__concat": {"unique_id": "macro.spark_utils.spark__concat", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/concat.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/concat.sql", "name": "spark__concat", "macro_sql": "{% macro spark__concat(fields) -%}\n concat({{ fields|join(', ') }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.120874}, "macro.spark_utils.spark__type_numeric": {"unique_id": "macro.spark_utils.spark__type_numeric", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/datatypes.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/datatypes.sql", "name": "spark__type_numeric", "macro_sql": "{% macro spark__type_numeric() %}\n decimal(28, 6)\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.121265}, "macro.spark_utils.spark__dateadd": {"unique_id": "macro.spark_utils.spark__dateadd", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/dateadd.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/dateadd.sql", "name": "spark__dateadd", "macro_sql": "{% macro spark__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n {%- set clock_component -%}\n {# make sure the dates + timestamps are real, otherwise raise an error asap #}\n to_unix_timestamp({{ spark_utils.assert_not_null('to_timestamp', from_date_or_timestamp) }})\n - to_unix_timestamp({{ spark_utils.assert_not_null('date', from_date_or_timestamp) }})\n {%- endset -%}\n\n {%- if datepart in ['day', 'week'] -%}\n \n {%- set multiplier = 7 if datepart == 'week' else 1 -%}\n\n to_timestamp(\n to_unix_timestamp(\n date_add(\n {{ spark_utils.assert_not_null('date', from_date_or_timestamp) }},\n cast({{interval}} * {{multiplier}} as int)\n )\n ) + {{clock_component}}\n )\n\n {%- elif datepart in ['month', 'quarter', 'year'] -%}\n \n {%- set multiplier -%} \n {%- if datepart == 'month' -%} 1\n {%- elif datepart == 'quarter' -%} 3\n {%- elif datepart == 'year' -%} 12\n {%- endif -%}\n {%- endset -%}\n\n to_timestamp(\n to_unix_timestamp(\n add_months(\n {{ spark_utils.assert_not_null('date', from_date_or_timestamp) }},\n cast({{interval}} * {{multiplier}} as int)\n )\n ) + {{clock_component}}\n )\n\n {%- elif datepart in ('hour', 'minute', 'second', 'millisecond', 'microsecond') -%}\n \n {%- set multiplier -%} \n {%- if datepart == 'hour' -%} 3600\n {%- elif datepart == 'minute' -%} 60\n {%- elif datepart == 'second' -%} 1\n {%- elif datepart == 'millisecond' -%} (1/1000000)\n {%- elif datepart == 'microsecond' -%} (1/1000000)\n {%- endif -%}\n {%- endset -%}\n\n to_timestamp(\n {{ spark_utils.assert_not_null('to_unix_timestamp', from_date_or_timestamp) }}\n + cast({{interval}} * {{multiplier}} as int)\n )\n\n {%- else -%}\n\n {{ exceptions.raise_compiler_error(\"macro dateadd not implemented for datepart ~ '\" ~ datepart ~ \"' ~ on Spark\") }}\n\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.127184}, "macro.spark_utils.spark__datediff": {"unique_id": "macro.spark_utils.spark__datediff", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/datediff.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/datediff.sql", "name": "spark__datediff", "macro_sql": "{% macro spark__datediff(first_date, second_date, datepart) %}\n\n {%- if datepart in ['day', 'week', 'month', 'quarter', 'year'] -%}\n \n {# make sure the dates are real, otherwise raise an error asap #}\n {% set first_date = spark_utils.assert_not_null('date', first_date) %}\n {% set second_date = spark_utils.assert_not_null('date', second_date) %}\n \n {%- endif -%}\n \n {%- if datepart == 'day' -%}\n \n datediff({{second_date}}, {{first_date}})\n \n {%- elif datepart == 'week' -%}\n \n case when {{first_date}} < {{second_date}}\n then floor(datediff({{second_date}}, {{first_date}})/7)\n else ceil(datediff({{second_date}}, {{first_date}})/7)\n end\n \n -- did we cross a week boundary (Sunday)?\n + case\n when {{first_date}} < {{second_date}} and dayofweek({{second_date}}) < dayofweek({{first_date}}) then 1\n when {{first_date}} > {{second_date}} and dayofweek({{second_date}}) > dayofweek({{first_date}}) then -1\n else 0 end\n\n {%- elif datepart == 'month' -%}\n\n case when {{first_date}} < {{second_date}}\n then floor(months_between(date({{second_date}}), date({{first_date}})))\n else ceil(months_between(date({{second_date}}), date({{first_date}})))\n end\n \n -- did we cross a month boundary?\n + case\n when {{first_date}} < {{second_date}} and dayofmonth({{second_date}}) < dayofmonth({{first_date}}) then 1\n when {{first_date}} > {{second_date}} and dayofmonth({{second_date}}) > dayofmonth({{first_date}}) then -1\n else 0 end\n \n {%- elif datepart == 'quarter' -%}\n \n case when {{first_date}} < {{second_date}}\n then floor(months_between(date({{second_date}}), date({{first_date}}))/3)\n else ceil(months_between(date({{second_date}}), date({{first_date}}))/3)\n end\n \n -- did we cross a quarter boundary?\n + case\n when {{first_date}} < {{second_date}} and (\n (dayofyear({{second_date}}) - (quarter({{second_date}}) * 365/4))\n < (dayofyear({{first_date}}) - (quarter({{first_date}}) * 365/4))\n ) then 1\n when {{first_date}} > {{second_date}} and (\n (dayofyear({{second_date}}) - (quarter({{second_date}}) * 365/4))\n > (dayofyear({{first_date}}) - (quarter({{first_date}}) * 365/4))\n ) then -1\n else 0 end\n\n {%- elif datepart == 'year' -%}\n \n year({{second_date}}) - year({{first_date}})\n\n {%- elif datepart in ('hour', 'minute', 'second', 'millisecond', 'microsecond') -%}\n \n {%- set divisor -%} \n {%- if datepart == 'hour' -%} 3600\n {%- elif datepart == 'minute' -%} 60\n {%- elif datepart == 'second' -%} 1\n {%- elif datepart == 'millisecond' -%} (1/1000)\n {%- elif datepart == 'microsecond' -%} (1/1000000)\n {%- endif -%}\n {%- endset -%}\n\n case when {{first_date}} < {{second_date}}\n then ceil((\n {# make sure the timestamps are real, otherwise raise an error asap #}\n {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', second_date)) }}\n - {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', first_date)) }}\n ) / {{divisor}})\n else floor((\n {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', second_date)) }}\n - {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', first_date)) }}\n ) / {{divisor}})\n end\n \n {% if datepart == 'millisecond' %}\n + cast(date_format({{second_date}}, 'SSS') as int)\n - cast(date_format({{first_date}}, 'SSS') as int)\n {% endif %}\n \n {% if datepart == 'microsecond' %} \n {% set capture_str = '[0-9]{4}-[0-9]{2}-[0-9]{2}.[0-9]{2}:[0-9]{2}:[0-9]{2}.([0-9]{6})' %}\n -- Spark doesn't really support microseconds, so this is a massive hack!\n -- It will only work if the timestamp-string is of the format\n -- 'yyyy-MM-dd-HH mm.ss.SSSSSS'\n + cast(regexp_extract({{second_date}}, '{{capture_str}}', 1) as int)\n - cast(regexp_extract({{first_date}}, '{{capture_str}}', 1) as int) \n {% endif %}\n\n {%- else -%}\n\n {{ exceptions.raise_compiler_error(\"macro datediff not implemented for datepart ~ '\" ~ datepart ~ \"' ~ on Spark\") }}\n\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.141421}, "macro.spark_utils.spark__current_timestamp": {"unique_id": "macro.spark_utils.spark__current_timestamp", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "name": "spark__current_timestamp", "macro_sql": "{% macro spark__current_timestamp() %}\n current_timestamp()\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.141859}, "macro.spark_utils.spark__current_timestamp_in_utc": {"unique_id": "macro.spark_utils.spark__current_timestamp_in_utc", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "name": "spark__current_timestamp_in_utc", "macro_sql": "{% macro spark__current_timestamp_in_utc() %}\n unix_timestamp()\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.142039}, "macro.spark_utils.spark__split_part": {"unique_id": "macro.spark_utils.spark__split_part", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/split_part.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/split_part.sql", "name": "spark__split_part", "macro_sql": "{% macro spark__split_part(string_text, delimiter_text, part_number) %}\n\n {% set delimiter_expr %}\n \n -- escape if starts with a special character\n case when regexp_extract({{ delimiter_text }}, '([^A-Za-z0-9])(.*)', 1) != '_'\n then concat('\\\\', {{ delimiter_text }})\n else {{ delimiter_text }} end\n \n {% endset %}\n\n {% set split_part_expr %}\n \n split(\n {{ string_text }},\n {{ delimiter_expr }}\n )[({{ part_number - 1 }})]\n \n {% endset %}\n \n {{ return(split_part_expr) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1433668}, "macro.spark_utils.spark__get_relations_by_pattern": {"unique_id": "macro.spark_utils.spark__get_relations_by_pattern", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_relations_by_pattern", "macro_sql": "{% macro spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n show table extended in {{ schema_pattern }} like '{{ table_pattern }}'\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=None,\n schema=row[0],\n identifier=row[1],\n type=('view' if 'Type: VIEW' in row[3] else 'table')\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.146799}, "macro.spark_utils.spark__get_relations_by_prefix": {"unique_id": "macro.spark_utils.spark__get_relations_by_prefix", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_relations_by_prefix", "macro_sql": "{% macro spark__get_relations_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {% set table_pattern = table_pattern ~ '*' %}\n {{ return(spark_utils.spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.147562}, "macro.spark_utils.spark__get_tables_by_pattern": {"unique_id": "macro.spark_utils.spark__get_tables_by_pattern", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_tables_by_pattern", "macro_sql": "{% macro spark__get_tables_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(spark_utils.spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.148195}, "macro.spark_utils.spark__get_tables_by_prefix": {"unique_id": "macro.spark_utils.spark__get_tables_by_prefix", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_tables_by_prefix", "macro_sql": "{% macro spark__get_tables_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(spark_utils.spark__get_relations_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_prefix"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.148823}, "macro.spark_utils.assert_not_null": {"unique_id": "macro.spark_utils.assert_not_null", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/etc/assert_not_null.sql", "original_file_path": "macros/etc/assert_not_null.sql", "name": "assert_not_null", "macro_sql": "{% macro assert_not_null(function, arg) -%}\n {{ return(adapter.dispatch('assert_not_null', 'spark_utils')(function, arg)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.default__assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.149665}, "macro.spark_utils.default__assert_not_null": {"unique_id": "macro.spark_utils.default__assert_not_null", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/etc/assert_not_null.sql", "original_file_path": "macros/etc/assert_not_null.sql", "name": "default__assert_not_null", "macro_sql": "{% macro default__assert_not_null(function, arg) %}\n\n coalesce({{function}}({{arg}}), nvl2({{function}}({{arg}}), assert_true({{function}}({{arg}}) is not null), null))\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.150152}, "macro.spark_utils.spark__convert_timezone": {"unique_id": "macro.spark_utils.spark__convert_timezone", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/snowplow/convert_timezone.sql", "original_file_path": "macros/snowplow/convert_timezone.sql", "name": "spark__convert_timezone", "macro_sql": "{% macro spark__convert_timezone(in_tz, out_tz, in_timestamp) %}\n from_utc_timestamp(to_utc_timestamp({{in_timestamp}}, {{in_tz}}), {{out_tz}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.150811}, "macro.fivetran_utils.enabled_vars": {"unique_id": "macro.fivetran_utils.enabled_vars", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/enabled_vars.sql", "original_file_path": "macros/enabled_vars.sql", "name": "enabled_vars", "macro_sql": "{% macro enabled_vars(vars) %}\n\n{% for v in vars %}\n \n {% if var(v, True) == False %}\n {{ return(False) }}\n {% endif %}\n\n{% endfor %}\n\n{{ return(True) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.15185}, "macro.fivetran_utils.percentile": {"unique_id": "macro.fivetran_utils.percentile", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "percentile", "macro_sql": "{% macro percentile(percentile_field, partition_field, percent) -%}\n\n{{ adapter.dispatch('percentile', 'fivetran_utils') (percentile_field, partition_field, percent) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.bigquery__percentile"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.153611}, "macro.fivetran_utils.default__percentile": {"unique_id": "macro.fivetran_utils.default__percentile", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "default__percentile", "macro_sql": "{% macro default__percentile(percentile_field, partition_field, percent) %}\n\n percentile_cont( \n {{ percent }} )\n within group ( order by {{ percentile_field }} )\n over ( partition by {{ partition_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.154005}, "macro.fivetran_utils.redshift__percentile": {"unique_id": "macro.fivetran_utils.redshift__percentile", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "redshift__percentile", "macro_sql": "{% macro redshift__percentile(percentile_field, partition_field, percent) %}\n\n percentile_cont( \n {{ percent }} )\n within group ( order by {{ percentile_field }} )\n over ( partition by {{ partition_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.154465}, "macro.fivetran_utils.bigquery__percentile": {"unique_id": "macro.fivetran_utils.bigquery__percentile", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "bigquery__percentile", "macro_sql": "{% macro bigquery__percentile(percentile_field, partition_field, percent) %}\n\n percentile_cont( \n {{ percentile_field }}, \n {{ percent }}) \n over (partition by {{ partition_field }} \n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.154953}, "macro.fivetran_utils.postgres__percentile": {"unique_id": "macro.fivetran_utils.postgres__percentile", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "postgres__percentile", "macro_sql": "{% macro postgres__percentile(percentile_field, partition_field, percent) %}\n\n percentile_cont( \n {{ percent }} )\n within group ( order by {{ percentile_field }} )\n /* have to group by partition field */\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.155288}, "macro.fivetran_utils.spark__percentile": {"unique_id": "macro.fivetran_utils.spark__percentile", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "spark__percentile", "macro_sql": "{% macro spark__percentile(percentile_field, partition_field, percent) %}\n\n percentile( \n {{ percentile_field }}, \n {{ percent }}) \n over (partition by {{ partition_field }} \n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.155659}, "macro.fivetran_utils.pivot_json_extract": {"unique_id": "macro.fivetran_utils.pivot_json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/pivot_json_extract.sql", "original_file_path": "macros/pivot_json_extract.sql", "name": "pivot_json_extract", "macro_sql": "{% macro pivot_json_extract(string, list_of_properties) %}\n\n{%- for property in list_of_properties -%}\n\nreplace( {{ fivetran_utils.json_extract(string, property) }}, '\"', '') as {{ property | replace(' ', '_') | lower }}\n\n{%- if not loop.last -%},{%- endif %}\n{% endfor -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.json_extract"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.157109}, "macro.fivetran_utils.persist_pass_through_columns": {"unique_id": "macro.fivetran_utils.persist_pass_through_columns", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/persist_pass_through_columns.sql", "original_file_path": "macros/persist_pass_through_columns.sql", "name": "persist_pass_through_columns", "macro_sql": "{% macro persist_pass_through_columns(pass_through_variable) %}\n\n{% if var(pass_through_variable, none) %}\n {% for field in var(pass_through_variable) %}\n , {{ field.alias if field.alias else field.name }}\n {% endfor %}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.158176}, "macro.fivetran_utils.json_parse": {"unique_id": "macro.fivetran_utils.json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "json_parse", "macro_sql": "{% macro json_parse(string, string_path) -%}\n\n{{ adapter.dispatch('json_parse', 'fivetran_utils') (string, string_path) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.bigquery__json_parse"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1604}, "macro.fivetran_utils.default__json_parse": {"unique_id": "macro.fivetran_utils.default__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "default__json_parse", "macro_sql": "{% macro default__json_parse(string, string_path) %}\n\n json_extract_path_text({{string}}, {%- for s in string_path -%}'{{ s }}'{%- if not loop.last -%},{%- endif -%}{%- endfor -%} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.161128}, "macro.fivetran_utils.redshift__json_parse": {"unique_id": "macro.fivetran_utils.redshift__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "redshift__json_parse", "macro_sql": "{% macro redshift__json_parse(string, string_path) %}\n\n json_extract_path_text({{string}}, {%- for s in string_path -%}'{{ s }}'{%- if not loop.last -%},{%- endif -%}{%- endfor -%} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1617222}, "macro.fivetran_utils.bigquery__json_parse": {"unique_id": "macro.fivetran_utils.bigquery__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "bigquery__json_parse", "macro_sql": "{% macro bigquery__json_parse(string, string_path) %}\n\n \n json_extract_scalar({{string}}, '$.{%- for s in string_path -%}{{ s }}{%- if not loop.last -%}.{%- endif -%}{%- endfor -%} ')\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.16232}, "macro.fivetran_utils.postgres__json_parse": {"unique_id": "macro.fivetran_utils.postgres__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "postgres__json_parse", "macro_sql": "{% macro postgres__json_parse(string, string_path) %}\n\n {{string}}::json #>> '{ {%- for s in string_path -%}{{ s }}{%- if not loop.last -%},{%- endif -%}{%- endfor -%} }'\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1628852}, "macro.fivetran_utils.snowflake__json_parse": {"unique_id": "macro.fivetran_utils.snowflake__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "snowflake__json_parse", "macro_sql": "{% macro snowflake__json_parse(string, string_path) %}\n\n parse_json( {{string}} ) {%- for s in string_path -%}{% if s is number %}[{{ s }}]{% else %}['{{ s }}']{% endif %}{%- endfor -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1635158}, "macro.fivetran_utils.spark__json_parse": {"unique_id": "macro.fivetran_utils.spark__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "spark__json_parse", "macro_sql": "{% macro spark__json_parse(string, string_path) %}\n\n {{string}} : {%- for s in string_path -%}{% if s is number %}[{{ s }}]{% else %}['{{ s }}']{% endif %}{%- endfor -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1641579}, "macro.fivetran_utils.max_bool": {"unique_id": "macro.fivetran_utils.max_bool", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "name": "max_bool", "macro_sql": "{% macro max_bool(boolean_field) -%}\n\n{{ adapter.dispatch('max_bool', 'fivetran_utils') (boolean_field) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.bigquery__max_bool"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.164961}, "macro.fivetran_utils.default__max_bool": {"unique_id": "macro.fivetran_utils.default__max_bool", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "name": "default__max_bool", "macro_sql": "{% macro default__max_bool(boolean_field) %}\n\n bool_or( {{ boolean_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.165225}, "macro.fivetran_utils.snowflake__max_bool": {"unique_id": "macro.fivetran_utils.snowflake__max_bool", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "name": "snowflake__max_bool", "macro_sql": "{% macro snowflake__max_bool(boolean_field) %}\n\n max( {{ boolean_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.16547}, "macro.fivetran_utils.bigquery__max_bool": {"unique_id": "macro.fivetran_utils.bigquery__max_bool", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "name": "bigquery__max_bool", "macro_sql": "{% macro bigquery__max_bool(boolean_field) %}\n\n max( {{ boolean_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.165709}, "macro.fivetran_utils.calculated_fields": {"unique_id": "macro.fivetran_utils.calculated_fields", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/calculated_fields.sql", "original_file_path": "macros/calculated_fields.sql", "name": "calculated_fields", "macro_sql": "{% macro calculated_fields(variable) -%}\n\n{% if var(variable, none) %}\n {% for field in var(variable) %}\n , {{ field.transform_sql }} as {{ field.name }} \n {% endfor %}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.166715}, "macro.fivetran_utils.seed_data_helper": {"unique_id": "macro.fivetran_utils.seed_data_helper", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/seed_data_helper.sql", "original_file_path": "macros/seed_data_helper.sql", "name": "seed_data_helper", "macro_sql": "{% macro seed_data_helper(seed_name, warehouses) %}\n\n{% if target.type in warehouses %}\n {% for w in warehouses %}\n {% if target.type == w %}\n {{ return(ref(seed_name ~ \"_\" ~ w ~ \"\")) }}\n {% endif %}\n {% endfor %}\n{% else %}\n{{ return(ref(seed_name)) }}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1681879}, "macro.fivetran_utils.fill_pass_through_columns": {"unique_id": "macro.fivetran_utils.fill_pass_through_columns", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/fill_pass_through_columns.sql", "original_file_path": "macros/fill_pass_through_columns.sql", "name": "fill_pass_through_columns", "macro_sql": "{% macro fill_pass_through_columns(pass_through_variable) %}\n\n{% if var(pass_through_variable) %}\n {% for field in var(pass_through_variable) %}\n {% if field.transform_sql %}\n , {{ field.transform_sql }} as {{ field.alias if field.alias else field.name }}\n {% else %}\n , {{ field.alias if field.alias else field.name }}\n {% endif %}\n {% endfor %}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1696792}, "macro.fivetran_utils.string_agg": {"unique_id": "macro.fivetran_utils.string_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "string_agg", "macro_sql": "{% macro string_agg(field_to_agg, delimiter) -%}\n\n{{ adapter.dispatch('string_agg', 'fivetran_utils') (field_to_agg, delimiter) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__string_agg"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.170922}, "macro.fivetran_utils.default__string_agg": {"unique_id": "macro.fivetran_utils.default__string_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "default__string_agg", "macro_sql": "{% macro default__string_agg(field_to_agg, delimiter) %}\n string_agg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.171235}, "macro.fivetran_utils.snowflake__string_agg": {"unique_id": "macro.fivetran_utils.snowflake__string_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "snowflake__string_agg", "macro_sql": "{% macro snowflake__string_agg(field_to_agg, delimiter) %}\n listagg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1715531}, "macro.fivetran_utils.redshift__string_agg": {"unique_id": "macro.fivetran_utils.redshift__string_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "redshift__string_agg", "macro_sql": "{% macro redshift__string_agg(field_to_agg, delimiter) %}\n listagg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.171867}, "macro.fivetran_utils.spark__string_agg": {"unique_id": "macro.fivetran_utils.spark__string_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "spark__string_agg", "macro_sql": "{% macro spark__string_agg(field_to_agg, delimiter) %}\n -- collect set will remove duplicates\n replace(replace(replace(cast( collect_set({{ field_to_agg }}) as string), '[', ''), ']', ''), ', ', {{ delimiter }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.172182}, "macro.fivetran_utils.timestamp_diff": {"unique_id": "macro.fivetran_utils.timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "timestamp_diff", "macro_sql": "{% macro timestamp_diff(first_date, second_date, datepart) %}\n {{ adapter.dispatch('timestamp_diff', 'fivetran_utils')(first_date, second_date, datepart) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.bigquery__timestamp_diff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.177061}, "macro.fivetran_utils.default__timestamp_diff": {"unique_id": "macro.fivetran_utils.default__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "default__timestamp_diff", "macro_sql": "{% macro default__timestamp_diff(first_date, second_date, datepart) %}\n\n datediff(\n {{ datepart }},\n {{ first_date }},\n {{ second_date }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.177525}, "macro.fivetran_utils.redshift__timestamp_diff": {"unique_id": "macro.fivetran_utils.redshift__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "redshift__timestamp_diff", "macro_sql": "{% macro redshift__timestamp_diff(first_date, second_date, datepart) %}\n\n datediff(\n {{ datepart }},\n {{ first_date }},\n {{ second_date }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.177956}, "macro.fivetran_utils.bigquery__timestamp_diff": {"unique_id": "macro.fivetran_utils.bigquery__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "bigquery__timestamp_diff", "macro_sql": "{% macro bigquery__timestamp_diff(first_date, second_date, datepart) %}\n\n timestamp_diff(\n {{second_date}},\n {{first_date}},\n {{datepart}}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.17837}, "macro.fivetran_utils.postgres__timestamp_diff": {"unique_id": "macro.fivetran_utils.postgres__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "postgres__timestamp_diff", "macro_sql": "{% macro postgres__timestamp_diff(first_date, second_date, datepart) %}\n\n {% if datepart == 'year' %}\n (date_part('year', ({{second_date}})::date) - date_part('year', ({{first_date}})::date))\n {% elif datepart == 'quarter' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 4 + date_part('quarter', ({{second_date}})::date) - date_part('quarter', ({{first_date}})::date))\n {% elif datepart == 'month' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 12 + date_part('month', ({{second_date}})::date) - date_part('month', ({{first_date}})::date))\n {% elif datepart == 'day' %}\n (({{second_date}})::date - ({{first_date}})::date)\n {% elif datepart == 'week' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} / 7 + case\n when date_part('dow', ({{first_date}})::timestamp) <= date_part('dow', ({{second_date}})::timestamp) then\n case when {{first_date}} <= {{second_date}} then 0 else -1 end\n else\n case when {{first_date}} <= {{second_date}} then 1 else 0 end\n end)\n {% elif datepart == 'hour' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} * 24 + date_part('hour', ({{second_date}})::timestamp) - date_part('hour', ({{first_date}})::timestamp))\n {% elif datepart == 'minute' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'hour') }} * 60 + date_part('minute', ({{second_date}})::timestamp) - date_part('minute', ({{first_date}})::timestamp))\n {% elif datepart == 'second' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60 + floor(date_part('second', ({{second_date}})::timestamp)) - floor(date_part('second', ({{first_date}})::timestamp)))\n {% elif datepart == 'millisecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000 + floor(date_part('millisecond', ({{second_date}})::timestamp)) - floor(date_part('millisecond', ({{first_date}})::timestamp)))\n {% elif datepart == 'microsecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000000 + floor(date_part('microsecond', ({{second_date}})::timestamp)) - floor(date_part('microsecond', ({{first_date}})::timestamp)))\n {% else %}\n {{ exceptions.raise_compiler_error(\"Unsupported datepart for macro datediff in postgres: {!r}\".format(datepart)) }}\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.182865}, "macro.fivetran_utils.try_cast": {"unique_id": "macro.fivetran_utils.try_cast", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "try_cast", "macro_sql": "{% macro try_cast(field, type) %}\n {{ adapter.dispatch('try_cast', 'fivetran_utils') (field, type) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.bigquery__try_cast"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.18457}, "macro.fivetran_utils.default__safe_cast": {"unique_id": "macro.fivetran_utils.default__safe_cast", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "default__safe_cast", "macro_sql": "{% macro default__safe_cast(field, type) %}\n {# most databases don't support this function yet\n so we just need to use cast #}\n cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1849039}, "macro.fivetran_utils.redshift__try_cast": {"unique_id": "macro.fivetran_utils.redshift__try_cast", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "redshift__try_cast", "macro_sql": "{% macro redshift__try_cast(field, type) %}\n{%- if type == 'numeric' -%}\n\n case\n when trim({{field}}) ~ '^(0|[1-9][0-9]*)$' then trim({{field}})\n else null\n end::{{type}}\n\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"non-numeric datatypes are not currently supported\") }}\n\n{% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.185598}, "macro.fivetran_utils.postgres__try_cast": {"unique_id": "macro.fivetran_utils.postgres__try_cast", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "postgres__try_cast", "macro_sql": "{% macro postgres__try_cast(field, type) %}\n{%- if type == 'numeric' -%}\n\n case\n when replace(cast({{field}} as varchar),cast(' ' as varchar),cast('' as varchar)) ~ '^(0|[1-9][0-9]*)$' \n then replace(cast({{field}} as varchar),cast(' ' as varchar),cast('' as varchar))\n else null\n end::{{type}}\n\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"non-numeric datatypes are not currently supported\") }}\n\n{% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.186312}, "macro.fivetran_utils.snowflake__try_cast": {"unique_id": "macro.fivetran_utils.snowflake__try_cast", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "snowflake__try_cast", "macro_sql": "{% macro snowflake__try_cast(field, type) %}\n try_cast(cast({{field}} as varchar) as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.186631}, "macro.fivetran_utils.bigquery__try_cast": {"unique_id": "macro.fivetran_utils.bigquery__try_cast", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "bigquery__try_cast", "macro_sql": "{% macro bigquery__try_cast(field, type) %}\n safe_cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1869419}, "macro.fivetran_utils.spark__try_cast": {"unique_id": "macro.fivetran_utils.spark__try_cast", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "spark__try_cast", "macro_sql": "{% macro spark__try_cast(field, type) %}\n try_cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1872509}, "macro.fivetran_utils.source_relation": {"unique_id": "macro.fivetran_utils.source_relation", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/source_relation.sql", "original_file_path": "macros/source_relation.sql", "name": "source_relation", "macro_sql": "{% macro source_relation(union_schema_variable='union_schemas', union_database_variable='union_databases') -%}\n\n{{ adapter.dispatch('source_relation', 'fivetran_utils') (union_schema_variable, union_database_variable) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__source_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.188386}, "macro.fivetran_utils.default__source_relation": {"unique_id": "macro.fivetran_utils.default__source_relation", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/source_relation.sql", "original_file_path": "macros/source_relation.sql", "name": "default__source_relation", "macro_sql": "{% macro default__source_relation(union_schema_variable, union_database_variable) %}\n\n{% if var(union_schema_variable, none) %}\n, case\n {% for schema in var(union_schema_variable) %}\n when lower(replace(replace(_dbt_source_relation,'\"',''),'`','')) like '%.{{ schema|lower }}.%' then '{{ schema|lower }}'\n {% endfor %}\n end as source_relation\n{% elif var(union_database_variable, none) %}\n, case\n {% for database in var(union_database_variable) %}\n when lower(replace(replace(_dbt_source_relation,'\"',''),'`','')) like '%{{ database|lower }}.%' then '{{ database|lower }}'\n {% endfor %}\n end as source_relation\n{% else %}\n, cast('' as {{ dbt_utils.type_string() }}) as source_relation\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.189734}, "macro.fivetran_utils.first_value": {"unique_id": "macro.fivetran_utils.first_value", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "name": "first_value", "macro_sql": "{% macro first_value(first_value_field, partition_field, order_by_field, order=\"asc\") -%}\n\n{{ adapter.dispatch('first_value', 'fivetran_utils') (first_value_field, partition_field, order_by_field, order) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__first_value"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1908622}, "macro.fivetran_utils.default__first_value": {"unique_id": "macro.fivetran_utils.default__first_value", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "name": "default__first_value", "macro_sql": "{% macro default__first_value(first_value_field, partition_field, order_by_field, order=\"asc\") %}\n\n first_value( {{ first_value_field }} ignore nulls ) over (partition by {{ partition_field }} order by {{ order_by_field }} {{ order }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1914518}, "macro.fivetran_utils.redshift__first_value": {"unique_id": "macro.fivetran_utils.redshift__first_value", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "name": "redshift__first_value", "macro_sql": "{% macro redshift__first_value(first_value_field, partition_field, order_by_field, order=\"asc\") %}\n\n first_value( {{ first_value_field }} ignore nulls ) over (partition by {{ partition_field }} order by {{ order_by_field }} {{ order }} , {{ partition_field }} rows unbounded preceding )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1919968}, "macro.fivetran_utils.add_dbt_source_relation": {"unique_id": "macro.fivetran_utils.add_dbt_source_relation", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/add_dbt_source_relation.sql", "original_file_path": "macros/add_dbt_source_relation.sql", "name": "add_dbt_source_relation", "macro_sql": "{% macro add_dbt_source_relation() %}\n\n{% if var('union_schemas', none) or var('union_databases', none) %}\n, _dbt_source_relation\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.192821}, "macro.fivetran_utils.add_pass_through_columns": {"unique_id": "macro.fivetran_utils.add_pass_through_columns", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/add_pass_through_columns.sql", "original_file_path": "macros/add_pass_through_columns.sql", "name": "add_pass_through_columns", "macro_sql": "{% macro add_pass_through_columns(base_columns, pass_through_var) %}\n\n {% if pass_through_var %}\n\n {% for column in pass_through_var %}\n\n {% if column.alias %}\n\n {% do base_columns.append({ \"name\": column.name, \"alias\": column.alias, \"datatype\": column.datatype if column.datatype else dbt_utils.type_string()}) %}\n\n {% else %}\n\n {% do base_columns.append({ \"name\": column.name, \"datatype\": column.datatype if column.datatype else dbt_utils.type_string()}) %}\n \n {% endif %}\n\n {% endfor %}\n\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.194816}, "macro.fivetran_utils.union_relations": {"unique_id": "macro.fivetran_utils.union_relations", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/union_relations.sql", "original_file_path": "macros/union_relations.sql", "name": "union_relations", "macro_sql": "{%- macro union_relations(relations, aliases=none, column_override=none, include=[], exclude=[], source_column_name=none) -%}\n\n {%- if exclude and include -%}\n {{ exceptions.raise_compiler_error(\"Both an exclude and include list were provided to the `union` macro. Only one is allowed\") }}\n {%- endif -%}\n\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. -#}\n {%- if not execute %}\n {{ return('') }}\n {% endif -%}\n\n {%- set column_override = column_override if column_override is not none else {} -%}\n {%- set source_column_name = source_column_name if source_column_name is not none else '_dbt_source_relation' -%}\n\n {%- set relation_columns = {} -%}\n {%- set column_superset = {} -%}\n\n {%- for relation in relations -%}\n\n {%- do relation_columns.update({relation: []}) -%}\n\n {%- do dbt_utils._is_relation(relation, 'union_relations') -%}\n {%- set cols = adapter.get_columns_in_relation(relation) -%}\n {%- for col in cols -%}\n\n {#- If an exclude list was provided and the column is in the list, do nothing -#}\n {%- if exclude and col.column in exclude -%}\n\n {#- If an include list was provided and the column is not in the list, do nothing -#}\n {%- elif include and col.column not in include -%}\n\n {#- Otherwise add the column to the column superset -#}\n {%- else -%}\n\n {#- update the list of columns in this relation -#}\n {%- do relation_columns[relation].append(col.column) -%}\n\n {%- if col.column in column_superset -%}\n\n {%- set stored = column_superset[col.column] -%}\n {%- if col.is_string() and stored.is_string() and col.string_size() > stored.string_size() -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif %}\n\n {%- else -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif -%}\n\n {%- endif -%}\n\n {%- endfor -%}\n {%- endfor -%}\n\n {%- set ordered_column_names = column_superset.keys() -%}\n\n {%- for relation in relations %}\n\n (\n select\n\n cast({{ dbt_utils.string_literal(relation) }} as {{ dbt_utils.type_string() }}) as {{ source_column_name }},\n {% for col_name in ordered_column_names -%}\n\n {%- set col = column_superset[col_name] %}\n {%- set col_type = column_override.get(col.column, col.data_type) %}\n {%- set col_name = adapter.quote(col_name) if col_name in relation_columns[relation] else 'null' %}\n cast({{ col_name }} as {{ col_type }}) as {{ col.quoted }} {% if not loop.last %},{% endif -%}\n\n {%- endfor %}\n\n from {{ aliases[loop.index0] if aliases else relation }}\n )\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n\n {%- endfor -%}\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils.string_literal", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.203735}, "macro.fivetran_utils.union_tables": {"unique_id": "macro.fivetran_utils.union_tables", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/union_relations.sql", "original_file_path": "macros/union_relations.sql", "name": "union_tables", "macro_sql": "{%- macro union_tables(tables, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_table') -%}\n\n {%- do exceptions.warn(\"Warning: the `union_tables` macro is no longer supported and will be deprecated in a future release of dbt-utils. Use the `union_relations` macro instead\") -%}\n\n {{ return(dbt_utils.union_relations(tables, column_override, include, exclude, source_column_name)) }}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.union_relations"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.204741}, "macro.fivetran_utils.snowflake_seed_data": {"unique_id": "macro.fivetran_utils.snowflake_seed_data", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/snowflake_seed_data.sql", "original_file_path": "macros/snowflake_seed_data.sql", "name": "snowflake_seed_data", "macro_sql": "{% macro snowflake_seed_data(seed_name) %}\n\n{% if target.type == 'snowflake' %}\n{{ return(ref(seed_name ~ '_snowflake')) }}\n{% else %}\n{{ return(ref(seed_name)) }}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.205817}, "macro.fivetran_utils.fill_staging_columns": {"unique_id": "macro.fivetran_utils.fill_staging_columns", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/fill_staging_columns.sql", "original_file_path": "macros/fill_staging_columns.sql", "name": "fill_staging_columns", "macro_sql": "{% macro fill_staging_columns(source_columns, staging_columns) -%}\n\n{%- set source_column_names = source_columns|map(attribute='name')|map('lower')|list -%}\n\n{%- for column in staging_columns %}\n {% if column.name|lower in source_column_names -%}\n {{ fivetran_utils.quote_column(column) }} as \n {%- if 'alias' in column %} {{ column.alias }} {% else %} {{ fivetran_utils.quote_column(column) }} {%- endif -%}\n {%- else -%}\n cast(null as {{ column.datatype }})\n {%- if 'alias' in column %} as {{ column.alias }} {% else %} as {{ fivetran_utils.quote_column(column) }} {% endif -%}\n {%- endif -%}\n {%- if not loop.last -%} , {% endif -%}\n{% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.quote_column"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.209116}, "macro.fivetran_utils.quote_column": {"unique_id": "macro.fivetran_utils.quote_column", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/fill_staging_columns.sql", "original_file_path": "macros/fill_staging_columns.sql", "name": "quote_column", "macro_sql": "{% macro quote_column(column) %}\n {% if 'quote' in column %}\n {% if column.quote %}\n {% if target.type in ('bigquery', 'spark') %}\n `{{ column.name }}`\n {% elif target.type == 'snowflake' %}\n \"{{ column.name | upper }}\"\n {% else %}\n \"{{ column.name }}\"\n {% endif %}\n {% else %}\n {{ column.name }}\n {% endif %}\n {% else %}\n {{ column.name }}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.210907}, "macro.fivetran_utils.json_extract": {"unique_id": "macro.fivetran_utils.json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "json_extract", "macro_sql": "{% macro json_extract(string, string_path) -%}\n\n{{ adapter.dispatch('json_extract', 'fivetran_utils') (string, string_path) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.bigquery__json_extract"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.212298}, "macro.fivetran_utils.default__json_extract": {"unique_id": "macro.fivetran_utils.default__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "default__json_extract", "macro_sql": "{% macro default__json_extract(string, string_path) %}\n\n json_extract_path_text({{string}}, {{ \"'\" ~ string_path ~ \"'\" }} )\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.212665}, "macro.fivetran_utils.snowflake__json_extract": {"unique_id": "macro.fivetran_utils.snowflake__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "snowflake__json_extract", "macro_sql": "{% macro snowflake__json_extract(string, string_path) %}\n\n json_extract_path_text(try_parse_json( {{string}} ), {{ \"'\" ~ string_path ~ \"'\" }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.213053}, "macro.fivetran_utils.redshift__json_extract": {"unique_id": "macro.fivetran_utils.redshift__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "redshift__json_extract", "macro_sql": "{% macro redshift__json_extract(string, string_path) %}\n\n case when is_valid_json( {{string}} ) then json_extract_path_text({{string}}, {{ \"'\" ~ string_path ~ \"'\" }} ) else null end\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.213608}, "macro.fivetran_utils.bigquery__json_extract": {"unique_id": "macro.fivetran_utils.bigquery__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "bigquery__json_extract", "macro_sql": "{% macro bigquery__json_extract(string, string_path) %}\n\n json_extract_scalar({{string}}, {{ \"'$.\" ~ string_path ~ \"'\" }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.213998}, "macro.fivetran_utils.postgres__json_extract": {"unique_id": "macro.fivetran_utils.postgres__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "postgres__json_extract", "macro_sql": "{% macro postgres__json_extract(string, string_path) %}\n\n {{string}}::json->>{{\"'\" ~ string_path ~ \"'\" }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.2143612}, "macro.fivetran_utils.collect_freshness": {"unique_id": "macro.fivetran_utils.collect_freshness", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/collect_freshness.sql", "original_file_path": "macros/collect_freshness.sql", "name": "collect_freshness", "macro_sql": "{% macro collect_freshness(source, loaded_at_field, filter) %}\n {{ return(adapter.dispatch('collect_freshness')(source, loaded_at_field, filter))}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__collect_freshness"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.215748}, "macro.fivetran_utils.default__collect_freshness": {"unique_id": "macro.fivetran_utils.default__collect_freshness", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/collect_freshness.sql", "original_file_path": "macros/collect_freshness.sql", "name": "default__collect_freshness", "macro_sql": "{% macro default__collect_freshness(source, loaded_at_field, filter) %}\n {% call statement('collect_freshness', fetch_result=True, auto_begin=False) -%}\n\n {%- set enabled_array = [] -%}\n {% for node in graph.sources.values() %}\n {% if node.identifier == source.identifier %}\n {% if (node.meta['is_enabled'] | default(true)) %}\n {%- do enabled_array.append(1) -%}\n {% endif %}\n {% endif %}\n {% endfor %}\n {% set is_enabled = (enabled_array != []) %}\n\n select\n {% if is_enabled %}\n max({{ loaded_at_field }})\n {% else %} \n {{ current_timestamp() }} {% endif %} as max_loaded_at,\n {{ current_timestamp() }} as snapshotted_at\n\n {% if is_enabled %}\n from {{ source }}\n {% if filter %}\n where {{ filter }}\n {% endif %}\n {% endif %}\n\n {% endcall %}\n {{ return(load_result('collect_freshness').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.218318}, "macro.fivetran_utils.timestamp_add": {"unique_id": "macro.fivetran_utils.timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "timestamp_add", "macro_sql": "{% macro timestamp_add(datepart, interval, from_timestamp) -%}\n\n{{ adapter.dispatch('timestamp_add', 'fivetran_utils') (datepart, interval, from_timestamp) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.bigquery__timestamp_add"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.219719}, "macro.fivetran_utils.default__timestamp_add": {"unique_id": "macro.fivetran_utils.default__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "default__timestamp_add", "macro_sql": "{% macro default__timestamp_add(datepart, interval, from_timestamp) %}\n\n timestampadd(\n {{ datepart }},\n {{ interval }},\n {{ from_timestamp }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.220246}, "macro.fivetran_utils.bigquery__timestamp_add": {"unique_id": "macro.fivetran_utils.bigquery__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "bigquery__timestamp_add", "macro_sql": "{% macro bigquery__timestamp_add(datepart, interval, from_timestamp) %}\n\n timestamp_add({{ from_timestamp }}, interval {{ interval }} {{ datepart }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.220649}, "macro.fivetran_utils.redshift__timestamp_add": {"unique_id": "macro.fivetran_utils.redshift__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "redshift__timestamp_add", "macro_sql": "{% macro redshift__timestamp_add(datepart, interval, from_timestamp) %}\n\n dateadd(\n {{ datepart }},\n {{ interval }},\n {{ from_timestamp }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.2210639}, "macro.fivetran_utils.postgres__timestamp_add": {"unique_id": "macro.fivetran_utils.postgres__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "postgres__timestamp_add", "macro_sql": "{% macro postgres__timestamp_add(datepart, interval, from_timestamp) %}\n\n {{ from_timestamp }} + ((interval '1 {{ datepart }}') * ({{ interval }}))\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.221461}, "macro.fivetran_utils.spark__timestamp_add": {"unique_id": "macro.fivetran_utils.spark__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "spark__timestamp_add", "macro_sql": "{% macro spark__timestamp_add(datepart, interval, from_timestamp) %}\n\n {{ dbt_utils.dateadd(datepart, interval, from_timestamp) }}\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.22188}, "macro.fivetran_utils.ceiling": {"unique_id": "macro.fivetran_utils.ceiling", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "name": "ceiling", "macro_sql": "{% macro ceiling(num) -%}\n\n{{ adapter.dispatch('ceiling', 'fivetran_utils') (num) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__ceiling"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.222653}, "macro.fivetran_utils.default__ceiling": {"unique_id": "macro.fivetran_utils.default__ceiling", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "name": "default__ceiling", "macro_sql": "{% macro default__ceiling(num) %}\n ceiling({{ num }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.222917}, "macro.fivetran_utils.snowflake__ceiling": {"unique_id": "macro.fivetran_utils.snowflake__ceiling", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "name": "snowflake__ceiling", "macro_sql": "{% macro snowflake__ceiling(num) %}\n ceil({{ num }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.2231748}, "macro.fivetran_utils.remove_prefix_from_columns": {"unique_id": "macro.fivetran_utils.remove_prefix_from_columns", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/remove_prefix_from_columns.sql", "original_file_path": "macros/remove_prefix_from_columns.sql", "name": "remove_prefix_from_columns", "macro_sql": "{% macro remove_prefix_from_columns(columns, prefix='', exclude=[]) %}\n\n {%- for col in columns if col.name not in exclude -%}\n {%- if col.name[:prefix|length]|lower == prefix -%}\n {{ col.name }} as {{ col.name[prefix|length:] }}\n {%- else -%}\n {{ col.name }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {% endfor -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.224908}, "macro.fivetran_utils.union_data": {"unique_id": "macro.fivetran_utils.union_data", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/union_data.sql", "original_file_path": "macros/union_data.sql", "name": "union_data", "macro_sql": "{% macro union_data(table_identifier, database_variable, schema_variable, default_database, default_schema, default_variable, union_schema_variable='union_schemas', union_database_variable='union_databases') -%}\n\n{{ adapter.dispatch('union_data', 'fivetran_utils') (\n table_identifier, \n database_variable, \n schema_variable, \n default_database, \n default_schema, \n default_variable,\n union_schema_variable,\n union_database_variable\n ) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__union_data"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.227359}, "macro.fivetran_utils.default__union_data": {"unique_id": "macro.fivetran_utils.default__union_data", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/union_data.sql", "original_file_path": "macros/union_data.sql", "name": "default__union_data", "macro_sql": "{% macro default__union_data(\n table_identifier, \n database_variable, \n schema_variable, \n default_database, \n default_schema, \n default_variable,\n union_schema_variable,\n union_database_variable\n ) %}\n\n{% if var(union_schema_variable, none) %}\n\n {% set relations = [] %}\n \n {% if var(union_schema_variable) is string %}\n {% set trimmed = var(union_schema_variable)|trim('[')|trim(']') %}\n {% set schemas = trimmed.split(',')|map('trim',\" \")|map('trim','\"')|map('trim',\"'\") %}\n {% else %}\n {% set schemas = var(union_schema_variable) %}\n {% endif %}\n\n {% for schema in var(union_schema_variable) %}\n\n {% set relation=adapter.get_relation(\n database=var(database_variable, default_database),\n schema=schema,\n identifier=table_identifier\n ) -%}\n \n {% set relation_exists=relation is not none %}\n\n {% if relation_exists %}\n\n {% do relations.append(relation) %}\n \n {% endif %}\n\n {% endfor %}\n\n {{ dbt_utils.union_relations(relations) }}\n\n{% elif var(union_database_variable, none) %}\n\n {% set relations = [] %}\n\n {% for database in var(union_database_variable) %}\n\n {% set relation=adapter.get_relation(\n database=database,\n schema=var(schema_variable, default_schema),\n identifier=table_identifier\n ) -%}\n\n {% set relation_exists=relation is not none %}\n\n {% if relation_exists %}\n\n {% do relations.append(relation) %}\n \n {% endif %}\n\n {% endfor %}\n\n {{ dbt_utils.union_relations(relations) }}\n\n{% else %}\n\n select * \n from {{ var(default_variable) }}\n\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.union_relations"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.231776}, "macro.fivetran_utils.dummy_coalesce_value": {"unique_id": "macro.fivetran_utils.dummy_coalesce_value", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/dummy_coalesce_value.sql", "original_file_path": "macros/dummy_coalesce_value.sql", "name": "dummy_coalesce_value", "macro_sql": "{% macro dummy_coalesce_value(column) %}\n\n{% set coalesce_value = {\n 'STRING': \"'DUMMY_STRING'\",\n 'BOOLEAN': 'null',\n 'INT': 999999999,\n 'FLOAT': 999999999.99,\n 'TIMESTAMP': 'cast(\"2099-12-31\" as timestamp)',\n 'DATE': 'cast(\"2099-12-31\" as date)',\n} %}\n\n{% if column.is_float() %}\n{{ return(coalesce_value['FLOAT']) }}\n\n{% elif column.is_numeric() %}\n{{ return(coalesce_value['INT']) }}\n\n{% elif column.is_string() %}\n{{ return(coalesce_value['STRING']) }}\n\n{% elif column.data_type|lower == 'boolean' %}\n{{ return(coalesce_value['BOOLEAN']) }}\n\n{% elif 'timestamp' in column.data_type|lower %}\n{{ return(coalesce_value['TIMESTAMP']) }}\n\n{% elif 'date' in column.data_type|lower %}\n{{ return(coalesce_value['DATE']) }}\n\n{% elif 'int' in column.data_type|lower %}\n{{ return(coalesce_value['INT']) }}\n\n{% endif %}\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.235132}, "macro.fivetran_utils.array_agg": {"unique_id": "macro.fivetran_utils.array_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "name": "array_agg", "macro_sql": "{% macro array_agg(field_to_agg) -%}\n\n{{ adapter.dispatch('array_agg', 'fivetran_utils') (field_to_agg) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__array_agg"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.2358541}, "macro.fivetran_utils.default__array_agg": {"unique_id": "macro.fivetran_utils.default__array_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "name": "default__array_agg", "macro_sql": "{% macro default__array_agg(field_to_agg) %}\n array_agg({{ field_to_agg }})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.2361212}, "macro.fivetran_utils.redshift__array_agg": {"unique_id": "macro.fivetran_utils.redshift__array_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "name": "redshift__array_agg", "macro_sql": "{% macro redshift__array_agg(field_to_agg) %}\n listagg({{ field_to_agg }}, ',')\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.236371}, "macro.fivetran_utils.empty_variable_warning": {"unique_id": "macro.fivetran_utils.empty_variable_warning", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/empty_variable_warning.sql", "original_file_path": "macros/empty_variable_warning.sql", "name": "empty_variable_warning", "macro_sql": "{% macro empty_variable_warning(variable, downstream_model) %}\n\n{% if not var(variable) %}\n{{ log(\n \"\"\"\n Warning: You have passed an empty list to the \"\"\" ~ variable ~ \"\"\".\n As a result, you won't see the history of any columns in the \"\"\" ~ downstream_model ~ \"\"\" model.\n \"\"\",\n info=True\n) }}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.23764}, "macro.fivetran_utils.enabled_vars_one_true": {"unique_id": "macro.fivetran_utils.enabled_vars_one_true", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/enabled_vars_one_true.sql", "original_file_path": "macros/enabled_vars_one_true.sql", "name": "enabled_vars_one_true", "macro_sql": "{% macro enabled_vars_one_true(vars) %}\n\n{% for v in vars %}\n \n {% if var(v, False) == True %}\n {{ return(True) }}\n {% endif %}\n\n{% endfor %}\n\n{{ return(False) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.23872}, "macro.tiktok_ads_source.get_ad_group_history_columns": {"unique_id": "macro.tiktok_ads_source.get_ad_group_history_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_ad_group_history_columns.sql", "original_file_path": "macros/get_ad_group_history_columns.sql", "name": "get_ad_group_history_columns", "macro_sql": "{% macro get_ad_group_history_columns() %}\n\n{% set columns = [\n {\"name\": \"action_days\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"adgroup_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"adgroup_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"advertiser_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"audience_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"budget\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"category\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"display_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"frequency\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"frequency_schedule\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"gender\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"landing_page_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"updated_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"interest_category_v_2\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"action_categories\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"age\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"languages\", \"datatype\": dbt_utils.type_string()}\n\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_numeric", "macro.dbt_utils.type_string", "macro.dbt_utils.type_float", "macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.243495}, "macro.tiktok_ads_source.get_ad_group_report_hourly_columns": {"unique_id": "macro.tiktok_ads_source.get_ad_group_report_hourly_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_ad_group_report_hourly_columns.sql", "original_file_path": "macros/get_ad_group_report_hourly_columns.sql", "name": "get_ad_group_report_hourly_columns", "macro_sql": "{% macro get_ad_group_report_hourly_columns() %}\n\n{% set columns = [\n {\"name\": \"adgroup_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"average_video_play\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"average_video_play_per_user\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"clicks\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"comments\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_conversion\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cpc\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cpm\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"ctr\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"follows\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"impressions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"likes\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"profile_visits\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"reach\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"shares\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"spend\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"stat_time_hour\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"video_play_actions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_25\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_50\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_75\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_2_s\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_6_s\", \"datatype\": dbt_utils.type_numeric()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_numeric", "macro.dbt_utils.type_float", "macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.250478}, "macro.tiktok_ads_source.get_advertiser_columns": {"unique_id": "macro.tiktok_ads_source.get_advertiser_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_advertiser_columns.sql", "original_file_path": "macros/get_advertiser_columns.sql", "name": "get_advertiser_columns", "macro_sql": "{% macro get_advertiser_columns() %}\n\n{% set columns = [\n {\"name\": \"address\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"balance\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"company\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"contacter\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"country\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"currency\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"description\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"email\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"industry\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"language\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"phone_number\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"telephone\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"timezone\", \"datatype\": dbt_utils.type_string()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string", "macro.dbt_utils.type_float", "macro.dbt_utils.type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.254393}, "macro.tiktok_ads_source.get_campaign_history_columns": {"unique_id": "macro.tiktok_ads_source.get_campaign_history_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_campaign_history_columns.sql", "original_file_path": "macros/get_campaign_history_columns.sql", "name": "get_campaign_history_columns", "macro_sql": "{% macro get_campaign_history_columns() %}\n\n{% set columns = [\n {\"name\": \"advertiser_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"campaign_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"split_test_variable\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"updated_at\", \"datatype\": dbt_utils.type_timestamp()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_numeric", "macro.dbt_utils.type_string", "macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.256351}, "macro.tiktok_ads_source.get_campaign_report_hourly_columns": {"unique_id": "macro.tiktok_ads_source.get_campaign_report_hourly_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_campaign_report_hourly_columns.sql", "original_file_path": "macros/get_campaign_report_hourly_columns.sql", "name": "get_campaign_report_hourly_columns", "macro_sql": "{% macro get_campaign_report_hourly_columns() %}\n\n{% set columns = [\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"ad_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"average_video_play\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"average_video_play_per_user\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"clicks\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"comments\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_conversion\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cpc\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cpm\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"ctr\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"follows\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"impressions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"likes\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"profile_visits\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"reach\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"shares\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"spend\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"stat_time_hour\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"video_play_actions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_25\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_50\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_75\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_2_s\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_6_s\", \"datatype\": dbt_utils.type_numeric()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_numeric", "macro.dbt_utils.type_float", "macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.26294}, "macro.tiktok_ads_source.get_ad_history_columns": {"unique_id": "macro.tiktok_ads_source.get_ad_history_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_ad_history_columns.sql", "original_file_path": "macros/get_ad_history_columns.sql", "name": "get_ad_history_columns", "macro_sql": "{% macro get_ad_history_columns() %}\n\n{% set columns = [\n {\"name\": \"ad_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"ad_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"adgroup_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"advertiser_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"call_to_action\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"click_tracking_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"impression_tracking_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"landing_page_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"updated_at\", \"datatype\": dbt_utils.type_timestamp()}\n\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_numeric", "macro.dbt_utils.type_string", "macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.265891}, "macro.tiktok_ads_source.get_ad_report_hourly_columns": {"unique_id": "macro.tiktok_ads_source.get_ad_report_hourly_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_ad_report_hourly_columns.sql", "original_file_path": "macros/get_ad_report_hourly_columns.sql", "name": "get_ad_report_hourly_columns", "macro_sql": "{% macro get_ad_report_hourly_columns() %}\n\n{% set columns = [\n {\"name\": \"ad_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"average_video_play\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"average_video_play_per_user\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"clicks\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"comments\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_conversion\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cpc\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cpm\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"ctr\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"follows\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"impressions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"likes\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"profile_visits\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"reach\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"shares\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"spend\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"stat_time_hour\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"video_play_actions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_25\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_50\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_75\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_2_s\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_6_s\", \"datatype\": dbt_utils.type_numeric()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_numeric", "macro.dbt_utils.type_float", "macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.272185}}, "docs": {"dbt.__overview__": {"unique_id": "dbt.__overview__", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "overview.md", "original_file_path": "docs/overview.md", "name": "__overview__", "block_contents": "### Welcome!\n\nWelcome to the auto-generated documentation for your dbt project!\n\n### Navigation\n\nYou can use the `Project` and `Database` navigation tabs on the left side of the window to explore the models\nin your project.\n\n#### Project Tab\nThe `Project` tab mirrors the directory structure of your dbt project. In this tab, you can see all of the\nmodels defined in your dbt project, as well as models imported from dbt packages.\n\n#### Database Tab\nThe `Database` tab also exposes your models, but in a format that looks more like a database explorer. This view\nshows relations (tables and views) grouped into database schemas. Note that ephemeral models are _not_ shown\nin this interface, as they do not exist in the database.\n\n### Graph Exploration\nYou can click the blue icon on the bottom-right corner of the page to view the lineage graph of your models.\n\nOn model pages, you'll see the immediate parents and children of the model you're exploring. By clicking the `Expand`\nbutton at the top-right of this lineage pane, you'll be able to see all of the models that are used to build,\nor are built from, the model you're exploring.\n\nOnce expanded, you'll be able to use the `--select` and `--exclude` model selection syntax to filter the\nmodels in the graph. For more information on model selection, check out the [dbt docs](https://docs.getdbt.com/docs/model-selection-syntax).\n\nNote that you can also right-click on models to interactively filter and explore the graph.\n\n---\n\n### More information\n\n- [What is dbt](https://docs.getdbt.com/docs/overview)?\n- Read the [dbt viewpoint](https://docs.getdbt.com/docs/viewpoint)\n- [Installation](https://docs.getdbt.com/docs/installation)\n- Join the [dbt Community](https://www.getdbt.com/community/) for questions and discussion"}}, "exposures": {}, "metrics": {}, "selectors": {}, "disabled": {}, "parent_map": {"model.tiktok_ads.tiktok_ads__ad_group_report": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "model.tiktok_ads.tiktok_ads__url_report": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad", "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "model.tiktok_ads.tiktok_ads__account_report": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad", "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "model.tiktok_ads.tiktok_ads__campaign_report": ["model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "model.tiktok_ads_source.stg_tiktok_ads__advertiser", "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"], "model.tiktok_ads.tiktok_ads__ad_report": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad", "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "model.tiktok_ads.int_tiktok_ads__most_recent_campaign": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"], "model.tiktok_ads.int_tiktok_ads__most_recent_ad": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"], "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__advertiser": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp", "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__ad_history": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_history": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp": ["source.tiktok_ads_source.tiktok_ads.ad_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp": ["source.tiktok_ads_source.tiktok_ads.ad_history"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp": ["source.tiktok_ads_source.tiktok_ads.adgroup_history"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp": ["source.tiktok_ads_source.tiktok_ads.campaign_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp": ["source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp": ["source.tiktok_ads_source.tiktok_ads.campaign_history"], "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp": ["source.tiktok_ads_source.tiktok_ads.advertiser"], "test.tiktok_ads.not_null_tiktok_ads__account_report_date_day.5a77812746": ["model.tiktok_ads.tiktok_ads__account_report"], "test.tiktok_ads.not_null_tiktok_ads__account_report_advertiser_id.bbeabada6f": ["model.tiktok_ads.tiktok_ads__account_report"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__account_report_advertiser_id__date_day.7b27a2f43b": ["model.tiktok_ads.tiktok_ads__account_report"], "test.tiktok_ads.not_null_tiktok_ads__ad_report_date_day.d61ee4a5ed": ["model.tiktok_ads.tiktok_ads__ad_report"], "test.tiktok_ads.not_null_tiktok_ads__ad_report_ad_id.2d8166e707": ["model.tiktok_ads.tiktok_ads__ad_report"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_report_ad_id__date_day.15357fac89": ["model.tiktok_ads.tiktok_ads__ad_report"], "test.tiktok_ads.not_null_tiktok_ads__ad_group_report_date_day.e39164964e": ["model.tiktok_ads.tiktok_ads__ad_group_report"], "test.tiktok_ads.not_null_tiktok_ads__ad_group_report_ad_group_id.17fb8710f4": ["model.tiktok_ads.tiktok_ads__ad_group_report"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day.2eb4c2ff6d": ["model.tiktok_ads.tiktok_ads__ad_group_report"], "test.tiktok_ads.not_null_tiktok_ads__campaign_report_date_day.3807b0e836": ["model.tiktok_ads.tiktok_ads__campaign_report"], "test.tiktok_ads.not_null_tiktok_ads__campaign_report_campaign_id.8a2b0c8ef8": ["model.tiktok_ads.tiktok_ads__campaign_report"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day.cc5f756c69": ["model.tiktok_ads.tiktok_ads__campaign_report"], "test.tiktok_ads.not_null_tiktok_ads__url_report_date_day.d593573eff": ["model.tiktok_ads.tiktok_ads__url_report"], "test.tiktok_ads.not_null_tiktok_ads__url_report_ad_id.6c41067bd0": ["model.tiktok_ads.tiktok_ads__url_report"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__url_report_ad_id__date_day.8b73e512af": ["model.tiktok_ads.tiktok_ads__url_report"], "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.fcb8c561bc": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad_group"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at.e2e9914076": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad_group"], "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_ad_id.14e9c145ca": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at.f58d824f65": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad"], "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_campaign_campaign_id.8cefa8981c": ["model.tiktok_ads.int_tiktok_ads__most_recent_campaign"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at.39077adf71": ["model.tiktok_ads.int_tiktok_ads__most_recent_campaign"], "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_ad_id.ee84d783ed": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour.9e2a2dca81": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour.ca4b495127": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour.e75e13184c": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"], "source.tiktok_ads_source.tiktok_ads.advertiser": [], "source.tiktok_ads_source.tiktok_ads.campaign_history": [], "source.tiktok_ads_source.tiktok_ads.adgroup_history": [], "source.tiktok_ads_source.tiktok_ads.ad_history": [], "source.tiktok_ads_source.tiktok_ads.ad_report_hourly": [], "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly": [], "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly": []}, "child_map": {"model.tiktok_ads.tiktok_ads__ad_group_report": ["test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day.2eb4c2ff6d", "test.tiktok_ads.not_null_tiktok_ads__ad_group_report_ad_group_id.17fb8710f4", "test.tiktok_ads.not_null_tiktok_ads__ad_group_report_date_day.e39164964e"], "model.tiktok_ads.tiktok_ads__url_report": ["test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__url_report_ad_id__date_day.8b73e512af", "test.tiktok_ads.not_null_tiktok_ads__url_report_ad_id.6c41067bd0", "test.tiktok_ads.not_null_tiktok_ads__url_report_date_day.d593573eff"], "model.tiktok_ads.tiktok_ads__account_report": ["test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__account_report_advertiser_id__date_day.7b27a2f43b", "test.tiktok_ads.not_null_tiktok_ads__account_report_advertiser_id.bbeabada6f", "test.tiktok_ads.not_null_tiktok_ads__account_report_date_day.5a77812746"], "model.tiktok_ads.tiktok_ads__campaign_report": ["test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day.cc5f756c69", "test.tiktok_ads.not_null_tiktok_ads__campaign_report_campaign_id.8a2b0c8ef8", "test.tiktok_ads.not_null_tiktok_ads__campaign_report_date_day.3807b0e836"], "model.tiktok_ads.tiktok_ads__ad_report": ["test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_report_ad_id__date_day.15357fac89", "test.tiktok_ads.not_null_tiktok_ads__ad_report_ad_id.2d8166e707", "test.tiktok_ads.not_null_tiktok_ads__ad_report_date_day.d61ee4a5ed"], "model.tiktok_ads.int_tiktok_ads__most_recent_campaign": ["model.tiktok_ads.tiktok_ads__ad_group_report", "model.tiktok_ads.tiktok_ads__ad_report", "model.tiktok_ads.tiktok_ads__campaign_report", "model.tiktok_ads.tiktok_ads__url_report", "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at.39077adf71", "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_campaign_campaign_id.8cefa8981c"], "model.tiktok_ads.int_tiktok_ads__most_recent_ad": ["model.tiktok_ads.tiktok_ads__account_report", "model.tiktok_ads.tiktok_ads__ad_report", "model.tiktok_ads.tiktok_ads__url_report", "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at.f58d824f65", "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_ad_id.14e9c145ca"], "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group": ["model.tiktok_ads.tiktok_ads__ad_group_report", "model.tiktok_ads.tiktok_ads__ad_report", "model.tiktok_ads.tiktok_ads__url_report", "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at.e2e9914076", "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.fcb8c561bc"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly": ["model.tiktok_ads.tiktok_ads__campaign_report", "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34", "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb", "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour.e75e13184c"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly": ["model.tiktok_ads.tiktok_ads__ad_group_report", "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad", "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1", "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour.ca4b495127"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de", "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad"], "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly": ["model.tiktok_ads.tiktok_ads__account_report", "model.tiktok_ads.tiktok_ads__ad_report", "model.tiktok_ads.tiktok_ads__url_report", "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d", "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_ad_id.ee84d783ed", "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour.9e2a2dca81"], "model.tiktok_ads_source.stg_tiktok_ads__advertiser": ["model.tiktok_ads.tiktok_ads__account_report", "model.tiktok_ads.tiktok_ads__ad_group_report", "model.tiktok_ads.tiktok_ads__ad_report", "model.tiktok_ads.tiktok_ads__campaign_report", "model.tiktok_ads.tiktok_ads__url_report", "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def", "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66"], "model.tiktok_ads_source.stg_tiktok_ads__ad_history": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad", "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1", "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_history": ["model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b", "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1"], "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history", "model.tiktok_ads_source.stg_tiktok_ads__ad_history"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history", "model.tiktok_ads_source.stg_tiktok_ads__campaign_history"], "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser", "model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "test.tiktok_ads.not_null_tiktok_ads__account_report_date_day.5a77812746": [], "test.tiktok_ads.not_null_tiktok_ads__account_report_advertiser_id.bbeabada6f": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__account_report_advertiser_id__date_day.7b27a2f43b": [], "test.tiktok_ads.not_null_tiktok_ads__ad_report_date_day.d61ee4a5ed": [], "test.tiktok_ads.not_null_tiktok_ads__ad_report_ad_id.2d8166e707": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_report_ad_id__date_day.15357fac89": [], "test.tiktok_ads.not_null_tiktok_ads__ad_group_report_date_day.e39164964e": [], "test.tiktok_ads.not_null_tiktok_ads__ad_group_report_ad_group_id.17fb8710f4": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day.2eb4c2ff6d": [], "test.tiktok_ads.not_null_tiktok_ads__campaign_report_date_day.3807b0e836": [], "test.tiktok_ads.not_null_tiktok_ads__campaign_report_campaign_id.8a2b0c8ef8": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day.cc5f756c69": [], "test.tiktok_ads.not_null_tiktok_ads__url_report_date_day.d593573eff": [], "test.tiktok_ads.not_null_tiktok_ads__url_report_ad_id.6c41067bd0": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__url_report_ad_id__date_day.8b73e512af": [], "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.fcb8c561bc": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at.e2e9914076": [], "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_ad_id.14e9c145ca": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at.f58d824f65": [], "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_campaign_campaign_id.8cefa8981c": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at.39077adf71": [], "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_ad_id.ee84d783ed": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour.9e2a2dca81": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour.ca4b495127": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour.e75e13184c": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34": [], "source.tiktok_ads_source.tiktok_ads.advertiser": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp"], "source.tiktok_ads_source.tiktok_ads.campaign_history": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp"], "source.tiktok_ads_source.tiktok_ads.adgroup_history": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp"], "source.tiktok_ads_source.tiktok_ads.ad_history": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp"], "source.tiktok_ads_source.tiktok_ads.ad_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp"], "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp"], "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp"]}} \ No newline at end of file diff --git a/docs/run_results.json b/docs/run_results.json index 69a096d..9257fd9 100644 --- a/docs/run_results.json +++ b/docs/run_results.json @@ -1 +1 @@ -{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/run-results/v4.json", "dbt_version": "1.0.0", "generated_at": "2022-07-19T17:45:41.159099Z", "invocation_id": "6dabac40-7cab-45b6-976c-67e398be82f2", "env": {}}, "results": [{"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:47.640915Z", "completed_at": "2022-07-19T17:44:47.704534Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:47.710267Z", "completed_at": "2022-07-19T17:44:48.656179Z"}], "thread_id": "Thread-2", "execution_time": 1.0178651809692383, "adapter_response": {"_message": "OK", "code": "CREATE VIEW"}, "message": "OK", "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:47.641607Z", "completed_at": "2022-07-19T17:44:47.709174Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:47.726167Z", "completed_at": "2022-07-19T17:44:48.727344Z"}], "thread_id": "Thread-4", "execution_time": 1.0883028507232666, "adapter_response": {"_message": "OK", "code": "CREATE VIEW"}, "message": "OK", "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:47.640705Z", "completed_at": "2022-07-19T17:44:47.709614Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:47.762855Z", "completed_at": "2022-07-19T17:44:48.750433Z"}], "thread_id": "Thread-1", "execution_time": 1.1129519939422607, "adapter_response": {"_message": "OK", "code": "CREATE VIEW"}, "message": "OK", "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:47.704094Z", "completed_at": "2022-07-19T17:44:47.736355Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:47.766466Z", "completed_at": "2022-07-19T17:44:48.764035Z"}], "thread_id": "Thread-3", "execution_time": 1.123201847076416, "adapter_response": {"_message": "OK", "code": "CREATE VIEW"}, "message": "OK", "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:48.659369Z", "completed_at": "2022-07-19T17:44:48.664109Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:48.664425Z", "completed_at": "2022-07-19T17:44:49.598610Z"}], "thread_id": "Thread-2", "execution_time": 0.9402968883514404, "adapter_response": {"_message": "OK", "code": "CREATE VIEW"}, "message": "OK", "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:48.730178Z", "completed_at": "2022-07-19T17:44:48.734320Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:48.734665Z", "completed_at": "2022-07-19T17:44:49.697903Z"}], "thread_id": "Thread-4", "execution_time": 0.9685781002044678, "adapter_response": {"_message": "OK", "code": "CREATE VIEW"}, "message": "OK", "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:48.753000Z", "completed_at": "2022-07-19T17:44:48.757172Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:48.757518Z", "completed_at": "2022-07-19T17:44:49.708509Z"}], "thread_id": "Thread-1", "execution_time": 0.9565601348876953, "adapter_response": {"_message": "OK", "code": "CREATE VIEW"}, "message": "OK", "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:48.768395Z", "completed_at": "2022-07-19T17:44:49.169101Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:49.169435Z", "completed_at": "2022-07-19T17:44:51.965630Z"}], "thread_id": "Thread-3", "execution_time": 3.198690891265869, "adapter_response": {"_message": "CREATE TABLE (26.0 rows, 5.3 KB processed)", "code": "CREATE TABLE", "rows_affected": 26, "bytes_processed": 5408}, "message": "CREATE TABLE (26.0 rows, 5.3 KB processed)", "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:49.601194Z", "completed_at": "2022-07-19T17:44:49.928465Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:49.928756Z", "completed_at": "2022-07-19T17:44:52.739865Z"}], "thread_id": "Thread-2", "execution_time": 3.139665126800537, "adapter_response": {"_message": "CREATE TABLE (26.0 rows, 5.3 KB processed)", "code": "CREATE TABLE", "rows_affected": 26, "bytes_processed": 5408}, "message": "CREATE TABLE (26.0 rows, 5.3 KB processed)", "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:49.712107Z", "completed_at": "2022-07-19T17:44:50.140948Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:50.141648Z", "completed_at": "2022-07-19T17:44:53.129881Z"}], "thread_id": "Thread-1", "execution_time": 3.418915033340454, "adapter_response": {"_message": "CREATE TABLE (1.0 rows, 191.0 Bytes processed)", "code": "CREATE TABLE", "rows_affected": 1, "bytes_processed": 191}, "message": "CREATE TABLE (1.0 rows, 191.0 Bytes processed)", "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:49.700428Z", "completed_at": "2022-07-19T17:44:50.092669Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:50.093293Z", "completed_at": "2022-07-19T17:44:53.193656Z"}], "thread_id": "Thread-4", "execution_time": 3.4941351413726807, "adapter_response": {"_message": "CREATE TABLE (2.0 rows, 278.0 Bytes processed)", "code": "CREATE TABLE", "rows_affected": 2, "bytes_processed": 278}, "message": "CREATE TABLE (2.0 rows, 278.0 Bytes processed)", "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:51.969372Z", "completed_at": "2022-07-19T17:44:52.351817Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:52.352167Z", "completed_at": "2022-07-19T17:44:55.413926Z"}], "thread_id": "Thread-3", "execution_time": 3.445889949798584, "adapter_response": {"_message": "CREATE TABLE (1.0 rows, 175.0 Bytes processed)", "code": "CREATE TABLE", "rows_affected": 1, "bytes_processed": 175}, "message": "CREATE TABLE (1.0 rows, 175.0 Bytes processed)", "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:52.743048Z", "completed_at": "2022-07-19T17:44:53.165452Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:53.165862Z", "completed_at": "2022-07-19T17:44:56.223151Z"}], "thread_id": "Thread-2", "execution_time": 3.4815449714660645, "adapter_response": {"_message": "CREATE TABLE (2.0 rows, 138.0 Bytes processed)", "code": "CREATE TABLE", "rows_affected": 2, "bytes_processed": 138}, "message": "CREATE TABLE (2.0 rows, 138.0 Bytes processed)", "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:53.133985Z", "completed_at": "2022-07-19T17:44:53.618472Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:53.618807Z", "completed_at": "2022-07-19T17:44:56.418470Z"}], "thread_id": "Thread-1", "execution_time": 3.2864370346069336, "adapter_response": {"_message": "CREATE TABLE (26.0 rows, 5.3 KB processed)", "code": "CREATE TABLE", "rows_affected": 26, "bytes_processed": 5408}, "message": "CREATE TABLE (26.0 rows, 5.3 KB processed)", "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:55.417551Z", "completed_at": "2022-07-19T17:44:55.459815Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:55.460215Z", "completed_at": "2022-07-19T17:44:58.753625Z"}], "thread_id": "Thread-4", "execution_time": 3.3373730182647705, "adapter_response": {"_message": "CREATE TABLE (5.0 rows, 3.5 KB processed)", "code": "CREATE TABLE", "rows_affected": 5, "bytes_processed": 3589}, "message": "CREATE TABLE (5.0 rows, 3.5 KB processed)", "failures": null, "unique_id": "model.tiktok_ads.tiktok_ads__account_report"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:56.235600Z", "completed_at": "2022-07-19T17:44:56.330057Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:56.330435Z", "completed_at": "2022-07-19T17:44:59.427414Z"}], "thread_id": "Thread-3", "execution_time": 3.1934618949890137, "adapter_response": {"_message": "CREATE TABLE (5.0 rows, 3.8 KB processed)", "code": "CREATE TABLE", "rows_affected": 5, "bytes_processed": 3937}, "message": "CREATE TABLE (5.0 rows, 3.8 KB processed)", "failures": null, "unique_id": "model.tiktok_ads.tiktok_ads__ad_report"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:56.235398Z", "completed_at": "2022-07-19T17:44:56.326152Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:56.326525Z", "completed_at": "2022-07-19T17:44:59.567816Z"}], "thread_id": "Thread-2", "execution_time": 3.3343770503997803, "adapter_response": {"_message": "CREATE TABLE (5.0 rows, 3.8 KB processed)", "code": "CREATE TABLE", "rows_affected": 5, "bytes_processed": 3876}, "message": "CREATE TABLE (5.0 rows, 3.8 KB processed)", "failures": null, "unique_id": "model.tiktok_ads.tiktok_ads__ad_group_report"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:58.757502Z", "completed_at": "2022-07-19T17:44:58.799176Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:58.799601Z", "completed_at": "2022-07-19T17:45:01.886900Z"}], "thread_id": "Thread-4", "execution_time": 3.130856990814209, "adapter_response": {"_message": "CREATE TABLE (5.0 rows, 3.6 KB processed)", "code": "CREATE TABLE", "rows_affected": 5, "bytes_processed": 3644}, "message": "CREATE TABLE (5.0 rows, 3.6 KB processed)", "failures": null, "unique_id": "model.tiktok_ads.tiktok_ads__campaign_report"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-19T17:44:56.422132Z", "completed_at": "2022-07-19T17:44:56.470128Z"}, {"name": "execute", "started_at": "2022-07-19T17:44:56.470488Z", "completed_at": "2022-07-19T17:45:41.153445Z"}], "thread_id": "Thread-1", "execution_time": 44.73266816139221, "adapter_response": {"_message": "CREATE TABLE (5.0 rows, 3.9 KB processed)", "code": "CREATE TABLE", "rows_affected": 5, "bytes_processed": 4021}, "message": "CREATE TABLE (5.0 rows, 3.9 KB processed)", "failures": null, "unique_id": "model.tiktok_ads.tiktok_ads__url_report"}], "elapsed_time": 54.804869174957275, "args": {"write_json": true, "use_colors": true, "printer_width": 80, "version_check": true, "partial_parse": true, "static_parser": true, "profiles_dir": "/Users/renee.li/.dbt", "send_anonymous_usage_stats": true, "event_buffer_size": 100000, "which": "run", "rpc_method": "run", "indirect_selection": "eager"}} \ No newline at end of file +{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/run-results/v4.json", "dbt_version": "1.0.0", "generated_at": "2022-07-28T16:21:12.570906Z", "invocation_id": "73d9028b-4406-406d-9101-01780cecfbb9", "env": {}}, "results": [{"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.068325Z", "completed_at": "2022-07-28T16:21:11.090293Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.091156Z", "completed_at": "2022-07-28T16:21:11.091195Z"}], "thread_id": "Thread-1", "execution_time": 0.026488065719604492, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.069018Z", "completed_at": "2022-07-28T16:21:11.090890Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.092955Z", "completed_at": "2022-07-28T16:21:11.092966Z"}], "thread_id": "Thread-2", "execution_time": 0.027742862701416016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.075447Z", "completed_at": "2022-07-28T16:21:11.091440Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.093627Z", "completed_at": "2022-07-28T16:21:11.093638Z"}], "thread_id": "Thread-3", "execution_time": 0.0279691219329834, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.075673Z", "completed_at": "2022-07-28T16:21:11.091644Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.093947Z", "completed_at": "2022-07-28T16:21:11.093958Z"}], "thread_id": "Thread-4", "execution_time": 0.027974843978881836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.097901Z", "completed_at": "2022-07-28T16:21:11.105289Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.122391Z", "completed_at": "2022-07-28T16:21:11.122409Z"}], "thread_id": "Thread-1", "execution_time": 0.028783082962036133, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.104794Z", "completed_at": "2022-07-28T16:21:11.124407Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.126970Z", "completed_at": "2022-07-28T16:21:11.126982Z"}], "thread_id": "Thread-3", "execution_time": 0.037214040756225586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.104449Z", "completed_at": "2022-07-28T16:21:11.125455Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.134915Z", "completed_at": "2022-07-28T16:21:11.134928Z"}], "thread_id": "Thread-2", "execution_time": 0.03870391845703125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.126241Z", "completed_at": "2022-07-28T16:21:11.615795Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.616155Z", "completed_at": "2022-07-28T16:21:11.616166Z"}], "thread_id": "Thread-1", "execution_time": 0.49252915382385254, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.140923Z", "completed_at": "2022-07-28T16:21:11.637321Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.637664Z", "completed_at": "2022-07-28T16:21:11.637673Z"}], "thread_id": "Thread-2", "execution_time": 0.49871373176574707, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.140723Z", "completed_at": "2022-07-28T16:21:11.754491Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.758504Z", "completed_at": "2022-07-28T16:21:11.758514Z"}], "thread_id": "Thread-3", "execution_time": 0.6203320026397705, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.105097Z", "completed_at": "2022-07-28T16:21:11.763441Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.764740Z", "completed_at": "2022-07-28T16:21:11.764749Z"}], "thread_id": "Thread-4", "execution_time": 0.666701078414917, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.765955Z", "completed_at": "2022-07-28T16:21:11.779778Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.780054Z", "completed_at": "2022-07-28T16:21:11.780062Z"}], "thread_id": "Thread-4", "execution_time": 0.014925956726074219, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.781410Z", "completed_at": "2022-07-28T16:21:11.787909Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.788162Z", "completed_at": "2022-07-28T16:21:11.788169Z"}], "thread_id": "Thread-4", "execution_time": 0.0075190067291259766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.789154Z", "completed_at": "2022-07-28T16:21:11.793480Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.794227Z", "completed_at": "2022-07-28T16:21:11.794260Z"}], "thread_id": "Thread-4", "execution_time": 0.0059320926666259766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour.ca4b495127"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.795566Z", "completed_at": "2022-07-28T16:21:11.799910Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.800165Z", "completed_at": "2022-07-28T16:21:11.800171Z"}], "thread_id": "Thread-4", "execution_time": 0.005239009857177734, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.801246Z", "completed_at": "2022-07-28T16:21:11.805132Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.805412Z", "completed_at": "2022-07-28T16:21:11.805419Z"}], "thread_id": "Thread-4", "execution_time": 0.004843711853027344, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_ad_id.ee84d783ed"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.806283Z", "completed_at": "2022-07-28T16:21:11.810030Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.810290Z", "completed_at": "2022-07-28T16:21:11.810297Z"}], "thread_id": "Thread-4", "execution_time": 0.004577159881591797, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour.9e2a2dca81"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.816183Z", "completed_at": "2022-07-28T16:21:11.820571Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.820993Z", "completed_at": "2022-07-28T16:21:11.821015Z"}], "thread_id": "Thread-4", "execution_time": 0.00578618049621582, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.823359Z", "completed_at": "2022-07-28T16:21:11.826797Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.827396Z", "completed_at": "2022-07-28T16:21:11.827403Z"}], "thread_id": "Thread-4", "execution_time": 0.006294965744018555, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.833345Z", "completed_at": "2022-07-28T16:21:11.837982Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.838247Z", "completed_at": "2022-07-28T16:21:11.838253Z"}], "thread_id": "Thread-4", "execution_time": 0.005467891693115234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.839158Z", "completed_at": "2022-07-28T16:21:11.842407Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.842814Z", "completed_at": "2022-07-28T16:21:11.842822Z"}], "thread_id": "Thread-4", "execution_time": 0.0043408870697021484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.843730Z", "completed_at": "2022-07-28T16:21:11.862142Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.862428Z", "completed_at": "2022-07-28T16:21:11.862438Z"}], "thread_id": "Thread-4", "execution_time": 0.01930069923400879, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at.f58d824f65"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.863367Z", "completed_at": "2022-07-28T16:21:11.869161Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.869421Z", "completed_at": "2022-07-28T16:21:11.869428Z"}], "thread_id": "Thread-4", "execution_time": 0.006623029708862305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_ad_id.14e9c145ca"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.870315Z", "completed_at": "2022-07-28T16:21:11.877417Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.877673Z", "completed_at": "2022-07-28T16:21:11.877680Z"}], "thread_id": "Thread-4", "execution_time": 0.007972955703735352, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at.e2e9914076"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.878537Z", "completed_at": "2022-07-28T16:21:11.883296Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.883599Z", "completed_at": "2022-07-28T16:21:11.883606Z"}], "thread_id": "Thread-4", "execution_time": 0.0056247711181640625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.fcb8c561bc"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.629302Z", "completed_at": "2022-07-28T16:21:12.138409Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.138740Z", "completed_at": "2022-07-28T16:21:12.138750Z"}], "thread_id": "Thread-1", "execution_time": 0.5140399932861328, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.144633Z", "completed_at": "2022-07-28T16:21:12.168490Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.168874Z", "completed_at": "2022-07-28T16:21:12.168885Z"}], "thread_id": "Thread-1", "execution_time": 0.027053117752075195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.144310Z", "completed_at": "2022-07-28T16:21:12.169982Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.171651Z", "completed_at": "2022-07-28T16:21:12.171659Z"}], "thread_id": "Thread-4", "execution_time": 0.030555009841918945, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.638923Z", "completed_at": "2022-07-28T16:21:12.177715Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.216179Z", "completed_at": "2022-07-28T16:21:12.216191Z"}], "thread_id": "Thread-2", "execution_time": 0.58514404296875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.171900Z", "completed_at": "2022-07-28T16:21:12.227541Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.228751Z", "completed_at": "2022-07-28T16:21:12.228760Z"}], "thread_id": "Thread-1", "execution_time": 0.0684669017791748, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads.tiktok_ads__account_report"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.759897Z", "completed_at": "2022-07-28T16:21:12.228619Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.239347Z", "completed_at": "2022-07-28T16:21:12.239360Z"}], "thread_id": "Thread-3", "execution_time": 0.4814000129699707, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.228308Z", "completed_at": "2022-07-28T16:21:12.240157Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.242495Z", "completed_at": "2022-07-28T16:21:12.242505Z"}], "thread_id": "Thread-4", "execution_time": 0.018278121948242188, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.228473Z", "completed_at": "2022-07-28T16:21:12.240880Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.242955Z", "completed_at": "2022-07-28T16:21:12.242963Z"}], "thread_id": "Thread-2", "execution_time": 0.017102956771850586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.243117Z", "completed_at": "2022-07-28T16:21:12.256227Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.258059Z", "completed_at": "2022-07-28T16:21:12.258070Z"}], "thread_id": "Thread-1", "execution_time": 0.02609419822692871, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour.e75e13184c"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.249564Z", "completed_at": "2022-07-28T16:21:12.257830Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.267984Z", "completed_at": "2022-07-28T16:21:12.267994Z"}], "thread_id": "Thread-3", "execution_time": 0.026739835739135742, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__account_report_advertiser_id__date_day.7b27a2f43b"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.257617Z", "completed_at": "2022-07-28T16:21:12.268868Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.270701Z", "completed_at": "2022-07-28T16:21:12.270709Z"}], "thread_id": "Thread-2", "execution_time": 0.01612997055053711, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.not_null_tiktok_ads__account_report_date_day.5a77812746"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.257450Z", "completed_at": "2022-07-28T16:21:12.269102Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.270972Z", "completed_at": "2022-07-28T16:21:12.270997Z"}], "thread_id": "Thread-4", "execution_time": 0.022071123123168945, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.not_null_tiktok_ads__account_report_advertiser_id.bbeabada6f"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.276945Z", "completed_at": "2022-07-28T16:21:12.285033Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.292153Z", "completed_at": "2022-07-28T16:21:12.292180Z"}], "thread_id": "Thread-3", "execution_time": 0.02172708511352539, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.284740Z", "completed_at": "2022-07-28T16:21:12.292508Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.310565Z", "completed_at": "2022-07-28T16:21:12.310585Z"}], "thread_id": "Thread-2", "execution_time": 0.08010220527648926, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.293152Z", "completed_at": "2022-07-28T16:21:12.377747Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.415749Z", "completed_at": "2022-07-28T16:21:12.415762Z"}], "thread_id": "Thread-4", "execution_time": 0.12711620330810547, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads.tiktok_ads__ad_group_report"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.293489Z", "completed_at": "2022-07-28T16:21:12.383468Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.416503Z", "completed_at": "2022-07-28T16:21:12.416531Z"}], "thread_id": "Thread-1", "execution_time": 0.136322021484375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads.tiktok_ads__ad_report"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.377520Z", "completed_at": "2022-07-28T16:21:12.422563Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.467138Z", "completed_at": "2022-07-28T16:21:12.467147Z"}], "thread_id": "Thread-3", "execution_time": 0.12116503715515137, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads.tiktok_ads__campaign_report"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.415962Z", "completed_at": "2022-07-28T16:21:12.467936Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.478288Z", "completed_at": "2022-07-28T16:21:12.478298Z"}], "thread_id": "Thread-2", "execution_time": 0.10742497444152832, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads.tiktok_ads__url_report"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.468549Z", "completed_at": "2022-07-28T16:21:12.485999Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.492368Z", "completed_at": "2022-07-28T16:21:12.492381Z"}], "thread_id": "Thread-4", "execution_time": 0.0265347957611084, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at.39077adf71"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.469159Z", "completed_at": "2022-07-28T16:21:12.486871Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.493420Z", "completed_at": "2022-07-28T16:21:12.493429Z"}], "thread_id": "Thread-1", "execution_time": 0.0271451473236084, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_campaign_campaign_id.8cefa8981c"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.486566Z", "completed_at": "2022-07-28T16:21:12.493787Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.501307Z", "completed_at": "2022-07-28T16:21:12.501322Z"}], "thread_id": "Thread-3", "execution_time": 0.023773908615112305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day.2eb4c2ff6d"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.493612Z", "completed_at": "2022-07-28T16:21:12.502045Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.507709Z", "completed_at": "2022-07-28T16:21:12.507720Z"}], "thread_id": "Thread-2", "execution_time": 0.026862144470214844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.not_null_tiktok_ads__ad_group_report_ad_group_id.17fb8710f4"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.502515Z", "completed_at": "2022-07-28T16:21:12.514330Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.519615Z", "completed_at": "2022-07-28T16:21:12.519639Z"}], "thread_id": "Thread-4", "execution_time": 0.019835233688354492, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.not_null_tiktok_ads__ad_group_report_date_day.e39164964e"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.507465Z", "completed_at": "2022-07-28T16:21:12.515200Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.520851Z", "completed_at": "2022-07-28T16:21:12.520882Z"}], "thread_id": "Thread-1", "execution_time": 0.020378828048706055, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_report_ad_id__date_day.15357fac89"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.514868Z", "completed_at": "2022-07-28T16:21:12.521396Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.527473Z", "completed_at": "2022-07-28T16:21:12.527482Z"}], "thread_id": "Thread-3", "execution_time": 0.02046799659729004, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.not_null_tiktok_ads__ad_report_ad_id.2d8166e707"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.521173Z", "completed_at": "2022-07-28T16:21:12.528116Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.534750Z", "completed_at": "2022-07-28T16:21:12.534759Z"}], "thread_id": "Thread-2", "execution_time": 0.026067018508911133, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.not_null_tiktok_ads__ad_report_date_day.d61ee4a5ed"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.528580Z", "completed_at": "2022-07-28T16:21:12.541693Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.543084Z", "completed_at": "2022-07-28T16:21:12.543094Z"}], "thread_id": "Thread-4", "execution_time": 0.02095317840576172, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day.cc5f756c69"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.534572Z", "completed_at": "2022-07-28T16:21:12.542671Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.548018Z", "completed_at": "2022-07-28T16:21:12.548030Z"}], "thread_id": "Thread-1", "execution_time": 0.021209001541137695, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.not_null_tiktok_ads__campaign_report_campaign_id.8a2b0c8ef8"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.542525Z", "completed_at": "2022-07-28T16:21:12.548721Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.556181Z", "completed_at": "2022-07-28T16:21:12.556195Z"}], "thread_id": "Thread-3", "execution_time": 0.02240729331970215, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.not_null_tiktok_ads__campaign_report_date_day.3807b0e836"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.548246Z", "completed_at": "2022-07-28T16:21:12.557066Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.562825Z", "completed_at": "2022-07-28T16:21:12.562834Z"}], "thread_id": "Thread-2", "execution_time": 0.024405956268310547, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__url_report_ad_id__date_day.8b73e512af"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.556803Z", "completed_at": "2022-07-28T16:21:12.567597Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.568195Z", "completed_at": "2022-07-28T16:21:12.568205Z"}], "thread_id": "Thread-4", "execution_time": 0.013918876647949219, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.not_null_tiktok_ads__url_report_ad_id.6c41067bd0"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.562492Z", "completed_at": "2022-07-28T16:21:12.568648Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.569064Z", "completed_at": "2022-07-28T16:21:12.569071Z"}], "thread_id": "Thread-1", "execution_time": 0.012896060943603516, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.not_null_tiktok_ads__url_report_date_day.d593573eff"}], "elapsed_time": 2.4011290073394775, "args": {"write_json": true, "use_colors": true, "printer_width": 80, "version_check": true, "partial_parse": true, "static_parser": true, "profiles_dir": "/Users/renee.li/.dbt", "send_anonymous_usage_stats": true, "event_buffer_size": 100000, "compile": true, "which": "generate", "rpc_method": "docs.generate", "indirect_selection": "eager"}} \ No newline at end of file From 2462a6c477019f7de504148c588fbbb190ab1139 Mon Sep 17 00:00:00 2001 From: fivetran-reneeli Date: Mon, 1 Aug 2022 16:22:50 +0200 Subject: [PATCH 27/41] changelog --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 684387f..1c3a8d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# dbt_tiktok_ads_source v0.2.0 +PR [#3](https://github.com/fivetran/dbt_tiktok_ads_source/pull/3) applies the following updates: +## šŸŽ‰ Feature Enhancements šŸŽ‰ +- Introduces metrics passthrough capability +- Casts all timestamp fields using dbt_utils.type_timestamp() and rounds all monetary fields +- Adds not-null tests to key fields +- Introduces the identifier variable for all source models + # dbt_tiktok_ads_source v0.1.0 ## Initial Release From 06661d594e59f1110bd4df940ef975247a18bbab Mon Sep 17 00:00:00 2001 From: fivetran-reneeli Date: Mon, 1 Aug 2022 16:58:41 +0200 Subject: [PATCH 28/41] readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6b62951..1e044c8 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ # Tiktok Ads Source dbt Package ([Docs](https://fivetran.github.io/dbt_tiktok_ads_source/)) # šŸ“£ What does this dbt package do? -- Materializes [Tiktok Ads staging tables](https://fivetran.github.io/dbt_tiktok_ads_source/#!/overview/tiktok-ads-source/models/?g_v=1) which leverage data in the format described by [this ERD](https://fivetran.com/docs/applications/tiktok_ads/#schemainformation). These staging tables clean, test, and prepare your Tiktok Ads data from [Fivetran's connector](https://fivetran.com/docs/applications/tiktok_ads) for analysis by doing the following: +- Materializes [Tiktok Ads staging tables](https://fivetran.github.io/dbt_tiktok_ads_source/#!/overview/tiktok-ads-source/models/?g_v=1) which leverage data in the format described by [this ERD](https://fivetran.com/docs/applications/tiktok-ads/#schemainformation). These staging tables clean, test, and prepare your Tiktok Ads data from [Fivetran's connector](https://fivetran.com/docs/applications/tiktok-ads) for analysis by doing the following: - Name columns for consistency across all packages and for easier analysis - Adds freshness tests to source data - Adds column-level testing where applicable. For example, all primary keys are tested for uniqueness and non-null values. From f0b40941ff9edb2712a465001c85843ffca70bf3 Mon Sep 17 00:00:00 2001 From: fivetran-reneeli Date: Mon, 1 Aug 2022 17:24:11 +0200 Subject: [PATCH 29/41] update spend type cast --- macros/get_ad_group_report_hourly_columns.sql | 2 +- macros/get_ad_report_hourly_columns.sql | 2 +- macros/get_campaign_report_hourly_columns.sql | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/macros/get_ad_group_report_hourly_columns.sql b/macros/get_ad_group_report_hourly_columns.sql index dc256d3..1fffcaf 100644 --- a/macros/get_ad_group_report_hourly_columns.sql +++ b/macros/get_ad_group_report_hourly_columns.sql @@ -18,7 +18,7 @@ {"name": "profile_visits", "datatype": dbt_utils.type_numeric()}, {"name": "reach", "datatype": dbt_utils.type_numeric()}, {"name": "shares", "datatype": dbt_utils.type_numeric()}, - {"name": "spend", "datatype": dbt_utils.type_float()}, + {"name": "spend", "datatype": dbt_utils.type_numeric()}, {"name": "stat_time_hour", "datatype": dbt_utils.type_timestamp()}, {"name": "video_play_actions", "datatype": dbt_utils.type_numeric()}, {"name": "video_views_p_25", "datatype": dbt_utils.type_numeric()}, diff --git a/macros/get_ad_report_hourly_columns.sql b/macros/get_ad_report_hourly_columns.sql index 3045c4a..cfb541e 100644 --- a/macros/get_ad_report_hourly_columns.sql +++ b/macros/get_ad_report_hourly_columns.sql @@ -18,7 +18,7 @@ {"name": "profile_visits", "datatype": dbt_utils.type_numeric()}, {"name": "reach", "datatype": dbt_utils.type_numeric()}, {"name": "shares", "datatype": dbt_utils.type_numeric()}, - {"name": "spend", "datatype": dbt_utils.type_float()}, + {"name": "spend", "datatype": dbt_utils.type_numeric()}, {"name": "stat_time_hour", "datatype": dbt_utils.type_timestamp()}, {"name": "video_play_actions", "datatype": dbt_utils.type_numeric()}, {"name": "video_views_p_25", "datatype": dbt_utils.type_numeric()}, diff --git a/macros/get_campaign_report_hourly_columns.sql b/macros/get_campaign_report_hourly_columns.sql index 27f82e5..9181fc4 100644 --- a/macros/get_campaign_report_hourly_columns.sql +++ b/macros/get_campaign_report_hourly_columns.sql @@ -19,7 +19,7 @@ {"name": "profile_visits", "datatype": dbt_utils.type_numeric()}, {"name": "reach", "datatype": dbt_utils.type_numeric()}, {"name": "shares", "datatype": dbt_utils.type_numeric()}, - {"name": "spend", "datatype": dbt_utils.type_float()}, + {"name": "spend", "datatype": dbt_utils.type_numeric()}, {"name": "stat_time_hour", "datatype": dbt_utils.type_timestamp()}, {"name": "video_play_actions", "datatype": dbt_utils.type_numeric()}, {"name": "video_views_p_25", "datatype": dbt_utils.type_numeric()}, From 1bba2adcaa60ba8de73e9568ae3511e62ef18443 Mon Sep 17 00:00:00 2001 From: fivetran-reneeli Date: Mon, 1 Aug 2022 20:07:06 +0200 Subject: [PATCH 30/41] formatting --- models/stg_tiktok_ads__campaign_history.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/models/stg_tiktok_ads__campaign_history.sql b/models/stg_tiktok_ads__campaign_history.sql index 96fe4b9..9adc4e9 100644 --- a/models/stg_tiktok_ads__campaign_history.sql +++ b/models/stg_tiktok_ads__campaign_history.sql @@ -20,11 +20,11 @@ fields as ( final as ( select - campaign_id, + campaign_id, cast(updated_at as {{ dbt_utils.type_timestamp() }}) as updated_at, - advertiser_id, - campaign_name, - campaign_type, + advertiser_id, + campaign_name, + campaign_type, split_test_variable from fields ), From 24beba2b9884c4ad2aeb8c2c548d8403771289fe Mon Sep 17 00:00:00 2001 From: Joe Markiewicz <74217849+fivetran-joemarkiewicz@users.noreply.github.com> Date: Tue, 9 Aug 2022 17:19:27 -0500 Subject: [PATCH 31/41] Update packages.yml --- packages.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages.yml b/packages.yml index aedd2b5..fbc10c2 100644 --- a/packages.yml +++ b/packages.yml @@ -1,5 +1,8 @@ packages: - - package: fivetran/fivetran_utils - version: [">=0.3.0", "<0.4.0"] +# - package: fivetran/fivetran_utils +# version: [">=0.3.0", "<0.4.0"] + - git: https://github.com/fivetran/dbt_fivetran_utils.git + revision: feature/transform-persist + warn-unpinned: false - package: dbt-labs/spark_utils - version: [">=0.3.0", "<0.4.0"] \ No newline at end of file + version: [">=0.3.0", "<0.4.0"] From 2e2505b15c347bd8d663fa827ca0084ed0c06df7 Mon Sep 17 00:00:00 2001 From: fivetran-reneeli Date: Thu, 11 Aug 2022 16:16:49 +0200 Subject: [PATCH 32/41] passthrough columns --- dbt_project.yml | 4 ++++ macros/get_ad_group_report_hourly_columns.sql | 2 ++ macros/get_ad_report_hourly_columns.sql | 2 ++ macros/get_campaign_report_hourly_columns.sql | 2 ++ models/stg_tiktok_ads__ad_group_report_hourly.sql | 6 ++---- models/stg_tiktok_ads__ad_report_hourly.sql | 6 ++---- models/stg_tiktok_ads__campaign_report_hourly.sql | 6 ++---- 7 files changed, 16 insertions(+), 12 deletions(-) diff --git a/dbt_project.yml b/dbt_project.yml index 211980a..9a2ac4d 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -19,3 +19,7 @@ vars: ad_report_hourly: "{{ source('tiktok_ads', 'ad_report_hourly') }}" ad_group_hourly: "{{ source('tiktok_ads', 'adgroup_report_hourly') }}" campaign_report_hourly: "{{ source('tiktok_ads', 'campaign_report_hourly') }}" + + tiktok_ads__ad_group_hourly_passthrough_metrics: [] + tiktok_ads__ad_hourly_passthrough_metrics: [] + tiktok_ads__campaign_hourly_passthrough_metrics: [] diff --git a/macros/get_ad_group_report_hourly_columns.sql b/macros/get_ad_group_report_hourly_columns.sql index 1fffcaf..5b89db4 100644 --- a/macros/get_ad_group_report_hourly_columns.sql +++ b/macros/get_ad_group_report_hourly_columns.sql @@ -30,4 +30,6 @@ {{ return(columns) }} +{{ fivetran_utils.add_pass_through_columns(columns, var('tiktok_ads__ad_group_hourly_passthrough_metrics')) }} + {% endmacro %} \ No newline at end of file diff --git a/macros/get_ad_report_hourly_columns.sql b/macros/get_ad_report_hourly_columns.sql index cfb541e..41b8d99 100644 --- a/macros/get_ad_report_hourly_columns.sql +++ b/macros/get_ad_report_hourly_columns.sql @@ -30,4 +30,6 @@ {{ return(columns) }} +{{ fivetran_utils.add_pass_through_columns(columns, var('tiktok_ads__ad_hourly_passthrough_metrics')) }} + {% endmacro %} \ No newline at end of file diff --git a/macros/get_campaign_report_hourly_columns.sql b/macros/get_campaign_report_hourly_columns.sql index 9181fc4..c48ff2a 100644 --- a/macros/get_campaign_report_hourly_columns.sql +++ b/macros/get_campaign_report_hourly_columns.sql @@ -31,4 +31,6 @@ {{ return(columns) }} +{{ fivetran_utils.add_pass_through_columns(columns, var('tiktok_ads__campaign_hourly_passthrough_metrics')) }} + {% endmacro %} \ No newline at end of file diff --git a/models/stg_tiktok_ads__ad_group_report_hourly.sql b/models/stg_tiktok_ads__ad_group_report_hourly.sql index 8028775..0758e03 100644 --- a/models/stg_tiktok_ads__ad_group_report_hourly.sql +++ b/models/stg_tiktok_ads__ad_group_report_hourly.sql @@ -49,10 +49,8 @@ final as ( video_views_p_75, average_video_play, average_video_play_per_user - - {% for metric in var('tiktok_ads__ad_group_hourly_passthrough_metrics', []) %} - , {{ metric }} - {% endfor %} + + {{ fivetran_utils.fill_pass_through_columns('tiktok_ads__ad_group_hourly_passthrough_metrics') }} from fields ) diff --git a/models/stg_tiktok_ads__ad_report_hourly.sql b/models/stg_tiktok_ads__ad_report_hourly.sql index 15cc96d..061901a 100644 --- a/models/stg_tiktok_ads__ad_report_hourly.sql +++ b/models/stg_tiktok_ads__ad_report_hourly.sql @@ -49,10 +49,8 @@ final as ( video_views_p_75, average_video_play, average_video_play_per_user - - {% for metric in var('tiktok_ads__ad_hourly_passthrough_metrics', []) %} - , {{ metric }} - {% endfor %} + + {{ fivetran_utils.fill_pass_through_columns('tiktok_ads__ad_hourly_passthrough_metrics') }} from fields ) diff --git a/models/stg_tiktok_ads__campaign_report_hourly.sql b/models/stg_tiktok_ads__campaign_report_hourly.sql index a696ea7..8320aee 100644 --- a/models/stg_tiktok_ads__campaign_report_hourly.sql +++ b/models/stg_tiktok_ads__campaign_report_hourly.sql @@ -49,10 +49,8 @@ final as ( video_views_p_75, average_video_play, average_video_play_per_user - - {% for metric in var('tiktok_ads__campaign_hourly_passthrough_metrics', []) %} - , {{ metric }} - {% endfor %} + + {{ fivetran_utils.fill_pass_through_columns('tiktok_ads__campaign_hourly_passthrough_metrics') }} from fields ) From 3443d16590a2cc64483daf7be461f7943e333863 Mon Sep 17 00:00:00 2001 From: fivetran-reneeli Date: Thu, 11 Aug 2022 16:21:24 +0200 Subject: [PATCH 33/41] update reamd --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1e044c8..c4109ba 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ vars: ## (Optional) Step 4: Additional configurations ### Passing Through Additional Metrics -If you would like to pass through additional metrics to the end models that are not by default, add the following configuration to your `dbt_project.yml` file: +If you would like to pass through additional metrics to the staging and end models that are not by default, add the following configuration to your `dbt_project.yml` file: ```yml # dbt_project.yml @@ -58,7 +58,7 @@ vars: tiktok_ads__ad_hourly_passthrough_metrics: ['the', 'list', 'of', 'metric', 'columns', 'to', 'include'] # from tiktok_ads.ad_report_hourly tiktok_ads__campaign_hourly_passthrough_metrics: ['the', 'list', 'of', 'metric', 'columns', 'to', 'include'] # from tiktok_ads.campaign_report_hourly ``` -> Please ensure you use due diligence when adding metrics to these models. The metrics added by default have been vetted by the Fivetran team maintaining this package for accuracy. You will want to ensure whichever metrics you pass through are indeed appropriate to aggregate. +> Please ensure you use due diligence when adding metrics to these models which will be summed upon aggregation. The metrics added by default have been vetted by the Fivetran team maintaining this package for accuracy. You will want to ensure whichever metrics you pass through are indeed appropriate to aggregate. ### Changing the Build Schema By default, this package will build the TikTok Ads staging models within a schema titled ( + `_stg_tiktok_ads`) in your target database. If this is not where you would like your TikTok Ads staging data to be written to, add the following configuration to your `dbt_project.yml` file: From e06f21fa247ebb879d7f9f00e7c2c17e765bb422 Mon Sep 17 00:00:00 2001 From: fivetran-reneeli Date: Thu, 18 Aug 2022 16:19:51 -0400 Subject: [PATCH 34/41] make most recent record within final cte --- models/stg_tiktok_ads__ad_group_history.sql | 14 ++++---------- models/stg_tiktok_ads__ad_history.sql | 13 +++---------- models/stg_tiktok_ads__campaign_history.sql | 13 +++---------- 3 files changed, 10 insertions(+), 30 deletions(-) diff --git a/models/stg_tiktok_ads__ad_group_history.sql b/models/stg_tiktok_ads__ad_group_history.sql index bc43c6f..69fe7aa 100644 --- a/models/stg_tiktok_ads__ad_group_history.sql +++ b/models/stg_tiktok_ads__ad_group_history.sql @@ -37,16 +37,10 @@ final as ( frequency_schedule, gender, languages, - landing_page_url - from fields -), - -most_recent as ( - - select - *, + landing_page_url, row_number() over (partition by ad_group_id order by updated_at desc) = 1 as is_most_recent_record - from final + from fields ) -select * from most_recent \ No newline at end of file +select * +from final \ No newline at end of file diff --git a/models/stg_tiktok_ads__ad_history.sql b/models/stg_tiktok_ads__ad_history.sql index 587ec62..2de60dd 100644 --- a/models/stg_tiktok_ads__ad_history.sql +++ b/models/stg_tiktok_ads__ad_history.sql @@ -37,17 +37,10 @@ final as ( {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_campaign') }} as utm_campaign, {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_content') }} as utm_content, {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_term') }} as utm_term, - landing_page_url - from fields -), - -most_recent as ( - - select - *, + landing_page_url, row_number() over (partition by ad_id order by updated_at desc) = 1 as is_most_recent_record - from final + from fields ) select * -from most_recent \ No newline at end of file +from final \ No newline at end of file diff --git a/models/stg_tiktok_ads__campaign_history.sql b/models/stg_tiktok_ads__campaign_history.sql index 9adc4e9..8d387c6 100644 --- a/models/stg_tiktok_ads__campaign_history.sql +++ b/models/stg_tiktok_ads__campaign_history.sql @@ -25,17 +25,10 @@ final as ( advertiser_id, campaign_name, campaign_type, - split_test_variable - from fields -), - -most_recent as ( - - select - *, + split_test_variable, row_number() over (partition by campaign_id order by updated_at desc) = 1 as is_most_recent_record - from final + from fields ) select * -from most_recent \ No newline at end of file +from final \ No newline at end of file From 28376b0f8ceb42b2eb7c5f290278475a5dfefe2a Mon Sep 17 00:00:00 2001 From: fivetran-reneeli Date: Thu, 18 Aug 2022 16:26:37 -0400 Subject: [PATCH 35/41] clean up macros --- macros/get_campaign_report_hourly_columns.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/macros/get_campaign_report_hourly_columns.sql b/macros/get_campaign_report_hourly_columns.sql index c48ff2a..1fe290d 100644 --- a/macros/get_campaign_report_hourly_columns.sql +++ b/macros/get_campaign_report_hourly_columns.sql @@ -2,7 +2,6 @@ {% set columns = [ {"name": "campaign_id", "datatype": dbt_utils.type_numeric()}, - {"name": "ad_id", "datatype": dbt_utils.type_numeric()}, {"name": "average_video_play", "datatype": dbt_utils.type_float()}, {"name": "average_video_play_per_user", "datatype": dbt_utils.type_float()}, {"name": "clicks", "datatype": dbt_utils.type_numeric()}, From 80f6f33f917c88cd27f09a3e9027032e8484108d Mon Sep 17 00:00:00 2001 From: fivetran-reneeli Date: Fri, 19 Aug 2022 11:55:39 -0400 Subject: [PATCH 36/41] add enable config --- models/src_tiktok_ads.yml | 18 ++++++++-- models/stg_tiktok_ads__ad_group_history.sql | 2 ++ ...stg_tiktok_ads__ad_group_report_hourly.sql | 2 ++ models/stg_tiktok_ads__ad_history.sql | 2 ++ models/stg_tiktok_ads__ad_report_hourly.sql | 2 ++ models/stg_tiktok_ads__advertiser.sql | 2 ++ models/stg_tiktok_ads__campaign_history.sql | 2 ++ ...stg_tiktok_ads__campaign_report_hourly.sql | 36 ++++++++++--------- .../stg_tiktok_ads__ad_group_history_tmp.sql | 2 ++ ...tiktok_ads__ad_group_report_hourly_tmp.sql | 2 ++ models/tmp/stg_tiktok_ads__ad_history_tmp.sql | 2 ++ .../stg_tiktok_ads__ad_report_hourly_tmp.sql | 2 ++ models/tmp/stg_tiktok_ads__advertiser_tmp.sql | 2 ++ .../stg_tiktok_ads__campaign_history_tmp.sql | 2 ++ ...tiktok_ads__campaign_report_hourly_tmp.sql | 2 ++ 15 files changed, 61 insertions(+), 19 deletions(-) diff --git a/models/src_tiktok_ads.yml b/models/src_tiktok_ads.yml index 8142c51..0e3389a 100644 --- a/models/src_tiktok_ads.yml +++ b/models/src_tiktok_ads.yml @@ -15,6 +15,8 @@ sources: tables: - name: advertiser identifier: "{{ var('tiktok_ads__advertiser_identifier', 'advertiser') }}" + config: + enabled: "{{ var('ad_reporting__tiktok_ads_enabled', true) }}" description: Each record represents data for one advertiser. columns: - name: id @@ -66,6 +68,8 @@ sources: - name: campaign_history identifier: "{{ var('tiktok_ads__campaign_history_identifier', 'campaign_history') }}" + config: + enabled: "{{ var('ad_reporting__tiktok_ads_enabled', true) }}" description: Each record represents a version of a TikTok campaign. columns: - name: campaign_id @@ -97,7 +101,9 @@ sources: - name: adgroup_history - identifier: "{{ var('tiktok_ads__ad_group_history_identifier', 'adgroup_history') }}" + identifier: "{{ var('tiktok_ads__ad_group_history_identifier', 'adgroup_history') }}" + config: + enabled: "{{ var('ad_reporting__tiktok_ads_enabled', true) }}" description: Each record represents a version of a TikTok ad group. columns: - name: adgroup_id @@ -250,7 +256,9 @@ sources: - name: ad_history - identifier: "{{ var('tiktok_ads__ad_history_identifier', 'ad_history') }}" + identifier: "{{ var('tiktok_ads__ad_history_identifier', 'ad_history') }}" + config: + enabled: "{{ var('ad_reporting__tiktok_ads_enabled', true) }}" description: Each record represents a version of a TikTok ad. columns: - name: ad_id @@ -306,6 +314,8 @@ sources: - name: ad_report_hourly identifier: "{{ var('tiktok_ads__ad_report_hourly_identifier', 'ad_report_hourly') }}" + config: + enabled: "{{ var('ad_reporting__tiktok_ads_enabled', true) }}" description: Each record represents data for each ad for each hour. columns: - name: ad_id @@ -425,6 +435,8 @@ sources: - name: campaign_report_hourly identifier: "{{ var('tiktok_ads__campaign_report_hourly_identifier', 'campaign_report_hourly') }}" + config: + enabled: "{{ var('ad_reporting__tiktok_ads_enabled', true) }}" description: Each record represents data for each campaign for each hour. columns: - name: campaign_id @@ -546,6 +558,8 @@ sources: - name: adgroup_report_hourly identifier: "{{ var('tiktok_ads__ad_group_report_hourly_identifier', 'adgroup_report_hourly') }}" + config: + enabled: "{{ var('ad_reporting__tiktok_ads_enabled', true) }}" description: Each record represents data for each ad group for each hour. columns: - name: adgroup_id diff --git a/models/stg_tiktok_ads__ad_group_history.sql b/models/stg_tiktok_ads__ad_group_history.sql index 69fe7aa..bd9497f 100644 --- a/models/stg_tiktok_ads__ad_group_history.sql +++ b/models/stg_tiktok_ads__ad_group_history.sql @@ -1,3 +1,5 @@ +{{ config(enabled=var('ad_reporting__tiktok_ads_enabled', true)) }} + with base as ( select * diff --git a/models/stg_tiktok_ads__ad_group_report_hourly.sql b/models/stg_tiktok_ads__ad_group_report_hourly.sql index 0758e03..3be98cf 100644 --- a/models/stg_tiktok_ads__ad_group_report_hourly.sql +++ b/models/stg_tiktok_ads__ad_group_report_hourly.sql @@ -1,3 +1,5 @@ +{{ config(enabled=var('ad_reporting__tiktok_ads_enabled', true)) }} + with base as ( select * diff --git a/models/stg_tiktok_ads__ad_history.sql b/models/stg_tiktok_ads__ad_history.sql index 2de60dd..acadc3c 100644 --- a/models/stg_tiktok_ads__ad_history.sql +++ b/models/stg_tiktok_ads__ad_history.sql @@ -1,3 +1,5 @@ +{{ config(enabled=var('ad_reporting__tiktok_ads_enabled', true)) }} + with base as ( select * diff --git a/models/stg_tiktok_ads__ad_report_hourly.sql b/models/stg_tiktok_ads__ad_report_hourly.sql index 061901a..dbf23f3 100644 --- a/models/stg_tiktok_ads__ad_report_hourly.sql +++ b/models/stg_tiktok_ads__ad_report_hourly.sql @@ -1,3 +1,5 @@ +{{ config(enabled=var('ad_reporting__tiktok_ads_enabled', true)) }} + with base as ( select * diff --git a/models/stg_tiktok_ads__advertiser.sql b/models/stg_tiktok_ads__advertiser.sql index b49c4d4..215fd29 100644 --- a/models/stg_tiktok_ads__advertiser.sql +++ b/models/stg_tiktok_ads__advertiser.sql @@ -1,3 +1,5 @@ +{{ config(enabled=var('ad_reporting__tiktok_ads_enabled', true)) }} + with base as ( select * diff --git a/models/stg_tiktok_ads__campaign_history.sql b/models/stg_tiktok_ads__campaign_history.sql index 8d387c6..211d210 100644 --- a/models/stg_tiktok_ads__campaign_history.sql +++ b/models/stg_tiktok_ads__campaign_history.sql @@ -1,3 +1,5 @@ +{{ config(enabled=var('ad_reporting__tiktok_ads_enabled', true)) }} + with base as ( select * diff --git a/models/stg_tiktok_ads__campaign_report_hourly.sql b/models/stg_tiktok_ads__campaign_report_hourly.sql index 8320aee..62f9daa 100644 --- a/models/stg_tiktok_ads__campaign_report_hourly.sql +++ b/models/stg_tiktok_ads__campaign_report_hourly.sql @@ -1,3 +1,5 @@ +{{ config(enabled=var('ad_reporting__tiktok_ads_enabled', true)) }} + with base as ( select * @@ -28,26 +30,26 @@ final as ( cast(stat_time_hour as {{ dbt_utils.type_timestamp() }}) as stat_time_hour, cpc, cpm, - ctr, - impressions, - clicks, - spend, + ctr, + impressions, + clicks, + spend, reach, - conversion, - cost_per_conversion, - conversion_rate, - likes, - comments, - shares, + conversion, + cost_per_conversion, + conversion_rate, + likes, + comments, + shares, profile_visits, - follows, - video_play_actions, - video_watched_2_s, - video_watched_6_s, - video_views_p_25, + follows, + video_play_actions, + video_watched_2_s, + video_watched_6_s, + video_views_p_25, video_views_p_50, - video_views_p_75, - average_video_play, + video_views_p_75, + average_video_play, average_video_play_per_user {{ fivetran_utils.fill_pass_through_columns('tiktok_ads__campaign_hourly_passthrough_metrics') }} diff --git a/models/tmp/stg_tiktok_ads__ad_group_history_tmp.sql b/models/tmp/stg_tiktok_ads__ad_group_history_tmp.sql index 2066a1e..cc8ca4b 100644 --- a/models/tmp/stg_tiktok_ads__ad_group_history_tmp.sql +++ b/models/tmp/stg_tiktok_ads__ad_group_history_tmp.sql @@ -1,2 +1,4 @@ +{{ config(enabled=var('ad_reporting__tiktok_ads_enabled', true)) }} + select * from {{ var('ad_group_history') }} \ No newline at end of file diff --git a/models/tmp/stg_tiktok_ads__ad_group_report_hourly_tmp.sql b/models/tmp/stg_tiktok_ads__ad_group_report_hourly_tmp.sql index c495494..7859c8c 100644 --- a/models/tmp/stg_tiktok_ads__ad_group_report_hourly_tmp.sql +++ b/models/tmp/stg_tiktok_ads__ad_group_report_hourly_tmp.sql @@ -1,2 +1,4 @@ +{{ config(enabled=var('ad_reporting__tiktok_ads_enabled', true)) }} + select * from {{ var('ad_group_hourly') }} \ No newline at end of file diff --git a/models/tmp/stg_tiktok_ads__ad_history_tmp.sql b/models/tmp/stg_tiktok_ads__ad_history_tmp.sql index 8f73813..e23724b 100644 --- a/models/tmp/stg_tiktok_ads__ad_history_tmp.sql +++ b/models/tmp/stg_tiktok_ads__ad_history_tmp.sql @@ -1,2 +1,4 @@ +{{ config(enabled=var('ad_reporting__tiktok_ads_enabled', true)) }} + select * from {{ var('ad_history') }} \ No newline at end of file diff --git a/models/tmp/stg_tiktok_ads__ad_report_hourly_tmp.sql b/models/tmp/stg_tiktok_ads__ad_report_hourly_tmp.sql index b3cb0f6..5669e53 100644 --- a/models/tmp/stg_tiktok_ads__ad_report_hourly_tmp.sql +++ b/models/tmp/stg_tiktok_ads__ad_report_hourly_tmp.sql @@ -1,2 +1,4 @@ +{{ config(enabled=var('ad_reporting__tiktok_ads_enabled', true)) }} + select * from {{ var('ad_report_hourly') }} \ No newline at end of file diff --git a/models/tmp/stg_tiktok_ads__advertiser_tmp.sql b/models/tmp/stg_tiktok_ads__advertiser_tmp.sql index 9e7dcb3..a682285 100644 --- a/models/tmp/stg_tiktok_ads__advertiser_tmp.sql +++ b/models/tmp/stg_tiktok_ads__advertiser_tmp.sql @@ -1,2 +1,4 @@ +{{ config(enabled=var('ad_reporting__tiktok_ads_enabled', true)) }} + select * from {{ var('advertiser') }} \ No newline at end of file diff --git a/models/tmp/stg_tiktok_ads__campaign_history_tmp.sql b/models/tmp/stg_tiktok_ads__campaign_history_tmp.sql index 1350a19..57868e0 100644 --- a/models/tmp/stg_tiktok_ads__campaign_history_tmp.sql +++ b/models/tmp/stg_tiktok_ads__campaign_history_tmp.sql @@ -1,2 +1,4 @@ +{{ config(enabled=var('ad_reporting__tiktok_ads_enabled', true)) }} + select * from {{ var('campaign_history') }} \ No newline at end of file diff --git a/models/tmp/stg_tiktok_ads__campaign_report_hourly_tmp.sql b/models/tmp/stg_tiktok_ads__campaign_report_hourly_tmp.sql index 28e5dac..15dcce1 100644 --- a/models/tmp/stg_tiktok_ads__campaign_report_hourly_tmp.sql +++ b/models/tmp/stg_tiktok_ads__campaign_report_hourly_tmp.sql @@ -1,2 +1,4 @@ +{{ config(enabled=var('ad_reporting__tiktok_ads_enabled', true)) }} + select * from {{ var('campaign_report_hourly') }} \ No newline at end of file From 1b18f3e82d95861344b373555fb74dfa90a3fccb Mon Sep 17 00:00:00 2001 From: fivetran-reneeli Date: Fri, 19 Aug 2022 13:08:41 -0400 Subject: [PATCH 37/41] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c3a8d5..bac9d5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ PR [#3](https://github.com/fivetran/dbt_tiktok_ads_source/pull/3) applies the fo - Casts all timestamp fields using dbt_utils.type_timestamp() and rounds all monetary fields - Adds not-null tests to key fields - Introduces the identifier variable for all source models +- Add enable configs for this specific ad platform, for use in the Ad Reporting rollup package # dbt_tiktok_ads_source v0.1.0 From df96ea3c5d9432ad6f8aa4f07da9943a68367787 Mon Sep 17 00:00:00 2001 From: fivetran-reneeli Date: Tue, 23 Aug 2022 12:40:35 -0400 Subject: [PATCH 38/41] fix adgroupid --- models/stg_tiktok_ads__ad_group_history.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/stg_tiktok_ads__ad_group_history.sql b/models/stg_tiktok_ads__ad_group_history.sql index bd9497f..9da4275 100644 --- a/models/stg_tiktok_ads__ad_group_history.sql +++ b/models/stg_tiktok_ads__ad_group_history.sql @@ -40,7 +40,7 @@ final as ( gender, languages, landing_page_url, - row_number() over (partition by ad_group_id order by updated_at desc) = 1 as is_most_recent_record + row_number() over (partition by adgroup_id order by updated_at desc) = 1 as is_most_recent_record from fields ) From 16e8ce0075f88edd2dd8cb7994c022484f832881 Mon Sep 17 00:00:00 2001 From: fivetran-joemarkiewicz Date: Fri, 26 Aug 2022 15:04:29 -0500 Subject: [PATCH 39/41] additional before merge updates and corrections --- CHANGELOG.md | 12 ++++++++++- README.md | 21 +++++++++++-------- docs/catalog.json | 2 +- docs/index.html | 6 +++--- docs/manifest.json | 2 +- docs/run_results.json | 2 +- integration_tests/dbt_project.yml | 2 +- models/src_tiktok_ads.yml | 21 +++---------------- ...stg_tiktok_ads__ad_group_report_hourly.sql | 6 +----- models/stg_tiktok_ads__ad_report_hourly.sql | 5 ----- models/stg_tiktok_ads__campaign_history.sql | 1 - ...stg_tiktok_ads__campaign_report_hourly.sql | 6 +----- packages.yml | 7 ++----- 13 files changed, 37 insertions(+), 56 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bac9d5f..2a22cf3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,17 @@ # dbt_tiktok_ads_source v0.2.0 PR [#3](https://github.com/fivetran/dbt_tiktok_ads_source/pull/3) applies the following updates: ## šŸŽ‰ Feature Enhancements šŸŽ‰ -- Introduces metrics passthrough capability +- Inclusion of passthrough metrics: + - `tiktok_ads__ad_group_hourly_passthrough_metrics` + - `tiktok_ads__ad_hourly_passthrough_metrics` + - `tiktok_ads__campaign_hourly_passthrough_metrics` +> This applies to all passthrough columns within the `dbt_snapchat_ads_source` package and not just the `tiktok_ads__ad_group_hourly_passthrough_metrics` example. +```yml +vars: + tiktok_ads__ad_group_hourly_passthrough_metrics: + - name: "my_field_to_include" # Required: Name of the field within the source. + alias: "field_alias" # Optional: If you wish to alias the field within the staging model. +``` - Casts all timestamp fields using dbt_utils.type_timestamp() and rounds all monetary fields - Adds not-null tests to key fields - Introduces the identifier variable for all source models diff --git a/README.md b/README.md index c4109ba..3b4f634 100644 --- a/README.md +++ b/README.md @@ -47,19 +47,22 @@ vars: ## (Optional) Step 4: Additional configurations ### Passing Through Additional Metrics -If you would like to pass through additional metrics to the staging and end models that are not by default, add the following configuration to your `dbt_project.yml` file: +By default, this package will select `clicks`, `impressions`, and `cost` from the source reporting tables to store into the staging models. If you would like to pass through additional metrics to the staging models, add the below configurations to your `dbt_project.yml` file. These variables allow for the pass-through fields to be aliased (`alias`) if desired, but not required. Use the below format for declaring the respective pass-through variables: -```yml -# dbt_project.yml +>**Note** Please ensure you exercised due diligence when adding metrics to these models. The metrics added by default (taps, impressions, and spend) have been vetted by the Fivetran team maintaining this package for accuracy. There are metrics included within the source reports, for example metric averages, which may be inaccurately represented at the grain for reports created in this package. You will want to ensure whichever metrics you pass through are indeed appropriate to aggregate at the respective reporting levels provided in this package. -... +```yml vars: - tiktok_ads__ad_group_hourly_passthrough_metrics: ['the', 'list', 'of', 'metric', 'columns', 'to', 'include'] # from tiktok_ads.adgroup_report_hourly - tiktok_ads__ad_hourly_passthrough_metrics: ['the', 'list', 'of', 'metric', 'columns', 'to', 'include'] # from tiktok_ads.ad_report_hourly - tiktok_ads__campaign_hourly_passthrough_metrics: ['the', 'list', 'of', 'metric', 'columns', 'to', 'include'] # from tiktok_ads.campaign_report_hourly + tiktok_ads__ad_group_hourly_passthrough_metrics: + - name: "new_custom_field" + alias: "custom_field" + - name: "my_other_field" + tiktok_ads__ad_hourly_passthrough_metrics: + - name: "this_field" + tiktok_ads__campaign_hourly_passthrough_metrics: + - name: "unique_string_field" + alias: "field_id" ``` -> Please ensure you use due diligence when adding metrics to these models which will be summed upon aggregation. The metrics added by default have been vetted by the Fivetran team maintaining this package for accuracy. You will want to ensure whichever metrics you pass through are indeed appropriate to aggregate. - ### Changing the Build Schema By default, this package will build the TikTok Ads staging models within a schema titled ( + `_stg_tiktok_ads`) in your target database. If this is not where you would like your TikTok Ads staging data to be written to, add the following configuration to your `dbt_project.yml` file: diff --git a/docs/catalog.json b/docs/catalog.json index 7758ce5..5a760f2 100644 --- a/docs/catalog.json +++ b/docs/catalog.json @@ -1 +1 @@ -{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/catalog/v1.json", "dbt_version": "1.0.0", "generated_at": "2022-07-28T16:21:17.346472Z", "invocation_id": "73d9028b-4406-406d-9101-01780cecfbb9", "env": {}}, "nodes": {"model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp": {"metadata": {"type": "view", "schema": "schema", "name": "stg_tiktok_ads__campaign_report_hourly_tmp", "database": "database", "comment": null, "owner": null}, "columns": {"campaign_id": {"type": "INT64", "index": 1, "name": "campaign_id", "comment": null}, "stat_time_hour": {"type": "DATETIME", "index": 2, "name": "stat_time_hour", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "average_video_play": {"type": "FLOAT64", "index": 4, "name": "average_video_play", "comment": null}, "average_video_play_per_user": {"type": "FLOAT64", "index": 5, "name": "average_video_play_per_user", "comment": null}, "clicks": {"type": "INT64", "index": 6, "name": "clicks", "comment": null}, "comments": {"type": "INT64", "index": 7, "name": "comments", "comment": null}, "conversion": {"type": "INT64", "index": 8, "name": "conversion", "comment": null}, "conversion_rate": {"type": "FLOAT64", "index": 9, "name": "conversion_rate", "comment": null}, "cost_per_1000_reached": {"type": "FLOAT64", "index": 10, "name": "cost_per_1000_reached", "comment": null}, "cost_per_conversion": {"type": "FLOAT64", "index": 11, "name": "cost_per_conversion", "comment": null}, "cost_per_result": {"type": "FLOAT64", "index": 12, "name": "cost_per_result", "comment": null}, "cost_per_secondary_goal_result": {"type": "STRING", "index": 13, "name": "cost_per_secondary_goal_result", "comment": null}, "cpc": {"type": "FLOAT64", "index": 14, "name": "cpc", "comment": null}, "cpm": {"type": "FLOAT64", "index": 15, "name": "cpm", "comment": null}, "ctr": {"type": "FLOAT64", "index": 16, "name": "ctr", "comment": null}, "follows": {"type": "INT64", "index": 17, "name": "follows", "comment": null}, "impressions": {"type": "INT64", "index": 18, "name": "impressions", "comment": null}, "likes": {"type": "INT64", "index": 19, "name": "likes", "comment": null}, "profile_visits": {"type": "INT64", "index": 20, "name": "profile_visits", "comment": null}, "profile_visits_rate": {"type": "FLOAT64", "index": 21, "name": "profile_visits_rate", "comment": null}, "reach": {"type": "INT64", "index": 22, "name": "reach", "comment": null}, "real_time_conversion": {"type": "INT64", "index": 23, "name": "real_time_conversion", "comment": null}, "real_time_conversion_rate": {"type": "FLOAT64", "index": 24, "name": "real_time_conversion_rate", "comment": null}, "real_time_cost_per_conversion": {"type": "FLOAT64", "index": 25, "name": "real_time_cost_per_conversion", "comment": null}, "real_time_cost_per_result": {"type": "FLOAT64", "index": 26, "name": "real_time_cost_per_result", "comment": null}, "real_time_result": {"type": "INT64", "index": 27, "name": "real_time_result", "comment": null}, "real_time_result_rate": {"type": "FLOAT64", "index": 28, "name": "real_time_result_rate", "comment": null}, "result": {"type": "INT64", "index": 29, "name": "result", "comment": null}, "result_rate": {"type": "FLOAT64", "index": 30, "name": "result_rate", "comment": null}, "sales_lead": {"type": "FLOAT64", "index": 31, "name": "sales_lead", "comment": null}, "secondary_goal_result": {"type": "STRING", "index": 32, "name": "secondary_goal_result", "comment": null}, "secondary_goal_result_rate": {"type": "STRING", "index": 33, "name": "secondary_goal_result_rate", "comment": null}, "shares": {"type": "INT64", "index": 34, "name": "shares", "comment": null}, "spend": {"type": "FLOAT64", "index": 35, "name": "spend", "comment": null}, "total_purchase": {"type": "FLOAT64", "index": 36, "name": "total_purchase", "comment": null}, "total_purchase_value": {"type": "FLOAT64", "index": 37, "name": "total_purchase_value", "comment": null}, "total_sales_lead": {"type": "FLOAT64", "index": 38, "name": "total_sales_lead", "comment": null}, "total_sales_lead_value": {"type": "FLOAT64", "index": 39, "name": "total_sales_lead_value", "comment": null}, "video_play_actions": {"type": "INT64", "index": 40, "name": "video_play_actions", "comment": null}, "video_views_p_100": {"type": "INT64", "index": 41, "name": "video_views_p_100", "comment": null}, "video_views_p_25": {"type": "INT64", "index": 42, "name": "video_views_p_25", "comment": null}, "video_views_p_50": {"type": "INT64", "index": 43, "name": "video_views_p_50", "comment": null}, "video_views_p_75": {"type": "INT64", "index": 44, "name": "video_views_p_75", "comment": null}, "video_watched_2_s": {"type": "INT64", "index": 45, "name": "video_watched_2_s", "comment": null}, "video_watched_6_s": {"type": "INT64", "index": 46, "name": "video_watched_6_s", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp": {"metadata": {"type": "view", "schema": "schema", "name": "stg_tiktok_ads__ad_report_hourly_tmp", "database": "database", "comment": null, "owner": null}, "columns": {"ad_id": {"type": "INT64", "index": 1, "name": "ad_id", "comment": null}, "stat_time_hour": {"type": "DATETIME", "index": 2, "name": "stat_time_hour", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "average_video_play": {"type": "FLOAT64", "index": 4, "name": "average_video_play", "comment": null}, "average_video_play_per_user": {"type": "FLOAT64", "index": 5, "name": "average_video_play_per_user", "comment": null}, "clicks": {"type": "INT64", "index": 6, "name": "clicks", "comment": null}, "comments": {"type": "INT64", "index": 7, "name": "comments", "comment": null}, "conversion": {"type": "INT64", "index": 8, "name": "conversion", "comment": null}, "conversion_rate": {"type": "FLOAT64", "index": 9, "name": "conversion_rate", "comment": null}, "cost_per_1000_reached": {"type": "FLOAT64", "index": 10, "name": "cost_per_1000_reached", "comment": null}, "cost_per_conversion": {"type": "FLOAT64", "index": 11, "name": "cost_per_conversion", "comment": null}, "cost_per_result": {"type": "FLOAT64", "index": 12, "name": "cost_per_result", "comment": null}, "cost_per_secondary_goal_result": {"type": "STRING", "index": 13, "name": "cost_per_secondary_goal_result", "comment": null}, "cpc": {"type": "FLOAT64", "index": 14, "name": "cpc", "comment": null}, "cpm": {"type": "FLOAT64", "index": 15, "name": "cpm", "comment": null}, "ctr": {"type": "FLOAT64", "index": 16, "name": "ctr", "comment": null}, "follows": {"type": "INT64", "index": 17, "name": "follows", "comment": null}, "impressions": {"type": "INT64", "index": 18, "name": "impressions", "comment": null}, "likes": {"type": "INT64", "index": 19, "name": "likes", "comment": null}, "profile_visits": {"type": "INT64", "index": 20, "name": "profile_visits", "comment": null}, "profile_visits_rate": {"type": "FLOAT64", "index": 21, "name": "profile_visits_rate", "comment": null}, "reach": {"type": "INT64", "index": 22, "name": "reach", "comment": null}, "real_time_conversion": {"type": "INT64", "index": 23, "name": "real_time_conversion", "comment": null}, "real_time_conversion_rate": {"type": "FLOAT64", "index": 24, "name": "real_time_conversion_rate", "comment": null}, "real_time_cost_per_conversion": {"type": "FLOAT64", "index": 25, "name": "real_time_cost_per_conversion", "comment": null}, "real_time_cost_per_result": {"type": "FLOAT64", "index": 26, "name": "real_time_cost_per_result", "comment": null}, "real_time_result": {"type": "INT64", "index": 27, "name": "real_time_result", "comment": null}, "real_time_result_rate": {"type": "FLOAT64", "index": 28, "name": "real_time_result_rate", "comment": null}, "result": {"type": "INT64", "index": 29, "name": "result", "comment": null}, "result_rate": {"type": "FLOAT64", "index": 30, "name": "result_rate", "comment": null}, "sales_lead": {"type": "FLOAT64", "index": 31, "name": "sales_lead", "comment": null}, "secondary_goal_result": {"type": "STRING", "index": 32, "name": "secondary_goal_result", "comment": null}, "secondary_goal_result_rate": {"type": "STRING", "index": 33, "name": "secondary_goal_result_rate", "comment": null}, "shares": {"type": "INT64", "index": 34, "name": "shares", "comment": null}, "spend": {"type": "FLOAT64", "index": 35, "name": "spend", "comment": null}, "total_purchase": {"type": "FLOAT64", "index": 36, "name": "total_purchase", "comment": null}, "total_purchase_value": {"type": "FLOAT64", "index": 37, "name": "total_purchase_value", "comment": null}, "total_sales_lead": {"type": "FLOAT64", "index": 38, "name": "total_sales_lead", "comment": null}, "total_sales_lead_value": {"type": "FLOAT64", "index": 39, "name": "total_sales_lead_value", "comment": null}, "video_play_actions": {"type": "INT64", "index": 40, "name": "video_play_actions", "comment": null}, "video_views_p_100": {"type": "INT64", "index": 41, "name": "video_views_p_100", "comment": null}, "video_views_p_25": {"type": "INT64", "index": 42, "name": "video_views_p_25", "comment": null}, "video_views_p_50": {"type": "INT64", "index": 43, "name": "video_views_p_50", "comment": null}, "video_views_p_75": {"type": "INT64", "index": 44, "name": "video_views_p_75", "comment": null}, "video_watched_2_s": {"type": "INT64", "index": 45, "name": "video_watched_2_s", "comment": null}, "video_watched_6_s": {"type": "INT64", "index": 46, "name": "video_watched_6_s", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp"}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly": {"metadata": {"type": "table", "schema": "schema", "name": "stg_tiktok_ads__campaign_report_hourly", "database": "database", "comment": null, "owner": null}, "columns": {"campaign_id": {"type": "INT64", "index": 1, "name": "campaign_id", "comment": null}, "stat_time_hour": {"type": "TIMESTAMP", "index": 2, "name": "stat_time_hour", "comment": null}, "cpc": {"type": "FLOAT64", "index": 3, "name": "cpc", "comment": null}, "cpm": {"type": "FLOAT64", "index": 4, "name": "cpm", "comment": null}, "ctr": {"type": "FLOAT64", "index": 5, "name": "ctr", "comment": null}, "impressions": {"type": "INT64", "index": 6, "name": "impressions", "comment": null}, "clicks": {"type": "INT64", "index": 7, "name": "clicks", "comment": null}, "spend": {"type": "FLOAT64", "index": 8, "name": "spend", "comment": null}, "reach": {"type": "INT64", "index": 9, "name": "reach", "comment": null}, "conversion": {"type": "INT64", "index": 10, "name": "conversion", "comment": null}, "cost_per_conversion": {"type": "FLOAT64", "index": 11, "name": "cost_per_conversion", "comment": null}, "conversion_rate": {"type": "FLOAT64", "index": 12, "name": "conversion_rate", "comment": null}, "likes": {"type": "INT64", "index": 13, "name": "likes", "comment": null}, "comments": {"type": "INT64", "index": 14, "name": "comments", "comment": null}, "shares": {"type": "INT64", "index": 15, "name": "shares", "comment": null}, "profile_visits": {"type": "INT64", "index": 16, "name": "profile_visits", "comment": null}, "follows": {"type": "INT64", "index": 17, "name": "follows", "comment": null}, "video_play_actions": {"type": "INT64", "index": 18, "name": "video_play_actions", "comment": null}, "video_watched_2_s": {"type": "INT64", "index": 19, "name": "video_watched_2_s", "comment": null}, "video_watched_6_s": {"type": "INT64", "index": 20, "name": "video_watched_6_s", "comment": null}, "video_views_p_25": {"type": "INT64", "index": 21, "name": "video_views_p_25", "comment": null}, "video_views_p_50": {"type": "INT64", "index": 22, "name": "video_views_p_50", "comment": null}, "video_views_p_75": {"type": "INT64", "index": 23, "name": "video_views_p_75", "comment": null}, "average_video_play": {"type": "FLOAT64", "index": 24, "name": "average_video_play", "comment": null}, "average_video_play_per_user": {"type": "FLOAT64", "index": 25, "name": "average_video_play_per_user", "comment": null}, "result": {"type": "INT64", "index": 26, "name": "result", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 26.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 5408.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp": {"metadata": {"type": "view", "schema": "schema", "name": "stg_tiktok_ads__ad_group_report_hourly_tmp", "database": "database", "comment": null, "owner": null}, "columns": {"adgroup_id": {"type": "INT64", "index": 1, "name": "adgroup_id", "comment": null}, "stat_time_hour": {"type": "DATETIME", "index": 2, "name": "stat_time_hour", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "average_video_play": {"type": "FLOAT64", "index": 4, "name": "average_video_play", "comment": null}, "average_video_play_per_user": {"type": "FLOAT64", "index": 5, "name": "average_video_play_per_user", "comment": null}, "clicks": {"type": "INT64", "index": 6, "name": "clicks", "comment": null}, "comments": {"type": "INT64", "index": 7, "name": "comments", "comment": null}, "conversion": {"type": "INT64", "index": 8, "name": "conversion", "comment": null}, "conversion_rate": {"type": "FLOAT64", "index": 9, "name": "conversion_rate", "comment": null}, "cost_per_1000_reached": {"type": "FLOAT64", "index": 10, "name": "cost_per_1000_reached", "comment": null}, "cost_per_conversion": {"type": "FLOAT64", "index": 11, "name": "cost_per_conversion", "comment": null}, "cost_per_result": {"type": "FLOAT64", "index": 12, "name": "cost_per_result", "comment": null}, "cost_per_secondary_goal_result": {"type": "STRING", "index": 13, "name": "cost_per_secondary_goal_result", "comment": null}, "cpc": {"type": "FLOAT64", "index": 14, "name": "cpc", "comment": null}, "cpm": {"type": "FLOAT64", "index": 15, "name": "cpm", "comment": null}, "ctr": {"type": "FLOAT64", "index": 16, "name": "ctr", "comment": null}, "follows": {"type": "INT64", "index": 17, "name": "follows", "comment": null}, "impressions": {"type": "INT64", "index": 18, "name": "impressions", "comment": null}, "likes": {"type": "INT64", "index": 19, "name": "likes", "comment": null}, "profile_visits": {"type": "INT64", "index": 20, "name": "profile_visits", "comment": null}, "profile_visits_rate": {"type": "FLOAT64", "index": 21, "name": "profile_visits_rate", "comment": null}, "reach": {"type": "INT64", "index": 22, "name": "reach", "comment": null}, "real_time_conversion": {"type": "INT64", "index": 23, "name": "real_time_conversion", "comment": null}, "real_time_conversion_rate": {"type": "FLOAT64", "index": 24, "name": "real_time_conversion_rate", "comment": null}, "real_time_cost_per_conversion": {"type": "FLOAT64", "index": 25, "name": "real_time_cost_per_conversion", "comment": null}, "real_time_cost_per_result": {"type": "FLOAT64", "index": 26, "name": "real_time_cost_per_result", "comment": null}, "real_time_result": {"type": "INT64", "index": 27, "name": "real_time_result", "comment": null}, "real_time_result_rate": {"type": "FLOAT64", "index": 28, "name": "real_time_result_rate", "comment": null}, "result": {"type": "INT64", "index": 29, "name": "result", "comment": null}, "result_rate": {"type": "FLOAT64", "index": 30, "name": "result_rate", "comment": null}, "sales_lead": {"type": "FLOAT64", "index": 31, "name": "sales_lead", "comment": null}, "secondary_goal_result": {"type": "STRING", "index": 32, "name": "secondary_goal_result", "comment": null}, "secondary_goal_result_rate": {"type": "STRING", "index": 33, "name": "secondary_goal_result_rate", "comment": null}, "shares": {"type": "INT64", "index": 34, "name": "shares", "comment": null}, "spend": {"type": "FLOAT64", "index": 35, "name": "spend", "comment": null}, "total_purchase": {"type": "FLOAT64", "index": 36, "name": "total_purchase", "comment": null}, "total_purchase_value": {"type": "FLOAT64", "index": 37, "name": "total_purchase_value", "comment": null}, "total_sales_lead": {"type": "FLOAT64", "index": 38, "name": "total_sales_lead", "comment": null}, "total_sales_lead_value": {"type": "FLOAT64", "index": 39, "name": "total_sales_lead_value", "comment": null}, "video_play_actions": {"type": "INT64", "index": 40, "name": "video_play_actions", "comment": null}, "video_views_p_100": {"type": "INT64", "index": 41, "name": "video_views_p_100", "comment": null}, "video_views_p_25": {"type": "INT64", "index": 42, "name": "video_views_p_25", "comment": null}, "video_views_p_50": {"type": "INT64", "index": 43, "name": "video_views_p_50", "comment": null}, "video_views_p_75": {"type": "INT64", "index": 44, "name": "video_views_p_75", "comment": null}, "video_watched_2_s": {"type": "INT64", "index": 45, "name": "video_watched_2_s", "comment": null}, "video_watched_6_s": {"type": "INT64", "index": 46, "name": "video_watched_6_s", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp"}, "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp": {"metadata": {"type": "view", "schema": "schema", "name": "stg_tiktok_ads__advertiser_tmp", "database": "database", "comment": null, "owner": null}, "columns": {"id": {"type": "INT64", "index": 1, "name": "id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 2, "name": "_fivetran_synced", "comment": null}, "address": {"type": "STRING", "index": 3, "name": "address", "comment": null}, "balance": {"type": "FLOAT64", "index": 4, "name": "balance", "comment": null}, "company": {"type": "STRING", "index": 5, "name": "company", "comment": null}, "contacter": {"type": "STRING", "index": 6, "name": "contacter", "comment": null}, "country": {"type": "STRING", "index": 7, "name": "country", "comment": null}, "create_time": {"type": "TIMESTAMP", "index": 8, "name": "create_time", "comment": null}, "currency": {"type": "STRING", "index": 9, "name": "currency", "comment": null}, "description": {"type": "STRING", "index": 10, "name": "description", "comment": null}, "email": {"type": "STRING", "index": 11, "name": "email", "comment": null}, "industry": {"type": "STRING", "index": 12, "name": "industry", "comment": null}, "language": {"type": "STRING", "index": 13, "name": "language", "comment": null}, "license_no": {"type": "STRING", "index": 14, "name": "license_no", "comment": null}, "license_url": {"type": "STRING", "index": 15, "name": "license_url", "comment": null}, "name": {"type": "STRING", "index": 16, "name": "name", "comment": null}, "phone_number": {"type": "STRING", "index": 17, "name": "phone_number", "comment": null}, "promotion_area": {"type": "STRING", "index": 18, "name": "promotion_area", "comment": null}, "reason": {"type": "STRING", "index": 19, "name": "reason", "comment": null}, "role": {"type": "STRING", "index": 20, "name": "role", "comment": null}, "status": {"type": "STRING", "index": 21, "name": "status", "comment": null}, "telephone": {"type": "STRING", "index": 22, "name": "telephone", "comment": null}, "timezone": {"type": "STRING", "index": 23, "name": "timezone", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly": {"metadata": {"type": "table", "schema": "schema", "name": "stg_tiktok_ads__ad_report_hourly", "database": "database", "comment": null, "owner": null}, "columns": {"ad_id": {"type": "INT64", "index": 1, "name": "ad_id", "comment": null}, "stat_time_hour": {"type": "TIMESTAMP", "index": 2, "name": "stat_time_hour", "comment": null}, "cpc": {"type": "FLOAT64", "index": 3, "name": "cpc", "comment": null}, "cpm": {"type": "FLOAT64", "index": 4, "name": "cpm", "comment": null}, "ctr": {"type": "FLOAT64", "index": 5, "name": "ctr", "comment": null}, "impressions": {"type": "INT64", "index": 6, "name": "impressions", "comment": null}, "clicks": {"type": "INT64", "index": 7, "name": "clicks", "comment": null}, "spend": {"type": "FLOAT64", "index": 8, "name": "spend", "comment": null}, "reach": {"type": "INT64", "index": 9, "name": "reach", "comment": null}, "conversion": {"type": "INT64", "index": 10, "name": "conversion", "comment": null}, "cost_per_conversion": {"type": "FLOAT64", "index": 11, "name": "cost_per_conversion", "comment": null}, "conversion_rate": {"type": "FLOAT64", "index": 12, "name": "conversion_rate", "comment": null}, "likes": {"type": "INT64", "index": 13, "name": "likes", "comment": null}, "comments": {"type": "INT64", "index": 14, "name": "comments", "comment": null}, "shares": {"type": "INT64", "index": 15, "name": "shares", "comment": null}, "profile_visits": {"type": "INT64", "index": 16, "name": "profile_visits", "comment": null}, "follows": {"type": "INT64", "index": 17, "name": "follows", "comment": null}, "video_play_actions": {"type": "INT64", "index": 18, "name": "video_play_actions", "comment": null}, "video_watched_2_s": {"type": "INT64", "index": 19, "name": "video_watched_2_s", "comment": null}, "video_watched_6_s": {"type": "INT64", "index": 20, "name": "video_watched_6_s", "comment": null}, "video_views_p_25": {"type": "INT64", "index": 21, "name": "video_views_p_25", "comment": null}, "video_views_p_50": {"type": "INT64", "index": 22, "name": "video_views_p_50", "comment": null}, "video_views_p_75": {"type": "INT64", "index": 23, "name": "video_views_p_75", "comment": null}, "average_video_play": {"type": "FLOAT64", "index": 24, "name": "average_video_play", "comment": null}, "average_video_play_per_user": {"type": "FLOAT64", "index": 25, "name": "average_video_play_per_user", "comment": null}, "REAL_TIME_COST_PER_RESULT": {"type": "FLOAT64", "index": 26, "name": "REAL_TIME_COST_PER_RESULT", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 26.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 5408.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history": {"metadata": {"type": "table", "schema": "schema", "name": "stg_tiktok_ads__ad_group_history", "database": "database", "comment": null, "owner": null}, "columns": {"ad_group_id": {"type": "INT64", "index": 1, "name": "ad_group_id", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 2, "name": "updated_at", "comment": null}, "advertiser_id": {"type": "INT64", "index": 3, "name": "advertiser_id", "comment": null}, "campaign_id": {"type": "INT64", "index": 4, "name": "campaign_id", "comment": null}, "action_days": {"type": "INT64", "index": 5, "name": "action_days", "comment": null}, "action_categories": {"type": "STRING", "index": 6, "name": "action_categories", "comment": null}, "ad_group_name": {"type": "STRING", "index": 7, "name": "ad_group_name", "comment": null}, "age": {"type": "STRING", "index": 8, "name": "age", "comment": null}, "audience_type": {"type": "STRING", "index": 9, "name": "audience_type", "comment": null}, "budget": {"type": "FLOAT64", "index": 10, "name": "budget", "comment": null}, "category": {"type": "INT64", "index": 11, "name": "category", "comment": null}, "display_name": {"type": "STRING", "index": 12, "name": "display_name", "comment": null}, "interest_category": {"type": "STRING", "index": 13, "name": "interest_category", "comment": null}, "frequency": {"type": "INT64", "index": 14, "name": "frequency", "comment": null}, "frequency_schedule": {"type": "INT64", "index": 15, "name": "frequency_schedule", "comment": null}, "gender": {"type": "STRING", "index": 16, "name": "gender", "comment": null}, "languages": {"type": "STRING", "index": 17, "name": "languages", "comment": null}, "landing_page_url": {"type": "STRING", "index": 18, "name": "landing_page_url", "comment": null}, "is_most_recent_record": {"type": "BOOL", "index": 19, "name": "is_most_recent_record", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 2.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 264.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp": {"metadata": {"type": "view", "schema": "schema", "name": "stg_tiktok_ads__campaign_history_tmp", "database": "database", "comment": null, "owner": null}, "columns": {"campaign_id": {"type": "INT64", "index": 1, "name": "campaign_id", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 2, "name": "updated_at", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "advertiser_id": {"type": "INT64", "index": 4, "name": "advertiser_id", "comment": null}, "budget": {"type": "FLOAT64", "index": 5, "name": "budget", "comment": null}, "budget_mode": {"type": "STRING", "index": 6, "name": "budget_mode", "comment": null}, "campaign_name": {"type": "STRING", "index": 7, "name": "campaign_name", "comment": null}, "campaign_type": {"type": "STRING", "index": 8, "name": "campaign_type", "comment": null}, "create_time": {"type": "TIMESTAMP", "index": 9, "name": "create_time", "comment": null}, "is_new_structure": {"type": "STRING", "index": 10, "name": "is_new_structure", "comment": null}, "objective_type": {"type": "STRING", "index": 11, "name": "objective_type", "comment": null}, "opt_status": {"type": "STRING", "index": 12, "name": "opt_status", "comment": null}, "split_test_variable": {"type": "STRING", "index": 13, "name": "split_test_variable", "comment": null}, "status": {"type": "STRING", "index": 14, "name": "status", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp"}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_history": {"metadata": {"type": "table", "schema": "schema", "name": "stg_tiktok_ads__campaign_history", "database": "database", "comment": null, "owner": null}, "columns": {"campaign_id": {"type": "INT64", "index": 1, "name": "campaign_id", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 2, "name": "updated_at", "comment": null}, "advertiser_id": {"type": "INT64", "index": 3, "name": "advertiser_id", "comment": null}, "campaign_name": {"type": "STRING", "index": 4, "name": "campaign_name", "comment": null}, "campaign_type": {"type": "STRING", "index": 5, "name": "campaign_type", "comment": null}, "split_test_variable": {"type": "STRING", "index": 6, "name": "split_test_variable", "comment": null}, "is_most_recent_record": {"type": "BOOL", "index": 7, "name": "is_most_recent_record", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 2.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 124.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history"}, "model.tiktok_ads_source.stg_tiktok_ads__advertiser": {"metadata": {"type": "table", "schema": "schema", "name": "stg_tiktok_ads__advertiser", "database": "database", "comment": null, "owner": null}, "columns": {"advertiser_id": {"type": "INT64", "index": 1, "name": "advertiser_id", "comment": null}, "address": {"type": "STRING", "index": 2, "name": "address", "comment": null}, "balance": {"type": "FLOAT64", "index": 3, "name": "balance", "comment": null}, "company": {"type": "STRING", "index": 4, "name": "company", "comment": null}, "contacter": {"type": "STRING", "index": 5, "name": "contacter", "comment": null}, "country": {"type": "STRING", "index": 6, "name": "country", "comment": null}, "currency": {"type": "STRING", "index": 7, "name": "currency", "comment": null}, "description": {"type": "STRING", "index": 8, "name": "description", "comment": null}, "email": {"type": "STRING", "index": 9, "name": "email", "comment": null}, "industry": {"type": "STRING", "index": 10, "name": "industry", "comment": null}, "language": {"type": "STRING", "index": 11, "name": "language", "comment": null}, "advertiser_name": {"type": "STRING", "index": 12, "name": "advertiser_name", "comment": null}, "phone_number": {"type": "STRING", "index": 13, "name": "phone_number", "comment": null}, "telephone": {"type": "STRING", "index": 14, "name": "telephone", "comment": null}, "timezone": {"type": "STRING", "index": 15, "name": "timezone", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 1.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 167.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp": {"metadata": {"type": "view", "schema": "schema", "name": "stg_tiktok_ads__ad_group_history_tmp", "database": "database", "comment": null, "owner": null}, "columns": {"adgroup_id": {"type": "INT64", "index": 1, "name": "adgroup_id", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 2, "name": "updated_at", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "action_categories": {"type": "STRING", "index": 4, "name": "action_categories", "comment": null}, "action_days": {"type": "INT64", "index": 5, "name": "action_days", "comment": null}, "adgroup_name": {"type": "STRING", "index": 6, "name": "adgroup_name", "comment": null}, "advertiser_id": {"type": "INT64", "index": 7, "name": "advertiser_id", "comment": null}, "age": {"type": "STRING", "index": 8, "name": "age", "comment": null}, "android_osv": {"type": "STRING", "index": 9, "name": "android_osv", "comment": null}, "app_download_url": {"type": "STRING", "index": 10, "name": "app_download_url", "comment": null}, "app_id": {"type": "INT64", "index": 11, "name": "app_id", "comment": null}, "app_name": {"type": "STRING", "index": 12, "name": "app_name", "comment": null}, "app_type": {"type": "STRING", "index": 13, "name": "app_type", "comment": null}, "audience": {"type": "STRING", "index": 14, "name": "audience", "comment": null}, "audience_type": {"type": "STRING", "index": 15, "name": "audience_type", "comment": null}, "bid": {"type": "FLOAT64", "index": 16, "name": "bid", "comment": null}, "bid_type": {"type": "STRING", "index": 17, "name": "bid_type", "comment": null}, "billing_event": {"type": "STRING", "index": 18, "name": "billing_event", "comment": null}, "budget": {"type": "FLOAT64", "index": 19, "name": "budget", "comment": null}, "budget_mode": {"type": "STRING", "index": 20, "name": "budget_mode", "comment": null}, "campaign_id": {"type": "INT64", "index": 21, "name": "campaign_id", "comment": null}, "carriers": {"type": "STRING", "index": 22, "name": "carriers", "comment": null}, "category": {"type": "INT64", "index": 23, "name": "category", "comment": null}, "click_tracking_url": {"type": "STRING", "index": 24, "name": "click_tracking_url", "comment": null}, "connection_type": {"type": "STRING", "index": 25, "name": "connection_type", "comment": null}, "conversion_bid": {"type": "FLOAT64", "index": 26, "name": "conversion_bid", "comment": null}, "cpv_video_duration": {"type": "STRING", "index": 27, "name": "cpv_video_duration", "comment": null}, "create_time": {"type": "TIMESTAMP", "index": 28, "name": "create_time", "comment": null}, "creative_material_mode": {"type": "STRING", "index": 29, "name": "creative_material_mode", "comment": null}, "dayparting": {"type": "STRING", "index": 30, "name": "dayparting", "comment": null}, "deep_bid_type": {"type": "STRING", "index": 31, "name": "deep_bid_type", "comment": null}, "deep_cpabid": {"type": "FLOAT64", "index": 32, "name": "deep_cpabid", "comment": null}, "deep_external_action": {"type": "STRING", "index": 33, "name": "deep_external_action", "comment": null}, "display_name": {"type": "STRING", "index": 34, "name": "display_name", "comment": null}, "enable_inventory_filter": {"type": "BOOL", "index": 35, "name": "enable_inventory_filter", "comment": null}, "excluded_audience": {"type": "STRING", "index": 36, "name": "excluded_audience", "comment": null}, "external_action": {"type": "STRING", "index": 37, "name": "external_action", "comment": null}, "fallback_type": {"type": "STRING", "index": 38, "name": "fallback_type", "comment": null}, "frequency": {"type": "INT64", "index": 39, "name": "frequency", "comment": null}, "frequency_schedule": {"type": "INT64", "index": 40, "name": "frequency_schedule", "comment": null}, "gender": {"type": "STRING", "index": 41, "name": "gender", "comment": null}, "impression_tracking_url": {"type": "STRING", "index": 42, "name": "impression_tracking_url", "comment": null}, "interest_category_v_2": {"type": "STRING", "index": 43, "name": "interest_category_v_2", "comment": null}, "ios_osv": {"type": "STRING", "index": 44, "name": "ios_osv", "comment": null}, "is_comment_disable": {"type": "INT64", "index": 45, "name": "is_comment_disable", "comment": null}, "is_hfss": {"type": "BOOL", "index": 46, "name": "is_hfss", "comment": null}, "is_new_structure": {"type": "BOOL", "index": 47, "name": "is_new_structure", "comment": null}, "keywords": {"type": "STRING", "index": 48, "name": "keywords", "comment": null}, "landing_page_url": {"type": "STRING", "index": 49, "name": "landing_page_url", "comment": null}, "languages": {"type": "STRING", "index": 50, "name": "languages", "comment": null}, "location": {"type": "STRING", "index": 51, "name": "location", "comment": null}, "open_url": {"type": "STRING", "index": 52, "name": "open_url", "comment": null}, "open_url_type": {"type": "STRING", "index": 53, "name": "open_url_type", "comment": null}, "operation_system": {"type": "STRING", "index": 54, "name": "operation_system", "comment": null}, "opt_status": {"type": "STRING", "index": 55, "name": "opt_status", "comment": null}, "optimize_goal": {"type": "STRING", "index": 56, "name": "optimize_goal", "comment": null}, "pacing": {"type": "STRING", "index": 57, "name": "pacing", "comment": null}, "package": {"type": "STRING", "index": 58, "name": "package", "comment": null}, "pangle_block_app_list_id": {"type": "STRING", "index": 59, "name": "pangle_block_app_list_id", "comment": null}, "pixel_id": {"type": "INT64", "index": 60, "name": "pixel_id", "comment": null}, "placement": {"type": "STRING", "index": 61, "name": "placement", "comment": null}, "placement_type": {"type": "STRING", "index": 62, "name": "placement_type", "comment": null}, "profile_image": {"type": "STRING", "index": 63, "name": "profile_image", "comment": null}, "schedule_end_time": {"type": "TIMESTAMP", "index": 64, "name": "schedule_end_time", "comment": null}, "schedule_start_time": {"type": "TIMESTAMP", "index": 65, "name": "schedule_start_time", "comment": null}, "schedule_type": {"type": "STRING", "index": 66, "name": "schedule_type", "comment": null}, "skip_learning_phase": {"type": "INT64", "index": 67, "name": "skip_learning_phase", "comment": null}, "statistic_type": {"type": "STRING", "index": 68, "name": "statistic_type", "comment": null}, "status": {"type": "STRING", "index": 69, "name": "status", "comment": null}, "video_actions": {"type": "STRING", "index": 70, "name": "video_actions", "comment": null}, "video_download": {"type": "STRING", "index": 71, "name": "video_download", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_history": {"metadata": {"type": "table", "schema": "schema", "name": "stg_tiktok_ads__ad_history", "database": "database", "comment": null, "owner": null}, "columns": {"ad_id": {"type": "INT64", "index": 1, "name": "ad_id", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 2, "name": "updated_at", "comment": null}, "ad_group_id": {"type": "INT64", "index": 3, "name": "ad_group_id", "comment": null}, "advertiser_id": {"type": "INT64", "index": 4, "name": "advertiser_id", "comment": null}, "campaign_id": {"type": "INT64", "index": 5, "name": "campaign_id", "comment": null}, "ad_name": {"type": "STRING", "index": 6, "name": "ad_name", "comment": null}, "call_to_action": {"type": "STRING", "index": 7, "name": "call_to_action", "comment": null}, "click_tracking_url": {"type": "STRING", "index": 8, "name": "click_tracking_url", "comment": null}, "impression_tracking_url": {"type": "STRING", "index": 9, "name": "impression_tracking_url", "comment": null}, "base_url": {"type": "STRING", "index": 10, "name": "base_url", "comment": null}, "url_host": {"type": "STRING", "index": 11, "name": "url_host", "comment": null}, "url_path": {"type": "STRING", "index": 12, "name": "url_path", "comment": null}, "utm_source": {"type": "STRING", "index": 13, "name": "utm_source", "comment": null}, "utm_medium": {"type": "STRING", "index": 14, "name": "utm_medium", "comment": null}, "utm_campaign": {"type": "STRING", "index": 15, "name": "utm_campaign", "comment": null}, "utm_content": {"type": "STRING", "index": 16, "name": "utm_content", "comment": null}, "utm_term": {"type": "STRING", "index": 17, "name": "utm_term", "comment": null}, "landing_page_url": {"type": "STRING", "index": 18, "name": "landing_page_url", "comment": null}, "is_most_recent_record": {"type": "BOOL", "index": 19, "name": "is_most_recent_record", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 1.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 169.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly": {"metadata": {"type": "table", "schema": "schema", "name": "stg_tiktok_ads__ad_group_report_hourly", "database": "database", "comment": null, "owner": null}, "columns": {"ad_group_id": {"type": "INT64", "index": 1, "name": "ad_group_id", "comment": null}, "stat_time_hour": {"type": "TIMESTAMP", "index": 2, "name": "stat_time_hour", "comment": null}, "cpc": {"type": "FLOAT64", "index": 3, "name": "cpc", "comment": null}, "cpm": {"type": "FLOAT64", "index": 4, "name": "cpm", "comment": null}, "ctr": {"type": "FLOAT64", "index": 5, "name": "ctr", "comment": null}, "impressions": {"type": "INT64", "index": 6, "name": "impressions", "comment": null}, "clicks": {"type": "INT64", "index": 7, "name": "clicks", "comment": null}, "spend": {"type": "FLOAT64", "index": 8, "name": "spend", "comment": null}, "reach": {"type": "INT64", "index": 9, "name": "reach", "comment": null}, "conversion": {"type": "INT64", "index": 10, "name": "conversion", "comment": null}, "cost_per_conversion": {"type": "FLOAT64", "index": 11, "name": "cost_per_conversion", "comment": null}, "conversion_rate": {"type": "FLOAT64", "index": 12, "name": "conversion_rate", "comment": null}, "likes": {"type": "INT64", "index": 13, "name": "likes", "comment": null}, "comments": {"type": "INT64", "index": 14, "name": "comments", "comment": null}, "shares": {"type": "INT64", "index": 15, "name": "shares", "comment": null}, "profile_visits": {"type": "INT64", "index": 16, "name": "profile_visits", "comment": null}, "follows": {"type": "INT64", "index": 17, "name": "follows", "comment": null}, "video_play_actions": {"type": "INT64", "index": 18, "name": "video_play_actions", "comment": null}, "video_watched_2_s": {"type": "INT64", "index": 19, "name": "video_watched_2_s", "comment": null}, "video_watched_6_s": {"type": "INT64", "index": 20, "name": "video_watched_6_s", "comment": null}, "video_views_p_25": {"type": "INT64", "index": 21, "name": "video_views_p_25", "comment": null}, "video_views_p_50": {"type": "INT64", "index": 22, "name": "video_views_p_50", "comment": null}, "video_views_p_75": {"type": "INT64", "index": 23, "name": "video_views_p_75", "comment": null}, "average_video_play": {"type": "FLOAT64", "index": 24, "name": "average_video_play", "comment": null}, "average_video_play_per_user": {"type": "FLOAT64", "index": 25, "name": "average_video_play_per_user", "comment": null}, "result": {"type": "INT64", "index": 26, "name": "result", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 26.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 5408.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp": {"metadata": {"type": "view", "schema": "schema", "name": "stg_tiktok_ads__ad_history_tmp", "database": "database", "comment": null, "owner": null}, "columns": {"ad_id": {"type": "INT64", "index": 1, "name": "ad_id", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 2, "name": "updated_at", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "ad_name": {"type": "STRING", "index": 4, "name": "ad_name", "comment": null}, "ad_text": {"type": "STRING", "index": 5, "name": "ad_text", "comment": null}, "adgroup_id": {"type": "INT64", "index": 6, "name": "adgroup_id", "comment": null}, "advertiser_id": {"type": "INT64", "index": 7, "name": "advertiser_id", "comment": null}, "app_name": {"type": "STRING", "index": 8, "name": "app_name", "comment": null}, "call_to_action": {"type": "STRING", "index": 9, "name": "call_to_action", "comment": null}, "campaign_id": {"type": "INT64", "index": 10, "name": "campaign_id", "comment": null}, "click_tracking_url": {"type": "STRING", "index": 11, "name": "click_tracking_url", "comment": null}, "create_time": {"type": "TIMESTAMP", "index": 12, "name": "create_time", "comment": null}, "display_name": {"type": "STRING", "index": 13, "name": "display_name", "comment": null}, "image_ids": {"type": "STRING", "index": 14, "name": "image_ids", "comment": null}, "impression_tracking_url": {"type": "STRING", "index": 15, "name": "impression_tracking_url", "comment": null}, "is_aco": {"type": "BOOL", "index": 16, "name": "is_aco", "comment": null}, "is_creative_authorized": {"type": "BOOL", "index": 17, "name": "is_creative_authorized", "comment": null}, "is_new_structure": {"type": "BOOL", "index": 18, "name": "is_new_structure", "comment": null}, "landing_page_url": {"type": "STRING", "index": 19, "name": "landing_page_url", "comment": null}, "open_url": {"type": "STRING", "index": 20, "name": "open_url", "comment": null}, "opt_status": {"type": "STRING", "index": 21, "name": "opt_status", "comment": null}, "playable_url": {"type": "STRING", "index": 22, "name": "playable_url", "comment": null}, "profile_image": {"type": "STRING", "index": 23, "name": "profile_image", "comment": null}, "status": {"type": "STRING", "index": 24, "name": "status", "comment": null}, "video_id": {"type": "STRING", "index": 25, "name": "video_id", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp"}, "model.tiktok_ads.tiktok_ads__account_report": {"metadata": {"type": "table", "schema": "dbt_renee_tiktok_ads", "name": "tiktok_ads__account_report", "database": "database", "comment": null, "owner": null}, "columns": {"date_day": {"type": "DATE", "index": 1, "name": "date_day", "comment": null}, "advertiser_id": {"type": "INT64", "index": 2, "name": "advertiser_id", "comment": null}, "advertiser_name": {"type": "STRING", "index": 3, "name": "advertiser_name", "comment": null}, "currency": {"type": "STRING", "index": 4, "name": "currency", "comment": null}, "clicks": {"type": "INT64", "index": 5, "name": "clicks", "comment": null}, "impressions": {"type": "INT64", "index": 6, "name": "impressions", "comment": null}, "spend": {"type": "FLOAT64", "index": 7, "name": "spend", "comment": null}, "reach": {"type": "INT64", "index": 8, "name": "reach", "comment": null}, "conversion": {"type": "INT64", "index": 9, "name": "conversion", "comment": null}, "likes": {"type": "INT64", "index": 10, "name": "likes", "comment": null}, "comments": {"type": "INT64", "index": 11, "name": "comments", "comment": null}, "shares": {"type": "INT64", "index": 12, "name": "shares", "comment": null}, "profile_visits": {"type": "INT64", "index": 13, "name": "profile_visits", "comment": null}, "follows": {"type": "INT64", "index": 14, "name": "follows", "comment": null}, "video_watched_2_s": {"type": "INT64", "index": 15, "name": "video_watched_2_s", "comment": null}, "video_watched_6_s": {"type": "INT64", "index": 16, "name": "video_watched_6_s", "comment": null}, "video_views_p_25": {"type": "INT64", "index": 17, "name": "video_views_p_25", "comment": null}, "video_views_p_50": {"type": "INT64", "index": 18, "name": "video_views_p_50", "comment": null}, "video_views_p_75": {"type": "INT64", "index": 19, "name": "video_views_p_75", "comment": null}, "daily_cpc": {"type": "FLOAT64", "index": 20, "name": "daily_cpc", "comment": null}, "daily_cpm": {"type": "FLOAT64", "index": 21, "name": "daily_cpm", "comment": null}, "daily_ctr": {"type": "FLOAT64", "index": 22, "name": "daily_ctr", "comment": null}, "REAL_TIME_COST_PER_RESULT": {"type": "FLOAT64", "index": 23, "name": "REAL_TIME_COST_PER_RESULT", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 5.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 908.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads.tiktok_ads__account_report"}, "model.tiktok_ads.tiktok_ads__url_report": {"metadata": {"type": "table", "schema": "dbt_renee_tiktok_ads", "name": "tiktok_ads__url_report", "database": "database", "comment": null, "owner": null}, "columns": {"date_day": {"type": "DATE", "index": 1, "name": "date_day", "comment": null}, "advertiser_id": {"type": "INT64", "index": 2, "name": "advertiser_id", "comment": null}, "advertiser_name": {"type": "STRING", "index": 3, "name": "advertiser_name", "comment": null}, "campaign_id": {"type": "INT64", "index": 4, "name": "campaign_id", "comment": null}, "campaign_name": {"type": "STRING", "index": 5, "name": "campaign_name", "comment": null}, "ad_group_id": {"type": "INT64", "index": 6, "name": "ad_group_id", "comment": null}, "ad_group_name": {"type": "STRING", "index": 7, "name": "ad_group_name", "comment": null}, "ad_id": {"type": "INT64", "index": 8, "name": "ad_id", "comment": null}, "ad_name": {"type": "STRING", "index": 9, "name": "ad_name", "comment": null}, "base_url": {"type": "STRING", "index": 10, "name": "base_url", "comment": null}, "url_host": {"type": "STRING", "index": 11, "name": "url_host", "comment": null}, "url_path": {"type": "STRING", "index": 12, "name": "url_path", "comment": null}, "utm_source": {"type": "STRING", "index": 13, "name": "utm_source", "comment": null}, "utm_medium": {"type": "STRING", "index": 14, "name": "utm_medium", "comment": null}, "utm_campaign": {"type": "STRING", "index": 15, "name": "utm_campaign", "comment": null}, "utm_content": {"type": "STRING", "index": 16, "name": "utm_content", "comment": null}, "utm_term": {"type": "STRING", "index": 17, "name": "utm_term", "comment": null}, "currency": {"type": "STRING", "index": 18, "name": "currency", "comment": null}, "action_categories": {"type": "STRING", "index": 19, "name": "action_categories", "comment": null}, "category": {"type": "INT64", "index": 20, "name": "category", "comment": null}, "gender": {"type": "STRING", "index": 21, "name": "gender", "comment": null}, "audience_type": {"type": "STRING", "index": 22, "name": "audience_type", "comment": null}, "budget": {"type": "FLOAT64", "index": 23, "name": "budget", "comment": null}, "age": {"type": "STRING", "index": 24, "name": "age", "comment": null}, "languages": {"type": "STRING", "index": 25, "name": "languages", "comment": null}, "interest_category": {"type": "STRING", "index": 26, "name": "interest_category", "comment": null}, "impressions": {"type": "INT64", "index": 27, "name": "impressions", "comment": null}, "clicks": {"type": "INT64", "index": 28, "name": "clicks", "comment": null}, "spend": {"type": "FLOAT64", "index": 29, "name": "spend", "comment": null}, "reach": {"type": "INT64", "index": 30, "name": "reach", "comment": null}, "conversion": {"type": "INT64", "index": 31, "name": "conversion", "comment": null}, "likes": {"type": "INT64", "index": 32, "name": "likes", "comment": null}, "comments": {"type": "INT64", "index": 33, "name": "comments", "comment": null}, "shares": {"type": "INT64", "index": 34, "name": "shares", "comment": null}, "profile_visits": {"type": "INT64", "index": 35, "name": "profile_visits", "comment": null}, "follows": {"type": "INT64", "index": 36, "name": "follows", "comment": null}, "video_watched_2_s": {"type": "INT64", "index": 37, "name": "video_watched_2_s", "comment": null}, "video_watched_6_s": {"type": "INT64", "index": 38, "name": "video_watched_6_s", "comment": null}, "video_views_p_25": {"type": "INT64", "index": 39, "name": "video_views_p_25", "comment": null}, "video_views_p_50": {"type": "INT64", "index": 40, "name": "video_views_p_50", "comment": null}, "video_views_p_75": {"type": "INT64", "index": 41, "name": "video_views_p_75", "comment": null}, "daily_cpc": {"type": "FLOAT64", "index": 42, "name": "daily_cpc", "comment": null}, "daily_cpm": {"type": "FLOAT64", "index": 43, "name": "daily_cpm", "comment": null}, "daily_ctr": {"type": "FLOAT64", "index": 44, "name": "daily_ctr", "comment": null}, "REAL_TIME_COST_PER_RESULT": {"type": "FLOAT64", "index": 45, "name": "REAL_TIME_COST_PER_RESULT", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 5.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 2108.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads.tiktok_ads__url_report"}, "model.tiktok_ads.tiktok_ads__ad_group_report": {"metadata": {"type": "table", "schema": "dbt_renee_tiktok_ads", "name": "tiktok_ads__ad_group_report", "database": "database", "comment": null, "owner": null}, "columns": {"date_day": {"type": "DATE", "index": 1, "name": "date_day", "comment": null}, "advertiser_id": {"type": "INT64", "index": 2, "name": "advertiser_id", "comment": null}, "advertiser_name": {"type": "STRING", "index": 3, "name": "advertiser_name", "comment": null}, "campaign_id": {"type": "INT64", "index": 4, "name": "campaign_id", "comment": null}, "campaign_name": {"type": "STRING", "index": 5, "name": "campaign_name", "comment": null}, "ad_group_id": {"type": "INT64", "index": 6, "name": "ad_group_id", "comment": null}, "ad_group_name": {"type": "STRING", "index": 7, "name": "ad_group_name", "comment": null}, "currency": {"type": "STRING", "index": 8, "name": "currency", "comment": null}, "action_categories": {"type": "STRING", "index": 9, "name": "action_categories", "comment": null}, "category": {"type": "INT64", "index": 10, "name": "category", "comment": null}, "gender": {"type": "STRING", "index": 11, "name": "gender", "comment": null}, "audience_type": {"type": "STRING", "index": 12, "name": "audience_type", "comment": null}, "budget": {"type": "FLOAT64", "index": 13, "name": "budget", "comment": null}, "age": {"type": "STRING", "index": 14, "name": "age", "comment": null}, "languages": {"type": "STRING", "index": 15, "name": "languages", "comment": null}, "interest_category": {"type": "STRING", "index": 16, "name": "interest_category", "comment": null}, "impressions": {"type": "INT64", "index": 17, "name": "impressions", "comment": null}, "clicks": {"type": "INT64", "index": 18, "name": "clicks", "comment": null}, "spend": {"type": "FLOAT64", "index": 19, "name": "spend", "comment": null}, "reach": {"type": "INT64", "index": 20, "name": "reach", "comment": null}, "conversion": {"type": "INT64", "index": 21, "name": "conversion", "comment": null}, "likes": {"type": "INT64", "index": 22, "name": "likes", "comment": null}, "comments": {"type": "INT64", "index": 23, "name": "comments", "comment": null}, "shares": {"type": "INT64", "index": 24, "name": "shares", "comment": null}, "profile_visits": {"type": "INT64", "index": 25, "name": "profile_visits", "comment": null}, "follows": {"type": "INT64", "index": 26, "name": "follows", "comment": null}, "video_watched_2_s": {"type": "INT64", "index": 27, "name": "video_watched_2_s", "comment": null}, "video_watched_6_s": {"type": "INT64", "index": 28, "name": "video_watched_6_s", "comment": null}, "video_views_p_25": {"type": "INT64", "index": 29, "name": "video_views_p_25", "comment": null}, "video_views_p_50": {"type": "INT64", "index": 30, "name": "video_views_p_50", "comment": null}, "video_views_p_75": {"type": "INT64", "index": 31, "name": "video_views_p_75", "comment": null}, "daily_cpc": {"type": "FLOAT64", "index": 32, "name": "daily_cpc", "comment": null}, "daily_cpm": {"type": "FLOAT64", "index": 33, "name": "daily_cpm", "comment": null}, "daily_ctr": {"type": "FLOAT64", "index": 34, "name": "daily_ctr", "comment": null}, "result": {"type": "INT64", "index": 35, "name": "result", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 5.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 1578.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads.tiktok_ads__ad_group_report"}, "model.tiktok_ads.tiktok_ads__ad_report": {"metadata": {"type": "table", "schema": "dbt_renee_tiktok_ads", "name": "tiktok_ads__ad_report", "database": "database", "comment": null, "owner": null}, "columns": {"date_day": {"type": "DATE", "index": 1, "name": "date_day", "comment": null}, "advertiser_id": {"type": "INT64", "index": 2, "name": "advertiser_id", "comment": null}, "advertiser_name": {"type": "STRING", "index": 3, "name": "advertiser_name", "comment": null}, "campaign_id": {"type": "INT64", "index": 4, "name": "campaign_id", "comment": null}, "campaign_name": {"type": "STRING", "index": 5, "name": "campaign_name", "comment": null}, "ad_group_id": {"type": "INT64", "index": 6, "name": "ad_group_id", "comment": null}, "ad_group_name": {"type": "STRING", "index": 7, "name": "ad_group_name", "comment": null}, "ad_id": {"type": "INT64", "index": 8, "name": "ad_id", "comment": null}, "ad_name": {"type": "STRING", "index": 9, "name": "ad_name", "comment": null}, "currency": {"type": "STRING", "index": 10, "name": "currency", "comment": null}, "category": {"type": "INT64", "index": 11, "name": "category", "comment": null}, "action_categories": {"type": "STRING", "index": 12, "name": "action_categories", "comment": null}, "gender": {"type": "STRING", "index": 13, "name": "gender", "comment": null}, "audience_type": {"type": "STRING", "index": 14, "name": "audience_type", "comment": null}, "budget": {"type": "FLOAT64", "index": 15, "name": "budget", "comment": null}, "age": {"type": "STRING", "index": 16, "name": "age", "comment": null}, "languages": {"type": "STRING", "index": 17, "name": "languages", "comment": null}, "interest_category": {"type": "STRING", "index": 18, "name": "interest_category", "comment": null}, "impressions": {"type": "INT64", "index": 19, "name": "impressions", "comment": null}, "clicks": {"type": "INT64", "index": 20, "name": "clicks", "comment": null}, "spend": {"type": "FLOAT64", "index": 21, "name": "spend", "comment": null}, "reach": {"type": "INT64", "index": 22, "name": "reach", "comment": null}, "conversion": {"type": "INT64", "index": 23, "name": "conversion", "comment": null}, "likes": {"type": "INT64", "index": 24, "name": "likes", "comment": null}, "comments": {"type": "INT64", "index": 25, "name": "comments", "comment": null}, "shares": {"type": "INT64", "index": 26, "name": "shares", "comment": null}, "profile_visits": {"type": "INT64", "index": 27, "name": "profile_visits", "comment": null}, "follows": {"type": "INT64", "index": 28, "name": "follows", "comment": null}, "video_watched_2_s": {"type": "INT64", "index": 29, "name": "video_watched_2_s", "comment": null}, "video_watched_6_s": {"type": "INT64", "index": 30, "name": "video_watched_6_s", "comment": null}, "video_views_p_25": {"type": "INT64", "index": 31, "name": "video_views_p_25", "comment": null}, "video_views_p_50": {"type": "INT64", "index": 32, "name": "video_views_p_50", "comment": null}, "video_views_p_75": {"type": "INT64", "index": 33, "name": "video_views_p_75", "comment": null}, "daily_cpc": {"type": "FLOAT64", "index": 34, "name": "daily_cpc", "comment": null}, "daily_cpm": {"type": "FLOAT64", "index": 35, "name": "daily_cpm", "comment": null}, "daily_ctr": {"type": "FLOAT64", "index": 36, "name": "daily_ctr", "comment": null}, "REAL_TIME_COST_PER_RESULT": {"type": "FLOAT64", "index": 37, "name": "REAL_TIME_COST_PER_RESULT", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 5.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 1838.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads.tiktok_ads__ad_report"}, "model.tiktok_ads.tiktok_ads__campaign_report": {"metadata": {"type": "table", "schema": "dbt_renee_tiktok_ads", "name": "tiktok_ads__campaign_report", "database": "database", "comment": null, "owner": null}, "columns": {"date_day": {"type": "DATE", "index": 1, "name": "date_day", "comment": null}, "advertiser_id": {"type": "INT64", "index": 2, "name": "advertiser_id", "comment": null}, "advertiser_name": {"type": "STRING", "index": 3, "name": "advertiser_name", "comment": null}, "campaign_id": {"type": "INT64", "index": 4, "name": "campaign_id", "comment": null}, "campaign_name": {"type": "STRING", "index": 5, "name": "campaign_name", "comment": null}, "currency": {"type": "STRING", "index": 6, "name": "currency", "comment": null}, "impressions": {"type": "INT64", "index": 7, "name": "impressions", "comment": null}, "clicks": {"type": "INT64", "index": 8, "name": "clicks", "comment": null}, "spend": {"type": "FLOAT64", "index": 9, "name": "spend", "comment": null}, "reach": {"type": "INT64", "index": 10, "name": "reach", "comment": null}, "conversion": {"type": "INT64", "index": 11, "name": "conversion", "comment": null}, "likes": {"type": "INT64", "index": 12, "name": "likes", "comment": null}, "comments": {"type": "INT64", "index": 13, "name": "comments", "comment": null}, "shares": {"type": "INT64", "index": 14, "name": "shares", "comment": null}, "profile_visits": {"type": "INT64", "index": 15, "name": "profile_visits", "comment": null}, "follows": {"type": "INT64", "index": 16, "name": "follows", "comment": null}, "video_watched_2_s": {"type": "INT64", "index": 17, "name": "video_watched_2_s", "comment": null}, "video_watched_6_s": {"type": "INT64", "index": 18, "name": "video_watched_6_s", "comment": null}, "video_views_p_25": {"type": "INT64", "index": 19, "name": "video_views_p_25", "comment": null}, "video_views_p_50": {"type": "INT64", "index": 20, "name": "video_views_p_50", "comment": null}, "video_views_p_75": {"type": "INT64", "index": 21, "name": "video_views_p_75", "comment": null}, "daily_cpc": {"type": "FLOAT64", "index": 22, "name": "daily_cpc", "comment": null}, "daily_cpm": {"type": "FLOAT64", "index": 23, "name": "daily_cpm", "comment": null}, "daily_ctr": {"type": "FLOAT64", "index": 24, "name": "daily_ctr", "comment": null}, "result": {"type": "INT64", "index": 25, "name": "result", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 5.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 1043.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads.tiktok_ads__campaign_report"}}, "sources": {"source.tiktok_ads_source.tiktok_ads.campaign_history": {"metadata": {"type": "table", "schema": "tiktok_ads_joe", "name": "campaign_history", "database": "database", "comment": null, "owner": null}, "columns": {"campaign_id": {"type": "INT64", "index": 1, "name": "campaign_id", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 2, "name": "updated_at", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "advertiser_id": {"type": "INT64", "index": 4, "name": "advertiser_id", "comment": null}, "budget": {"type": "FLOAT64", "index": 5, "name": "budget", "comment": null}, "budget_mode": {"type": "STRING", "index": 6, "name": "budget_mode", "comment": null}, "campaign_name": {"type": "STRING", "index": 7, "name": "campaign_name", "comment": null}, "campaign_type": {"type": "STRING", "index": 8, "name": "campaign_type", "comment": null}, "create_time": {"type": "TIMESTAMP", "index": 9, "name": "create_time", "comment": null}, "is_new_structure": {"type": "STRING", "index": 10, "name": "is_new_structure", "comment": null}, "objective_type": {"type": "STRING", "index": 11, "name": "objective_type", "comment": null}, "opt_status": {"type": "STRING", "index": 12, "name": "opt_status", "comment": null}, "split_test_variable": {"type": "STRING", "index": 13, "name": "split_test_variable", "comment": null}, "status": {"type": "STRING", "index": 14, "name": "status", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 2.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 304.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.tiktok_ads_source.tiktok_ads.campaign_history"}, "source.tiktok_ads_source.tiktok_ads.advertiser": {"metadata": {"type": "table", "schema": "tiktok_ads_joe", "name": "advertiser", "database": "database", "comment": null, "owner": null}, "columns": {"id": {"type": "INT64", "index": 1, "name": "id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 2, "name": "_fivetran_synced", "comment": null}, "address": {"type": "STRING", "index": 3, "name": "address", "comment": null}, "balance": {"type": "FLOAT64", "index": 4, "name": "balance", "comment": null}, "company": {"type": "STRING", "index": 5, "name": "company", "comment": null}, "contacter": {"type": "STRING", "index": 6, "name": "contacter", "comment": null}, "country": {"type": "STRING", "index": 7, "name": "country", "comment": null}, "create_time": {"type": "TIMESTAMP", "index": 8, "name": "create_time", "comment": null}, "currency": {"type": "STRING", "index": 9, "name": "currency", "comment": null}, "description": {"type": "STRING", "index": 10, "name": "description", "comment": null}, "email": {"type": "STRING", "index": 11, "name": "email", "comment": null}, "industry": {"type": "STRING", "index": 12, "name": "industry", "comment": null}, "language": {"type": "STRING", "index": 13, "name": "language", "comment": null}, "license_no": {"type": "STRING", "index": 14, "name": "license_no", "comment": null}, "license_url": {"type": "STRING", "index": 15, "name": "license_url", "comment": null}, "name": {"type": "STRING", "index": 16, "name": "name", "comment": null}, "phone_number": {"type": "STRING", "index": 17, "name": "phone_number", "comment": null}, "promotion_area": {"type": "STRING", "index": 18, "name": "promotion_area", "comment": null}, "reason": {"type": "STRING", "index": 19, "name": "reason", "comment": null}, "role": {"type": "STRING", "index": 20, "name": "role", "comment": null}, "status": {"type": "STRING", "index": 21, "name": "status", "comment": null}, "telephone": {"type": "STRING", "index": 22, "name": "telephone", "comment": null}, "timezone": {"type": "STRING", "index": 23, "name": "timezone", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 1.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 223.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.tiktok_ads_source.tiktok_ads.advertiser"}, "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly": {"metadata": {"type": "table", "schema": "tiktok_ads_joe", "name": "campaign_report_hourly", "database": "database", "comment": null, "owner": null}, "columns": {"campaign_id": {"type": "INT64", "index": 1, "name": "campaign_id", "comment": null}, "stat_time_hour": {"type": "DATETIME", "index": 2, "name": "stat_time_hour", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "average_video_play": {"type": "FLOAT64", "index": 4, "name": "average_video_play", "comment": null}, "average_video_play_per_user": {"type": "FLOAT64", "index": 5, "name": "average_video_play_per_user", "comment": null}, "clicks": {"type": "INT64", "index": 6, "name": "clicks", "comment": null}, "comments": {"type": "INT64", "index": 7, "name": "comments", "comment": null}, "conversion": {"type": "INT64", "index": 8, "name": "conversion", "comment": null}, "conversion_rate": {"type": "FLOAT64", "index": 9, "name": "conversion_rate", "comment": null}, "cost_per_1000_reached": {"type": "FLOAT64", "index": 10, "name": "cost_per_1000_reached", "comment": null}, "cost_per_conversion": {"type": "FLOAT64", "index": 11, "name": "cost_per_conversion", "comment": null}, "cost_per_result": {"type": "FLOAT64", "index": 12, "name": "cost_per_result", "comment": null}, "cost_per_secondary_goal_result": {"type": "STRING", "index": 13, "name": "cost_per_secondary_goal_result", "comment": null}, "cpc": {"type": "FLOAT64", "index": 14, "name": "cpc", "comment": null}, "cpm": {"type": "FLOAT64", "index": 15, "name": "cpm", "comment": null}, "ctr": {"type": "FLOAT64", "index": 16, "name": "ctr", "comment": null}, "follows": {"type": "INT64", "index": 17, "name": "follows", "comment": null}, "impressions": {"type": "INT64", "index": 18, "name": "impressions", "comment": null}, "likes": {"type": "INT64", "index": 19, "name": "likes", "comment": null}, "profile_visits": {"type": "INT64", "index": 20, "name": "profile_visits", "comment": null}, "profile_visits_rate": {"type": "FLOAT64", "index": 21, "name": "profile_visits_rate", "comment": null}, "reach": {"type": "INT64", "index": 22, "name": "reach", "comment": null}, "real_time_conversion": {"type": "INT64", "index": 23, "name": "real_time_conversion", "comment": null}, "real_time_conversion_rate": {"type": "FLOAT64", "index": 24, "name": "real_time_conversion_rate", "comment": null}, "real_time_cost_per_conversion": {"type": "FLOAT64", "index": 25, "name": "real_time_cost_per_conversion", "comment": null}, "real_time_cost_per_result": {"type": "FLOAT64", "index": 26, "name": "real_time_cost_per_result", "comment": null}, "real_time_result": {"type": "INT64", "index": 27, "name": "real_time_result", "comment": null}, "real_time_result_rate": {"type": "FLOAT64", "index": 28, "name": "real_time_result_rate", "comment": null}, "result": {"type": "INT64", "index": 29, "name": "result", "comment": null}, "result_rate": {"type": "FLOAT64", "index": 30, "name": "result_rate", "comment": null}, "sales_lead": {"type": "FLOAT64", "index": 31, "name": "sales_lead", "comment": null}, "secondary_goal_result": {"type": "STRING", "index": 32, "name": "secondary_goal_result", "comment": null}, "secondary_goal_result_rate": {"type": "STRING", "index": 33, "name": "secondary_goal_result_rate", "comment": null}, "shares": {"type": "INT64", "index": 34, "name": "shares", "comment": null}, "spend": {"type": "FLOAT64", "index": 35, "name": "spend", "comment": null}, "total_purchase": {"type": "FLOAT64", "index": 36, "name": "total_purchase", "comment": null}, "total_purchase_value": {"type": "FLOAT64", "index": 37, "name": "total_purchase_value", "comment": null}, "total_sales_lead": {"type": "FLOAT64", "index": 38, "name": "total_sales_lead", "comment": null}, "total_sales_lead_value": {"type": "FLOAT64", "index": 39, "name": "total_sales_lead_value", "comment": null}, "video_play_actions": {"type": "INT64", "index": 40, "name": "video_play_actions", "comment": null}, "video_views_p_100": {"type": "INT64", "index": 41, "name": "video_views_p_100", "comment": null}, "video_views_p_25": {"type": "INT64", "index": 42, "name": "video_views_p_25", "comment": null}, "video_views_p_50": {"type": "INT64", "index": 43, "name": "video_views_p_50", "comment": null}, "video_views_p_75": {"type": "INT64", "index": 44, "name": "video_views_p_75", "comment": null}, "video_watched_2_s": {"type": "INT64", "index": 45, "name": "video_watched_2_s", "comment": null}, "video_watched_6_s": {"type": "INT64", "index": 46, "name": "video_watched_6_s", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 26.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 9178.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly"}, "source.tiktok_ads_source.tiktok_ads.ad_history": {"metadata": {"type": "table", "schema": "tiktok_ads_joe", "name": "ad_history", "database": "database", "comment": null, "owner": null}, "columns": {"ad_id": {"type": "INT64", "index": 1, "name": "ad_id", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 2, "name": "updated_at", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "ad_name": {"type": "STRING", "index": 4, "name": "ad_name", "comment": null}, "ad_text": {"type": "STRING", "index": 5, "name": "ad_text", "comment": null}, "adgroup_id": {"type": "INT64", "index": 6, "name": "adgroup_id", "comment": null}, "advertiser_id": {"type": "INT64", "index": 7, "name": "advertiser_id", "comment": null}, "app_name": {"type": "STRING", "index": 8, "name": "app_name", "comment": null}, "call_to_action": {"type": "STRING", "index": 9, "name": "call_to_action", "comment": null}, "campaign_id": {"type": "INT64", "index": 10, "name": "campaign_id", "comment": null}, "click_tracking_url": {"type": "STRING", "index": 11, "name": "click_tracking_url", "comment": null}, "create_time": {"type": "TIMESTAMP", "index": 12, "name": "create_time", "comment": null}, "display_name": {"type": "STRING", "index": 13, "name": "display_name", "comment": null}, "image_ids": {"type": "STRING", "index": 14, "name": "image_ids", "comment": null}, "impression_tracking_url": {"type": "STRING", "index": 15, "name": "impression_tracking_url", "comment": null}, "is_aco": {"type": "BOOL", "index": 16, "name": "is_aco", "comment": null}, "is_creative_authorized": {"type": "BOOL", "index": 17, "name": "is_creative_authorized", "comment": null}, "is_new_structure": {"type": "BOOL", "index": 18, "name": "is_new_structure", "comment": null}, "landing_page_url": {"type": "STRING", "index": 19, "name": "landing_page_url", "comment": null}, "open_url": {"type": "STRING", "index": 20, "name": "open_url", "comment": null}, "opt_status": {"type": "STRING", "index": 21, "name": "opt_status", "comment": null}, "playable_url": {"type": "STRING", "index": 22, "name": "playable_url", "comment": null}, "profile_image": {"type": "STRING", "index": 23, "name": "profile_image", "comment": null}, "status": {"type": "STRING", "index": 24, "name": "status", "comment": null}, "video_id": {"type": "STRING", "index": 25, "name": "video_id", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 1.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 309.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.tiktok_ads_source.tiktok_ads.ad_history"}, "source.tiktok_ads_source.tiktok_ads.adgroup_history": {"metadata": {"type": "table", "schema": "tiktok_ads_joe", "name": "adgroup_history", "database": "database", "comment": null, "owner": null}, "columns": {"adgroup_id": {"type": "INT64", "index": 1, "name": "adgroup_id", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 2, "name": "updated_at", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "action_categories": {"type": "STRING", "index": 4, "name": "action_categories", "comment": null}, "action_days": {"type": "INT64", "index": 5, "name": "action_days", "comment": null}, "adgroup_name": {"type": "STRING", "index": 6, "name": "adgroup_name", "comment": null}, "advertiser_id": {"type": "INT64", "index": 7, "name": "advertiser_id", "comment": null}, "age": {"type": "STRING", "index": 8, "name": "age", "comment": null}, "android_osv": {"type": "STRING", "index": 9, "name": "android_osv", "comment": null}, "app_download_url": {"type": "STRING", "index": 10, "name": "app_download_url", "comment": null}, "app_id": {"type": "INT64", "index": 11, "name": "app_id", "comment": null}, "app_name": {"type": "STRING", "index": 12, "name": "app_name", "comment": null}, "app_type": {"type": "STRING", "index": 13, "name": "app_type", "comment": null}, "audience": {"type": "STRING", "index": 14, "name": "audience", "comment": null}, "audience_type": {"type": "STRING", "index": 15, "name": "audience_type", "comment": null}, "bid": {"type": "FLOAT64", "index": 16, "name": "bid", "comment": null}, "bid_type": {"type": "STRING", "index": 17, "name": "bid_type", "comment": null}, "billing_event": {"type": "STRING", "index": 18, "name": "billing_event", "comment": null}, "budget": {"type": "FLOAT64", "index": 19, "name": "budget", "comment": null}, "budget_mode": {"type": "STRING", "index": 20, "name": "budget_mode", "comment": null}, "campaign_id": {"type": "INT64", "index": 21, "name": "campaign_id", "comment": null}, "carriers": {"type": "STRING", "index": 22, "name": "carriers", "comment": null}, "category": {"type": "INT64", "index": 23, "name": "category", "comment": null}, "click_tracking_url": {"type": "STRING", "index": 24, "name": "click_tracking_url", "comment": null}, "connection_type": {"type": "STRING", "index": 25, "name": "connection_type", "comment": null}, "conversion_bid": {"type": "FLOAT64", "index": 26, "name": "conversion_bid", "comment": null}, "cpv_video_duration": {"type": "STRING", "index": 27, "name": "cpv_video_duration", "comment": null}, "create_time": {"type": "TIMESTAMP", "index": 28, "name": "create_time", "comment": null}, "creative_material_mode": {"type": "STRING", "index": 29, "name": "creative_material_mode", "comment": null}, "dayparting": {"type": "STRING", "index": 30, "name": "dayparting", "comment": null}, "deep_bid_type": {"type": "STRING", "index": 31, "name": "deep_bid_type", "comment": null}, "deep_cpabid": {"type": "FLOAT64", "index": 32, "name": "deep_cpabid", "comment": null}, "deep_external_action": {"type": "STRING", "index": 33, "name": "deep_external_action", "comment": null}, "display_name": {"type": "STRING", "index": 34, "name": "display_name", "comment": null}, "enable_inventory_filter": {"type": "BOOL", "index": 35, "name": "enable_inventory_filter", "comment": null}, "excluded_audience": {"type": "STRING", "index": 36, "name": "excluded_audience", "comment": null}, "external_action": {"type": "STRING", "index": 37, "name": "external_action", "comment": null}, "fallback_type": {"type": "STRING", "index": 38, "name": "fallback_type", "comment": null}, "frequency": {"type": "INT64", "index": 39, "name": "frequency", "comment": null}, "frequency_schedule": {"type": "INT64", "index": 40, "name": "frequency_schedule", "comment": null}, "gender": {"type": "STRING", "index": 41, "name": "gender", "comment": null}, "impression_tracking_url": {"type": "STRING", "index": 42, "name": "impression_tracking_url", "comment": null}, "interest_category_v_2": {"type": "STRING", "index": 43, "name": "interest_category_v_2", "comment": null}, "ios_osv": {"type": "STRING", "index": 44, "name": "ios_osv", "comment": null}, "is_comment_disable": {"type": "INT64", "index": 45, "name": "is_comment_disable", "comment": null}, "is_hfss": {"type": "BOOL", "index": 46, "name": "is_hfss", "comment": null}, "is_new_structure": {"type": "BOOL", "index": 47, "name": "is_new_structure", "comment": null}, "keywords": {"type": "STRING", "index": 48, "name": "keywords", "comment": null}, "landing_page_url": {"type": "STRING", "index": 49, "name": "landing_page_url", "comment": null}, "languages": {"type": "STRING", "index": 50, "name": "languages", "comment": null}, "location": {"type": "STRING", "index": 51, "name": "location", "comment": null}, "open_url": {"type": "STRING", "index": 52, "name": "open_url", "comment": null}, "open_url_type": {"type": "STRING", "index": 53, "name": "open_url_type", "comment": null}, "operation_system": {"type": "STRING", "index": 54, "name": "operation_system", "comment": null}, "opt_status": {"type": "STRING", "index": 55, "name": "opt_status", "comment": null}, "optimize_goal": {"type": "STRING", "index": 56, "name": "optimize_goal", "comment": null}, "pacing": {"type": "STRING", "index": 57, "name": "pacing", "comment": null}, "package": {"type": "STRING", "index": 58, "name": "package", "comment": null}, "pangle_block_app_list_id": {"type": "STRING", "index": 59, "name": "pangle_block_app_list_id", "comment": null}, "pixel_id": {"type": "INT64", "index": 60, "name": "pixel_id", "comment": null}, "placement": {"type": "STRING", "index": 61, "name": "placement", "comment": null}, "placement_type": {"type": "STRING", "index": 62, "name": "placement_type", "comment": null}, "profile_image": {"type": "STRING", "index": 63, "name": "profile_image", "comment": null}, "schedule_end_time": {"type": "TIMESTAMP", "index": 64, "name": "schedule_end_time", "comment": null}, "schedule_start_time": {"type": "TIMESTAMP", "index": 65, "name": "schedule_start_time", "comment": null}, "schedule_type": {"type": "STRING", "index": 66, "name": "schedule_type", "comment": null}, "skip_learning_phase": {"type": "INT64", "index": 67, "name": "skip_learning_phase", "comment": null}, "statistic_type": {"type": "STRING", "index": 68, "name": "statistic_type", "comment": null}, "status": {"type": "STRING", "index": 69, "name": "status", "comment": null}, "video_actions": {"type": "STRING", "index": 70, "name": "video_actions", "comment": null}, "video_download": {"type": "STRING", "index": 71, "name": "video_download", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 2.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 1653.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.tiktok_ads_source.tiktok_ads.adgroup_history"}, "source.tiktok_ads_source.tiktok_ads.ad_report_hourly": {"metadata": {"type": "table", "schema": "tiktok_ads_joe", "name": "ad_report_hourly", "database": "database", "comment": null, "owner": null}, "columns": {"ad_id": {"type": "INT64", "index": 1, "name": "ad_id", "comment": null}, "stat_time_hour": {"type": "DATETIME", "index": 2, "name": "stat_time_hour", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "average_video_play": {"type": "FLOAT64", "index": 4, "name": "average_video_play", "comment": null}, "average_video_play_per_user": {"type": "FLOAT64", "index": 5, "name": "average_video_play_per_user", "comment": null}, "clicks": {"type": "INT64", "index": 6, "name": "clicks", "comment": null}, "comments": {"type": "INT64", "index": 7, "name": "comments", "comment": null}, "conversion": {"type": "INT64", "index": 8, "name": "conversion", "comment": null}, "conversion_rate": {"type": "FLOAT64", "index": 9, "name": "conversion_rate", "comment": null}, "cost_per_1000_reached": {"type": "FLOAT64", "index": 10, "name": "cost_per_1000_reached", "comment": null}, "cost_per_conversion": {"type": "FLOAT64", "index": 11, "name": "cost_per_conversion", "comment": null}, "cost_per_result": {"type": "FLOAT64", "index": 12, "name": "cost_per_result", "comment": null}, "cost_per_secondary_goal_result": {"type": "STRING", "index": 13, "name": "cost_per_secondary_goal_result", "comment": null}, "cpc": {"type": "FLOAT64", "index": 14, "name": "cpc", "comment": null}, "cpm": {"type": "FLOAT64", "index": 15, "name": "cpm", "comment": null}, "ctr": {"type": "FLOAT64", "index": 16, "name": "ctr", "comment": null}, "follows": {"type": "INT64", "index": 17, "name": "follows", "comment": null}, "impressions": {"type": "INT64", "index": 18, "name": "impressions", "comment": null}, "likes": {"type": "INT64", "index": 19, "name": "likes", "comment": null}, "profile_visits": {"type": "INT64", "index": 20, "name": "profile_visits", "comment": null}, "profile_visits_rate": {"type": "FLOAT64", "index": 21, "name": "profile_visits_rate", "comment": null}, "reach": {"type": "INT64", "index": 22, "name": "reach", "comment": null}, "real_time_conversion": {"type": "INT64", "index": 23, "name": "real_time_conversion", "comment": null}, "real_time_conversion_rate": {"type": "FLOAT64", "index": 24, "name": "real_time_conversion_rate", "comment": null}, "real_time_cost_per_conversion": {"type": "FLOAT64", "index": 25, "name": "real_time_cost_per_conversion", "comment": null}, "real_time_cost_per_result": {"type": "FLOAT64", "index": 26, "name": "real_time_cost_per_result", "comment": null}, "real_time_result": {"type": "INT64", "index": 27, "name": "real_time_result", "comment": null}, "real_time_result_rate": {"type": "FLOAT64", "index": 28, "name": "real_time_result_rate", "comment": null}, "result": {"type": "INT64", "index": 29, "name": "result", "comment": null}, "result_rate": {"type": "FLOAT64", "index": 30, "name": "result_rate", "comment": null}, "sales_lead": {"type": "FLOAT64", "index": 31, "name": "sales_lead", "comment": null}, "secondary_goal_result": {"type": "STRING", "index": 32, "name": "secondary_goal_result", "comment": null}, "secondary_goal_result_rate": {"type": "STRING", "index": 33, "name": "secondary_goal_result_rate", "comment": null}, "shares": {"type": "INT64", "index": 34, "name": "shares", "comment": null}, "spend": {"type": "FLOAT64", "index": 35, "name": "spend", "comment": null}, "total_purchase": {"type": "FLOAT64", "index": 36, "name": "total_purchase", "comment": null}, "total_purchase_value": {"type": "FLOAT64", "index": 37, "name": "total_purchase_value", "comment": null}, "total_sales_lead": {"type": "FLOAT64", "index": 38, "name": "total_sales_lead", "comment": null}, "total_sales_lead_value": {"type": "FLOAT64", "index": 39, "name": "total_sales_lead_value", "comment": null}, "video_play_actions": {"type": "INT64", "index": 40, "name": "video_play_actions", "comment": null}, "video_views_p_100": {"type": "INT64", "index": 41, "name": "video_views_p_100", "comment": null}, "video_views_p_25": {"type": "INT64", "index": 42, "name": "video_views_p_25", "comment": null}, "video_views_p_50": {"type": "INT64", "index": 43, "name": "video_views_p_50", "comment": null}, "video_views_p_75": {"type": "INT64", "index": 44, "name": "video_views_p_75", "comment": null}, "video_watched_2_s": {"type": "INT64", "index": 45, "name": "video_watched_2_s", "comment": null}, "video_watched_6_s": {"type": "INT64", "index": 46, "name": "video_watched_6_s", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 26.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 9178.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.tiktok_ads_source.tiktok_ads.ad_report_hourly"}, "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly": {"metadata": {"type": "table", "schema": "tiktok_ads_joe", "name": "adgroup_report_hourly", "database": "database", "comment": null, "owner": null}, "columns": {"adgroup_id": {"type": "INT64", "index": 1, "name": "adgroup_id", "comment": null}, "stat_time_hour": {"type": "DATETIME", "index": 2, "name": "stat_time_hour", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "average_video_play": {"type": "FLOAT64", "index": 4, "name": "average_video_play", "comment": null}, "average_video_play_per_user": {"type": "FLOAT64", "index": 5, "name": "average_video_play_per_user", "comment": null}, "clicks": {"type": "INT64", "index": 6, "name": "clicks", "comment": null}, "comments": {"type": "INT64", "index": 7, "name": "comments", "comment": null}, "conversion": {"type": "INT64", "index": 8, "name": "conversion", "comment": null}, "conversion_rate": {"type": "FLOAT64", "index": 9, "name": "conversion_rate", "comment": null}, "cost_per_1000_reached": {"type": "FLOAT64", "index": 10, "name": "cost_per_1000_reached", "comment": null}, "cost_per_conversion": {"type": "FLOAT64", "index": 11, "name": "cost_per_conversion", "comment": null}, "cost_per_result": {"type": "FLOAT64", "index": 12, "name": "cost_per_result", "comment": null}, "cost_per_secondary_goal_result": {"type": "STRING", "index": 13, "name": "cost_per_secondary_goal_result", "comment": null}, "cpc": {"type": "FLOAT64", "index": 14, "name": "cpc", "comment": null}, "cpm": {"type": "FLOAT64", "index": 15, "name": "cpm", "comment": null}, "ctr": {"type": "FLOAT64", "index": 16, "name": "ctr", "comment": null}, "follows": {"type": "INT64", "index": 17, "name": "follows", "comment": null}, "impressions": {"type": "INT64", "index": 18, "name": "impressions", "comment": null}, "likes": {"type": "INT64", "index": 19, "name": "likes", "comment": null}, "profile_visits": {"type": "INT64", "index": 20, "name": "profile_visits", "comment": null}, "profile_visits_rate": {"type": "FLOAT64", "index": 21, "name": "profile_visits_rate", "comment": null}, "reach": {"type": "INT64", "index": 22, "name": "reach", "comment": null}, "real_time_conversion": {"type": "INT64", "index": 23, "name": "real_time_conversion", "comment": null}, "real_time_conversion_rate": {"type": "FLOAT64", "index": 24, "name": "real_time_conversion_rate", "comment": null}, "real_time_cost_per_conversion": {"type": "FLOAT64", "index": 25, "name": "real_time_cost_per_conversion", "comment": null}, "real_time_cost_per_result": {"type": "FLOAT64", "index": 26, "name": "real_time_cost_per_result", "comment": null}, "real_time_result": {"type": "INT64", "index": 27, "name": "real_time_result", "comment": null}, "real_time_result_rate": {"type": "FLOAT64", "index": 28, "name": "real_time_result_rate", "comment": null}, "result": {"type": "INT64", "index": 29, "name": "result", "comment": null}, "result_rate": {"type": "FLOAT64", "index": 30, "name": "result_rate", "comment": null}, "sales_lead": {"type": "FLOAT64", "index": 31, "name": "sales_lead", "comment": null}, "secondary_goal_result": {"type": "STRING", "index": 32, "name": "secondary_goal_result", "comment": null}, "secondary_goal_result_rate": {"type": "STRING", "index": 33, "name": "secondary_goal_result_rate", "comment": null}, "shares": {"type": "INT64", "index": 34, "name": "shares", "comment": null}, "spend": {"type": "FLOAT64", "index": 35, "name": "spend", "comment": null}, "total_purchase": {"type": "FLOAT64", "index": 36, "name": "total_purchase", "comment": null}, "total_purchase_value": {"type": "FLOAT64", "index": 37, "name": "total_purchase_value", "comment": null}, "total_sales_lead": {"type": "FLOAT64", "index": 38, "name": "total_sales_lead", "comment": null}, "total_sales_lead_value": {"type": "FLOAT64", "index": 39, "name": "total_sales_lead_value", "comment": null}, "video_play_actions": {"type": "INT64", "index": 40, "name": "video_play_actions", "comment": null}, "video_views_p_100": {"type": "INT64", "index": 41, "name": "video_views_p_100", "comment": null}, "video_views_p_25": {"type": "INT64", "index": 42, "name": "video_views_p_25", "comment": null}, "video_views_p_50": {"type": "INT64", "index": 43, "name": "video_views_p_50", "comment": null}, "video_views_p_75": {"type": "INT64", "index": 44, "name": "video_views_p_75", "comment": null}, "video_watched_2_s": {"type": "INT64", "index": 45, "name": "video_watched_2_s", "comment": null}, "video_watched_6_s": {"type": "INT64", "index": 46, "name": "video_watched_6_s", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 26.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 9178.0, "include": true, "description": "Approximate size of table as reported by BigQuery"}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly"}}, "errors": null} \ No newline at end of file +{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/catalog/v1.json", "dbt_version": "1.0.4", "generated_at": "2022-08-26T20:02:13.016874Z", "invocation_id": "9fdbca68-4741-4af7-99ac-be7d5e1618c0", "env": {}}, "nodes": {"seed.tiktok_ads_source_integration_tests.tiktok_ad_history_data": {"metadata": {"type": "BASE TABLE", "schema": "tiktok_ads_source_integration_tests_1", "name": "tiktok_ad_history_data", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"ad_id": {"type": "integer", "index": 1, "name": "ad_id", "comment": null}, "updated_at": {"type": "text", "index": 2, "name": "updated_at", "comment": null}, "advertiser_id": {"type": "integer", "index": 3, "name": "advertiser_id", "comment": null}, "adgroup_id": {"type": "integer", "index": 4, "name": "adgroup_id", "comment": null}, "campaign_id": {"type": "integer", "index": 5, "name": "campaign_id", "comment": null}, "create_time": {"type": "text", "index": 6, "name": "create_time", "comment": null}, "ad_name": {"type": "text", "index": 7, "name": "ad_name", "comment": null}, "call_to_action": {"type": "text", "index": 8, "name": "call_to_action", "comment": null}, "status": {"type": "text", "index": 9, "name": "status", "comment": null}, "opt_status": {"type": "text", "index": 10, "name": "opt_status", "comment": null}, "ad_text": {"type": "text", "index": 11, "name": "ad_text", "comment": null}, "video_id": {"type": "text", "index": 12, "name": "video_id", "comment": null}, "app_name": {"type": "integer", "index": 13, "name": "app_name", "comment": null}, "open_url": {"type": "integer", "index": 14, "name": "open_url", "comment": null}, "landing_page_url": {"type": "text", "index": 15, "name": "landing_page_url", "comment": null}, "display_name": {"type": "text", "index": 16, "name": "display_name", "comment": null}, "profile_image": {"type": "integer", "index": 17, "name": "profile_image", "comment": null}, "impression_tracking_url": {"type": "integer", "index": 18, "name": "impression_tracking_url", "comment": null}, "click_tracking_url": {"type": "integer", "index": 19, "name": "click_tracking_url", "comment": null}, "playable_url": {"type": "integer", "index": 20, "name": "playable_url", "comment": null}, "is_aco": {"type": "boolean", "index": 21, "name": "is_aco", "comment": null}, "is_creative_authorized": {"type": "boolean", "index": 22, "name": "is_creative_authorized", "comment": null}, "is_new_structure": {"type": "boolean", "index": 23, "name": "is_new_structure", "comment": null}, "image_ids": {"type": "text", "index": 24, "name": "image_ids", "comment": null}, "_fivetran_synced": {"type": "text", "index": 25, "name": "_fivetran_synced", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.tiktok_ads_source_integration_tests.tiktok_ad_history_data"}, "seed.tiktok_ads_source_integration_tests.tiktok_ad_report_hourly_data": {"metadata": {"type": "BASE TABLE", "schema": "tiktok_ads_source_integration_tests_1", "name": "tiktok_ad_report_hourly_data", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"ad_id": {"type": "integer", "index": 1, "name": "ad_id", "comment": null}, "stat_time_hour": {"type": "timestamp without time zone", "index": 2, "name": "stat_time_hour", "comment": null}, "cost_per_conversion": {"type": "double precision", "index": 3, "name": "cost_per_conversion", "comment": null}, "real_time_conversion": {"type": "integer", "index": 4, "name": "real_time_conversion", "comment": null}, "cpc": {"type": "double precision", "index": 5, "name": "cpc", "comment": null}, "video_play_actions": {"type": "integer", "index": 6, "name": "video_play_actions", "comment": null}, "conversion_rate": {"type": "integer", "index": 7, "name": "conversion_rate", "comment": null}, "video_views_p_75": {"type": "integer", "index": 8, "name": "video_views_p_75", "comment": null}, "result": {"type": "integer", "index": 9, "name": "result", "comment": null}, "video_views_p_50": {"type": "integer", "index": 10, "name": "video_views_p_50", "comment": null}, "impressions": {"type": "integer", "index": 11, "name": "impressions", "comment": null}, "comments": {"type": "integer", "index": 12, "name": "comments", "comment": null}, "real_time_cost_per_result": {"type": "double precision", "index": 13, "name": "real_time_cost_per_result", "comment": null}, "conversion": {"type": "integer", "index": 14, "name": "conversion", "comment": null}, "real_time_result": {"type": "integer", "index": 15, "name": "real_time_result", "comment": null}, "video_views_p_100": {"type": "integer", "index": 16, "name": "video_views_p_100", "comment": null}, "shares": {"type": "integer", "index": 17, "name": "shares", "comment": null}, "real_time_conversion_rate": {"type": "integer", "index": 18, "name": "real_time_conversion_rate", "comment": null}, "cost_per_secondary_goal_result": {"type": "text", "index": 19, "name": "cost_per_secondary_goal_result", "comment": null}, "secondary_goal_result_rate": {"type": "text", "index": 20, "name": "secondary_goal_result_rate", "comment": null}, "clicks": {"type": "integer", "index": 21, "name": "clicks", "comment": null}, "cost_per_1000_reached": {"type": "integer", "index": 22, "name": "cost_per_1000_reached", "comment": null}, "video_views_p_25": {"type": "integer", "index": 23, "name": "video_views_p_25", "comment": null}, "reach": {"type": "integer", "index": 24, "name": "reach", "comment": null}, "real_time_cost_per_conversion": {"type": "double precision", "index": 25, "name": "real_time_cost_per_conversion", "comment": null}, "profile_visits_rate": {"type": "integer", "index": 26, "name": "profile_visits_rate", "comment": null}, "average_video_play": {"type": "double precision", "index": 27, "name": "average_video_play", "comment": null}, "profile_visits": {"type": "integer", "index": 28, "name": "profile_visits", "comment": null}, "cpm": {"type": "double precision", "index": 29, "name": "cpm", "comment": null}, "ctr": {"type": "double precision", "index": 30, "name": "ctr", "comment": null}, "video_watched_2_s": {"type": "integer", "index": 31, "name": "video_watched_2_s", "comment": null}, "follows": {"type": "integer", "index": 32, "name": "follows", "comment": null}, "result_rate": {"type": "integer", "index": 33, "name": "result_rate", "comment": null}, "video_watched_6_s": {"type": "integer", "index": 34, "name": "video_watched_6_s", "comment": null}, "secondary_goal_result": {"type": "text", "index": 35, "name": "secondary_goal_result", "comment": null}, "cost_per_result": {"type": "double precision", "index": 36, "name": "cost_per_result", "comment": null}, "average_video_play_per_user": {"type": "integer", "index": 37, "name": "average_video_play_per_user", "comment": null}, "real_time_result_rate": {"type": "integer", "index": 38, "name": "real_time_result_rate", "comment": null}, "spend": {"type": "double precision", "index": 39, "name": "spend", "comment": null}, "likes": {"type": "integer", "index": 40, "name": "likes", "comment": null}, "_fivetran_synced": {"type": "text", "index": 41, "name": "_fivetran_synced", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.tiktok_ads_source_integration_tests.tiktok_ad_report_hourly_data"}, "seed.tiktok_ads_source_integration_tests.tiktok_adgroup_history_data": {"metadata": {"type": "BASE TABLE", "schema": "tiktok_ads_source_integration_tests_1", "name": "tiktok_adgroup_history_data", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"adgroup_id": {"type": "integer", "index": 1, "name": "adgroup_id", "comment": null}, "updated_at": {"type": "text", "index": 2, "name": "updated_at", "comment": null}, "advertiser_id": {"type": "integer", "index": 3, "name": "advertiser_id", "comment": null}, "campaign_id": {"type": "integer", "index": 4, "name": "campaign_id", "comment": null}, "create_time": {"type": "text", "index": 5, "name": "create_time", "comment": null}, "adgroup_name": {"type": "text", "index": 6, "name": "adgroup_name", "comment": null}, "placement_type": {"type": "text", "index": 7, "name": "placement_type", "comment": null}, "profile_image": {"type": "integer", "index": 8, "name": "profile_image", "comment": null}, "landing_page_url": {"type": "integer", "index": 9, "name": "landing_page_url", "comment": null}, "display_name": {"type": "integer", "index": 10, "name": "display_name", "comment": null}, "app_type": {"type": "integer", "index": 11, "name": "app_type", "comment": null}, "app_download_url": {"type": "integer", "index": 12, "name": "app_download_url", "comment": null}, "app_name": {"type": "integer", "index": 13, "name": "app_name", "comment": null}, "external_action": {"type": "text", "index": 14, "name": "external_action", "comment": null}, "deep_external_action": {"type": "integer", "index": 15, "name": "deep_external_action", "comment": null}, "creative_material_mode": {"type": "text", "index": 16, "name": "creative_material_mode", "comment": null}, "audience_type": {"type": "integer", "index": 17, "name": "audience_type", "comment": null}, "gender": {"type": "text", "index": 18, "name": "gender", "comment": null}, "android_osv": {"type": "integer", "index": 19, "name": "android_osv", "comment": null}, "ios_osv": {"type": "integer", "index": 20, "name": "ios_osv", "comment": null}, "budget_mode": {"type": "text", "index": 21, "name": "budget_mode", "comment": null}, "schedule_type": {"type": "text", "index": 22, "name": "schedule_type", "comment": null}, "dayparting": {"type": "integer", "index": 23, "name": "dayparting", "comment": null}, "optimize_goal": {"type": "text", "index": 24, "name": "optimize_goal", "comment": null}, "cpv_video_duration": {"type": "integer", "index": 25, "name": "cpv_video_duration", "comment": null}, "pacing": {"type": "text", "index": 26, "name": "pacing", "comment": null}, "billing_event": {"type": "text", "index": 27, "name": "billing_event", "comment": null}, "bid_type": {"type": "text", "index": 28, "name": "bid_type", "comment": null}, "deep_bid_type": {"type": "integer", "index": 29, "name": "deep_bid_type", "comment": null}, "impression_tracking_url": {"type": "integer", "index": 30, "name": "impression_tracking_url", "comment": null}, "click_tracking_url": {"type": "integer", "index": 31, "name": "click_tracking_url", "comment": null}, "status": {"type": "text", "index": 32, "name": "status", "comment": null}, "opt_status": {"type": "text", "index": 33, "name": "opt_status", "comment": null}, "statistic_type": {"type": "integer", "index": 34, "name": "statistic_type", "comment": null}, "video_download": {"type": "text", "index": 35, "name": "video_download", "comment": null}, "open_url": {"type": "integer", "index": 36, "name": "open_url", "comment": null}, "open_url_type": {"type": "integer", "index": 37, "name": "open_url_type", "comment": null}, "fallback_type": {"type": "integer", "index": 38, "name": "fallback_type", "comment": null}, "budget": {"type": "integer", "index": 39, "name": "budget", "comment": null}, "bid": {"type": "integer", "index": 40, "name": "bid", "comment": null}, "conversion_bid": {"type": "integer", "index": 41, "name": "conversion_bid", "comment": null}, "deep_cpabid": {"type": "integer", "index": 42, "name": "deep_cpabid", "comment": null}, "schedule_start_time": {"type": "text", "index": 43, "name": "schedule_start_time", "comment": null}, "schedule_end_time": {"type": "text", "index": 44, "name": "schedule_end_time", "comment": null}, "app_id": {"type": "integer", "index": 45, "name": "app_id", "comment": null}, "pixel_id": {"type": "integer", "index": 46, "name": "pixel_id", "comment": null}, "enable_inventory_filter": {"type": "boolean", "index": 47, "name": "enable_inventory_filter", "comment": null}, "is_hfss": {"type": "boolean", "index": 48, "name": "is_hfss", "comment": null}, "is_new_structure": {"type": "boolean", "index": 49, "name": "is_new_structure", "comment": null}, "category": {"type": "integer", "index": 50, "name": "category", "comment": null}, "is_comment_disable": {"type": "integer", "index": 51, "name": "is_comment_disable", "comment": null}, "skip_learning_phase": {"type": "integer", "index": 52, "name": "skip_learning_phase", "comment": null}, "frequency": {"type": "integer", "index": 53, "name": "frequency", "comment": null}, "frequency_schedule": {"type": "integer", "index": 54, "name": "frequency_schedule", "comment": null}, "action_days": {"type": "integer", "index": 55, "name": "action_days", "comment": null}, "audience": {"type": "text", "index": 56, "name": "audience", "comment": null}, "excluded_audience": {"type": "text", "index": 57, "name": "excluded_audience", "comment": null}, "location": {"type": "text", "index": 58, "name": "location", "comment": null}, "interest_category_v_2": {"type": "text", "index": 59, "name": "interest_category_v_2", "comment": null}, "pangle_block_app_list_id": {"type": "text", "index": 60, "name": "pangle_block_app_list_id", "comment": null}, "action_categories": {"type": "text", "index": 61, "name": "action_categories", "comment": null}, "placement": {"type": "text", "index": 62, "name": "placement", "comment": null}, "keywords": {"type": "integer", "index": 63, "name": "keywords", "comment": null}, "age": {"type": "text", "index": 64, "name": "age", "comment": null}, "languages": {"type": "text", "index": 65, "name": "languages", "comment": null}, "operation_system": {"type": "text", "index": 66, "name": "operation_system", "comment": null}, "connection_type": {"type": "text", "index": 67, "name": "connection_type", "comment": null}, "carriers": {"type": "text", "index": 68, "name": "carriers", "comment": null}, "video_actions": {"type": "text", "index": 69, "name": "video_actions", "comment": null}, "package": {"type": "integer", "index": 70, "name": "package", "comment": null}, "_fivetran_synced": {"type": "text", "index": 71, "name": "_fivetran_synced", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.tiktok_ads_source_integration_tests.tiktok_adgroup_history_data"}, "seed.tiktok_ads_source_integration_tests.tiktok_adgroup_report_hourly_data": {"metadata": {"type": "BASE TABLE", "schema": "tiktok_ads_source_integration_tests_1", "name": "tiktok_adgroup_report_hourly_data", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"adgroup_id": {"type": "integer", "index": 1, "name": "adgroup_id", "comment": null}, "stat_time_hour": {"type": "timestamp without time zone", "index": 2, "name": "stat_time_hour", "comment": null}, "cost_per_conversion": {"type": "double precision", "index": 3, "name": "cost_per_conversion", "comment": null}, "real_time_conversion": {"type": "integer", "index": 4, "name": "real_time_conversion", "comment": null}, "cpc": {"type": "double precision", "index": 5, "name": "cpc", "comment": null}, "video_play_actions": {"type": "integer", "index": 6, "name": "video_play_actions", "comment": null}, "conversion_rate": {"type": "integer", "index": 7, "name": "conversion_rate", "comment": null}, "video_views_p_75": {"type": "integer", "index": 8, "name": "video_views_p_75", "comment": null}, "result": {"type": "integer", "index": 9, "name": "result", "comment": null}, "video_views_p_50": {"type": "integer", "index": 10, "name": "video_views_p_50", "comment": null}, "impressions": {"type": "integer", "index": 11, "name": "impressions", "comment": null}, "comments": {"type": "integer", "index": 12, "name": "comments", "comment": null}, "real_time_cost_per_result": {"type": "double precision", "index": 13, "name": "real_time_cost_per_result", "comment": null}, "conversion": {"type": "integer", "index": 14, "name": "conversion", "comment": null}, "real_time_result": {"type": "integer", "index": 15, "name": "real_time_result", "comment": null}, "video_views_p_100": {"type": "integer", "index": 16, "name": "video_views_p_100", "comment": null}, "shares": {"type": "integer", "index": 17, "name": "shares", "comment": null}, "real_time_conversion_rate": {"type": "double precision", "index": 18, "name": "real_time_conversion_rate", "comment": null}, "cost_per_secondary_goal_result": {"type": "text", "index": 19, "name": "cost_per_secondary_goal_result", "comment": null}, "secondary_goal_result_rate": {"type": "text", "index": 20, "name": "secondary_goal_result_rate", "comment": null}, "clicks": {"type": "integer", "index": 21, "name": "clicks", "comment": null}, "cost_per_1000_reached": {"type": "double precision", "index": 22, "name": "cost_per_1000_reached", "comment": null}, "video_views_p_25": {"type": "integer", "index": 23, "name": "video_views_p_25", "comment": null}, "reach": {"type": "integer", "index": 24, "name": "reach", "comment": null}, "real_time_cost_per_conversion": {"type": "double precision", "index": 25, "name": "real_time_cost_per_conversion", "comment": null}, "profile_visits_rate": {"type": "integer", "index": 26, "name": "profile_visits_rate", "comment": null}, "average_video_play": {"type": "double precision", "index": 27, "name": "average_video_play", "comment": null}, "profile_visits": {"type": "integer", "index": 28, "name": "profile_visits", "comment": null}, "cpm": {"type": "double precision", "index": 29, "name": "cpm", "comment": null}, "ctr": {"type": "double precision", "index": 30, "name": "ctr", "comment": null}, "video_watched_2_s": {"type": "integer", "index": 31, "name": "video_watched_2_s", "comment": null}, "follows": {"type": "integer", "index": 32, "name": "follows", "comment": null}, "result_rate": {"type": "double precision", "index": 33, "name": "result_rate", "comment": null}, "video_watched_6_s": {"type": "integer", "index": 34, "name": "video_watched_6_s", "comment": null}, "secondary_goal_result": {"type": "text", "index": 35, "name": "secondary_goal_result", "comment": null}, "cost_per_result": {"type": "double precision", "index": 36, "name": "cost_per_result", "comment": null}, "average_video_play_per_user": {"type": "double precision", "index": 37, "name": "average_video_play_per_user", "comment": null}, "real_time_result_rate": {"type": "double precision", "index": 38, "name": "real_time_result_rate", "comment": null}, "spend": {"type": "double precision", "index": 39, "name": "spend", "comment": null}, "likes": {"type": "integer", "index": 40, "name": "likes", "comment": null}, "_fivetran_synced": {"type": "text", "index": 41, "name": "_fivetran_synced", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.tiktok_ads_source_integration_tests.tiktok_adgroup_report_hourly_data"}, "seed.tiktok_ads_source_integration_tests.tiktok_advertiser_data": {"metadata": {"type": "BASE TABLE", "schema": "tiktok_ads_source_integration_tests_1", "name": "tiktok_advertiser_data", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"id": {"type": "integer", "index": 1, "name": "id", "comment": null}, "name": {"type": "text", "index": 2, "name": "name", "comment": null}, "address": {"type": "text", "index": 3, "name": "address", "comment": null}, "company": {"type": "text", "index": 4, "name": "company", "comment": null}, "contacter": {"type": "integer", "index": 5, "name": "contacter", "comment": null}, "country": {"type": "text", "index": 6, "name": "country", "comment": null}, "currency": {"type": "text", "index": 7, "name": "currency", "comment": null}, "description": {"type": "text", "index": 8, "name": "description", "comment": null}, "email": {"type": "text", "index": 9, "name": "email", "comment": null}, "industry": {"type": "integer", "index": 10, "name": "industry", "comment": null}, "license_no": {"type": "integer", "index": 11, "name": "license_no", "comment": null}, "license_url": {"type": "integer", "index": 12, "name": "license_url", "comment": null}, "promotion_area": {"type": "integer", "index": 13, "name": "promotion_area", "comment": null}, "reason": {"type": "integer", "index": 14, "name": "reason", "comment": null}, "role": {"type": "text", "index": 15, "name": "role", "comment": null}, "status": {"type": "text", "index": 16, "name": "status", "comment": null}, "telephone": {"type": "integer", "index": 17, "name": "telephone", "comment": null}, "timezone": {"type": "text", "index": 18, "name": "timezone", "comment": null}, "balance": {"type": "double precision", "index": 19, "name": "balance", "comment": null}, "create_time": {"type": "text", "index": 20, "name": "create_time", "comment": null}, "language": {"type": "text", "index": 21, "name": "language", "comment": null}, "phone_number": {"type": "text", "index": 22, "name": "phone_number", "comment": null}, "_fivetran_synced": {"type": "text", "index": 23, "name": "_fivetran_synced", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.tiktok_ads_source_integration_tests.tiktok_advertiser_data"}, "seed.tiktok_ads_source_integration_tests.tiktok_campaign_history_data": {"metadata": {"type": "BASE TABLE", "schema": "tiktok_ads_source_integration_tests_1", "name": "tiktok_campaign_history_data", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"campaign_id": {"type": "integer", "index": 1, "name": "campaign_id", "comment": null}, "updated_at": {"type": "text", "index": 2, "name": "updated_at", "comment": null}, "advertiser_id": {"type": "integer", "index": 3, "name": "advertiser_id", "comment": null}, "campaign_name": {"type": "text", "index": 4, "name": "campaign_name", "comment": null}, "campaign_type": {"type": "text", "index": 5, "name": "campaign_type", "comment": null}, "budget": {"type": "integer", "index": 6, "name": "budget", "comment": null}, "budget_mode": {"type": "text", "index": 7, "name": "budget_mode", "comment": null}, "opt_status": {"type": "text", "index": 8, "name": "opt_status", "comment": null}, "objective_type": {"type": "text", "index": 9, "name": "objective_type", "comment": null}, "is_new_structure": {"type": "boolean", "index": 10, "name": "is_new_structure", "comment": null}, "split_test_variable": {"type": "integer", "index": 11, "name": "split_test_variable", "comment": null}, "create_time": {"type": "text", "index": 12, "name": "create_time", "comment": null}, "_fivetran_synced": {"type": "text", "index": 13, "name": "_fivetran_synced", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.tiktok_ads_source_integration_tests.tiktok_campaign_history_data"}, "seed.tiktok_ads_source_integration_tests.tiktok_campaign_report_hourly_data": {"metadata": {"type": "BASE TABLE", "schema": "tiktok_ads_source_integration_tests_1", "name": "tiktok_campaign_report_hourly_data", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"campaign_id": {"type": "integer", "index": 1, "name": "campaign_id", "comment": null}, "stat_time_hour": {"type": "timestamp without time zone", "index": 2, "name": "stat_time_hour", "comment": null}, "cost_per_conversion": {"type": "double precision", "index": 3, "name": "cost_per_conversion", "comment": null}, "real_time_conversion": {"type": "integer", "index": 4, "name": "real_time_conversion", "comment": null}, "cpc": {"type": "double precision", "index": 5, "name": "cpc", "comment": null}, "video_play_actions": {"type": "integer", "index": 6, "name": "video_play_actions", "comment": null}, "conversion_rate": {"type": "integer", "index": 7, "name": "conversion_rate", "comment": null}, "video_views_p_75": {"type": "integer", "index": 8, "name": "video_views_p_75", "comment": null}, "result": {"type": "integer", "index": 9, "name": "result", "comment": null}, "video_views_p_50": {"type": "integer", "index": 10, "name": "video_views_p_50", "comment": null}, "impressions": {"type": "integer", "index": 11, "name": "impressions", "comment": null}, "comments": {"type": "integer", "index": 12, "name": "comments", "comment": null}, "real_time_cost_per_result": {"type": "double precision", "index": 13, "name": "real_time_cost_per_result", "comment": null}, "conversion": {"type": "integer", "index": 14, "name": "conversion", "comment": null}, "real_time_result": {"type": "integer", "index": 15, "name": "real_time_result", "comment": null}, "video_views_p_100": {"type": "integer", "index": 16, "name": "video_views_p_100", "comment": null}, "shares": {"type": "integer", "index": 17, "name": "shares", "comment": null}, "real_time_conversion_rate": {"type": "double precision", "index": 18, "name": "real_time_conversion_rate", "comment": null}, "cost_per_secondary_goal_result": {"type": "text", "index": 19, "name": "cost_per_secondary_goal_result", "comment": null}, "secondary_goal_result_rate": {"type": "text", "index": 20, "name": "secondary_goal_result_rate", "comment": null}, "clicks": {"type": "integer", "index": 21, "name": "clicks", "comment": null}, "cost_per_1000_reached": {"type": "double precision", "index": 22, "name": "cost_per_1000_reached", "comment": null}, "video_views_p_25": {"type": "integer", "index": 23, "name": "video_views_p_25", "comment": null}, "reach": {"type": "integer", "index": 24, "name": "reach", "comment": null}, "real_time_cost_per_conversion": {"type": "double precision", "index": 25, "name": "real_time_cost_per_conversion", "comment": null}, "profile_visits_rate": {"type": "integer", "index": 26, "name": "profile_visits_rate", "comment": null}, "average_video_play": {"type": "double precision", "index": 27, "name": "average_video_play", "comment": null}, "profile_visits": {"type": "integer", "index": 28, "name": "profile_visits", "comment": null}, "cpm": {"type": "double precision", "index": 29, "name": "cpm", "comment": null}, "ctr": {"type": "double precision", "index": 30, "name": "ctr", "comment": null}, "video_watched_2_s": {"type": "integer", "index": 31, "name": "video_watched_2_s", "comment": null}, "follows": {"type": "integer", "index": 32, "name": "follows", "comment": null}, "result_rate": {"type": "double precision", "index": 33, "name": "result_rate", "comment": null}, "video_watched_6_s": {"type": "integer", "index": 34, "name": "video_watched_6_s", "comment": null}, "secondary_goal_result": {"type": "text", "index": 35, "name": "secondary_goal_result", "comment": null}, "cost_per_result": {"type": "double precision", "index": 36, "name": "cost_per_result", "comment": null}, "average_video_play_per_user": {"type": "double precision", "index": 37, "name": "average_video_play_per_user", "comment": null}, "real_time_result_rate": {"type": "double precision", "index": 38, "name": "real_time_result_rate", "comment": null}, "spend": {"type": "double precision", "index": 39, "name": "spend", "comment": null}, "likes": {"type": "integer", "index": 40, "name": "likes", "comment": null}, "_fivetran_synced": {"type": "text", "index": 41, "name": "_fivetran_synced", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.tiktok_ads_source_integration_tests.tiktok_campaign_report_hourly_data"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history": {"metadata": {"type": "BASE TABLE", "schema": "tiktok_ads_source_integration_tests_1_stg_tiktok_ads", "name": "stg_tiktok_ads__ad_group_history", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"ad_group_id": {"type": "integer", "index": 1, "name": "ad_group_id", "comment": null}, "updated_at": {"type": "timestamp without time zone", "index": 2, "name": "updated_at", "comment": null}, "advertiser_id": {"type": "integer", "index": 3, "name": "advertiser_id", "comment": null}, "campaign_id": {"type": "integer", "index": 4, "name": "campaign_id", "comment": null}, "action_days": {"type": "integer", "index": 5, "name": "action_days", "comment": null}, "action_categories": {"type": "text", "index": 6, "name": "action_categories", "comment": null}, "ad_group_name": {"type": "text", "index": 7, "name": "ad_group_name", "comment": null}, "age": {"type": "text", "index": 8, "name": "age", "comment": null}, "audience_type": {"type": "integer", "index": 9, "name": "audience_type", "comment": null}, "budget": {"type": "integer", "index": 10, "name": "budget", "comment": null}, "category": {"type": "integer", "index": 11, "name": "category", "comment": null}, "display_name": {"type": "integer", "index": 12, "name": "display_name", "comment": null}, "interest_category": {"type": "text", "index": 13, "name": "interest_category", "comment": null}, "frequency": {"type": "integer", "index": 14, "name": "frequency", "comment": null}, "frequency_schedule": {"type": "integer", "index": 15, "name": "frequency_schedule", "comment": null}, "gender": {"type": "text", "index": 16, "name": "gender", "comment": null}, "languages": {"type": "text", "index": 17, "name": "languages", "comment": null}, "landing_page_url": {"type": "integer", "index": 18, "name": "landing_page_url", "comment": null}, "is_most_recent_record": {"type": "boolean", "index": 19, "name": "is_most_recent_record", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp": {"metadata": {"type": "VIEW", "schema": "tiktok_ads_source_integration_tests_1_stg_tiktok_ads", "name": "stg_tiktok_ads__ad_group_history_tmp", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"adgroup_id": {"type": "integer", "index": 1, "name": "adgroup_id", "comment": null}, "updated_at": {"type": "text", "index": 2, "name": "updated_at", "comment": null}, "advertiser_id": {"type": "integer", "index": 3, "name": "advertiser_id", "comment": null}, "campaign_id": {"type": "integer", "index": 4, "name": "campaign_id", "comment": null}, "create_time": {"type": "text", "index": 5, "name": "create_time", "comment": null}, "adgroup_name": {"type": "text", "index": 6, "name": "adgroup_name", "comment": null}, "placement_type": {"type": "text", "index": 7, "name": "placement_type", "comment": null}, "profile_image": {"type": "integer", "index": 8, "name": "profile_image", "comment": null}, "landing_page_url": {"type": "integer", "index": 9, "name": "landing_page_url", "comment": null}, "display_name": {"type": "integer", "index": 10, "name": "display_name", "comment": null}, "app_type": {"type": "integer", "index": 11, "name": "app_type", "comment": null}, "app_download_url": {"type": "integer", "index": 12, "name": "app_download_url", "comment": null}, "app_name": {"type": "integer", "index": 13, "name": "app_name", "comment": null}, "external_action": {"type": "text", "index": 14, "name": "external_action", "comment": null}, "deep_external_action": {"type": "integer", "index": 15, "name": "deep_external_action", "comment": null}, "creative_material_mode": {"type": "text", "index": 16, "name": "creative_material_mode", "comment": null}, "audience_type": {"type": "integer", "index": 17, "name": "audience_type", "comment": null}, "gender": {"type": "text", "index": 18, "name": "gender", "comment": null}, "android_osv": {"type": "integer", "index": 19, "name": "android_osv", "comment": null}, "ios_osv": {"type": "integer", "index": 20, "name": "ios_osv", "comment": null}, "budget_mode": {"type": "text", "index": 21, "name": "budget_mode", "comment": null}, "schedule_type": {"type": "text", "index": 22, "name": "schedule_type", "comment": null}, "dayparting": {"type": "integer", "index": 23, "name": "dayparting", "comment": null}, "optimize_goal": {"type": "text", "index": 24, "name": "optimize_goal", "comment": null}, "cpv_video_duration": {"type": "integer", "index": 25, "name": "cpv_video_duration", "comment": null}, "pacing": {"type": "text", "index": 26, "name": "pacing", "comment": null}, "billing_event": {"type": "text", "index": 27, "name": "billing_event", "comment": null}, "bid_type": {"type": "text", "index": 28, "name": "bid_type", "comment": null}, "deep_bid_type": {"type": "integer", "index": 29, "name": "deep_bid_type", "comment": null}, "impression_tracking_url": {"type": "integer", "index": 30, "name": "impression_tracking_url", "comment": null}, "click_tracking_url": {"type": "integer", "index": 31, "name": "click_tracking_url", "comment": null}, "status": {"type": "text", "index": 32, "name": "status", "comment": null}, "opt_status": {"type": "text", "index": 33, "name": "opt_status", "comment": null}, "statistic_type": {"type": "integer", "index": 34, "name": "statistic_type", "comment": null}, "video_download": {"type": "text", "index": 35, "name": "video_download", "comment": null}, "open_url": {"type": "integer", "index": 36, "name": "open_url", "comment": null}, "open_url_type": {"type": "integer", "index": 37, "name": "open_url_type", "comment": null}, "fallback_type": {"type": "integer", "index": 38, "name": "fallback_type", "comment": null}, "budget": {"type": "integer", "index": 39, "name": "budget", "comment": null}, "bid": {"type": "integer", "index": 40, "name": "bid", "comment": null}, "conversion_bid": {"type": "integer", "index": 41, "name": "conversion_bid", "comment": null}, "deep_cpabid": {"type": "integer", "index": 42, "name": "deep_cpabid", "comment": null}, "schedule_start_time": {"type": "text", "index": 43, "name": "schedule_start_time", "comment": null}, "schedule_end_time": {"type": "text", "index": 44, "name": "schedule_end_time", "comment": null}, "app_id": {"type": "integer", "index": 45, "name": "app_id", "comment": null}, "pixel_id": {"type": "integer", "index": 46, "name": "pixel_id", "comment": null}, "enable_inventory_filter": {"type": "boolean", "index": 47, "name": "enable_inventory_filter", "comment": null}, "is_hfss": {"type": "boolean", "index": 48, "name": "is_hfss", "comment": null}, "is_new_structure": {"type": "boolean", "index": 49, "name": "is_new_structure", "comment": null}, "category": {"type": "integer", "index": 50, "name": "category", "comment": null}, "is_comment_disable": {"type": "integer", "index": 51, "name": "is_comment_disable", "comment": null}, "skip_learning_phase": {"type": "integer", "index": 52, "name": "skip_learning_phase", "comment": null}, "frequency": {"type": "integer", "index": 53, "name": "frequency", "comment": null}, "frequency_schedule": {"type": "integer", "index": 54, "name": "frequency_schedule", "comment": null}, "action_days": {"type": "integer", "index": 55, "name": "action_days", "comment": null}, "audience": {"type": "text", "index": 56, "name": "audience", "comment": null}, "excluded_audience": {"type": "text", "index": 57, "name": "excluded_audience", "comment": null}, "location": {"type": "text", "index": 58, "name": "location", "comment": null}, "interest_category_v_2": {"type": "text", "index": 59, "name": "interest_category_v_2", "comment": null}, "pangle_block_app_list_id": {"type": "text", "index": 60, "name": "pangle_block_app_list_id", "comment": null}, "action_categories": {"type": "text", "index": 61, "name": "action_categories", "comment": null}, "placement": {"type": "text", "index": 62, "name": "placement", "comment": null}, "keywords": {"type": "integer", "index": 63, "name": "keywords", "comment": null}, "age": {"type": "text", "index": 64, "name": "age", "comment": null}, "languages": {"type": "text", "index": 65, "name": "languages", "comment": null}, "operation_system": {"type": "text", "index": 66, "name": "operation_system", "comment": null}, "connection_type": {"type": "text", "index": 67, "name": "connection_type", "comment": null}, "carriers": {"type": "text", "index": 68, "name": "carriers", "comment": null}, "video_actions": {"type": "text", "index": 69, "name": "video_actions", "comment": null}, "package": {"type": "integer", "index": 70, "name": "package", "comment": null}, "_fivetran_synced": {"type": "text", "index": 71, "name": "_fivetran_synced", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly": {"metadata": {"type": "BASE TABLE", "schema": "tiktok_ads_source_integration_tests_1_stg_tiktok_ads", "name": "stg_tiktok_ads__ad_group_report_hourly", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"ad_group_id": {"type": "integer", "index": 1, "name": "ad_group_id", "comment": null}, "stat_time_hour": {"type": "timestamp without time zone", "index": 2, "name": "stat_time_hour", "comment": null}, "cpc": {"type": "double precision", "index": 3, "name": "cpc", "comment": null}, "cpm": {"type": "double precision", "index": 4, "name": "cpm", "comment": null}, "ctr": {"type": "double precision", "index": 5, "name": "ctr", "comment": null}, "impressions": {"type": "integer", "index": 6, "name": "impressions", "comment": null}, "clicks": {"type": "integer", "index": 7, "name": "clicks", "comment": null}, "spend": {"type": "double precision", "index": 8, "name": "spend", "comment": null}, "reach": {"type": "integer", "index": 9, "name": "reach", "comment": null}, "conversion": {"type": "integer", "index": 10, "name": "conversion", "comment": null}, "cost_per_conversion": {"type": "double precision", "index": 11, "name": "cost_per_conversion", "comment": null}, "conversion_rate": {"type": "integer", "index": 12, "name": "conversion_rate", "comment": null}, "likes": {"type": "integer", "index": 13, "name": "likes", "comment": null}, "comments": {"type": "integer", "index": 14, "name": "comments", "comment": null}, "shares": {"type": "integer", "index": 15, "name": "shares", "comment": null}, "profile_visits": {"type": "integer", "index": 16, "name": "profile_visits", "comment": null}, "follows": {"type": "integer", "index": 17, "name": "follows", "comment": null}, "video_play_actions": {"type": "integer", "index": 18, "name": "video_play_actions", "comment": null}, "video_watched_2_s": {"type": "integer", "index": 19, "name": "video_watched_2_s", "comment": null}, "video_watched_6_s": {"type": "integer", "index": 20, "name": "video_watched_6_s", "comment": null}, "video_views_p_25": {"type": "integer", "index": 21, "name": "video_views_p_25", "comment": null}, "video_views_p_50": {"type": "integer", "index": 22, "name": "video_views_p_50", "comment": null}, "video_views_p_75": {"type": "integer", "index": 23, "name": "video_views_p_75", "comment": null}, "average_video_play": {"type": "double precision", "index": 24, "name": "average_video_play", "comment": null}, "average_video_play_per_user": {"type": "double precision", "index": 25, "name": "average_video_play_per_user", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp": {"metadata": {"type": "VIEW", "schema": "tiktok_ads_source_integration_tests_1_stg_tiktok_ads", "name": "stg_tiktok_ads__ad_group_report_hourly_tmp", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"adgroup_id": {"type": "integer", "index": 1, "name": "adgroup_id", "comment": null}, "stat_time_hour": {"type": "timestamp without time zone", "index": 2, "name": "stat_time_hour", "comment": null}, "cost_per_conversion": {"type": "double precision", "index": 3, "name": "cost_per_conversion", "comment": null}, "real_time_conversion": {"type": "integer", "index": 4, "name": "real_time_conversion", "comment": null}, "cpc": {"type": "double precision", "index": 5, "name": "cpc", "comment": null}, "video_play_actions": {"type": "integer", "index": 6, "name": "video_play_actions", "comment": null}, "conversion_rate": {"type": "integer", "index": 7, "name": "conversion_rate", "comment": null}, "video_views_p_75": {"type": "integer", "index": 8, "name": "video_views_p_75", "comment": null}, "result": {"type": "integer", "index": 9, "name": "result", "comment": null}, "video_views_p_50": {"type": "integer", "index": 10, "name": "video_views_p_50", "comment": null}, "impressions": {"type": "integer", "index": 11, "name": "impressions", "comment": null}, "comments": {"type": "integer", "index": 12, "name": "comments", "comment": null}, "real_time_cost_per_result": {"type": "double precision", "index": 13, "name": "real_time_cost_per_result", "comment": null}, "conversion": {"type": "integer", "index": 14, "name": "conversion", "comment": null}, "real_time_result": {"type": "integer", "index": 15, "name": "real_time_result", "comment": null}, "video_views_p_100": {"type": "integer", "index": 16, "name": "video_views_p_100", "comment": null}, "shares": {"type": "integer", "index": 17, "name": "shares", "comment": null}, "real_time_conversion_rate": {"type": "double precision", "index": 18, "name": "real_time_conversion_rate", "comment": null}, "cost_per_secondary_goal_result": {"type": "text", "index": 19, "name": "cost_per_secondary_goal_result", "comment": null}, "secondary_goal_result_rate": {"type": "text", "index": 20, "name": "secondary_goal_result_rate", "comment": null}, "clicks": {"type": "integer", "index": 21, "name": "clicks", "comment": null}, "cost_per_1000_reached": {"type": "double precision", "index": 22, "name": "cost_per_1000_reached", "comment": null}, "video_views_p_25": {"type": "integer", "index": 23, "name": "video_views_p_25", "comment": null}, "reach": {"type": "integer", "index": 24, "name": "reach", "comment": null}, "real_time_cost_per_conversion": {"type": "double precision", "index": 25, "name": "real_time_cost_per_conversion", "comment": null}, "profile_visits_rate": {"type": "integer", "index": 26, "name": "profile_visits_rate", "comment": null}, "average_video_play": {"type": "double precision", "index": 27, "name": "average_video_play", "comment": null}, "profile_visits": {"type": "integer", "index": 28, "name": "profile_visits", "comment": null}, "cpm": {"type": "double precision", "index": 29, "name": "cpm", "comment": null}, "ctr": {"type": "double precision", "index": 30, "name": "ctr", "comment": null}, "video_watched_2_s": {"type": "integer", "index": 31, "name": "video_watched_2_s", "comment": null}, "follows": {"type": "integer", "index": 32, "name": "follows", "comment": null}, "result_rate": {"type": "double precision", "index": 33, "name": "result_rate", "comment": null}, "video_watched_6_s": {"type": "integer", "index": 34, "name": "video_watched_6_s", "comment": null}, "secondary_goal_result": {"type": "text", "index": 35, "name": "secondary_goal_result", "comment": null}, "cost_per_result": {"type": "double precision", "index": 36, "name": "cost_per_result", "comment": null}, "average_video_play_per_user": {"type": "double precision", "index": 37, "name": "average_video_play_per_user", "comment": null}, "real_time_result_rate": {"type": "double precision", "index": 38, "name": "real_time_result_rate", "comment": null}, "spend": {"type": "double precision", "index": 39, "name": "spend", "comment": null}, "likes": {"type": "integer", "index": 40, "name": "likes", "comment": null}, "_fivetran_synced": {"type": "text", "index": 41, "name": "_fivetran_synced", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_history": {"metadata": {"type": "BASE TABLE", "schema": "tiktok_ads_source_integration_tests_1_stg_tiktok_ads", "name": "stg_tiktok_ads__ad_history", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"ad_id": {"type": "integer", "index": 1, "name": "ad_id", "comment": null}, "updated_at": {"type": "timestamp without time zone", "index": 2, "name": "updated_at", "comment": null}, "ad_group_id": {"type": "integer", "index": 3, "name": "ad_group_id", "comment": null}, "advertiser_id": {"type": "integer", "index": 4, "name": "advertiser_id", "comment": null}, "campaign_id": {"type": "integer", "index": 5, "name": "campaign_id", "comment": null}, "ad_name": {"type": "text", "index": 6, "name": "ad_name", "comment": null}, "call_to_action": {"type": "text", "index": 7, "name": "call_to_action", "comment": null}, "click_tracking_url": {"type": "integer", "index": 8, "name": "click_tracking_url", "comment": null}, "impression_tracking_url": {"type": "integer", "index": 9, "name": "impression_tracking_url", "comment": null}, "base_url": {"type": "text", "index": 10, "name": "base_url", "comment": null}, "url_host": {"type": "character varying", "index": 11, "name": "url_host", "comment": null}, "url_path": {"type": "text", "index": 12, "name": "url_path", "comment": null}, "utm_source": {"type": "text", "index": 13, "name": "utm_source", "comment": null}, "utm_medium": {"type": "text", "index": 14, "name": "utm_medium", "comment": null}, "utm_campaign": {"type": "text", "index": 15, "name": "utm_campaign", "comment": null}, "utm_content": {"type": "text", "index": 16, "name": "utm_content", "comment": null}, "utm_term": {"type": "text", "index": 17, "name": "utm_term", "comment": null}, "landing_page_url": {"type": "text", "index": 18, "name": "landing_page_url", "comment": null}, "is_most_recent_record": {"type": "boolean", "index": 19, "name": "is_most_recent_record", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp": {"metadata": {"type": "VIEW", "schema": "tiktok_ads_source_integration_tests_1_stg_tiktok_ads", "name": "stg_tiktok_ads__ad_history_tmp", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"ad_id": {"type": "integer", "index": 1, "name": "ad_id", "comment": null}, "updated_at": {"type": "text", "index": 2, "name": "updated_at", "comment": null}, "advertiser_id": {"type": "integer", "index": 3, "name": "advertiser_id", "comment": null}, "adgroup_id": {"type": "integer", "index": 4, "name": "adgroup_id", "comment": null}, "campaign_id": {"type": "integer", "index": 5, "name": "campaign_id", "comment": null}, "create_time": {"type": "text", "index": 6, "name": "create_time", "comment": null}, "ad_name": {"type": "text", "index": 7, "name": "ad_name", "comment": null}, "call_to_action": {"type": "text", "index": 8, "name": "call_to_action", "comment": null}, "status": {"type": "text", "index": 9, "name": "status", "comment": null}, "opt_status": {"type": "text", "index": 10, "name": "opt_status", "comment": null}, "ad_text": {"type": "text", "index": 11, "name": "ad_text", "comment": null}, "video_id": {"type": "text", "index": 12, "name": "video_id", "comment": null}, "app_name": {"type": "integer", "index": 13, "name": "app_name", "comment": null}, "open_url": {"type": "integer", "index": 14, "name": "open_url", "comment": null}, "landing_page_url": {"type": "text", "index": 15, "name": "landing_page_url", "comment": null}, "display_name": {"type": "text", "index": 16, "name": "display_name", "comment": null}, "profile_image": {"type": "integer", "index": 17, "name": "profile_image", "comment": null}, "impression_tracking_url": {"type": "integer", "index": 18, "name": "impression_tracking_url", "comment": null}, "click_tracking_url": {"type": "integer", "index": 19, "name": "click_tracking_url", "comment": null}, "playable_url": {"type": "integer", "index": 20, "name": "playable_url", "comment": null}, "is_aco": {"type": "boolean", "index": 21, "name": "is_aco", "comment": null}, "is_creative_authorized": {"type": "boolean", "index": 22, "name": "is_creative_authorized", "comment": null}, "is_new_structure": {"type": "boolean", "index": 23, "name": "is_new_structure", "comment": null}, "image_ids": {"type": "text", "index": 24, "name": "image_ids", "comment": null}, "_fivetran_synced": {"type": "text", "index": 25, "name": "_fivetran_synced", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly": {"metadata": {"type": "BASE TABLE", "schema": "tiktok_ads_source_integration_tests_1_stg_tiktok_ads", "name": "stg_tiktok_ads__ad_report_hourly", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"ad_id": {"type": "integer", "index": 1, "name": "ad_id", "comment": null}, "stat_time_hour": {"type": "timestamp without time zone", "index": 2, "name": "stat_time_hour", "comment": null}, "cpc": {"type": "double precision", "index": 3, "name": "cpc", "comment": null}, "cpm": {"type": "double precision", "index": 4, "name": "cpm", "comment": null}, "ctr": {"type": "double precision", "index": 5, "name": "ctr", "comment": null}, "impressions": {"type": "integer", "index": 6, "name": "impressions", "comment": null}, "clicks": {"type": "integer", "index": 7, "name": "clicks", "comment": null}, "spend": {"type": "double precision", "index": 8, "name": "spend", "comment": null}, "reach": {"type": "integer", "index": 9, "name": "reach", "comment": null}, "conversion": {"type": "integer", "index": 10, "name": "conversion", "comment": null}, "cost_per_conversion": {"type": "double precision", "index": 11, "name": "cost_per_conversion", "comment": null}, "conversion_rate": {"type": "integer", "index": 12, "name": "conversion_rate", "comment": null}, "likes": {"type": "integer", "index": 13, "name": "likes", "comment": null}, "comments": {"type": "integer", "index": 14, "name": "comments", "comment": null}, "shares": {"type": "integer", "index": 15, "name": "shares", "comment": null}, "profile_visits": {"type": "integer", "index": 16, "name": "profile_visits", "comment": null}, "follows": {"type": "integer", "index": 17, "name": "follows", "comment": null}, "video_play_actions": {"type": "integer", "index": 18, "name": "video_play_actions", "comment": null}, "video_watched_2_s": {"type": "integer", "index": 19, "name": "video_watched_2_s", "comment": null}, "video_watched_6_s": {"type": "integer", "index": 20, "name": "video_watched_6_s", "comment": null}, "video_views_p_25": {"type": "integer", "index": 21, "name": "video_views_p_25", "comment": null}, "video_views_p_50": {"type": "integer", "index": 22, "name": "video_views_p_50", "comment": null}, "video_views_p_75": {"type": "integer", "index": 23, "name": "video_views_p_75", "comment": null}, "average_video_play": {"type": "double precision", "index": 24, "name": "average_video_play", "comment": null}, "average_video_play_per_user": {"type": "integer", "index": 25, "name": "average_video_play_per_user", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp": {"metadata": {"type": "VIEW", "schema": "tiktok_ads_source_integration_tests_1_stg_tiktok_ads", "name": "stg_tiktok_ads__ad_report_hourly_tmp", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"ad_id": {"type": "integer", "index": 1, "name": "ad_id", "comment": null}, "stat_time_hour": {"type": "timestamp without time zone", "index": 2, "name": "stat_time_hour", "comment": null}, "cost_per_conversion": {"type": "double precision", "index": 3, "name": "cost_per_conversion", "comment": null}, "real_time_conversion": {"type": "integer", "index": 4, "name": "real_time_conversion", "comment": null}, "cpc": {"type": "double precision", "index": 5, "name": "cpc", "comment": null}, "video_play_actions": {"type": "integer", "index": 6, "name": "video_play_actions", "comment": null}, "conversion_rate": {"type": "integer", "index": 7, "name": "conversion_rate", "comment": null}, "video_views_p_75": {"type": "integer", "index": 8, "name": "video_views_p_75", "comment": null}, "result": {"type": "integer", "index": 9, "name": "result", "comment": null}, "video_views_p_50": {"type": "integer", "index": 10, "name": "video_views_p_50", "comment": null}, "impressions": {"type": "integer", "index": 11, "name": "impressions", "comment": null}, "comments": {"type": "integer", "index": 12, "name": "comments", "comment": null}, "real_time_cost_per_result": {"type": "double precision", "index": 13, "name": "real_time_cost_per_result", "comment": null}, "conversion": {"type": "integer", "index": 14, "name": "conversion", "comment": null}, "real_time_result": {"type": "integer", "index": 15, "name": "real_time_result", "comment": null}, "video_views_p_100": {"type": "integer", "index": 16, "name": "video_views_p_100", "comment": null}, "shares": {"type": "integer", "index": 17, "name": "shares", "comment": null}, "real_time_conversion_rate": {"type": "integer", "index": 18, "name": "real_time_conversion_rate", "comment": null}, "cost_per_secondary_goal_result": {"type": "text", "index": 19, "name": "cost_per_secondary_goal_result", "comment": null}, "secondary_goal_result_rate": {"type": "text", "index": 20, "name": "secondary_goal_result_rate", "comment": null}, "clicks": {"type": "integer", "index": 21, "name": "clicks", "comment": null}, "cost_per_1000_reached": {"type": "integer", "index": 22, "name": "cost_per_1000_reached", "comment": null}, "video_views_p_25": {"type": "integer", "index": 23, "name": "video_views_p_25", "comment": null}, "reach": {"type": "integer", "index": 24, "name": "reach", "comment": null}, "real_time_cost_per_conversion": {"type": "double precision", "index": 25, "name": "real_time_cost_per_conversion", "comment": null}, "profile_visits_rate": {"type": "integer", "index": 26, "name": "profile_visits_rate", "comment": null}, "average_video_play": {"type": "double precision", "index": 27, "name": "average_video_play", "comment": null}, "profile_visits": {"type": "integer", "index": 28, "name": "profile_visits", "comment": null}, "cpm": {"type": "double precision", "index": 29, "name": "cpm", "comment": null}, "ctr": {"type": "double precision", "index": 30, "name": "ctr", "comment": null}, "video_watched_2_s": {"type": "integer", "index": 31, "name": "video_watched_2_s", "comment": null}, "follows": {"type": "integer", "index": 32, "name": "follows", "comment": null}, "result_rate": {"type": "integer", "index": 33, "name": "result_rate", "comment": null}, "video_watched_6_s": {"type": "integer", "index": 34, "name": "video_watched_6_s", "comment": null}, "secondary_goal_result": {"type": "text", "index": 35, "name": "secondary_goal_result", "comment": null}, "cost_per_result": {"type": "double precision", "index": 36, "name": "cost_per_result", "comment": null}, "average_video_play_per_user": {"type": "integer", "index": 37, "name": "average_video_play_per_user", "comment": null}, "real_time_result_rate": {"type": "integer", "index": 38, "name": "real_time_result_rate", "comment": null}, "spend": {"type": "double precision", "index": 39, "name": "spend", "comment": null}, "likes": {"type": "integer", "index": 40, "name": "likes", "comment": null}, "_fivetran_synced": {"type": "text", "index": 41, "name": "_fivetran_synced", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp"}, "model.tiktok_ads_source.stg_tiktok_ads__advertiser": {"metadata": {"type": "BASE TABLE", "schema": "tiktok_ads_source_integration_tests_1_stg_tiktok_ads", "name": "stg_tiktok_ads__advertiser", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"advertiser_id": {"type": "integer", "index": 1, "name": "advertiser_id", "comment": null}, "address": {"type": "text", "index": 2, "name": "address", "comment": null}, "balance": {"type": "double precision", "index": 3, "name": "balance", "comment": null}, "company": {"type": "text", "index": 4, "name": "company", "comment": null}, "contacter": {"type": "integer", "index": 5, "name": "contacter", "comment": null}, "country": {"type": "text", "index": 6, "name": "country", "comment": null}, "currency": {"type": "text", "index": 7, "name": "currency", "comment": null}, "description": {"type": "text", "index": 8, "name": "description", "comment": null}, "email": {"type": "text", "index": 9, "name": "email", "comment": null}, "industry": {"type": "integer", "index": 10, "name": "industry", "comment": null}, "language": {"type": "text", "index": 11, "name": "language", "comment": null}, "advertiser_name": {"type": "text", "index": 12, "name": "advertiser_name", "comment": null}, "phone_number": {"type": "text", "index": 13, "name": "phone_number", "comment": null}, "telephone": {"type": "integer", "index": 14, "name": "telephone", "comment": null}, "timezone": {"type": "text", "index": 15, "name": "timezone", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser"}, "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp": {"metadata": {"type": "VIEW", "schema": "tiktok_ads_source_integration_tests_1_stg_tiktok_ads", "name": "stg_tiktok_ads__advertiser_tmp", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"id": {"type": "integer", "index": 1, "name": "id", "comment": null}, "name": {"type": "text", "index": 2, "name": "name", "comment": null}, "address": {"type": "text", "index": 3, "name": "address", "comment": null}, "company": {"type": "text", "index": 4, "name": "company", "comment": null}, "contacter": {"type": "integer", "index": 5, "name": "contacter", "comment": null}, "country": {"type": "text", "index": 6, "name": "country", "comment": null}, "currency": {"type": "text", "index": 7, "name": "currency", "comment": null}, "description": {"type": "text", "index": 8, "name": "description", "comment": null}, "email": {"type": "text", "index": 9, "name": "email", "comment": null}, "industry": {"type": "integer", "index": 10, "name": "industry", "comment": null}, "license_no": {"type": "integer", "index": 11, "name": "license_no", "comment": null}, "license_url": {"type": "integer", "index": 12, "name": "license_url", "comment": null}, "promotion_area": {"type": "integer", "index": 13, "name": "promotion_area", "comment": null}, "reason": {"type": "integer", "index": 14, "name": "reason", "comment": null}, "role": {"type": "text", "index": 15, "name": "role", "comment": null}, "status": {"type": "text", "index": 16, "name": "status", "comment": null}, "telephone": {"type": "integer", "index": 17, "name": "telephone", "comment": null}, "timezone": {"type": "text", "index": 18, "name": "timezone", "comment": null}, "balance": {"type": "double precision", "index": 19, "name": "balance", "comment": null}, "create_time": {"type": "text", "index": 20, "name": "create_time", "comment": null}, "language": {"type": "text", "index": 21, "name": "language", "comment": null}, "phone_number": {"type": "text", "index": 22, "name": "phone_number", "comment": null}, "_fivetran_synced": {"type": "text", "index": 23, "name": "_fivetran_synced", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp"}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_history": {"metadata": {"type": "BASE TABLE", "schema": "tiktok_ads_source_integration_tests_1_stg_tiktok_ads", "name": "stg_tiktok_ads__campaign_history", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"campaign_id": {"type": "integer", "index": 1, "name": "campaign_id", "comment": null}, "updated_at": {"type": "timestamp without time zone", "index": 2, "name": "updated_at", "comment": null}, "advertiser_id": {"type": "integer", "index": 3, "name": "advertiser_id", "comment": null}, "campaign_name": {"type": "text", "index": 4, "name": "campaign_name", "comment": null}, "campaign_type": {"type": "text", "index": 5, "name": "campaign_type", "comment": null}, "split_test_variable": {"type": "integer", "index": 6, "name": "split_test_variable", "comment": null}, "is_most_recent_record": {"type": "boolean", "index": 7, "name": "is_most_recent_record", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history"}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp": {"metadata": {"type": "VIEW", "schema": "tiktok_ads_source_integration_tests_1_stg_tiktok_ads", "name": "stg_tiktok_ads__campaign_history_tmp", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"campaign_id": {"type": "integer", "index": 1, "name": "campaign_id", "comment": null}, "updated_at": {"type": "text", "index": 2, "name": "updated_at", "comment": null}, "advertiser_id": {"type": "integer", "index": 3, "name": "advertiser_id", "comment": null}, "campaign_name": {"type": "text", "index": 4, "name": "campaign_name", "comment": null}, "campaign_type": {"type": "text", "index": 5, "name": "campaign_type", "comment": null}, "budget": {"type": "integer", "index": 6, "name": "budget", "comment": null}, "budget_mode": {"type": "text", "index": 7, "name": "budget_mode", "comment": null}, "opt_status": {"type": "text", "index": 8, "name": "opt_status", "comment": null}, "objective_type": {"type": "text", "index": 9, "name": "objective_type", "comment": null}, "is_new_structure": {"type": "boolean", "index": 10, "name": "is_new_structure", "comment": null}, "split_test_variable": {"type": "integer", "index": 11, "name": "split_test_variable", "comment": null}, "create_time": {"type": "text", "index": 12, "name": "create_time", "comment": null}, "_fivetran_synced": {"type": "text", "index": 13, "name": "_fivetran_synced", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp"}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly": {"metadata": {"type": "BASE TABLE", "schema": "tiktok_ads_source_integration_tests_1_stg_tiktok_ads", "name": "stg_tiktok_ads__campaign_report_hourly", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"campaign_id": {"type": "integer", "index": 1, "name": "campaign_id", "comment": null}, "stat_time_hour": {"type": "timestamp without time zone", "index": 2, "name": "stat_time_hour", "comment": null}, "cpc": {"type": "double precision", "index": 3, "name": "cpc", "comment": null}, "cpm": {"type": "double precision", "index": 4, "name": "cpm", "comment": null}, "ctr": {"type": "double precision", "index": 5, "name": "ctr", "comment": null}, "impressions": {"type": "integer", "index": 6, "name": "impressions", "comment": null}, "clicks": {"type": "integer", "index": 7, "name": "clicks", "comment": null}, "spend": {"type": "double precision", "index": 8, "name": "spend", "comment": null}, "reach": {"type": "integer", "index": 9, "name": "reach", "comment": null}, "conversion": {"type": "integer", "index": 10, "name": "conversion", "comment": null}, "cost_per_conversion": {"type": "double precision", "index": 11, "name": "cost_per_conversion", "comment": null}, "conversion_rate": {"type": "integer", "index": 12, "name": "conversion_rate", "comment": null}, "likes": {"type": "integer", "index": 13, "name": "likes", "comment": null}, "comments": {"type": "integer", "index": 14, "name": "comments", "comment": null}, "shares": {"type": "integer", "index": 15, "name": "shares", "comment": null}, "profile_visits": {"type": "integer", "index": 16, "name": "profile_visits", "comment": null}, "follows": {"type": "integer", "index": 17, "name": "follows", "comment": null}, "video_play_actions": {"type": "integer", "index": 18, "name": "video_play_actions", "comment": null}, "video_watched_2_s": {"type": "integer", "index": 19, "name": "video_watched_2_s", "comment": null}, "video_watched_6_s": {"type": "integer", "index": 20, "name": "video_watched_6_s", "comment": null}, "video_views_p_25": {"type": "integer", "index": 21, "name": "video_views_p_25", "comment": null}, "video_views_p_50": {"type": "integer", "index": 22, "name": "video_views_p_50", "comment": null}, "video_views_p_75": {"type": "integer", "index": 23, "name": "video_views_p_75", "comment": null}, "average_video_play": {"type": "double precision", "index": 24, "name": "average_video_play", "comment": null}, "average_video_play_per_user": {"type": "double precision", "index": 25, "name": "average_video_play_per_user", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp": {"metadata": {"type": "VIEW", "schema": "tiktok_ads_source_integration_tests_1_stg_tiktok_ads", "name": "stg_tiktok_ads__campaign_report_hourly_tmp", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"campaign_id": {"type": "integer", "index": 1, "name": "campaign_id", "comment": null}, "stat_time_hour": {"type": "timestamp without time zone", "index": 2, "name": "stat_time_hour", "comment": null}, "cost_per_conversion": {"type": "double precision", "index": 3, "name": "cost_per_conversion", "comment": null}, "real_time_conversion": {"type": "integer", "index": 4, "name": "real_time_conversion", "comment": null}, "cpc": {"type": "double precision", "index": 5, "name": "cpc", "comment": null}, "video_play_actions": {"type": "integer", "index": 6, "name": "video_play_actions", "comment": null}, "conversion_rate": {"type": "integer", "index": 7, "name": "conversion_rate", "comment": null}, "video_views_p_75": {"type": "integer", "index": 8, "name": "video_views_p_75", "comment": null}, "result": {"type": "integer", "index": 9, "name": "result", "comment": null}, "video_views_p_50": {"type": "integer", "index": 10, "name": "video_views_p_50", "comment": null}, "impressions": {"type": "integer", "index": 11, "name": "impressions", "comment": null}, "comments": {"type": "integer", "index": 12, "name": "comments", "comment": null}, "real_time_cost_per_result": {"type": "double precision", "index": 13, "name": "real_time_cost_per_result", "comment": null}, "conversion": {"type": "integer", "index": 14, "name": "conversion", "comment": null}, "real_time_result": {"type": "integer", "index": 15, "name": "real_time_result", "comment": null}, "video_views_p_100": {"type": "integer", "index": 16, "name": "video_views_p_100", "comment": null}, "shares": {"type": "integer", "index": 17, "name": "shares", "comment": null}, "real_time_conversion_rate": {"type": "double precision", "index": 18, "name": "real_time_conversion_rate", "comment": null}, "cost_per_secondary_goal_result": {"type": "text", "index": 19, "name": "cost_per_secondary_goal_result", "comment": null}, "secondary_goal_result_rate": {"type": "text", "index": 20, "name": "secondary_goal_result_rate", "comment": null}, "clicks": {"type": "integer", "index": 21, "name": "clicks", "comment": null}, "cost_per_1000_reached": {"type": "double precision", "index": 22, "name": "cost_per_1000_reached", "comment": null}, "video_views_p_25": {"type": "integer", "index": 23, "name": "video_views_p_25", "comment": null}, "reach": {"type": "integer", "index": 24, "name": "reach", "comment": null}, "real_time_cost_per_conversion": {"type": "double precision", "index": 25, "name": "real_time_cost_per_conversion", "comment": null}, "profile_visits_rate": {"type": "integer", "index": 26, "name": "profile_visits_rate", "comment": null}, "average_video_play": {"type": "double precision", "index": 27, "name": "average_video_play", "comment": null}, "profile_visits": {"type": "integer", "index": 28, "name": "profile_visits", "comment": null}, "cpm": {"type": "double precision", "index": 29, "name": "cpm", "comment": null}, "ctr": {"type": "double precision", "index": 30, "name": "ctr", "comment": null}, "video_watched_2_s": {"type": "integer", "index": 31, "name": "video_watched_2_s", "comment": null}, "follows": {"type": "integer", "index": 32, "name": "follows", "comment": null}, "result_rate": {"type": "double precision", "index": 33, "name": "result_rate", "comment": null}, "video_watched_6_s": {"type": "integer", "index": 34, "name": "video_watched_6_s", "comment": null}, "secondary_goal_result": {"type": "text", "index": 35, "name": "secondary_goal_result", "comment": null}, "cost_per_result": {"type": "double precision", "index": 36, "name": "cost_per_result", "comment": null}, "average_video_play_per_user": {"type": "double precision", "index": 37, "name": "average_video_play_per_user", "comment": null}, "real_time_result_rate": {"type": "double precision", "index": 38, "name": "real_time_result_rate", "comment": null}, "spend": {"type": "double precision", "index": 39, "name": "spend", "comment": null}, "likes": {"type": "integer", "index": 40, "name": "likes", "comment": null}, "_fivetran_synced": {"type": "text", "index": 41, "name": "_fivetran_synced", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp"}}, "sources": {"source.tiktok_ads_source.tiktok_ads.ad_history": {"metadata": {"type": "BASE TABLE", "schema": "tiktok_ads_source_integration_tests_1", "name": "tiktok_ad_history_data", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"ad_id": {"type": "integer", "index": 1, "name": "ad_id", "comment": null}, "updated_at": {"type": "text", "index": 2, "name": "updated_at", "comment": null}, "advertiser_id": {"type": "integer", "index": 3, "name": "advertiser_id", "comment": null}, "adgroup_id": {"type": "integer", "index": 4, "name": "adgroup_id", "comment": null}, "campaign_id": {"type": "integer", "index": 5, "name": "campaign_id", "comment": null}, "create_time": {"type": "text", "index": 6, "name": "create_time", "comment": null}, "ad_name": {"type": "text", "index": 7, "name": "ad_name", "comment": null}, "call_to_action": {"type": "text", "index": 8, "name": "call_to_action", "comment": null}, "status": {"type": "text", "index": 9, "name": "status", "comment": null}, "opt_status": {"type": "text", "index": 10, "name": "opt_status", "comment": null}, "ad_text": {"type": "text", "index": 11, "name": "ad_text", "comment": null}, "video_id": {"type": "text", "index": 12, "name": "video_id", "comment": null}, "app_name": {"type": "integer", "index": 13, "name": "app_name", "comment": null}, "open_url": {"type": "integer", "index": 14, "name": "open_url", "comment": null}, "landing_page_url": {"type": "text", "index": 15, "name": "landing_page_url", "comment": null}, "display_name": {"type": "text", "index": 16, "name": "display_name", "comment": null}, "profile_image": {"type": "integer", "index": 17, "name": "profile_image", "comment": null}, "impression_tracking_url": {"type": "integer", "index": 18, "name": "impression_tracking_url", "comment": null}, "click_tracking_url": {"type": "integer", "index": 19, "name": "click_tracking_url", "comment": null}, "playable_url": {"type": "integer", "index": 20, "name": "playable_url", "comment": null}, "is_aco": {"type": "boolean", "index": 21, "name": "is_aco", "comment": null}, "is_creative_authorized": {"type": "boolean", "index": 22, "name": "is_creative_authorized", "comment": null}, "is_new_structure": {"type": "boolean", "index": 23, "name": "is_new_structure", "comment": null}, "image_ids": {"type": "text", "index": 24, "name": "image_ids", "comment": null}, "_fivetran_synced": {"type": "text", "index": 25, "name": "_fivetran_synced", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.tiktok_ads_source.tiktok_ads.ad_history"}, "source.tiktok_ads_source.tiktok_ads.ad_report_hourly": {"metadata": {"type": "BASE TABLE", "schema": "tiktok_ads_source_integration_tests_1", "name": "tiktok_ad_report_hourly_data", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"ad_id": {"type": "integer", "index": 1, "name": "ad_id", "comment": null}, "stat_time_hour": {"type": "timestamp without time zone", "index": 2, "name": "stat_time_hour", "comment": null}, "cost_per_conversion": {"type": "double precision", "index": 3, "name": "cost_per_conversion", "comment": null}, "real_time_conversion": {"type": "integer", "index": 4, "name": "real_time_conversion", "comment": null}, "cpc": {"type": "double precision", "index": 5, "name": "cpc", "comment": null}, "video_play_actions": {"type": "integer", "index": 6, "name": "video_play_actions", "comment": null}, "conversion_rate": {"type": "integer", "index": 7, "name": "conversion_rate", "comment": null}, "video_views_p_75": {"type": "integer", "index": 8, "name": "video_views_p_75", "comment": null}, "result": {"type": "integer", "index": 9, "name": "result", "comment": null}, "video_views_p_50": {"type": "integer", "index": 10, "name": "video_views_p_50", "comment": null}, "impressions": {"type": "integer", "index": 11, "name": "impressions", "comment": null}, "comments": {"type": "integer", "index": 12, "name": "comments", "comment": null}, "real_time_cost_per_result": {"type": "double precision", "index": 13, "name": "real_time_cost_per_result", "comment": null}, "conversion": {"type": "integer", "index": 14, "name": "conversion", "comment": null}, "real_time_result": {"type": "integer", "index": 15, "name": "real_time_result", "comment": null}, "video_views_p_100": {"type": "integer", "index": 16, "name": "video_views_p_100", "comment": null}, "shares": {"type": "integer", "index": 17, "name": "shares", "comment": null}, "real_time_conversion_rate": {"type": "integer", "index": 18, "name": "real_time_conversion_rate", "comment": null}, "cost_per_secondary_goal_result": {"type": "text", "index": 19, "name": "cost_per_secondary_goal_result", "comment": null}, "secondary_goal_result_rate": {"type": "text", "index": 20, "name": "secondary_goal_result_rate", "comment": null}, "clicks": {"type": "integer", "index": 21, "name": "clicks", "comment": null}, "cost_per_1000_reached": {"type": "integer", "index": 22, "name": "cost_per_1000_reached", "comment": null}, "video_views_p_25": {"type": "integer", "index": 23, "name": "video_views_p_25", "comment": null}, "reach": {"type": "integer", "index": 24, "name": "reach", "comment": null}, "real_time_cost_per_conversion": {"type": "double precision", "index": 25, "name": "real_time_cost_per_conversion", "comment": null}, "profile_visits_rate": {"type": "integer", "index": 26, "name": "profile_visits_rate", "comment": null}, "average_video_play": {"type": "double precision", "index": 27, "name": "average_video_play", "comment": null}, "profile_visits": {"type": "integer", "index": 28, "name": "profile_visits", "comment": null}, "cpm": {"type": "double precision", "index": 29, "name": "cpm", "comment": null}, "ctr": {"type": "double precision", "index": 30, "name": "ctr", "comment": null}, "video_watched_2_s": {"type": "integer", "index": 31, "name": "video_watched_2_s", "comment": null}, "follows": {"type": "integer", "index": 32, "name": "follows", "comment": null}, "result_rate": {"type": "integer", "index": 33, "name": "result_rate", "comment": null}, "video_watched_6_s": {"type": "integer", "index": 34, "name": "video_watched_6_s", "comment": null}, "secondary_goal_result": {"type": "text", "index": 35, "name": "secondary_goal_result", "comment": null}, "cost_per_result": {"type": "double precision", "index": 36, "name": "cost_per_result", "comment": null}, "average_video_play_per_user": {"type": "integer", "index": 37, "name": "average_video_play_per_user", "comment": null}, "real_time_result_rate": {"type": "integer", "index": 38, "name": "real_time_result_rate", "comment": null}, "spend": {"type": "double precision", "index": 39, "name": "spend", "comment": null}, "likes": {"type": "integer", "index": 40, "name": "likes", "comment": null}, "_fivetran_synced": {"type": "text", "index": 41, "name": "_fivetran_synced", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.tiktok_ads_source.tiktok_ads.ad_report_hourly"}, "source.tiktok_ads_source.tiktok_ads.adgroup_history": {"metadata": {"type": "BASE TABLE", "schema": "tiktok_ads_source_integration_tests_1", "name": "tiktok_adgroup_history_data", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"adgroup_id": {"type": "integer", "index": 1, "name": "adgroup_id", "comment": null}, "updated_at": {"type": "text", "index": 2, "name": "updated_at", "comment": null}, "advertiser_id": {"type": "integer", "index": 3, "name": "advertiser_id", "comment": null}, "campaign_id": {"type": "integer", "index": 4, "name": "campaign_id", "comment": null}, "create_time": {"type": "text", "index": 5, "name": "create_time", "comment": null}, "adgroup_name": {"type": "text", "index": 6, "name": "adgroup_name", "comment": null}, "placement_type": {"type": "text", "index": 7, "name": "placement_type", "comment": null}, "profile_image": {"type": "integer", "index": 8, "name": "profile_image", "comment": null}, "landing_page_url": {"type": "integer", "index": 9, "name": "landing_page_url", "comment": null}, "display_name": {"type": "integer", "index": 10, "name": "display_name", "comment": null}, "app_type": {"type": "integer", "index": 11, "name": "app_type", "comment": null}, "app_download_url": {"type": "integer", "index": 12, "name": "app_download_url", "comment": null}, "app_name": {"type": "integer", "index": 13, "name": "app_name", "comment": null}, "external_action": {"type": "text", "index": 14, "name": "external_action", "comment": null}, "deep_external_action": {"type": "integer", "index": 15, "name": "deep_external_action", "comment": null}, "creative_material_mode": {"type": "text", "index": 16, "name": "creative_material_mode", "comment": null}, "audience_type": {"type": "integer", "index": 17, "name": "audience_type", "comment": null}, "gender": {"type": "text", "index": 18, "name": "gender", "comment": null}, "android_osv": {"type": "integer", "index": 19, "name": "android_osv", "comment": null}, "ios_osv": {"type": "integer", "index": 20, "name": "ios_osv", "comment": null}, "budget_mode": {"type": "text", "index": 21, "name": "budget_mode", "comment": null}, "schedule_type": {"type": "text", "index": 22, "name": "schedule_type", "comment": null}, "dayparting": {"type": "integer", "index": 23, "name": "dayparting", "comment": null}, "optimize_goal": {"type": "text", "index": 24, "name": "optimize_goal", "comment": null}, "cpv_video_duration": {"type": "integer", "index": 25, "name": "cpv_video_duration", "comment": null}, "pacing": {"type": "text", "index": 26, "name": "pacing", "comment": null}, "billing_event": {"type": "text", "index": 27, "name": "billing_event", "comment": null}, "bid_type": {"type": "text", "index": 28, "name": "bid_type", "comment": null}, "deep_bid_type": {"type": "integer", "index": 29, "name": "deep_bid_type", "comment": null}, "impression_tracking_url": {"type": "integer", "index": 30, "name": "impression_tracking_url", "comment": null}, "click_tracking_url": {"type": "integer", "index": 31, "name": "click_tracking_url", "comment": null}, "status": {"type": "text", "index": 32, "name": "status", "comment": null}, "opt_status": {"type": "text", "index": 33, "name": "opt_status", "comment": null}, "statistic_type": {"type": "integer", "index": 34, "name": "statistic_type", "comment": null}, "video_download": {"type": "text", "index": 35, "name": "video_download", "comment": null}, "open_url": {"type": "integer", "index": 36, "name": "open_url", "comment": null}, "open_url_type": {"type": "integer", "index": 37, "name": "open_url_type", "comment": null}, "fallback_type": {"type": "integer", "index": 38, "name": "fallback_type", "comment": null}, "budget": {"type": "integer", "index": 39, "name": "budget", "comment": null}, "bid": {"type": "integer", "index": 40, "name": "bid", "comment": null}, "conversion_bid": {"type": "integer", "index": 41, "name": "conversion_bid", "comment": null}, "deep_cpabid": {"type": "integer", "index": 42, "name": "deep_cpabid", "comment": null}, "schedule_start_time": {"type": "text", "index": 43, "name": "schedule_start_time", "comment": null}, "schedule_end_time": {"type": "text", "index": 44, "name": "schedule_end_time", "comment": null}, "app_id": {"type": "integer", "index": 45, "name": "app_id", "comment": null}, "pixel_id": {"type": "integer", "index": 46, "name": "pixel_id", "comment": null}, "enable_inventory_filter": {"type": "boolean", "index": 47, "name": "enable_inventory_filter", "comment": null}, "is_hfss": {"type": "boolean", "index": 48, "name": "is_hfss", "comment": null}, "is_new_structure": {"type": "boolean", "index": 49, "name": "is_new_structure", "comment": null}, "category": {"type": "integer", "index": 50, "name": "category", "comment": null}, "is_comment_disable": {"type": "integer", "index": 51, "name": "is_comment_disable", "comment": null}, "skip_learning_phase": {"type": "integer", "index": 52, "name": "skip_learning_phase", "comment": null}, "frequency": {"type": "integer", "index": 53, "name": "frequency", "comment": null}, "frequency_schedule": {"type": "integer", "index": 54, "name": "frequency_schedule", "comment": null}, "action_days": {"type": "integer", "index": 55, "name": "action_days", "comment": null}, "audience": {"type": "text", "index": 56, "name": "audience", "comment": null}, "excluded_audience": {"type": "text", "index": 57, "name": "excluded_audience", "comment": null}, "location": {"type": "text", "index": 58, "name": "location", "comment": null}, "interest_category_v_2": {"type": "text", "index": 59, "name": "interest_category_v_2", "comment": null}, "pangle_block_app_list_id": {"type": "text", "index": 60, "name": "pangle_block_app_list_id", "comment": null}, "action_categories": {"type": "text", "index": 61, "name": "action_categories", "comment": null}, "placement": {"type": "text", "index": 62, "name": "placement", "comment": null}, "keywords": {"type": "integer", "index": 63, "name": "keywords", "comment": null}, "age": {"type": "text", "index": 64, "name": "age", "comment": null}, "languages": {"type": "text", "index": 65, "name": "languages", "comment": null}, "operation_system": {"type": "text", "index": 66, "name": "operation_system", "comment": null}, "connection_type": {"type": "text", "index": 67, "name": "connection_type", "comment": null}, "carriers": {"type": "text", "index": 68, "name": "carriers", "comment": null}, "video_actions": {"type": "text", "index": 69, "name": "video_actions", "comment": null}, "package": {"type": "integer", "index": 70, "name": "package", "comment": null}, "_fivetran_synced": {"type": "text", "index": 71, "name": "_fivetran_synced", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.tiktok_ads_source.tiktok_ads.adgroup_history"}, "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly": {"metadata": {"type": "BASE TABLE", "schema": "tiktok_ads_source_integration_tests_1", "name": "tiktok_adgroup_report_hourly_data", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"adgroup_id": {"type": "integer", "index": 1, "name": "adgroup_id", "comment": null}, "stat_time_hour": {"type": "timestamp without time zone", "index": 2, "name": "stat_time_hour", "comment": null}, "cost_per_conversion": {"type": "double precision", "index": 3, "name": "cost_per_conversion", "comment": null}, "real_time_conversion": {"type": "integer", "index": 4, "name": "real_time_conversion", "comment": null}, "cpc": {"type": "double precision", "index": 5, "name": "cpc", "comment": null}, "video_play_actions": {"type": "integer", "index": 6, "name": "video_play_actions", "comment": null}, "conversion_rate": {"type": "integer", "index": 7, "name": "conversion_rate", "comment": null}, "video_views_p_75": {"type": "integer", "index": 8, "name": "video_views_p_75", "comment": null}, "result": {"type": "integer", "index": 9, "name": "result", "comment": null}, "video_views_p_50": {"type": "integer", "index": 10, "name": "video_views_p_50", "comment": null}, "impressions": {"type": "integer", "index": 11, "name": "impressions", "comment": null}, "comments": {"type": "integer", "index": 12, "name": "comments", "comment": null}, "real_time_cost_per_result": {"type": "double precision", "index": 13, "name": "real_time_cost_per_result", "comment": null}, "conversion": {"type": "integer", "index": 14, "name": "conversion", "comment": null}, "real_time_result": {"type": "integer", "index": 15, "name": "real_time_result", "comment": null}, "video_views_p_100": {"type": "integer", "index": 16, "name": "video_views_p_100", "comment": null}, "shares": {"type": "integer", "index": 17, "name": "shares", "comment": null}, "real_time_conversion_rate": {"type": "double precision", "index": 18, "name": "real_time_conversion_rate", "comment": null}, "cost_per_secondary_goal_result": {"type": "text", "index": 19, "name": "cost_per_secondary_goal_result", "comment": null}, "secondary_goal_result_rate": {"type": "text", "index": 20, "name": "secondary_goal_result_rate", "comment": null}, "clicks": {"type": "integer", "index": 21, "name": "clicks", "comment": null}, "cost_per_1000_reached": {"type": "double precision", "index": 22, "name": "cost_per_1000_reached", "comment": null}, "video_views_p_25": {"type": "integer", "index": 23, "name": "video_views_p_25", "comment": null}, "reach": {"type": "integer", "index": 24, "name": "reach", "comment": null}, "real_time_cost_per_conversion": {"type": "double precision", "index": 25, "name": "real_time_cost_per_conversion", "comment": null}, "profile_visits_rate": {"type": "integer", "index": 26, "name": "profile_visits_rate", "comment": null}, "average_video_play": {"type": "double precision", "index": 27, "name": "average_video_play", "comment": null}, "profile_visits": {"type": "integer", "index": 28, "name": "profile_visits", "comment": null}, "cpm": {"type": "double precision", "index": 29, "name": "cpm", "comment": null}, "ctr": {"type": "double precision", "index": 30, "name": "ctr", "comment": null}, "video_watched_2_s": {"type": "integer", "index": 31, "name": "video_watched_2_s", "comment": null}, "follows": {"type": "integer", "index": 32, "name": "follows", "comment": null}, "result_rate": {"type": "double precision", "index": 33, "name": "result_rate", "comment": null}, "video_watched_6_s": {"type": "integer", "index": 34, "name": "video_watched_6_s", "comment": null}, "secondary_goal_result": {"type": "text", "index": 35, "name": "secondary_goal_result", "comment": null}, "cost_per_result": {"type": "double precision", "index": 36, "name": "cost_per_result", "comment": null}, "average_video_play_per_user": {"type": "double precision", "index": 37, "name": "average_video_play_per_user", "comment": null}, "real_time_result_rate": {"type": "double precision", "index": 38, "name": "real_time_result_rate", "comment": null}, "spend": {"type": "double precision", "index": 39, "name": "spend", "comment": null}, "likes": {"type": "integer", "index": 40, "name": "likes", "comment": null}, "_fivetran_synced": {"type": "text", "index": 41, "name": "_fivetran_synced", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly"}, "source.tiktok_ads_source.tiktok_ads.advertiser": {"metadata": {"type": "BASE TABLE", "schema": "tiktok_ads_source_integration_tests_1", "name": "tiktok_advertiser_data", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"id": {"type": "integer", "index": 1, "name": "id", "comment": null}, "name": {"type": "text", "index": 2, "name": "name", "comment": null}, "address": {"type": "text", "index": 3, "name": "address", "comment": null}, "company": {"type": "text", "index": 4, "name": "company", "comment": null}, "contacter": {"type": "integer", "index": 5, "name": "contacter", "comment": null}, "country": {"type": "text", "index": 6, "name": "country", "comment": null}, "currency": {"type": "text", "index": 7, "name": "currency", "comment": null}, "description": {"type": "text", "index": 8, "name": "description", "comment": null}, "email": {"type": "text", "index": 9, "name": "email", "comment": null}, "industry": {"type": "integer", "index": 10, "name": "industry", "comment": null}, "license_no": {"type": "integer", "index": 11, "name": "license_no", "comment": null}, "license_url": {"type": "integer", "index": 12, "name": "license_url", "comment": null}, "promotion_area": {"type": "integer", "index": 13, "name": "promotion_area", "comment": null}, "reason": {"type": "integer", "index": 14, "name": "reason", "comment": null}, "role": {"type": "text", "index": 15, "name": "role", "comment": null}, "status": {"type": "text", "index": 16, "name": "status", "comment": null}, "telephone": {"type": "integer", "index": 17, "name": "telephone", "comment": null}, "timezone": {"type": "text", "index": 18, "name": "timezone", "comment": null}, "balance": {"type": "double precision", "index": 19, "name": "balance", "comment": null}, "create_time": {"type": "text", "index": 20, "name": "create_time", "comment": null}, "language": {"type": "text", "index": 21, "name": "language", "comment": null}, "phone_number": {"type": "text", "index": 22, "name": "phone_number", "comment": null}, "_fivetran_synced": {"type": "text", "index": 23, "name": "_fivetran_synced", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.tiktok_ads_source.tiktok_ads.advertiser"}, "source.tiktok_ads_source.tiktok_ads.campaign_history": {"metadata": {"type": "BASE TABLE", "schema": "tiktok_ads_source_integration_tests_1", "name": "tiktok_campaign_history_data", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"campaign_id": {"type": "integer", "index": 1, "name": "campaign_id", "comment": null}, "updated_at": {"type": "text", "index": 2, "name": "updated_at", "comment": null}, "advertiser_id": {"type": "integer", "index": 3, "name": "advertiser_id", "comment": null}, "campaign_name": {"type": "text", "index": 4, "name": "campaign_name", "comment": null}, "campaign_type": {"type": "text", "index": 5, "name": "campaign_type", "comment": null}, "budget": {"type": "integer", "index": 6, "name": "budget", "comment": null}, "budget_mode": {"type": "text", "index": 7, "name": "budget_mode", "comment": null}, "opt_status": {"type": "text", "index": 8, "name": "opt_status", "comment": null}, "objective_type": {"type": "text", "index": 9, "name": "objective_type", "comment": null}, "is_new_structure": {"type": "boolean", "index": 10, "name": "is_new_structure", "comment": null}, "split_test_variable": {"type": "integer", "index": 11, "name": "split_test_variable", "comment": null}, "create_time": {"type": "text", "index": 12, "name": "create_time", "comment": null}, "_fivetran_synced": {"type": "text", "index": 13, "name": "_fivetran_synced", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.tiktok_ads_source.tiktok_ads.campaign_history"}, "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly": {"metadata": {"type": "BASE TABLE", "schema": "tiktok_ads_source_integration_tests_1", "name": "tiktok_campaign_report_hourly_data", "database": "postgres", "comment": null, "owner": "pguser"}, "columns": {"campaign_id": {"type": "integer", "index": 1, "name": "campaign_id", "comment": null}, "stat_time_hour": {"type": "timestamp without time zone", "index": 2, "name": "stat_time_hour", "comment": null}, "cost_per_conversion": {"type": "double precision", "index": 3, "name": "cost_per_conversion", "comment": null}, "real_time_conversion": {"type": "integer", "index": 4, "name": "real_time_conversion", "comment": null}, "cpc": {"type": "double precision", "index": 5, "name": "cpc", "comment": null}, "video_play_actions": {"type": "integer", "index": 6, "name": "video_play_actions", "comment": null}, "conversion_rate": {"type": "integer", "index": 7, "name": "conversion_rate", "comment": null}, "video_views_p_75": {"type": "integer", "index": 8, "name": "video_views_p_75", "comment": null}, "result": {"type": "integer", "index": 9, "name": "result", "comment": null}, "video_views_p_50": {"type": "integer", "index": 10, "name": "video_views_p_50", "comment": null}, "impressions": {"type": "integer", "index": 11, "name": "impressions", "comment": null}, "comments": {"type": "integer", "index": 12, "name": "comments", "comment": null}, "real_time_cost_per_result": {"type": "double precision", "index": 13, "name": "real_time_cost_per_result", "comment": null}, "conversion": {"type": "integer", "index": 14, "name": "conversion", "comment": null}, "real_time_result": {"type": "integer", "index": 15, "name": "real_time_result", "comment": null}, "video_views_p_100": {"type": "integer", "index": 16, "name": "video_views_p_100", "comment": null}, "shares": {"type": "integer", "index": 17, "name": "shares", "comment": null}, "real_time_conversion_rate": {"type": "double precision", "index": 18, "name": "real_time_conversion_rate", "comment": null}, "cost_per_secondary_goal_result": {"type": "text", "index": 19, "name": "cost_per_secondary_goal_result", "comment": null}, "secondary_goal_result_rate": {"type": "text", "index": 20, "name": "secondary_goal_result_rate", "comment": null}, "clicks": {"type": "integer", "index": 21, "name": "clicks", "comment": null}, "cost_per_1000_reached": {"type": "double precision", "index": 22, "name": "cost_per_1000_reached", "comment": null}, "video_views_p_25": {"type": "integer", "index": 23, "name": "video_views_p_25", "comment": null}, "reach": {"type": "integer", "index": 24, "name": "reach", "comment": null}, "real_time_cost_per_conversion": {"type": "double precision", "index": 25, "name": "real_time_cost_per_conversion", "comment": null}, "profile_visits_rate": {"type": "integer", "index": 26, "name": "profile_visits_rate", "comment": null}, "average_video_play": {"type": "double precision", "index": 27, "name": "average_video_play", "comment": null}, "profile_visits": {"type": "integer", "index": 28, "name": "profile_visits", "comment": null}, "cpm": {"type": "double precision", "index": 29, "name": "cpm", "comment": null}, "ctr": {"type": "double precision", "index": 30, "name": "ctr", "comment": null}, "video_watched_2_s": {"type": "integer", "index": 31, "name": "video_watched_2_s", "comment": null}, "follows": {"type": "integer", "index": 32, "name": "follows", "comment": null}, "result_rate": {"type": "double precision", "index": 33, "name": "result_rate", "comment": null}, "video_watched_6_s": {"type": "integer", "index": 34, "name": "video_watched_6_s", "comment": null}, "secondary_goal_result": {"type": "text", "index": 35, "name": "secondary_goal_result", "comment": null}, "cost_per_result": {"type": "double precision", "index": 36, "name": "cost_per_result", "comment": null}, "average_video_play_per_user": {"type": "double precision", "index": 37, "name": "average_video_play_per_user", "comment": null}, "real_time_result_rate": {"type": "double precision", "index": 38, "name": "real_time_result_rate", "comment": null}, "spend": {"type": "double precision", "index": 39, "name": "spend", "comment": null}, "likes": {"type": "integer", "index": 40, "name": "likes", "comment": null}, "_fivetran_synced": {"type": "text", "index": 41, "name": "_fivetran_synced", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly"}}, "errors": null} \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index fa8b08b..0c4d0ec 100644 --- a/docs/index.html +++ b/docs/index.html @@ -70,7 +70,7 @@ * (c) 2010-2020 Google LLC. http://angularjs.org * License: MIT */ -!function(e){"use strict";var t={objectMaxDepth:5,urlErrorParamsEnabled:!0};function n(e){if(!L(e))return t;z(e.objectMaxDepth)&&(t.objectMaxDepth=r(e.objectMaxDepth)?e.objectMaxDepth:NaN),z(e.urlErrorParamsEnabled)&&Z(e.urlErrorParamsEnabled)&&(t.urlErrorParamsEnabled=e.urlErrorParamsEnabled)}function r(e){return q(e)&&e>0}function i(e,n){n=n||Error;var r="https://errors.angularjs.org/1.8.2/",i=r.replace(".","\\.")+"[\\s\\S]*",o=new RegExp(i,"g");return function(){var i,a,s=arguments[0],l=arguments[1],c="["+(e?e+":":"")+s+"] ",u=de(arguments,2).map((function(e){return Ve(e,t.objectMaxDepth)}));if(c+=l.replace(/\{\d+\}/g,(function(e){var t=+e.slice(1,-1);return t=0&&t-1 in e||"function"==typeof e.item)}function k(e,t,n){var r,i;if(e)if(G(e))for(r in e)"prototype"!==r&&"length"!==r&&"name"!==r&&e.hasOwnProperty(r)&&t.call(n,e[r],r,e);else if(U(e)||w(e)){var o="object"!=typeof e;for(r=0,i=e.length;r=0&&e.splice(n,1),n}function oe(e,t,n){var i,o,a=[],s=[];if(n=r(n)?n:NaN,t){if((o=t)&&q(o.length)&&J.test(v.call(o))||(i=t,"[object ArrayBuffer]"===v.call(i)))throw b("cpta","Can't copy! TypedArray destination cannot be mutated.");if(e===t)throw b("cpi","Can't copy! Source and destination are identical.");return U(t)?t.length=0:k(t,(function(e,n){"$$hashKey"!==n&&delete t[n]})),a.push(e),s.push(t),l(e,t,n)}return c(e,n);function l(e,t,n){if(--n<0)return"...";var r,i=t.$$hashKey;if(U(e))for(var o=0,a=e.length;o2?de(arguments,2):[];return!G(t)||t instanceof RegExp?t:n.length?function(){return arguments.length?t.apply(e,ue(n,arguments,0)):t.apply(e,n)}:function(){return arguments.length?t.apply(e,arguments):t.call(e)}}function pe(t,n){var r=n;return"string"==typeof t&&"$"===t.charAt(0)&&"$"===t.charAt(1)?r=void 0:Y(n)?r="$WINDOW":n&&e.document===n?r="$DOCUMENT":X(n)&&(r="$SCOPE"),r}function he(e,t){if(!M(e))return q(t)||(t=t?2:null),JSON.stringify(e,pe,t)}function ge(e){return F(e)?JSON.parse(e):e}var ve=/:/g;function me(e,t){e=e.replace(ve,"");var n=Date.parse("Jan 01, 1970 00:00:00 "+e)/6e4;return j(n)?t:n}function be(e,t){return(e=new Date(e.getTime())).setMinutes(e.getMinutes()+t),e}function ye(e,t,n){n=n?-1:1;var r=e.getTimezoneOffset();return be(e,n*(me(t,r)-r))}function xe(e){e=a(e).clone().empty();var t=a("
").append(e).html();try{return e[0].nodeType===Fe?d(t):t.match(/^(<[^>]+>)/)[1].replace(/^<([\w-]+)/,(function(e,t){return"<"+d(t)}))}catch(e){return d(t)}}function we(e){try{return decodeURIComponent(e)}catch(e){}}function ke(e){var t={};return k((e||"").split("&"),(function(e){var n,r,i;e&&(r=e=e.replace(/\+/g,"%20"),-1!==(n=e.indexOf("="))&&(r=e.substring(0,n),i=e.substring(n+1)),z(r=we(r))&&(i=!z(i)||we(i),u.call(t,r)?U(t[r])?t[r].push(i):t[r]=[t[r],i]:t[r]=i))})),t}function Ae(e){return Ee(e,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function Ee(e,t){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%3B/gi,";").replace(/%20/g,t?"%20":"+")}var Se=["ng-","data-ng-","ng:","x-ng-"];var Ce=function(t){var n=t.currentScript;if(!n)return!0;if(!(n instanceof e.HTMLScriptElement||n instanceof e.SVGScriptElement))return!1;var r=n.attributes;return[r.getNamedItem("src"),r.getNamedItem("href"),r.getNamedItem("xlink:href")].every((function(e){if(!e)return!0;if(!e.value)return!1;var n=t.createElement("a");if(n.href=e.value,t.location.origin===n.origin)return!0;switch(n.protocol){case"http:":case"https:":case"ftp:":case"blob:":case"file:":case"data:":return!0;default:return!1}}))}(e.document);function $e(t,n){var r,i,o={};if(k(Se,(function(e){var n=e+"app";!r&&t.hasAttribute&&t.hasAttribute(n)&&(r=t,i=t.getAttribute(n))})),k(Se,(function(e){var n,o=e+"app";!r&&(n=t.querySelector("["+o.replace(":","\\:")+"]"))&&(r=n,i=n.getAttribute(o))})),r){if(!Ce)return void e.console.error("AngularJS: disabling automatic bootstrap. diff --git a/docs/manifest.json b/docs/manifest.json index 739593f..d657f40 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -1 +1 @@ -{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v4.json", "dbt_version": "1.0.0", "generated_at": "2022-07-28T16:21:10.068522Z", "invocation_id": "73d9028b-4406-406d-9101-01780cecfbb9", "env": {}, "project_id": "faebc42304447d4427374f806679ecb5", "user_id": "e607f749-4294-4b15-833b-0ae4a87d4d24", "send_anonymous_usage_stats": true, "adapter_type": "bigquery"}, "nodes": {"model.tiktok_ads.tiktok_ads__ad_group_report": {"raw_sql": "with hourly as (\n \n select *\n from {{ var('ad_group_report_hourly') }}\n\n), ad_groups as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_ad_group') }}\n\n), advertiser as (\n\n select *\n from {{ var('advertiser') }}\n\n), campaigns as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_campaign') }}\n\n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n ad_groups.advertiser_id,\n advertiser.advertiser_name,\n campaigns.campaign_id,\n campaigns.campaign_name,\n hourly.ad_group_id,\n ad_groups.ad_group_name,\n advertiser.currency,\n ad_groups.action_categories,\n ad_groups.category,\n ad_groups.gender,\n ad_groups.audience_type,\n ad_groups.budget,\n ad_groups.age,\n ad_groups.languages,\n ad_groups.interest_category,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n {% for metric in var('tiktok_ads__ad_group_hourly_passthrough_metrics', []) %}\n , sum(hourly.{{ metric }}) as {{ metric }}\n {% endfor %}\n from hourly\n left join ad_groups \n on hourly.ad_group_id = ad_groups.ad_group_id\n left join advertiser\n on ad_groups.advertiser_id = advertiser.advertiser_id\n left join campaigns\n on ad_groups.campaign_id = campaigns.campaign_id\n {{ dbt_utils.group_by(16) }}\n\n)\n\nselect *\nfrom aggregated", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.group_by"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly", "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "model.tiktok_ads_source.stg_tiktok_ads__advertiser", "model.tiktok_ads.int_tiktok_ads__most_recent_campaign"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_tiktok_ads", "fqn": ["tiktok_ads", "tiktok_ads__ad_group_report"], "unique_id": "model.tiktok_ads.tiktok_ads__ad_group_report", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "tiktok_ads__ad_group_report.sql", "original_file_path": "models/tiktok_ads__ad_group_report.sql", "name": "tiktok_ads__ad_group_report", "alias": "tiktok_ads__ad_group_report", "checksum": {"name": "sha256", "checksum": "4d9c652cfe378018869cfdd831056ec099d46848e7a30007fdb1b9c8d3ca0a62"}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_report_hourly"], ["int_tiktok_ads__most_recent_ad_group"], ["stg_tiktok_ads__advertiser"], ["int_tiktok_ads__most_recent_campaign"]], "sources": [], "description": "Each record in this table represents the daily performance of ads at the ad group level.", "columns": {"date_day": {"name": "date_day", "description": "Day of record", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "Ad group name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_name": {"name": "advertiser_name", "description": "Advertiser name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "currency": {"name": "currency", "description": "Advertiser's currency.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_categories": {"name": "action_categories", "description": "IDs of the action categories (behaviors) that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "age": {"name": "age", "description": "Age groups you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience_type": {"name": "audience_type", "description": "Audience Type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget": {"name": "budget", "description": "Ad budget. Returns 0.0 when Campaign Budget Optimization (budget_optimize_switch) is on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "category": {"name": "category", "description": "Ad group category.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "interest_category": {"name": "interest_category", "description": "Interest classification. If the interest is specified, users that do not meet interest target will be excluded during delivery.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "languages": {"name": "languages", "description": "Codes of the languages that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of impressions that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The amount of spend that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of follows that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpc": {"name": "daily_cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpm": {"name": "daily_cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_ctr": {"name": "daily_ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads__ad_group_report.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "table"}, "created_at": 1659025250.225373, "compiled_sql": "with __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n), __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n),hourly as (\n \n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_group_report_hourly`\n\n), ad_groups as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_ad_group\n\n), advertiser as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__advertiser`\n\n), campaigns as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_campaign\n\n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n ad_groups.advertiser_id,\n advertiser.advertiser_name,\n campaigns.campaign_id,\n campaigns.campaign_name,\n hourly.ad_group_id,\n ad_groups.ad_group_name,\n advertiser.currency,\n ad_groups.action_categories,\n ad_groups.category,\n ad_groups.gender,\n ad_groups.audience_type,\n ad_groups.budget,\n ad_groups.age,\n ad_groups.languages,\n ad_groups.interest_category,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n \n , sum(hourly.result) as result\n \n from hourly\n left join ad_groups \n on hourly.ad_group_id = ad_groups.ad_group_id\n left join advertiser\n on ad_groups.advertiser_id = advertiser.advertiser_id\n left join campaigns\n on ad_groups.campaign_id = campaigns.campaign_id\n group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16\n\n)\n\nselect *\nfrom aggregated", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}, {"id": "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "sql": " __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": "`database`.`dbt_renee_tiktok_ads`.`tiktok_ads__ad_group_report`"}, "model.tiktok_ads.tiktok_ads__url_report": {"raw_sql": "with hourly as (\n \n select *\n from {{ var('ad_report_hourly') }}\n\n), ads as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_ad') }}\n\n), ad_groups as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_ad_group') }}\n\n), advertiser as (\n\n select *\n from {{ var('advertiser') }}\n\n), campaigns as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_campaign') }}\n\n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n ad_groups.advertiser_id,\n advertiser.advertiser_name,\n campaigns.campaign_id,\n campaigns.campaign_name,\n ad_groups.ad_group_id,\n ad_groups.ad_group_name,\n hourly.ad_id,\n ads.ad_name,\n ads.base_url,\n ads.url_host,\n ads.url_path,\n ads.utm_source,\n ads.utm_medium,\n ads.utm_campaign,\n ads.utm_content,\n ads.utm_term,\n advertiser.currency,\n ad_groups.action_categories,\n ad_groups.category,\n ad_groups.gender,\n ad_groups.audience_type,\n ad_groups.budget,\n ad_groups.age,\n ad_groups.languages,\n ad_groups.interest_category,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n {% for metric in var('tiktok_ads__ad_hourly_passthrough_metrics', []) %}\n , sum(hourly.{{ metric }}) as {{ metric }}\n {% endfor %}\n from hourly\n left join ads\n on hourly.ad_id = ads.ad_id\n left join ad_groups \n on ads.ad_group_id = ad_groups.ad_group_id\n left join advertiser\n on ads.advertiser_id = advertiser.advertiser_id\n left join campaigns\n on ads.campaign_id = campaigns.campaign_id\n\n -- We only want utm ads to populate this report. Therefore, we filter where url ads are populated.\n where ads.landing_page_url is not null\n {{ dbt_utils.group_by(26) }}\n\n)\n\nselect *\nfrom aggregated", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.group_by"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "model.tiktok_ads_source.stg_tiktok_ads__advertiser", "model.tiktok_ads.int_tiktok_ads__most_recent_campaign"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_tiktok_ads", "fqn": ["tiktok_ads", "tiktok_ads__url_report"], "unique_id": "model.tiktok_ads.tiktok_ads__url_report", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "tiktok_ads__url_report.sql", "original_file_path": "models/tiktok_ads__url_report.sql", "name": "tiktok_ads__url_report", "alias": "tiktok_ads__url_report", "checksum": {"name": "sha256", "checksum": "43277aa326650ef818aa44cfa4fe00ef71d07bf523ec08a608ca7309f85a3af4"}, "tags": [], "refs": [["stg_tiktok_ads__ad_report_hourly"], ["int_tiktok_ads__most_recent_ad"], ["int_tiktok_ads__most_recent_ad_group"], ["stg_tiktok_ads__advertiser"], ["int_tiktok_ads__most_recent_campaign"]], "sources": [], "description": "Each record in this table represents the daily performance of ads at the URL level.", "columns": {"date_day": {"name": "date_day", "description": "Day of record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_id": {"name": "ad_id", "description": "Ad ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_name": {"name": "ad_name", "description": "Ad name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_name": {"name": "advertiser_name", "description": "Advertiser name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "Ad group ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "Ad group name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "base_url": {"name": "base_url", "description": "The base URL of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_host": {"name": "url_host", "description": "The URL host of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_path": {"name": "url_path", "description": "The URL path of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_source": {"name": "utm_source", "description": "The utm_source parameter of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_medium": {"name": "utm_medium", "description": "The utm_medium parameter of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_campaign": {"name": "utm_campaign", "description": "The utm_campaign parameter of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_content": {"name": "utm_content", "description": "The utm_content parameter of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_term": {"name": "utm_term", "description": "The utm_term parameter of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_categories": {"name": "action_categories", "description": "IDs of the action categories (behaviors) that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "age": {"name": "age", "description": "Age groups you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience_type": {"name": "audience_type", "description": "Audience Type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget": {"name": "budget", "description": "Ad budget. Returns 0.0 when Campaign Budget Optimization (budget_optimize_switch) is on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "category": {"name": "category", "description": "Ad group category.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "interest_category": {"name": "interest_category", "description": "Interest classification. If the interest is specified, users that do not meet interest target will be excluded during delivery.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "languages": {"name": "languages", "description": "Codes of the languages that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "currency": {"name": "currency", "description": "Advertiser's currency.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of impressions that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The amount of spend that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of follows that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpc": {"name": "daily_cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpm": {"name": "daily_cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_ctr": {"name": "daily_ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads__url_report.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "table"}, "created_at": 1659025250.249853, "compiled_sql": "with __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n), __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n), __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n),hourly as (\n \n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_report_hourly`\n\n), ads as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_ad\n\n), ad_groups as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_ad_group\n\n), advertiser as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__advertiser`\n\n), campaigns as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_campaign\n\n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n ad_groups.advertiser_id,\n advertiser.advertiser_name,\n campaigns.campaign_id,\n campaigns.campaign_name,\n ad_groups.ad_group_id,\n ad_groups.ad_group_name,\n hourly.ad_id,\n ads.ad_name,\n ads.base_url,\n ads.url_host,\n ads.url_path,\n ads.utm_source,\n ads.utm_medium,\n ads.utm_campaign,\n ads.utm_content,\n ads.utm_term,\n advertiser.currency,\n ad_groups.action_categories,\n ad_groups.category,\n ad_groups.gender,\n ad_groups.audience_type,\n ad_groups.budget,\n ad_groups.age,\n ad_groups.languages,\n ad_groups.interest_category,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n \n , sum(hourly.REAL_TIME_COST_PER_RESULT) as REAL_TIME_COST_PER_RESULT\n \n from hourly\n left join ads\n on hourly.ad_id = ads.ad_id\n left join ad_groups \n on ads.ad_group_id = ad_groups.ad_group_id\n left join advertiser\n on ads.advertiser_id = advertiser.advertiser_id\n left join campaigns\n on ads.campaign_id = campaigns.campaign_id\n\n -- We only want utm ads to populate this report. Therefore, we filter where url ads are populated.\n where ads.landing_page_url is not null\n group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26\n\n)\n\nselect *\nfrom aggregated", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}, {"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}, {"id": "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "sql": " __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": "`database`.`dbt_renee_tiktok_ads`.`tiktok_ads__url_report`"}, "model.tiktok_ads.tiktok_ads__account_report": {"raw_sql": "with hourly as (\n \n select *\n from {{ var('ad_report_hourly') }}\n\n), advertiser as (\n\n select *\n from {{ var('advertiser') }}\n\n), ads as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_ad') }}\n\n), joined as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n ads.advertiser_id,\n advertiser.advertiser_name,\n advertiser.currency,\n sum(hourly.clicks) as clicks,\n sum(hourly.impressions) as impressions,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s, \n sum(hourly.video_watched_6_s) as video_watched_6_s, \n sum(hourly.video_views_p_25) as video_views_p_25, \n sum(hourly.video_views_p_50) as video_views_p_50,\n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n {% for metric in var('tiktok_ads__ad_hourly_passthrough_metrics', []) %}\n , sum(hourly.{{ metric }}) as {{ metric }}\n {% endfor %}\n from hourly\n left join ads\n on hourly.ad_id = ads.ad_id\n left join advertiser\n on ads.advertiser_id = advertiser.advertiser_id\n {{ dbt_utils.group_by(4) }}\n \n\n\n)\n\nselect *\nfrom joined", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.group_by"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__advertiser", "model.tiktok_ads.int_tiktok_ads__most_recent_ad"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_tiktok_ads", "fqn": ["tiktok_ads", "tiktok_ads__account_report"], "unique_id": "model.tiktok_ads.tiktok_ads__account_report", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "tiktok_ads__account_report.sql", "original_file_path": "models/tiktok_ads__account_report.sql", "name": "tiktok_ads__account_report", "alias": "tiktok_ads__account_report", "checksum": {"name": "sha256", "checksum": "4d92af604bb91482ca33af0f21c0dcce9ba18fa0d93744f4bc42023e93f0f756"}, "tags": [], "refs": [["stg_tiktok_ads__ad_report_hourly"], ["stg_tiktok_ads__advertiser"], ["int_tiktok_ads__most_recent_ad"]], "sources": [], "description": "Each record in this table represents the daily performance of ads at the account level.", "columns": {"date_day": {"name": "date_day", "description": "Day of record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_name": {"name": "advertiser_name", "description": "Advertiser name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "currency": {"name": "currency", "description": "Advertiser's currency.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of impressions that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The amount of spend that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of follows that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpc": {"name": "daily_cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpm": {"name": "daily_cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_ctr": {"name": "daily_ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads__account_report.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "table"}, "created_at": 1659025250.1962502, "compiled_sql": "with __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n),hourly as (\n \n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_report_hourly`\n\n), advertiser as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__advertiser`\n\n), ads as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_ad\n\n), joined as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n ads.advertiser_id,\n advertiser.advertiser_name,\n advertiser.currency,\n sum(hourly.clicks) as clicks,\n sum(hourly.impressions) as impressions,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s, \n sum(hourly.video_watched_6_s) as video_watched_6_s, \n sum(hourly.video_views_p_25) as video_views_p_25, \n sum(hourly.video_views_p_50) as video_views_p_50,\n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n \n , sum(hourly.REAL_TIME_COST_PER_RESULT) as REAL_TIME_COST_PER_RESULT\n \n from hourly\n left join ads\n on hourly.ad_id = ads.ad_id\n left join advertiser\n on ads.advertiser_id = advertiser.advertiser_id\n group by 1,2,3,4\n \n\n\n)\n\nselect *\nfrom joined", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": "`database`.`dbt_renee_tiktok_ads`.`tiktok_ads__account_report`"}, "model.tiktok_ads.tiktok_ads__campaign_report": {"raw_sql": "with hourly as (\n \n select *\n from {{ var('campaign_report_hourly') }}\n\n), campaigns as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_campaign') }}\n\n), advertiser as (\n\n select *\n from {{ var('advertiser') }}\n \n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n advertiser.advertiser_id,\n advertiser.advertiser_name,\n hourly.campaign_id,\n campaigns.campaign_name,\n advertiser.currency,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n {% for metric in var('tiktok_ads__campaign_hourly_passthrough_metrics', []) %}\n , sum(hourly.{{ metric }}) as {{ metric }}\n {% endfor %}\n from hourly\n left join campaigns\n on hourly.campaign_id = campaigns.campaign_id\n left join advertiser\n on campaigns.advertiser_id = advertiser.advertiser_id\n {{ dbt_utils.group_by(6) }}\n\n)\n\nselect *\nfrom aggregated", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.group_by"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly", "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "model.tiktok_ads_source.stg_tiktok_ads__advertiser"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_tiktok_ads", "fqn": ["tiktok_ads", "tiktok_ads__campaign_report"], "unique_id": "model.tiktok_ads.tiktok_ads__campaign_report", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "tiktok_ads__campaign_report.sql", "original_file_path": "models/tiktok_ads__campaign_report.sql", "name": "tiktok_ads__campaign_report", "alias": "tiktok_ads__campaign_report", "checksum": {"name": "sha256", "checksum": "705a629feb32d1c01ed4a276f0a9cc2e232049e0a155229954075ff50e552aa4"}, "tags": [], "refs": [["stg_tiktok_ads__campaign_report_hourly"], ["int_tiktok_ads__most_recent_campaign"], ["stg_tiktok_ads__advertiser"]], "sources": [], "description": "Each record in this table represents the daily performance at the campaign level.", "columns": {"date_day": {"name": "date_day", "description": "Day of record", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_name": {"name": "advertiser_name", "description": "Advertiser name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of impressions that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The amount of spend that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of follows that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpc": {"name": "daily_cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpm": {"name": "daily_cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_daily_ctr": {"name": "daily_daily_ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads__campaign_report.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "table"}, "created_at": 1659025250.234406, "compiled_sql": "with __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n),hourly as (\n \n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_report_hourly`\n\n), campaigns as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_campaign\n\n), advertiser as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__advertiser`\n \n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n advertiser.advertiser_id,\n advertiser.advertiser_name,\n hourly.campaign_id,\n campaigns.campaign_name,\n advertiser.currency,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n \n , sum(hourly.result) as result\n \n from hourly\n left join campaigns\n on hourly.campaign_id = campaigns.campaign_id\n left join advertiser\n on campaigns.advertiser_id = advertiser.advertiser_id\n group by 1,2,3,4,5,6\n\n)\n\nselect *\nfrom aggregated", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "sql": " __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": "`database`.`dbt_renee_tiktok_ads`.`tiktok_ads__campaign_report`"}, "model.tiktok_ads.tiktok_ads__ad_report": {"raw_sql": "with hourly as (\n \n select *\n from {{ var('ad_report_hourly') }}\n\n), ads as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_ad') }}\n\n), ad_groups as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_ad_group') }}\n\n), advertiser as (\n\n select *\n from {{ var('advertiser') }}\n\n), campaigns as (\n\n select *\n from {{ ref('int_tiktok_ads__most_recent_campaign') }}\n\n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n ad_groups.advertiser_id,\n advertiser.advertiser_name,\n campaigns.campaign_id,\n campaigns.campaign_name,\n ad_groups.ad_group_id,\n ad_groups.ad_group_name,\n hourly.ad_id,\n ads.ad_name,\n advertiser.currency,\n ad_groups.category,\n ad_groups.action_categories,\n ad_groups.gender,\n ad_groups.audience_type,\n ad_groups.budget,\n ad_groups.age,\n ad_groups.languages,\n ad_groups.interest_category,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n {% for metric in var('tiktok_ads__ad_hourly_passthrough_metrics', []) %}\n , sum(hourly.{{ metric }}) as {{ metric }}\n {% endfor %}\n from hourly\n left join ads\n on hourly.ad_id = ads.ad_id\n left join ad_groups \n on ads.ad_group_id = ad_groups.ad_group_id\n left join advertiser\n on ads.advertiser_id = advertiser.advertiser_id\n left join campaigns\n on ads.campaign_id = campaigns.campaign_id\n {{ dbt_utils.group_by(18) }}\n\n)\n\nselect *\nfrom aggregated", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.group_by"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "model.tiktok_ads_source.stg_tiktok_ads__advertiser", "model.tiktok_ads.int_tiktok_ads__most_recent_campaign"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_tiktok_ads", "fqn": ["tiktok_ads", "tiktok_ads__ad_report"], "unique_id": "model.tiktok_ads.tiktok_ads__ad_report", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "tiktok_ads__ad_report.sql", "original_file_path": "models/tiktok_ads__ad_report.sql", "name": "tiktok_ads__ad_report", "alias": "tiktok_ads__ad_report", "checksum": {"name": "sha256", "checksum": "425bd8283f1e154b54fe51145ff1b9b337107ac840efcbfbadabdf5930d6f7e7"}, "tags": [], "refs": [["stg_tiktok_ads__ad_report_hourly"], ["int_tiktok_ads__most_recent_ad"], ["int_tiktok_ads__most_recent_ad_group"], ["stg_tiktok_ads__advertiser"], ["int_tiktok_ads__most_recent_campaign"]], "sources": [], "description": "Each record in this table represents the daily performance of ads at the ad level.", "columns": {"date_day": {"name": "date_day", "description": "Day of record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_id": {"name": "ad_id", "description": "Ad ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_name": {"name": "ad_name", "description": "Ad name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_name": {"name": "advertiser_name", "description": "Advertiser name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "Ad group ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "Ad group name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_categories": {"name": "action_categories", "description": "IDs of the action categories (behaviors) that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "age": {"name": "age", "description": "Age groups you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience_type": {"name": "audience_type", "description": "Audience Type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget": {"name": "budget", "description": "Ad budget. Returns 0.0 when Campaign Budget Optimization (budget_optimize_switch) is on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "category": {"name": "category", "description": "Ad group category.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "interest_category": {"name": "interest_category", "description": "Interest classification. If the interest is specified, users that do not meet interest target will be excluded during delivery.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "languages": {"name": "languages", "description": "Codes of the languages that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "currency": {"name": "currency", "description": "Advertiser's currency.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of impressions that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The amount of spend that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of follows that occurred on the day of the record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpc": {"name": "daily_cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_cpm": {"name": "daily_cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daily_ctr": {"name": "daily_ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads__ad_report.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "table"}, "created_at": 1659025250.211673, "compiled_sql": "with __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n), __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n), __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n),hourly as (\n \n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_report_hourly`\n\n), ads as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_ad\n\n), ad_groups as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_ad_group\n\n), advertiser as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__advertiser`\n\n), campaigns as (\n\n select *\n from __dbt__cte__int_tiktok_ads__most_recent_campaign\n\n), aggregated as (\n\n select\n cast(hourly.stat_time_hour as date) as date_day,\n ad_groups.advertiser_id,\n advertiser.advertiser_name,\n campaigns.campaign_id,\n campaigns.campaign_name,\n ad_groups.ad_group_id,\n ad_groups.ad_group_name,\n hourly.ad_id,\n ads.ad_name,\n advertiser.currency,\n ad_groups.category,\n ad_groups.action_categories,\n ad_groups.gender,\n ad_groups.audience_type,\n ad_groups.budget,\n ad_groups.age,\n ad_groups.languages,\n ad_groups.interest_category,\n sum(hourly.impressions) as impressions,\n sum(hourly.clicks) as clicks,\n sum(hourly.spend) as spend,\n sum(hourly.reach) as reach,\n sum(hourly.conversion) as conversion,\n sum(hourly.likes) as likes,\n sum(hourly.comments) as comments,\n sum(hourly.shares) as shares,\n sum(hourly.profile_visits) as profile_visits,\n sum(hourly.follows) as follows,\n sum(hourly.video_watched_2_s) as video_watched_2_s,\n sum(hourly.video_watched_6_s) as video_watched_6_s,\n sum(hourly.video_views_p_25) as video_views_p_25,\n sum(hourly.video_views_p_50) as video_views_p_50, \n sum(hourly.video_views_p_75) as video_views_p_75,\n sum(hourly.spend)/nullif(sum(hourly.clicks),0) as daily_cpc,\n (sum(hourly.spend)/nullif(sum(hourly.impressions),0))*1000 as daily_cpm,\n (sum(hourly.clicks)/nullif(sum(hourly.impressions),0))*100 as daily_ctr\n \n \n , sum(hourly.REAL_TIME_COST_PER_RESULT) as REAL_TIME_COST_PER_RESULT\n \n from hourly\n left join ads\n on hourly.ad_id = ads.ad_id\n left join ad_groups \n on ads.ad_group_id = ad_groups.ad_group_id\n left join advertiser\n on ads.advertiser_id = advertiser.advertiser_id\n left join campaigns\n on ads.campaign_id = campaigns.campaign_id\n group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18\n\n)\n\nselect *\nfrom aggregated", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}, {"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}, {"id": "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "sql": " __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": "`database`.`dbt_renee_tiktok_ads`.`tiktok_ads__ad_report`"}, "model.tiktok_ads.int_tiktok_ads__most_recent_campaign": {"raw_sql": "with base as (\n\n select *\n from {{ var('campaign_history') }}\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "ephemeral", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_tiktok_ads", "fqn": ["tiktok_ads", "intermediate", "int_tiktok_ads__most_recent_campaign"], "unique_id": "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "intermediate/int_tiktok_ads__most_recent_campaign.sql", "original_file_path": "models/intermediate/int_tiktok_ads__most_recent_campaign.sql", "name": "int_tiktok_ads__most_recent_campaign", "alias": "int_tiktok_ads__most_recent_campaign", "checksum": {"name": "sha256", "checksum": "6c395cfec3d0d6060d64883569154a087d790db7a438b72cea679e96e4fdd220"}, "tags": [], "refs": [["stg_tiktok_ads__campaign_history"]], "sources": [], "description": "Each record in this table represents the most recent data for each campaign.", "columns": {"campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_type": {"name": "campaign_type", "description": "Campaign Type, indicates the campaign is a regular campaign or iOS 14 campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "split_test_variable": {"name": "split_test_variable", "description": "Split Test variables. Optional values; TARGETING, BIDDING_OPTIMIZATION , CREATIVE.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/intermediate/intermediate.yml", "compiled_path": "target/compiled/tiktok_ads/models/intermediate/int_tiktok_ads__most_recent_campaign.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "ephemeral"}, "created_at": 1659025250.331912, "compiled_sql": "with base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null}, "model.tiktok_ads.int_tiktok_ads__most_recent_ad": {"raw_sql": "with base as (\n\n select *\n from {{ var('ad_history') }}\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "ephemeral", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_tiktok_ads", "fqn": ["tiktok_ads", "intermediate", "int_tiktok_ads__most_recent_ad"], "unique_id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "intermediate/int_tiktok_ads__most_recent_ad.sql", "original_file_path": "models/intermediate/int_tiktok_ads__most_recent_ad.sql", "name": "int_tiktok_ads__most_recent_ad", "alias": "int_tiktok_ads__most_recent_ad", "checksum": {"name": "sha256", "checksum": "418d75ad47295f6fe67385f0c94e018602e4028dc4cf52a28e9f7006121ad7d7"}, "tags": [], "refs": [["stg_tiktok_ads__ad_history"]], "sources": [], "description": "Each record in this table represents the most recent data for each ad.", "columns": {"ad_id": {"name": "ad_id", "description": "Ad ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "base_url": {"name": "base_url", "description": "The base URL of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_name": {"name": "ad_name", "description": "Ad Name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_text": {"name": "ad_text", "description": "The ad text.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "call_to_action": {"name": "call_to_action", "description": "Call to action values.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "click_tracking_url": {"name": "click_tracking_url", "description": "Click monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impression_tracking_url": {"name": "impression_tracking_url", "description": "Display monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_host": {"name": "url_host", "description": "The URL host of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_path": {"name": "url_path", "description": "The URL path of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_source": {"name": "utm_source", "description": "The utm_source parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_medium": {"name": "utm_medium", "description": "The utm_medium parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_campaign": {"name": "utm_campaign", "description": "The utm_campaign parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_content": {"name": "utm_content", "description": "The utm_content parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_term": {"name": "utm_term", "description": "The utm_term parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_id": {"name": "video_id", "description": "The video ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/intermediate/intermediate.yml", "compiled_path": "target/compiled/tiktok_ads/models/intermediate/int_tiktok_ads__most_recent_ad.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "ephemeral"}, "created_at": 1659025250.327927, "compiled_sql": "with base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null}, "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group": {"raw_sql": "with base as (\n\n select *\n from {{ var('ad_group_history') }}\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"]}, "config": {"enabled": true, "alias": null, "schema": "tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "ephemeral", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "dbt_renee_tiktok_ads", "fqn": ["tiktok_ads", "intermediate", "int_tiktok_ads__most_recent_ad_group"], "unique_id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "intermediate/int_tiktok_ads__most_recent_ad_group.sql", "original_file_path": "models/intermediate/int_tiktok_ads__most_recent_ad_group.sql", "name": "int_tiktok_ads__most_recent_ad_group", "alias": "int_tiktok_ads__most_recent_ad_group", "checksum": {"name": "sha256", "checksum": "a1d9693e48ac9773013bd17c70506c937b917254481075d677d7e989e9665358"}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_history"]], "sources": [], "description": "Each record in this table represents the most recent data for each ad group.", "columns": {"ad_group_id": {"name": "ad_group_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The Ad group's campaign ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_days": {"name": "action_days", "description": "Action days", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "Ad group name. Character limit is 512 and cannot contain emoji.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "age": {"name": "age", "description": "Age groups you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience_type": {"name": "audience_type", "description": "Audience Type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "category": {"name": "category", "description": "Ad group category.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "display_name": {"name": "display_name", "description": "Display name of ad group.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency": {"name": "frequency", "description": "frequency, together with frequency_schedule, controls how often people see your ad (only available for REACH ads). For example, frequency = 2 frequency_schedule = 3 means \"show ads no more than twice every 3 day\".\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency_schedule": {"name": "frequency_schedule", "description": "frequency, together with frequency, controls how often people see your ad (only available for REACH ads).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_download": {"name": "video_download", "description": "Whether the video is allowed to be downloaded.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "languages": {"name": "languages", "description": "Codes of the languages that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads://models/intermediate/intermediate.yml", "compiled_path": "target/compiled/tiktok_ads/models/intermediate/int_tiktok_ads__most_recent_ad_group.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "tiktok_ads", "materialized": "ephemeral"}, "created_at": 1659025250.3184938, "compiled_sql": "with base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__campaign_report_hourly_tmp') }}\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__campaign_report_hourly_tmp')),\n staging_columns=get_campaign_report_hourly_columns()\n )\n }}\n \n {% for metric in var('tiktok_ads__campaign_hourly_passthrough_metrics', []) %}\n , {{ metric }}\n {% endfor %}\n\n from base\n), \n\nfinal as (\n\n select \n campaign_id,\n cast(stat_time_hour as {{ dbt_utils.type_timestamp() }}) as stat_time_hour,\n cpc, \n cpm,\n ctr, \n impressions, \n clicks, \n spend, \n reach,\n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n \n {% for metric in var('tiktok_ads__campaign_hourly_passthrough_metrics', []) %}\n , {{ metric }}\n {% endfor %}\n from fields\n)\n\nselect *\nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_campaign_report_hourly_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__campaign_report_hourly"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__campaign_report_hourly.sql", "original_file_path": "models/stg_tiktok_ads__campaign_report_hourly.sql", "name": "stg_tiktok_ads__campaign_report_hourly", "alias": "stg_tiktok_ads__campaign_report_hourly", "checksum": {"name": "sha256", "checksum": "c3d7ffdd7ed412450d0cbc955713f686de19fcb3daea3d911adebfa999afa3d8"}, "tags": [], "refs": [["stg_tiktok_ads__campaign_report_hourly_tmp"], ["stg_tiktok_ads__campaign_report_hourly_tmp"]], "sources": [], "description": "Each record represent data for each campaign for each hour.", "columns": {"campaign_id": {"name": "campaign_id", "description": "Campaign id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time per user your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__campaign_report_hourly.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1659025250.605123, "compiled_sql": "with base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_report_hourly_tmp`\n), \n\nfields as (\n\n select\n \n \n \n campaign_id\n \n as \n \n campaign_id\n \n, \n cast(null as \n numeric\n) as \n \n ad_id\n \n , \n \n \n average_video_play\n \n as \n \n average_video_play\n \n, \n \n \n average_video_play_per_user\n \n as \n \n average_video_play_per_user\n \n, \n \n \n clicks\n \n as \n \n clicks\n \n, \n \n \n comments\n \n as \n \n comments\n \n, \n \n \n conversion\n \n as \n \n conversion\n \n, \n \n \n conversion_rate\n \n as \n \n conversion_rate\n \n, \n \n \n cost_per_conversion\n \n as \n \n cost_per_conversion\n \n, \n \n \n cpc\n \n as \n \n cpc\n \n, \n \n \n cpm\n \n as \n \n cpm\n \n, \n \n \n ctr\n \n as \n \n ctr\n \n, \n \n \n follows\n \n as \n \n follows\n \n, \n \n \n impressions\n \n as \n \n impressions\n \n, \n \n \n likes\n \n as \n \n likes\n \n, \n \n \n profile_visits\n \n as \n \n profile_visits\n \n, \n \n \n reach\n \n as \n \n reach\n \n, \n \n \n shares\n \n as \n \n shares\n \n, \n \n \n spend\n \n as \n \n spend\n \n, \n \n \n stat_time_hour\n \n as \n \n stat_time_hour\n \n, \n \n \n video_play_actions\n \n as \n \n video_play_actions\n \n, \n \n \n video_views_p_25\n \n as \n \n video_views_p_25\n \n, \n \n \n video_views_p_50\n \n as \n \n video_views_p_50\n \n, \n \n \n video_views_p_75\n \n as \n \n video_views_p_75\n \n, \n \n \n video_watched_2_s\n \n as \n \n video_watched_2_s\n \n, \n \n \n video_watched_6_s\n \n as \n \n video_watched_6_s\n \n\n\n\n \n \n , result\n \n\n from base\n), \n\nfinal as (\n\n select \n campaign_id,\n cast(stat_time_hour as \n timestamp\n) as stat_time_hour,\n cpc, \n cpm,\n ctr, \n impressions, \n clicks, \n spend, \n reach,\n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n \n \n , result\n \n from fields\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`schema`.`stg_tiktok_ads__campaign_report_hourly`"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__ad_group_report_hourly_tmp') }}\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__ad_group_report_hourly_tmp')),\n staging_columns=get_ad_group_report_hourly_columns()\n )\n }}\n \n {% for metric in var('tiktok_ads__ad_group_hourly_passthrough_metrics', []) %}\n , {{ metric }}\n {% endfor %}\n\n from base\n), \n\nfinal as (\n\n select \n adgroup_id as ad_group_id,\n cast(stat_time_hour as {{ dbt_utils.type_timestamp() }}) as stat_time_hour, \n cpc, \n cpm, \n ctr, \n impressions, \n clicks, \n spend, \n reach, \n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n \n {% for metric in var('tiktok_ads__ad_group_hourly_passthrough_metrics', []) %}\n , {{ metric }}\n {% endfor %}\n from fields\n) \n\nselect *\nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_ad_group_report_hourly_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__ad_group_report_hourly"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__ad_group_report_hourly.sql", "original_file_path": "models/stg_tiktok_ads__ad_group_report_hourly.sql", "name": "stg_tiktok_ads__ad_group_report_hourly", "alias": "stg_tiktok_ads__ad_group_report_hourly", "checksum": {"name": "sha256", "checksum": "764429f47a8429332b579f7283748ef905957598d215522ec8d85a2c666fed0f"}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_report_hourly_tmp"], ["stg_tiktok_ads__ad_group_report_hourly_tmp"]], "sources": [], "description": "Each record represents data for each ad group for each hour.", "columns": {"ad_group_id": {"name": "ad_group_id", "description": "Ad group id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time per user your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__ad_group_report_hourly.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1659025250.591536, "compiled_sql": "with base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_group_report_hourly_tmp`\n), \n\nfields as (\n\n select\n \n \n \n adgroup_id\n \n as \n \n adgroup_id\n \n, \n \n \n average_video_play\n \n as \n \n average_video_play\n \n, \n \n \n average_video_play_per_user\n \n as \n \n average_video_play_per_user\n \n, \n \n \n clicks\n \n as \n \n clicks\n \n, \n \n \n comments\n \n as \n \n comments\n \n, \n \n \n conversion\n \n as \n \n conversion\n \n, \n \n \n conversion_rate\n \n as \n \n conversion_rate\n \n, \n \n \n cost_per_conversion\n \n as \n \n cost_per_conversion\n \n, \n \n \n cpc\n \n as \n \n cpc\n \n, \n \n \n cpm\n \n as \n \n cpm\n \n, \n \n \n ctr\n \n as \n \n ctr\n \n, \n \n \n follows\n \n as \n \n follows\n \n, \n \n \n impressions\n \n as \n \n impressions\n \n, \n \n \n likes\n \n as \n \n likes\n \n, \n \n \n profile_visits\n \n as \n \n profile_visits\n \n, \n \n \n reach\n \n as \n \n reach\n \n, \n \n \n shares\n \n as \n \n shares\n \n, \n \n \n spend\n \n as \n \n spend\n \n, \n \n \n stat_time_hour\n \n as \n \n stat_time_hour\n \n, \n \n \n video_play_actions\n \n as \n \n video_play_actions\n \n, \n \n \n video_views_p_25\n \n as \n \n video_views_p_25\n \n, \n \n \n video_views_p_50\n \n as \n \n video_views_p_50\n \n, \n \n \n video_views_p_75\n \n as \n \n video_views_p_75\n \n, \n \n \n video_watched_2_s\n \n as \n \n video_watched_2_s\n \n, \n \n \n video_watched_6_s\n \n as \n \n video_watched_6_s\n \n\n\n\n \n \n , result\n \n\n from base\n), \n\nfinal as (\n\n select \n adgroup_id as ad_group_id,\n cast(stat_time_hour as \n timestamp\n) as stat_time_hour, \n cpc, \n cpm, \n ctr, \n impressions, \n clicks, \n spend, \n reach, \n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n \n \n , result\n \n from fields\n) \n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`schema`.`stg_tiktok_ads__ad_group_report_hourly`"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__ad_group_history_tmp') }}\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__ad_group_history_tmp')),\n staging_columns=get_ad_group_history_columns()\n )\n }}\n\n from base\n), \n\nfinal as (\n\n select\n adgroup_id as ad_group_id,\n cast(updated_at as {{ dbt_utils.type_timestamp() }}) as updated_at,\n advertiser_id,\n campaign_id,\n action_days,\n action_categories,\n adgroup_name as ad_group_name,\n age,\n audience_type,\n budget,\n category,\n display_name,\n interest_category_v_2 as interest_category,\n frequency,\n frequency_schedule,\n gender,\n languages, \n landing_page_url\n from fields\n), \n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by ad_group_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n)\n\nselect * from most_recent", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_ad_group_history_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__ad_group_history"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__ad_group_history.sql", "original_file_path": "models/stg_tiktok_ads__ad_group_history.sql", "name": "stg_tiktok_ads__ad_group_history", "alias": "stg_tiktok_ads__ad_group_history", "checksum": {"name": "sha256", "checksum": "9175d821a78b78d0aa0a1d79455563d95dd7ef8276aa6fb986257d4c4acd0a36"}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_history_tmp"], ["stg_tiktok_ads__ad_group_history_tmp"]], "sources": [], "description": "Each record represents data for each ad group.", "columns": {"ad_group_id": {"name": "ad_group_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_categories": {"name": "action_categories", "description": "IDs of the action categories (behaviors) that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The Ad group's campaign ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_days": {"name": "action_days", "description": "Action days", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "Ad group name. Character limit is 512 and cannot contain emoji.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "age": {"name": "age", "description": "Age groups you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience_type": {"name": "audience_type", "description": "Audience Type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget": {"name": "budget", "description": "Ad budget. Returns 0.0 when Campaign Budget Optimization (budget_optimize_switch) is on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "category": {"name": "category", "description": "Ad group category.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "display_name": {"name": "display_name", "description": "Display name of ad group.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "interest_category": {"name": "interest_category", "description": "Interest classification. If the interest is specified, users that do not meet interest target will be excluded during delivery.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency": {"name": "frequency", "description": "frequency, together with frequency_schedule, controls how often people see your ad (only available for REACH ads). For example, frequency = 2 frequency_schedule = 3 means \"show ads no more than twice every 3 day\".\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency_schedule": {"name": "frequency_schedule", "description": "frequency, together with frequency, controls how often people see your ad (only available for REACH ads).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "languages": {"name": "languages", "description": "Codes of the languages that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__ad_group_history.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1659025250.542208, "compiled_sql": "with base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_group_history_tmp`\n), \n\nfields as (\n\n select\n \n \n \n action_days\n \n as \n \n action_days\n \n, \n \n \n adgroup_id\n \n as \n \n adgroup_id\n \n, \n \n \n adgroup_name\n \n as \n \n adgroup_name\n \n, \n \n \n advertiser_id\n \n as \n \n advertiser_id\n \n, \n \n \n audience_type\n \n as \n \n audience_type\n \n, \n \n \n budget\n \n as \n \n budget\n \n, \n \n \n campaign_id\n \n as \n \n campaign_id\n \n, \n \n \n category\n \n as \n \n category\n \n, \n \n \n display_name\n \n as \n \n display_name\n \n, \n \n \n frequency\n \n as \n \n frequency\n \n, \n \n \n frequency_schedule\n \n as \n \n frequency_schedule\n \n, \n \n \n gender\n \n as \n \n gender\n \n, \n \n \n landing_page_url\n \n as \n \n landing_page_url\n \n, \n \n \n updated_at\n \n as \n \n updated_at\n \n, \n \n \n interest_category_v_2\n \n as \n \n interest_category_v_2\n \n, \n \n \n action_categories\n \n as \n \n action_categories\n \n, \n \n \n age\n \n as \n \n age\n \n, \n \n \n languages\n \n as \n \n languages\n \n\n\n\n\n from base\n), \n\nfinal as (\n\n select\n adgroup_id as ad_group_id,\n cast(updated_at as \n timestamp\n) as updated_at,\n advertiser_id,\n campaign_id,\n action_days,\n action_categories,\n adgroup_name as ad_group_name,\n age,\n audience_type,\n budget,\n category,\n display_name,\n interest_category_v_2 as interest_category,\n frequency,\n frequency_schedule,\n gender,\n languages, \n landing_page_url\n from fields\n), \n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by ad_group_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n)\n\nselect * from most_recent", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`schema`.`stg_tiktok_ads__ad_group_history`"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__ad_report_hourly_tmp') }}\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__ad_report_hourly_tmp')),\n staging_columns=get_ad_report_hourly_columns()\n )\n }}\n \n {% for metric in var('tiktok_ads__ad_hourly_passthrough_metrics', []) %}\n , {{ metric }}\n {% endfor %}\n\n from base\n), \n\nfinal as (\n\n select \n ad_id, \n cast(stat_time_hour as {{ dbt_utils.type_timestamp() }}) as stat_time_hour, \n cpc, \n cpm, \n ctr, \n impressions, \n clicks, \n spend, \n reach, \n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n \n {% for metric in var('tiktok_ads__ad_hourly_passthrough_metrics', []) %}\n , {{ metric }}\n {% endfor %}\n from fields\n)\n\nselect * \nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_ad_report_hourly_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__ad_report_hourly"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__ad_report_hourly.sql", "original_file_path": "models/stg_tiktok_ads__ad_report_hourly.sql", "name": "stg_tiktok_ads__ad_report_hourly", "alias": "stg_tiktok_ads__ad_report_hourly", "checksum": {"name": "sha256", "checksum": "c6433e7e84959d7da8a1262126ef554a23eee701cf551f21306f5ac08af7d1da"}, "tags": [], "refs": [["stg_tiktok_ads__ad_report_hourly_tmp"], ["stg_tiktok_ads__ad_report_hourly_tmp"]], "sources": [], "description": "Each record represents data for each ad for each hour.", "columns": {"ad_id": {"name": "ad_id", "description": "Ad id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time per user your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__ad_report_hourly.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1659025250.5772932, "compiled_sql": "with base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_report_hourly_tmp`\n), \n\nfields as (\n\n select\n \n \n \n ad_id\n \n as \n \n ad_id\n \n, \n \n \n average_video_play\n \n as \n \n average_video_play\n \n, \n \n \n average_video_play_per_user\n \n as \n \n average_video_play_per_user\n \n, \n \n \n clicks\n \n as \n \n clicks\n \n, \n \n \n comments\n \n as \n \n comments\n \n, \n \n \n conversion\n \n as \n \n conversion\n \n, \n \n \n conversion_rate\n \n as \n \n conversion_rate\n \n, \n \n \n cost_per_conversion\n \n as \n \n cost_per_conversion\n \n, \n \n \n cpc\n \n as \n \n cpc\n \n, \n \n \n cpm\n \n as \n \n cpm\n \n, \n \n \n ctr\n \n as \n \n ctr\n \n, \n \n \n follows\n \n as \n \n follows\n \n, \n \n \n impressions\n \n as \n \n impressions\n \n, \n \n \n likes\n \n as \n \n likes\n \n, \n \n \n profile_visits\n \n as \n \n profile_visits\n \n, \n \n \n reach\n \n as \n \n reach\n \n, \n \n \n shares\n \n as \n \n shares\n \n, \n \n \n spend\n \n as \n \n spend\n \n, \n \n \n stat_time_hour\n \n as \n \n stat_time_hour\n \n, \n \n \n video_play_actions\n \n as \n \n video_play_actions\n \n, \n \n \n video_views_p_25\n \n as \n \n video_views_p_25\n \n, \n \n \n video_views_p_50\n \n as \n \n video_views_p_50\n \n, \n \n \n video_views_p_75\n \n as \n \n video_views_p_75\n \n, \n \n \n video_watched_2_s\n \n as \n \n video_watched_2_s\n \n, \n \n \n video_watched_6_s\n \n as \n \n video_watched_6_s\n \n\n\n\n \n \n , REAL_TIME_COST_PER_RESULT\n \n\n from base\n), \n\nfinal as (\n\n select \n ad_id, \n cast(stat_time_hour as \n timestamp\n) as stat_time_hour, \n cpc, \n cpm, \n ctr, \n impressions, \n clicks, \n spend, \n reach, \n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n \n \n , REAL_TIME_COST_PER_RESULT\n \n from fields\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`schema`.`stg_tiktok_ads__ad_report_hourly`"}, "model.tiktok_ads_source.stg_tiktok_ads__advertiser": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__advertiser_tmp') }}\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__advertiser_tmp')),\n staging_columns=get_advertiser_columns()\n )\n }}\n\n from base\n),\n\nfinal as (\n\n select \n id as advertiser_id, \n address, \n balance, \n company, \n contacter, \n country, \n currency, \n description, \n email, \n industry, \n language,\n name as advertiser_name, \n phone_number, \n telephone, \n timezone\n from fields\n)\n\nselect *\nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_advertiser_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp", "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__advertiser"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__advertiser.sql", "original_file_path": "models/stg_tiktok_ads__advertiser.sql", "name": "stg_tiktok_ads__advertiser", "alias": "stg_tiktok_ads__advertiser", "checksum": {"name": "sha256", "checksum": "300666e61406b8816159808ea46adfc61484cf4f9e46a171255e6f7db94bd8f5"}, "tags": [], "refs": [["stg_tiktok_ads__advertiser_tmp"], ["stg_tiktok_ads__advertiser_tmp"]], "sources": [], "description": "Each record represents data for each advertiser.", "columns": {"advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "address": {"name": "address", "description": "Advertiser address information", "meta": {}, "data_type": null, "quote": null, "tags": []}, "balance": {"name": "balance", "description": "Account available balance", "meta": {}, "data_type": null, "quote": null, "tags": []}, "company": {"name": "company", "description": "Advertiser's company name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "contacter": {"name": "contacter", "description": "Contact Person", "meta": {}, "data_type": null, "quote": null, "tags": []}, "country": {"name": "country", "description": "The advertiser's country", "meta": {}, "data_type": null, "quote": null, "tags": []}, "create_time": {"name": "create_time", "description": "Advertiser's create time", "meta": {}, "data_type": null, "quote": null, "tags": []}, "currency": {"name": "currency", "description": "Type of currency used by advertisers", "meta": {}, "data_type": null, "quote": null, "tags": []}, "description": {"name": "description", "description": "Brand description, i.e. promotional content", "meta": {}, "data_type": null, "quote": null, "tags": []}, "email": {"name": "email", "description": "Advertiser contact email, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "industry": {"name": "industry", "description": "Advertiser industry category", "meta": {}, "data_type": null, "quote": null, "tags": []}, "language": {"name": "language", "description": "Language used by advertisers", "meta": {}, "data_type": null, "quote": null, "tags": []}, "license_no": {"name": "license_no", "description": "License number", "meta": {}, "data_type": null, "quote": null, "tags": []}, "license_url": {"name": "license_url", "description": "License preview address, the link is valid for an hour by default.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_name": {"name": "advertiser_name", "description": "Advertiser name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "phone_number": {"name": "phone_number", "description": "Contact mobile number, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "telephone": {"name": "telephone", "description": "Fixed phone number, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "timezone": {"name": "timezone", "description": "Ad account time zone including GMT offset", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__advertiser.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1659025250.53167, "compiled_sql": "with base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__advertiser_tmp`\n), \n\nfields as (\n\n select\n \n \n \n address\n \n as \n \n address\n \n, \n \n \n balance\n \n as \n \n balance\n \n, \n \n \n company\n \n as \n \n company\n \n, \n \n \n contacter\n \n as \n \n contacter\n \n, \n \n \n country\n \n as \n \n country\n \n, \n \n \n currency\n \n as \n \n currency\n \n, \n \n \n description\n \n as \n \n description\n \n, \n \n \n email\n \n as \n \n email\n \n, \n \n \n id\n \n as \n \n id\n \n, \n \n \n industry\n \n as \n \n industry\n \n, \n \n \n language\n \n as \n \n language\n \n, \n \n \n name\n \n as \n \n name\n \n, \n \n \n phone_number\n \n as \n \n phone_number\n \n, \n \n \n telephone\n \n as \n \n telephone\n \n, \n \n \n timezone\n \n as \n \n timezone\n \n\n\n\n\n from base\n),\n\nfinal as (\n\n select \n id as advertiser_id, \n address, \n balance, \n company, \n contacter, \n country, \n currency, \n description, \n email, \n industry, \n language,\n name as advertiser_name, \n phone_number, \n telephone, \n timezone\n from fields\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`schema`.`stg_tiktok_ads__advertiser`"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_history": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__ad_history_tmp') }}\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__ad_history_tmp')),\n staging_columns=get_ad_history_columns()\n )\n }}\n\n from base\n), \n\nfinal as (\n\n select \n ad_id,\n cast(updated_at as {{ dbt_utils.type_timestamp() }}) as updated_at,\n adgroup_id as ad_group_id,\n advertiser_id,\n campaign_id,\n ad_name,\n call_to_action,\n click_tracking_url,\n impression_tracking_url,\n {{ dbt_utils.split_part('landing_page_url', \"'?'\", 1) }} as base_url,\n {{ dbt_utils.get_url_host('landing_page_url') }} as url_host,\n '/' || {{ dbt_utils.get_url_path('landing_page_url') }} as url_path,\n {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_source') }} as utm_source,\n {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_medium') }} as utm_medium,\n {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_campaign') }} as utm_campaign,\n {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_content') }} as utm_content,\n {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_term') }} as utm_term,\n landing_page_url\n from fields\n), \n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by ad_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n)\n\nselect * \nfrom most_recent", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_ad_history_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp", "macro.dbt_utils.split_part", "macro.dbt_utils.get_url_host", "macro.dbt_utils.get_url_path", "macro.dbt_utils.get_url_parameter"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__ad_history"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__ad_history.sql", "original_file_path": "models/stg_tiktok_ads__ad_history.sql", "name": "stg_tiktok_ads__ad_history", "alias": "stg_tiktok_ads__ad_history", "checksum": {"name": "sha256", "checksum": "8d980a128704aea99662ccd2b8face0d3290e428948cee76a082aaea2d43cc64"}, "tags": [], "refs": [["stg_tiktok_ads__ad_history_tmp"], ["stg_tiktok_ads__ad_history_tmp"]], "sources": [], "description": "Each record represents data for each ad.", "columns": {"ad_id": {"name": "ad_id", "description": "Ad ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "base_url": {"name": "base_url", "description": "The base URL of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_name": {"name": "ad_name", "description": "Ad Name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "call_to_action": {"name": "call_to_action", "description": "Call to action values.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "click_tracking_url": {"name": "click_tracking_url", "description": "Click monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impression_tracking_url": {"name": "impression_tracking_url", "description": "Display monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_host": {"name": "url_host", "description": "The URL host of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_path": {"name": "url_path", "description": "The URL path of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_source": {"name": "utm_source", "description": "The utm_source parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_medium": {"name": "utm_medium", "description": "The utm_medium parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_campaign": {"name": "utm_campaign", "description": "The utm_campaign parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_content": {"name": "utm_content", "description": "The utm_content parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_term": {"name": "utm_term", "description": "The utm_term parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__ad_history.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1659025250.558231, "compiled_sql": "with base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_history_tmp`\n), \n\nfields as (\n\n select\n \n \n \n ad_id\n \n as \n \n ad_id\n \n, \n \n \n ad_name\n \n as \n \n ad_name\n \n, \n \n \n adgroup_id\n \n as \n \n adgroup_id\n \n, \n \n \n advertiser_id\n \n as \n \n advertiser_id\n \n, \n \n \n call_to_action\n \n as \n \n call_to_action\n \n, \n \n \n campaign_id\n \n as \n \n campaign_id\n \n, \n \n \n click_tracking_url\n \n as \n \n click_tracking_url\n \n, \n \n \n impression_tracking_url\n \n as \n \n impression_tracking_url\n \n, \n \n \n landing_page_url\n \n as \n \n landing_page_url\n \n, \n \n \n updated_at\n \n as \n \n updated_at\n \n\n\n\n\n from base\n), \n\nfinal as (\n\n select \n ad_id,\n cast(updated_at as \n timestamp\n) as updated_at,\n adgroup_id as ad_group_id,\n advertiser_id,\n campaign_id,\n ad_name,\n call_to_action,\n click_tracking_url,\n impression_tracking_url,\n \n\n \n split(\n landing_page_url,\n '?'\n )[safe_offset(0)]\n \n\n as base_url,\n \n safe_cast(\n\n \n split(\n \n\n \n split(\n \n\n replace(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'android-app://',\n ''\n )\n \n\n,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n '/'\n )[safe_offset(0)]\n \n\n,\n '?'\n )[safe_offset(0)]\n \n\n as \n string\n)\n as url_host,\n '/' || \n safe_cast(\n\n \n split(\n \n\n case when \n \n length(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n\n )-coalesce(\n nullif(\n\n strpos(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n '/'\n \n ), 0),\n \n\n strpos(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n '?'\n \n ) - 1\n ) = 0 \n then ''\n else \n substr(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n -1 * (\n \n length(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n\n )-coalesce(\n nullif(\n\n strpos(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n '/'\n \n ), 0),\n \n\n strpos(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n '?'\n \n ) - 1\n ))\n )\n end,\n '?'\n )[safe_offset(0)]\n \n\n as \n string\n)\n as url_path,\n nullif(\n\n \n split(\n \n\n \n split(\n landing_page_url,\n 'utm_source='\n )[safe_offset(1)]\n \n\n,\n '&'\n )[safe_offset(0)]\n \n\n,'') as utm_source,\n nullif(\n\n \n split(\n \n\n \n split(\n landing_page_url,\n 'utm_medium='\n )[safe_offset(1)]\n \n\n,\n '&'\n )[safe_offset(0)]\n \n\n,'') as utm_medium,\n nullif(\n\n \n split(\n \n\n \n split(\n landing_page_url,\n 'utm_campaign='\n )[safe_offset(1)]\n \n\n,\n '&'\n )[safe_offset(0)]\n \n\n,'') as utm_campaign,\n nullif(\n\n \n split(\n \n\n \n split(\n landing_page_url,\n 'utm_content='\n )[safe_offset(1)]\n \n\n,\n '&'\n )[safe_offset(0)]\n \n\n,'') as utm_content,\n nullif(\n\n \n split(\n \n\n \n split(\n landing_page_url,\n 'utm_term='\n )[safe_offset(1)]\n \n\n,\n '&'\n )[safe_offset(0)]\n \n\n,'') as utm_term,\n landing_page_url\n from fields\n), \n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by ad_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n)\n\nselect * \nfrom most_recent", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`schema`.`stg_tiktok_ads__ad_history`"}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_history": {"raw_sql": "with base as (\n\n select *\n from {{ ref('stg_tiktok_ads__campaign_history_tmp') }}\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__campaign_history_tmp')),\n staging_columns=get_campaign_history_columns()\n )\n }}\n \n from base\n), \n\nfinal as (\n\n select \n campaign_id, \n cast(updated_at as {{ dbt_utils.type_timestamp() }}) as updated_at,\n advertiser_id, \n campaign_name, \n campaign_type, \n split_test_variable\n from fields\n), \n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by campaign_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n)\n\nselect *\nfrom most_recent", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_campaign_history_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__campaign_history"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__campaign_history.sql", "original_file_path": "models/stg_tiktok_ads__campaign_history.sql", "name": "stg_tiktok_ads__campaign_history", "alias": "stg_tiktok_ads__campaign_history", "checksum": {"name": "sha256", "checksum": "ba45d9210281370b9d7245597425dbaa1b356f95baa788c44579abbb0fc835ad"}, "tags": [], "refs": [["stg_tiktok_ads__campaign_history_tmp"], ["stg_tiktok_ads__campaign_history_tmp"]], "sources": [], "description": "Each record represents data for each campaign.", "columns": {"campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_type": {"name": "campaign_type", "description": "Campaign Type, indicates the campaign is a regular campaign or iOS 14 campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "split_test_variable": {"name": "split_test_variable", "description": "Split Test variables. Optional values; TARGETING, BIDDING_OPTIMIZATION , CREATIVE.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__campaign_history.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads"}, "created_at": 1659025250.562881, "compiled_sql": "with base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_history_tmp`\n), \n\nfields as (\n\n select\n \n \n \n advertiser_id\n \n as \n \n advertiser_id\n \n, \n \n \n campaign_id\n \n as \n \n campaign_id\n \n, \n \n \n campaign_name\n \n as \n \n campaign_name\n \n, \n \n \n campaign_type\n \n as \n \n campaign_type\n \n, \n \n \n split_test_variable\n \n as \n \n split_test_variable\n \n, \n \n \n updated_at\n \n as \n \n updated_at\n \n\n\n\n \n from base\n), \n\nfinal as (\n\n select \n campaign_id, \n cast(updated_at as \n timestamp\n) as updated_at,\n advertiser_id, \n campaign_name, \n campaign_type, \n split_test_variable\n from fields\n), \n\nmost_recent as (\n\n select \n *,\n row_number() over (partition by campaign_id order by updated_at desc) = 1 as is_most_recent_record\n from final\n)\n\nselect *\nfrom most_recent", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`schema`.`stg_tiktok_ads__campaign_history`"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp": {"raw_sql": "select *\nfrom {{ var('ad_report_hourly') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.tiktok_ads_source.tiktok_ads.ad_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__ad_report_hourly_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__ad_report_hourly_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__ad_report_hourly_tmp.sql", "name": "stg_tiktok_ads__ad_report_hourly_tmp", "alias": "stg_tiktok_ads__ad_report_hourly_tmp", "checksum": {"name": "sha256", "checksum": "a487182a6ea56715aff4fb53a16e8e185223097096f8b06c53beeaf354bffb3f"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "ad_report_hourly"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_report_hourly_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1659025250.136051, "compiled_sql": "select *\nfrom `database`.`tiktok_ads_joe`.`ad_report_hourly`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`schema`.`stg_tiktok_ads__ad_report_hourly_tmp`"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp": {"raw_sql": "select *\nfrom {{ var('ad_history') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.tiktok_ads_source.tiktok_ads.ad_history"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__ad_history_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__ad_history_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__ad_history_tmp.sql", "name": "stg_tiktok_ads__ad_history_tmp", "alias": "stg_tiktok_ads__ad_history_tmp", "checksum": {"name": "sha256", "checksum": "a57ca2d986b3dbad7d2bbd8b0a0dd7c992c25bc5cda65daee19e3541f40b6890"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "ad_history"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_history_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1659025250.141647, "compiled_sql": "select *\nfrom `database`.`tiktok_ads_joe`.`ad_history`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`schema`.`stg_tiktok_ads__ad_history_tmp`"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp": {"raw_sql": "select *\nfrom {{ var('ad_group_history') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.tiktok_ads_source.tiktok_ads.adgroup_history"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__ad_group_history_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__ad_group_history_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__ad_group_history_tmp.sql", "name": "stg_tiktok_ads__ad_group_history_tmp", "alias": "stg_tiktok_ads__ad_group_history_tmp", "checksum": {"name": "sha256", "checksum": "b3d1b8772b0465ed063cfa1f77cb9384475c21fa4ac9f970065e3da5c327ad1a"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "adgroup_history"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_group_history_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1659025250.146827, "compiled_sql": "select *\nfrom `database`.`tiktok_ads_joe`.`adgroup_history`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`schema`.`stg_tiktok_ads__ad_group_history_tmp`"}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp": {"raw_sql": "select *\nfrom {{ var('campaign_report_hourly') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.tiktok_ads_source.tiktok_ads.campaign_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__campaign_report_hourly_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__campaign_report_hourly_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__campaign_report_hourly_tmp.sql", "name": "stg_tiktok_ads__campaign_report_hourly_tmp", "alias": "stg_tiktok_ads__campaign_report_hourly_tmp", "checksum": {"name": "sha256", "checksum": "198e8d143514167295dfe352776c5050850cb7bc60e46b122a6a0a0da08a14ce"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "campaign_report_hourly"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__campaign_report_hourly_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1659025250.1522691, "compiled_sql": "select *\nfrom `database`.`tiktok_ads_joe`.`campaign_report_hourly`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`schema`.`stg_tiktok_ads__campaign_report_hourly_tmp`"}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp": {"raw_sql": "select *\nfrom {{ var('ad_group_hourly') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__ad_group_report_hourly_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__ad_group_report_hourly_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__ad_group_report_hourly_tmp.sql", "name": "stg_tiktok_ads__ad_group_report_hourly_tmp", "alias": "stg_tiktok_ads__ad_group_report_hourly_tmp", "checksum": {"name": "sha256", "checksum": "187c3f6f290dd9846646843a108714a51fff1700c838c4c7e58852db64a1edfd"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "adgroup_report_hourly"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_group_report_hourly_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1659025250.157234, "compiled_sql": "select *\nfrom `database`.`tiktok_ads_joe`.`adgroup_report_hourly`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`schema`.`stg_tiktok_ads__ad_group_report_hourly_tmp`"}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp": {"raw_sql": "select *\nfrom {{ var('campaign_history') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.tiktok_ads_source.tiktok_ads.campaign_history"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__campaign_history_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__campaign_history_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__campaign_history_tmp.sql", "name": "stg_tiktok_ads__campaign_history_tmp", "alias": "stg_tiktok_ads__campaign_history_tmp", "checksum": {"name": "sha256", "checksum": "d695c134485444137d663f41732085a5cfa81de49f3ec2676e9f8e58f1c62c02"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "campaign_history"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__campaign_history_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1659025250.162176, "compiled_sql": "select *\nfrom `database`.`tiktok_ads_joe`.`campaign_history`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`schema`.`stg_tiktok_ads__campaign_history_tmp`"}, "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp": {"raw_sql": "select *\nfrom {{ var('advertiser') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.tiktok_ads_source.tiktok_ads.advertiser"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "database", "schema": "schema", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__advertiser_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__advertiser_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__advertiser_tmp.sql", "name": "stg_tiktok_ads__advertiser_tmp", "alias": "stg_tiktok_ads__advertiser_tmp", "checksum": {"name": "sha256", "checksum": "2806a63477df7962ac6a4476e3e514a47ae56470e95f490e88b58696a99c2fcf"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "advertiser"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__advertiser_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads"}, "created_at": 1659025250.166961, "compiled_sql": "select *\nfrom `database`.`tiktok_ads_joe`.`advertiser`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`database`.`schema`.`stg_tiktok_ads__advertiser_tmp`"}, "test.tiktok_ads.not_null_tiktok_ads__account_report_date_day.5a77812746": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "date_day", "model": "{{ get_where_subquery(ref('tiktok_ads__account_report')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__account_report"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "not_null_tiktok_ads__account_report_date_day"], "unique_id": "test.tiktok_ads.not_null_tiktok_ads__account_report_date_day.5a77812746", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_tiktok_ads__account_report_date_day.sql", "original_file_path": "models/tiktok_ads.yml", "name": "not_null_tiktok_ads__account_report_date_day", "alias": "not_null_tiktok_ads__account_report_date_day", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__account_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/not_null_tiktok_ads__account_report_date_day.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.257969, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`dbt_renee_tiktok_ads`.`tiktok_ads__account_report`\nwhere date_day is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "date_day", "file_key_name": "models.tiktok_ads__account_report"}, "test.tiktok_ads.not_null_tiktok_ads__account_report_advertiser_id.bbeabada6f": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "advertiser_id", "model": "{{ get_where_subquery(ref('tiktok_ads__account_report')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__account_report"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "not_null_tiktok_ads__account_report_advertiser_id"], "unique_id": "test.tiktok_ads.not_null_tiktok_ads__account_report_advertiser_id.bbeabada6f", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_tiktok_ads__account_report_advertiser_id.sql", "original_file_path": "models/tiktok_ads.yml", "name": "not_null_tiktok_ads__account_report_advertiser_id", "alias": "not_null_tiktok_ads__account_report_advertiser_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__account_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/not_null_tiktok_ads__account_report_advertiser_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.260212, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`dbt_renee_tiktok_ads`.`tiktok_ads__account_report`\nwhere advertiser_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "advertiser_id", "file_key_name": "models.tiktok_ads__account_report"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__account_report_advertiser_id__date_day.7b27a2f43b": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_e775e605c8835d2fdc47cf9d0cf5ee54\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["advertiser_id", "date_day"], "model": "{{ get_where_subquery(ref('tiktok_ads__account_report')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__account_report"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_e775e605c8835d2fdc47cf9d0cf5ee54", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "dbt_utils_unique_combination_of_columns_tiktok_ads__account_report_advertiser_id__date_day"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__account_report_advertiser_id__date_day.7b27a2f43b", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_e775e605c8835d2fdc47cf9d0cf5ee54.sql", "original_file_path": "models/tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_tiktok_ads__account_report_advertiser_id__date_day", "alias": "dbt_utils_unique_combination_o_e775e605c8835d2fdc47cf9d0cf5ee54", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__account_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/dbt_utils_unique_combination_o_e775e605c8835d2fdc47cf9d0cf5ee54.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_e775e605c8835d2fdc47cf9d0cf5ee54"}, "created_at": 1659025250.26227, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n advertiser_id, date_day\n from `database`.`dbt_renee_tiktok_ads`.`tiktok_ads__account_report`\n group by advertiser_id, date_day\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.tiktok_ads__account_report"}, "test.tiktok_ads.not_null_tiktok_ads__ad_report_date_day.d61ee4a5ed": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "date_day", "model": "{{ get_where_subquery(ref('tiktok_ads__ad_report')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__ad_report"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "not_null_tiktok_ads__ad_report_date_day"], "unique_id": "test.tiktok_ads.not_null_tiktok_ads__ad_report_date_day.d61ee4a5ed", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_tiktok_ads__ad_report_date_day.sql", "original_file_path": "models/tiktok_ads.yml", "name": "not_null_tiktok_ads__ad_report_date_day", "alias": "not_null_tiktok_ads__ad_report_date_day", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__ad_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/not_null_tiktok_ads__ad_report_date_day.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.275629, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`dbt_renee_tiktok_ads`.`tiktok_ads__ad_report`\nwhere date_day is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "date_day", "file_key_name": "models.tiktok_ads__ad_report"}, "test.tiktok_ads.not_null_tiktok_ads__ad_report_ad_id.2d8166e707": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_id", "model": "{{ get_where_subquery(ref('tiktok_ads__ad_report')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__ad_report"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "not_null_tiktok_ads__ad_report_ad_id"], "unique_id": "test.tiktok_ads.not_null_tiktok_ads__ad_report_ad_id.2d8166e707", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_tiktok_ads__ad_report_ad_id.sql", "original_file_path": "models/tiktok_ads.yml", "name": "not_null_tiktok_ads__ad_report_ad_id", "alias": "not_null_tiktok_ads__ad_report_ad_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__ad_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/not_null_tiktok_ads__ad_report_ad_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.27732, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`dbt_renee_tiktok_ads`.`tiktok_ads__ad_report`\nwhere ad_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ad_id", "file_key_name": "models.tiktok_ads__ad_report"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_report_ad_id__date_day.15357fac89": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_056f22d77c1daa2b10c2ecadca5404c3\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_id", "date_day"], "model": "{{ get_where_subquery(ref('tiktok_ads__ad_report')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__ad_report"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_056f22d77c1daa2b10c2ecadca5404c3", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "dbt_utils_unique_combination_of_columns_tiktok_ads__ad_report_ad_id__date_day"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_report_ad_id__date_day.15357fac89", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_056f22d77c1daa2b10c2ecadca5404c3.sql", "original_file_path": "models/tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_tiktok_ads__ad_report_ad_id__date_day", "alias": "dbt_utils_unique_combination_o_056f22d77c1daa2b10c2ecadca5404c3", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__ad_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/dbt_utils_unique_combination_o_056f22d77c1daa2b10c2ecadca5404c3.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_056f22d77c1daa2b10c2ecadca5404c3"}, "created_at": 1659025250.2791302, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n ad_id, date_day\n from `database`.`dbt_renee_tiktok_ads`.`tiktok_ads__ad_report`\n group by ad_id, date_day\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.tiktok_ads__ad_report"}, "test.tiktok_ads.not_null_tiktok_ads__ad_group_report_date_day.e39164964e": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "date_day", "model": "{{ get_where_subquery(ref('tiktok_ads__ad_group_report')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__ad_group_report"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "not_null_tiktok_ads__ad_group_report_date_day"], "unique_id": "test.tiktok_ads.not_null_tiktok_ads__ad_group_report_date_day.e39164964e", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_tiktok_ads__ad_group_report_date_day.sql", "original_file_path": "models/tiktok_ads.yml", "name": "not_null_tiktok_ads__ad_group_report_date_day", "alias": "not_null_tiktok_ads__ad_group_report_date_day", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__ad_group_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/not_null_tiktok_ads__ad_group_report_date_day.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.283883, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`dbt_renee_tiktok_ads`.`tiktok_ads__ad_group_report`\nwhere date_day is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "date_day", "file_key_name": "models.tiktok_ads__ad_group_report"}, "test.tiktok_ads.not_null_tiktok_ads__ad_group_report_ad_group_id.17fb8710f4": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_group_id", "model": "{{ get_where_subquery(ref('tiktok_ads__ad_group_report')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__ad_group_report"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "not_null_tiktok_ads__ad_group_report_ad_group_id"], "unique_id": "test.tiktok_ads.not_null_tiktok_ads__ad_group_report_ad_group_id.17fb8710f4", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_tiktok_ads__ad_group_report_ad_group_id.sql", "original_file_path": "models/tiktok_ads.yml", "name": "not_null_tiktok_ads__ad_group_report_ad_group_id", "alias": "not_null_tiktok_ads__ad_group_report_ad_group_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__ad_group_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/not_null_tiktok_ads__ad_group_report_ad_group_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.285575, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`dbt_renee_tiktok_ads`.`tiktok_ads__ad_group_report`\nwhere ad_group_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ad_group_id", "file_key_name": "models.tiktok_ads__ad_group_report"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day.2eb4c2ff6d": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_72fdc194de3164f205583879773e492a\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_group_id", "date_day"], "model": "{{ get_where_subquery(ref('tiktok_ads__ad_group_report')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__ad_group_report"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_72fdc194de3164f205583879773e492a", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day.2eb4c2ff6d", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_72fdc194de3164f205583879773e492a.sql", "original_file_path": "models/tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day", "alias": "dbt_utils_unique_combination_o_72fdc194de3164f205583879773e492a", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__ad_group_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/dbt_utils_unique_combination_o_72fdc194de3164f205583879773e492a.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_72fdc194de3164f205583879773e492a"}, "created_at": 1659025250.287495, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n ad_group_id, date_day\n from `database`.`dbt_renee_tiktok_ads`.`tiktok_ads__ad_group_report`\n group by ad_group_id, date_day\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.tiktok_ads__ad_group_report"}, "test.tiktok_ads.not_null_tiktok_ads__campaign_report_date_day.3807b0e836": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "date_day", "model": "{{ get_where_subquery(ref('tiktok_ads__campaign_report')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__campaign_report"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "not_null_tiktok_ads__campaign_report_date_day"], "unique_id": "test.tiktok_ads.not_null_tiktok_ads__campaign_report_date_day.3807b0e836", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_tiktok_ads__campaign_report_date_day.sql", "original_file_path": "models/tiktok_ads.yml", "name": "not_null_tiktok_ads__campaign_report_date_day", "alias": "not_null_tiktok_ads__campaign_report_date_day", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__campaign_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/not_null_tiktok_ads__campaign_report_date_day.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.292518, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`dbt_renee_tiktok_ads`.`tiktok_ads__campaign_report`\nwhere date_day is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "date_day", "file_key_name": "models.tiktok_ads__campaign_report"}, "test.tiktok_ads.not_null_tiktok_ads__campaign_report_campaign_id.8a2b0c8ef8": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "campaign_id", "model": "{{ get_where_subquery(ref('tiktok_ads__campaign_report')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__campaign_report"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "not_null_tiktok_ads__campaign_report_campaign_id"], "unique_id": "test.tiktok_ads.not_null_tiktok_ads__campaign_report_campaign_id.8a2b0c8ef8", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_tiktok_ads__campaign_report_campaign_id.sql", "original_file_path": "models/tiktok_ads.yml", "name": "not_null_tiktok_ads__campaign_report_campaign_id", "alias": "not_null_tiktok_ads__campaign_report_campaign_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__campaign_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/not_null_tiktok_ads__campaign_report_campaign_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.2955399, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`dbt_renee_tiktok_ads`.`tiktok_ads__campaign_report`\nwhere campaign_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "campaign_id", "file_key_name": "models.tiktok_ads__campaign_report"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day.cc5f756c69": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_48804305b042fff8fc9179671c157c13\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["campaign_id", "date_day"], "model": "{{ get_where_subquery(ref('tiktok_ads__campaign_report')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__campaign_report"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_48804305b042fff8fc9179671c157c13", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day.cc5f756c69", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_48804305b042fff8fc9179671c157c13.sql", "original_file_path": "models/tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day", "alias": "dbt_utils_unique_combination_o_48804305b042fff8fc9179671c157c13", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__campaign_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/dbt_utils_unique_combination_o_48804305b042fff8fc9179671c157c13.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_48804305b042fff8fc9179671c157c13"}, "created_at": 1659025250.297539, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n campaign_id, date_day\n from `database`.`dbt_renee_tiktok_ads`.`tiktok_ads__campaign_report`\n group by campaign_id, date_day\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.tiktok_ads__campaign_report"}, "test.tiktok_ads.not_null_tiktok_ads__url_report_date_day.d593573eff": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "date_day", "model": "{{ get_where_subquery(ref('tiktok_ads__url_report')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__url_report"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "not_null_tiktok_ads__url_report_date_day"], "unique_id": "test.tiktok_ads.not_null_tiktok_ads__url_report_date_day.d593573eff", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_tiktok_ads__url_report_date_day.sql", "original_file_path": "models/tiktok_ads.yml", "name": "not_null_tiktok_ads__url_report_date_day", "alias": "not_null_tiktok_ads__url_report_date_day", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__url_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/not_null_tiktok_ads__url_report_date_day.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.302998, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`dbt_renee_tiktok_ads`.`tiktok_ads__url_report`\nwhere date_day is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "date_day", "file_key_name": "models.tiktok_ads__url_report"}, "test.tiktok_ads.not_null_tiktok_ads__url_report_ad_id.6c41067bd0": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_id", "model": "{{ get_where_subquery(ref('tiktok_ads__url_report')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__url_report"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "not_null_tiktok_ads__url_report_ad_id"], "unique_id": "test.tiktok_ads.not_null_tiktok_ads__url_report_ad_id.6c41067bd0", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_tiktok_ads__url_report_ad_id.sql", "original_file_path": "models/tiktok_ads.yml", "name": "not_null_tiktok_ads__url_report_ad_id", "alias": "not_null_tiktok_ads__url_report_ad_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__url_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/not_null_tiktok_ads__url_report_ad_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.3052008, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`dbt_renee_tiktok_ads`.`tiktok_ads__url_report`\nwhere ad_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ad_id", "file_key_name": "models.tiktok_ads__url_report"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__url_report_ad_id__date_day.8b73e512af": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_30d691e3772c912d1a7e5874b0b91854\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_id", "date_day"], "model": "{{ get_where_subquery(ref('tiktok_ads__url_report')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.tiktok_ads__url_report"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_30d691e3772c912d1a7e5874b0b91854", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "dbt_utils_unique_combination_of_columns_tiktok_ads__url_report_ad_id__date_day"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__url_report_ad_id__date_day.8b73e512af", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_30d691e3772c912d1a7e5874b0b91854.sql", "original_file_path": "models/tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_tiktok_ads__url_report_ad_id__date_day", "alias": "dbt_utils_unique_combination_o_30d691e3772c912d1a7e5874b0b91854", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["tiktok_ads__url_report"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/tiktok_ads.yml/dbt_utils_unique_combination_o_30d691e3772c912d1a7e5874b0b91854.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_30d691e3772c912d1a7e5874b0b91854"}, "created_at": 1659025250.3070238, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n ad_id, date_day\n from `database`.`dbt_renee_tiktok_ads`.`tiktok_ads__url_report`\n group by ad_id, date_day\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.tiktok_ads__url_report"}, "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.fcb8c561bc": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_group_id", "model": "{{ get_where_subquery(ref('int_tiktok_ads__most_recent_ad_group')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad_group"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "intermediate", "not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id"], "unique_id": "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.fcb8c561bc", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.sql", "original_file_path": "models/intermediate/intermediate.yml", "name": "not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id", "alias": "not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["int_tiktok_ads__most_recent_ad_group"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/intermediate/intermediate.yml/not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.3331132, "compiled_sql": "\n \n \n\nwith __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)select *\nfrom __dbt__cte__int_tiktok_ads__most_recent_ad_group\nwhere ad_group_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": null, "column_name": "ad_group_id", "file_key_name": "models.int_tiktok_ads__most_recent_ad_group"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at.e2e9914076": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_7aae7967f01788b5ccce56d37f64c75b\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_group_id", "updated_at"], "model": "{{ get_where_subquery(ref('int_tiktok_ads__most_recent_ad_group')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad_group"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_7aae7967f01788b5ccce56d37f64c75b", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "intermediate", "dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at.e2e9914076", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_7aae7967f01788b5ccce56d37f64c75b.sql", "original_file_path": "models/intermediate/intermediate.yml", "name": "dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at", "alias": "dbt_utils_unique_combination_o_7aae7967f01788b5ccce56d37f64c75b", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["int_tiktok_ads__most_recent_ad_group"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/intermediate/intermediate.yml/dbt_utils_unique_combination_o_7aae7967f01788b5ccce56d37f64c75b.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_7aae7967f01788b5ccce56d37f64c75b"}, "created_at": 1659025250.3351848, "compiled_sql": "\n\n\n\n\n\nwith __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n),validation_errors as (\n\n select\n ad_group_id, updated_at\n from __dbt__cte__int_tiktok_ads__most_recent_ad_group\n group by ad_group_id, updated_at\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad_group as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_group_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": null, "column_name": null, "file_key_name": "models.int_tiktok_ads__most_recent_ad_group"}, "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_ad_id.14e9c145ca": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_id", "model": "{{ get_where_subquery(ref('int_tiktok_ads__most_recent_ad')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "intermediate", "not_null_int_tiktok_ads__most_recent_ad_ad_id"], "unique_id": "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_ad_id.14e9c145ca", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_int_tiktok_ads__most_recent_ad_ad_id.sql", "original_file_path": "models/intermediate/intermediate.yml", "name": "not_null_int_tiktok_ads__most_recent_ad_ad_id", "alias": "not_null_int_tiktok_ads__most_recent_ad_ad_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["int_tiktok_ads__most_recent_ad"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/intermediate/intermediate.yml/not_null_int_tiktok_ads__most_recent_ad_ad_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.340708, "compiled_sql": "\n \n \n\nwith __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)select *\nfrom __dbt__cte__int_tiktok_ads__most_recent_ad\nwhere ad_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": null, "column_name": "ad_id", "file_key_name": "models.int_tiktok_ads__most_recent_ad"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at.f58d824f65": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_82db7b1c335645aabf3916a22992c42a\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_id", "updated_at"], "model": "{{ get_where_subquery(ref('int_tiktok_ads__most_recent_ad')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_82db7b1c335645aabf3916a22992c42a", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "intermediate", "dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at.f58d824f65", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_82db7b1c335645aabf3916a22992c42a.sql", "original_file_path": "models/intermediate/intermediate.yml", "name": "dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at", "alias": "dbt_utils_unique_combination_o_82db7b1c335645aabf3916a22992c42a", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["int_tiktok_ads__most_recent_ad"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/intermediate/intermediate.yml/dbt_utils_unique_combination_o_82db7b1c335645aabf3916a22992c42a.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_82db7b1c335645aabf3916a22992c42a"}, "created_at": 1659025250.342508, "compiled_sql": "\n\n\n\n\n\nwith __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n),validation_errors as (\n\n select\n ad_id, updated_at\n from __dbt__cte__int_tiktok_ads__most_recent_ad\n group by ad_id, updated_at\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_ad", "sql": " __dbt__cte__int_tiktok_ads__most_recent_ad as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__ad_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": null, "column_name": null, "file_key_name": "models.int_tiktok_ads__most_recent_ad"}, "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_campaign_campaign_id.8cefa8981c": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "campaign_id", "model": "{{ get_where_subquery(ref('int_tiktok_ads__most_recent_campaign')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.int_tiktok_ads__most_recent_campaign"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "intermediate", "not_null_int_tiktok_ads__most_recent_campaign_campaign_id"], "unique_id": "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_campaign_campaign_id.8cefa8981c", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "not_null_int_tiktok_ads__most_recent_campaign_campaign_id.sql", "original_file_path": "models/intermediate/intermediate.yml", "name": "not_null_int_tiktok_ads__most_recent_campaign_campaign_id", "alias": "not_null_int_tiktok_ads__most_recent_campaign_campaign_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["int_tiktok_ads__most_recent_campaign"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/intermediate/intermediate.yml/not_null_int_tiktok_ads__most_recent_campaign_campaign_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.3478642, "compiled_sql": "\n \n \n\nwith __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)select *\nfrom __dbt__cte__int_tiktok_ads__most_recent_campaign\nwhere campaign_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "sql": " __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": null, "column_name": "campaign_id", "file_key_name": "models.int_tiktok_ads__most_recent_campaign"}, "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at.39077adf71": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_8456719f1ebbe11b109db2e39e0239ce\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["campaign_id", "updated_at"], "model": "{{ get_where_subquery(ref('int_tiktok_ads__most_recent_campaign')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads.int_tiktok_ads__most_recent_campaign"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_8456719f1ebbe11b109db2e39e0239ce", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads", "intermediate", "dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at"], "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at.39077adf71", "package_name": "tiktok_ads", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads", "path": "dbt_utils_unique_combination_o_8456719f1ebbe11b109db2e39e0239ce.sql", "original_file_path": "models/intermediate/intermediate.yml", "name": "dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at", "alias": "dbt_utils_unique_combination_o_8456719f1ebbe11b109db2e39e0239ce", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["int_tiktok_ads__most_recent_campaign"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads/models/intermediate/intermediate.yml/dbt_utils_unique_combination_o_8456719f1ebbe11b109db2e39e0239ce.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_8456719f1ebbe11b109db2e39e0239ce"}, "created_at": 1659025250.349807, "compiled_sql": "\n\n\n\n\n\nwith __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n),validation_errors as (\n\n select\n campaign_id, updated_at\n from __dbt__cte__int_tiktok_ads__most_recent_campaign\n group by campaign_id, updated_at\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "sql": " __dbt__cte__int_tiktok_ads__most_recent_campaign as (\nwith base as (\n\n select *\n from `database`.`schema`.`stg_tiktok_ads__campaign_history`\n\n), filtered as (\n\n select *\n from base\n where is_most_recent_record\n \n)\n\nselect *\nfrom filtered\n)"}], "relation_name": null, "column_name": null, "file_key_name": "models.int_tiktok_ads__most_recent_campaign"}, "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66": {"raw_sql": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "unique", "kwargs": {"column_name": "advertiser_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__advertiser')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "unique_stg_tiktok_ads__advertiser_advertiser_id"], "unique_id": "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "unique_stg_tiktok_ads__advertiser_advertiser_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "unique_stg_tiktok_ads__advertiser_advertiser_id", "alias": "unique_stg_tiktok_ads__advertiser_advertiser_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__advertiser"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/unique_stg_tiktok_ads__advertiser_advertiser_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.606677, "compiled_sql": "\n \n \n\nwith dbt_test__target as (\n \n select advertiser_id as unique_field\n from `database`.`schema`.`stg_tiktok_ads__advertiser`\n where advertiser_id is not null\n \n)\n\nselect\n unique_field,\n count(*) as n_records\n\nfrom dbt_test__target\ngroup by unique_field\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "advertiser_id", "file_key_name": "models.stg_tiktok_ads__advertiser"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "advertiser_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__advertiser')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__advertiser_advertiser_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__advertiser_advertiser_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__advertiser_advertiser_id", "alias": "not_null_stg_tiktok_ads__advertiser_advertiser_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__advertiser"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__advertiser_advertiser_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.609247, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`schema`.`stg_tiktok_ads__advertiser`\nwhere advertiser_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "advertiser_id", "file_key_name": "models.stg_tiktok_ads__advertiser"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_group_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_group_history')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__ad_group_history_ad_group_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__ad_group_history_ad_group_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__ad_group_history_ad_group_id", "alias": "not_null_stg_tiktok_ads__ad_group_history_ad_group_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__ad_group_history_ad_group_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.611615, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`schema`.`stg_tiktok_ads__ad_group_history`\nwhere ad_group_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ad_group_id", "file_key_name": "models.stg_tiktok_ads__ad_group_history"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_group_id", "updated_at"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_group_history')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at", "alias": "dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8"}, "created_at": 1659025250.613982, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n ad_group_id, updated_at\n from `database`.`schema`.`stg_tiktok_ads__ad_group_history`\n group by ad_group_id, updated_at\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.stg_tiktok_ads__ad_group_history"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_history')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__ad_history_ad_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__ad_history_ad_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__ad_history_ad_id", "alias": "not_null_stg_tiktok_ads__ad_history_ad_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__ad_history_ad_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.620536, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`schema`.`stg_tiktok_ads__ad_history`\nwhere ad_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ad_id", "file_key_name": "models.stg_tiktok_ads__ad_history"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_id", "updated_at"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_history')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at", "alias": "dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f"}, "created_at": 1659025250.622965, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n ad_id, updated_at\n from `database`.`schema`.`stg_tiktok_ads__ad_history`\n group by ad_id, updated_at\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.stg_tiktok_ads__ad_history"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "campaign_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__campaign_history')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__campaign_history_campaign_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__campaign_history_campaign_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__campaign_history_campaign_id", "alias": "not_null_stg_tiktok_ads__campaign_history_campaign_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__campaign_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__campaign_history_campaign_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.6292312, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`schema`.`stg_tiktok_ads__campaign_history`\nwhere campaign_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "campaign_id", "file_key_name": "models.stg_tiktok_ads__campaign_history"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["campaign_id", "updated_at"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__campaign_history')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at", "alias": "dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__campaign_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000"}, "created_at": 1659025250.631393, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n campaign_id, updated_at\n from `database`.`schema`.`stg_tiktok_ads__campaign_history`\n group by campaign_id, updated_at\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.stg_tiktok_ads__campaign_history"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_ad_id.ee84d783ed": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_report_hourly')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__ad_report_hourly_ad_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_ad_id.ee84d783ed", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__ad_report_hourly_ad_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__ad_report_hourly_ad_id", "alias": "not_null_stg_tiktok_ads__ad_report_hourly_ad_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__ad_report_hourly_ad_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.636872, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`schema`.`stg_tiktok_ads__ad_report_hourly`\nwhere ad_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ad_id", "file_key_name": "models.stg_tiktok_ads__ad_report_hourly"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour.9e2a2dca81": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "stat_time_hour", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_report_hourly')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour.9e2a2dca81", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour", "alias": "not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.638859, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`schema`.`stg_tiktok_ads__ad_report_hourly`\nwhere stat_time_hour is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "stat_time_hour", "file_key_name": "models.stg_tiktok_ads__ad_report_hourly"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_id", "stat_time_hour"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_report_hourly')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour", "alias": "dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc"}, "created_at": 1659025250.6413739, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n ad_id, stat_time_hour\n from `database`.`schema`.`stg_tiktok_ads__ad_report_hourly`\n group by ad_id, stat_time_hour\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.stg_tiktok_ads__ad_report_hourly"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_group_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_group_report_hourly')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id", "alias": "not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.64688, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`schema`.`stg_tiktok_ads__ad_group_report_hourly`\nwhere ad_group_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ad_group_id", "file_key_name": "models.stg_tiktok_ads__ad_group_report_hourly"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour.ca4b495127": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "stat_time_hour", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_group_report_hourly')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour.ca4b495127", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour", "alias": "not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.6488671, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`schema`.`stg_tiktok_ads__ad_group_report_hourly`\nwhere stat_time_hour is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "stat_time_hour", "file_key_name": "models.stg_tiktok_ads__ad_group_report_hourly"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_group_id", "stat_time_hour"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_group_report_hourly')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour", "alias": "dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60"}, "created_at": 1659025250.651117, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n ad_group_id, stat_time_hour\n from `database`.`schema`.`stg_tiktok_ads__ad_group_report_hourly`\n group by ad_group_id, stat_time_hour\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.stg_tiktok_ads__ad_group_report_hourly"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "campaign_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__campaign_report_hourly')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id", "alias": "not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__campaign_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.657023, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`schema`.`stg_tiktok_ads__campaign_report_hourly`\nwhere campaign_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "campaign_id", "file_key_name": "models.stg_tiktok_ads__campaign_report_hourly"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour.e75e13184c": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "stat_time_hour", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__campaign_report_hourly')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour.e75e13184c", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour", "alias": "not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__campaign_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1659025250.6591501, "compiled_sql": "\n \n \n\nselect *\nfrom `database`.`schema`.`stg_tiktok_ads__campaign_report_hourly`\nwhere stat_time_hour is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "stat_time_hour", "file_key_name": "models.stg_tiktok_ads__campaign_report_hourly"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["campaign_id", "stat_time_hour"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__campaign_report_hourly')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "database", "schema": "dbt_renee_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour", "alias": "dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__campaign_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16"}, "created_at": 1659025250.661264, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n campaign_id, stat_time_hour\n from `database`.`schema`.`stg_tiktok_ads__campaign_report_hourly`\n group by campaign_id, stat_time_hour\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.stg_tiktok_ads__campaign_report_hourly"}}, "sources": {"source.tiktok_ads_source.tiktok_ads.advertiser": {"fqn": ["tiktok_ads_source", "tiktok_ads", "advertiser"], "database": "database", "schema": "tiktok_ads_joe", "unique_id": "source.tiktok_ads_source.tiktok_ads.advertiser", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "advertiser", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "advertiser", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 48, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Each record represents data for one advertiser.", "columns": {"id": {"name": "id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "address": {"name": "address", "description": "Advertiser address information", "meta": {}, "data_type": null, "quote": null, "tags": []}, "balance": {"name": "balance", "description": "Account available balance", "meta": {}, "data_type": null, "quote": null, "tags": []}, "company": {"name": "company", "description": "Advertiser's company name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "contacter": {"name": "contacter", "description": "Contact Person", "meta": {}, "data_type": null, "quote": null, "tags": []}, "country": {"name": "country", "description": "The advertiser's country", "meta": {}, "data_type": null, "quote": null, "tags": []}, "create_time": {"name": "create_time", "description": "Advertiser's create time", "meta": {}, "data_type": null, "quote": null, "tags": []}, "currency": {"name": "currency", "description": "Type of currency used by advertisers", "meta": {}, "data_type": null, "quote": null, "tags": []}, "description": {"name": "description", "description": "Brand description, i.e. promotional content", "meta": {}, "data_type": null, "quote": null, "tags": []}, "email": {"name": "email", "description": "Advertiser contact email, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "industry": {"name": "industry", "description": "Advertiser industry category", "meta": {}, "data_type": null, "quote": null, "tags": []}, "language": {"name": "language", "description": "Language used by advertisers", "meta": {}, "data_type": null, "quote": null, "tags": []}, "license_no": {"name": "license_no", "description": "License number", "meta": {}, "data_type": null, "quote": null, "tags": []}, "license_url": {"name": "license_url", "description": "License preview address, the link is valid for an hour by default.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "Advertiser name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "phone_number": {"name": "phone_number", "description": "Contact mobile number, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "promotion_area": {"name": "promotion_area", "description": "Operation area", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reason": {"name": "reason", "description": "Reason for rejection", "meta": {}, "data_type": null, "quote": null, "tags": []}, "role": {"name": "role", "description": "Advertiser role", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Advertiser status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "telephone": {"name": "telephone", "description": "Fixed phone number, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "timezone": {"name": "timezone", "description": "Ad account time zone including GMT offset", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`database`.`tiktok_ads_joe`.`advertiser`", "created_at": 1659025250.666205}, "source.tiktok_ads_source.tiktok_ads.campaign_history": {"fqn": ["tiktok_ads_source", "tiktok_ads", "campaign_history"], "database": "database", "schema": "tiktok_ads_joe", "unique_id": "source.tiktok_ads_source.tiktok_ads.campaign_history", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "campaign_history", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "campaign_history", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 48, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Each record represents a version of a TikTok campaign.", "columns": {"campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget": {"name": "budget", "description": "Campaign budget", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget_mode": {"name": "budget_mode", "description": "Budget type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_type": {"name": "campaign_type", "description": "Campaign Type, indicates the campaign is a regular campaign or iOS 14 campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "create_time": {"name": "create_time", "description": "Time at which the campaign was created.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_new_structure": {"name": "is_new_structure", "description": "Whether the campaign is a new structure (for the same campaign, the structure of campaign, adgroups and ads are the same)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "objective_type": {"name": "objective_type", "description": "Advertising objective.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "opt_status": {"name": "opt_status", "description": "Operation status.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Campaign status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "split_test_variable": {"name": "split_test_variable", "description": "Split Test variables. Optional values; TARGETING, BIDDING_OPTIMIZATION , CREATIVE.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`database`.`tiktok_ads_joe`.`campaign_history`", "created_at": 1659025250.6664262}, "source.tiktok_ads_source.tiktok_ads.adgroup_history": {"fqn": ["tiktok_ads_source", "tiktok_ads", "adgroup_history"], "database": "database", "schema": "tiktok_ads_joe", "unique_id": "source.tiktok_ads_source.tiktok_ads.adgroup_history", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "adgroup_history", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "adgroup_history", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 48, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Each record represents a version of a TikTok ad group.", "columns": {"adgroup_id": {"name": "adgroup_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The Ad group's campaign ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_categories": {"name": "action_categories", "description": "IDs of the action categories (behaviors) that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_days": {"name": "action_days", "description": "The number of days of the time period to include action from.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "adgroup_name": {"name": "adgroup_name", "description": "Ad group name. Character limit is 512 and cannot contain emoji.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "age": {"name": "age", "description": "Age groups you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "android_osv": {"name": "android_osv", "description": "Minimum Android version.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "app_download_url": {"name": "app_download_url", "description": "App download link", "meta": {}, "data_type": null, "quote": null, "tags": []}, "app_id": {"name": "app_id", "description": "The Application id of the promoted app", "meta": {}, "data_type": null, "quote": null, "tags": []}, "app_name": {"name": "app_name", "description": "App name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "app_type": {"name": "app_type", "description": "App type.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience": {"name": "audience", "description": "A list of audience IDs.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience_type": {"name": "audience_type", "description": "Audience Type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "bid": {"name": "bid", "description": "CPC, CPM bidding, oCPM learning bidding", "meta": {}, "data_type": null, "quote": null, "tags": []}, "bid_type": {"name": "bid_type", "description": "Bidding Strategy", "meta": {}, "data_type": null, "quote": null, "tags": []}, "billing_event": {"name": "billing_event", "description": "Bid method.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget": {"name": "budget", "description": "Ad budget. Returns 0.0 when Campaign Budget Optimization (budget_optimize_switch) is on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget_mode": {"name": "budget_mode", "description": "Budget mode. This field will be ignored when Campaign Budget Optimization (budget_optimize_switch) is enabled.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "carriers": {"name": "carriers", "description": "Carriers that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "category": {"name": "category", "description": "Ad group category.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "click_tracking_url": {"name": "click_tracking_url", "description": "Click monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "connection_type": {"name": "connection_type", "description": "Device connection types that you want to target. Default; unlimited.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_bid": {"name": "conversion_bid", "description": "oCPM conversion bid", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpv_video_duration": {"name": "cpv_video_duration", "description": "Video playback duration, required if optimize_goal is VIDEO_VIEW. Allowed values; SIX_SECONDS (video playback 6s), TWO_SECONDS (video playback 2s)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "creative_material_mode": {"name": "creative_material_mode", "description": "Creative delivery mode.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "dayparting": {"name": "dayparting", "description": "Ad delivery period, the default is always and the format is 48 * 7 character string, represented by 0 or 1. > That is, with half an hour as the minimum granularity, a day (24 hours) is divided by the minimum granularity(30 mins) from Monday to Sunday. Resulting in a 48*7 format.0 represents not to be delivered, 1 represents delivery. no transmission, full transmission 0, full transmission 1 all represent full time delivery", "meta": {}, "data_type": null, "quote": null, "tags": []}, "deep_bid_type": {"name": "deep_bid_type", "description": "Bidding strategy for in-app events.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "deep_cpabid": {"name": "deep_cpabid", "description": "Deep bid", "meta": {}, "data_type": null, "quote": null, "tags": []}, "deep_external_action": {"name": "deep_external_action", "description": "Deep conversion event.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "display_name": {"name": "display_name", "description": "Display name of ad group.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "enable_inventory_filter": {"name": "enable_inventory_filter", "description": "Inventory filtering (Unsafe videos will not be displayed).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "excluded_audience": {"name": "excluded_audience", "description": "A list of audience ID to be excluded.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "external_action": {"name": "external_action", "description": "Conversion event for the ad group. It is required when the promoted object is an app with tracking urls, or when pixel_id is specified.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "fallback_type": {"name": "fallback_type", "description": "Fallback Type. If the audience do not have the app installed, you can have them fall back to install the app, or to view a specific web page. Not applicable for Deferred Deeplink. Allowed values; APP_INSTALL, WEBSITE, UNSET. If website is chosen, you need to specify the url via landing_page_url field.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency": {"name": "frequency", "description": "frequency, together with frequency_schedule, controls how often people see your ad (only available for REACH ads). For example, frequency = 2 frequency_schedule = 3 means \"show ads no more than twice every 3 day\".\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency_schedule": {"name": "frequency_schedule", "description": "frequency, together with frequency, controls how often people see your ad (only available for REACH ads).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impression_tracking_url": {"name": "impression_tracking_url", "description": "Display monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "interest_category_v2": {"name": "interest_category_v2", "description": "Interest classification. If the interest is specified, users that do not meet interest target will be excluded during delivery.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ios_osv": {"name": "ios_osv", "description": "Minimum iOS version.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_comment_disable": {"name": "is_comment_disable", "description": "Whether to allow comments on your ads on TikTok, Vigo, Helo.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_hfss": {"name": "is_hfss", "description": "Whether the promoted content is HFSS foods (foods that are high in fat, salt, or sugar).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_new_structure": {"name": "is_new_structure", "description": "Whether the campaign is a new structure.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "keywords": {"name": "keywords", "description": "Keywords used.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "languages": {"name": "languages", "description": "Codes of the languages that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "location": {"name": "location", "description": "IDs of the locations that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "open_url": {"name": "open_url", "description": "The specific location where you want your audience to go if they have your app installed.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "open_url_type": {"name": "open_url_type", "description": "The open URL type.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "operation_system": {"name": "operation_system", "description": "Device operating systems that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "opt_status": {"name": "opt_status", "description": "Operation status.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "optimize_goal": {"name": "optimize_goal", "description": "Optimization goal.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "pacing": {"name": "pacing", "description": "You can choose between PACING_MODE_SMOOTH and PACING_MODE_FAST. For PACING_MODE_SMOOTH, the budget is allocated evenly within the scheduled time. PACING_MODE_FAST would consume budget and produce results as soon as possible. \n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "package": {"name": "package", "description": "Package name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "pangle_block_app_list_id": {"name": "pangle_block_app_list_id", "description": "Pangle app block list ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "pixel_id": {"name": "pixel_id", "description": "Pixel ID. Only application for landing pages.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "placement": {"name": "placement", "description": "The apps where you want to deliver your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "placement_type": {"name": "placement_type", "description": "Placement type.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_image": {"name": "profile_image", "description": "Avatar URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "schedule_end_time": {"name": "schedule_end_time", "description": "Ad delivery end time (UTC+0). Format should be YYYY-MM-DD HH:MM:SS", "meta": {}, "data_type": null, "quote": null, "tags": []}, "schedule_start_time": {"name": "schedule_start_time", "description": "Ad delivery start time (UTC+0). Format should be YYYY-MM-DD HH:MM:SS", "meta": {}, "data_type": null, "quote": null, "tags": []}, "schedule_type": {"name": "schedule_type", "description": "The schedule type, which can be either SCHEDULE_START_END or SCHEDULE_FROM_NOW.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "skip_learning_phase": {"name": "skip_learning_phase", "description": "Whether to skip the learning stage.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "statistic_type": {"name": "statistic_type", "description": "conversion bid statistic type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Ad group status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_actions": {"name": "video_actions", "description": "Number of video actions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_download": {"name": "video_download", "description": "Whether users can download your video ads on TikTok(cannot be updated once created).", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`database`.`tiktok_ads_joe`.`adgroup_history`", "created_at": 1659025250.6667461}, "source.tiktok_ads_source.tiktok_ads.ad_history": {"fqn": ["tiktok_ads_source", "tiktok_ads", "ad_history"], "database": "database", "schema": "tiktok_ads_joe", "unique_id": "source.tiktok_ads_source.tiktok_ads.ad_history", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "ad_history", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "ad_history", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 48, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Each record represents a version of a TikTok ad.", "columns": {"ad_id": {"name": "ad_id", "description": "Ad ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "adgroup_id": {"name": "adgroup_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_name": {"name": "ad_name", "description": "Ad Name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_text": {"name": "ad_text", "description": "The ad text.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "app_name": {"name": "app_name", "description": "The display name of app download ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "call_to_action": {"name": "call_to_action", "description": "Call to action values.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "click_tracking_url": {"name": "click_tracking_url", "description": "Click monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "create_time": {"name": "create_time", "description": "Time at which the ad was created.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "display_name": {"name": "display_name", "description": "The display name of landing page or pure exposure ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "image_ids": {"name": "image_ids", "description": "A list of image IDs.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impression_tracking_url": {"name": "impression_tracking_url", "description": "Display monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_aco": {"name": "is_aco", "description": "Whether the ad is an automated ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_creative_authorized": {"name": "is_creative_authorized", "description": "Whether you grant displaying some of your ads in our TikTok For Business Creative Center. Only valid for non-US advertisers, the default value is false.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_new_structure": {"name": "is_new_structure", "description": "Whether the campaign is a new structure.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "open_url": {"name": "open_url", "description": "The specific location where you want your audience to go if they have your app installed.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "opt_status": {"name": "opt_status", "description": "Operation status.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "playable_url": {"name": "playable_url", "description": "Playable material url.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_image": {"name": "profile_image", "description": "Avatar URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Ad status.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_id": {"name": "video_id", "description": "The video ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`database`.`tiktok_ads_joe`.`ad_history`", "created_at": 1659025250.6669629}, "source.tiktok_ads_source.tiktok_ads.ad_report_hourly": {"fqn": ["tiktok_ads_source", "tiktok_ads", "ad_report_hourly"], "database": "database", "schema": "tiktok_ads_joe", "unique_id": "source.tiktok_ads_source.tiktok_ads.ad_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "ad_report_hourly", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "ad_report_hourly", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 48, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Each record represents data for each ad for each hour.", "columns": {"ad_id": {"name": "ad_id", "description": "Ad id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion": {"name": "real_time_conversion", "description": "The number of times your ad achieved an outcome, based on the objective and settings you selected. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result": {"name": "result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the results. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_result": {"name": "real_time_cost_per_result", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now, please go to the ad group section to view the cost per Result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result": {"name": "real_time_result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As a campaign may have different optimization goals, the total number of result is not supported in campaign section now , Please go to the ad group section to view the result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_view_p_100": {"name": "video_view_p_100", "description": "The number of times your video was played at 100% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion_rate": {"name": "real_time_conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_secondary_goal_result": {"name": "cost_per_secondary_goal_result", "description": "The average cost for each secondary goal result from your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result_rate": {"name": "secondary_goal_result_rate", "description": "The percentage of secondary goal results you achieved out of all of the installs of your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. The total count is calculated based on the time each ad impression occurred.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_conversion": {"name": "real_time_cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result_rate": {"name": "result_rate", "description": "The percentage of results you achieved out of all of the views/clicks on your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the result rate. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result": {"name": "secondary_goal_result", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_result": {"name": "cost_per_result", "description": "The average cost for each result from your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the cost per result. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time your video was played per person, including any time spent replaying the video. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result_rate": {"name": "real_time_result_rate", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now ,Please go to the ad group section to view the Result Rate. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`database`.`tiktok_ads_joe`.`ad_report_hourly`", "created_at": 1659025250.667213}, "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly": {"fqn": ["tiktok_ads_source", "tiktok_ads", "campaign_report_hourly"], "database": "database", "schema": "tiktok_ads_joe", "unique_id": "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "campaign_report_hourly", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "campaign_report_hourly", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 48, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Each record represents data for each campaign for each hour.", "columns": {"campaign_id": {"name": "campaign_id", "description": "Campaign id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion": {"name": "real_time_conversion", "description": "The number of times your ad achieved an outcome, based on the objective and settings you selected. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result": {"name": "result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the results. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_result": {"name": "real_time_cost_per_result", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now, please go to the ad group section to view the cost per Result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result": {"name": "real_time_result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As a campaign may have different optimization goals, the total number of result is not supported in campaign section now , Please go to the ad group section to view the result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_view_p_100": {"name": "video_view_p_100", "description": "The number of times your video was played at 100% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion_rate": {"name": "real_time_conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_secondary_goal_result": {"name": "cost_per_secondary_goal_result", "description": "The average cost for each secondary goal result from your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result_rate": {"name": "secondary_goal_result_rate", "description": "The percentage of secondary goal results you achieved out of all of the installs of your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. The total count is calculated based on the time each ad impression occurred.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_conversion": {"name": "real_time_cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result_rate": {"name": "result_rate", "description": "The percentage of results you achieved out of all of the views/clicks on your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the result rate. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result": {"name": "secondary_goal_result", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_result": {"name": "cost_per_result", "description": "The average cost for each result from your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the cost per result. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time your video was played per person, including any time spent replaying the video. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result_rate": {"name": "real_time_result_rate", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now ,Please go to the ad group section to view the Result Rate. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`database`.`tiktok_ads_joe`.`campaign_report_hourly`", "created_at": 1659025250.667466}, "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly": {"fqn": ["tiktok_ads_source", "tiktok_ads", "adgroup_report_hourly"], "database": "database", "schema": "tiktok_ads_joe", "unique_id": "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "adgroup_report_hourly", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "adgroup_report_hourly", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 48, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Each record represents data for each ad group for each hour.", "columns": {"adgroup_id": {"name": "adgroup_id", "description": "Ad group id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion": {"name": "real_time_conversion", "description": "The number of times your ad achieved an outcome, based on the objective and settings you selected. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result": {"name": "result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the results. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_result": {"name": "real_time_cost_per_result", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now, please go to the ad group section to view the cost per Result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result": {"name": "real_time_result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As a campaign may have different optimization goals, the total number of result is not supported in campaign section now , Please go to the ad group section to view the result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_view_p_100": {"name": "video_view_p_100", "description": "The number of times your video was played at 100% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion_rate": {"name": "real_time_conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_secondary_goal_result": {"name": "cost_per_secondary_goal_result", "description": "The average cost for each secondary goal result from your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result_rate": {"name": "secondary_goal_result_rate", "description": "The percentage of secondary goal results you achieved out of all of the installs of your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. The total count is calculated based on the time each ad impression occurred.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_conversion": {"name": "real_time_cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result_rate": {"name": "result_rate", "description": "The percentage of results you achieved out of all of the views/clicks on your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the result rate. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result": {"name": "secondary_goal_result", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_result": {"name": "cost_per_result", "description": "The average cost for each result from your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the cost per result. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time your video was played per person, including any time spent replaying the video. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result_rate": {"name": "real_time_result_rate", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now ,Please go to the ad group section to view the Result Rate. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`database`.`tiktok_ads_joe`.`adgroup_report_hourly`", "created_at": 1659025250.667936}}, "macros": {"macro.dbt_bigquery.date_sharded_table": {"unique_id": "macro.dbt_bigquery.date_sharded_table", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/etc.sql", "original_file_path": "macros/etc.sql", "name": "date_sharded_table", "macro_sql": "{% macro date_sharded_table(base_name) %}\n {{ return(base_name ~ \"[DBT__PARTITION_DATE]\") }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.559489}, "macro.dbt_bigquery.grant_access_to": {"unique_id": "macro.dbt_bigquery.grant_access_to", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/etc.sql", "original_file_path": "macros/etc.sql", "name": "grant_access_to", "macro_sql": "{% macro grant_access_to(entity, entity_type, role, grant_target_dict) -%}\n {% do adapter.grant_access_to(entity, entity_type, role, grant_target_dict) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.5600598}, "macro.dbt_bigquery.get_partitions_metadata": {"unique_id": "macro.dbt_bigquery.get_partitions_metadata", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/etc.sql", "original_file_path": "macros/etc.sql", "name": "get_partitions_metadata", "macro_sql": "\n\n{%- macro get_partitions_metadata(table) -%}\n {%- if execute -%}\n {%- set res = adapter.get_partitions_metadata(table) -%}\n {{- return(res) -}}\n {%- endif -%}\n {{- return(None) -}}\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.560735}, "macro.dbt_bigquery.bigquery__get_catalog": {"unique_id": "macro.dbt_bigquery.bigquery__get_catalog", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "name": "bigquery__get_catalog", "macro_sql": "{% macro bigquery__get_catalog(information_schema, schemas) -%}\n\n {%- if (schemas | length) == 0 -%}\n {# Hopefully nothing cares about the columns we return when there are no rows #}\n {%- set query = \"select 1 as id limit 0\" -%}\n {%- else -%}\n\n {%- set query -%}\n with tables as (\n select\n project_id as table_database,\n dataset_id as table_schema,\n table_id as original_table_name,\n\n concat(project_id, '.', dataset_id, '.', table_id) as relation_id,\n\n row_count,\n size_bytes as size_bytes,\n case\n when type = 1 then 'table'\n when type = 2 then 'view'\n else 'external'\n end as table_type,\n\n REGEXP_CONTAINS(table_id, '^.+[0-9]{8}$') and coalesce(type, 0) = 1 as is_date_shard,\n REGEXP_EXTRACT(table_id, '^(.+)[0-9]{8}$') as shard_base_name,\n REGEXP_EXTRACT(table_id, '^.+([0-9]{8})$') as shard_name\n\n from {{ information_schema.replace(information_schema_view='__TABLES__') }}\n where (\n {%- for schema in schemas -%}\n upper(dataset_id) = upper('{{ schema }}'){%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n )\n ),\n\n extracted as (\n\n select *,\n case\n when is_date_shard then shard_base_name\n else original_table_name\n end as table_name\n\n from tables\n\n ),\n\n unsharded_tables as (\n\n select\n table_database,\n table_schema,\n table_name,\n coalesce(table_type, 'external') as table_type,\n is_date_shard,\n\n struct(\n min(shard_name) as shard_min,\n max(shard_name) as shard_max,\n count(*) as shard_count\n ) as table_shards,\n\n sum(size_bytes) as size_bytes,\n sum(row_count) as row_count,\n\n max(relation_id) as relation_id\n\n from extracted\n group by 1,2,3,4,5\n\n ),\n\n info_schema_columns as (\n\n select\n concat(table_catalog, '.', table_schema, '.', table_name) as relation_id,\n table_catalog as table_database,\n table_schema,\n table_name,\n\n -- use the \"real\" column name from the paths query below\n column_name as base_column_name,\n ordinal_position as column_index,\n\n is_partitioning_column,\n clustering_ordinal_position\n\n from {{ information_schema.replace(information_schema_view='COLUMNS') }}\n where ordinal_position is not null\n\n ),\n\n info_schema_column_paths as (\n\n select\n concat(table_catalog, '.', table_schema, '.', table_name) as relation_id,\n field_path as column_name,\n data_type as column_type,\n column_name as base_column_name,\n description as column_comment\n\n from {{ information_schema.replace(information_schema_view='COLUMN_FIELD_PATHS') }}\n\n ),\n\n columns as (\n\n select * except (base_column_name)\n from info_schema_columns\n join info_schema_column_paths using (relation_id, base_column_name)\n\n ),\n\n column_stats as (\n\n select\n table_database,\n table_schema,\n table_name,\n max(relation_id) as relation_id,\n max(case when is_partitioning_column = 'YES' then 1 else 0 end) = 1 as is_partitioned,\n max(case when is_partitioning_column = 'YES' then column_name else null end) as partition_column,\n max(case when clustering_ordinal_position is not null then 1 else 0 end) = 1 as is_clustered,\n array_to_string(\n array_agg(\n case\n when clustering_ordinal_position is not null then column_name\n else null\n end ignore nulls\n order by clustering_ordinal_position\n ), ', '\n ) as clustering_columns\n\n from columns\n group by 1,2,3\n\n )\n\n select\n unsharded_tables.table_database,\n unsharded_tables.table_schema,\n case\n when is_date_shard then concat(unsharded_tables.table_name, '*')\n else unsharded_tables.table_name\n end as table_name,\n unsharded_tables.table_type,\n\n -- coalesce name and type for External tables - these columns are not\n -- present in the COLUMN_FIELD_PATHS resultset\n coalesce(columns.column_name, '') as column_name,\n -- invent a row number to account for nested fields -- BQ does\n -- not treat these nested properties as independent fields\n row_number() over (\n partition by relation_id\n order by columns.column_index, columns.column_name\n ) as column_index,\n coalesce(columns.column_type, '') as column_type,\n columns.column_comment,\n\n 'Shard count' as `stats__date_shards__label`,\n table_shards.shard_count as `stats__date_shards__value`,\n 'The number of date shards in this table' as `stats__date_shards__description`,\n is_date_shard as `stats__date_shards__include`,\n\n 'Shard (min)' as `stats__date_shard_min__label`,\n table_shards.shard_min as `stats__date_shard_min__value`,\n 'The first date shard in this table' as `stats__date_shard_min__description`,\n is_date_shard as `stats__date_shard_min__include`,\n\n 'Shard (max)' as `stats__date_shard_max__label`,\n table_shards.shard_max as `stats__date_shard_max__value`,\n 'The last date shard in this table' as `stats__date_shard_max__description`,\n is_date_shard as `stats__date_shard_max__include`,\n\n '# Rows' as `stats__num_rows__label`,\n row_count as `stats__num_rows__value`,\n 'Approximate count of rows in this table' as `stats__num_rows__description`,\n (unsharded_tables.table_type = 'table') as `stats__num_rows__include`,\n\n 'Approximate Size' as `stats__num_bytes__label`,\n size_bytes as `stats__num_bytes__value`,\n 'Approximate size of table as reported by BigQuery' as `stats__num_bytes__description`,\n (unsharded_tables.table_type = 'table') as `stats__num_bytes__include`,\n\n 'Partitioned By' as `stats__partitioning_type__label`,\n partition_column as `stats__partitioning_type__value`,\n 'The partitioning column for this table' as `stats__partitioning_type__description`,\n is_partitioned as `stats__partitioning_type__include`,\n\n 'Clustered By' as `stats__clustering_fields__label`,\n clustering_columns as `stats__clustering_fields__value`,\n 'The clustering columns for this table' as `stats__clustering_fields__description`,\n is_clustered as `stats__clustering_fields__include`\n\n -- join using relation_id (an actual relation, not a shard prefix) to make\n -- sure that column metadata is picked up through the join. This will only\n -- return the column information for the \"max\" table in a date-sharded table set\n from unsharded_tables\n left join columns using (relation_id)\n left join column_stats using (relation_id)\n {%- endset -%}\n\n {%- endif -%}\n\n {{ return(run_query(query)) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.replace", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.5665238}, "macro.dbt_bigquery.partition_by": {"unique_id": "macro.dbt_bigquery.partition_by", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "partition_by", "macro_sql": "{% macro partition_by(partition_config) -%}\n {%- if partition_config is none -%}\n {% do return('') %}\n {%- elif partition_config.data_type | lower in ('date','timestamp','datetime') -%}\n partition by {{ partition_config.render() }}\n {%- elif partition_config.data_type | lower in ('int64') -%}\n {%- set range = partition_config.range -%}\n partition by range_bucket(\n {{ partition_config.field }},\n generate_array({{ range.start}}, {{ range.end }}, {{ range.interval }})\n )\n {%- endif -%}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.575375}, "macro.dbt_bigquery.cluster_by": {"unique_id": "macro.dbt_bigquery.cluster_by", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "cluster_by", "macro_sql": "{% macro cluster_by(raw_cluster_by) %}\n {%- if raw_cluster_by is not none -%}\n cluster by {% if raw_cluster_by is string -%}\n {% set raw_cluster_by = [raw_cluster_by] %}\n {%- endif -%}\n {%- for cluster in raw_cluster_by -%}\n {{ cluster }}\n {%- if not loop.last -%}, {% endif -%}\n {%- endfor -%}\n\n {% endif %}\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.576308}, "macro.dbt_bigquery.bigquery_options": {"unique_id": "macro.dbt_bigquery.bigquery_options", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery_options", "macro_sql": "{% macro bigquery_options(opts) %}\n {% set options -%}\n OPTIONS({% for opt_key, opt_val in opts.items() %}\n {{ opt_key }}={{ opt_val }}{{ \",\" if not loop.last }}\n {% endfor %})\n {%- endset %}\n {%- do return(options) -%}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.5771232}, "macro.dbt_bigquery.bigquery_table_options": {"unique_id": "macro.dbt_bigquery.bigquery_table_options", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery_table_options", "macro_sql": "{% macro bigquery_table_options(config, node, temporary) %}\n {% set opts = adapter.get_table_options(config, node, temporary) %}\n {%- do return(bigquery_options(opts)) -%}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery_options"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.5777018}, "macro.dbt_bigquery.bigquery__create_table_as": {"unique_id": "macro.dbt_bigquery.bigquery__create_table_as", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__create_table_as", "macro_sql": "{% macro bigquery__create_table_as(temporary, relation, sql) -%}\n {%- set raw_partition_by = config.get('partition_by', none) -%}\n {%- set raw_cluster_by = config.get('cluster_by', none) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {%- set partition_config = adapter.parse_partition_by(raw_partition_by) -%}\n\n {{ sql_header if sql_header is not none }}\n\n create or replace table {{ relation }}\n {{ partition_by(partition_config) }}\n {{ cluster_by(raw_cluster_by) }}\n {{ bigquery_table_options(config, model, temporary) }}\n as (\n {{ sql }}\n );\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.partition_by", "macro.dbt_bigquery.cluster_by", "macro.dbt_bigquery.bigquery_table_options"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.579099}, "macro.dbt_bigquery.bigquery_view_options": {"unique_id": "macro.dbt_bigquery.bigquery_view_options", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery_view_options", "macro_sql": "{% macro bigquery_view_options(config, node) %}\n {% set opts = adapter.get_view_options(config, node) %}\n {%- do return(bigquery_options(opts)) -%}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery_options"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.5798368}, "macro.dbt_bigquery.bigquery__create_view_as": {"unique_id": "macro.dbt_bigquery.bigquery__create_view_as", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__create_view_as", "macro_sql": "{% macro bigquery__create_view_as(relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n\n create or replace view {{ relation }}\n {{ bigquery_view_options(config, model) }}\n as {{ sql }};\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery_view_options"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.580534}, "macro.dbt_bigquery.bigquery__create_schema": {"unique_id": "macro.dbt_bigquery.bigquery__create_schema", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__create_schema", "macro_sql": "{% macro bigquery__create_schema(relation) -%}\n {{ adapter.create_schema(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.580823}, "macro.dbt_bigquery.bigquery__drop_schema": {"unique_id": "macro.dbt_bigquery.bigquery__drop_schema", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__drop_schema", "macro_sql": "{% macro bigquery__drop_schema(relation) -%}\n {{ adapter.drop_schema(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.581107}, "macro.dbt_bigquery.bigquery__drop_relation": {"unique_id": "macro.dbt_bigquery.bigquery__drop_relation", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__drop_relation", "macro_sql": "{% macro bigquery__drop_relation(relation) -%}\n {% call statement('drop_relation') -%}\n drop {{ relation.type }} if exists {{ relation }}\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.581578}, "macro.dbt_bigquery.bigquery__get_columns_in_relation": {"unique_id": "macro.dbt_bigquery.bigquery__get_columns_in_relation", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__get_columns_in_relation", "macro_sql": "{% macro bigquery__get_columns_in_relation(relation) -%}\n {{ return(adapter.get_columns_in_relation(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.58202}, "macro.dbt_bigquery.bigquery__list_relations_without_caching": {"unique_id": "macro.dbt_bigquery.bigquery__list_relations_without_caching", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__list_relations_without_caching", "macro_sql": "{% macro bigquery__list_relations_without_caching(schema_relation) -%}\n {{ return(adapter.list_relations_without_caching(schema_relation)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.582551}, "macro.dbt_bigquery.bigquery__current_timestamp": {"unique_id": "macro.dbt_bigquery.bigquery__current_timestamp", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__current_timestamp", "macro_sql": "{% macro bigquery__current_timestamp() -%}\n CURRENT_TIMESTAMP()\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.582869}, "macro.dbt_bigquery.bigquery__snapshot_string_as_time": {"unique_id": "macro.dbt_bigquery.bigquery__snapshot_string_as_time", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__snapshot_string_as_time", "macro_sql": "{% macro bigquery__snapshot_string_as_time(timestamp) -%}\n {%- set result = 'TIMESTAMP(\"' ~ timestamp ~ '\")' -%}\n {{ return(result) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.583254}, "macro.dbt_bigquery.bigquery__list_schemas": {"unique_id": "macro.dbt_bigquery.bigquery__list_schemas", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__list_schemas", "macro_sql": "{% macro bigquery__list_schemas(database) -%}\n {{ return(adapter.list_schemas(database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.5838091}, "macro.dbt_bigquery.bigquery__check_schema_exists": {"unique_id": "macro.dbt_bigquery.bigquery__check_schema_exists", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__check_schema_exists", "macro_sql": "{% macro bigquery__check_schema_exists(information_schema, schema) %}\n {{ return(adapter.check_schema_exists(information_schema.database, schema)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.584695}, "macro.dbt_bigquery.bigquery__persist_docs": {"unique_id": "macro.dbt_bigquery.bigquery__persist_docs", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__persist_docs", "macro_sql": "{% macro bigquery__persist_docs(relation, model, for_relation, for_columns) -%}\n {% if for_columns and config.persist_column_docs() and model.columns %}\n {% do alter_column_comment(relation, model.columns) %}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.5856}, "macro.dbt_bigquery.bigquery__alter_column_comment": {"unique_id": "macro.dbt_bigquery.bigquery__alter_column_comment", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__alter_column_comment", "macro_sql": "{% macro bigquery__alter_column_comment(relation, column_dict) -%}\n {% do adapter.update_columns(relation, column_dict) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.585968}, "macro.dbt_bigquery.bigquery__rename_relation": {"unique_id": "macro.dbt_bigquery.bigquery__rename_relation", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__rename_relation", "macro_sql": "{% macro bigquery__rename_relation(from_relation, to_relation) -%}\n {% do adapter.rename_relation(from_relation, to_relation) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.586335}, "macro.dbt_bigquery.bigquery__alter_relation_add_columns": {"unique_id": "macro.dbt_bigquery.bigquery__alter_relation_add_columns", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__alter_relation_add_columns", "macro_sql": "{% macro bigquery__alter_relation_add_columns(relation, add_columns) %}\n \n {% set sql -%}\n \n alter {{ relation.type }} {{ relation }}\n {% for column in add_columns %}\n add column {{ column.name }} {{ column.data_type }}{{ ',' if not loop.last }}\n {% endfor %}\n \n {%- endset -%}\n\n {{ return(run_query(sql)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.587254}, "macro.dbt_bigquery.bigquery__alter_relation_drop_columns": {"unique_id": "macro.dbt_bigquery.bigquery__alter_relation_drop_columns", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__alter_relation_drop_columns", "macro_sql": "{% macro bigquery__alter_relation_drop_columns(relation, drop_columns) %}\n \n {% set sql -%}\n \n alter {{ relation.type }} {{ relation }}\n\n {% for column in drop_columns %}\n drop column {{ column.name }}{{ ',' if not loop.last }}\n {% endfor %}\n \n {%- endset -%}\n \n {{ return(run_query(sql)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.5881789}, "macro.dbt_bigquery.bigquery__alter_column_type": {"unique_id": "macro.dbt_bigquery.bigquery__alter_column_type", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__alter_column_type", "macro_sql": "{% macro bigquery__alter_column_type(relation, column_name, new_column_type) -%}\n {#-- Changing a column's data type using a query requires you to scan the entire table.\n The query charges can be significant if the table is very large.\n\n https://cloud.google.com/bigquery/docs/manually-changing-schemas#changing_a_columns_data_type\n #}\n {% set relation_columns = get_columns_in_relation(relation) %}\n\n {% set sql %}\n select\n {%- for col in relation_columns -%}\n {% if col.column == column_name %}\n CAST({{ col.quoted }} AS {{ new_column_type }}) AS {{ col.quoted }}\n {%- else %}\n {{ col.quoted }}\n {%- endif %}\n {%- if not loop.last %},{% endif -%}\n {%- endfor %}\n from {{ relation }}\n {% endset %}\n\n {% call statement('alter_column_type') %}\n {{ create_table_as(False, relation, sql)}}\n {%- endcall %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_columns_in_relation", "macro.dbt.statement", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.5898502}, "macro.dbt_bigquery.bigquery__test_unique": {"unique_id": "macro.dbt_bigquery.bigquery__test_unique", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "bigquery__test_unique", "macro_sql": "{% macro bigquery__test_unique(model, column_name) %}\n\nwith dbt_test__target as (\n \n select {{ column_name }} as unique_field\n from {{ model }}\n where {{ column_name }} is not null\n \n)\n\nselect\n unique_field,\n count(*) as n_records\n\nfrom dbt_test__target\ngroup by unique_field\nhaving count(*) > 1\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.590223}, "macro.dbt_bigquery.bigquery__create_csv_table": {"unique_id": "macro.dbt_bigquery.bigquery__create_csv_table", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "name": "bigquery__create_csv_table", "macro_sql": "{% macro bigquery__create_csv_table(model, agate_table) %}\n -- no-op\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.590954}, "macro.dbt_bigquery.bigquery__reset_csv_table": {"unique_id": "macro.dbt_bigquery.bigquery__reset_csv_table", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "name": "bigquery__reset_csv_table", "macro_sql": "{% macro bigquery__reset_csv_table(model, full_refresh, old_relation, agate_table) %}\n {{ adapter.drop_relation(old_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.591389}, "macro.dbt_bigquery.bigquery__load_csv_rows": {"unique_id": "macro.dbt_bigquery.bigquery__load_csv_rows", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/seed.sql", "original_file_path": "macros/materializations/seed.sql", "name": "bigquery__load_csv_rows", "macro_sql": "{% macro bigquery__load_csv_rows(model, agate_table) %}\n\n {%- set column_override = model['config'].get('column_types', {}) -%}\n {{ adapter.load_dataframe(model['database'], model['schema'], model['alias'],\n \t\t\t\t\t\t\tagate_table, column_override) }}\n {% if config.persist_relation_docs() and 'description' in model %}\n\n \t{{ adapter.update_table_description(model['database'], model['schema'], model['alias'], model['description']) }}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.593206}, "macro.dbt_bigquery.bigquery__handle_existing_table": {"unique_id": "macro.dbt_bigquery.bigquery__handle_existing_table", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/view.sql", "original_file_path": "macros/materializations/view.sql", "name": "bigquery__handle_existing_table", "macro_sql": "{% macro bigquery__handle_existing_table(full_refresh, old_relation) %}\n {%- if full_refresh -%}\n {{ adapter.drop_relation(old_relation) }}\n {%- else -%}\n {{ exceptions.relation_wrong_type(old_relation, 'view') }}\n {%- endif -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.594513}, "macro.dbt_bigquery.materialization_view_bigquery": {"unique_id": "macro.dbt_bigquery.materialization_view_bigquery", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/view.sql", "original_file_path": "macros/materializations/view.sql", "name": "materialization_view_bigquery", "macro_sql": "{% materialization view, adapter='bigquery' -%}\n {% set to_return = create_or_replace_view() %}\n\n {% set target_relation = this.incorporate(type='view') %}\n {% do persist_docs(target_relation, model) %}\n\n {% if config.get('grant_access_to') %}\n {% for grant_target_dict in config.get('grant_access_to') %}\n {% do adapter.grant_access_to(this, 'view', None, grant_target_dict) %}\n {% endfor %}\n {% endif %}\n\n {% do return(to_return) %}\n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_or_replace_view", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.596042}, "macro.dbt_bigquery.materialization_table_bigquery": {"unique_id": "macro.dbt_bigquery.materialization_table_bigquery", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "name": "materialization_table_bigquery", "macro_sql": "{% materialization table, adapter='bigquery' -%}\n\n {%- set identifier = model['alias'] -%}\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set exists_not_as_table = (old_relation is not none and not old_relation.is_table) -%}\n {%- set target_relation = api.Relation.create(database=database, schema=schema, identifier=identifier, type='table') -%}\n\n {{ run_hooks(pre_hooks) }}\n\n {#\n We only need to drop this thing if it is not a table.\n If it _is_ already a table, then we can overwrite it without downtime\n Unlike table -> view, no need for `--full-refresh`: dropping a view is no big deal\n #}\n {%- if exists_not_as_table -%}\n {{ adapter.drop_relation(old_relation) }}\n {%- endif -%}\n\n -- build model\n {%- set raw_partition_by = config.get('partition_by', none) -%}\n {%- set partition_by = adapter.parse_partition_by(raw_partition_by) -%}\n {%- set cluster_by = config.get('cluster_by', none) -%}\n {% if not adapter.is_replaceable(old_relation, partition_by, cluster_by) %}\n {% do log(\"Hard refreshing \" ~ old_relation ~ \" because it is not replaceable\") %}\n {% do adapter.drop_relation(old_relation) %}\n {% endif %}\n {% call statement('main') -%}\n {{ create_table_as(False, target_relation, sql) }}\n {% endcall -%}\n\n {{ run_hooks(post_hooks) }}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.599952}, "macro.dbt_bigquery.materialization_copy_bigquery": {"unique_id": "macro.dbt_bigquery.materialization_copy_bigquery", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/copy.sql", "original_file_path": "macros/materializations/copy.sql", "name": "materialization_copy_bigquery", "macro_sql": "{% materialization copy, adapter='bigquery' -%}\n\n {# Setup #}\n {{ run_hooks(pre_hooks) }}\n\n {% set destination = this.incorporate(type='table') %}\n\n {# there can be several ref() or source() according to BQ copy API docs #}\n {# cycle over ref() and source() to create source tables array #}\n {% set source_array = [] %}\n {% for ref_table in model.refs %}\n {{ source_array.append(ref(*ref_table)) }}\n {% endfor %}\n\n {% for src_table in model.sources %}\n {{ source_array.append(source(*src_table)) }}\n {% endfor %}\n\n {# Call adapter's copy_table function #}\n {%- set result_str = adapter.copy_table(\n source_array,\n destination,\n config.get('copy_materialization', default = 'table')) -%}\n\n {{ store_result('main', response=result_str) }}\n\n {# Clean up #}\n {{ run_hooks(post_hooks) }}\n {{ adapter.commit() }}\n\n {{ return({'relations': [destination]}) }}\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6024902}, "macro.dbt_bigquery.declare_dbt_max_partition": {"unique_id": "macro.dbt_bigquery.declare_dbt_max_partition", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "name": "declare_dbt_max_partition", "macro_sql": "{% macro declare_dbt_max_partition(relation, partition_by, sql) %}\n\n {% if '_dbt_max_partition' in sql %}\n\n declare _dbt_max_partition {{ partition_by.data_type }} default (\n select max({{ partition_by.field }}) from {{ this }}\n where {{ partition_by.field }} is not null\n );\n \n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.606169}, "macro.dbt_bigquery.dbt_bigquery_validate_get_incremental_strategy": {"unique_id": "macro.dbt_bigquery.dbt_bigquery_validate_get_incremental_strategy", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "name": "dbt_bigquery_validate_get_incremental_strategy", "macro_sql": "{% macro dbt_bigquery_validate_get_incremental_strategy(config) %}\n {#-- Find and validate the incremental strategy #}\n {%- set strategy = config.get(\"incremental_strategy\", default=\"merge\") -%}\n\n {% set invalid_strategy_msg -%}\n Invalid incremental strategy provided: {{ strategy }}\n Expected one of: 'merge', 'insert_overwrite'\n {%- endset %}\n {% if strategy not in ['merge', 'insert_overwrite'] %}\n {% do exceptions.raise_compiler_error(invalid_strategy_msg) %}\n {% endif %}\n\n {% do return(strategy) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6072152}, "macro.dbt_bigquery.bq_insert_overwrite": {"unique_id": "macro.dbt_bigquery.bq_insert_overwrite", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "name": "bq_insert_overwrite", "macro_sql": "{% macro bq_insert_overwrite(\n tmp_relation, target_relation, sql, unique_key, partition_by, partitions, dest_columns, tmp_relation_exists\n) %}\n\n {% if partitions is not none and partitions != [] %} {# static #}\n\n {% set predicate -%}\n {{ partition_by.render(alias='DBT_INTERNAL_DEST') }} in (\n {{ partitions | join (', ') }}\n )\n {%- endset %}\n\n {%- set source_sql -%}\n (\n {{sql}}\n )\n {%- endset -%}\n\n {{ get_insert_overwrite_merge_sql(target_relation, source_sql, dest_columns, [predicate], include_sql_header=true) }}\n\n {% else %} {# dynamic #}\n\n {% set predicate -%}\n {{ partition_by.render(alias='DBT_INTERNAL_DEST') }} in unnest(dbt_partitions_for_replacement)\n {%- endset %}\n\n {%- set source_sql -%}\n (\n select * from {{ tmp_relation }}\n )\n {%- endset -%}\n\n -- generated script to merge partitions into {{ target_relation }}\n declare dbt_partitions_for_replacement array<{{ partition_by.data_type }}>;\n\n {# have we already created the temp table to check for schema changes? #}\n {% if not tmp_relation_exists %}\n {{ declare_dbt_max_partition(this, partition_by, sql) }}\n \n -- 1. create a temp table\n {{ create_table_as(True, tmp_relation, sql) }}\n {% else %}\n -- 1. temp table already exists, we used it to check for schema changes\n {% endif %}\n\n -- 2. define partitions to update\n set (dbt_partitions_for_replacement) = (\n select as struct\n array_agg(distinct {{ partition_by.render() }})\n from {{ tmp_relation }}\n );\n\n {#\n TODO: include_sql_header is a hack; consider a better approach that includes\n the sql_header at the materialization-level instead\n #}\n -- 3. run the merge statement\n {{ get_insert_overwrite_merge_sql(target_relation, source_sql, dest_columns, [predicate], include_sql_header=false) }};\n\n -- 4. clean up the temp table\n drop table if exists {{ tmp_relation }}\n\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_insert_overwrite_merge_sql", "macro.dbt_bigquery.declare_dbt_max_partition", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.610614}, "macro.dbt_bigquery.bq_generate_incremental_build_sql": {"unique_id": "macro.dbt_bigquery.bq_generate_incremental_build_sql", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "name": "bq_generate_incremental_build_sql", "macro_sql": "{% macro bq_generate_incremental_build_sql(\n strategy, tmp_relation, target_relation, sql, unique_key, partition_by, partitions, dest_columns, tmp_relation_exists\n) %}\n {#-- if partitioned, use BQ scripting to get the range of partition values to be updated --#}\n {% if strategy == 'insert_overwrite' %}\n\n {% set missing_partition_msg -%}\n The 'insert_overwrite' strategy requires the `partition_by` config.\n {%- endset %}\n {% if partition_by is none %}\n {% do exceptions.raise_compiler_error(missing_partition_msg) %}\n {% endif %}\n\n {% set build_sql = bq_insert_overwrite(\n tmp_relation, target_relation, sql, unique_key, partition_by, partitions, dest_columns, on_schema_change\n ) %}\n\n {% else %} {# strategy == 'merge' #}\n {%- set source_sql -%}\n {%- if tmp_relation_exists -%}\n (\n select * from {{ tmp_relation }}\n )\n {%- else -%} {#-- wrap sql in parens to make it a subquery --#}\n (\n {{sql}}\n )\n {%- endif -%}\n {%- endset -%}\n\n {% set build_sql = get_merge_sql(target_relation, source_sql, unique_key, dest_columns) %}\n\n {% endif %}\n\n {{ return(build_sql) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bq_insert_overwrite", "macro.dbt.get_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6128929}, "macro.dbt_bigquery.materialization_incremental_bigquery": {"unique_id": "macro.dbt_bigquery.materialization_incremental_bigquery", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/incremental.sql", "original_file_path": "macros/materializations/incremental.sql", "name": "materialization_incremental_bigquery", "macro_sql": "{% materialization incremental, adapter='bigquery' -%}\n\n {%- set unique_key = config.get('unique_key') -%}\n {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n {%- set target_relation = this %}\n {%- set existing_relation = load_relation(this) %}\n {%- set tmp_relation = make_temp_relation(this) %}\n\n {#-- Validate early so we don't run SQL if the strategy is invalid --#}\n {% set strategy = dbt_bigquery_validate_get_incremental_strategy(config) -%}\n\n {%- set raw_partition_by = config.get('partition_by', none) -%}\n {%- set partition_by = adapter.parse_partition_by(raw_partition_by) -%}\n {%- set partitions = config.get('partitions', none) -%}\n {%- set cluster_by = config.get('cluster_by', none) -%}\n\n {% set on_schema_change = incremental_validate_on_schema_change(config.get('on_schema_change'), default='ignore') %}\n\n {{ run_hooks(pre_hooks) }}\n\n {% if existing_relation is none %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n \n {% elif existing_relation.is_view %}\n {#-- There's no way to atomically replace a view with a table on BQ --#}\n {{ adapter.drop_relation(existing_relation) }}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n \n {% elif full_refresh_mode %}\n {#-- If the partition/cluster config has changed, then we must drop and recreate --#}\n {% if not adapter.is_replaceable(existing_relation, partition_by, cluster_by) %}\n {% do log(\"Hard refreshing \" ~ existing_relation ~ \" because it is not replaceable\") %}\n {{ adapter.drop_relation(existing_relation) }}\n {% endif %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n \n {% else %}\n {% set tmp_relation_exists = false %}\n {% if on_schema_change != 'ignore' %} {# Check first, since otherwise we may not build a temp table #}\n {% do run_query(\n declare_dbt_max_partition(this, partition_by, sql) + create_table_as(True, tmp_relation, sql)\n ) %}\n {% set tmp_relation_exists = true %}\n {#-- Process schema changes. Returns dict of changes if successful. Use source columns for upserting/merging --#}\n {% set dest_columns = process_schema_changes(on_schema_change, tmp_relation, existing_relation) %}\n {% endif %}\n {% if not dest_columns %}\n {% set dest_columns = adapter.get_columns_in_relation(existing_relation) %}\n {% endif %}\n {% set build_sql = bq_generate_incremental_build_sql(\n strategy, tmp_relation, target_relation, sql, unique_key, partition_by, partitions, dest_columns, tmp_relation_exists\n ) %}\n\n {% endif %}\n\n {%- call statement('main') -%}\n {{ build_sql }}\n {% endcall %}\n\n {{ run_hooks(post_hooks) }}\n\n {% set target_relation = this.incorporate(type='table') %}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.load_relation", "macro.dbt.make_temp_relation", "macro.dbt_bigquery.dbt_bigquery_validate_get_incremental_strategy", "macro.dbt.incremental_validate_on_schema_change", "macro.dbt.run_hooks", "macro.dbt.create_table_as", "macro.dbt.run_query", "macro.dbt_bigquery.declare_dbt_max_partition", "macro.dbt.process_schema_changes", "macro.dbt_bigquery.bq_generate_incremental_build_sql", "macro.dbt.statement", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.619224}, "macro.dbt_bigquery.bigquery__snapshot_hash_arguments": {"unique_id": "macro.dbt_bigquery.bigquery__snapshot_hash_arguments", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/snapshot.sql", "original_file_path": "macros/materializations/snapshot.sql", "name": "bigquery__snapshot_hash_arguments", "macro_sql": "{% macro bigquery__snapshot_hash_arguments(args) -%}\n to_hex(md5(concat({%- for arg in args -%}\n coalesce(cast({{ arg }} as string), ''){% if not loop.last %}, '|',{% endif -%}\n {%- endfor -%}\n )))\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.620119}, "macro.dbt_bigquery.bigquery__create_columns": {"unique_id": "macro.dbt_bigquery.bigquery__create_columns", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/snapshot.sql", "original_file_path": "macros/materializations/snapshot.sql", "name": "bigquery__create_columns", "macro_sql": "{% macro bigquery__create_columns(relation, columns) %}\n {{ adapter.alter_table_add_columns(relation, columns) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6204631}, "macro.dbt_bigquery.bigquery__post_snapshot": {"unique_id": "macro.dbt_bigquery.bigquery__post_snapshot", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/bigquery", "path": "macros/materializations/snapshot.sql", "original_file_path": "macros/materializations/snapshot.sql", "name": "bigquery__post_snapshot", "macro_sql": "{% macro bigquery__post_snapshot(staging_relation) %}\n -- Clean up the snapshot temp table\n {% do drop_relation(staging_relation) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.drop_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.620758}, "macro.dbt.run_hooks": {"unique_id": "macro.dbt.run_hooks", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "run_hooks", "macro_sql": "{% macro run_hooks(hooks, inside_transaction=True) %}\n {% for hook in hooks | selectattr('transaction', 'equalto', inside_transaction) %}\n {% if not inside_transaction and loop.first %}\n {% call statement(auto_begin=inside_transaction) %}\n commit;\n {% endcall %}\n {% endif %}\n {% set rendered = render(hook.get('sql')) | trim %}\n {% if (rendered | length) > 0 %}\n {% call statement(auto_begin=inside_transaction) %}\n {{ rendered }}\n {% endcall %}\n {% endif %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.623059}, "macro.dbt.make_hook_config": {"unique_id": "macro.dbt.make_hook_config", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "make_hook_config", "macro_sql": "{% macro make_hook_config(sql, inside_transaction) %}\n {{ tojson({\"sql\": sql, \"transaction\": inside_transaction}) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6234891}, "macro.dbt.before_begin": {"unique_id": "macro.dbt.before_begin", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "before_begin", "macro_sql": "{% macro before_begin(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.623808}, "macro.dbt.in_transaction": {"unique_id": "macro.dbt.in_transaction", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "in_transaction", "macro_sql": "{% macro in_transaction(sql) %}\n {{ make_hook_config(sql, inside_transaction=True) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.62433}, "macro.dbt.after_commit": {"unique_id": "macro.dbt.after_commit", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "after_commit", "macro_sql": "{% macro after_commit(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.624646}, "macro.dbt.set_sql_header": {"unique_id": "macro.dbt.set_sql_header", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "name": "set_sql_header", "macro_sql": "{% macro set_sql_header(config) -%}\n {{ config.set('sql_header', caller()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.625519}, "macro.dbt.should_full_refresh": {"unique_id": "macro.dbt.should_full_refresh", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "name": "should_full_refresh", "macro_sql": "{% macro should_full_refresh() %}\n {% set config_full_refresh = config.get('full_refresh') %}\n {% if config_full_refresh is none %}\n {% set config_full_refresh = flags.FULL_REFRESH %}\n {% endif %}\n {% do return(config_full_refresh) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6262531}, "macro.dbt.should_store_failures": {"unique_id": "macro.dbt.should_store_failures", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "name": "should_store_failures", "macro_sql": "{% macro should_store_failures() %}\n {% set config_store_failures = config.get('store_failures') %}\n {% if config_store_failures is none %}\n {% set config_store_failures = flags.STORE_FAILURES %}\n {% endif %}\n {% do return(config_store_failures) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6269178}, "macro.dbt.snapshot_merge_sql": {"unique_id": "macro.dbt.snapshot_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshots/snapshot_merge.sql", "name": "snapshot_merge_sql", "macro_sql": "{% macro snapshot_merge_sql(target, source, insert_cols) -%}\n {{ adapter.dispatch('snapshot_merge_sql', 'dbt')(target, source, insert_cols) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__snapshot_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.627841}, "macro.dbt.default__snapshot_merge_sql": {"unique_id": "macro.dbt.default__snapshot_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshots/snapshot_merge.sql", "name": "default__snapshot_merge_sql", "macro_sql": "{% macro default__snapshot_merge_sql(target, source, insert_cols) -%}\n {%- set insert_cols_csv = insert_cols | join(', ') -%}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on DBT_INTERNAL_SOURCE.dbt_scd_id = DBT_INTERNAL_DEST.dbt_scd_id\n\n when matched\n and DBT_INTERNAL_DEST.dbt_valid_to is null\n and DBT_INTERNAL_SOURCE.dbt_change_type in ('update', 'delete')\n then update\n set dbt_valid_to = DBT_INTERNAL_SOURCE.dbt_valid_to\n\n when not matched\n and DBT_INTERNAL_SOURCE.dbt_change_type = 'insert'\n then insert ({{ insert_cols_csv }})\n values ({{ insert_cols_csv }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6284218}, "macro.dbt.strategy_dispatch": {"unique_id": "macro.dbt.strategy_dispatch", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "strategy_dispatch", "macro_sql": "{% macro strategy_dispatch(name) -%}\n{% set original_name = name %}\n {% if '.' in name %}\n {% set package_name, name = name.split(\".\", 1) %}\n {% else %}\n {% set package_name = none %}\n {% endif %}\n\n {% if package_name is none %}\n {% set package_context = context %}\n {% elif package_name in context %}\n {% set package_context = context[package_name] %}\n {% else %}\n {% set error_msg %}\n Could not find package '{{package_name}}', called with '{{original_name}}'\n {% endset %}\n {{ exceptions.raise_compiler_error(error_msg | trim) }}\n {% endif %}\n\n {%- set search_name = 'snapshot_' ~ name ~ '_strategy' -%}\n\n {% if search_name not in package_context %}\n {% set error_msg %}\n The specified strategy macro '{{name}}' was not found in package '{{ package_name }}'\n {% endset %}\n {{ exceptions.raise_compiler_error(error_msg | trim) }}\n {% endif %}\n {{ return(package_context[search_name]) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.634329}, "macro.dbt.snapshot_hash_arguments": {"unique_id": "macro.dbt.snapshot_hash_arguments", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_hash_arguments", "macro_sql": "{% macro snapshot_hash_arguments(args) -%}\n {{ adapter.dispatch('snapshot_hash_arguments', 'dbt')(args) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.634702}, "macro.dbt.default__snapshot_hash_arguments": {"unique_id": "macro.dbt.default__snapshot_hash_arguments", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "default__snapshot_hash_arguments", "macro_sql": "{% macro default__snapshot_hash_arguments(args) -%}\n md5({%- for arg in args -%}\n coalesce(cast({{ arg }} as varchar ), '')\n {% if not loop.last %} || '|' || {% endif %}\n {%- endfor -%})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.635193}, "macro.dbt.snapshot_get_time": {"unique_id": "macro.dbt.snapshot_get_time", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_get_time", "macro_sql": "{% macro snapshot_get_time() -%}\n {{ adapter.dispatch('snapshot_get_time', 'dbt')() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.635556}, "macro.dbt.default__snapshot_get_time": {"unique_id": "macro.dbt.default__snapshot_get_time", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "default__snapshot_get_time", "macro_sql": "{% macro default__snapshot_get_time() -%}\n {{ current_timestamp() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.635833}, "macro.dbt.snapshot_timestamp_strategy": {"unique_id": "macro.dbt.snapshot_timestamp_strategy", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_timestamp_strategy", "macro_sql": "{% macro snapshot_timestamp_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n {% set primary_key = config['unique_key'] %}\n {% set updated_at = config['updated_at'] %}\n {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n\n {#/*\n The snapshot relation might not have an {{ updated_at }} value if the\n snapshot strategy is changed from `check` to `timestamp`. We\n should use a dbt-created column for the comparison in the snapshot\n table instead of assuming that the user-supplied {{ updated_at }}\n will be present in the historical data.\n\n See https://github.com/dbt-labs/dbt-core/issues/2350\n */ #}\n {% set row_changed_expr -%}\n ({{ snapshotted_rel }}.dbt_valid_from < {{ current_rel }}.{{ updated_at }})\n {%- endset %}\n\n {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n {% do return({\n \"unique_key\": primary_key,\n \"updated_at\": updated_at,\n \"row_changed\": row_changed_expr,\n \"scd_id\": scd_id_expr,\n \"invalidate_hard_deletes\": invalidate_hard_deletes\n }) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.637905}, "macro.dbt.snapshot_string_as_time": {"unique_id": "macro.dbt.snapshot_string_as_time", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_string_as_time", "macro_sql": "{% macro snapshot_string_as_time(timestamp) -%}\n {{ adapter.dispatch('snapshot_string_as_time', 'dbt')(timestamp) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__snapshot_string_as_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6383722}, "macro.dbt.default__snapshot_string_as_time": {"unique_id": "macro.dbt.default__snapshot_string_as_time", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "default__snapshot_string_as_time", "macro_sql": "{% macro default__snapshot_string_as_time(timestamp) %}\n {% do exceptions.raise_not_implemented(\n 'snapshot_string_as_time macro not implemented for adapter '+adapter.type()\n ) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.638856}, "macro.dbt.snapshot_check_all_get_existing_columns": {"unique_id": "macro.dbt.snapshot_check_all_get_existing_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_check_all_get_existing_columns", "macro_sql": "{% macro snapshot_check_all_get_existing_columns(node, target_exists) -%}\n {%- set query_columns = get_columns_in_query(node['compiled_sql']) -%}\n {%- if not target_exists -%}\n {# no table yet -> return whatever the query does #}\n {{ return([false, query_columns]) }}\n {%- endif -%}\n {# handle any schema changes #}\n {%- set target_table = node.get('alias', node.get('name')) -%}\n {%- set target_relation = adapter.get_relation(database=node.database, schema=node.schema, identifier=target_table) -%}\n {%- set existing_cols = get_columns_in_query('select * from ' ~ target_relation) -%}\n {%- set ns = namespace() -%} {# handle for-loop scoping with a namespace #}\n {%- set ns.column_added = false -%}\n\n {%- set intersection = [] -%}\n {%- for col in query_columns -%}\n {%- if col in existing_cols -%}\n {%- do intersection.append(col) -%}\n {%- else -%}\n {% set ns.column_added = true %}\n {%- endif -%}\n {%- endfor -%}\n {{ return([ns.column_added, intersection]) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.64127}, "macro.dbt.snapshot_check_strategy": {"unique_id": "macro.dbt.snapshot_check_strategy", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_check_strategy", "macro_sql": "{% macro snapshot_check_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n {% set check_cols_config = config['check_cols'] %}\n {% set primary_key = config['unique_key'] %}\n {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n \n {% set select_current_time -%}\n select {{ snapshot_get_time() }} as snapshot_start\n {%- endset %}\n\n {#-- don't access the column by name, to avoid dealing with casing issues on snowflake #}\n {%- set now = run_query(select_current_time)[0][0] -%}\n {% if now is none or now is undefined -%}\n {%- do exceptions.raise_compiler_error('Could not get a snapshot start time from the database') -%}\n {%- endif %}\n {% set updated_at = config.get('updated_at', snapshot_string_as_time(now)) %}\n\n {% set column_added = false %}\n\n {% if check_cols_config == 'all' %}\n {% set column_added, check_cols = snapshot_check_all_get_existing_columns(node, target_exists) %}\n {% elif check_cols_config is iterable and (check_cols_config | length) > 0 %}\n {% set check_cols = check_cols_config %}\n {% else %}\n {% do exceptions.raise_compiler_error(\"Invalid value for 'check_cols': \" ~ check_cols_config) %}\n {% endif %}\n\n {%- set row_changed_expr -%}\n (\n {%- if column_added -%}\n TRUE\n {%- else -%}\n {%- for col in check_cols -%}\n {{ snapshotted_rel }}.{{ col }} != {{ current_rel }}.{{ col }}\n or\n (\n (({{ snapshotted_rel }}.{{ col }} is null) and not ({{ current_rel }}.{{ col }} is null))\n or\n ((not {{ snapshotted_rel }}.{{ col }} is null) and ({{ current_rel }}.{{ col }} is null))\n )\n {%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n {%- endif -%}\n )\n {%- endset %}\n\n {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n {% do return({\n \"unique_key\": primary_key,\n \"updated_at\": updated_at,\n \"row_changed\": row_changed_expr,\n \"scd_id\": scd_id_expr,\n \"invalidate_hard_deletes\": invalidate_hard_deletes\n }) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.snapshot_get_time", "macro.dbt.run_query", "macro.dbt.snapshot_string_as_time", "macro.dbt.snapshot_check_all_get_existing_columns", "macro.dbt.snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6458821}, "macro.dbt.create_columns": {"unique_id": "macro.dbt.create_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "create_columns", "macro_sql": "{% macro create_columns(relation, columns) %}\n {{ adapter.dispatch('create_columns', 'dbt')(relation, columns) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_columns"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.650947}, "macro.dbt.default__create_columns": {"unique_id": "macro.dbt.default__create_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "default__create_columns", "macro_sql": "{% macro default__create_columns(relation, columns) %}\n {% for column in columns %}\n {% call statement() %}\n alter table {{ relation }} add column \"{{ column.name }}\" {{ column.data_type }};\n {% endcall %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.651618}, "macro.dbt.post_snapshot": {"unique_id": "macro.dbt.post_snapshot", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "post_snapshot", "macro_sql": "{% macro post_snapshot(staging_relation) %}\n {{ adapter.dispatch('post_snapshot', 'dbt')(staging_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.652004}, "macro.dbt.default__post_snapshot": {"unique_id": "macro.dbt.default__post_snapshot", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "default__post_snapshot", "macro_sql": "{% macro default__post_snapshot(staging_relation) %}\n {# no-op #}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6522188}, "macro.dbt.snapshot_staging_table": {"unique_id": "macro.dbt.snapshot_staging_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "snapshot_staging_table", "macro_sql": "{% macro snapshot_staging_table(strategy, source_sql, target_relation) -%}\n {{ adapter.dispatch('snapshot_staging_table', 'dbt')(strategy, source_sql, target_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__snapshot_staging_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.652673}, "macro.dbt.default__snapshot_staging_table": {"unique_id": "macro.dbt.default__snapshot_staging_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "default__snapshot_staging_table", "macro_sql": "{% macro default__snapshot_staging_table(strategy, source_sql, target_relation) -%}\n\n with snapshot_query as (\n\n {{ source_sql }}\n\n ),\n\n snapshotted_data as (\n\n select *,\n {{ strategy.unique_key }} as dbt_unique_key\n\n from {{ target_relation }}\n where dbt_valid_to is null\n\n ),\n\n insertions_source_data as (\n\n select\n *,\n {{ strategy.unique_key }} as dbt_unique_key,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to,\n {{ strategy.scd_id }} as dbt_scd_id\n\n from snapshot_query\n ),\n\n updates_source_data as (\n\n select\n *,\n {{ strategy.unique_key }} as dbt_unique_key,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n {{ strategy.updated_at }} as dbt_valid_to\n\n from snapshot_query\n ),\n\n {%- if strategy.invalidate_hard_deletes %}\n\n deletes_source_data as (\n\n select \n *,\n {{ strategy.unique_key }} as dbt_unique_key\n from snapshot_query\n ),\n {% endif %}\n\n insertions as (\n\n select\n 'insert' as dbt_change_type,\n source_data.*\n\n from insertions_source_data as source_data\n left outer join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where snapshotted_data.dbt_unique_key is null\n or (\n snapshotted_data.dbt_unique_key is not null\n and (\n {{ strategy.row_changed }}\n )\n )\n\n ),\n\n updates as (\n\n select\n 'update' as dbt_change_type,\n source_data.*,\n snapshotted_data.dbt_scd_id\n\n from updates_source_data as source_data\n join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where (\n {{ strategy.row_changed }}\n )\n )\n\n {%- if strategy.invalidate_hard_deletes -%}\n ,\n\n deletes as (\n \n select\n 'delete' as dbt_change_type,\n source_data.*,\n {{ snapshot_get_time() }} as dbt_valid_from,\n {{ snapshot_get_time() }} as dbt_updated_at,\n {{ snapshot_get_time() }} as dbt_valid_to,\n snapshotted_data.dbt_scd_id\n \n from snapshotted_data\n left join deletes_source_data as source_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where source_data.dbt_unique_key is null\n )\n {%- endif %}\n\n select * from insertions\n union all\n select * from updates\n {%- if strategy.invalidate_hard_deletes %}\n union all\n select * from deletes\n {%- endif %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.654573}, "macro.dbt.build_snapshot_table": {"unique_id": "macro.dbt.build_snapshot_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "build_snapshot_table", "macro_sql": "{% macro build_snapshot_table(strategy, sql) -%}\n {{ adapter.dispatch('build_snapshot_table', 'dbt')(strategy, sql) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__build_snapshot_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.654986}, "macro.dbt.default__build_snapshot_table": {"unique_id": "macro.dbt.default__build_snapshot_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "default__build_snapshot_table", "macro_sql": "{% macro default__build_snapshot_table(strategy, sql) %}\n\n select *,\n {{ strategy.scd_id }} as dbt_scd_id,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to\n from (\n {{ sql }}\n ) sbq\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6555688}, "macro.dbt.build_snapshot_staging_table": {"unique_id": "macro.dbt.build_snapshot_staging_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "build_snapshot_staging_table", "macro_sql": "{% macro build_snapshot_staging_table(strategy, sql, target_relation) %}\n {% set tmp_relation = make_temp_relation(target_relation) %}\n\n {% set select = snapshot_staging_table(strategy, sql, target_relation) %}\n\n {% call statement('build_snapshot_staging_relation') %}\n {{ create_table_as(True, tmp_relation, select) }}\n {% endcall %}\n\n {% do return(tmp_relation) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_temp_relation", "macro.dbt.snapshot_staging_table", "macro.dbt.statement", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6565309}, "macro.dbt.materialization_snapshot_default": {"unique_id": "macro.dbt.materialization_snapshot_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/snapshot.sql", "original_file_path": "macros/materializations/snapshots/snapshot.sql", "name": "materialization_snapshot_default", "macro_sql": "{% materialization snapshot, default %}\n {%- set config = model['config'] -%}\n\n {%- set target_table = model.get('alias', model.get('name')) -%}\n\n {%- set strategy_name = config.get('strategy') -%}\n {%- set unique_key = config.get('unique_key') %}\n\n {% if not adapter.check_schema_exists(model.database, model.schema) %}\n {% do create_schema(model.database, model.schema) %}\n {% endif %}\n\n {% set target_relation_exists, target_relation = get_or_create_relation(\n database=model.database,\n schema=model.schema,\n identifier=target_table,\n type='table') -%}\n\n {%- if not target_relation.is_table -%}\n {% do exceptions.relation_wrong_type(target_relation, 'table') %}\n {%- endif -%}\n\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set strategy_macro = strategy_dispatch(strategy_name) %}\n {% set strategy = strategy_macro(model, \"snapshotted_data\", \"source_data\", config, target_relation_exists) %}\n\n {% if not target_relation_exists %}\n\n {% set build_sql = build_snapshot_table(strategy, model['compiled_sql']) %}\n {% set final_sql = create_table_as(False, target_relation, build_sql) %}\n\n {% else %}\n\n {{ adapter.valid_snapshot_target(target_relation) }}\n\n {% set staging_table = build_snapshot_staging_table(strategy, sql, target_relation) %}\n\n -- this may no-op if the database does not require column expansion\n {% do adapter.expand_target_column_types(from_relation=staging_table,\n to_relation=target_relation) %}\n\n {% set missing_columns = adapter.get_missing_columns(staging_table, target_relation)\n | rejectattr('name', 'equalto', 'dbt_change_type')\n | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n | rejectattr('name', 'equalto', 'dbt_unique_key')\n | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n | list %}\n\n {% do create_columns(target_relation, missing_columns) %}\n\n {% set source_columns = adapter.get_columns_in_relation(staging_table)\n | rejectattr('name', 'equalto', 'dbt_change_type')\n | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n | rejectattr('name', 'equalto', 'dbt_unique_key')\n | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n | list %}\n\n {% set quoted_source_columns = [] %}\n {% for column in source_columns %}\n {% do quoted_source_columns.append(adapter.quote(column.name)) %}\n {% endfor %}\n\n {% set final_sql = snapshot_merge_sql(\n target = target_relation,\n source = staging_table,\n insert_cols = quoted_source_columns\n )\n %}\n\n {% endif %}\n\n {% call statement('main') %}\n {{ final_sql }}\n {% endcall %}\n\n {% do persist_docs(target_relation, model) %}\n\n {% if not target_relation_exists %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {% if staging_table is defined %}\n {% do post_snapshot(staging_table) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_schema", "macro.dbt.get_or_create_relation", "macro.dbt.run_hooks", "macro.dbt.strategy_dispatch", "macro.dbt.build_snapshot_table", "macro.dbt.create_table_as", "macro.dbt.build_snapshot_staging_table", "macro.dbt.create_columns", "macro.dbt.snapshot_merge_sql", "macro.dbt.statement", "macro.dbt.persist_docs", "macro.dbt.create_indexes", "macro.dbt.post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.668413}, "macro.dbt.materialization_test_default": {"unique_id": "macro.dbt.materialization_test_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/test.sql", "original_file_path": "macros/materializations/tests/test.sql", "name": "materialization_test_default", "macro_sql": "{%- materialization test, default -%}\n\n {% set relations = [] %}\n\n {% if should_store_failures() %}\n\n {% set identifier = model['alias'] %}\n {% set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n {% set target_relation = api.Relation.create(\n identifier=identifier, schema=schema, database=database, type='table') -%} %}\n \n {% if old_relation %}\n {% do adapter.drop_relation(old_relation) %}\n {% endif %}\n \n {% call statement(auto_begin=True) %}\n {{ create_table_as(False, target_relation, sql) }}\n {% endcall %}\n \n {% do relations.append(target_relation) %}\n \n {% set main_sql %}\n select *\n from {{ target_relation }}\n {% endset %}\n \n {{ adapter.commit() }}\n \n {% else %}\n\n {% set main_sql = sql %}\n \n {% endif %}\n\n {% set limit = config.get('limit') %}\n {% set fail_calc = config.get('fail_calc') %}\n {% set warn_if = config.get('warn_if') %}\n {% set error_if = config.get('error_if') %}\n\n {% call statement('main', fetch_result=True) -%}\n\n {{ get_test_sql(main_sql, fail_calc, warn_if, error_if, limit)}}\n\n {%- endcall %}\n \n {{ return({'relations': relations}) }}\n\n{%- endmaterialization -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.should_store_failures", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt.get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6734989}, "macro.dbt.get_test_sql": {"unique_id": "macro.dbt.get_test_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/helpers.sql", "original_file_path": "macros/materializations/tests/helpers.sql", "name": "get_test_sql", "macro_sql": "{% macro get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n {{ adapter.dispatch('get_test_sql', 'dbt')(main_sql, fail_calc, warn_if, error_if, limit) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6745942}, "macro.dbt.default__get_test_sql": {"unique_id": "macro.dbt.default__get_test_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/helpers.sql", "original_file_path": "macros/materializations/tests/helpers.sql", "name": "default__get_test_sql", "macro_sql": "{% macro default__get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n select\n {{ fail_calc }} as failures,\n {{ fail_calc }} {{ warn_if }} as should_warn,\n {{ fail_calc }} {{ error_if }} as should_error\n from (\n {{ main_sql }}\n {{ \"limit \" ~ limit if limit != none }}\n ) dbt_internal_test\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.675461}, "macro.dbt.get_where_subquery": {"unique_id": "macro.dbt.get_where_subquery", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/where_subquery.sql", "original_file_path": "macros/materializations/tests/where_subquery.sql", "name": "get_where_subquery", "macro_sql": "{% macro get_where_subquery(relation) -%}\n {% do return(adapter.dispatch('get_where_subquery', 'dbt')(relation)) %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_where_subquery"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.676608}, "macro.dbt.default__get_where_subquery": {"unique_id": "macro.dbt.default__get_where_subquery", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/where_subquery.sql", "original_file_path": "macros/materializations/tests/where_subquery.sql", "name": "default__get_where_subquery", "macro_sql": "{% macro default__get_where_subquery(relation) -%}\n {% set where = config.get('where', '') %}\n {% if where %}\n {%- set filtered -%}\n (select * from {{ relation }} where {{ where }}) dbt_subquery\n {%- endset -%}\n {% do return(filtered) %}\n {%- else -%}\n {% do return(relation) %}\n {%- endif -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6774778}, "macro.dbt.get_quoted_csv": {"unique_id": "macro.dbt.get_quoted_csv", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "name": "get_quoted_csv", "macro_sql": "{% macro get_quoted_csv(column_names) %}\n \n {% set quoted = [] %}\n {% for col in column_names -%}\n {%- do quoted.append(adapter.quote(col)) -%}\n {%- endfor %}\n\n {%- set dest_cols_csv = quoted | join(', ') -%}\n {{ return(dest_cols_csv) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.679115}, "macro.dbt.diff_columns": {"unique_id": "macro.dbt.diff_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "name": "diff_columns", "macro_sql": "{% macro diff_columns(source_columns, target_columns) %}\n\n {% set result = [] %}\n {% set source_names = source_columns | map(attribute = 'column') | list %}\n {% set target_names = target_columns | map(attribute = 'column') | list %}\n \n {# --check whether the name attribute exists in the target - this does not perform a data type check #}\n {% for sc in source_columns %}\n {% if sc.name not in target_names %}\n {{ result.append(sc) }}\n {% endif %}\n {% endfor %}\n \n {{ return(result) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.68033}, "macro.dbt.diff_column_data_types": {"unique_id": "macro.dbt.diff_column_data_types", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "name": "diff_column_data_types", "macro_sql": "{% macro diff_column_data_types(source_columns, target_columns) %}\n \n {% set result = [] %}\n {% for sc in source_columns %}\n {% set tc = target_columns | selectattr(\"name\", \"equalto\", sc.name) | list | first %}\n {% if tc %}\n {% if sc.data_type != tc.data_type %}\n {{ result.append( { 'column_name': tc.name, 'new_type': sc.data_type } ) }} \n {% endif %}\n {% endif %}\n {% endfor %}\n\n {{ return(result) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.681699}, "macro.dbt.get_merge_sql": {"unique_id": "macro.dbt.get_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "get_merge_sql", "macro_sql": "{% macro get_merge_sql(target, source, unique_key, dest_columns, predicates=none) -%}\n {{ adapter.dispatch('get_merge_sql', 'dbt')(target, source, unique_key, dest_columns, predicates) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.686409}, "macro.dbt.default__get_merge_sql": {"unique_id": "macro.dbt.default__get_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "default__get_merge_sql", "macro_sql": "{% macro default__get_merge_sql(target, source, unique_key, dest_columns, predicates) -%}\n {%- set predicates = [] if predicates is none else [] + predicates -%}\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n {%- set update_columns = config.get('merge_update_columns', default = dest_columns | map(attribute=\"quoted\") | list) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {% if unique_key %}\n {% set unique_key_match %}\n DBT_INTERNAL_SOURCE.{{ unique_key }} = DBT_INTERNAL_DEST.{{ unique_key }}\n {% endset %}\n {% do predicates.append(unique_key_match) %}\n {% else %}\n {% do predicates.append('FALSE') %}\n {% endif %}\n\n {{ sql_header if sql_header is not none }}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on {{ predicates | join(' and ') }}\n\n {% if unique_key %}\n when matched then update set\n {% for column_name in update_columns -%}\n {{ column_name }} = DBT_INTERNAL_SOURCE.{{ column_name }}\n {%- if not loop.last %}, {%- endif %}\n {%- endfor %}\n {% endif %}\n\n when not matched then insert\n ({{ dest_cols_csv }})\n values\n ({{ dest_cols_csv }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.689673}, "macro.dbt.get_delete_insert_merge_sql": {"unique_id": "macro.dbt.get_delete_insert_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "get_delete_insert_merge_sql", "macro_sql": "{% macro get_delete_insert_merge_sql(target, source, unique_key, dest_columns) -%}\n {{ adapter.dispatch('get_delete_insert_merge_sql', 'dbt')(target, source, unique_key, dest_columns) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_delete_insert_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6902}, "macro.dbt.default__get_delete_insert_merge_sql": {"unique_id": "macro.dbt.default__get_delete_insert_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "default__get_delete_insert_merge_sql", "macro_sql": "{% macro default__get_delete_insert_merge_sql(target, source, unique_key, dest_columns) -%}\n\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n {% if unique_key is not none %}\n delete from {{ target }}\n where ({{ unique_key }}) in (\n select ({{ unique_key }})\n from {{ source }}\n );\n {% endif %}\n\n insert into {{ target }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ source }}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.6914}, "macro.dbt.get_insert_overwrite_merge_sql": {"unique_id": "macro.dbt.get_insert_overwrite_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "get_insert_overwrite_merge_sql", "macro_sql": "{% macro get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header=false) -%}\n {{ adapter.dispatch('get_insert_overwrite_merge_sql', 'dbt')(target, source, dest_columns, predicates, include_sql_header) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_insert_overwrite_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.692064}, "macro.dbt.default__get_insert_overwrite_merge_sql": {"unique_id": "macro.dbt.default__get_insert_overwrite_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "default__get_insert_overwrite_merge_sql", "macro_sql": "{% macro default__get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header) -%}\n {%- set predicates = [] if predicates is none else [] + predicates -%}\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none and include_sql_header }}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on FALSE\n\n when not matched by source\n {% if predicates %} and {{ predicates | join(' and ') }} {% endif %}\n then delete\n\n when not matched then insert\n ({{ dest_cols_csv }})\n values\n ({{ dest_cols_csv }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.693449}, "macro.dbt.is_incremental": {"unique_id": "macro.dbt.is_incremental", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/is_incremental.sql", "original_file_path": "macros/materializations/models/incremental/is_incremental.sql", "name": "is_incremental", "macro_sql": "{% macro is_incremental() %}\n {#-- do not run introspective queries in parsing #}\n {% if not execute %}\n {{ return(False) }}\n {% else %}\n {% set relation = adapter.get_relation(this.database, this.schema, this.table) %}\n {{ return(relation is not none\n and relation.type == 'table'\n and model.config.materialized == 'incremental'\n and not should_full_refresh()) }}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.should_full_refresh"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.694926}, "macro.dbt.materialization_incremental_default": {"unique_id": "macro.dbt.materialization_incremental_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/incremental.sql", "original_file_path": "macros/materializations/models/incremental/incremental.sql", "name": "materialization_incremental_default", "macro_sql": "{% materialization incremental, default -%}\n\n {% set unique_key = config.get('unique_key') %}\n\n {% set target_relation = this.incorporate(type='table') %}\n {% set existing_relation = load_relation(this) %}\n {% set tmp_relation = make_temp_relation(target_relation) %}\n {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n {% set on_schema_change = incremental_validate_on_schema_change(config.get('on_schema_change'), default='ignore') %}\n\n {% set tmp_identifier = model['name'] + '__dbt_tmp' %}\n {% set backup_identifier = model['name'] + \"__dbt_backup\" %}\n\n -- the intermediate_ and backup_ relations should not already exist in the database; get_relation\n -- will return None in that case. Otherwise, we get a relation that we can drop\n -- later, before we try to use this name for the current operation. This has to happen before\n -- BEGIN, in a separate transaction\n {% set preexisting_intermediate_relation = adapter.get_relation(identifier=tmp_identifier, \n schema=schema,\n database=database) %} \n {% set preexisting_backup_relation = adapter.get_relation(identifier=backup_identifier,\n schema=schema,\n database=database) %}\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set to_drop = [] %}\n\n {# -- first check whether we want to full refresh for source view or config reasons #}\n {% set trigger_full_refresh = (full_refresh_mode or existing_relation.is_view) %}\n\n {% if existing_relation is none %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n{% elif trigger_full_refresh %}\n {#-- Make sure the backup doesn't exist so we don't encounter issues with the rename below #}\n {% set tmp_identifier = model['name'] + '__dbt_tmp' %}\n {% set backup_identifier = model['name'] + '__dbt_backup' %}\n {% set intermediate_relation = existing_relation.incorporate(path={\"identifier\": tmp_identifier}) %}\n {% set backup_relation = existing_relation.incorporate(path={\"identifier\": backup_identifier}) %}\n\n {% set build_sql = create_table_as(False, intermediate_relation, sql) %}\n {% set need_swap = true %}\n {% do to_drop.append(backup_relation) %}\n {% else %}\n {% do run_query(create_table_as(True, tmp_relation, sql)) %}\n {% do adapter.expand_target_column_types(\n from_relation=tmp_relation,\n to_relation=target_relation) %}\n {#-- Process schema changes. Returns dict of changes if successful. Use source columns for upserting/merging --#}\n {% set dest_columns = process_schema_changes(on_schema_change, tmp_relation, existing_relation) %}\n {% if not dest_columns %}\n {% set dest_columns = adapter.get_columns_in_relation(existing_relation) %}\n {% endif %}\n {% set build_sql = get_delete_insert_merge_sql(target_relation, tmp_relation, unique_key, dest_columns) %}\n \n {% endif %}\n\n {% call statement(\"main\") %}\n {{ build_sql }}\n {% endcall %}\n\n {% if need_swap %} \n {% do adapter.rename_relation(target_relation, backup_relation) %} \n {% do adapter.rename_relation(intermediate_relation, target_relation) %} \n {% endif %}\n\n {% do persist_docs(target_relation, model) %}\n\n {% if existing_relation is none or existing_relation.is_view or should_full_refresh() %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {% do adapter.commit() %}\n\n {% for rel in to_drop %}\n {% do adapter.drop_relation(rel) %}\n {% endfor %}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.load_relation", "macro.dbt.make_temp_relation", "macro.dbt.should_full_refresh", "macro.dbt.incremental_validate_on_schema_change", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.create_table_as", "macro.dbt.run_query", "macro.dbt.process_schema_changes", "macro.dbt.get_delete_insert_merge_sql", "macro.dbt.statement", "macro.dbt.persist_docs", "macro.dbt.create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.705695}, "macro.dbt.incremental_validate_on_schema_change": {"unique_id": "macro.dbt.incremental_validate_on_schema_change", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "name": "incremental_validate_on_schema_change", "macro_sql": "{% macro incremental_validate_on_schema_change(on_schema_change, default='ignore') %}\n \n {% if on_schema_change not in ['sync_all_columns', 'append_new_columns', 'fail', 'ignore'] %}\n \n {% set log_message = 'Invalid value for on_schema_change (%s) specified. Setting default value of %s.' % (on_schema_change, default) %}\n {% do log(log_message) %}\n \n {{ return(default) }}\n\n {% else %}\n\n {{ return(on_schema_change) }}\n \n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.714394}, "macro.dbt.check_for_schema_changes": {"unique_id": "macro.dbt.check_for_schema_changes", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "name": "check_for_schema_changes", "macro_sql": "{% macro check_for_schema_changes(source_relation, target_relation) %}\n \n {% set schema_changed = False %}\n \n {%- set source_columns = adapter.get_columns_in_relation(source_relation) -%}\n {%- set target_columns = adapter.get_columns_in_relation(target_relation) -%}\n {%- set source_not_in_target = diff_columns(source_columns, target_columns) -%}\n {%- set target_not_in_source = diff_columns(target_columns, source_columns) -%}\n\n {% set new_target_types = diff_column_data_types(source_columns, target_columns) %}\n\n {% if source_not_in_target != [] %}\n {% set schema_changed = True %}\n {% elif target_not_in_source != [] or new_target_types != [] %}\n {% set schema_changed = True %}\n {% elif new_target_types != [] %}\n {% set schema_changed = True %}\n {% endif %}\n \n {% set changes_dict = {\n 'schema_changed': schema_changed,\n 'source_not_in_target': source_not_in_target,\n 'target_not_in_source': target_not_in_source,\n 'source_columns': source_columns,\n 'target_columns': target_columns,\n 'new_target_types': new_target_types\n } %}\n\n {% set msg %}\n In {{ target_relation }}:\n Schema changed: {{ schema_changed }}\n Source columns not in target: {{ source_not_in_target }}\n Target columns not in source: {{ target_not_in_source }}\n New column types: {{ new_target_types }}\n {% endset %}\n \n {% do log(msg) %}\n\n {{ return(changes_dict) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.diff_columns", "macro.dbt.diff_column_data_types"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7172182}, "macro.dbt.sync_column_schemas": {"unique_id": "macro.dbt.sync_column_schemas", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "name": "sync_column_schemas", "macro_sql": "{% macro sync_column_schemas(on_schema_change, target_relation, schema_changes_dict) %}\n \n {%- set add_to_target_arr = schema_changes_dict['source_not_in_target'] -%}\n\n {%- if on_schema_change == 'append_new_columns'-%}\n {%- if add_to_target_arr | length > 0 -%}\n {%- do alter_relation_add_remove_columns(target_relation, add_to_target_arr, none) -%}\n {%- endif -%}\n \n {% elif on_schema_change == 'sync_all_columns' %}\n {%- set remove_from_target_arr = schema_changes_dict['target_not_in_source'] -%}\n {%- set new_target_types = schema_changes_dict['new_target_types'] -%}\n \n {% if add_to_target_arr | length > 0 or remove_from_target_arr | length > 0 %} \n {%- do alter_relation_add_remove_columns(target_relation, add_to_target_arr, remove_from_target_arr) -%}\n {% endif %}\n\n {% if new_target_types != [] %}\n {% for ntt in new_target_types %}\n {% set column_name = ntt['column_name'] %}\n {% set new_type = ntt['new_type'] %}\n {% do alter_column_type(target_relation, column_name, new_type) %}\n {% endfor %}\n {% endif %}\n \n {% endif %}\n\n {% set schema_change_message %}\n In {{ target_relation }}:\n Schema change approach: {{ on_schema_change }}\n Columns added: {{ add_to_target_arr }}\n Columns removed: {{ remove_from_target_arr }}\n Data types changed: {{ new_target_types }}\n {% endset %}\n \n {% do log(schema_change_message) %}\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.alter_relation_add_remove_columns", "macro.dbt.alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.720057}, "macro.dbt.process_schema_changes": {"unique_id": "macro.dbt.process_schema_changes", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "name": "process_schema_changes", "macro_sql": "{% macro process_schema_changes(on_schema_change, source_relation, target_relation) %}\n \n {% if on_schema_change == 'ignore' %}\n\n {{ return({}) }}\n\n {% else %}\n \n {% set schema_changes_dict = check_for_schema_changes(source_relation, target_relation) %}\n \n {% if schema_changes_dict['schema_changed'] %}\n \n {% if on_schema_change == 'fail' %}\n \n {% set fail_msg %}\n The source and target schemas on this incremental model are out of sync!\n They can be reconciled in several ways: \n - set the `on_schema_change` config to either append_new_columns or sync_all_columns, depending on your situation.\n - Re-run the incremental model with `full_refresh: True` to update the target schema.\n - update the schema manually and re-run the process.\n {% endset %}\n \n {% do exceptions.raise_compiler_error(fail_msg) %}\n \n {# -- unless we ignore, run the sync operation per the config #}\n {% else %}\n \n {% do sync_column_schemas(on_schema_change, target_relation, schema_changes_dict) %}\n \n {% endif %}\n \n {% endif %}\n\n {{ return(schema_changes_dict['source_columns']) }}\n \n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.check_for_schema_changes", "macro.dbt.sync_column_schemas"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.721715}, "macro.dbt.materialization_table_default": {"unique_id": "macro.dbt.materialization_table_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/table.sql", "original_file_path": "macros/materializations/models/table/table.sql", "name": "materialization_table_default", "macro_sql": "{% materialization table, default %}\n {%- set identifier = model['alias'] -%}\n {%- set tmp_identifier = model['name'] + '__dbt_tmp' -%}\n {%- set backup_identifier = model['name'] + '__dbt_backup' -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier,\n schema=schema,\n database=database,\n type='table') -%}\n {%- set intermediate_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema,\n database=database,\n type='table') -%}\n -- the intermediate_relation should not already exist in the database; get_relation\n -- will return None in that case. Otherwise, we get a relation that we can drop\n -- later, before we try to use this name for the current operation\n {%- set preexisting_intermediate_relation = adapter.get_relation(identifier=tmp_identifier, \n schema=schema,\n database=database) -%}\n /*\n See ../view/view.sql for more information about this relation.\n */\n {%- set backup_relation_type = 'table' if old_relation is none else old_relation.type -%}\n {%- set backup_relation = api.Relation.create(identifier=backup_identifier,\n schema=schema,\n database=database,\n type=backup_relation_type) -%}\n -- as above, the backup_relation should not already exist\n {%- set preexisting_backup_relation = adapter.get_relation(identifier=backup_identifier,\n schema=schema,\n database=database) -%}\n\n\n -- drop the temp relations if they exist already in the database\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% call statement('main') -%}\n {{ get_create_table_as_sql(False, intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n {% if old_relation is not none %}\n {{ adapter.rename_relation(old_relation, backup_relation) }}\n {% endif %}\n\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {% do create_indexes(target_relation) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {% do persist_docs(target_relation, model) %}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n -- finally, drop the existing/backup relation after the commit\n {{ drop_relation_if_exists(backup_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.get_create_table_as_sql", "macro.dbt.create_indexes", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.729088}, "macro.dbt.get_create_table_as_sql": {"unique_id": "macro.dbt.get_create_table_as_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.sql", "name": "get_create_table_as_sql", "macro_sql": "{% macro get_create_table_as_sql(temporary, relation, sql) -%}\n {{ adapter.dispatch('get_create_table_as_sql', 'dbt')(temporary, relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_create_table_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.730059}, "macro.dbt.default__get_create_table_as_sql": {"unique_id": "macro.dbt.default__get_create_table_as_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.sql", "name": "default__get_create_table_as_sql", "macro_sql": "{% macro default__get_create_table_as_sql(temporary, relation, sql) -%}\n {{ return(create_table_as(temporary, relation, sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7304902}, "macro.dbt.create_table_as": {"unique_id": "macro.dbt.create_table_as", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.sql", "name": "create_table_as", "macro_sql": "{% macro create_table_as(temporary, relation, sql) -%}\n {{ adapter.dispatch('create_table_as', 'dbt')(temporary, relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7309608}, "macro.dbt.default__create_table_as": {"unique_id": "macro.dbt.default__create_table_as", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.sql", "name": "default__create_table_as", "macro_sql": "{% macro default__create_table_as(temporary, relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n \n {{ sql_header if sql_header is not none }}\n \n create {% if temporary: -%}temporary{%- endif %} table\n {{ relation.include(database=(not temporary), schema=(not temporary)) }}\n as (\n {{ sql }}\n );\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.731889}, "macro.dbt.materialization_view_default": {"unique_id": "macro.dbt.materialization_view_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/view.sql", "original_file_path": "macros/materializations/models/view/view.sql", "name": "materialization_view_default", "macro_sql": "{%- materialization view, default -%}\n\n {%- set identifier = model['alias'] -%}\n {%- set tmp_identifier = model['name'] + '__dbt_tmp' -%}\n {%- set backup_identifier = model['name'] + '__dbt_backup' -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier, schema=schema, database=database,\n type='view') -%}\n {%- set intermediate_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema, database=database, type='view') -%}\n -- the intermediate_relation should not already exist in the database; get_relation\n -- will return None in that case. Otherwise, we get a relation that we can drop\n -- later, before we try to use this name for the current operation\n {%- set preexisting_intermediate_relation = adapter.get_relation(identifier=tmp_identifier, \n schema=schema,\n database=database) -%}\n /*\n This relation (probably) doesn't exist yet. If it does exist, it's a leftover from\n a previous run, and we're going to try to drop it immediately. At the end of this\n materialization, we're going to rename the \"old_relation\" to this identifier,\n and then we're going to drop it. In order to make sure we run the correct one of:\n - drop view ...\n - drop table ...\n\n We need to set the type of this relation to be the type of the old_relation, if it exists,\n or else \"view\" as a sane default if it does not. Note that if the old_relation does not\n exist, then there is nothing to move out of the way and subsequentally drop. In that case,\n this relation will be effectively unused.\n */\n {%- set backup_relation_type = 'view' if old_relation is none else old_relation.type -%}\n {%- set backup_relation = api.Relation.create(identifier=backup_identifier,\n schema=schema, database=database,\n type=backup_relation_type) -%}\n -- as above, the backup_relation should not already exist\n {%- set preexisting_backup_relation = adapter.get_relation(identifier=backup_identifier,\n schema=schema,\n database=database) -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- drop the temp relations if they exist already in the database\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% call statement('main') -%}\n {{ create_view_as(intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n -- move the existing view out of the way\n {% if old_relation is not none %}\n {{ adapter.rename_relation(old_relation, backup_relation) }}\n {% endif %}\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {{ drop_relation_if_exists(backup_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt.create_view_as", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7398348}, "macro.dbt.handle_existing_table": {"unique_id": "macro.dbt.handle_existing_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/helpers.sql", "original_file_path": "macros/materializations/models/view/helpers.sql", "name": "handle_existing_table", "macro_sql": "{% macro handle_existing_table(full_refresh, old_relation) %}\n {{ adapter.dispatch('handle_existing_table', 'dbt')(full_refresh, old_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__handle_existing_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.741197}, "macro.dbt.default__handle_existing_table": {"unique_id": "macro.dbt.default__handle_existing_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/helpers.sql", "original_file_path": "macros/materializations/models/view/helpers.sql", "name": "default__handle_existing_table", "macro_sql": "{% macro default__handle_existing_table(full_refresh, old_relation) %}\n {{ log(\"Dropping relation \" ~ old_relation ~ \" because it is of type \" ~ old_relation.type) }}\n {{ adapter.drop_relation(old_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.741759}, "macro.dbt.create_or_replace_view": {"unique_id": "macro.dbt.create_or_replace_view", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_or_replace_view.sql", "original_file_path": "macros/materializations/models/view/create_or_replace_view.sql", "name": "create_or_replace_view", "macro_sql": "{% macro create_or_replace_view() %}\n {%- set identifier = model['alias'] -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {%- set target_relation = api.Relation.create(\n identifier=identifier, schema=schema, database=database,\n type='view') -%}\n\n {{ run_hooks(pre_hooks) }}\n\n -- If there's a table with the same name and we weren't told to full refresh,\n -- that's an error. If we were told to full refresh, drop it. This behavior differs\n -- for Snowflake and BigQuery, so multiple dispatch is used.\n {%- if old_relation is not none and old_relation.is_table -%}\n {{ handle_existing_table(should_full_refresh(), old_relation) }}\n {%- endif -%}\n\n -- build model\n {% call statement('main') -%}\n {{ get_create_view_as_sql(target_relation, sql) }}\n {%- endcall %}\n\n {{ run_hooks(post_hooks) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.handle_existing_table", "macro.dbt.should_full_refresh", "macro.dbt.statement", "macro.dbt.get_create_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.745218}, "macro.dbt.get_create_view_as_sql": {"unique_id": "macro.dbt.get_create_view_as_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.sql", "name": "get_create_view_as_sql", "macro_sql": "{% macro get_create_view_as_sql(relation, sql) -%}\n {{ adapter.dispatch('get_create_view_as_sql', 'dbt')(relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_create_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7462971}, "macro.dbt.default__get_create_view_as_sql": {"unique_id": "macro.dbt.default__get_create_view_as_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.sql", "name": "default__get_create_view_as_sql", "macro_sql": "{% macro default__get_create_view_as_sql(relation, sql) -%}\n {{ return(create_view_as(relation, sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.74679}, "macro.dbt.create_view_as": {"unique_id": "macro.dbt.create_view_as", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.sql", "name": "create_view_as", "macro_sql": "{% macro create_view_as(relation, sql) -%}\n {{ adapter.dispatch('create_view_as', 'dbt')(relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.747294}, "macro.dbt.default__create_view_as": {"unique_id": "macro.dbt.default__create_view_as", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.sql", "name": "default__create_view_as", "macro_sql": "{% macro default__create_view_as(relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n create view {{ relation }} as (\n {{ sql }}\n );\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7483032}, "macro.dbt.materialization_seed_default": {"unique_id": "macro.dbt.materialization_seed_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/seed.sql", "original_file_path": "macros/materializations/seeds/seed.sql", "name": "materialization_seed_default", "macro_sql": "{% materialization seed, default %}\n\n {%- set identifier = model['alias'] -%}\n {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n\n {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {%- set agate_table = load_agate_table() -%}\n {%- do store_result('agate_table', response='OK', agate_table=agate_table) -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% set create_table_sql = \"\" %}\n {% if exists_as_view %}\n {{ exceptions.raise_compiler_error(\"Cannot seed to '{}', it is a view\".format(old_relation)) }}\n {% elif exists_as_table %}\n {% set create_table_sql = reset_csv_table(model, full_refresh_mode, old_relation, agate_table) %}\n {% else %}\n {% set create_table_sql = create_csv_table(model, agate_table) %}\n {% endif %}\n\n {% set code = 'CREATE' if full_refresh_mode else 'INSERT' %}\n {% set rows_affected = (agate_table.rows | length) %}\n {% set sql = load_csv_rows(model, agate_table) %}\n\n {% call noop_statement('main', code ~ ' ' ~ rows_affected, code, rows_affected) %}\n {{ create_table_sql }};\n -- dbt seed --\n {{ sql }}\n {% endcall %}\n\n {% set target_relation = this.incorporate(type='table') %}\n {% do persist_docs(target_relation, model) %}\n\n {% if full_refresh_mode or not exists_as_table %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.run_hooks", "macro.dbt.reset_csv_table", "macro.dbt.create_csv_table", "macro.dbt.load_csv_rows", "macro.dbt.noop_statement", "macro.dbt.persist_docs", "macro.dbt.create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.75549}, "macro.dbt.create_csv_table": {"unique_id": "macro.dbt.create_csv_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "create_csv_table", "macro_sql": "{% macro create_csv_table(model, agate_table) -%}\n {{ adapter.dispatch('create_csv_table', 'dbt')(model, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7621398}, "macro.dbt.default__create_csv_table": {"unique_id": "macro.dbt.default__create_csv_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__create_csv_table", "macro_sql": "{% macro default__create_csv_table(model, agate_table) %}\n {%- set column_override = model['config'].get('column_types', {}) -%}\n {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n\n {% set sql %}\n create table {{ this.render() }} (\n {%- for col_name in agate_table.column_names -%}\n {%- set inferred_type = adapter.convert_type(agate_table, loop.index0) -%}\n {%- set type = column_override.get(col_name, inferred_type) -%}\n {%- set column_name = (col_name | string) -%}\n {{ adapter.quote_seed_column(column_name, quote_seed_column) }} {{ type }} {%- if not loop.last -%}, {%- endif -%}\n {%- endfor -%}\n )\n {% endset %}\n\n {% call statement('_') -%}\n {{ sql }}\n {%- endcall %}\n\n {{ return(sql) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.764229}, "macro.dbt.reset_csv_table": {"unique_id": "macro.dbt.reset_csv_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "reset_csv_table", "macro_sql": "{% macro reset_csv_table(model, full_refresh, old_relation, agate_table) -%}\n {{ adapter.dispatch('reset_csv_table', 'dbt')(model, full_refresh, old_relation, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__reset_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.76475}, "macro.dbt.default__reset_csv_table": {"unique_id": "macro.dbt.default__reset_csv_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__reset_csv_table", "macro_sql": "{% macro default__reset_csv_table(model, full_refresh, old_relation, agate_table) %}\n {% set sql = \"\" %}\n {% if full_refresh %}\n {{ adapter.drop_relation(old_relation) }}\n {% set sql = create_csv_table(model, agate_table) %}\n {% else %}\n {{ adapter.truncate_relation(old_relation) }}\n {% set sql = \"truncate table \" ~ old_relation %}\n {% endif %}\n\n {{ return(sql) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.765895}, "macro.dbt.get_binding_char": {"unique_id": "macro.dbt.get_binding_char", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "get_binding_char", "macro_sql": "{% macro get_binding_char() -%}\n {{ adapter.dispatch('get_binding_char', 'dbt')() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_binding_char"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.766253}, "macro.dbt.default__get_binding_char": {"unique_id": "macro.dbt.default__get_binding_char", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__get_binding_char", "macro_sql": "{% macro default__get_binding_char() %}\n {{ return('%s') }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.766529}, "macro.dbt.get_batch_size": {"unique_id": "macro.dbt.get_batch_size", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "get_batch_size", "macro_sql": "{% macro get_batch_size() -%}\n {{ return(adapter.dispatch('get_batch_size', 'dbt')()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_batch_size"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.766898}, "macro.dbt.default__get_batch_size": {"unique_id": "macro.dbt.default__get_batch_size", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__get_batch_size", "macro_sql": "{% macro default__get_batch_size() %}\n {{ return(10000) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.76717}, "macro.dbt.get_seed_column_quoted_csv": {"unique_id": "macro.dbt.get_seed_column_quoted_csv", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "get_seed_column_quoted_csv", "macro_sql": "{% macro get_seed_column_quoted_csv(model, column_names) %}\n {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n {% set quoted = [] %}\n {% for col in column_names -%}\n {%- do quoted.append(adapter.quote_seed_column(col, quote_seed_column)) -%}\n {%- endfor %}\n\n {%- set dest_cols_csv = quoted | join(', ') -%}\n {{ return(dest_cols_csv) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.768275}, "macro.dbt.load_csv_rows": {"unique_id": "macro.dbt.load_csv_rows", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "load_csv_rows", "macro_sql": "{% macro load_csv_rows(model, agate_table) -%}\n {{ adapter.dispatch('load_csv_rows', 'dbt')(model, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__load_csv_rows"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.768702}, "macro.dbt.default__load_csv_rows": {"unique_id": "macro.dbt.default__load_csv_rows", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__load_csv_rows", "macro_sql": "{% macro default__load_csv_rows(model, agate_table) %}\n\n {% set batch_size = get_batch_size() %}\n\n {% set cols_sql = get_seed_column_quoted_csv(model, agate_table.column_names) %}\n {% set bindings = [] %}\n\n {% set statements = [] %}\n\n {% for chunk in agate_table.rows | batch(batch_size) %}\n {% set bindings = [] %}\n\n {% for row in chunk %}\n {% do bindings.extend(row) %}\n {% endfor %}\n\n {% set sql %}\n insert into {{ this.render() }} ({{ cols_sql }}) values\n {% for row in chunk -%}\n ({%- for column in agate_table.column_names -%}\n {{ get_binding_char() }}\n {%- if not loop.last%},{%- endif %}\n {%- endfor -%})\n {%- if not loop.last%},{%- endif %}\n {%- endfor %}\n {% endset %}\n\n {% do adapter.add_query(sql, bindings=bindings, abridge_sql_log=True) %}\n\n {% if loop.index0 == 0 %}\n {% do statements.append(sql) %}\n {% endif %}\n {% endfor %}\n\n {# Return SQL so we can render it out into the compiled files #}\n {{ return(statements[0]) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_batch_size", "macro.dbt.get_seed_column_quoted_csv", "macro.dbt.get_binding_char"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.77159}, "macro.dbt.generate_alias_name": {"unique_id": "macro.dbt.generate_alias_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_alias.sql", "original_file_path": "macros/get_custom_name/get_custom_alias.sql", "name": "generate_alias_name", "macro_sql": "{% macro generate_alias_name(custom_alias_name=none, node=none) -%}\n {% do return(adapter.dispatch('generate_alias_name', 'dbt')(custom_alias_name, node)) %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__generate_alias_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.772518}, "macro.dbt.default__generate_alias_name": {"unique_id": "macro.dbt.default__generate_alias_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_alias.sql", "original_file_path": "macros/get_custom_name/get_custom_alias.sql", "name": "default__generate_alias_name", "macro_sql": "{% macro default__generate_alias_name(custom_alias_name=none, node=none) -%}\n\n {%- if custom_alias_name is none -%}\n\n {{ node.name }}\n\n {%- else -%}\n\n {{ custom_alias_name | trim }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7730508}, "macro.dbt.generate_schema_name": {"unique_id": "macro.dbt.generate_schema_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "name": "generate_schema_name", "macro_sql": "{% macro generate_schema_name(custom_schema_name=none, node=none) -%}\n {{ return(adapter.dispatch('generate_schema_name', 'dbt')(custom_schema_name, node)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__generate_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7741902}, "macro.dbt.default__generate_schema_name": {"unique_id": "macro.dbt.default__generate_schema_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "name": "default__generate_schema_name", "macro_sql": "{% macro default__generate_schema_name(custom_schema_name, node) -%}\n\n {%- set default_schema = target.schema -%}\n {%- if custom_schema_name is none -%}\n\n {{ default_schema }}\n\n {%- else -%}\n\n {{ default_schema }}_{{ custom_schema_name | trim }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.774806}, "macro.dbt.generate_schema_name_for_env": {"unique_id": "macro.dbt.generate_schema_name_for_env", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "name": "generate_schema_name_for_env", "macro_sql": "{% macro generate_schema_name_for_env(custom_schema_name, node) -%}\n\n {%- set default_schema = target.schema -%}\n {%- if target.name == 'prod' and custom_schema_name is not none -%}\n\n {{ custom_schema_name | trim }}\n\n {%- else -%}\n\n {{ default_schema }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7754948}, "macro.dbt.generate_database_name": {"unique_id": "macro.dbt.generate_database_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_database.sql", "original_file_path": "macros/get_custom_name/get_custom_database.sql", "name": "generate_database_name", "macro_sql": "{% macro generate_database_name(custom_database_name=none, node=none) -%}\n {% do return(adapter.dispatch('generate_database_name', 'dbt')(custom_database_name, node)) %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__generate_database_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.776464}, "macro.dbt.default__generate_database_name": {"unique_id": "macro.dbt.default__generate_database_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_database.sql", "original_file_path": "macros/get_custom_name/get_custom_database.sql", "name": "default__generate_database_name", "macro_sql": "{% macro default__generate_database_name(custom_database_name=none, node=none) -%}\n {%- set default_database = target.database -%}\n {%- if custom_database_name is none -%}\n\n {{ default_database }}\n\n {%- else -%}\n\n {{ custom_database_name }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7770722}, "macro.dbt.default__test_relationships": {"unique_id": "macro.dbt.default__test_relationships", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/generic_test_sql/relationships.sql", "original_file_path": "macros/generic_test_sql/relationships.sql", "name": "default__test_relationships", "macro_sql": "{% macro default__test_relationships(model, column_name, to, field) %}\n\nwith child as (\n select {{ column_name }} as from_field\n from {{ model }}\n where {{ column_name }} is not null\n),\n\nparent as (\n select {{ field }} as to_field\n from {{ to }}\n)\n\nselect\n from_field\n\nfrom child\nleft join parent\n on child.from_field = parent.to_field\n\nwhere parent.to_field is null\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7780669}, "macro.dbt.default__test_not_null": {"unique_id": "macro.dbt.default__test_not_null", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/generic_test_sql/not_null.sql", "original_file_path": "macros/generic_test_sql/not_null.sql", "name": "default__test_not_null", "macro_sql": "{% macro default__test_not_null(model, column_name) %}\n\nselect *\nfrom {{ model }}\nwhere {{ column_name }} is null\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7786188}, "macro.dbt.default__test_unique": {"unique_id": "macro.dbt.default__test_unique", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/generic_test_sql/unique.sql", "original_file_path": "macros/generic_test_sql/unique.sql", "name": "default__test_unique", "macro_sql": "{% macro default__test_unique(model, column_name) %}\n\nselect\n {{ column_name }} as unique_field,\n count(*) as n_records\n\nfrom {{ model }}\nwhere {{ column_name }} is not null\ngroup by {{ column_name }}\nhaving count(*) > 1\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7793448}, "macro.dbt.default__test_accepted_values": {"unique_id": "macro.dbt.default__test_accepted_values", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/generic_test_sql/accepted_values.sql", "original_file_path": "macros/generic_test_sql/accepted_values.sql", "name": "default__test_accepted_values", "macro_sql": "{% macro default__test_accepted_values(model, column_name, values, quote=True) %}\n\nwith all_values as (\n\n select\n {{ column_name }} as value_field,\n count(*) as n_records\n\n from {{ model }}\n group by {{ column_name }}\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n {% for value in values -%}\n {% if quote -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {%- endfor %}\n)\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.78078}, "macro.dbt.statement": {"unique_id": "macro.dbt.statement", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "name": "statement", "macro_sql": "{% macro statement(name=None, fetch_result=False, auto_begin=True) -%}\n {%- if execute: -%}\n {%- set sql = caller() -%}\n\n {%- if name == 'main' -%}\n {{ log('Writing runtime SQL for node \"{}\"'.format(model['unique_id'])) }}\n {{ write(sql) }}\n {%- endif -%}\n\n {%- set res, table = adapter.execute(sql, auto_begin=auto_begin, fetch=fetch_result) -%}\n {%- if name is not none -%}\n {{ store_result(name, response=res, agate_table=table) }}\n {%- endif -%}\n\n {%- endif -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.783254}, "macro.dbt.noop_statement": {"unique_id": "macro.dbt.noop_statement", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "name": "noop_statement", "macro_sql": "{% macro noop_statement(name=None, message=None, code=None, rows_affected=None, res=None) -%}\n {%- set sql = caller() -%}\n\n {%- if name == 'main' -%}\n {{ log('Writing runtime SQL for node \"{}\"'.format(model['unique_id'])) }}\n {{ write(sql) }}\n {%- endif -%}\n\n {%- if name is not none -%}\n {{ store_raw_result(name, message=message, code=code, rows_affected=rows_affected, agate_table=res) }}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7847638}, "macro.dbt.run_query": {"unique_id": "macro.dbt.run_query", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "name": "run_query", "macro_sql": "{% macro run_query(sql) %}\n {% call statement(\"run_query_statement\", fetch_result=true, auto_begin=false) %}\n {{ sql }}\n {% endcall %}\n\n {% do return(load_result(\"run_query_statement\").table) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7854028}, "macro.dbt.convert_datetime": {"unique_id": "macro.dbt.convert_datetime", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "convert_datetime", "macro_sql": "{% macro convert_datetime(date_str, date_fmt) %}\n\n {% set error_msg -%}\n The provided partition date '{{ date_str }}' does not match the expected format '{{ date_fmt }}'\n {%- endset %}\n\n {% set res = try_or_compiler_error(error_msg, modules.datetime.datetime.strptime, date_str.strip(), date_fmt) %}\n {{ return(res) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.788404}, "macro.dbt.dates_in_range": {"unique_id": "macro.dbt.dates_in_range", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "dates_in_range", "macro_sql": "{% macro dates_in_range(start_date_str, end_date_str=none, in_fmt=\"%Y%m%d\", out_fmt=\"%Y%m%d\") %}\n {% set end_date_str = start_date_str if end_date_str is none else end_date_str %}\n\n {% set start_date = convert_datetime(start_date_str, in_fmt) %}\n {% set end_date = convert_datetime(end_date_str, in_fmt) %}\n\n {% set day_count = (end_date - start_date).days %}\n {% if day_count < 0 %}\n {% set msg -%}\n Partiton start date is after the end date ({{ start_date }}, {{ end_date }})\n {%- endset %}\n\n {{ exceptions.raise_compiler_error(msg, model) }}\n {% endif %}\n\n {% set date_list = [] %}\n {% for i in range(0, day_count + 1) %}\n {% set the_date = (modules.datetime.timedelta(days=i) + start_date) %}\n {% if not out_fmt %}\n {% set _ = date_list.append(the_date) %}\n {% else %}\n {% set _ = date_list.append(the_date.strftime(out_fmt)) %}\n {% endif %}\n {% endfor %}\n\n {{ return(date_list) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.convert_datetime"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.791596}, "macro.dbt.partition_range": {"unique_id": "macro.dbt.partition_range", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "partition_range", "macro_sql": "{% macro partition_range(raw_partition_date, date_fmt='%Y%m%d') %}\n {% set partition_range = (raw_partition_date | string).split(\",\") %}\n\n {% if (partition_range | length) == 1 %}\n {% set start_date = partition_range[0] %}\n {% set end_date = none %}\n {% elif (partition_range | length) == 2 %}\n {% set start_date = partition_range[0] %}\n {% set end_date = partition_range[1] %}\n {% else %}\n {{ exceptions.raise_compiler_error(\"Invalid partition time. Expected format: {Start Date}[,{End Date}]. Got: \" ~ raw_partition_date) }}\n {% endif %}\n\n {{ return(dates_in_range(start_date, end_date, in_fmt=date_fmt)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.dates_in_range"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.793637}, "macro.dbt.py_current_timestring": {"unique_id": "macro.dbt.py_current_timestring", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "py_current_timestring", "macro_sql": "{% macro py_current_timestring() %}\n {% set dt = modules.datetime.datetime.now() %}\n {% do return(dt.strftime(\"%Y%m%d%H%M%S%f\")) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.794369}, "macro.dbt.create_schema": {"unique_id": "macro.dbt.create_schema", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "name": "create_schema", "macro_sql": "{% macro create_schema(relation) -%}\n {{ adapter.dispatch('create_schema', 'dbt')(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__create_schema"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.795937}, "macro.dbt.default__create_schema": {"unique_id": "macro.dbt.default__create_schema", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "name": "default__create_schema", "macro_sql": "{% macro default__create_schema(relation) -%}\n {%- call statement('create_schema') -%}\n create schema if not exists {{ relation.without_identifier() }}\n {% endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.796397}, "macro.dbt.drop_schema": {"unique_id": "macro.dbt.drop_schema", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "name": "drop_schema", "macro_sql": "{% macro drop_schema(relation) -%}\n {{ adapter.dispatch('drop_schema', 'dbt')(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__drop_schema"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.796787}, "macro.dbt.default__drop_schema": {"unique_id": "macro.dbt.default__drop_schema", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "name": "default__drop_schema", "macro_sql": "{% macro default__drop_schema(relation) -%}\n {%- call statement('drop_schema') -%}\n drop schema if exists {{ relation.without_identifier() }} cascade\n {% endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.797187}, "macro.dbt.get_create_index_sql": {"unique_id": "macro.dbt.get_create_index_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "name": "get_create_index_sql", "macro_sql": "{% macro get_create_index_sql(relation, index_dict) -%}\n {{ return(adapter.dispatch('get_create_index_sql', 'dbt')(relation, index_dict)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_create_index_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.798153}, "macro.dbt.default__get_create_index_sql": {"unique_id": "macro.dbt.default__get_create_index_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "name": "default__get_create_index_sql", "macro_sql": "{% macro default__get_create_index_sql(relation, index_dict) -%}\n {% do return(None) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.798452}, "macro.dbt.create_indexes": {"unique_id": "macro.dbt.create_indexes", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "name": "create_indexes", "macro_sql": "{% macro create_indexes(relation) -%}\n {{ adapter.dispatch('create_indexes', 'dbt')(relation) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.798799}, "macro.dbt.default__create_indexes": {"unique_id": "macro.dbt.default__create_indexes", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "name": "default__create_indexes", "macro_sql": "{% macro default__create_indexes(relation) -%}\n {%- set _indexes = config.get('indexes', default=[]) -%}\n\n {% for _index_dict in _indexes %}\n {% set create_index_sql = get_create_index_sql(relation, _index_dict) %}\n {% if create_index_sql %}\n {% do run_query(create_index_sql) %}\n {% endif %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_create_index_sql", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.7997172}, "macro.dbt.make_temp_relation": {"unique_id": "macro.dbt.make_temp_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "make_temp_relation", "macro_sql": "{% macro make_temp_relation(base_relation, suffix='__dbt_tmp') %}\n {{ return(adapter.dispatch('make_temp_relation', 'dbt')(base_relation, suffix))}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__make_temp_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.802512}, "macro.dbt.default__make_temp_relation": {"unique_id": "macro.dbt.default__make_temp_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__make_temp_relation", "macro_sql": "{% macro default__make_temp_relation(base_relation, suffix) %}\n {% set tmp_identifier = base_relation.identifier ~ suffix %}\n {% set tmp_relation = base_relation.incorporate(\n path={\"identifier\": tmp_identifier}) -%}\n\n {% do return(tmp_relation) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.803516}, "macro.dbt.drop_relation": {"unique_id": "macro.dbt.drop_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "drop_relation", "macro_sql": "{% macro drop_relation(relation) -%}\n {{ return(adapter.dispatch('drop_relation', 'dbt')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__drop_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8039129}, "macro.dbt.default__drop_relation": {"unique_id": "macro.dbt.default__drop_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__drop_relation", "macro_sql": "{% macro default__drop_relation(relation) -%}\n {% call statement('drop_relation', auto_begin=False) -%}\n drop {{ relation.type }} if exists {{ relation }} cascade\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.804424}, "macro.dbt.truncate_relation": {"unique_id": "macro.dbt.truncate_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "truncate_relation", "macro_sql": "{% macro truncate_relation(relation) -%}\n {{ return(adapter.dispatch('truncate_relation', 'dbt')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__truncate_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.804822}, "macro.dbt.default__truncate_relation": {"unique_id": "macro.dbt.default__truncate_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__truncate_relation", "macro_sql": "{% macro default__truncate_relation(relation) -%}\n {% call statement('truncate_relation') -%}\n truncate table {{ relation }}\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.805177}, "macro.dbt.rename_relation": {"unique_id": "macro.dbt.rename_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "rename_relation", "macro_sql": "{% macro rename_relation(from_relation, to_relation) -%}\n {{ return(adapter.dispatch('rename_relation', 'dbt')(from_relation, to_relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__rename_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.805724}, "macro.dbt.default__rename_relation": {"unique_id": "macro.dbt.default__rename_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__rename_relation", "macro_sql": "{% macro default__rename_relation(from_relation, to_relation) -%}\n {% set target_name = adapter.quote_as_configured(to_relation.identifier, 'identifier') %}\n {% call statement('rename_relation') -%}\n alter table {{ from_relation }} rename to {{ target_name }}\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8063428}, "macro.dbt.get_or_create_relation": {"unique_id": "macro.dbt.get_or_create_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "get_or_create_relation", "macro_sql": "{% macro get_or_create_relation(database, schema, identifier, type) -%}\n {{ return(adapter.dispatch('get_or_create_relation', 'dbt')(database, schema, identifier, type)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_or_create_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8069298}, "macro.dbt.default__get_or_create_relation": {"unique_id": "macro.dbt.default__get_or_create_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__get_or_create_relation", "macro_sql": "{% macro default__get_or_create_relation(database, schema, identifier, type) %}\n {%- set target_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n\n {% if target_relation %}\n {% do return([true, target_relation]) %}\n {% endif %}\n\n {%- set new_relation = api.Relation.create(\n database=database,\n schema=schema,\n identifier=identifier,\n type=type\n ) -%}\n {% do return([false, new_relation]) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.808249}, "macro.dbt.load_relation": {"unique_id": "macro.dbt.load_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "load_relation", "macro_sql": "{% macro load_relation(relation) %}\n {% do return(adapter.get_relation(\n database=relation.database,\n schema=relation.schema,\n identifier=relation.identifier\n )) -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.80883}, "macro.dbt.drop_relation_if_exists": {"unique_id": "macro.dbt.drop_relation_if_exists", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "drop_relation_if_exists", "macro_sql": "{% macro drop_relation_if_exists(relation) %}\n {% if relation is not none %}\n {{ adapter.drop_relation(relation) }}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8095849}, "macro.dbt.current_timestamp": {"unique_id": "macro.dbt.current_timestamp", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "name": "current_timestamp", "macro_sql": "{% macro current_timestamp() -%}\n {{ adapter.dispatch('current_timestamp', 'dbt')() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.810751}, "macro.dbt.default__current_timestamp": {"unique_id": "macro.dbt.default__current_timestamp", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "name": "default__current_timestamp", "macro_sql": "{% macro default__current_timestamp() -%}\n {{ exceptions.raise_not_implemented(\n 'current_timestamp macro not implemented for adapter '+adapter.type()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8110762}, "macro.dbt.collect_freshness": {"unique_id": "macro.dbt.collect_freshness", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "name": "collect_freshness", "macro_sql": "{% macro collect_freshness(source, loaded_at_field, filter) %}\n {{ return(adapter.dispatch('collect_freshness', 'dbt')(source, loaded_at_field, filter))}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__collect_freshness"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.811571}, "macro.dbt.default__collect_freshness": {"unique_id": "macro.dbt.default__collect_freshness", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "name": "default__collect_freshness", "macro_sql": "{% macro default__collect_freshness(source, loaded_at_field, filter) %}\n {% call statement('collect_freshness', fetch_result=True, auto_begin=False) -%}\n select\n max({{ loaded_at_field }}) as max_loaded_at,\n {{ current_timestamp() }} as snapshotted_at\n from {{ source }}\n {% if filter %}\n where {{ filter }}\n {% endif %}\n {% endcall %}\n {{ return(load_result('collect_freshness').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8124769}, "macro.dbt.alter_column_comment": {"unique_id": "macro.dbt.alter_column_comment", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "alter_column_comment", "macro_sql": "{% macro alter_column_comment(relation, column_dict) -%}\n {{ return(adapter.dispatch('alter_column_comment', 'dbt')(relation, column_dict)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.813783}, "macro.dbt.default__alter_column_comment": {"unique_id": "macro.dbt.default__alter_column_comment", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "default__alter_column_comment", "macro_sql": "{% macro default__alter_column_comment(relation, column_dict) -%}\n {{ exceptions.raise_not_implemented(\n 'alter_column_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.814156}, "macro.dbt.alter_relation_comment": {"unique_id": "macro.dbt.alter_relation_comment", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "alter_relation_comment", "macro_sql": "{% macro alter_relation_comment(relation, relation_comment) -%}\n {{ return(adapter.dispatch('alter_relation_comment', 'dbt')(relation, relation_comment)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__alter_relation_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.814604}, "macro.dbt.default__alter_relation_comment": {"unique_id": "macro.dbt.default__alter_relation_comment", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "default__alter_relation_comment", "macro_sql": "{% macro default__alter_relation_comment(relation, relation_comment) -%}\n {{ exceptions.raise_not_implemented(\n 'alter_relation_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.814971}, "macro.dbt.persist_docs": {"unique_id": "macro.dbt.persist_docs", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "persist_docs", "macro_sql": "{% macro persist_docs(relation, model, for_relation=true, for_columns=true) -%}\n {{ return(adapter.dispatch('persist_docs', 'dbt')(relation, model, for_relation, for_columns)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.815559}, "macro.dbt.default__persist_docs": {"unique_id": "macro.dbt.default__persist_docs", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "default__persist_docs", "macro_sql": "{% macro default__persist_docs(relation, model, for_relation, for_columns) -%}\n {% if for_relation and config.persist_relation_docs() and model.description %}\n {% do run_query(alter_relation_comment(relation, model.description)) %}\n {% endif %}\n\n {% if for_columns and config.persist_column_docs() and model.columns %}\n {% do run_query(alter_column_comment(relation, model.columns)) %}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query", "macro.dbt.alter_relation_comment", "macro.dbt.alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.816597}, "macro.dbt.get_catalog": {"unique_id": "macro.dbt.get_catalog", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "get_catalog", "macro_sql": "{% macro get_catalog(information_schema, schemas) -%}\n {{ return(adapter.dispatch('get_catalog', 'dbt')(information_schema, schemas)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_catalog"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.820811}, "macro.dbt.default__get_catalog": {"unique_id": "macro.dbt.default__get_catalog", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__get_catalog", "macro_sql": "{% macro default__get_catalog(information_schema, schemas) -%}\n\n {% set typename = adapter.type() %}\n {% set msg -%}\n get_catalog not implemented for {{ typename }}\n {%- endset %}\n\n {{ exceptions.raise_compiler_error(msg) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8215091}, "macro.dbt.information_schema_name": {"unique_id": "macro.dbt.information_schema_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "information_schema_name", "macro_sql": "{% macro information_schema_name(database) %}\n {{ return(adapter.dispatch('information_schema_name', 'dbt')(database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__information_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.821953}, "macro.dbt.default__information_schema_name": {"unique_id": "macro.dbt.default__information_schema_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__information_schema_name", "macro_sql": "{% macro default__information_schema_name(database) -%}\n {%- if database -%}\n {{ database }}.INFORMATION_SCHEMA\n {%- else -%}\n INFORMATION_SCHEMA\n {%- endif -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8223622}, "macro.dbt.list_schemas": {"unique_id": "macro.dbt.list_schemas", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "list_schemas", "macro_sql": "{% macro list_schemas(database) -%}\n {{ return(adapter.dispatch('list_schemas', 'dbt')(database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__list_schemas"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.822835}, "macro.dbt.default__list_schemas": {"unique_id": "macro.dbt.default__list_schemas", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__list_schemas", "macro_sql": "{% macro default__list_schemas(database) -%}\n {% set sql %}\n select distinct schema_name\n from {{ information_schema_name(database) }}.SCHEMATA\n where catalog_name ilike '{{ database }}'\n {% endset %}\n {{ return(run_query(sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.information_schema_name", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8234382}, "macro.dbt.check_schema_exists": {"unique_id": "macro.dbt.check_schema_exists", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "check_schema_exists", "macro_sql": "{% macro check_schema_exists(information_schema, schema) -%}\n {{ return(adapter.dispatch('check_schema_exists', 'dbt')(information_schema, schema)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__check_schema_exists"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.823937}, "macro.dbt.default__check_schema_exists": {"unique_id": "macro.dbt.default__check_schema_exists", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__check_schema_exists", "macro_sql": "{% macro default__check_schema_exists(information_schema, schema) -%}\n {% set sql -%}\n select count(*)\n from {{ information_schema.replace(information_schema_view='SCHEMATA') }}\n where catalog_name='{{ information_schema.database }}'\n and schema_name='{{ schema }}'\n {%- endset %}\n {{ return(run_query(sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.replace", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.824768}, "macro.dbt.list_relations_without_caching": {"unique_id": "macro.dbt.list_relations_without_caching", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "list_relations_without_caching", "macro_sql": "{% macro list_relations_without_caching(schema_relation) %}\n {{ return(adapter.dispatch('list_relations_without_caching', 'dbt')(schema_relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__list_relations_without_caching"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.825184}, "macro.dbt.default__list_relations_without_caching": {"unique_id": "macro.dbt.default__list_relations_without_caching", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__list_relations_without_caching", "macro_sql": "{% macro default__list_relations_without_caching(schema_relation) %}\n {{ exceptions.raise_not_implemented(\n 'list_relations_without_caching macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.825543}, "macro.dbt.get_columns_in_relation": {"unique_id": "macro.dbt.get_columns_in_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "get_columns_in_relation", "macro_sql": "{% macro get_columns_in_relation(relation) -%}\n {{ return(adapter.dispatch('get_columns_in_relation', 'dbt')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__get_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.828556}, "macro.dbt.default__get_columns_in_relation": {"unique_id": "macro.dbt.default__get_columns_in_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "default__get_columns_in_relation", "macro_sql": "{% macro default__get_columns_in_relation(relation) -%}\n {{ exceptions.raise_not_implemented(\n 'get_columns_in_relation macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.828906}, "macro.dbt.sql_convert_columns_in_relation": {"unique_id": "macro.dbt.sql_convert_columns_in_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "sql_convert_columns_in_relation", "macro_sql": "{% macro sql_convert_columns_in_relation(table) -%}\n {% set columns = [] %}\n {% for row in table %}\n {% do columns.append(api.Column(*row)) %}\n {% endfor %}\n {{ return(columns) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.829576}, "macro.dbt.get_columns_in_query": {"unique_id": "macro.dbt.get_columns_in_query", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "get_columns_in_query", "macro_sql": "{% macro get_columns_in_query(select_sql) -%}\n {{ return(adapter.dispatch('get_columns_in_query', 'dbt')(select_sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.82998}, "macro.dbt.default__get_columns_in_query": {"unique_id": "macro.dbt.default__get_columns_in_query", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "default__get_columns_in_query", "macro_sql": "{% macro default__get_columns_in_query(select_sql) %}\n {% call statement('get_columns_in_query', fetch_result=True, auto_begin=False) -%}\n select * from (\n {{ select_sql }}\n ) as __dbt_sbq\n where false\n limit 0\n {% endcall %}\n\n {{ return(load_result('get_columns_in_query').table.columns | map(attribute='name') | list) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.830781}, "macro.dbt.alter_column_type": {"unique_id": "macro.dbt.alter_column_type", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "alter_column_type", "macro_sql": "{% macro alter_column_type(relation, column_name, new_column_type) -%}\n {{ return(adapter.dispatch('alter_column_type', 'dbt')(relation, column_name, new_column_type)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.831276}, "macro.dbt.default__alter_column_type": {"unique_id": "macro.dbt.default__alter_column_type", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "default__alter_column_type", "macro_sql": "{% macro default__alter_column_type(relation, column_name, new_column_type) -%}\n {#\n 1. Create a new column (w/ temp name and correct type)\n 2. Copy data over to it\n 3. Drop the existing column (cascade!)\n 4. Rename the new column to existing column\n #}\n {%- set tmp_column = column_name + \"__dbt_alter\" -%}\n\n {% call statement('alter_column_type') %}\n alter table {{ relation }} add column {{ adapter.quote(tmp_column) }} {{ new_column_type }};\n update {{ relation }} set {{ adapter.quote(tmp_column) }} = {{ adapter.quote(column_name) }};\n alter table {{ relation }} drop column {{ adapter.quote(column_name) }} cascade;\n alter table {{ relation }} rename column {{ adapter.quote(tmp_column) }} to {{ adapter.quote(column_name) }}\n {% endcall %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.832623}, "macro.dbt.alter_relation_add_remove_columns": {"unique_id": "macro.dbt.alter_relation_add_remove_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "alter_relation_add_remove_columns", "macro_sql": "{% macro alter_relation_add_remove_columns(relation, add_columns = none, remove_columns = none) -%}\n {{ return(adapter.dispatch('alter_relation_add_remove_columns', 'dbt')(relation, add_columns, remove_columns)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__alter_relation_add_remove_columns"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.833177}, "macro.dbt.default__alter_relation_add_remove_columns": {"unique_id": "macro.dbt.default__alter_relation_add_remove_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "default__alter_relation_add_remove_columns", "macro_sql": "{% macro default__alter_relation_add_remove_columns(relation, add_columns, remove_columns) %}\n \n {% if add_columns is none %}\n {% set add_columns = [] %}\n {% endif %}\n {% if remove_columns is none %}\n {% set remove_columns = [] %}\n {% endif %}\n \n {% set sql -%}\n \n alter {{ relation.type }} {{ relation }}\n \n {% for column in add_columns %}\n add column {{ column.name }} {{ column.data_type }}{{ ',' if not loop.last }}\n {% endfor %}{{ ',' if add_columns and remove_columns }}\n \n {% for column in remove_columns %}\n drop column {{ column.name }}{{ ',' if not loop.last }}\n {% endfor %}\n \n {%- endset -%}\n\n {% do run_query(sql) %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.836224}, "macro.dbt.test_unique": {"unique_id": "macro.dbt.test_unique", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "name": "test_unique", "macro_sql": "{% test unique(model, column_name) %}\n {% set macro = adapter.dispatch('test_unique', 'dbt') %}\n {{ macro(model, column_name) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_bigquery.bigquery__test_unique"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.838303}, "macro.dbt.test_not_null": {"unique_id": "macro.dbt.test_not_null", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "name": "test_not_null", "macro_sql": "{% test not_null(model, column_name) %}\n {% set macro = adapter.dispatch('test_not_null', 'dbt') %}\n {{ macro(model, column_name) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__test_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8388531}, "macro.dbt.test_accepted_values": {"unique_id": "macro.dbt.test_accepted_values", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "name": "test_accepted_values", "macro_sql": "{% test accepted_values(model, column_name, values, quote=True) %}\n {% set macro = adapter.dispatch('test_accepted_values', 'dbt') %}\n {{ macro(model, column_name, values, quote) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__test_accepted_values"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.839527}, "macro.dbt.test_relationships": {"unique_id": "macro.dbt.test_relationships", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "name": "test_relationships", "macro_sql": "{% test relationships(model, column_name, to, field) %}\n {% set macro = adapter.dispatch('test_relationships', 'dbt') %}\n {{ macro(model, column_name, to, field) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__test_relationships"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.840215}, "macro.dbt_utils.except": {"unique_id": "macro.dbt_utils.except", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/except.sql", "original_file_path": "macros/cross_db_utils/except.sql", "name": "except", "macro_sql": "{% macro except() %}\n {{ return(adapter.dispatch('except', 'dbt_utils')()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__except"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.841411}, "macro.dbt_utils.default__except": {"unique_id": "macro.dbt_utils.default__except", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/except.sql", "original_file_path": "macros/cross_db_utils/except.sql", "name": "default__except", "macro_sql": "{% macro default__except() %}\n\n except\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.841585}, "macro.dbt_utils.bigquery__except": {"unique_id": "macro.dbt_utils.bigquery__except", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/except.sql", "original_file_path": "macros/cross_db_utils/except.sql", "name": "bigquery__except", "macro_sql": "{% macro bigquery__except() %}\n\n except distinct\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8418188}, "macro.dbt_utils.replace": {"unique_id": "macro.dbt_utils.replace", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/replace.sql", "original_file_path": "macros/cross_db_utils/replace.sql", "name": "replace", "macro_sql": "{% macro replace(field, old_chars, new_chars) -%}\n {{ return(adapter.dispatch('replace', 'dbt_utils') (field, old_chars, new_chars)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__replace"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.842864}, "macro.dbt_utils.default__replace": {"unique_id": "macro.dbt_utils.default__replace", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/replace.sql", "original_file_path": "macros/cross_db_utils/replace.sql", "name": "default__replace", "macro_sql": "{% macro default__replace(field, old_chars, new_chars) %}\n\n replace(\n {{ field }},\n {{ old_chars }},\n {{ new_chars }}\n )\n \n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.843256}, "macro.dbt_utils.concat": {"unique_id": "macro.dbt_utils.concat", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/concat.sql", "original_file_path": "macros/cross_db_utils/concat.sql", "name": "concat", "macro_sql": "{% macro concat(fields) -%}\n {{ return(adapter.dispatch('concat', 'dbt_utils')(fields)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__concat"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.843929}, "macro.dbt_utils.default__concat": {"unique_id": "macro.dbt_utils.default__concat", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/concat.sql", "original_file_path": "macros/cross_db_utils/concat.sql", "name": "default__concat", "macro_sql": "{% macro default__concat(fields) -%}\n {{ fields|join(' || ') }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.84422}, "macro.dbt_utils.type_string": {"unique_id": "macro.dbt_utils.type_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_string", "macro_sql": "\n\n{%- macro type_string() -%}\n {{ return(adapter.dispatch('type_string', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.845669}, "macro.dbt_utils.default__type_string": {"unique_id": "macro.dbt_utils.default__type_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_string", "macro_sql": "{% macro default__type_string() %}\n string\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8459468}, "macro.dbt_utils.redshift__type_string": {"unique_id": "macro.dbt_utils.redshift__type_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "redshift__type_string", "macro_sql": "\n\n{%- macro redshift__type_string() -%}\n varchar\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.846113}, "macro.dbt_utils.postgres__type_string": {"unique_id": "macro.dbt_utils.postgres__type_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "postgres__type_string", "macro_sql": "{% macro postgres__type_string() %}\n varchar\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.846275}, "macro.dbt_utils.snowflake__type_string": {"unique_id": "macro.dbt_utils.snowflake__type_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "snowflake__type_string", "macro_sql": "{% macro snowflake__type_string() %}\n varchar\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.846435}, "macro.dbt_utils.type_timestamp": {"unique_id": "macro.dbt_utils.type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_timestamp", "macro_sql": "\n\n{%- macro type_timestamp() -%}\n {{ return(adapter.dispatch('type_timestamp', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.846783}, "macro.dbt_utils.default__type_timestamp": {"unique_id": "macro.dbt_utils.default__type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_timestamp", "macro_sql": "{% macro default__type_timestamp() %}\n timestamp\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8469481}, "macro.dbt_utils.postgres__type_timestamp": {"unique_id": "macro.dbt_utils.postgres__type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "postgres__type_timestamp", "macro_sql": "{% macro postgres__type_timestamp() %}\n timestamp without time zone\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.847109}, "macro.dbt_utils.snowflake__type_timestamp": {"unique_id": "macro.dbt_utils.snowflake__type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "snowflake__type_timestamp", "macro_sql": "{% macro snowflake__type_timestamp() %}\n timestamp_ntz\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.847266}, "macro.dbt_utils.type_float": {"unique_id": "macro.dbt_utils.type_float", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_float", "macro_sql": "\n\n{%- macro type_float() -%}\n {{ return(adapter.dispatch('type_float', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__type_float"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.84761}, "macro.dbt_utils.default__type_float": {"unique_id": "macro.dbt_utils.default__type_float", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_float", "macro_sql": "{% macro default__type_float() %}\n float\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8477728}, "macro.dbt_utils.bigquery__type_float": {"unique_id": "macro.dbt_utils.bigquery__type_float", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_float", "macro_sql": "{% macro bigquery__type_float() %}\n float64\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.847934}, "macro.dbt_utils.type_numeric": {"unique_id": "macro.dbt_utils.type_numeric", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_numeric", "macro_sql": "\n\n{%- macro type_numeric() -%}\n {{ return(adapter.dispatch('type_numeric', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.84848}, "macro.dbt_utils.default__type_numeric": {"unique_id": "macro.dbt_utils.default__type_numeric", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_numeric", "macro_sql": "{% macro default__type_numeric() %}\n numeric(28, 6)\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.848825}, "macro.dbt_utils.bigquery__type_numeric": {"unique_id": "macro.dbt_utils.bigquery__type_numeric", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_numeric", "macro_sql": "{% macro bigquery__type_numeric() %}\n numeric\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.849045}, "macro.dbt_utils.type_bigint": {"unique_id": "macro.dbt_utils.type_bigint", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_bigint", "macro_sql": "\n\n{%- macro type_bigint() -%}\n {{ return(adapter.dispatch('type_bigint', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8496158}, "macro.dbt_utils.default__type_bigint": {"unique_id": "macro.dbt_utils.default__type_bigint", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_bigint", "macro_sql": "{% macro default__type_bigint() %}\n bigint\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.849791}, "macro.dbt_utils.bigquery__type_bigint": {"unique_id": "macro.dbt_utils.bigquery__type_bigint", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_bigint", "macro_sql": "{% macro bigquery__type_bigint() %}\n int64\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.850076}, "macro.dbt_utils.type_int": {"unique_id": "macro.dbt_utils.type_int", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_int", "macro_sql": "\n\n{%- macro type_int() -%}\n {{ return(adapter.dispatch('type_int', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__type_int"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.85044}, "macro.dbt_utils.default__type_int": {"unique_id": "macro.dbt_utils.default__type_int", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_int", "macro_sql": "{% macro default__type_int() %}\n int\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.850611}, "macro.dbt_utils.bigquery__type_int": {"unique_id": "macro.dbt_utils.bigquery__type_int", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_int", "macro_sql": "{% macro bigquery__type_int() %}\n int64\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.850801}, "macro.dbt_utils._is_relation": {"unique_id": "macro.dbt_utils._is_relation", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/_is_relation.sql", "original_file_path": "macros/cross_db_utils/_is_relation.sql", "name": "_is_relation", "macro_sql": "{% macro _is_relation(obj, macro) %}\n {%- if not (obj is mapping and obj.get('metadata', {}).get('type', '').endswith('Relation')) -%}\n {%- do exceptions.raise_compiler_error(\"Macro \" ~ macro ~ \" expected a Relation but received the value: \" ~ obj) -%}\n {%- endif -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.852258}, "macro.dbt_utils.cast_array_to_string": {"unique_id": "macro.dbt_utils.cast_array_to_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_array_to_string.sql", "original_file_path": "macros/cross_db_utils/cast_array_to_string.sql", "name": "cast_array_to_string", "macro_sql": "{% macro cast_array_to_string(array) %}\n {{ adapter.dispatch('cast_array_to_string', 'dbt_utils') (array) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__cast_array_to_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.853392}, "macro.dbt_utils.default__cast_array_to_string": {"unique_id": "macro.dbt_utils.default__cast_array_to_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_array_to_string.sql", "original_file_path": "macros/cross_db_utils/cast_array_to_string.sql", "name": "default__cast_array_to_string", "macro_sql": "{% macro default__cast_array_to_string(array) %}\n cast({{ array }} as {{ dbt_utils.type_string() }})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8537269}, "macro.dbt_utils.postgres__cast_array_to_string": {"unique_id": "macro.dbt_utils.postgres__cast_array_to_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_array_to_string.sql", "original_file_path": "macros/cross_db_utils/cast_array_to_string.sql", "name": "postgres__cast_array_to_string", "macro_sql": "{% macro postgres__cast_array_to_string(array) %}\n {%- set array_as_string -%}cast({{ array }} as {{ dbt_utils.type_string() }}){%- endset -%}\n {{ dbt_utils.replace(dbt_utils.replace(array_as_string,\"'}'\",\"']'\"),\"'{'\",\"'['\") }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string", "macro.dbt_utils.replace"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.854899}, "macro.dbt_utils.redshift__cast_array_to_string": {"unique_id": "macro.dbt_utils.redshift__cast_array_to_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_array_to_string.sql", "original_file_path": "macros/cross_db_utils/cast_array_to_string.sql", "name": "redshift__cast_array_to_string", "macro_sql": "{% macro redshift__cast_array_to_string(array) %}\n cast({{ array }} as {{ dbt_utils.type_string() }})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.855371}, "macro.dbt_utils.bigquery__cast_array_to_string": {"unique_id": "macro.dbt_utils.bigquery__cast_array_to_string", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_array_to_string.sql", "original_file_path": "macros/cross_db_utils/cast_array_to_string.sql", "name": "bigquery__cast_array_to_string", "macro_sql": "{% macro bigquery__cast_array_to_string(array) %}\n '['||(select string_agg(cast(element as string), ',') from unnest({{ array }}) element)||']'\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8556118}, "macro.dbt_utils.length": {"unique_id": "macro.dbt_utils.length", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/length.sql", "original_file_path": "macros/cross_db_utils/length.sql", "name": "length", "macro_sql": "{% macro length(expression) -%}\n {{ return(adapter.dispatch('length', 'dbt_utils') (expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__length"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.856446}, "macro.dbt_utils.default__length": {"unique_id": "macro.dbt_utils.default__length", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/length.sql", "original_file_path": "macros/cross_db_utils/length.sql", "name": "default__length", "macro_sql": "{% macro default__length(expression) %}\n \n length(\n {{ expression }}\n )\n \n{%- endmacro -%}\n\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.85669}, "macro.dbt_utils.redshift__length": {"unique_id": "macro.dbt_utils.redshift__length", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/length.sql", "original_file_path": "macros/cross_db_utils/length.sql", "name": "redshift__length", "macro_sql": "{% macro redshift__length(expression) %}\n\n len(\n {{ expression }}\n )\n \n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.856944}, "macro.dbt_utils.dateadd": {"unique_id": "macro.dbt_utils.dateadd", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "dateadd", "macro_sql": "{% macro dateadd(datepart, interval, from_date_or_timestamp) %}\n {{ return(adapter.dispatch('dateadd', 'dbt_utils')(datepart, interval, from_date_or_timestamp)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.858359}, "macro.dbt_utils.default__dateadd": {"unique_id": "macro.dbt_utils.default__dateadd", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "default__dateadd", "macro_sql": "{% macro default__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n dateadd(\n {{ datepart }},\n {{ interval }},\n {{ from_date_or_timestamp }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.858839}, "macro.dbt_utils.bigquery__dateadd": {"unique_id": "macro.dbt_utils.bigquery__dateadd", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "bigquery__dateadd", "macro_sql": "{% macro bigquery__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n datetime_add(\n cast( {{ from_date_or_timestamp }} as datetime),\n interval {{ interval }} {{ datepart }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.859356}, "macro.dbt_utils.postgres__dateadd": {"unique_id": "macro.dbt_utils.postgres__dateadd", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "postgres__dateadd", "macro_sql": "{% macro postgres__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n {{ from_date_or_timestamp }} + ((interval '1 {{ datepart }}') * ({{ interval }}))\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8597271}, "macro.dbt_utils.redshift__dateadd": {"unique_id": "macro.dbt_utils.redshift__dateadd", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "redshift__dateadd", "macro_sql": "{% macro redshift__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n {{ return(dbt_utils.default__dateadd(datepart, interval, from_date_or_timestamp)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.860342}, "macro.dbt_utils.intersect": {"unique_id": "macro.dbt_utils.intersect", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/intersect.sql", "original_file_path": "macros/cross_db_utils/intersect.sql", "name": "intersect", "macro_sql": "{% macro intersect() %}\n {{ return(adapter.dispatch('intersect', 'dbt_utils')()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__intersect"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.861022}, "macro.dbt_utils.default__intersect": {"unique_id": "macro.dbt_utils.default__intersect", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/intersect.sql", "original_file_path": "macros/cross_db_utils/intersect.sql", "name": "default__intersect", "macro_sql": "{% macro default__intersect() %}\n\n intersect\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8612669}, "macro.dbt_utils.bigquery__intersect": {"unique_id": "macro.dbt_utils.bigquery__intersect", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/intersect.sql", "original_file_path": "macros/cross_db_utils/intersect.sql", "name": "bigquery__intersect", "macro_sql": "{% macro bigquery__intersect() %}\n\n intersect distinct\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8615491}, "macro.dbt_utils.escape_single_quotes": {"unique_id": "macro.dbt_utils.escape_single_quotes", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/escape_single_quotes.sql", "original_file_path": "macros/cross_db_utils/escape_single_quotes.sql", "name": "escape_single_quotes", "macro_sql": "{% macro escape_single_quotes(expression) %}\n {{ return(adapter.dispatch('escape_single_quotes', 'dbt_utils') (expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__escape_single_quotes"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.862447}, "macro.dbt_utils.default__escape_single_quotes": {"unique_id": "macro.dbt_utils.default__escape_single_quotes", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/escape_single_quotes.sql", "original_file_path": "macros/cross_db_utils/escape_single_quotes.sql", "name": "default__escape_single_quotes", "macro_sql": "{% macro default__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\",\"''\") }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.862766}, "macro.dbt_utils.snowflake__escape_single_quotes": {"unique_id": "macro.dbt_utils.snowflake__escape_single_quotes", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/escape_single_quotes.sql", "original_file_path": "macros/cross_db_utils/escape_single_quotes.sql", "name": "snowflake__escape_single_quotes", "macro_sql": "{% macro snowflake__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\", \"\\\\'\") }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8631308}, "macro.dbt_utils.bigquery__escape_single_quotes": {"unique_id": "macro.dbt_utils.bigquery__escape_single_quotes", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/escape_single_quotes.sql", "original_file_path": "macros/cross_db_utils/escape_single_quotes.sql", "name": "bigquery__escape_single_quotes", "macro_sql": "{% macro bigquery__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\", \"\\\\'\") }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.863439}, "macro.dbt_utils.right": {"unique_id": "macro.dbt_utils.right", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "right", "macro_sql": "{% macro right(string_text, length_expression) -%}\n {{ return(adapter.dispatch('right', 'dbt_utils') (string_text, length_expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__right"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.864588}, "macro.dbt_utils.default__right": {"unique_id": "macro.dbt_utils.default__right", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "default__right", "macro_sql": "{% macro default__right(string_text, length_expression) %}\n\n right(\n {{ string_text }},\n {{ length_expression }}\n )\n \n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.86489}, "macro.dbt_utils.bigquery__right": {"unique_id": "macro.dbt_utils.bigquery__right", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "bigquery__right", "macro_sql": "{% macro bigquery__right(string_text, length_expression) %}\n\n case when {{ length_expression }} = 0 \n then ''\n else \n substr(\n {{ string_text }},\n -1 * ({{ length_expression }})\n )\n end\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8653288}, "macro.dbt_utils.snowflake__right": {"unique_id": "macro.dbt_utils.snowflake__right", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "snowflake__right", "macro_sql": "{% macro snowflake__right(string_text, length_expression) %}\n\n case when {{ length_expression }} = 0 \n then ''\n else \n right(\n {{ string_text }},\n {{ length_expression }}\n )\n end\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8656719}, "macro.dbt_utils.listagg": {"unique_id": "macro.dbt_utils.listagg", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/listagg.sql", "original_file_path": "macros/cross_db_utils/listagg.sql", "name": "listagg", "macro_sql": "{% macro listagg(measure, delimiter_text=\"','\", order_by_clause=none, limit_num=none) -%}\n {{ return(adapter.dispatch('listagg', 'dbt_utils') (measure, delimiter_text, order_by_clause, limit_num)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__listagg"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8695521}, "macro.dbt_utils.default__listagg": {"unique_id": "macro.dbt_utils.default__listagg", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/listagg.sql", "original_file_path": "macros/cross_db_utils/listagg.sql", "name": "default__listagg", "macro_sql": "{% macro default__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n\n {% if limit_num -%}\n array_to_string(\n array_slice(\n array_agg(\n {{ measure }}\n ){% if order_by_clause -%}\n within group ({{ order_by_clause }})\n {%- endif %}\n ,0\n ,{{ limit_num }}\n ),\n {{ delimiter_text }}\n )\n {%- else %}\n listagg(\n {{ measure }},\n {{ delimiter_text }}\n )\n {% if order_by_clause -%}\n within group ({{ order_by_clause }})\n {%- endif %}\n {%- endif %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.870634}, "macro.dbt_utils.bigquery__listagg": {"unique_id": "macro.dbt_utils.bigquery__listagg", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/listagg.sql", "original_file_path": "macros/cross_db_utils/listagg.sql", "name": "bigquery__listagg", "macro_sql": "{% macro bigquery__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n\n string_agg(\n {{ measure }},\n {{ delimiter_text }}\n {% if order_by_clause -%}\n {{ order_by_clause }}\n {%- endif %}\n {% if limit_num -%}\n limit {{ limit_num }}\n {%- endif %}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.87133}, "macro.dbt_utils.postgres__listagg": {"unique_id": "macro.dbt_utils.postgres__listagg", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/listagg.sql", "original_file_path": "macros/cross_db_utils/listagg.sql", "name": "postgres__listagg", "macro_sql": "{% macro postgres__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n \n {% if limit_num -%}\n array_to_string(\n (array_agg(\n {{ measure }}\n {% if order_by_clause -%}\n {{ order_by_clause }}\n {%- endif %}\n ))[1:{{ limit_num }}],\n {{ delimiter_text }}\n )\n {%- else %}\n string_agg(\n {{ measure }},\n {{ delimiter_text }}\n {% if order_by_clause -%}\n {{ order_by_clause }}\n {%- endif %}\n )\n {%- endif %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8723001}, "macro.dbt_utils.redshift__listagg": {"unique_id": "macro.dbt_utils.redshift__listagg", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/listagg.sql", "original_file_path": "macros/cross_db_utils/listagg.sql", "name": "redshift__listagg", "macro_sql": "{% macro redshift__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n\n {% if limit_num -%}\n {% set ns = namespace() %}\n {% set ns.delimiter_text_regex = delimiter_text|trim(\"'\") %}\n {% set special_chars %}\\,^,$,.,|,?,*,+,(,),[,],{,}{% endset %} \n {%- for char in special_chars.split(',') -%}\n {% set escape_char %}\\\\{{ char }}{% endset %}\n {% set ns.delimiter_text_regex = ns.delimiter_text_regex|replace(char,escape_char) %}\n {%- endfor -%}\n\n {% set regex %}'([^{{ ns.delimiter_text_regex }}]+{{ ns.delimiter_text_regex }}){1,{{ limit_num - 1}}}[^{{ ns.delimiter_text_regex }}]+'{% endset %}\n regexp_substr(\n listagg(\n {{ measure }},\n {{ delimiter_text }}\n )\n {% if order_by_clause -%}\n within group ({{ order_by_clause }})\n {%- endif %}\n ,{{ regex }}\n )\n {%- else %}\n listagg(\n {{ measure }},\n {{ delimiter_text }}\n )\n {% if order_by_clause -%}\n within group ({{ order_by_clause }})\n {%- endif %}\n {%- endif %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.874482}, "macro.dbt_utils.datediff": {"unique_id": "macro.dbt_utils.datediff", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "datediff", "macro_sql": "{% macro datediff(first_date, second_date, datepart) %}\n {{ return(adapter.dispatch('datediff', 'dbt_utils')(first_date, second_date, datepart)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.878845}, "macro.dbt_utils.default__datediff": {"unique_id": "macro.dbt_utils.default__datediff", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "default__datediff", "macro_sql": "{% macro default__datediff(first_date, second_date, datepart) -%}\n\n datediff(\n {{ datepart }},\n {{ first_date }},\n {{ second_date }}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.879251}, "macro.dbt_utils.bigquery__datediff": {"unique_id": "macro.dbt_utils.bigquery__datediff", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "bigquery__datediff", "macro_sql": "{% macro bigquery__datediff(first_date, second_date, datepart) -%}\n\n datetime_diff(\n cast({{second_date}} as datetime),\n cast({{first_date}} as datetime),\n {{datepart}}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.879638}, "macro.dbt_utils.postgres__datediff": {"unique_id": "macro.dbt_utils.postgres__datediff", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "postgres__datediff", "macro_sql": "{% macro postgres__datediff(first_date, second_date, datepart) -%}\n\n {% if datepart == 'year' %}\n (date_part('year', ({{second_date}})::date) - date_part('year', ({{first_date}})::date))\n {% elif datepart == 'quarter' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 4 + date_part('quarter', ({{second_date}})::date) - date_part('quarter', ({{first_date}})::date))\n {% elif datepart == 'month' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 12 + date_part('month', ({{second_date}})::date) - date_part('month', ({{first_date}})::date))\n {% elif datepart == 'day' %}\n (({{second_date}})::date - ({{first_date}})::date)\n {% elif datepart == 'week' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} / 7 + case\n when date_part('dow', ({{first_date}})::timestamp) <= date_part('dow', ({{second_date}})::timestamp) then\n case when {{first_date}} <= {{second_date}} then 0 else -1 end\n else\n case when {{first_date}} <= {{second_date}} then 1 else 0 end\n end)\n {% elif datepart == 'hour' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} * 24 + date_part('hour', ({{second_date}})::timestamp) - date_part('hour', ({{first_date}})::timestamp))\n {% elif datepart == 'minute' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'hour') }} * 60 + date_part('minute', ({{second_date}})::timestamp) - date_part('minute', ({{first_date}})::timestamp))\n {% elif datepart == 'second' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60 + floor(date_part('second', ({{second_date}})::timestamp)) - floor(date_part('second', ({{first_date}})::timestamp)))\n {% elif datepart == 'millisecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000 + floor(date_part('millisecond', ({{second_date}})::timestamp)) - floor(date_part('millisecond', ({{first_date}})::timestamp)))\n {% elif datepart == 'microsecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000000 + floor(date_part('microsecond', ({{second_date}})::timestamp)) - floor(date_part('microsecond', ({{first_date}})::timestamp)))\n {% else %}\n {{ exceptions.raise_compiler_error(\"Unsupported datepart for macro datediff in postgres: {!r}\".format(datepart)) }}\n {% endif %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.88371}, "macro.dbt_utils.redshift__datediff": {"unique_id": "macro.dbt_utils.redshift__datediff", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "redshift__datediff", "macro_sql": "{% macro redshift__datediff(first_date, second_date, datepart) -%}\n\n {{ return(dbt_utils.default__datediff(first_date, second_date, datepart)) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8842502}, "macro.dbt_utils.safe_cast": {"unique_id": "macro.dbt_utils.safe_cast", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "safe_cast", "macro_sql": "{% macro safe_cast(field, type) %}\n {{ return(adapter.dispatch('safe_cast', 'dbt_utils') (field, type)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__safe_cast"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.88512}, "macro.dbt_utils.default__safe_cast": {"unique_id": "macro.dbt_utils.default__safe_cast", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "default__safe_cast", "macro_sql": "{% macro default__safe_cast(field, type) %}\n {# most databases don't support this function yet\n so we just need to use cast #}\n cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.885442}, "macro.dbt_utils.snowflake__safe_cast": {"unique_id": "macro.dbt_utils.snowflake__safe_cast", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "snowflake__safe_cast", "macro_sql": "{% macro snowflake__safe_cast(field, type) %}\n try_cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.885739}, "macro.dbt_utils.bigquery__safe_cast": {"unique_id": "macro.dbt_utils.bigquery__safe_cast", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "bigquery__safe_cast", "macro_sql": "{% macro bigquery__safe_cast(field, type) %}\n safe_cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8860328}, "macro.dbt_utils.hash": {"unique_id": "macro.dbt_utils.hash", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/hash.sql", "original_file_path": "macros/cross_db_utils/hash.sql", "name": "hash", "macro_sql": "{% macro hash(field) -%}\n {{ return(adapter.dispatch('hash', 'dbt_utils') (field)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__hash"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.886764}, "macro.dbt_utils.default__hash": {"unique_id": "macro.dbt_utils.default__hash", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/hash.sql", "original_file_path": "macros/cross_db_utils/hash.sql", "name": "default__hash", "macro_sql": "{% macro default__hash(field) -%}\n md5(cast({{field}} as {{dbt_utils.type_string()}}))\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.887085}, "macro.dbt_utils.bigquery__hash": {"unique_id": "macro.dbt_utils.bigquery__hash", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/hash.sql", "original_file_path": "macros/cross_db_utils/hash.sql", "name": "bigquery__hash", "macro_sql": "{% macro bigquery__hash(field) -%}\n to_hex({{dbt_utils.default__hash(field)}})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__hash"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.887383}, "macro.dbt_utils.cast_bool_to_text": {"unique_id": "macro.dbt_utils.cast_bool_to_text", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_bool_to_text.sql", "original_file_path": "macros/cross_db_utils/cast_bool_to_text.sql", "name": "cast_bool_to_text", "macro_sql": "{% macro cast_bool_to_text(field) %}\n {{ adapter.dispatch('cast_bool_to_text', 'dbt_utils') (field) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.888136}, "macro.dbt_utils.default__cast_bool_to_text": {"unique_id": "macro.dbt_utils.default__cast_bool_to_text", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_bool_to_text.sql", "original_file_path": "macros/cross_db_utils/cast_bool_to_text.sql", "name": "default__cast_bool_to_text", "macro_sql": "{% macro default__cast_bool_to_text(field) %}\n cast({{ field }} as {{ dbt_utils.type_string() }})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.888463}, "macro.dbt_utils.redshift__cast_bool_to_text": {"unique_id": "macro.dbt_utils.redshift__cast_bool_to_text", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_bool_to_text.sql", "original_file_path": "macros/cross_db_utils/cast_bool_to_text.sql", "name": "redshift__cast_bool_to_text", "macro_sql": "{% macro redshift__cast_bool_to_text(field) %}\n case\n when {{ field }} is true then 'true'\n when {{ field }} is false then 'false'\n end::text\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.888872}, "macro.dbt_utils.identifier": {"unique_id": "macro.dbt_utils.identifier", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/identifier.sql", "original_file_path": "macros/cross_db_utils/identifier.sql", "name": "identifier", "macro_sql": "{% macro identifier(value) %}\t\n {%- set error_message = '\n Warning: the `identifier` macro is no longer supported and will be deprecated in a future release of dbt-utils. \\\n Use `adapter.quote` instead. The {}.{} model triggered this warning. \\\n '.format(model.package_name, model.name) -%}\n {%- do exceptions.warn(error_message) -%}\n {{ return(adapter.dispatch('identifier', 'dbt_utils') (value)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__identifier"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.889976}, "macro.dbt_utils.default__identifier": {"unique_id": "macro.dbt_utils.default__identifier", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/identifier.sql", "original_file_path": "macros/cross_db_utils/identifier.sql", "name": "default__identifier", "macro_sql": "{% macro default__identifier(value) -%}\t\n \"{{ value }}\"\t\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.890269}, "macro.dbt_utils.bigquery__identifier": {"unique_id": "macro.dbt_utils.bigquery__identifier", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/identifier.sql", "original_file_path": "macros/cross_db_utils/identifier.sql", "name": "bigquery__identifier", "macro_sql": "{% macro bigquery__identifier(value) -%}\t\n `{{ value }}`\t\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.890504}, "macro.dbt_utils.any_value": {"unique_id": "macro.dbt_utils.any_value", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/any_value.sql", "original_file_path": "macros/cross_db_utils/any_value.sql", "name": "any_value", "macro_sql": "{% macro any_value(expression) -%}\n {{ return(adapter.dispatch('any_value', 'dbt_utils') (expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__any_value"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.891444}, "macro.dbt_utils.default__any_value": {"unique_id": "macro.dbt_utils.default__any_value", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/any_value.sql", "original_file_path": "macros/cross_db_utils/any_value.sql", "name": "default__any_value", "macro_sql": "{% macro default__any_value(expression) -%}\n \n any_value({{ expression }})\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.89169}, "macro.dbt_utils.postgres__any_value": {"unique_id": "macro.dbt_utils.postgres__any_value", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/any_value.sql", "original_file_path": "macros/cross_db_utils/any_value.sql", "name": "postgres__any_value", "macro_sql": "{% macro postgres__any_value(expression) -%}\n {#- /*Postgres doesn't support any_value, so we're using min() to get the same result*/ -#}\n min({{ expression }})\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.89194}, "macro.dbt_utils.position": {"unique_id": "macro.dbt_utils.position", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/position.sql", "original_file_path": "macros/cross_db_utils/position.sql", "name": "position", "macro_sql": "{% macro position(substring_text, string_text) -%}\n {{ return(adapter.dispatch('position', 'dbt_utils') (substring_text, string_text)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__position"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.892998}, "macro.dbt_utils.default__position": {"unique_id": "macro.dbt_utils.default__position", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/position.sql", "original_file_path": "macros/cross_db_utils/position.sql", "name": "default__position", "macro_sql": "{% macro default__position(substring_text, string_text) %}\n\n position(\n {{ substring_text }} in {{ string_text }}\n )\n \n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.893316}, "macro.dbt_utils.bigquery__position": {"unique_id": "macro.dbt_utils.bigquery__position", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/position.sql", "original_file_path": "macros/cross_db_utils/position.sql", "name": "bigquery__position", "macro_sql": "{% macro bigquery__position(substring_text, string_text) %}\n\n strpos(\n {{ string_text }},\n {{ substring_text }}\n \n )\n \n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.89363}, "macro.dbt_utils.string_literal": {"unique_id": "macro.dbt_utils.string_literal", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/literal.sql", "original_file_path": "macros/cross_db_utils/literal.sql", "name": "string_literal", "macro_sql": "{%- macro string_literal(value) -%}\n {{ return(adapter.dispatch('string_literal', 'dbt_utils') (value)) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__string_literal"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8942962}, "macro.dbt_utils.default__string_literal": {"unique_id": "macro.dbt_utils.default__string_literal", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/literal.sql", "original_file_path": "macros/cross_db_utils/literal.sql", "name": "default__string_literal", "macro_sql": "{% macro default__string_literal(value) -%}\n '{{ value }}'\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.894537}, "macro.dbt_utils.current_timestamp": {"unique_id": "macro.dbt_utils.current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "current_timestamp", "macro_sql": "{% macro current_timestamp() -%}\n {{ return(adapter.dispatch('current_timestamp', 'dbt_utils')()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8957179}, "macro.dbt_utils.default__current_timestamp": {"unique_id": "macro.dbt_utils.default__current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "default__current_timestamp", "macro_sql": "{% macro default__current_timestamp() %}\n current_timestamp::{{dbt_utils.type_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.896032}, "macro.dbt_utils.redshift__current_timestamp": {"unique_id": "macro.dbt_utils.redshift__current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "redshift__current_timestamp", "macro_sql": "{% macro redshift__current_timestamp() %}\n getdate()\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.896242}, "macro.dbt_utils.bigquery__current_timestamp": {"unique_id": "macro.dbt_utils.bigquery__current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "bigquery__current_timestamp", "macro_sql": "{% macro bigquery__current_timestamp() %}\n current_timestamp\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.896422}, "macro.dbt_utils.current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "current_timestamp_in_utc", "macro_sql": "{% macro current_timestamp_in_utc() -%}\n {{ return(adapter.dispatch('current_timestamp_in_utc', 'dbt_utils')()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__current_timestamp_in_utc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8968031}, "macro.dbt_utils.default__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.default__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "default__current_timestamp_in_utc", "macro_sql": "{% macro default__current_timestamp_in_utc() %}\n {{dbt_utils.current_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.897119}, "macro.dbt_utils.snowflake__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.snowflake__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "snowflake__current_timestamp_in_utc", "macro_sql": "{% macro snowflake__current_timestamp_in_utc() %}\n convert_timezone('UTC', {{dbt_utils.current_timestamp()}})::{{dbt_utils.type_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.current_timestamp", "macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.897513}, "macro.dbt_utils.postgres__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.postgres__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "postgres__current_timestamp_in_utc", "macro_sql": "{% macro postgres__current_timestamp_in_utc() %}\n (current_timestamp at time zone 'utc')::{{dbt_utils.type_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.8977642}, "macro.dbt_utils.redshift__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.redshift__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "redshift__current_timestamp_in_utc", "macro_sql": "{% macro redshift__current_timestamp_in_utc() %}\n {{ return(dbt_utils.default__current_timestamp_in_utc()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__current_timestamp_in_utc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.898277}, "macro.dbt_utils.width_bucket": {"unique_id": "macro.dbt_utils.width_bucket", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "width_bucket", "macro_sql": "{% macro width_bucket(expr, min_value, max_value, num_buckets) %}\n {{ return(adapter.dispatch('width_bucket', 'dbt_utils') (expr, min_value, max_value, num_buckets)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__width_bucket"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.900964}, "macro.dbt_utils.default__width_bucket": {"unique_id": "macro.dbt_utils.default__width_bucket", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "default__width_bucket", "macro_sql": "{% macro default__width_bucket(expr, min_value, max_value, num_buckets) -%}\n\n {% set bin_size -%}\n (( {{ max_value }} - {{ min_value }} ) / {{ num_buckets }} )\n {%- endset %}\n (\n -- to break ties when the amount is eaxtly at the bucket egde\n case\n when\n mod(\n {{ dbt_utils.safe_cast(expr, dbt_utils.type_numeric() ) }},\n {{ dbt_utils.safe_cast(bin_size, dbt_utils.type_numeric() ) }}\n ) = 0\n then 1\n else 0\n end\n ) +\n -- Anything over max_value goes the N+1 bucket\n least(\n ceil(\n ({{ expr }} - {{ min_value }})/{{ bin_size }}\n ),\n {{ num_buckets }} + 1\n )\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.safe_cast", "macro.dbt_utils.type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.902099}, "macro.dbt_utils.redshift__width_bucket": {"unique_id": "macro.dbt_utils.redshift__width_bucket", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "redshift__width_bucket", "macro_sql": "{% macro redshift__width_bucket(expr, min_value, max_value, num_buckets) -%}\n\n {% set bin_size -%}\n (( {{ max_value }} - {{ min_value }} ) / {{ num_buckets }} )\n {%- endset %}\n (\n -- to break ties when the amount is exactly at the bucket edge\n case\n when\n {{ dbt_utils.safe_cast(expr, dbt_utils.type_numeric() ) }} %\n {{ dbt_utils.safe_cast(bin_size, dbt_utils.type_numeric() ) }}\n = 0\n then 1\n else 0\n end\n ) +\n -- Anything over max_value goes the N+1 bucket\n least(\n ceil(\n ({{ expr }} - {{ min_value }})/{{ bin_size }}\n ),\n {{ num_buckets }} + 1\n )\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.safe_cast", "macro.dbt_utils.type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9031801}, "macro.dbt_utils.snowflake__width_bucket": {"unique_id": "macro.dbt_utils.snowflake__width_bucket", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "snowflake__width_bucket", "macro_sql": "{% macro snowflake__width_bucket(expr, min_value, max_value, num_buckets) %}\n width_bucket({{ expr }}, {{ min_value }}, {{ max_value }}, {{ num_buckets }} )\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.903709}, "macro.dbt_utils.array_concat": {"unique_id": "macro.dbt_utils.array_concat", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_concat.sql", "original_file_path": "macros/cross_db_utils/array_concat.sql", "name": "array_concat", "macro_sql": "{% macro array_concat(array_1, array_2) -%}\n {{ return(adapter.dispatch('array_concat', 'dbt_utils')(array_1, array_2)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__array_concat"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.904598}, "macro.dbt_utils.default__array_concat": {"unique_id": "macro.dbt_utils.default__array_concat", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_concat.sql", "original_file_path": "macros/cross_db_utils/array_concat.sql", "name": "default__array_concat", "macro_sql": "{% macro default__array_concat(array_1, array_2) -%}\n array_cat({{ array_1 }}, {{ array_2 }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9049401}, "macro.dbt_utils.bigquery__array_concat": {"unique_id": "macro.dbt_utils.bigquery__array_concat", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_concat.sql", "original_file_path": "macros/cross_db_utils/array_concat.sql", "name": "bigquery__array_concat", "macro_sql": "{% macro bigquery__array_concat(array_1, array_2) -%}\n array_concat({{ array_1 }}, {{ array_2 }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9052339}, "macro.dbt_utils.redshift__array_concat": {"unique_id": "macro.dbt_utils.redshift__array_concat", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_concat.sql", "original_file_path": "macros/cross_db_utils/array_concat.sql", "name": "redshift__array_concat", "macro_sql": "{% macro redshift__array_concat(array_1, array_2) -%}\n array_concat({{ array_1 }}, {{ array_2 }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9056718}, "macro.dbt_utils.bool_or": {"unique_id": "macro.dbt_utils.bool_or", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/bool_or.sql", "original_file_path": "macros/cross_db_utils/bool_or.sql", "name": "bool_or", "macro_sql": "{% macro bool_or(expression) -%}\n {{ return(adapter.dispatch('bool_or', 'dbt_utils') (expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__bool_or"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9065652}, "macro.dbt_utils.default__bool_or": {"unique_id": "macro.dbt_utils.default__bool_or", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/bool_or.sql", "original_file_path": "macros/cross_db_utils/bool_or.sql", "name": "default__bool_or", "macro_sql": "{% macro default__bool_or(expression) -%}\n \n bool_or({{ expression }})\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.906803}, "macro.dbt_utils.snowflake__bool_or": {"unique_id": "macro.dbt_utils.snowflake__bool_or", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/bool_or.sql", "original_file_path": "macros/cross_db_utils/bool_or.sql", "name": "snowflake__bool_or", "macro_sql": "{% macro snowflake__bool_or(expression) -%}\n \n boolor_agg({{ expression }})\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.907153}, "macro.dbt_utils.bigquery__bool_or": {"unique_id": "macro.dbt_utils.bigquery__bool_or", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/bool_or.sql", "original_file_path": "macros/cross_db_utils/bool_or.sql", "name": "bigquery__bool_or", "macro_sql": "{% macro bigquery__bool_or(expression) -%}\n \n logical_or({{ expression }})\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.907391}, "macro.dbt_utils.last_day": {"unique_id": "macro.dbt_utils.last_day", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "last_day", "macro_sql": "{% macro last_day(date, datepart) %}\n {{ return(adapter.dispatch('last_day', 'dbt_utils') (date, datepart)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.908513}, "macro.dbt_utils.default_last_day": {"unique_id": "macro.dbt_utils.default_last_day", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "default_last_day", "macro_sql": "\n\n\n{%- macro default_last_day(date, datepart) -%}\n cast(\n {{dbt_utils.dateadd('day', '-1',\n dbt_utils.dateadd(datepart, '1', dbt_utils.date_trunc(datepart, date))\n )}}\n as date)\n{%- endmacro -%}\n\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd", "macro.dbt_utils.date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.90909}, "macro.dbt_utils.default__last_day": {"unique_id": "macro.dbt_utils.default__last_day", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "default__last_day", "macro_sql": "{% macro default__last_day(date, datepart) -%}\n {{dbt_utils.default_last_day(date, datepart)}}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default_last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.909568}, "macro.dbt_utils.postgres__last_day": {"unique_id": "macro.dbt_utils.postgres__last_day", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "postgres__last_day", "macro_sql": "{% macro postgres__last_day(date, datepart) -%}\n\n {%- if datepart == 'quarter' -%}\n -- postgres dateadd does not support quarter interval.\n cast(\n {{dbt_utils.dateadd('day', '-1',\n dbt_utils.dateadd('month', '3', dbt_utils.date_trunc(datepart, date))\n )}}\n as date)\n {%- else -%}\n {{dbt_utils.default_last_day(date, datepart)}}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd", "macro.dbt_utils.date_trunc", "macro.dbt_utils.default_last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9107032}, "macro.dbt_utils.redshift__last_day": {"unique_id": "macro.dbt_utils.redshift__last_day", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "redshift__last_day", "macro_sql": "{% macro redshift__last_day(date, datepart) %}\n\n {{ return(dbt_utils.default__last_day(date, datepart)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.911197}, "macro.dbt_utils.split_part": {"unique_id": "macro.dbt_utils.split_part", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "split_part", "macro_sql": "{% macro split_part(string_text, delimiter_text, part_number) %}\n {{ return(adapter.dispatch('split_part', 'dbt_utils') (string_text, delimiter_text, part_number)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__split_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.914127}, "macro.dbt_utils.default__split_part": {"unique_id": "macro.dbt_utils.default__split_part", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "default__split_part", "macro_sql": "{% macro default__split_part(string_text, delimiter_text, part_number) %}\n\n split_part(\n {{ string_text }},\n {{ delimiter_text }},\n {{ part_number }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.914508}, "macro.dbt_utils._split_part_negative": {"unique_id": "macro.dbt_utils._split_part_negative", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "_split_part_negative", "macro_sql": "{% macro _split_part_negative(string_text, delimiter_text, part_number) %}\n\n split_part(\n {{ string_text }},\n {{ delimiter_text }},\n length({{ string_text }}) \n - length(\n replace({{ string_text }}, {{ delimiter_text }}, '')\n ) + 2 {{ part_number }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9150279}, "macro.dbt_utils.postgres__split_part": {"unique_id": "macro.dbt_utils.postgres__split_part", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "postgres__split_part", "macro_sql": "{% macro postgres__split_part(string_text, delimiter_text, part_number) %}\n\n {% if part_number >= 0 %}\n {{ dbt_utils.default__split_part(string_text, delimiter_text, part_number) }}\n {% else %}\n {{ dbt_utils._split_part_negative(string_text, delimiter_text, part_number) }}\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__split_part", "macro.dbt_utils._split_part_negative"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.915762}, "macro.dbt_utils.redshift__split_part": {"unique_id": "macro.dbt_utils.redshift__split_part", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "redshift__split_part", "macro_sql": "{% macro redshift__split_part(string_text, delimiter_text, part_number) %}\n\n {% if part_number >= 0 %}\n {{ dbt_utils.default__split_part(string_text, delimiter_text, part_number) }}\n {% else %}\n {{ dbt_utils._split_part_negative(string_text, delimiter_text, part_number) }}\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__split_part", "macro.dbt_utils._split_part_negative"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.916502}, "macro.dbt_utils.bigquery__split_part": {"unique_id": "macro.dbt_utils.bigquery__split_part", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "bigquery__split_part", "macro_sql": "{% macro bigquery__split_part(string_text, delimiter_text, part_number) %}\n\n {% if part_number >= 0 %}\n split(\n {{ string_text }},\n {{ delimiter_text }}\n )[safe_offset({{ part_number - 1 }})]\n {% else %}\n split(\n {{ string_text }},\n {{ delimiter_text }}\n )[safe_offset(\n length({{ string_text }}) \n - length(\n replace({{ string_text }}, {{ delimiter_text }}, '')\n ) + 1\n )]\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9174259}, "macro.dbt_utils.date_trunc": {"unique_id": "macro.dbt_utils.date_trunc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/date_trunc.sql", "original_file_path": "macros/cross_db_utils/date_trunc.sql", "name": "date_trunc", "macro_sql": "{% macro date_trunc(datepart, date) -%}\n {{ return(adapter.dispatch('date_trunc', 'dbt_utils') (datepart, date)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.918459}, "macro.dbt_utils.default__date_trunc": {"unique_id": "macro.dbt_utils.default__date_trunc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/date_trunc.sql", "original_file_path": "macros/cross_db_utils/date_trunc.sql", "name": "default__date_trunc", "macro_sql": "{% macro default__date_trunc(datepart, date) -%}\n date_trunc('{{datepart}}', {{date}})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.918753}, "macro.dbt_utils.bigquery__date_trunc": {"unique_id": "macro.dbt_utils.bigquery__date_trunc", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/date_trunc.sql", "original_file_path": "macros/cross_db_utils/date_trunc.sql", "name": "bigquery__date_trunc", "macro_sql": "{% macro bigquery__date_trunc(datepart, date) -%}\n timestamp_trunc(\n cast({{date}} as timestamp),\n {{datepart}}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9190478}, "macro.dbt_utils.array_construct": {"unique_id": "macro.dbt_utils.array_construct", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_construct.sql", "original_file_path": "macros/cross_db_utils/array_construct.sql", "name": "array_construct", "macro_sql": "{% macro array_construct(inputs = [], data_type = api.Column.translate_type('integer')) -%}\n {{ return(adapter.dispatch('array_construct', 'dbt_utils')(inputs, data_type)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__array_construct"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9205031}, "macro.dbt_utils.default__array_construct": {"unique_id": "macro.dbt_utils.default__array_construct", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_construct.sql", "original_file_path": "macros/cross_db_utils/array_construct.sql", "name": "default__array_construct", "macro_sql": "{% macro default__array_construct(inputs, data_type) -%}\n {% if inputs|length > 0 %}\n array[ {{ inputs|join(' , ') }} ]\n {% else %}\n array[]::{{data_type}}[]\n {% endif %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.921035}, "macro.dbt_utils.snowflake__array_construct": {"unique_id": "macro.dbt_utils.snowflake__array_construct", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_construct.sql", "original_file_path": "macros/cross_db_utils/array_construct.sql", "name": "snowflake__array_construct", "macro_sql": "{% macro snowflake__array_construct(inputs, data_type) -%}\n array_construct( {{ inputs|join(' , ') }} )\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.92144}, "macro.dbt_utils.redshift__array_construct": {"unique_id": "macro.dbt_utils.redshift__array_construct", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_construct.sql", "original_file_path": "macros/cross_db_utils/array_construct.sql", "name": "redshift__array_construct", "macro_sql": "{% macro redshift__array_construct(inputs, data_type) -%}\n array( {{ inputs|join(' , ') }} )\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9217489}, "macro.dbt_utils.bigquery__array_construct": {"unique_id": "macro.dbt_utils.bigquery__array_construct", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_construct.sql", "original_file_path": "macros/cross_db_utils/array_construct.sql", "name": "bigquery__array_construct", "macro_sql": "{% macro bigquery__array_construct(inputs, data_type) -%}\n [ {{ inputs|join(' , ') }} ]\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.922132}, "macro.dbt_utils._is_ephemeral": {"unique_id": "macro.dbt_utils._is_ephemeral", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/_is_ephemeral.sql", "original_file_path": "macros/cross_db_utils/_is_ephemeral.sql", "name": "_is_ephemeral", "macro_sql": "{% macro _is_ephemeral(obj, macro) %}\n {%- if obj.is_cte -%}\n {% set ephemeral_prefix = api.Relation.add_ephemeral_prefix('') %}\n {% if obj.name.startswith(ephemeral_prefix) %}\n {% set model_name = obj.name[(ephemeral_prefix|length):] %}\n {% else %}\n {% set model_name = obj.name %}\n {%- endif -%}\n {% set error_message %}\nThe `{{ macro }}` macro cannot be used with ephemeral models, as it relies on the information schema.\n\n`{{ model_name }}` is an ephemeral model. Consider making it a view or table instead.\n {% endset %}\n {%- do exceptions.raise_compiler_error(error_message) -%}\n {%- endif -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.924188}, "macro.dbt_utils.array_append": {"unique_id": "macro.dbt_utils.array_append", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_append.sql", "original_file_path": "macros/cross_db_utils/array_append.sql", "name": "array_append", "macro_sql": "{% macro array_append(array, new_element) -%}\n {{ return(adapter.dispatch('array_append', 'dbt_utils')(array, new_element)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__array_append"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.92538}, "macro.dbt_utils.default__array_append": {"unique_id": "macro.dbt_utils.default__array_append", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_append.sql", "original_file_path": "macros/cross_db_utils/array_append.sql", "name": "default__array_append", "macro_sql": "{% macro default__array_append(array, new_element) -%}\n array_append({{ array }}, {{ new_element }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.925693}, "macro.dbt_utils.bigquery__array_append": {"unique_id": "macro.dbt_utils.bigquery__array_append", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_append.sql", "original_file_path": "macros/cross_db_utils/array_append.sql", "name": "bigquery__array_append", "macro_sql": "{% macro bigquery__array_append(array, new_element) -%}\n {{ dbt_utils.array_concat(array, dbt_utils.array_construct([new_element])) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.array_concat", "macro.dbt_utils.array_construct"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.926136}, "macro.dbt_utils.redshift__array_append": {"unique_id": "macro.dbt_utils.redshift__array_append", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_append.sql", "original_file_path": "macros/cross_db_utils/array_append.sql", "name": "redshift__array_append", "macro_sql": "{% macro redshift__array_append(array, new_element) -%}\n {{ dbt_utils.array_concat(array, dbt_utils.array_construct([new_element])) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.array_concat", "macro.dbt_utils.array_construct"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9265401}, "macro.dbt_utils.get_period_boundaries": {"unique_id": "macro.dbt_utils.get_period_boundaries", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "get_period_boundaries", "macro_sql": "{% macro get_period_boundaries(target_schema, target_table, timestamp_field, start_date, stop_date, period) -%}\n {{ return(adapter.dispatch('get_period_boundaries', 'dbt_utils')(target_schema, target_table, timestamp_field, start_date, stop_date, period)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_period_boundaries"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.937341}, "macro.dbt_utils.default__get_period_boundaries": {"unique_id": "macro.dbt_utils.default__get_period_boundaries", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "default__get_period_boundaries", "macro_sql": "{% macro default__get_period_boundaries(target_schema, target_table, timestamp_field, start_date, stop_date, period) -%}\n\n {% call statement('period_boundaries', fetch_result=True) -%}\n with data as (\n select\n coalesce(max(\"{{timestamp_field}}\"), '{{start_date}}')::timestamp as start_timestamp,\n coalesce(\n {{dbt_utils.dateadd('millisecond',\n -1,\n \"nullif('\" ~ stop_date ~ \"','')::timestamp\")}},\n {{dbt_utils.current_timestamp()}}\n ) as stop_timestamp\n from \"{{target_schema}}\".\"{{target_table}}\"\n )\n\n select\n start_timestamp,\n stop_timestamp,\n {{dbt_utils.datediff('start_timestamp',\n 'stop_timestamp',\n period)}} + 1 as num_periods\n from data\n {%- endcall %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.dateadd", "macro.dbt_utils.current_timestamp", "macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9388}, "macro.dbt_utils.get_period_sql": {"unique_id": "macro.dbt_utils.get_period_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "get_period_sql", "macro_sql": "{% macro get_period_sql(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset) -%}\n {{ return(adapter.dispatch('get_period_sql', 'dbt_utils')(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_period_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.939666}, "macro.dbt_utils.default__get_period_sql": {"unique_id": "macro.dbt_utils.default__get_period_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "default__get_period_sql", "macro_sql": "{% macro default__get_period_sql(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset) -%}\n\n {%- set period_filter -%}\n (\"{{timestamp_field}}\" > '{{start_timestamp}}'::timestamp + interval '{{offset}} {{period}}' and\n \"{{timestamp_field}}\" <= '{{start_timestamp}}'::timestamp + interval '{{offset}} {{period}}' + interval '1 {{period}}' and\n \"{{timestamp_field}}\" < '{{stop_timestamp}}'::timestamp)\n {%- endset -%}\n\n {%- set filtered_sql = sql | replace(\"__PERIOD_FILTER__\", period_filter) -%}\n\n select\n {{target_cols_csv}}\n from (\n {{filtered_sql}}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.940771}, "macro.dbt_utils.materialization_insert_by_period_default": {"unique_id": "macro.dbt_utils.materialization_insert_by_period_default", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "materialization_insert_by_period_default", "macro_sql": "{% materialization insert_by_period, default -%}\n {%- set timestamp_field = config.require('timestamp_field') -%}\n {%- set start_date = config.require('start_date') -%}\n {%- set stop_date = config.get('stop_date') or '' -%}\n {%- set period = config.get('period') or 'week' -%}\n\n {%- if sql.find('__PERIOD_FILTER__') == -1 -%}\n {%- set error_message -%}\n Model '{{ model.unique_id }}' does not include the required string '__PERIOD_FILTER__' in its sql\n {%- endset -%}\n {{ exceptions.raise_compiler_error(error_message) }}\n {%- endif -%}\n\n {%- set identifier = model['name'] -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier, schema=schema, type='table') -%}\n\n {%- set non_destructive_mode = (flags.NON_DESTRUCTIVE == True) -%}\n {%- set full_refresh_mode = (flags.FULL_REFRESH == True) -%}\n\n {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n {%- set exists_not_as_table = (old_relation is not none and not old_relation.is_table) -%}\n\n {%- set should_truncate = (non_destructive_mode and full_refresh_mode and exists_as_table) -%}\n {%- set should_drop = (not should_truncate and (full_refresh_mode or exists_not_as_table)) -%}\n {%- set force_create = (flags.FULL_REFRESH and not flags.NON_DESTRUCTIVE) -%}\n\n -- setup\n {% if old_relation is none -%}\n -- noop\n {%- elif should_truncate -%}\n {{adapter.truncate_relation(old_relation)}}\n {%- elif should_drop -%}\n {{adapter.drop_relation(old_relation)}}\n {%- set old_relation = none -%}\n {%- endif %}\n\n {{run_hooks(pre_hooks, inside_transaction=False)}}\n\n -- `begin` happens here, so `commit` after it to finish the transaction\n {{run_hooks(pre_hooks, inside_transaction=True)}}\n {% call statement() -%}\n begin; -- make extra sure we've closed out the transaction\n commit;\n {%- endcall %}\n\n -- build model\n {% if force_create or old_relation is none -%}\n {# Create an empty target table -#}\n {% call statement('main') -%}\n {%- set empty_sql = sql | replace(\"__PERIOD_FILTER__\", 'false') -%}\n {{create_table_as(False, target_relation, empty_sql)}}\n {%- endcall %}\n {%- endif %}\n\n {% set _ = dbt_utils.get_period_boundaries(schema,\n identifier,\n timestamp_field,\n start_date,\n stop_date,\n period) %}\n {%- set start_timestamp = load_result('period_boundaries')['data'][0][0] | string -%}\n {%- set stop_timestamp = load_result('period_boundaries')['data'][0][1] | string -%}\n {%- set num_periods = load_result('period_boundaries')['data'][0][2] | int -%}\n\n {% set target_columns = adapter.get_columns_in_relation(target_relation) %}\n {%- set target_cols_csv = target_columns | map(attribute='quoted') | join(', ') -%}\n {%- set loop_vars = {'sum_rows_inserted': 0} -%}\n\n -- commit each period as a separate transaction\n {% for i in range(num_periods) -%}\n {%- set msg = \"Running for \" ~ period ~ \" \" ~ (i + 1) ~ \" of \" ~ (num_periods) -%}\n {{ dbt_utils.log_info(msg) }}\n\n {%- set tmp_identifier = model['name'] ~ '__dbt_incremental_period' ~ i ~ '_tmp' -%}\n {%- set tmp_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema, type='table') -%}\n {% call statement() -%}\n {% set tmp_table_sql = dbt_utils.get_period_sql(target_cols_csv,\n sql,\n timestamp_field,\n period,\n start_timestamp,\n stop_timestamp,\n i) %}\n {{dbt.create_table_as(True, tmp_relation, tmp_table_sql)}}\n {%- endcall %}\n\n {{adapter.expand_target_column_types(from_relation=tmp_relation,\n to_relation=target_relation)}}\n {%- set name = 'main-' ~ i -%}\n {% call statement(name, fetch_result=True) -%}\n insert into {{target_relation}} ({{target_cols_csv}})\n (\n select\n {{target_cols_csv}}\n from {{tmp_relation.include(schema=False)}}\n );\n {%- endcall %}\n {% set result = load_result('main-' ~ i) %}\n {% if 'response' in result.keys() %} {# added in v0.19.0 #}\n {% set rows_inserted = result['response']['rows_affected'] %}\n {% else %} {# older versions #}\n {% set rows_inserted = result['status'].split(\" \")[2] | int %}\n {% endif %}\n \n {%- set sum_rows_inserted = loop_vars['sum_rows_inserted'] + rows_inserted -%}\n {%- if loop_vars.update({'sum_rows_inserted': sum_rows_inserted}) %} {% endif -%}\n\n {%- set msg = \"Ran for \" ~ period ~ \" \" ~ (i + 1) ~ \" of \" ~ (num_periods) ~ \"; \" ~ rows_inserted ~ \" records inserted\" -%}\n {{ dbt_utils.log_info(msg) }}\n\n {%- endfor %}\n\n {% call statement() -%}\n begin;\n {%- endcall %}\n\n {{run_hooks(post_hooks, inside_transaction=True)}}\n\n {% call statement() -%}\n commit;\n {%- endcall %}\n\n {{run_hooks(post_hooks, inside_transaction=False)}}\n\n {%- set status_string = \"INSERT \" ~ loop_vars['sum_rows_inserted'] -%}\n\n {% call noop_statement('main', status_string) -%}\n -- no-op\n {%- endcall %}\n\n -- Return the relations created in this materialization\n {{ return({'relations': [target_relation]}) }} \n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt_utils.get_period_boundaries", "macro.dbt_utils.log_info", "macro.dbt_utils.get_period_sql", "macro.dbt.noop_statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9539251}, "macro.dbt_utils.get_url_host": {"unique_id": "macro.dbt_utils.get_url_host", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "name": "get_url_host", "macro_sql": "{% macro get_url_host(field) -%}\n {{ return(adapter.dispatch('get_url_host', 'dbt_utils')(field)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_url_host"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.954814}, "macro.dbt_utils.default__get_url_host": {"unique_id": "macro.dbt_utils.default__get_url_host", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "name": "default__get_url_host", "macro_sql": "{% macro default__get_url_host(field) -%}\n\n{%- set parsed =\n dbt_utils.split_part(\n dbt_utils.split_part(\n dbt_utils.replace(\n dbt_utils.replace(\n dbt_utils.replace(field, \"'android-app://'\", \"''\"\n ), \"'http://'\", \"''\"\n ), \"'https://'\", \"''\"\n ), \"'/'\", 1\n ), \"'?'\", 1\n )\n\n-%}\n\n\n {{ dbt_utils.safe_cast(\n parsed,\n dbt_utils.type_string()\n )}}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.split_part", "macro.dbt_utils.replace", "macro.dbt_utils.safe_cast", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.955887}, "macro.dbt_utils.get_url_path": {"unique_id": "macro.dbt_utils.get_url_path", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "name": "get_url_path", "macro_sql": "{% macro get_url_path(field) -%}\n {{ return(adapter.dispatch('get_url_path', 'dbt_utils')(field)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_url_path"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.956893}, "macro.dbt_utils.default__get_url_path": {"unique_id": "macro.dbt_utils.default__get_url_path", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "name": "default__get_url_path", "macro_sql": "{% macro default__get_url_path(field) -%}\n\n {%- set stripped_url = \n dbt_utils.replace(\n dbt_utils.replace(field, \"'http://'\", \"''\"), \"'https://'\", \"''\")\n -%}\n\n {%- set first_slash_pos -%}\n coalesce(\n nullif({{dbt_utils.position(\"'/'\", stripped_url)}}, 0),\n {{dbt_utils.position(\"'?'\", stripped_url)}} - 1\n )\n {%- endset -%}\n\n {%- set parsed_path =\n dbt_utils.split_part(\n dbt_utils.right(\n stripped_url, \n dbt_utils.length(stripped_url) ~ \"-\" ~ first_slash_pos\n ), \n \"'?'\", 1\n )\n -%}\n\n {{ dbt_utils.safe_cast(\n parsed_path,\n dbt_utils.type_string()\n )}}\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.replace", "macro.dbt_utils.position", "macro.dbt_utils.split_part", "macro.dbt_utils.right", "macro.dbt_utils.length", "macro.dbt_utils.safe_cast", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9583611}, "macro.dbt_utils.get_url_parameter": {"unique_id": "macro.dbt_utils.get_url_parameter", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "name": "get_url_parameter", "macro_sql": "{% macro get_url_parameter(field, url_parameter) -%}\n {{ return(adapter.dispatch('get_url_parameter', 'dbt_utils')(field, url_parameter)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_url_parameter"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9591732}, "macro.dbt_utils.default__get_url_parameter": {"unique_id": "macro.dbt_utils.default__get_url_parameter", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "name": "default__get_url_parameter", "macro_sql": "{% macro default__get_url_parameter(field, url_parameter) -%}\n\n{%- set formatted_url_parameter = \"'\" + url_parameter + \"='\" -%}\n\n{%- set split = dbt_utils.split_part(dbt_utils.split_part(field, formatted_url_parameter, 2), \"'&'\", 1) -%}\n\nnullif({{ split }},'')\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.split_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.960279}, "macro.dbt_utils.test_fewer_rows_than": {"unique_id": "macro.dbt_utils.test_fewer_rows_than", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/fewer_rows_than.sql", "original_file_path": "macros/generic_tests/fewer_rows_than.sql", "name": "test_fewer_rows_than", "macro_sql": "{% test fewer_rows_than(model, compare_model) %}\n {{ return(adapter.dispatch('test_fewer_rows_than', 'dbt_utils')(model, compare_model)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_fewer_rows_than"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.961407}, "macro.dbt_utils.default__test_fewer_rows_than": {"unique_id": "macro.dbt_utils.default__test_fewer_rows_than", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/fewer_rows_than.sql", "original_file_path": "macros/generic_tests/fewer_rows_than.sql", "name": "default__test_fewer_rows_than", "macro_sql": "{% macro default__test_fewer_rows_than(model, compare_model) %}\n\n{{ config(fail_calc = 'coalesce(row_count_delta, 0)') }}\n\nwith a as (\n\n select count(*) as count_our_model from {{ model }}\n\n),\nb as (\n\n select count(*) as count_comparison_model from {{ compare_model }}\n\n),\ncounts as (\n\n select\n count_our_model,\n count_comparison_model\n from a\n cross join b\n\n),\nfinal as (\n\n select *,\n case\n -- fail the test if we have more rows than the reference model and return the row count delta\n when count_our_model > count_comparison_model then (count_our_model - count_comparison_model)\n -- fail the test if they are the same number\n when count_our_model = count_comparison_model then 1\n -- pass the test if the delta is positive (i.e. return the number 0)\n else 0\n end as row_count_delta\n from counts\n\n)\n\nselect * from final\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.961885}, "macro.dbt_utils.test_equal_rowcount": {"unique_id": "macro.dbt_utils.test_equal_rowcount", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/equal_rowcount.sql", "original_file_path": "macros/generic_tests/equal_rowcount.sql", "name": "test_equal_rowcount", "macro_sql": "{% test equal_rowcount(model, compare_model) %}\n {{ return(adapter.dispatch('test_equal_rowcount', 'dbt_utils')(model, compare_model)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_equal_rowcount"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9628632}, "macro.dbt_utils.default__test_equal_rowcount": {"unique_id": "macro.dbt_utils.default__test_equal_rowcount", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/equal_rowcount.sql", "original_file_path": "macros/generic_tests/equal_rowcount.sql", "name": "default__test_equal_rowcount", "macro_sql": "{% macro default__test_equal_rowcount(model, compare_model) %}\n\n{#-- Needs to be set at parse time, before we return '' below --#}\n{{ config(fail_calc = 'coalesce(diff_count, 0)') }}\n\n{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n{%- if not execute -%}\n {{ return('') }}\n{% endif %}\n\nwith a as (\n\n select count(*) as count_a from {{ model }}\n\n),\nb as (\n\n select count(*) as count_b from {{ compare_model }}\n\n),\nfinal as (\n\n select\n count_a,\n count_b,\n abs(count_a - count_b) as diff_count\n from a\n cross join b\n\n)\n\nselect * from final\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.963586}, "macro.dbt_utils.test_relationships_where": {"unique_id": "macro.dbt_utils.test_relationships_where", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/relationships_where.sql", "original_file_path": "macros/generic_tests/relationships_where.sql", "name": "test_relationships_where", "macro_sql": "{% test relationships_where(model, column_name, to, field, from_condition=\"1=1\", to_condition=\"1=1\") %}\n {{ return(adapter.dispatch('test_relationships_where', 'dbt_utils')(model, column_name, to, field, from_condition, to_condition)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_relationships_where"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.96519}, "macro.dbt_utils.default__test_relationships_where": {"unique_id": "macro.dbt_utils.default__test_relationships_where", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/relationships_where.sql", "original_file_path": "macros/generic_tests/relationships_where.sql", "name": "default__test_relationships_where", "macro_sql": "{% macro default__test_relationships_where(model, column_name, to, field, from_condition=\"1=1\", to_condition=\"1=1\") %}\n\n{# T-SQL has no boolean data type so we use 1=1 which returns TRUE #}\n{# ref https://stackoverflow.com/a/7170753/3842610 #}\n\nwith left_table as (\n\n select\n {{column_name}} as id\n\n from {{model}}\n\n where {{column_name}} is not null\n and {{from_condition}}\n\n),\n\nright_table as (\n\n select\n {{field}} as id\n\n from {{to}}\n\n where {{field}} is not null\n and {{to_condition}}\n\n),\n\nexceptions as (\n\n select\n left_table.id,\n right_table.id as right_id\n\n from left_table\n\n left join right_table\n on left_table.id = right_table.id\n\n where right_table.id is null\n\n)\n\nselect * from exceptions\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9659982}, "macro.dbt_utils.test_recency": {"unique_id": "macro.dbt_utils.test_recency", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/recency.sql", "original_file_path": "macros/generic_tests/recency.sql", "name": "test_recency", "macro_sql": "{% test recency(model, field, datepart, interval) %}\n {{ return(adapter.dispatch('test_recency', 'dbt_utils')(model, field, datepart, interval)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_recency"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.966948}, "macro.dbt_utils.default__test_recency": {"unique_id": "macro.dbt_utils.default__test_recency", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/recency.sql", "original_file_path": "macros/generic_tests/recency.sql", "name": "default__test_recency", "macro_sql": "{% macro default__test_recency(model, field, datepart, interval) %}\n\n{% set threshold = dbt_utils.dateadd(datepart, interval * -1, dbt_utils.current_timestamp()) %}\n\nwith recency as (\n\n select max({{field}}) as most_recent\n from {{ model }}\n\n)\n\nselect\n\n most_recent,\n {{ threshold }} as threshold\n\nfrom recency\nwhere most_recent < {{ threshold }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd", "macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.967665}, "macro.dbt_utils.test_not_constant": {"unique_id": "macro.dbt_utils.test_not_constant", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/not_constant.sql", "original_file_path": "macros/generic_tests/not_constant.sql", "name": "test_not_constant", "macro_sql": "{% test not_constant(model, column_name) %}\n {{ return(adapter.dispatch('test_not_constant', 'dbt_utils')(model, column_name)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_not_constant"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.968647}, "macro.dbt_utils.default__test_not_constant": {"unique_id": "macro.dbt_utils.default__test_not_constant", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/not_constant.sql", "original_file_path": "macros/generic_tests/not_constant.sql", "name": "default__test_not_constant", "macro_sql": "{% macro default__test_not_constant(model, column_name) %}\n\n\nselect\n {# In TSQL, subquery aggregate columns need aliases #}\n {# thus: a filler col name, 'filler_column' #}\n count(distinct {{ column_name }}) as filler_column\n\nfrom {{ model }}\n\nhaving count(distinct {{ column_name }}) = 1\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.969538}, "macro.dbt_utils.test_accepted_range": {"unique_id": "macro.dbt_utils.test_accepted_range", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/accepted_range.sql", "original_file_path": "macros/generic_tests/accepted_range.sql", "name": "test_accepted_range", "macro_sql": "{% test accepted_range(model, column_name, min_value=none, max_value=none, inclusive=true) %}\n {{ return(adapter.dispatch('test_accepted_range', 'dbt_utils')(model, column_name, min_value, max_value, inclusive)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_accepted_range"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.971262}, "macro.dbt_utils.default__test_accepted_range": {"unique_id": "macro.dbt_utils.default__test_accepted_range", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/accepted_range.sql", "original_file_path": "macros/generic_tests/accepted_range.sql", "name": "default__test_accepted_range", "macro_sql": "{% macro default__test_accepted_range(model, column_name, min_value=none, max_value=none, inclusive=true) %}\n\nwith meet_condition as(\n select *\n from {{ model }}\n),\n\nvalidation_errors as (\n select *\n from meet_condition\n where\n -- never true, defaults to an empty result set. Exists to ensure any combo of the `or` clauses below succeeds\n 1 = 2\n\n {%- if min_value is not none %}\n -- records with a value >= min_value are permitted. The `not` flips this to find records that don't meet the rule.\n or not {{ column_name }} > {{- \"=\" if inclusive }} {{ min_value }}\n {%- endif %}\n\n {%- if max_value is not none %}\n -- records with a value <= max_value are permitted. The `not` flips this to find records that don't meet the rule.\n or not {{ column_name }} < {{- \"=\" if inclusive }} {{ max_value }}\n {%- endif %}\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.972639}, "macro.dbt_utils.test_not_accepted_values": {"unique_id": "macro.dbt_utils.test_not_accepted_values", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/not_accepted_values.sql", "original_file_path": "macros/generic_tests/not_accepted_values.sql", "name": "test_not_accepted_values", "macro_sql": "{% test not_accepted_values(model, column_name, values, quote=True) %}\n {{ return(adapter.dispatch('test_not_accepted_values', 'dbt_utils')(model, column_name, values, quote)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_not_accepted_values"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.973919}, "macro.dbt_utils.default__test_not_accepted_values": {"unique_id": "macro.dbt_utils.default__test_not_accepted_values", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/not_accepted_values.sql", "original_file_path": "macros/generic_tests/not_accepted_values.sql", "name": "default__test_not_accepted_values", "macro_sql": "{% macro default__test_not_accepted_values(model, column_name, values, quote=True) %}\nwith all_values as (\n\n select distinct\n {{ column_name }} as value_field\n\n from {{ model }}\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field in (\n {% for value in values -%}\n {% if quote -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {%- endfor %}\n )\n\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.974889}, "macro.dbt_utils.test_unique_where": {"unique_id": "macro.dbt_utils.test_unique_where", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/test_unique_where.sql", "original_file_path": "macros/generic_tests/test_unique_where.sql", "name": "test_unique_where", "macro_sql": "{% test unique_where(model, column_name) %}\r\n {%- set deprecation_warning = '\r\n Warning: `dbt_utils.unique_where` is no longer supported.\r\n Starting in dbt v0.20.0, the built-in `unique` test supports a `where` config.\r\n ' -%}\r\n {%- do exceptions.warn(deprecation_warning) -%}\r\n {{ return(adapter.dispatch('test_unique_where', 'dbt_utils')(model, column_name)) }}\r\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_unique_where"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.975876}, "macro.dbt_utils.default__test_unique_where": {"unique_id": "macro.dbt_utils.default__test_unique_where", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/test_unique_where.sql", "original_file_path": "macros/generic_tests/test_unique_where.sql", "name": "default__test_unique_where", "macro_sql": "{% macro default__test_unique_where(model, column_name) %}\r\n {{ return(test_unique(model, column_name)) }}\r\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.test_unique"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.976248}, "macro.dbt_utils.test_at_least_one": {"unique_id": "macro.dbt_utils.test_at_least_one", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/at_least_one.sql", "original_file_path": "macros/generic_tests/at_least_one.sql", "name": "test_at_least_one", "macro_sql": "{% test at_least_one(model, column_name) %}\n {{ return(adapter.dispatch('test_at_least_one', 'dbt_utils')(model, column_name)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_at_least_one"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.97712}, "macro.dbt_utils.default__test_at_least_one": {"unique_id": "macro.dbt_utils.default__test_at_least_one", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/at_least_one.sql", "original_file_path": "macros/generic_tests/at_least_one.sql", "name": "default__test_at_least_one", "macro_sql": "{% macro default__test_at_least_one(model, column_name) %}\n\nselect *\nfrom (\n select\n {# In TSQL, subquery aggregate columns need aliases #}\n {# thus: a filler col name, 'filler_column' #}\n count({{ column_name }}) as filler_column\n\n from {{ model }}\n\n having count({{ column_name }}) = 0\n\n) validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.977612}, "macro.dbt_utils.test_unique_combination_of_columns": {"unique_id": "macro.dbt_utils.test_unique_combination_of_columns", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/unique_combination_of_columns.sql", "original_file_path": "macros/generic_tests/unique_combination_of_columns.sql", "name": "test_unique_combination_of_columns", "macro_sql": "{% test unique_combination_of_columns(model, combination_of_columns, quote_columns=false) %}\n {{ return(adapter.dispatch('test_unique_combination_of_columns', 'dbt_utils')(model, combination_of_columns, quote_columns)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_unique_combination_of_columns"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.979168}, "macro.dbt_utils.default__test_unique_combination_of_columns": {"unique_id": "macro.dbt_utils.default__test_unique_combination_of_columns", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/unique_combination_of_columns.sql", "original_file_path": "macros/generic_tests/unique_combination_of_columns.sql", "name": "default__test_unique_combination_of_columns", "macro_sql": "{% macro default__test_unique_combination_of_columns(model, combination_of_columns, quote_columns=false) %}\n\n{% if not quote_columns %}\n {%- set column_list=combination_of_columns %}\n{% elif quote_columns %}\n {%- set column_list=[] %}\n {% for column in combination_of_columns -%}\n {% set column_list = column_list.append( adapter.quote(column) ) %}\n {%- endfor %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`quote_columns` argument for unique_combination_of_columns test must be one of [True, False] Got: '\" ~ quote ~\"'.'\"\n ) }}\n{% endif %}\n\n{%- set columns_csv=column_list | join(', ') %}\n\n\nwith validation_errors as (\n\n select\n {{ columns_csv }}\n from {{ model }}\n group by {{ columns_csv }}\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.980979}, "macro.dbt_utils.test_cardinality_equality": {"unique_id": "macro.dbt_utils.test_cardinality_equality", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/cardinality_equality.sql", "original_file_path": "macros/generic_tests/cardinality_equality.sql", "name": "test_cardinality_equality", "macro_sql": "{% test cardinality_equality(model, column_name, to, field) %}\n {{ return(adapter.dispatch('test_cardinality_equality', 'dbt_utils')(model, column_name, to, field)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_cardinality_equality"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9823868}, "macro.dbt_utils.default__test_cardinality_equality": {"unique_id": "macro.dbt_utils.default__test_cardinality_equality", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/cardinality_equality.sql", "original_file_path": "macros/generic_tests/cardinality_equality.sql", "name": "default__test_cardinality_equality", "macro_sql": "{% macro default__test_cardinality_equality(model, column_name, to, field) %}\n\n{# T-SQL does not let you use numbers as aliases for columns #}\n{# Thus, no \"GROUP BY 1\" #}\n\nwith table_a as (\nselect\n {{ column_name }},\n count(*) as num_rows\nfrom {{ model }}\ngroup by {{ column_name }}\n),\n\ntable_b as (\nselect\n {{ field }},\n count(*) as num_rows\nfrom {{ to }}\ngroup by {{ field }}\n),\n\nexcept_a as (\n select *\n from table_a\n {{ dbt_utils.except() }}\n select *\n from table_b\n),\n\nexcept_b as (\n select *\n from table_b\n {{ dbt_utils.except() }}\n select *\n from table_a\n),\n\nunioned as (\n select *\n from except_a\n union all\n select *\n from except_b\n)\n\nselect *\nfrom unioned\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.except"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.983357}, "macro.dbt_utils.test_expression_is_true": {"unique_id": "macro.dbt_utils.test_expression_is_true", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/expression_is_true.sql", "original_file_path": "macros/generic_tests/expression_is_true.sql", "name": "test_expression_is_true", "macro_sql": "{% test expression_is_true(model, expression, column_name=None, condition='1=1') %}\n{# T-SQL has no boolean data type so we use 1=1 which returns TRUE #}\n{# ref https://stackoverflow.com/a/7170753/3842610 #}\n {{ return(adapter.dispatch('test_expression_is_true', 'dbt_utils')(model, expression, column_name, condition)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.984442}, "macro.dbt_utils.default__test_expression_is_true": {"unique_id": "macro.dbt_utils.default__test_expression_is_true", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/expression_is_true.sql", "original_file_path": "macros/generic_tests/expression_is_true.sql", "name": "default__test_expression_is_true", "macro_sql": "{% macro default__test_expression_is_true(model, expression, column_name, condition) %}\n\nwith meet_condition as (\n select * from {{ model }} where {{ condition }}\n)\n\nselect\n *\nfrom meet_condition\n{% if column_name is none %}\nwhere not({{ expression }})\n{%- else %}\nwhere not({{ column_name }} {{ expression }})\n{%- endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.985152}, "macro.dbt_utils.test_not_null_proportion": {"unique_id": "macro.dbt_utils.test_not_null_proportion", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/not_null_proportion.sql", "original_file_path": "macros/generic_tests/not_null_proportion.sql", "name": "test_not_null_proportion", "macro_sql": "{% macro test_not_null_proportion(model) %}\n {{ return(adapter.dispatch('test_not_null_proportion', 'dbt_utils')(model, **kwargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_not_null_proportion"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.986133}, "macro.dbt_utils.default__test_not_null_proportion": {"unique_id": "macro.dbt_utils.default__test_not_null_proportion", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/not_null_proportion.sql", "original_file_path": "macros/generic_tests/not_null_proportion.sql", "name": "default__test_not_null_proportion", "macro_sql": "{% macro default__test_not_null_proportion(model) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}\n{% set at_least = kwargs.get('at_least', kwargs.get('arg')) %}\n{% set at_most = kwargs.get('at_most', kwargs.get('arg', 1)) %}\n\nwith validation as (\n select\n sum(case when {{ column_name }} is null then 0 else 1 end) / cast(count(*) as numeric) as not_null_proportion\n from {{ model }}\n),\nvalidation_errors as (\n select\n not_null_proportion\n from validation\n where not_null_proportion < {{ at_least }} or not_null_proportion > {{ at_most }}\n)\nselect\n *\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.987484}, "macro.dbt_utils.test_sequential_values": {"unique_id": "macro.dbt_utils.test_sequential_values", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/sequential_values.sql", "original_file_path": "macros/generic_tests/sequential_values.sql", "name": "test_sequential_values", "macro_sql": "{% test sequential_values(model, column_name, interval=1, datepart=None) %}\n\n {{ return(adapter.dispatch('test_sequential_values', 'dbt_utils')(model, column_name, interval, datepart)) }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_sequential_values"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9894311}, "macro.dbt_utils.default__test_sequential_values": {"unique_id": "macro.dbt_utils.default__test_sequential_values", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/sequential_values.sql", "original_file_path": "macros/generic_tests/sequential_values.sql", "name": "default__test_sequential_values", "macro_sql": "{% macro default__test_sequential_values(model, column_name, interval=1, datepart=None) %}\n\n{% set previous_column_name = \"previous_\" ~ dbt_utils.slugify(column_name) %}\n\nwith windowed as (\n\n select\n {{ column_name }},\n lag({{ column_name }}) over (\n order by {{ column_name }}\n ) as {{ previous_column_name }}\n from {{ model }}\n),\n\nvalidation_errors as (\n select\n *\n from windowed\n {% if datepart %}\n where not(cast({{ column_name }} as {{ dbt_utils.type_timestamp() }})= cast({{ dbt_utils.dateadd(datepart, interval, previous_column_name) }} as {{ dbt_utils.type_timestamp() }}))\n {% else %}\n where not({{ column_name }} = {{ previous_column_name }} + {{ interval }})\n {% endif %}\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.slugify", "macro.dbt_utils.type_timestamp", "macro.dbt_utils.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.990914}, "macro.dbt_utils.test_not_null_where": {"unique_id": "macro.dbt_utils.test_not_null_where", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/test_not_null_where.sql", "original_file_path": "macros/generic_tests/test_not_null_where.sql", "name": "test_not_null_where", "macro_sql": "{% test not_null_where(model, column_name) %}\r\n {%- set deprecation_warning = '\r\n Warning: `dbt_utils.not_null_where` is no longer supported.\r\n Starting in dbt v0.20.0, the built-in `not_null` test supports a `where` config.\r\n ' -%}\r\n {%- do exceptions.warn(deprecation_warning) -%}\r\n {{ return(adapter.dispatch('test_not_null_where', 'dbt_utils')(model, column_name)) }}\r\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_not_null_where"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.992269}, "macro.dbt_utils.default__test_not_null_where": {"unique_id": "macro.dbt_utils.default__test_not_null_where", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/test_not_null_where.sql", "original_file_path": "macros/generic_tests/test_not_null_where.sql", "name": "default__test_not_null_where", "macro_sql": "{% macro default__test_not_null_where(model, column_name) %}\r\n {{ return(test_not_null(model, column_name)) }}\r\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.test_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.992722}, "macro.dbt_utils.test_equality": {"unique_id": "macro.dbt_utils.test_equality", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/equality.sql", "original_file_path": "macros/generic_tests/equality.sql", "name": "test_equality", "macro_sql": "{% test equality(model, compare_model, compare_columns=None) %}\n {{ return(adapter.dispatch('test_equality', 'dbt_utils')(model, compare_model, compare_columns)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_equality"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9944441}, "macro.dbt_utils.default__test_equality": {"unique_id": "macro.dbt_utils.default__test_equality", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/equality.sql", "original_file_path": "macros/generic_tests/equality.sql", "name": "default__test_equality", "macro_sql": "{% macro default__test_equality(model, compare_model, compare_columns=None) %}\n\n{% set set_diff %}\n count(*) + coalesce(abs(\n sum(case when which_diff = 'a_minus_b' then 1 else 0 end) -\n sum(case when which_diff = 'b_minus_a' then 1 else 0 end)\n ), 0)\n{% endset %}\n\n{#-- Needs to be set at parse time, before we return '' below --#}\n{{ config(fail_calc = set_diff) }}\n\n{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n{%- if not execute -%}\n {{ return('') }}\n{% endif %}\n\n-- setup\n{%- do dbt_utils._is_relation(model, 'test_equality') -%}\n\n{#-\nIf the compare_cols arg is provided, we can run this test without querying the\ninformation schema\u00a0\u2014 this allows the model to be an ephemeral model\n-#}\n\n{%- if not compare_columns -%}\n {%- do dbt_utils._is_ephemeral(model, 'test_equality') -%}\n {%- set compare_columns = adapter.get_columns_in_relation(model) | map(attribute='quoted') -%}\n{%- endif -%}\n\n{% set compare_cols_csv = compare_columns | join(', ') %}\n\nwith a as (\n\n select * from {{ model }}\n\n),\n\nb as (\n\n select * from {{ compare_model }}\n\n),\n\na_minus_b as (\n\n select {{compare_cols_csv}} from a\n {{ dbt_utils.except() }}\n select {{compare_cols_csv}} from b\n\n),\n\nb_minus_a as (\n\n select {{compare_cols_csv}} from b\n {{ dbt_utils.except() }}\n select {{compare_cols_csv}} from a\n\n),\n\nunioned as (\n\n select 'a_minus_b' as which_diff, a_minus_b.* from a_minus_b\n union all\n select 'b_minus_a' as which_diff, b_minus_a.* from b_minus_a\n\n)\n\nselect * from unioned\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.except"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025248.9968488}, "macro.dbt_utils.test_mutually_exclusive_ranges": {"unique_id": "macro.dbt_utils.test_mutually_exclusive_ranges", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/mutually_exclusive_ranges.sql", "original_file_path": "macros/generic_tests/mutually_exclusive_ranges.sql", "name": "test_mutually_exclusive_ranges", "macro_sql": "{% test mutually_exclusive_ranges(model, lower_bound_column, upper_bound_column, partition_by=None, gaps='allowed', zero_length_range_allowed=False) %}\n {{ return(adapter.dispatch('test_mutually_exclusive_ranges', 'dbt_utils')(model, lower_bound_column, upper_bound_column, partition_by, gaps, zero_length_range_allowed)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_mutually_exclusive_ranges"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.003118}, "macro.dbt_utils.default__test_mutually_exclusive_ranges": {"unique_id": "macro.dbt_utils.default__test_mutually_exclusive_ranges", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/generic_tests/mutually_exclusive_ranges.sql", "original_file_path": "macros/generic_tests/mutually_exclusive_ranges.sql", "name": "default__test_mutually_exclusive_ranges", "macro_sql": "{% macro default__test_mutually_exclusive_ranges(model, lower_bound_column, upper_bound_column, partition_by=None, gaps='allowed', zero_length_range_allowed=False) %}\n{% if gaps == 'not_allowed' %}\n {% set allow_gaps_operator='=' %}\n {% set allow_gaps_operator_in_words='equal_to' %}\n{% elif gaps == 'allowed' %}\n {% set allow_gaps_operator='<=' %}\n {% set allow_gaps_operator_in_words='less_than_or_equal_to' %}\n{% elif gaps == 'required' %}\n {% set allow_gaps_operator='<' %}\n {% set allow_gaps_operator_in_words='less_than' %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`gaps` argument for mutually_exclusive_ranges test must be one of ['not_allowed', 'allowed', 'required'] Got: '\" ~ gaps ~\"'.'\"\n ) }}\n{% endif %}\n{% if not zero_length_range_allowed %}\n {% set allow_zero_length_operator='<' %}\n {% set allow_zero_length_operator_in_words='less_than' %}\n{% elif zero_length_range_allowed %}\n {% set allow_zero_length_operator='<=' %}\n {% set allow_zero_length_operator_in_words='less_than_or_equal_to' %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`zero_length_range_allowed` argument for mutually_exclusive_ranges test must be one of [true, false] Got: '\" ~ zero_length_range_allowed ~\"'.'\"\n ) }}\n{% endif %}\n\n{% set partition_clause=\"partition by \" ~ partition_by if partition_by else '' %}\n\nwith window_functions as (\n\n select\n {% if partition_by %}\n {{ partition_by }} as partition_by_col,\n {% endif %}\n {{ lower_bound_column }} as lower_bound,\n {{ upper_bound_column }} as upper_bound,\n\n lead({{ lower_bound_column }}) over (\n {{ partition_clause }}\n order by {{ lower_bound_column }}\n ) as next_lower_bound,\n\n row_number() over (\n {{ partition_clause }}\n order by {{ lower_bound_column }} desc\n ) = 1 as is_last_record\n\n from {{ model }}\n\n),\n\ncalc as (\n -- We want to return records where one of our assumptions fails, so we'll use\n -- the `not` function with `and` statements so we can write our assumptions nore cleanly\n select\n *,\n\n -- For each record: lower_bound should be < upper_bound.\n -- Coalesce it to return an error on the null case (implicit assumption\n -- these columns are not_null)\n coalesce(\n lower_bound {{ allow_zero_length_operator }} upper_bound,\n false\n ) as lower_bound_{{ allow_zero_length_operator_in_words }}_upper_bound,\n\n -- For each record: upper_bound {{ allow_gaps_operator }} the next lower_bound.\n -- Coalesce it to handle null cases for the last record.\n coalesce(\n upper_bound {{ allow_gaps_operator }} next_lower_bound,\n is_last_record,\n false\n ) as upper_bound_{{ allow_gaps_operator_in_words }}_next_lower_bound\n\n from window_functions\n\n),\n\nvalidation_errors as (\n\n select\n *\n from calc\n\n where not(\n -- THE FOLLOWING SHOULD BE TRUE --\n lower_bound_{{ allow_zero_length_operator_in_words }}_upper_bound\n and upper_bound_{{ allow_gaps_operator_in_words }}_next_lower_bound\n )\n)\n\nselect * from validation_errors\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.007039}, "macro.dbt_utils.pretty_log_format": {"unique_id": "macro.dbt_utils.pretty_log_format", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_log_format.sql", "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", "name": "pretty_log_format", "macro_sql": "{% macro pretty_log_format(message) %}\n {{ return(adapter.dispatch('pretty_log_format', 'dbt_utils')(message)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__pretty_log_format"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.007905}, "macro.dbt_utils.default__pretty_log_format": {"unique_id": "macro.dbt_utils.default__pretty_log_format", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_log_format.sql", "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", "name": "default__pretty_log_format", "macro_sql": "{% macro default__pretty_log_format(message) %}\n {{ return( dbt_utils.pretty_time() ~ ' + ' ~ message) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.pretty_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.008466}, "macro.dbt_utils.pretty_time": {"unique_id": "macro.dbt_utils.pretty_time", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_time.sql", "original_file_path": "macros/jinja_helpers/pretty_time.sql", "name": "pretty_time", "macro_sql": "{% macro pretty_time(format='%H:%M:%S') %}\n {{ return(adapter.dispatch('pretty_time', 'dbt_utils')(format)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__pretty_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0092978}, "macro.dbt_utils.default__pretty_time": {"unique_id": "macro.dbt_utils.default__pretty_time", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_time.sql", "original_file_path": "macros/jinja_helpers/pretty_time.sql", "name": "default__pretty_time", "macro_sql": "{% macro default__pretty_time(format='%H:%M:%S') %}\n {{ return(modules.datetime.datetime.now().strftime(format)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.009784}, "macro.dbt_utils.log_info": {"unique_id": "macro.dbt_utils.log_info", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/log_info.sql", "original_file_path": "macros/jinja_helpers/log_info.sql", "name": "log_info", "macro_sql": "{% macro log_info(message) %}\n {{ return(adapter.dispatch('log_info', 'dbt_utils')(message)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__log_info"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.010505}, "macro.dbt_utils.default__log_info": {"unique_id": "macro.dbt_utils.default__log_info", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/log_info.sql", "original_file_path": "macros/jinja_helpers/log_info.sql", "name": "default__log_info", "macro_sql": "{% macro default__log_info(message) %}\n {{ log(dbt_utils.pretty_log_format(message), info=True) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.pretty_log_format"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.01089}, "macro.dbt_utils.slugify": {"unique_id": "macro.dbt_utils.slugify", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/slugify.sql", "original_file_path": "macros/jinja_helpers/slugify.sql", "name": "slugify", "macro_sql": "{% macro slugify(string) %}\n\n{#- Lower case the string -#}\n{% set string = string | lower %}\n{#- Replace spaces and dashes with underscores -#}\n{% set string = modules.re.sub('[ -]+', '_', string) %}\n{#- Only take letters, numbers, and underscores -#}\n{% set string = modules.re.sub('[^a-z0-9_]+', '', string) %}\n\n{{ return(string) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.012007}, "macro.dbt_utils.get_intervals_between": {"unique_id": "macro.dbt_utils.get_intervals_between", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "get_intervals_between", "macro_sql": "{% macro get_intervals_between(start_date, end_date, datepart) -%}\n {{ return(adapter.dispatch('get_intervals_between', 'dbt_utils')(start_date, end_date, datepart)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_intervals_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.013667}, "macro.dbt_utils.default__get_intervals_between": {"unique_id": "macro.dbt_utils.default__get_intervals_between", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "default__get_intervals_between", "macro_sql": "{% macro default__get_intervals_between(start_date, end_date, datepart) -%}\n {%- call statement('get_intervals_between', fetch_result=True) %}\n\n select {{dbt_utils.datediff(start_date, end_date, datepart)}}\n\n {%- endcall -%}\n\n {%- set value_list = load_result('get_intervals_between') -%}\n\n {%- if value_list and value_list['data'] -%}\n {%- set values = value_list['data'] | map(attribute=0) | list %}\n {{ return(values[0]) }}\n {%- else -%}\n {{ return(1) }}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.01524}, "macro.dbt_utils.date_spine": {"unique_id": "macro.dbt_utils.date_spine", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "date_spine", "macro_sql": "{% macro date_spine(datepart, start_date, end_date) %}\n {{ return(adapter.dispatch('date_spine', 'dbt_utils')(datepart, start_date, end_date)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__date_spine"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.015785}, "macro.dbt_utils.default__date_spine": {"unique_id": "macro.dbt_utils.default__date_spine", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "default__date_spine", "macro_sql": "{% macro default__date_spine(datepart, start_date, end_date) %}\n\n\n{# call as follows:\n\ndate_spine(\n \"day\",\n \"to_date('01/01/2016', 'mm/dd/yyyy')\",\n \"dateadd(week, 1, current_date)\"\n) #}\n\n\nwith rawdata as (\n\n {{dbt_utils.generate_series(\n dbt_utils.get_intervals_between(start_date, end_date, datepart)\n )}}\n\n),\n\nall_periods as (\n\n select (\n {{\n dbt_utils.dateadd(\n datepart,\n \"row_number() over (order by 1) - 1\",\n start_date\n )\n }}\n ) as date_{{datepart}}\n from rawdata\n\n),\n\nfiltered as (\n\n select *\n from all_periods\n where date_{{datepart}} <= {{ end_date }}\n\n)\n\nselect * from filtered\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.generate_series", "macro.dbt_utils.get_intervals_between", "macro.dbt_utils.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0165749}, "macro.dbt_utils.nullcheck_table": {"unique_id": "macro.dbt_utils.nullcheck_table", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "name": "nullcheck_table", "macro_sql": "{% macro nullcheck_table(relation) %}\n {{ return(adapter.dispatch('nullcheck_table', 'dbt_utils')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__nullcheck_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.017339}, "macro.dbt_utils.default__nullcheck_table": {"unique_id": "macro.dbt_utils.default__nullcheck_table", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "name": "default__nullcheck_table", "macro_sql": "{% macro default__nullcheck_table(relation) %}\n\n {%- do dbt_utils._is_relation(relation, 'nullcheck_table') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'nullcheck_table') -%}\n {% set cols = adapter.get_columns_in_relation(relation) %}\n\n select {{ dbt_utils.nullcheck(cols) }}\n from {{relation}}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.nullcheck"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.018104}, "macro.dbt_utils.get_relations_by_pattern": {"unique_id": "macro.dbt_utils.get_relations_by_pattern", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "name": "get_relations_by_pattern", "macro_sql": "{% macro get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_relations_by_pattern', 'dbt_utils')(schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.019514}, "macro.dbt_utils.default__get_relations_by_pattern": {"unique_id": "macro.dbt_utils.default__get_relations_by_pattern", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "name": "default__get_relations_by_pattern", "macro_sql": "{% macro default__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n {{ dbt_utils.get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude, database) }}\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=database,\n schema=row.table_schema,\n identifier=row.table_name,\n type=row.table_type\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0215948}, "macro.dbt_utils.get_powers_of_two": {"unique_id": "macro.dbt_utils.get_powers_of_two", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "get_powers_of_two", "macro_sql": "{% macro get_powers_of_two(upper_bound) %}\n {{ return(adapter.dispatch('get_powers_of_two', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0231218}, "macro.dbt_utils.default__get_powers_of_two": {"unique_id": "macro.dbt_utils.default__get_powers_of_two", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "default__get_powers_of_two", "macro_sql": "{% macro default__get_powers_of_two(upper_bound) %}\n\n {% if upper_bound <= 0 %}\n {{ exceptions.raise_compiler_error(\"upper bound must be positive\") }}\n {% endif %}\n\n {% for _ in range(1, 100) %}\n {% if upper_bound <= 2 ** loop.index %}{{ return(loop.index) }}{% endif %}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.024134}, "macro.dbt_utils.generate_series": {"unique_id": "macro.dbt_utils.generate_series", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "generate_series", "macro_sql": "{% macro generate_series(upper_bound) %}\n {{ return(adapter.dispatch('generate_series', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__generate_series"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.024555}, "macro.dbt_utils.default__generate_series": {"unique_id": "macro.dbt_utils.default__generate_series", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "default__generate_series", "macro_sql": "{% macro default__generate_series(upper_bound) %}\n\n {% set n = dbt_utils.get_powers_of_two(upper_bound) %}\n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n {% for i in range(n) %}\n p{{i}}.generated_number * power(2, {{i}})\n {% if not loop.last %} + {% endif %}\n {% endfor %}\n + 1\n as generated_number\n\n from\n\n {% for i in range(n) %}\n p as p{{i}}\n {% if not loop.last %} cross join {% endif %}\n {% endfor %}\n\n )\n\n select *\n from unioned\n where generated_number <= {{upper_bound}}\n order by generated_number\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.025716}, "macro.dbt_utils.get_relations_by_prefix": {"unique_id": "macro.dbt_utils.get_relations_by_prefix", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "name": "get_relations_by_prefix", "macro_sql": "{% macro get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_relations_by_prefix', 'dbt_utils')(schema, prefix, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_relations_by_prefix"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.027084}, "macro.dbt_utils.default__get_relations_by_prefix": {"unique_id": "macro.dbt_utils.default__get_relations_by_prefix", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "name": "default__get_relations_by_prefix", "macro_sql": "{% macro default__get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n {{ dbt_utils.get_tables_by_prefix_sql(schema, prefix, exclude, database) }}\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=database,\n schema=row.table_schema,\n identifier=row.table_name,\n type=row.table_type\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.get_tables_by_prefix_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0290701}, "macro.dbt_utils.get_tables_by_prefix_sql": {"unique_id": "macro.dbt_utils.get_tables_by_prefix_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "name": "get_tables_by_prefix_sql", "macro_sql": "{% macro get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_tables_by_prefix_sql', 'dbt_utils')(schema, prefix, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_tables_by_prefix_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.030064}, "macro.dbt_utils.default__get_tables_by_prefix_sql": {"unique_id": "macro.dbt_utils.default__get_tables_by_prefix_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "name": "default__get_tables_by_prefix_sql", "macro_sql": "{% macro default__get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n\n {{ dbt_utils.get_tables_by_pattern_sql(\n schema_pattern = schema,\n table_pattern = prefix ~ '%',\n exclude = exclude,\n database = database\n ) }}\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.030706}, "macro.dbt_utils.star": {"unique_id": "macro.dbt_utils.star", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "name": "star", "macro_sql": "{% macro star(from, relation_alias=False, except=[], prefix='', suffix='') -%}\n {{ return(adapter.dispatch('star', 'dbt_utils')(from, relation_alias, except, prefix, suffix)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__star"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.032268}, "macro.dbt_utils.default__star": {"unique_id": "macro.dbt_utils.default__star", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "name": "default__star", "macro_sql": "{% macro default__star(from, relation_alias=False, except=[], prefix='', suffix='') -%}\n {%- do dbt_utils._is_relation(from, 'star') -%}\n {%- do dbt_utils._is_ephemeral(from, 'star') -%}\n\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {{ return('*') }}\n {% endif %}\n\n {% set cols = dbt_utils.get_filtered_columns_in_relation(from, except) %}\n\n {%- if cols|length <= 0 -%}\n {{- return('*') -}}\n {%- else -%}\n {%- for col in cols %}\n {%- if relation_alias %}{{ relation_alias }}.{% else %}{%- endif -%}{{ adapter.quote(col)|trim }} {%- if prefix!='' or suffix!='' %} as {{ adapter.quote(prefix ~ col ~ suffix)|trim }} {%- endif -%}\n {%- if not loop.last %},{{ '\\n ' }}{% endif %}\n {%- endfor -%}\n {% endif %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.get_filtered_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.034687}, "macro.dbt_utils.unpivot": {"unique_id": "macro.dbt_utils.unpivot", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "name": "unpivot", "macro_sql": "{% macro unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value', table=none) -%}\n {{ return(adapter.dispatch('unpivot', 'dbt_utils')(relation, cast_to, exclude, remove, field_name, value_name, table)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__unpivot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0376298}, "macro.dbt_utils.default__unpivot": {"unique_id": "macro.dbt_utils.default__unpivot", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "name": "default__unpivot", "macro_sql": "{% macro default__unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value', table=none) -%}\n\n {% if table %}\n {%- set error_message = '\n Warning: the `unpivot` macro no longer accepts a `table` parameter. \\\n This parameter will be deprecated in a future release of dbt-utils. Use the `relation` parameter instead. \\\n The {}.{} model triggered this warning. \\\n '.format(model.package_name, model.name) -%}\n {%- do exceptions.warn(error_message) -%}\n {% endif %}\n\n {% if relation and table %}\n {{ exceptions.raise_compiler_error(\"Error: both the `relation` and `table` parameters were provided to `unpivot` macro. Choose one only (we recommend `relation`).\") }}\n {% elif not relation and table %}\n {% set relation=table %}\n {% elif not relation and not table %}\n {{ exceptions.raise_compiler_error(\"Error: argument `relation` is required for `unpivot` macro.\") }}\n {% endif %}\n\n {%- set exclude = exclude if exclude is not none else [] %}\n {%- set remove = remove if remove is not none else [] %}\n\n {%- set include_cols = [] %}\n\n {%- set table_columns = {} %}\n\n {%- do table_columns.update({relation: []}) %}\n\n {%- do dbt_utils._is_relation(relation, 'unpivot') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'unpivot') -%}\n {%- set cols = adapter.get_columns_in_relation(relation) %}\n\n {%- for col in cols -%}\n {%- if col.column.lower() not in remove|map('lower') and col.column.lower() not in exclude|map('lower') -%}\n {% do include_cols.append(col) %}\n {%- endif %}\n {%- endfor %}\n\n\n {%- for col in include_cols -%}\n select\n {%- for exclude_col in exclude %}\n {{ exclude_col }},\n {%- endfor %}\n\n cast('{{ col.column }}' as {{ dbt_utils.type_string() }}) as {{ field_name }},\n cast( {% if col.data_type == 'boolean' %}\n {{ dbt_utils.cast_bool_to_text(col.column) }}\n {% else %}\n {{ col.column }}\n {% endif %}\n as {{ cast_to }}) as {{ value_name }}\n\n from {{ relation }}\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n {%- endfor -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.type_string", "macro.dbt_utils.cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.042538}, "macro.dbt_utils.union_relations": {"unique_id": "macro.dbt_utils.union_relations", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "name": "union_relations", "macro_sql": "{%- macro union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation', where=none) -%}\n {{ return(adapter.dispatch('union_relations', 'dbt_utils')(relations, column_override, include, exclude, source_column_name, where)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__union_relations"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0480692}, "macro.dbt_utils.default__union_relations": {"unique_id": "macro.dbt_utils.default__union_relations", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "name": "default__union_relations", "macro_sql": "\n\n{%- macro default__union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation', where=none) -%}\n\n {%- if exclude and include -%}\n {{ exceptions.raise_compiler_error(\"Both an exclude and include list were provided to the `union` macro. Only one is allowed\") }}\n {%- endif -%}\n\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. -#}\n {%- if not execute %}\n {{ return('') }}\n {% endif -%}\n\n {%- set column_override = column_override if column_override is not none else {} -%}\n\n {%- set relation_columns = {} -%}\n {%- set column_superset = {} -%}\n\n {%- for relation in relations -%}\n\n {%- do relation_columns.update({relation: []}) -%}\n\n {%- do dbt_utils._is_relation(relation, 'union_relations') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'union_relations') -%}\n {%- set cols = adapter.get_columns_in_relation(relation) -%}\n {%- for col in cols -%}\n\n {#- If an exclude list was provided and the column is in the list, do nothing -#}\n {%- if exclude and col.column in exclude -%}\n\n {#- If an include list was provided and the column is not in the list, do nothing -#}\n {%- elif include and col.column not in include -%}\n\n {#- Otherwise add the column to the column superset -#}\n {%- else -%}\n\n {#- update the list of columns in this relation -#}\n {%- do relation_columns[relation].append(col.column) -%}\n\n {%- if col.column in column_superset -%}\n\n {%- set stored = column_superset[col.column] -%}\n {%- if col.is_string() and stored.is_string() and col.string_size() > stored.string_size() -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif %}\n\n {%- else -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif -%}\n\n {%- endif -%}\n\n {%- endfor -%}\n {%- endfor -%}\n\n {%- set ordered_column_names = column_superset.keys() -%}\n {%- set dbt_command = flags.WHICH -%}\n\n\n {% if dbt_command in ['run', 'build'] %}\n {% if (include | length > 0 or exclude | length > 0) and not column_superset.keys() %}\n {%- set relations_string -%}\n {%- for relation in relations -%}\n {{ relation.name }}\n {%- if not loop.last %}, {% endif -%}\n {%- endfor -%}\n {%- endset -%}\n\n {%- set error_message -%}\n There were no columns found to union for relations {{ relations_string }}\n {%- endset -%}\n\n {{ exceptions.raise_compiler_error(error_message) }}\n {%- endif -%}\n {%- endif -%}\n\n {%- for relation in relations %}\n\n (\n select\n\n cast({{ dbt_utils.string_literal(relation) }} as {{ dbt_utils.type_string() }}) as {{ source_column_name }},\n {% for col_name in ordered_column_names -%}\n\n {%- set col = column_superset[col_name] %}\n {%- set col_type = column_override.get(col.column, col.data_type) %}\n {%- set col_name = adapter.quote(col_name) if col_name in relation_columns[relation] else 'null' %}\n cast({{ col_name }} as {{ col_type }}) as {{ col.quoted }} {% if not loop.last %},{% endif -%}\n\n {%- endfor %}\n\n from {{ relation }}\n\n {% if where -%}\n where {{ where }}\n {%- endif %}\n )\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n\n {%- endfor -%}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.string_literal", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0561988}, "macro.dbt_utils.group_by": {"unique_id": "macro.dbt_utils.group_by", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "name": "group_by", "macro_sql": "{%- macro group_by(n) -%}\n {{ return(adapter.dispatch('group_by', 'dbt_utils')(n)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__group_by"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.056979}, "macro.dbt_utils.default__group_by": {"unique_id": "macro.dbt_utils.default__group_by", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "name": "default__group_by", "macro_sql": "\n\n{%- macro default__group_by(n) -%}\n\n group by {% for i in range(1, n + 1) -%}\n {{ i }}{{ ',' if not loop.last }} \n {%- endfor -%}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.057527}, "macro.dbt_utils.deduplicate": {"unique_id": "macro.dbt_utils.deduplicate", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "name": "deduplicate", "macro_sql": "{%- macro deduplicate(relation, partition_by, order_by=none, relation_alias=none) -%}\n\n {%- set error_message_group_by -%}\nWarning: the `group_by` parameter of the `deduplicate` macro is no longer supported and will be deprecated in a future release of dbt-utils.\nUse `partition_by` instead.\nThe {{ model.package_name }}.{{ model.name }} model triggered this warning.\n {%- endset -%}\n\n {% if kwargs.get('group_by') %}\n {%- do exceptions.warn(error_message_group_by) -%}\n {%- endif -%}\n\n {%- set error_message_order_by -%}\nWarning: `order_by` as an optional parameter of the `deduplicate` macro is no longer supported and will be deprecated in a future release of dbt-utils.\nSupply a non-null value for `order_by` instead.\nThe {{ model.package_name }}.{{ model.name }} model triggered this warning.\n {%- endset -%}\n\n {% if not order_by %}\n {%- do exceptions.warn(error_message_order_by) -%}\n {%- endif -%}\n\n {%- set error_message_alias -%}\nWarning: the `relation_alias` parameter of the `deduplicate` macro is no longer supported and will be deprecated in a future release of dbt-utils.\nIf you were using `relation_alias` to point to a CTE previously then you can now pass the alias directly to `relation` instead.\nThe {{ model.package_name }}.{{ model.name }} model triggered this warning.\n {%- endset -%}\n\n {% if relation_alias %}\n {%- do exceptions.warn(error_message_alias) -%}\n {%- endif -%}\n\n {% set partition_by = partition_by or kwargs.get('group_by') %}\n {% set relation = relation_alias or relation %}\n {% set order_by = order_by or \"'1'\" %}\n\n {{ return(adapter.dispatch('deduplicate', 'dbt_utils')(relation, partition_by, order_by)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__deduplicate"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.062219}, "macro.dbt_utils.default__deduplicate": {"unique_id": "macro.dbt_utils.default__deduplicate", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "name": "default__deduplicate", "macro_sql": "\n\n{%- macro default__deduplicate(relation, partition_by, order_by) -%}\n\n with row_numbered as (\n select\n _inner.*,\n row_number() over (\n partition by {{ partition_by }}\n order by {{ order_by }}\n ) as rn\n from {{ relation }} as _inner\n )\n\n select\n distinct data.*\n from {{ relation }} as data\n {#\n -- Not all DBs will support natural joins but the ones that do include:\n -- Oracle, MySQL, SQLite, Redshift, Teradata, Materialize, Databricks\n -- Apache Spark, SingleStore, Vertica\n -- Those that do not appear to support natural joins include:\n -- SQLServer, Trino, Presto, Rockset, Athena\n #}\n natural join row_numbered\n where row_numbered.rn = 1\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.06283}, "macro.dbt_utils.redshift__deduplicate": {"unique_id": "macro.dbt_utils.redshift__deduplicate", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "name": "redshift__deduplicate", "macro_sql": "{% macro redshift__deduplicate(relation, partition_by, order_by) -%}\n\n {{ return(dbt_utils.default__deduplicate(relation, partition_by, order_by=order_by)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__deduplicate"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.063283}, "macro.dbt_utils.postgres__deduplicate": {"unique_id": "macro.dbt_utils.postgres__deduplicate", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "name": "postgres__deduplicate", "macro_sql": "\n{%- macro postgres__deduplicate(relation, partition_by, order_by) -%}\n\n select\n distinct on ({{ partition_by }}) *\n from {{ relation }}\n order by {{ partition_by }}{{ ',' ~ order_by }}\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0637271}, "macro.dbt_utils.snowflake__deduplicate": {"unique_id": "macro.dbt_utils.snowflake__deduplicate", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "name": "snowflake__deduplicate", "macro_sql": "\n{%- macro snowflake__deduplicate(relation, partition_by, order_by) -%}\n\n select *\n from {{ relation }}\n qualify\n row_number() over (\n partition by {{ partition_by }}\n order by {{ order_by }}\n ) = 1\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0642061}, "macro.dbt_utils.bigquery__deduplicate": {"unique_id": "macro.dbt_utils.bigquery__deduplicate", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "name": "bigquery__deduplicate", "macro_sql": "\n{%- macro bigquery__deduplicate(relation, partition_by, order_by) -%}\n\n select unique.*\n from (\n select\n array_agg (\n original\n order by {{ order_by }}\n limit 1\n )[offset(0)] unique\n from {{ relation }} original\n group by {{ partition_by }}\n )\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.064629}, "macro.dbt_utils.surrogate_key": {"unique_id": "macro.dbt_utils.surrogate_key", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "name": "surrogate_key", "macro_sql": "{%- macro surrogate_key(field_list) -%}\n {# needed for safe_add to allow for non-keyword arguments see SO post #}\n {# https://stackoverflow.com/questions/13944751/args-kwargs-in-jinja2-macros #}\n {% set frustrating_jinja_feature = varargs %}\n {{ return(adapter.dispatch('surrogate_key', 'dbt_utils')(field_list, *varargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__surrogate_key"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.065831}, "macro.dbt_utils.default__surrogate_key": {"unique_id": "macro.dbt_utils.default__surrogate_key", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "name": "default__surrogate_key", "macro_sql": "\n\n{%- macro default__surrogate_key(field_list) -%}\n\n{%- if varargs|length >= 1 or field_list is string %}\n\n{%- set error_message = '\nWarning: the `surrogate_key` macro now takes a single list argument instead of \\\nmultiple string arguments. Support for multiple string arguments will be \\\ndeprecated in a future release of dbt-utils. The {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.warn(error_message) -%}\n\n{# first argument is not included in varargs, so add first element to field_list_xf #}\n{%- set field_list_xf = [field_list] -%}\n\n{%- for field in varargs %}\n{%- set _ = field_list_xf.append(field) -%}\n{%- endfor -%}\n\n{%- else -%}\n\n{# if using list, just set field_list_xf as field_list #}\n{%- set field_list_xf = field_list -%}\n\n{%- endif -%}\n\n\n{%- set fields = [] -%}\n\n{%- for field in field_list_xf -%}\n\n {%- set _ = fields.append(\n \"coalesce(cast(\" ~ field ~ \" as \" ~ dbt_utils.type_string() ~ \"), '')\"\n ) -%}\n\n {%- if not loop.last %}\n {%- set _ = fields.append(\"'-'\") -%}\n {%- endif -%}\n\n{%- endfor -%}\n\n{{dbt_utils.hash(dbt_utils.concat(fields))}}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string", "macro.dbt_utils.hash", "macro.dbt_utils.concat"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.068005}, "macro.dbt_utils.safe_add": {"unique_id": "macro.dbt_utils.safe_add", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "name": "safe_add", "macro_sql": "{%- macro safe_add() -%}\n {# needed for safe_add to allow for non-keyword arguments see SO post #}\n {# https://stackoverflow.com/questions/13944751/args-kwargs-in-jinja2-macros #}\n {% set frustrating_jinja_feature = varargs %}\n {{ return(adapter.dispatch('safe_add', 'dbt_utils')(*varargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__safe_add"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.069272}, "macro.dbt_utils.default__safe_add": {"unique_id": "macro.dbt_utils.default__safe_add", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "name": "default__safe_add", "macro_sql": "\n\n{%- macro default__safe_add() -%}\n\n{% set fields = [] %}\n\n{%- for field in varargs -%}\n\n {% do fields.append(\"coalesce(\" ~ field ~ \", 0)\") %}\n\n{%- endfor -%}\n\n{{ fields|join(' +\\n ') }}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.070057}, "macro.dbt_utils.nullcheck": {"unique_id": "macro.dbt_utils.nullcheck", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "name": "nullcheck", "macro_sql": "{% macro nullcheck(cols) %}\n {{ return(adapter.dispatch('nullcheck', 'dbt_utils')(cols)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__nullcheck"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0709069}, "macro.dbt_utils.default__nullcheck": {"unique_id": "macro.dbt_utils.default__nullcheck", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "name": "default__nullcheck", "macro_sql": "{% macro default__nullcheck(cols) %}\n{%- for col in cols %}\n\n {% if col.is_string() -%}\n\n nullif({{col.name}},'') as {{col.name}}\n\n {%- else -%}\n\n {{col.name}}\n\n {%- endif -%}\n\n{%- if not loop.last -%} , {%- endif -%}\n\n{%- endfor -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0716622}, "macro.dbt_utils.get_tables_by_pattern_sql": {"unique_id": "macro.dbt_utils.get_tables_by_pattern_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "get_tables_by_pattern_sql", "macro_sql": "{% macro get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_tables_by_pattern_sql', 'dbt_utils')\n (schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.074296}, "macro.dbt_utils.default__get_tables_by_pattern_sql": {"unique_id": "macro.dbt_utils.default__get_tables_by_pattern_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "default__get_tables_by_pattern_sql", "macro_sql": "{% macro default__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n select distinct\n table_schema as \"table_schema\",\n table_name as \"table_name\",\n {{ dbt_utils.get_table_types_sql() }}\n from {{ database }}.information_schema.tables\n where table_schema ilike '{{ schema_pattern }}'\n and table_name ilike '{{ table_pattern }}'\n and table_name not ilike '{{ exclude }}'\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0749362}, "macro.dbt_utils.bigquery__get_tables_by_pattern_sql": {"unique_id": "macro.dbt_utils.bigquery__get_tables_by_pattern_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "bigquery__get_tables_by_pattern_sql", "macro_sql": "{% macro bigquery__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {% if '%' in schema_pattern %}\n {% set schemata=dbt_utils._bigquery__get_matching_schemata(schema_pattern, database) %}\n {% else %}\n {% set schemata=[schema_pattern] %}\n {% endif %}\n\n {% set sql %}\n {% for schema in schemata %}\n select distinct\n table_schema,\n table_name,\n {{ dbt_utils.get_table_types_sql() }}\n\n from {{ adapter.quote(database) }}.{{ schema }}.INFORMATION_SCHEMA.TABLES\n where lower(table_name) like lower ('{{ table_pattern }}')\n and lower(table_name) not like lower ('{{ exclude }}')\n\n {% if not loop.last %} union all {% endif %}\n\n {% endfor %}\n {% endset %}\n\n {{ return(sql) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._bigquery__get_matching_schemata", "macro.dbt_utils.get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.076882}, "macro.dbt_utils._bigquery__get_matching_schemata": {"unique_id": "macro.dbt_utils._bigquery__get_matching_schemata", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "_bigquery__get_matching_schemata", "macro_sql": "{% macro _bigquery__get_matching_schemata(schema_pattern, database) %}\n {% if execute %}\n\n {% set sql %}\n select schema_name from {{ adapter.quote(database) }}.INFORMATION_SCHEMA.SCHEMATA\n where lower(schema_name) like lower('{{ schema_pattern }}')\n {% endset %}\n\n {% set results=run_query(sql) %}\n\n {% set schemata=results.columns['schema_name'].values() %}\n\n {{ return(schemata) }}\n\n {% else %}\n\n {{ return([]) }}\n\n {% endif %}\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.078059}, "macro.dbt_utils.get_column_values": {"unique_id": "macro.dbt_utils.get_column_values", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "name": "get_column_values", "macro_sql": "{% macro get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none, where=none) -%}\n {{ return(adapter.dispatch('get_column_values', 'dbt_utils')(table, column, order_by, max_records, default, where)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_column_values"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.080377}, "macro.dbt_utils.default__get_column_values": {"unique_id": "macro.dbt_utils.default__get_column_values", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "name": "default__get_column_values", "macro_sql": "{% macro default__get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none, where=none) -%}\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {% set default = [] if not default %}\n {{ return(default) }}\n {% endif %}\n\n {%- do dbt_utils._is_ephemeral(table, 'get_column_values') -%}\n\n {# Not all relations are tables. Renaming for internal clarity without breaking functionality for anyone using named arguments #}\n {# TODO: Change the method signature in a future 0.x.0 release #}\n {%- set target_relation = table -%}\n\n {# adapter.load_relation is a convenience wrapper to avoid building a Relation when we already have one #}\n {% set relation_exists = (load_relation(target_relation)) is not none %}\n\n {%- call statement('get_column_values', fetch_result=true) %}\n\n {%- if not relation_exists and default is none -%}\n\n {{ exceptions.raise_compiler_error(\"In get_column_values(): relation \" ~ target_relation ~ \" does not exist and no default value was provided.\") }}\n\n {%- elif not relation_exists and default is not none -%}\n\n {{ log(\"Relation \" ~ target_relation ~ \" does not exist. Returning the default value: \" ~ default) }}\n\n {{ return(default) }}\n\n {%- else -%}\n\n\n select\n {{ column }} as value\n\n from {{ target_relation }}\n\n {% if where is not none %}\n where {{ where }}\n {% endif %}\n\n group by {{ column }}\n order by {{ order_by }}\n\n {% if max_records is not none %}\n limit {{ max_records }}\n {% endif %}\n\n {% endif %}\n\n {%- endcall -%}\n\n {%- set value_list = load_result('get_column_values') -%}\n\n {%- if value_list and value_list['data'] -%}\n {%- set values = value_list['data'] | map(attribute=0) | list %}\n {{ return(values) }}\n {%- else -%}\n {{ return(default) }}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_ephemeral", "macro.dbt.load_relation", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.08389}, "macro.dbt_utils.pivot": {"unique_id": "macro.dbt_utils.pivot", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "name": "pivot", "macro_sql": "{% macro pivot(column,\n values,\n alias=True,\n agg='sum',\n cmp='=',\n prefix='',\n suffix='',\n then_value=1,\n else_value=0,\n quote_identifiers=True,\n distinct=False) %}\n {{ return(adapter.dispatch('pivot', 'dbt_utils')(column, values, alias, agg, cmp, prefix, suffix, then_value, else_value, quote_identifiers, distinct)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__pivot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.086101}, "macro.dbt_utils.default__pivot": {"unique_id": "macro.dbt_utils.default__pivot", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "name": "default__pivot", "macro_sql": "{% macro default__pivot(column,\n values,\n alias=True,\n agg='sum',\n cmp='=',\n prefix='',\n suffix='',\n then_value=1,\n else_value=0,\n quote_identifiers=True,\n distinct=False) %}\n {% for value in values %}\n {{ agg }}(\n {% if distinct %} distinct {% endif %}\n case\n when {{ column }} {{ cmp }} '{{ dbt_utils.escape_single_quotes(value) }}'\n then {{ then_value }}\n else {{ else_value }}\n end\n )\n {% if alias %}\n {% if quote_identifiers %}\n as {{ adapter.quote(prefix ~ value ~ suffix) }}\n {% else %}\n as {{ dbt_utils.slugify(prefix ~ value ~ suffix) }}\n {% endif %}\n {% endif %}\n {% if not loop.last %},{% endif %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.escape_single_quotes", "macro.dbt_utils.slugify"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.088104}, "macro.dbt_utils.get_filtered_columns_in_relation": {"unique_id": "macro.dbt_utils.get_filtered_columns_in_relation", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_filtered_columns_in_relation.sql", "original_file_path": "macros/sql/get_filtered_columns_in_relation.sql", "name": "get_filtered_columns_in_relation", "macro_sql": "{% macro get_filtered_columns_in_relation(from, except=[]) -%}\n {{ return(adapter.dispatch('get_filtered_columns_in_relation', 'dbt_utils')(from, except)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_filtered_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0892491}, "macro.dbt_utils.default__get_filtered_columns_in_relation": {"unique_id": "macro.dbt_utils.default__get_filtered_columns_in_relation", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_filtered_columns_in_relation.sql", "original_file_path": "macros/sql/get_filtered_columns_in_relation.sql", "name": "default__get_filtered_columns_in_relation", "macro_sql": "{% macro default__get_filtered_columns_in_relation(from, except=[]) -%}\n {%- do dbt_utils._is_relation(from, 'get_filtered_columns_in_relation') -%}\n {%- do dbt_utils._is_ephemeral(from, 'get_filtered_columns_in_relation') -%}\n\n {# -- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {{ return('') }}\n {% endif %}\n\n {%- set include_cols = [] %}\n {%- set cols = adapter.get_columns_in_relation(from) -%}\n {%- set except = except | map(\"lower\") | list %}\n {%- for col in cols -%}\n {%- if col.column|lower not in except -%}\n {% do include_cols.append(col.column) %}\n {%- endif %}\n {%- endfor %}\n\n {{ return(include_cols) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.091028}, "macro.dbt_utils.get_query_results_as_dict": {"unique_id": "macro.dbt_utils.get_query_results_as_dict", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "name": "get_query_results_as_dict", "macro_sql": "{% macro get_query_results_as_dict(query) %}\n {{ return(adapter.dispatch('get_query_results_as_dict', 'dbt_utils')(query)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_query_results_as_dict"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.091972}, "macro.dbt_utils.default__get_query_results_as_dict": {"unique_id": "macro.dbt_utils.default__get_query_results_as_dict", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "name": "default__get_query_results_as_dict", "macro_sql": "{% macro default__get_query_results_as_dict(query) %}\n\n{# This macro returns a dictionary of the form {column_name: (tuple_of_results)} #}\n\n {%- call statement('get_query_results', fetch_result=True,auto_begin=false) -%}\n\n {{ query }}\n\n {%- endcall -%}\n\n {% set sql_results={} %}\n\n {%- if execute -%}\n {% set sql_results_table = load_result('get_query_results').table.columns %}\n {% for column_name, column in sql_results_table.items() %}\n {% do sql_results.update({column_name: column.values()}) %}\n {% endfor %}\n {%- endif -%}\n\n {{ return(sql_results) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.093353}, "macro.dbt_utils.get_table_types_sql": {"unique_id": "macro.dbt_utils.get_table_types_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "name": "get_table_types_sql", "macro_sql": "{%- macro get_table_types_sql() -%}\n {{ return(adapter.dispatch('get_table_types_sql', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.094377}, "macro.dbt_utils.default__get_table_types_sql": {"unique_id": "macro.dbt_utils.default__get_table_types_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "name": "default__get_table_types_sql", "macro_sql": "{% macro default__get_table_types_sql() %}\n case table_type\n when 'BASE TABLE' then 'table'\n when 'EXTERNAL TABLE' then 'external'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as \"table_type\"\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.09459}, "macro.dbt_utils.postgres__get_table_types_sql": {"unique_id": "macro.dbt_utils.postgres__get_table_types_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "name": "postgres__get_table_types_sql", "macro_sql": "{% macro postgres__get_table_types_sql() %}\n case table_type\n when 'BASE TABLE' then 'table'\n when 'FOREIGN' then 'external'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as \"table_type\"\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0947998}, "macro.dbt_utils.bigquery__get_table_types_sql": {"unique_id": "macro.dbt_utils.bigquery__get_table_types_sql", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "name": "bigquery__get_table_types_sql", "macro_sql": "{% macro bigquery__get_table_types_sql() %}\n case table_type\n when 'BASE TABLE' then 'table'\n when 'EXTERNAL TABLE' then 'external'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as `table_type`\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.094996}, "macro.dbt_utils.degrees_to_radians": {"unique_id": "macro.dbt_utils.degrees_to_radians", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "degrees_to_radians", "macro_sql": "{% macro degrees_to_radians(degrees) -%}\n acos(-1) * {{degrees}} / 180\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.0968928}, "macro.dbt_utils.haversine_distance": {"unique_id": "macro.dbt_utils.haversine_distance", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "haversine_distance", "macro_sql": "{% macro haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n {{ return(adapter.dispatch('haversine_distance', 'dbt_utils')(lat1,lon1,lat2,lon2,unit)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.bigquery__haversine_distance"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.097564}, "macro.dbt_utils.default__haversine_distance": {"unique_id": "macro.dbt_utils.default__haversine_distance", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "default__haversine_distance", "macro_sql": "{% macro default__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{%- if unit == 'mi' %}\n {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n {% set conversion_rate = 1.60934 %}\n{% else %}\n {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n\n 2 * 3961 * asin(sqrt(power((sin(radians(({{ lat2 }} - {{ lat1 }}) / 2))), 2) +\n cos(radians({{lat1}})) * cos(radians({{lat2}})) *\n power((sin(radians(({{ lon2 }} - {{ lon1 }}) / 2))), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.098939}, "macro.dbt_utils.bigquery__haversine_distance": {"unique_id": "macro.dbt_utils.bigquery__haversine_distance", "package_name": "dbt_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "bigquery__haversine_distance", "macro_sql": "{% macro bigquery__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{% set radians_lat1 = dbt_utils.degrees_to_radians(lat1) %}\n{% set radians_lat2 = dbt_utils.degrees_to_radians(lat2) %}\n{% set radians_lon1 = dbt_utils.degrees_to_radians(lon1) %}\n{% set radians_lon2 = dbt_utils.degrees_to_radians(lon2) %}\n{%- if unit == 'mi' %}\n {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n {% set conversion_rate = 1.60934 %}\n{% else %}\n {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n 2 * 3961 * asin(sqrt(power(sin(({{ radians_lat2 }} - {{ radians_lat1 }}) / 2), 2) +\n cos({{ radians_lat1 }}) * cos({{ radians_lat2 }}) *\n power(sin(({{ radians_lon2 }} - {{ radians_lon1 }}) / 2), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.degrees_to_radians"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.101043}, "macro.spark_utils.get_tables": {"unique_id": "macro.spark_utils.get_tables", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "get_tables", "macro_sql": "{% macro get_tables(table_regex_pattern='.*') %}\n\n {% set tables = [] %}\n {% for database in spark__list_schemas('not_used') %}\n {% for table in spark__list_relations_without_caching(database[0]) %}\n {% set db_tablename = database[0] ~ \".\" ~ table[1] %}\n {% set is_match = modules.re.match(table_regex_pattern, db_tablename) %}\n {% if is_match %}\n {% call statement('table_detail', fetch_result=True) -%}\n describe extended {{ db_tablename }}\n {% endcall %}\n\n {% set table_type = load_result('table_detail').table|reverse|selectattr(0, 'in', ('type', 'TYPE', 'Type'))|first %}\n {% if table_type[1]|lower != 'view' %}\n {{ tables.append(db_tablename) }}\n {% endif %}\n {% endif %}\n {% endfor %}\n {% endfor %}\n {{ return(tables) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.110191}, "macro.spark_utils.get_delta_tables": {"unique_id": "macro.spark_utils.get_delta_tables", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "get_delta_tables", "macro_sql": "{% macro get_delta_tables(table_regex_pattern='.*') %}\n\n {% set delta_tables = [] %}\n {% for db_tablename in get_tables(table_regex_pattern) %}\n {% call statement('table_detail', fetch_result=True) -%}\n describe extended {{ db_tablename }}\n {% endcall %}\n\n {% set table_type = load_result('table_detail').table|reverse|selectattr(0, 'in', ('provider', 'PROVIDER', 'Provider'))|first %}\n {% if table_type[1]|lower == 'delta' %}\n {{ delta_tables.append(db_tablename) }}\n {% endif %}\n {% endfor %}\n {{ return(delta_tables) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_tables", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1120079}, "macro.spark_utils.get_statistic_columns": {"unique_id": "macro.spark_utils.get_statistic_columns", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "get_statistic_columns", "macro_sql": "{% macro get_statistic_columns(table) %}\n\n {% call statement('input_columns', fetch_result=True) %}\n SHOW COLUMNS IN {{ table }}\n {% endcall %}\n {% set input_columns = load_result('input_columns').table %}\n\n {% set output_columns = [] %}\n {% for column in input_columns %}\n {% call statement('column_information', fetch_result=True) %}\n DESCRIBE TABLE {{ table }} `{{ column[0] }}`\n {% endcall %}\n {% if not load_result('column_information').table[1][1].startswith('struct') and not load_result('column_information').table[1][1].startswith('array') %}\n {{ output_columns.append('`' ~ column[0] ~ '`') }}\n {% endif %}\n {% endfor %}\n {{ return(output_columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.114054}, "macro.spark_utils.spark_optimize_delta_tables": {"unique_id": "macro.spark_utils.spark_optimize_delta_tables", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "spark_optimize_delta_tables", "macro_sql": "{% macro spark_optimize_delta_tables(table_regex_pattern='.*') %}\n\n {% for table in get_delta_tables(table_regex_pattern) %}\n {% set start=modules.datetime.datetime.now() %}\n {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n {{ dbt_utils.log_info(message_prefix ~ \" Optimizing \" ~ table) }}\n {% do run_query(\"optimize \" ~ table) %}\n {% set end=modules.datetime.datetime.now() %}\n {% set total_seconds = (end - start).total_seconds() | round(2) %}\n {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_delta_tables", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.116299}, "macro.spark_utils.spark_vacuum_delta_tables": {"unique_id": "macro.spark_utils.spark_vacuum_delta_tables", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "spark_vacuum_delta_tables", "macro_sql": "{% macro spark_vacuum_delta_tables(table_regex_pattern='.*') %}\n\n {% for table in get_delta_tables(table_regex_pattern) %}\n {% set start=modules.datetime.datetime.now() %}\n {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n {{ dbt_utils.log_info(message_prefix ~ \" Vacuuming \" ~ table) }}\n {% do run_query(\"vacuum \" ~ table) %}\n {% set end=modules.datetime.datetime.now() %}\n {% set total_seconds = (end - start).total_seconds() | round(2) %}\n {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_delta_tables", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.118128}, "macro.spark_utils.spark_analyze_tables": {"unique_id": "macro.spark_utils.spark_analyze_tables", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "spark_analyze_tables", "macro_sql": "{% macro spark_analyze_tables(table_regex_pattern='.*') %}\n\n {% for table in get_tables(table_regex_pattern) %}\n {% set start=modules.datetime.datetime.now() %}\n {% set columns = get_statistic_columns(table) | join(',') %}\n {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n {{ dbt_utils.log_info(message_prefix ~ \" Analyzing \" ~ table) }}\n {% if columns != '' %}\n {% do run_query(\"analyze table \" ~ table ~ \" compute statistics for columns \" ~ columns) %}\n {% endif %}\n {% set end=modules.datetime.datetime.now() %}\n {% set total_seconds = (end - start).total_seconds() | round(2) %}\n {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_tables", "macro.spark_utils.get_statistic_columns", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1203442}, "macro.spark_utils.spark__concat": {"unique_id": "macro.spark_utils.spark__concat", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/concat.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/concat.sql", "name": "spark__concat", "macro_sql": "{% macro spark__concat(fields) -%}\n concat({{ fields|join(', ') }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.120874}, "macro.spark_utils.spark__type_numeric": {"unique_id": "macro.spark_utils.spark__type_numeric", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/datatypes.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/datatypes.sql", "name": "spark__type_numeric", "macro_sql": "{% macro spark__type_numeric() %}\n decimal(28, 6)\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.121265}, "macro.spark_utils.spark__dateadd": {"unique_id": "macro.spark_utils.spark__dateadd", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/dateadd.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/dateadd.sql", "name": "spark__dateadd", "macro_sql": "{% macro spark__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n {%- set clock_component -%}\n {# make sure the dates + timestamps are real, otherwise raise an error asap #}\n to_unix_timestamp({{ spark_utils.assert_not_null('to_timestamp', from_date_or_timestamp) }})\n - to_unix_timestamp({{ spark_utils.assert_not_null('date', from_date_or_timestamp) }})\n {%- endset -%}\n\n {%- if datepart in ['day', 'week'] -%}\n \n {%- set multiplier = 7 if datepart == 'week' else 1 -%}\n\n to_timestamp(\n to_unix_timestamp(\n date_add(\n {{ spark_utils.assert_not_null('date', from_date_or_timestamp) }},\n cast({{interval}} * {{multiplier}} as int)\n )\n ) + {{clock_component}}\n )\n\n {%- elif datepart in ['month', 'quarter', 'year'] -%}\n \n {%- set multiplier -%} \n {%- if datepart == 'month' -%} 1\n {%- elif datepart == 'quarter' -%} 3\n {%- elif datepart == 'year' -%} 12\n {%- endif -%}\n {%- endset -%}\n\n to_timestamp(\n to_unix_timestamp(\n add_months(\n {{ spark_utils.assert_not_null('date', from_date_or_timestamp) }},\n cast({{interval}} * {{multiplier}} as int)\n )\n ) + {{clock_component}}\n )\n\n {%- elif datepart in ('hour', 'minute', 'second', 'millisecond', 'microsecond') -%}\n \n {%- set multiplier -%} \n {%- if datepart == 'hour' -%} 3600\n {%- elif datepart == 'minute' -%} 60\n {%- elif datepart == 'second' -%} 1\n {%- elif datepart == 'millisecond' -%} (1/1000000)\n {%- elif datepart == 'microsecond' -%} (1/1000000)\n {%- endif -%}\n {%- endset -%}\n\n to_timestamp(\n {{ spark_utils.assert_not_null('to_unix_timestamp', from_date_or_timestamp) }}\n + cast({{interval}} * {{multiplier}} as int)\n )\n\n {%- else -%}\n\n {{ exceptions.raise_compiler_error(\"macro dateadd not implemented for datepart ~ '\" ~ datepart ~ \"' ~ on Spark\") }}\n\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.127184}, "macro.spark_utils.spark__datediff": {"unique_id": "macro.spark_utils.spark__datediff", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/datediff.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/datediff.sql", "name": "spark__datediff", "macro_sql": "{% macro spark__datediff(first_date, second_date, datepart) %}\n\n {%- if datepart in ['day', 'week', 'month', 'quarter', 'year'] -%}\n \n {# make sure the dates are real, otherwise raise an error asap #}\n {% set first_date = spark_utils.assert_not_null('date', first_date) %}\n {% set second_date = spark_utils.assert_not_null('date', second_date) %}\n \n {%- endif -%}\n \n {%- if datepart == 'day' -%}\n \n datediff({{second_date}}, {{first_date}})\n \n {%- elif datepart == 'week' -%}\n \n case when {{first_date}} < {{second_date}}\n then floor(datediff({{second_date}}, {{first_date}})/7)\n else ceil(datediff({{second_date}}, {{first_date}})/7)\n end\n \n -- did we cross a week boundary (Sunday)?\n + case\n when {{first_date}} < {{second_date}} and dayofweek({{second_date}}) < dayofweek({{first_date}}) then 1\n when {{first_date}} > {{second_date}} and dayofweek({{second_date}}) > dayofweek({{first_date}}) then -1\n else 0 end\n\n {%- elif datepart == 'month' -%}\n\n case when {{first_date}} < {{second_date}}\n then floor(months_between(date({{second_date}}), date({{first_date}})))\n else ceil(months_between(date({{second_date}}), date({{first_date}})))\n end\n \n -- did we cross a month boundary?\n + case\n when {{first_date}} < {{second_date}} and dayofmonth({{second_date}}) < dayofmonth({{first_date}}) then 1\n when {{first_date}} > {{second_date}} and dayofmonth({{second_date}}) > dayofmonth({{first_date}}) then -1\n else 0 end\n \n {%- elif datepart == 'quarter' -%}\n \n case when {{first_date}} < {{second_date}}\n then floor(months_between(date({{second_date}}), date({{first_date}}))/3)\n else ceil(months_between(date({{second_date}}), date({{first_date}}))/3)\n end\n \n -- did we cross a quarter boundary?\n + case\n when {{first_date}} < {{second_date}} and (\n (dayofyear({{second_date}}) - (quarter({{second_date}}) * 365/4))\n < (dayofyear({{first_date}}) - (quarter({{first_date}}) * 365/4))\n ) then 1\n when {{first_date}} > {{second_date}} and (\n (dayofyear({{second_date}}) - (quarter({{second_date}}) * 365/4))\n > (dayofyear({{first_date}}) - (quarter({{first_date}}) * 365/4))\n ) then -1\n else 0 end\n\n {%- elif datepart == 'year' -%}\n \n year({{second_date}}) - year({{first_date}})\n\n {%- elif datepart in ('hour', 'minute', 'second', 'millisecond', 'microsecond') -%}\n \n {%- set divisor -%} \n {%- if datepart == 'hour' -%} 3600\n {%- elif datepart == 'minute' -%} 60\n {%- elif datepart == 'second' -%} 1\n {%- elif datepart == 'millisecond' -%} (1/1000)\n {%- elif datepart == 'microsecond' -%} (1/1000000)\n {%- endif -%}\n {%- endset -%}\n\n case when {{first_date}} < {{second_date}}\n then ceil((\n {# make sure the timestamps are real, otherwise raise an error asap #}\n {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', second_date)) }}\n - {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', first_date)) }}\n ) / {{divisor}})\n else floor((\n {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', second_date)) }}\n - {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', first_date)) }}\n ) / {{divisor}})\n end\n \n {% if datepart == 'millisecond' %}\n + cast(date_format({{second_date}}, 'SSS') as int)\n - cast(date_format({{first_date}}, 'SSS') as int)\n {% endif %}\n \n {% if datepart == 'microsecond' %} \n {% set capture_str = '[0-9]{4}-[0-9]{2}-[0-9]{2}.[0-9]{2}:[0-9]{2}:[0-9]{2}.([0-9]{6})' %}\n -- Spark doesn't really support microseconds, so this is a massive hack!\n -- It will only work if the timestamp-string is of the format\n -- 'yyyy-MM-dd-HH mm.ss.SSSSSS'\n + cast(regexp_extract({{second_date}}, '{{capture_str}}', 1) as int)\n - cast(regexp_extract({{first_date}}, '{{capture_str}}', 1) as int) \n {% endif %}\n\n {%- else -%}\n\n {{ exceptions.raise_compiler_error(\"macro datediff not implemented for datepart ~ '\" ~ datepart ~ \"' ~ on Spark\") }}\n\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.141421}, "macro.spark_utils.spark__current_timestamp": {"unique_id": "macro.spark_utils.spark__current_timestamp", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "name": "spark__current_timestamp", "macro_sql": "{% macro spark__current_timestamp() %}\n current_timestamp()\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.141859}, "macro.spark_utils.spark__current_timestamp_in_utc": {"unique_id": "macro.spark_utils.spark__current_timestamp_in_utc", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "name": "spark__current_timestamp_in_utc", "macro_sql": "{% macro spark__current_timestamp_in_utc() %}\n unix_timestamp()\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.142039}, "macro.spark_utils.spark__split_part": {"unique_id": "macro.spark_utils.spark__split_part", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/split_part.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/split_part.sql", "name": "spark__split_part", "macro_sql": "{% macro spark__split_part(string_text, delimiter_text, part_number) %}\n\n {% set delimiter_expr %}\n \n -- escape if starts with a special character\n case when regexp_extract({{ delimiter_text }}, '([^A-Za-z0-9])(.*)', 1) != '_'\n then concat('\\\\', {{ delimiter_text }})\n else {{ delimiter_text }} end\n \n {% endset %}\n\n {% set split_part_expr %}\n \n split(\n {{ string_text }},\n {{ delimiter_expr }}\n )[({{ part_number - 1 }})]\n \n {% endset %}\n \n {{ return(split_part_expr) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1433668}, "macro.spark_utils.spark__get_relations_by_pattern": {"unique_id": "macro.spark_utils.spark__get_relations_by_pattern", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_relations_by_pattern", "macro_sql": "{% macro spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n show table extended in {{ schema_pattern }} like '{{ table_pattern }}'\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=None,\n schema=row[0],\n identifier=row[1],\n type=('view' if 'Type: VIEW' in row[3] else 'table')\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.146799}, "macro.spark_utils.spark__get_relations_by_prefix": {"unique_id": "macro.spark_utils.spark__get_relations_by_prefix", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_relations_by_prefix", "macro_sql": "{% macro spark__get_relations_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {% set table_pattern = table_pattern ~ '*' %}\n {{ return(spark_utils.spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.147562}, "macro.spark_utils.spark__get_tables_by_pattern": {"unique_id": "macro.spark_utils.spark__get_tables_by_pattern", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_tables_by_pattern", "macro_sql": "{% macro spark__get_tables_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(spark_utils.spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.148195}, "macro.spark_utils.spark__get_tables_by_prefix": {"unique_id": "macro.spark_utils.spark__get_tables_by_prefix", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_tables_by_prefix", "macro_sql": "{% macro spark__get_tables_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(spark_utils.spark__get_relations_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_prefix"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.148823}, "macro.spark_utils.assert_not_null": {"unique_id": "macro.spark_utils.assert_not_null", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/etc/assert_not_null.sql", "original_file_path": "macros/etc/assert_not_null.sql", "name": "assert_not_null", "macro_sql": "{% macro assert_not_null(function, arg) -%}\n {{ return(adapter.dispatch('assert_not_null', 'spark_utils')(function, arg)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.default__assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.149665}, "macro.spark_utils.default__assert_not_null": {"unique_id": "macro.spark_utils.default__assert_not_null", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/etc/assert_not_null.sql", "original_file_path": "macros/etc/assert_not_null.sql", "name": "default__assert_not_null", "macro_sql": "{% macro default__assert_not_null(function, arg) %}\n\n coalesce({{function}}({{arg}}), nvl2({{function}}({{arg}}), assert_true({{function}}({{arg}}) is not null), null))\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.150152}, "macro.spark_utils.spark__convert_timezone": {"unique_id": "macro.spark_utils.spark__convert_timezone", "package_name": "spark_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/spark_utils", "path": "macros/snowplow/convert_timezone.sql", "original_file_path": "macros/snowplow/convert_timezone.sql", "name": "spark__convert_timezone", "macro_sql": "{% macro spark__convert_timezone(in_tz, out_tz, in_timestamp) %}\n from_utc_timestamp(to_utc_timestamp({{in_timestamp}}, {{in_tz}}), {{out_tz}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.150811}, "macro.fivetran_utils.enabled_vars": {"unique_id": "macro.fivetran_utils.enabled_vars", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/enabled_vars.sql", "original_file_path": "macros/enabled_vars.sql", "name": "enabled_vars", "macro_sql": "{% macro enabled_vars(vars) %}\n\n{% for v in vars %}\n \n {% if var(v, True) == False %}\n {{ return(False) }}\n {% endif %}\n\n{% endfor %}\n\n{{ return(True) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.15185}, "macro.fivetran_utils.percentile": {"unique_id": "macro.fivetran_utils.percentile", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "percentile", "macro_sql": "{% macro percentile(percentile_field, partition_field, percent) -%}\n\n{{ adapter.dispatch('percentile', 'fivetran_utils') (percentile_field, partition_field, percent) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.bigquery__percentile"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.153611}, "macro.fivetran_utils.default__percentile": {"unique_id": "macro.fivetran_utils.default__percentile", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "default__percentile", "macro_sql": "{% macro default__percentile(percentile_field, partition_field, percent) %}\n\n percentile_cont( \n {{ percent }} )\n within group ( order by {{ percentile_field }} )\n over ( partition by {{ partition_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.154005}, "macro.fivetran_utils.redshift__percentile": {"unique_id": "macro.fivetran_utils.redshift__percentile", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "redshift__percentile", "macro_sql": "{% macro redshift__percentile(percentile_field, partition_field, percent) %}\n\n percentile_cont( \n {{ percent }} )\n within group ( order by {{ percentile_field }} )\n over ( partition by {{ partition_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.154465}, "macro.fivetran_utils.bigquery__percentile": {"unique_id": "macro.fivetran_utils.bigquery__percentile", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "bigquery__percentile", "macro_sql": "{% macro bigquery__percentile(percentile_field, partition_field, percent) %}\n\n percentile_cont( \n {{ percentile_field }}, \n {{ percent }}) \n over (partition by {{ partition_field }} \n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.154953}, "macro.fivetran_utils.postgres__percentile": {"unique_id": "macro.fivetran_utils.postgres__percentile", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "postgres__percentile", "macro_sql": "{% macro postgres__percentile(percentile_field, partition_field, percent) %}\n\n percentile_cont( \n {{ percent }} )\n within group ( order by {{ percentile_field }} )\n /* have to group by partition field */\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.155288}, "macro.fivetran_utils.spark__percentile": {"unique_id": "macro.fivetran_utils.spark__percentile", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "spark__percentile", "macro_sql": "{% macro spark__percentile(percentile_field, partition_field, percent) %}\n\n percentile( \n {{ percentile_field }}, \n {{ percent }}) \n over (partition by {{ partition_field }} \n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.155659}, "macro.fivetran_utils.pivot_json_extract": {"unique_id": "macro.fivetran_utils.pivot_json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/pivot_json_extract.sql", "original_file_path": "macros/pivot_json_extract.sql", "name": "pivot_json_extract", "macro_sql": "{% macro pivot_json_extract(string, list_of_properties) %}\n\n{%- for property in list_of_properties -%}\n\nreplace( {{ fivetran_utils.json_extract(string, property) }}, '\"', '') as {{ property | replace(' ', '_') | lower }}\n\n{%- if not loop.last -%},{%- endif %}\n{% endfor -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.json_extract"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.157109}, "macro.fivetran_utils.persist_pass_through_columns": {"unique_id": "macro.fivetran_utils.persist_pass_through_columns", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/persist_pass_through_columns.sql", "original_file_path": "macros/persist_pass_through_columns.sql", "name": "persist_pass_through_columns", "macro_sql": "{% macro persist_pass_through_columns(pass_through_variable) %}\n\n{% if var(pass_through_variable, none) %}\n {% for field in var(pass_through_variable) %}\n , {{ field.alias if field.alias else field.name }}\n {% endfor %}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.158176}, "macro.fivetran_utils.json_parse": {"unique_id": "macro.fivetran_utils.json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "json_parse", "macro_sql": "{% macro json_parse(string, string_path) -%}\n\n{{ adapter.dispatch('json_parse', 'fivetran_utils') (string, string_path) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.bigquery__json_parse"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1604}, "macro.fivetran_utils.default__json_parse": {"unique_id": "macro.fivetran_utils.default__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "default__json_parse", "macro_sql": "{% macro default__json_parse(string, string_path) %}\n\n json_extract_path_text({{string}}, {%- for s in string_path -%}'{{ s }}'{%- if not loop.last -%},{%- endif -%}{%- endfor -%} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.161128}, "macro.fivetran_utils.redshift__json_parse": {"unique_id": "macro.fivetran_utils.redshift__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "redshift__json_parse", "macro_sql": "{% macro redshift__json_parse(string, string_path) %}\n\n json_extract_path_text({{string}}, {%- for s in string_path -%}'{{ s }}'{%- if not loop.last -%},{%- endif -%}{%- endfor -%} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1617222}, "macro.fivetran_utils.bigquery__json_parse": {"unique_id": "macro.fivetran_utils.bigquery__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "bigquery__json_parse", "macro_sql": "{% macro bigquery__json_parse(string, string_path) %}\n\n \n json_extract_scalar({{string}}, '$.{%- for s in string_path -%}{{ s }}{%- if not loop.last -%}.{%- endif -%}{%- endfor -%} ')\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.16232}, "macro.fivetran_utils.postgres__json_parse": {"unique_id": "macro.fivetran_utils.postgres__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "postgres__json_parse", "macro_sql": "{% macro postgres__json_parse(string, string_path) %}\n\n {{string}}::json #>> '{ {%- for s in string_path -%}{{ s }}{%- if not loop.last -%},{%- endif -%}{%- endfor -%} }'\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1628852}, "macro.fivetran_utils.snowflake__json_parse": {"unique_id": "macro.fivetran_utils.snowflake__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "snowflake__json_parse", "macro_sql": "{% macro snowflake__json_parse(string, string_path) %}\n\n parse_json( {{string}} ) {%- for s in string_path -%}{% if s is number %}[{{ s }}]{% else %}['{{ s }}']{% endif %}{%- endfor -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1635158}, "macro.fivetran_utils.spark__json_parse": {"unique_id": "macro.fivetran_utils.spark__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "spark__json_parse", "macro_sql": "{% macro spark__json_parse(string, string_path) %}\n\n {{string}} : {%- for s in string_path -%}{% if s is number %}[{{ s }}]{% else %}['{{ s }}']{% endif %}{%- endfor -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1641579}, "macro.fivetran_utils.max_bool": {"unique_id": "macro.fivetran_utils.max_bool", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "name": "max_bool", "macro_sql": "{% macro max_bool(boolean_field) -%}\n\n{{ adapter.dispatch('max_bool', 'fivetran_utils') (boolean_field) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.bigquery__max_bool"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.164961}, "macro.fivetran_utils.default__max_bool": {"unique_id": "macro.fivetran_utils.default__max_bool", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "name": "default__max_bool", "macro_sql": "{% macro default__max_bool(boolean_field) %}\n\n bool_or( {{ boolean_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.165225}, "macro.fivetran_utils.snowflake__max_bool": {"unique_id": "macro.fivetran_utils.snowflake__max_bool", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "name": "snowflake__max_bool", "macro_sql": "{% macro snowflake__max_bool(boolean_field) %}\n\n max( {{ boolean_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.16547}, "macro.fivetran_utils.bigquery__max_bool": {"unique_id": "macro.fivetran_utils.bigquery__max_bool", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "name": "bigquery__max_bool", "macro_sql": "{% macro bigquery__max_bool(boolean_field) %}\n\n max( {{ boolean_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.165709}, "macro.fivetran_utils.calculated_fields": {"unique_id": "macro.fivetran_utils.calculated_fields", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/calculated_fields.sql", "original_file_path": "macros/calculated_fields.sql", "name": "calculated_fields", "macro_sql": "{% macro calculated_fields(variable) -%}\n\n{% if var(variable, none) %}\n {% for field in var(variable) %}\n , {{ field.transform_sql }} as {{ field.name }} \n {% endfor %}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.166715}, "macro.fivetran_utils.seed_data_helper": {"unique_id": "macro.fivetran_utils.seed_data_helper", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/seed_data_helper.sql", "original_file_path": "macros/seed_data_helper.sql", "name": "seed_data_helper", "macro_sql": "{% macro seed_data_helper(seed_name, warehouses) %}\n\n{% if target.type in warehouses %}\n {% for w in warehouses %}\n {% if target.type == w %}\n {{ return(ref(seed_name ~ \"_\" ~ w ~ \"\")) }}\n {% endif %}\n {% endfor %}\n{% else %}\n{{ return(ref(seed_name)) }}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1681879}, "macro.fivetran_utils.fill_pass_through_columns": {"unique_id": "macro.fivetran_utils.fill_pass_through_columns", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/fill_pass_through_columns.sql", "original_file_path": "macros/fill_pass_through_columns.sql", "name": "fill_pass_through_columns", "macro_sql": "{% macro fill_pass_through_columns(pass_through_variable) %}\n\n{% if var(pass_through_variable) %}\n {% for field in var(pass_through_variable) %}\n {% if field.transform_sql %}\n , {{ field.transform_sql }} as {{ field.alias if field.alias else field.name }}\n {% else %}\n , {{ field.alias if field.alias else field.name }}\n {% endif %}\n {% endfor %}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1696792}, "macro.fivetran_utils.string_agg": {"unique_id": "macro.fivetran_utils.string_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "string_agg", "macro_sql": "{% macro string_agg(field_to_agg, delimiter) -%}\n\n{{ adapter.dispatch('string_agg', 'fivetran_utils') (field_to_agg, delimiter) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__string_agg"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.170922}, "macro.fivetran_utils.default__string_agg": {"unique_id": "macro.fivetran_utils.default__string_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "default__string_agg", "macro_sql": "{% macro default__string_agg(field_to_agg, delimiter) %}\n string_agg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.171235}, "macro.fivetran_utils.snowflake__string_agg": {"unique_id": "macro.fivetran_utils.snowflake__string_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "snowflake__string_agg", "macro_sql": "{% macro snowflake__string_agg(field_to_agg, delimiter) %}\n listagg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1715531}, "macro.fivetran_utils.redshift__string_agg": {"unique_id": "macro.fivetran_utils.redshift__string_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "redshift__string_agg", "macro_sql": "{% macro redshift__string_agg(field_to_agg, delimiter) %}\n listagg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.171867}, "macro.fivetran_utils.spark__string_agg": {"unique_id": "macro.fivetran_utils.spark__string_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "spark__string_agg", "macro_sql": "{% macro spark__string_agg(field_to_agg, delimiter) %}\n -- collect set will remove duplicates\n replace(replace(replace(cast( collect_set({{ field_to_agg }}) as string), '[', ''), ']', ''), ', ', {{ delimiter }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.172182}, "macro.fivetran_utils.timestamp_diff": {"unique_id": "macro.fivetran_utils.timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "timestamp_diff", "macro_sql": "{% macro timestamp_diff(first_date, second_date, datepart) %}\n {{ adapter.dispatch('timestamp_diff', 'fivetran_utils')(first_date, second_date, datepart) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.bigquery__timestamp_diff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.177061}, "macro.fivetran_utils.default__timestamp_diff": {"unique_id": "macro.fivetran_utils.default__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "default__timestamp_diff", "macro_sql": "{% macro default__timestamp_diff(first_date, second_date, datepart) %}\n\n datediff(\n {{ datepart }},\n {{ first_date }},\n {{ second_date }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.177525}, "macro.fivetran_utils.redshift__timestamp_diff": {"unique_id": "macro.fivetran_utils.redshift__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "redshift__timestamp_diff", "macro_sql": "{% macro redshift__timestamp_diff(first_date, second_date, datepart) %}\n\n datediff(\n {{ datepart }},\n {{ first_date }},\n {{ second_date }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.177956}, "macro.fivetran_utils.bigquery__timestamp_diff": {"unique_id": "macro.fivetran_utils.bigquery__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "bigquery__timestamp_diff", "macro_sql": "{% macro bigquery__timestamp_diff(first_date, second_date, datepart) %}\n\n timestamp_diff(\n {{second_date}},\n {{first_date}},\n {{datepart}}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.17837}, "macro.fivetran_utils.postgres__timestamp_diff": {"unique_id": "macro.fivetran_utils.postgres__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "postgres__timestamp_diff", "macro_sql": "{% macro postgres__timestamp_diff(first_date, second_date, datepart) %}\n\n {% if datepart == 'year' %}\n (date_part('year', ({{second_date}})::date) - date_part('year', ({{first_date}})::date))\n {% elif datepart == 'quarter' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 4 + date_part('quarter', ({{second_date}})::date) - date_part('quarter', ({{first_date}})::date))\n {% elif datepart == 'month' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 12 + date_part('month', ({{second_date}})::date) - date_part('month', ({{first_date}})::date))\n {% elif datepart == 'day' %}\n (({{second_date}})::date - ({{first_date}})::date)\n {% elif datepart == 'week' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} / 7 + case\n when date_part('dow', ({{first_date}})::timestamp) <= date_part('dow', ({{second_date}})::timestamp) then\n case when {{first_date}} <= {{second_date}} then 0 else -1 end\n else\n case when {{first_date}} <= {{second_date}} then 1 else 0 end\n end)\n {% elif datepart == 'hour' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} * 24 + date_part('hour', ({{second_date}})::timestamp) - date_part('hour', ({{first_date}})::timestamp))\n {% elif datepart == 'minute' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'hour') }} * 60 + date_part('minute', ({{second_date}})::timestamp) - date_part('minute', ({{first_date}})::timestamp))\n {% elif datepart == 'second' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60 + floor(date_part('second', ({{second_date}})::timestamp)) - floor(date_part('second', ({{first_date}})::timestamp)))\n {% elif datepart == 'millisecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000 + floor(date_part('millisecond', ({{second_date}})::timestamp)) - floor(date_part('millisecond', ({{first_date}})::timestamp)))\n {% elif datepart == 'microsecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000000 + floor(date_part('microsecond', ({{second_date}})::timestamp)) - floor(date_part('microsecond', ({{first_date}})::timestamp)))\n {% else %}\n {{ exceptions.raise_compiler_error(\"Unsupported datepart for macro datediff in postgres: {!r}\".format(datepart)) }}\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.182865}, "macro.fivetran_utils.try_cast": {"unique_id": "macro.fivetran_utils.try_cast", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "try_cast", "macro_sql": "{% macro try_cast(field, type) %}\n {{ adapter.dispatch('try_cast', 'fivetran_utils') (field, type) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.bigquery__try_cast"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.18457}, "macro.fivetran_utils.default__safe_cast": {"unique_id": "macro.fivetran_utils.default__safe_cast", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "default__safe_cast", "macro_sql": "{% macro default__safe_cast(field, type) %}\n {# most databases don't support this function yet\n so we just need to use cast #}\n cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1849039}, "macro.fivetran_utils.redshift__try_cast": {"unique_id": "macro.fivetran_utils.redshift__try_cast", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "redshift__try_cast", "macro_sql": "{% macro redshift__try_cast(field, type) %}\n{%- if type == 'numeric' -%}\n\n case\n when trim({{field}}) ~ '^(0|[1-9][0-9]*)$' then trim({{field}})\n else null\n end::{{type}}\n\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"non-numeric datatypes are not currently supported\") }}\n\n{% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.185598}, "macro.fivetran_utils.postgres__try_cast": {"unique_id": "macro.fivetran_utils.postgres__try_cast", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "postgres__try_cast", "macro_sql": "{% macro postgres__try_cast(field, type) %}\n{%- if type == 'numeric' -%}\n\n case\n when replace(cast({{field}} as varchar),cast(' ' as varchar),cast('' as varchar)) ~ '^(0|[1-9][0-9]*)$' \n then replace(cast({{field}} as varchar),cast(' ' as varchar),cast('' as varchar))\n else null\n end::{{type}}\n\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"non-numeric datatypes are not currently supported\") }}\n\n{% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.186312}, "macro.fivetran_utils.snowflake__try_cast": {"unique_id": "macro.fivetran_utils.snowflake__try_cast", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "snowflake__try_cast", "macro_sql": "{% macro snowflake__try_cast(field, type) %}\n try_cast(cast({{field}} as varchar) as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.186631}, "macro.fivetran_utils.bigquery__try_cast": {"unique_id": "macro.fivetran_utils.bigquery__try_cast", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "bigquery__try_cast", "macro_sql": "{% macro bigquery__try_cast(field, type) %}\n safe_cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1869419}, "macro.fivetran_utils.spark__try_cast": {"unique_id": "macro.fivetran_utils.spark__try_cast", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "spark__try_cast", "macro_sql": "{% macro spark__try_cast(field, type) %}\n try_cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1872509}, "macro.fivetran_utils.source_relation": {"unique_id": "macro.fivetran_utils.source_relation", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/source_relation.sql", "original_file_path": "macros/source_relation.sql", "name": "source_relation", "macro_sql": "{% macro source_relation(union_schema_variable='union_schemas', union_database_variable='union_databases') -%}\n\n{{ adapter.dispatch('source_relation', 'fivetran_utils') (union_schema_variable, union_database_variable) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__source_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.188386}, "macro.fivetran_utils.default__source_relation": {"unique_id": "macro.fivetran_utils.default__source_relation", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/source_relation.sql", "original_file_path": "macros/source_relation.sql", "name": "default__source_relation", "macro_sql": "{% macro default__source_relation(union_schema_variable, union_database_variable) %}\n\n{% if var(union_schema_variable, none) %}\n, case\n {% for schema in var(union_schema_variable) %}\n when lower(replace(replace(_dbt_source_relation,'\"',''),'`','')) like '%.{{ schema|lower }}.%' then '{{ schema|lower }}'\n {% endfor %}\n end as source_relation\n{% elif var(union_database_variable, none) %}\n, case\n {% for database in var(union_database_variable) %}\n when lower(replace(replace(_dbt_source_relation,'\"',''),'`','')) like '%{{ database|lower }}.%' then '{{ database|lower }}'\n {% endfor %}\n end as source_relation\n{% else %}\n, cast('' as {{ dbt_utils.type_string() }}) as source_relation\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.189734}, "macro.fivetran_utils.first_value": {"unique_id": "macro.fivetran_utils.first_value", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "name": "first_value", "macro_sql": "{% macro first_value(first_value_field, partition_field, order_by_field, order=\"asc\") -%}\n\n{{ adapter.dispatch('first_value', 'fivetran_utils') (first_value_field, partition_field, order_by_field, order) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__first_value"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1908622}, "macro.fivetran_utils.default__first_value": {"unique_id": "macro.fivetran_utils.default__first_value", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "name": "default__first_value", "macro_sql": "{% macro default__first_value(first_value_field, partition_field, order_by_field, order=\"asc\") %}\n\n first_value( {{ first_value_field }} ignore nulls ) over (partition by {{ partition_field }} order by {{ order_by_field }} {{ order }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1914518}, "macro.fivetran_utils.redshift__first_value": {"unique_id": "macro.fivetran_utils.redshift__first_value", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "name": "redshift__first_value", "macro_sql": "{% macro redshift__first_value(first_value_field, partition_field, order_by_field, order=\"asc\") %}\n\n first_value( {{ first_value_field }} ignore nulls ) over (partition by {{ partition_field }} order by {{ order_by_field }} {{ order }} , {{ partition_field }} rows unbounded preceding )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.1919968}, "macro.fivetran_utils.add_dbt_source_relation": {"unique_id": "macro.fivetran_utils.add_dbt_source_relation", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/add_dbt_source_relation.sql", "original_file_path": "macros/add_dbt_source_relation.sql", "name": "add_dbt_source_relation", "macro_sql": "{% macro add_dbt_source_relation() %}\n\n{% if var('union_schemas', none) or var('union_databases', none) %}\n, _dbt_source_relation\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.192821}, "macro.fivetran_utils.add_pass_through_columns": {"unique_id": "macro.fivetran_utils.add_pass_through_columns", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/add_pass_through_columns.sql", "original_file_path": "macros/add_pass_through_columns.sql", "name": "add_pass_through_columns", "macro_sql": "{% macro add_pass_through_columns(base_columns, pass_through_var) %}\n\n {% if pass_through_var %}\n\n {% for column in pass_through_var %}\n\n {% if column.alias %}\n\n {% do base_columns.append({ \"name\": column.name, \"alias\": column.alias, \"datatype\": column.datatype if column.datatype else dbt_utils.type_string()}) %}\n\n {% else %}\n\n {% do base_columns.append({ \"name\": column.name, \"datatype\": column.datatype if column.datatype else dbt_utils.type_string()}) %}\n \n {% endif %}\n\n {% endfor %}\n\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.194816}, "macro.fivetran_utils.union_relations": {"unique_id": "macro.fivetran_utils.union_relations", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/union_relations.sql", "original_file_path": "macros/union_relations.sql", "name": "union_relations", "macro_sql": "{%- macro union_relations(relations, aliases=none, column_override=none, include=[], exclude=[], source_column_name=none) -%}\n\n {%- if exclude and include -%}\n {{ exceptions.raise_compiler_error(\"Both an exclude and include list were provided to the `union` macro. Only one is allowed\") }}\n {%- endif -%}\n\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. -#}\n {%- if not execute %}\n {{ return('') }}\n {% endif -%}\n\n {%- set column_override = column_override if column_override is not none else {} -%}\n {%- set source_column_name = source_column_name if source_column_name is not none else '_dbt_source_relation' -%}\n\n {%- set relation_columns = {} -%}\n {%- set column_superset = {} -%}\n\n {%- for relation in relations -%}\n\n {%- do relation_columns.update({relation: []}) -%}\n\n {%- do dbt_utils._is_relation(relation, 'union_relations') -%}\n {%- set cols = adapter.get_columns_in_relation(relation) -%}\n {%- for col in cols -%}\n\n {#- If an exclude list was provided and the column is in the list, do nothing -#}\n {%- if exclude and col.column in exclude -%}\n\n {#- If an include list was provided and the column is not in the list, do nothing -#}\n {%- elif include and col.column not in include -%}\n\n {#- Otherwise add the column to the column superset -#}\n {%- else -%}\n\n {#- update the list of columns in this relation -#}\n {%- do relation_columns[relation].append(col.column) -%}\n\n {%- if col.column in column_superset -%}\n\n {%- set stored = column_superset[col.column] -%}\n {%- if col.is_string() and stored.is_string() and col.string_size() > stored.string_size() -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif %}\n\n {%- else -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif -%}\n\n {%- endif -%}\n\n {%- endfor -%}\n {%- endfor -%}\n\n {%- set ordered_column_names = column_superset.keys() -%}\n\n {%- for relation in relations %}\n\n (\n select\n\n cast({{ dbt_utils.string_literal(relation) }} as {{ dbt_utils.type_string() }}) as {{ source_column_name }},\n {% for col_name in ordered_column_names -%}\n\n {%- set col = column_superset[col_name] %}\n {%- set col_type = column_override.get(col.column, col.data_type) %}\n {%- set col_name = adapter.quote(col_name) if col_name in relation_columns[relation] else 'null' %}\n cast({{ col_name }} as {{ col_type }}) as {{ col.quoted }} {% if not loop.last %},{% endif -%}\n\n {%- endfor %}\n\n from {{ aliases[loop.index0] if aliases else relation }}\n )\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n\n {%- endfor -%}\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils.string_literal", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.203735}, "macro.fivetran_utils.union_tables": {"unique_id": "macro.fivetran_utils.union_tables", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/union_relations.sql", "original_file_path": "macros/union_relations.sql", "name": "union_tables", "macro_sql": "{%- macro union_tables(tables, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_table') -%}\n\n {%- do exceptions.warn(\"Warning: the `union_tables` macro is no longer supported and will be deprecated in a future release of dbt-utils. Use the `union_relations` macro instead\") -%}\n\n {{ return(dbt_utils.union_relations(tables, column_override, include, exclude, source_column_name)) }}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.union_relations"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.204741}, "macro.fivetran_utils.snowflake_seed_data": {"unique_id": "macro.fivetran_utils.snowflake_seed_data", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/snowflake_seed_data.sql", "original_file_path": "macros/snowflake_seed_data.sql", "name": "snowflake_seed_data", "macro_sql": "{% macro snowflake_seed_data(seed_name) %}\n\n{% if target.type == 'snowflake' %}\n{{ return(ref(seed_name ~ '_snowflake')) }}\n{% else %}\n{{ return(ref(seed_name)) }}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.205817}, "macro.fivetran_utils.fill_staging_columns": {"unique_id": "macro.fivetran_utils.fill_staging_columns", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/fill_staging_columns.sql", "original_file_path": "macros/fill_staging_columns.sql", "name": "fill_staging_columns", "macro_sql": "{% macro fill_staging_columns(source_columns, staging_columns) -%}\n\n{%- set source_column_names = source_columns|map(attribute='name')|map('lower')|list -%}\n\n{%- for column in staging_columns %}\n {% if column.name|lower in source_column_names -%}\n {{ fivetran_utils.quote_column(column) }} as \n {%- if 'alias' in column %} {{ column.alias }} {% else %} {{ fivetran_utils.quote_column(column) }} {%- endif -%}\n {%- else -%}\n cast(null as {{ column.datatype }})\n {%- if 'alias' in column %} as {{ column.alias }} {% else %} as {{ fivetran_utils.quote_column(column) }} {% endif -%}\n {%- endif -%}\n {%- if not loop.last -%} , {% endif -%}\n{% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.quote_column"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.209116}, "macro.fivetran_utils.quote_column": {"unique_id": "macro.fivetran_utils.quote_column", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/fill_staging_columns.sql", "original_file_path": "macros/fill_staging_columns.sql", "name": "quote_column", "macro_sql": "{% macro quote_column(column) %}\n {% if 'quote' in column %}\n {% if column.quote %}\n {% if target.type in ('bigquery', 'spark') %}\n `{{ column.name }}`\n {% elif target.type == 'snowflake' %}\n \"{{ column.name | upper }}\"\n {% else %}\n \"{{ column.name }}\"\n {% endif %}\n {% else %}\n {{ column.name }}\n {% endif %}\n {% else %}\n {{ column.name }}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.210907}, "macro.fivetran_utils.json_extract": {"unique_id": "macro.fivetran_utils.json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "json_extract", "macro_sql": "{% macro json_extract(string, string_path) -%}\n\n{{ adapter.dispatch('json_extract', 'fivetran_utils') (string, string_path) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.bigquery__json_extract"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.212298}, "macro.fivetran_utils.default__json_extract": {"unique_id": "macro.fivetran_utils.default__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "default__json_extract", "macro_sql": "{% macro default__json_extract(string, string_path) %}\n\n json_extract_path_text({{string}}, {{ \"'\" ~ string_path ~ \"'\" }} )\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.212665}, "macro.fivetran_utils.snowflake__json_extract": {"unique_id": "macro.fivetran_utils.snowflake__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "snowflake__json_extract", "macro_sql": "{% macro snowflake__json_extract(string, string_path) %}\n\n json_extract_path_text(try_parse_json( {{string}} ), {{ \"'\" ~ string_path ~ \"'\" }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.213053}, "macro.fivetran_utils.redshift__json_extract": {"unique_id": "macro.fivetran_utils.redshift__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "redshift__json_extract", "macro_sql": "{% macro redshift__json_extract(string, string_path) %}\n\n case when is_valid_json( {{string}} ) then json_extract_path_text({{string}}, {{ \"'\" ~ string_path ~ \"'\" }} ) else null end\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.213608}, "macro.fivetran_utils.bigquery__json_extract": {"unique_id": "macro.fivetran_utils.bigquery__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "bigquery__json_extract", "macro_sql": "{% macro bigquery__json_extract(string, string_path) %}\n\n json_extract_scalar({{string}}, {{ \"'$.\" ~ string_path ~ \"'\" }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.213998}, "macro.fivetran_utils.postgres__json_extract": {"unique_id": "macro.fivetran_utils.postgres__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "postgres__json_extract", "macro_sql": "{% macro postgres__json_extract(string, string_path) %}\n\n {{string}}::json->>{{\"'\" ~ string_path ~ \"'\" }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.2143612}, "macro.fivetran_utils.collect_freshness": {"unique_id": "macro.fivetran_utils.collect_freshness", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/collect_freshness.sql", "original_file_path": "macros/collect_freshness.sql", "name": "collect_freshness", "macro_sql": "{% macro collect_freshness(source, loaded_at_field, filter) %}\n {{ return(adapter.dispatch('collect_freshness')(source, loaded_at_field, filter))}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__collect_freshness"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.215748}, "macro.fivetran_utils.default__collect_freshness": {"unique_id": "macro.fivetran_utils.default__collect_freshness", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/collect_freshness.sql", "original_file_path": "macros/collect_freshness.sql", "name": "default__collect_freshness", "macro_sql": "{% macro default__collect_freshness(source, loaded_at_field, filter) %}\n {% call statement('collect_freshness', fetch_result=True, auto_begin=False) -%}\n\n {%- set enabled_array = [] -%}\n {% for node in graph.sources.values() %}\n {% if node.identifier == source.identifier %}\n {% if (node.meta['is_enabled'] | default(true)) %}\n {%- do enabled_array.append(1) -%}\n {% endif %}\n {% endif %}\n {% endfor %}\n {% set is_enabled = (enabled_array != []) %}\n\n select\n {% if is_enabled %}\n max({{ loaded_at_field }})\n {% else %} \n {{ current_timestamp() }} {% endif %} as max_loaded_at,\n {{ current_timestamp() }} as snapshotted_at\n\n {% if is_enabled %}\n from {{ source }}\n {% if filter %}\n where {{ filter }}\n {% endif %}\n {% endif %}\n\n {% endcall %}\n {{ return(load_result('collect_freshness').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.218318}, "macro.fivetran_utils.timestamp_add": {"unique_id": "macro.fivetran_utils.timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "timestamp_add", "macro_sql": "{% macro timestamp_add(datepart, interval, from_timestamp) -%}\n\n{{ adapter.dispatch('timestamp_add', 'fivetran_utils') (datepart, interval, from_timestamp) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.bigquery__timestamp_add"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.219719}, "macro.fivetran_utils.default__timestamp_add": {"unique_id": "macro.fivetran_utils.default__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "default__timestamp_add", "macro_sql": "{% macro default__timestamp_add(datepart, interval, from_timestamp) %}\n\n timestampadd(\n {{ datepart }},\n {{ interval }},\n {{ from_timestamp }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.220246}, "macro.fivetran_utils.bigquery__timestamp_add": {"unique_id": "macro.fivetran_utils.bigquery__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "bigquery__timestamp_add", "macro_sql": "{% macro bigquery__timestamp_add(datepart, interval, from_timestamp) %}\n\n timestamp_add({{ from_timestamp }}, interval {{ interval }} {{ datepart }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.220649}, "macro.fivetran_utils.redshift__timestamp_add": {"unique_id": "macro.fivetran_utils.redshift__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "redshift__timestamp_add", "macro_sql": "{% macro redshift__timestamp_add(datepart, interval, from_timestamp) %}\n\n dateadd(\n {{ datepart }},\n {{ interval }},\n {{ from_timestamp }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.2210639}, "macro.fivetran_utils.postgres__timestamp_add": {"unique_id": "macro.fivetran_utils.postgres__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "postgres__timestamp_add", "macro_sql": "{% macro postgres__timestamp_add(datepart, interval, from_timestamp) %}\n\n {{ from_timestamp }} + ((interval '1 {{ datepart }}') * ({{ interval }}))\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.221461}, "macro.fivetran_utils.spark__timestamp_add": {"unique_id": "macro.fivetran_utils.spark__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "spark__timestamp_add", "macro_sql": "{% macro spark__timestamp_add(datepart, interval, from_timestamp) %}\n\n {{ dbt_utils.dateadd(datepart, interval, from_timestamp) }}\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.22188}, "macro.fivetran_utils.ceiling": {"unique_id": "macro.fivetran_utils.ceiling", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "name": "ceiling", "macro_sql": "{% macro ceiling(num) -%}\n\n{{ adapter.dispatch('ceiling', 'fivetran_utils') (num) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__ceiling"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.222653}, "macro.fivetran_utils.default__ceiling": {"unique_id": "macro.fivetran_utils.default__ceiling", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "name": "default__ceiling", "macro_sql": "{% macro default__ceiling(num) %}\n ceiling({{ num }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.222917}, "macro.fivetran_utils.snowflake__ceiling": {"unique_id": "macro.fivetran_utils.snowflake__ceiling", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "name": "snowflake__ceiling", "macro_sql": "{% macro snowflake__ceiling(num) %}\n ceil({{ num }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.2231748}, "macro.fivetran_utils.remove_prefix_from_columns": {"unique_id": "macro.fivetran_utils.remove_prefix_from_columns", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/remove_prefix_from_columns.sql", "original_file_path": "macros/remove_prefix_from_columns.sql", "name": "remove_prefix_from_columns", "macro_sql": "{% macro remove_prefix_from_columns(columns, prefix='', exclude=[]) %}\n\n {%- for col in columns if col.name not in exclude -%}\n {%- if col.name[:prefix|length]|lower == prefix -%}\n {{ col.name }} as {{ col.name[prefix|length:] }}\n {%- else -%}\n {{ col.name }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {% endfor -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.224908}, "macro.fivetran_utils.union_data": {"unique_id": "macro.fivetran_utils.union_data", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/union_data.sql", "original_file_path": "macros/union_data.sql", "name": "union_data", "macro_sql": "{% macro union_data(table_identifier, database_variable, schema_variable, default_database, default_schema, default_variable, union_schema_variable='union_schemas', union_database_variable='union_databases') -%}\n\n{{ adapter.dispatch('union_data', 'fivetran_utils') (\n table_identifier, \n database_variable, \n schema_variable, \n default_database, \n default_schema, \n default_variable,\n union_schema_variable,\n union_database_variable\n ) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__union_data"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.227359}, "macro.fivetran_utils.default__union_data": {"unique_id": "macro.fivetran_utils.default__union_data", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/union_data.sql", "original_file_path": "macros/union_data.sql", "name": "default__union_data", "macro_sql": "{% macro default__union_data(\n table_identifier, \n database_variable, \n schema_variable, \n default_database, \n default_schema, \n default_variable,\n union_schema_variable,\n union_database_variable\n ) %}\n\n{% if var(union_schema_variable, none) %}\n\n {% set relations = [] %}\n \n {% if var(union_schema_variable) is string %}\n {% set trimmed = var(union_schema_variable)|trim('[')|trim(']') %}\n {% set schemas = trimmed.split(',')|map('trim',\" \")|map('trim','\"')|map('trim',\"'\") %}\n {% else %}\n {% set schemas = var(union_schema_variable) %}\n {% endif %}\n\n {% for schema in var(union_schema_variable) %}\n\n {% set relation=adapter.get_relation(\n database=var(database_variable, default_database),\n schema=schema,\n identifier=table_identifier\n ) -%}\n \n {% set relation_exists=relation is not none %}\n\n {% if relation_exists %}\n\n {% do relations.append(relation) %}\n \n {% endif %}\n\n {% endfor %}\n\n {{ dbt_utils.union_relations(relations) }}\n\n{% elif var(union_database_variable, none) %}\n\n {% set relations = [] %}\n\n {% for database in var(union_database_variable) %}\n\n {% set relation=adapter.get_relation(\n database=database,\n schema=var(schema_variable, default_schema),\n identifier=table_identifier\n ) -%}\n\n {% set relation_exists=relation is not none %}\n\n {% if relation_exists %}\n\n {% do relations.append(relation) %}\n \n {% endif %}\n\n {% endfor %}\n\n {{ dbt_utils.union_relations(relations) }}\n\n{% else %}\n\n select * \n from {{ var(default_variable) }}\n\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.union_relations"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.231776}, "macro.fivetran_utils.dummy_coalesce_value": {"unique_id": "macro.fivetran_utils.dummy_coalesce_value", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/dummy_coalesce_value.sql", "original_file_path": "macros/dummy_coalesce_value.sql", "name": "dummy_coalesce_value", "macro_sql": "{% macro dummy_coalesce_value(column) %}\n\n{% set coalesce_value = {\n 'STRING': \"'DUMMY_STRING'\",\n 'BOOLEAN': 'null',\n 'INT': 999999999,\n 'FLOAT': 999999999.99,\n 'TIMESTAMP': 'cast(\"2099-12-31\" as timestamp)',\n 'DATE': 'cast(\"2099-12-31\" as date)',\n} %}\n\n{% if column.is_float() %}\n{{ return(coalesce_value['FLOAT']) }}\n\n{% elif column.is_numeric() %}\n{{ return(coalesce_value['INT']) }}\n\n{% elif column.is_string() %}\n{{ return(coalesce_value['STRING']) }}\n\n{% elif column.data_type|lower == 'boolean' %}\n{{ return(coalesce_value['BOOLEAN']) }}\n\n{% elif 'timestamp' in column.data_type|lower %}\n{{ return(coalesce_value['TIMESTAMP']) }}\n\n{% elif 'date' in column.data_type|lower %}\n{{ return(coalesce_value['DATE']) }}\n\n{% elif 'int' in column.data_type|lower %}\n{{ return(coalesce_value['INT']) }}\n\n{% endif %}\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.235132}, "macro.fivetran_utils.array_agg": {"unique_id": "macro.fivetran_utils.array_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "name": "array_agg", "macro_sql": "{% macro array_agg(field_to_agg) -%}\n\n{{ adapter.dispatch('array_agg', 'fivetran_utils') (field_to_agg) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__array_agg"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.2358541}, "macro.fivetran_utils.default__array_agg": {"unique_id": "macro.fivetran_utils.default__array_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "name": "default__array_agg", "macro_sql": "{% macro default__array_agg(field_to_agg) %}\n array_agg({{ field_to_agg }})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.2361212}, "macro.fivetran_utils.redshift__array_agg": {"unique_id": "macro.fivetran_utils.redshift__array_agg", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "name": "redshift__array_agg", "macro_sql": "{% macro redshift__array_agg(field_to_agg) %}\n listagg({{ field_to_agg }}, ',')\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.236371}, "macro.fivetran_utils.empty_variable_warning": {"unique_id": "macro.fivetran_utils.empty_variable_warning", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/empty_variable_warning.sql", "original_file_path": "macros/empty_variable_warning.sql", "name": "empty_variable_warning", "macro_sql": "{% macro empty_variable_warning(variable, downstream_model) %}\n\n{% if not var(variable) %}\n{{ log(\n \"\"\"\n Warning: You have passed an empty list to the \"\"\" ~ variable ~ \"\"\".\n As a result, you won't see the history of any columns in the \"\"\" ~ downstream_model ~ \"\"\" model.\n \"\"\",\n info=True\n) }}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.23764}, "macro.fivetran_utils.enabled_vars_one_true": {"unique_id": "macro.fivetran_utils.enabled_vars_one_true", "package_name": "fivetran_utils", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/fivetran_utils", "path": "macros/enabled_vars_one_true.sql", "original_file_path": "macros/enabled_vars_one_true.sql", "name": "enabled_vars_one_true", "macro_sql": "{% macro enabled_vars_one_true(vars) %}\n\n{% for v in vars %}\n \n {% if var(v, False) == True %}\n {{ return(True) }}\n {% endif %}\n\n{% endfor %}\n\n{{ return(False) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.23872}, "macro.tiktok_ads_source.get_ad_group_history_columns": {"unique_id": "macro.tiktok_ads_source.get_ad_group_history_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_ad_group_history_columns.sql", "original_file_path": "macros/get_ad_group_history_columns.sql", "name": "get_ad_group_history_columns", "macro_sql": "{% macro get_ad_group_history_columns() %}\n\n{% set columns = [\n {\"name\": \"action_days\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"adgroup_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"adgroup_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"advertiser_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"audience_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"budget\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"category\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"display_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"frequency\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"frequency_schedule\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"gender\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"landing_page_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"updated_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"interest_category_v_2\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"action_categories\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"age\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"languages\", \"datatype\": dbt_utils.type_string()}\n\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_numeric", "macro.dbt_utils.type_string", "macro.dbt_utils.type_float", "macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.243495}, "macro.tiktok_ads_source.get_ad_group_report_hourly_columns": {"unique_id": "macro.tiktok_ads_source.get_ad_group_report_hourly_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_ad_group_report_hourly_columns.sql", "original_file_path": "macros/get_ad_group_report_hourly_columns.sql", "name": "get_ad_group_report_hourly_columns", "macro_sql": "{% macro get_ad_group_report_hourly_columns() %}\n\n{% set columns = [\n {\"name\": \"adgroup_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"average_video_play\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"average_video_play_per_user\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"clicks\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"comments\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_conversion\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cpc\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cpm\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"ctr\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"follows\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"impressions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"likes\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"profile_visits\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"reach\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"shares\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"spend\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"stat_time_hour\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"video_play_actions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_25\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_50\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_75\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_2_s\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_6_s\", \"datatype\": dbt_utils.type_numeric()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_numeric", "macro.dbt_utils.type_float", "macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.250478}, "macro.tiktok_ads_source.get_advertiser_columns": {"unique_id": "macro.tiktok_ads_source.get_advertiser_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_advertiser_columns.sql", "original_file_path": "macros/get_advertiser_columns.sql", "name": "get_advertiser_columns", "macro_sql": "{% macro get_advertiser_columns() %}\n\n{% set columns = [\n {\"name\": \"address\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"balance\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"company\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"contacter\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"country\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"currency\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"description\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"email\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"industry\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"language\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"phone_number\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"telephone\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"timezone\", \"datatype\": dbt_utils.type_string()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string", "macro.dbt_utils.type_float", "macro.dbt_utils.type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.254393}, "macro.tiktok_ads_source.get_campaign_history_columns": {"unique_id": "macro.tiktok_ads_source.get_campaign_history_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_campaign_history_columns.sql", "original_file_path": "macros/get_campaign_history_columns.sql", "name": "get_campaign_history_columns", "macro_sql": "{% macro get_campaign_history_columns() %}\n\n{% set columns = [\n {\"name\": \"advertiser_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"campaign_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"split_test_variable\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"updated_at\", \"datatype\": dbt_utils.type_timestamp()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_numeric", "macro.dbt_utils.type_string", "macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.256351}, "macro.tiktok_ads_source.get_campaign_report_hourly_columns": {"unique_id": "macro.tiktok_ads_source.get_campaign_report_hourly_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_campaign_report_hourly_columns.sql", "original_file_path": "macros/get_campaign_report_hourly_columns.sql", "name": "get_campaign_report_hourly_columns", "macro_sql": "{% macro get_campaign_report_hourly_columns() %}\n\n{% set columns = [\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"ad_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"average_video_play\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"average_video_play_per_user\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"clicks\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"comments\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_conversion\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cpc\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cpm\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"ctr\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"follows\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"impressions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"likes\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"profile_visits\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"reach\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"shares\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"spend\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"stat_time_hour\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"video_play_actions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_25\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_50\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_75\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_2_s\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_6_s\", \"datatype\": dbt_utils.type_numeric()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_numeric", "macro.dbt_utils.type_float", "macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.26294}, "macro.tiktok_ads_source.get_ad_history_columns": {"unique_id": "macro.tiktok_ads_source.get_ad_history_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_ad_history_columns.sql", "original_file_path": "macros/get_ad_history_columns.sql", "name": "get_ad_history_columns", "macro_sql": "{% macro get_ad_history_columns() %}\n\n{% set columns = [\n {\"name\": \"ad_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"ad_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"adgroup_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"advertiser_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"call_to_action\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"click_tracking_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"impression_tracking_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"landing_page_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"updated_at\", \"datatype\": dbt_utils.type_timestamp()}\n\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_numeric", "macro.dbt_utils.type_string", "macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.265891}, "macro.tiktok_ads_source.get_ad_report_hourly_columns": {"unique_id": "macro.tiktok_ads_source.get_ad_report_hourly_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/renee.li/Documents/dbt/tiktok/develop/dbt_packages/tiktok_ads_source", "path": "macros/get_ad_report_hourly_columns.sql", "original_file_path": "macros/get_ad_report_hourly_columns.sql", "name": "get_ad_report_hourly_columns", "macro_sql": "{% macro get_ad_report_hourly_columns() %}\n\n{% set columns = [\n {\"name\": \"ad_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"average_video_play\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"average_video_play_per_user\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"clicks\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"comments\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_conversion\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cpc\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cpm\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"ctr\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"follows\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"impressions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"likes\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"profile_visits\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"reach\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"shares\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"spend\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"stat_time_hour\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"video_play_actions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_25\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_50\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_75\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_2_s\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_6_s\", \"datatype\": dbt_utils.type_numeric()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_numeric", "macro.dbt_utils.type_float", "macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1659025249.272185}}, "docs": {"dbt.__overview__": {"unique_id": "dbt.__overview__", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/dbt/include/global_project", "path": "overview.md", "original_file_path": "docs/overview.md", "name": "__overview__", "block_contents": "### Welcome!\n\nWelcome to the auto-generated documentation for your dbt project!\n\n### Navigation\n\nYou can use the `Project` and `Database` navigation tabs on the left side of the window to explore the models\nin your project.\n\n#### Project Tab\nThe `Project` tab mirrors the directory structure of your dbt project. In this tab, you can see all of the\nmodels defined in your dbt project, as well as models imported from dbt packages.\n\n#### Database Tab\nThe `Database` tab also exposes your models, but in a format that looks more like a database explorer. This view\nshows relations (tables and views) grouped into database schemas. Note that ephemeral models are _not_ shown\nin this interface, as they do not exist in the database.\n\n### Graph Exploration\nYou can click the blue icon on the bottom-right corner of the page to view the lineage graph of your models.\n\nOn model pages, you'll see the immediate parents and children of the model you're exploring. By clicking the `Expand`\nbutton at the top-right of this lineage pane, you'll be able to see all of the models that are used to build,\nor are built from, the model you're exploring.\n\nOnce expanded, you'll be able to use the `--select` and `--exclude` model selection syntax to filter the\nmodels in the graph. For more information on model selection, check out the [dbt docs](https://docs.getdbt.com/docs/model-selection-syntax).\n\nNote that you can also right-click on models to interactively filter and explore the graph.\n\n---\n\n### More information\n\n- [What is dbt](https://docs.getdbt.com/docs/overview)?\n- Read the [dbt viewpoint](https://docs.getdbt.com/docs/viewpoint)\n- [Installation](https://docs.getdbt.com/docs/installation)\n- Join the [dbt Community](https://www.getdbt.com/community/) for questions and discussion"}}, "exposures": {}, "metrics": {}, "selectors": {}, "disabled": {}, "parent_map": {"model.tiktok_ads.tiktok_ads__ad_group_report": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "model.tiktok_ads.tiktok_ads__url_report": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad", "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "model.tiktok_ads.tiktok_ads__account_report": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad", "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "model.tiktok_ads.tiktok_ads__campaign_report": ["model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "model.tiktok_ads_source.stg_tiktok_ads__advertiser", "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"], "model.tiktok_ads.tiktok_ads__ad_report": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad", "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "model.tiktok_ads.int_tiktok_ads__most_recent_campaign": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"], "model.tiktok_ads.int_tiktok_ads__most_recent_ad": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"], "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__advertiser": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp", "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__ad_history": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_history": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp": ["source.tiktok_ads_source.tiktok_ads.ad_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp": ["source.tiktok_ads_source.tiktok_ads.ad_history"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp": ["source.tiktok_ads_source.tiktok_ads.adgroup_history"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp": ["source.tiktok_ads_source.tiktok_ads.campaign_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp": ["source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp": ["source.tiktok_ads_source.tiktok_ads.campaign_history"], "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp": ["source.tiktok_ads_source.tiktok_ads.advertiser"], "test.tiktok_ads.not_null_tiktok_ads__account_report_date_day.5a77812746": ["model.tiktok_ads.tiktok_ads__account_report"], "test.tiktok_ads.not_null_tiktok_ads__account_report_advertiser_id.bbeabada6f": ["model.tiktok_ads.tiktok_ads__account_report"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__account_report_advertiser_id__date_day.7b27a2f43b": ["model.tiktok_ads.tiktok_ads__account_report"], "test.tiktok_ads.not_null_tiktok_ads__ad_report_date_day.d61ee4a5ed": ["model.tiktok_ads.tiktok_ads__ad_report"], "test.tiktok_ads.not_null_tiktok_ads__ad_report_ad_id.2d8166e707": ["model.tiktok_ads.tiktok_ads__ad_report"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_report_ad_id__date_day.15357fac89": ["model.tiktok_ads.tiktok_ads__ad_report"], "test.tiktok_ads.not_null_tiktok_ads__ad_group_report_date_day.e39164964e": ["model.tiktok_ads.tiktok_ads__ad_group_report"], "test.tiktok_ads.not_null_tiktok_ads__ad_group_report_ad_group_id.17fb8710f4": ["model.tiktok_ads.tiktok_ads__ad_group_report"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day.2eb4c2ff6d": ["model.tiktok_ads.tiktok_ads__ad_group_report"], "test.tiktok_ads.not_null_tiktok_ads__campaign_report_date_day.3807b0e836": ["model.tiktok_ads.tiktok_ads__campaign_report"], "test.tiktok_ads.not_null_tiktok_ads__campaign_report_campaign_id.8a2b0c8ef8": ["model.tiktok_ads.tiktok_ads__campaign_report"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day.cc5f756c69": ["model.tiktok_ads.tiktok_ads__campaign_report"], "test.tiktok_ads.not_null_tiktok_ads__url_report_date_day.d593573eff": ["model.tiktok_ads.tiktok_ads__url_report"], "test.tiktok_ads.not_null_tiktok_ads__url_report_ad_id.6c41067bd0": ["model.tiktok_ads.tiktok_ads__url_report"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__url_report_ad_id__date_day.8b73e512af": ["model.tiktok_ads.tiktok_ads__url_report"], "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.fcb8c561bc": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad_group"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at.e2e9914076": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad_group"], "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_ad_id.14e9c145ca": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at.f58d824f65": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad"], "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_campaign_campaign_id.8cefa8981c": ["model.tiktok_ads.int_tiktok_ads__most_recent_campaign"], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at.39077adf71": ["model.tiktok_ads.int_tiktok_ads__most_recent_campaign"], "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_ad_id.ee84d783ed": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour.9e2a2dca81": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour.ca4b495127": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour.e75e13184c": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"], "source.tiktok_ads_source.tiktok_ads.advertiser": [], "source.tiktok_ads_source.tiktok_ads.campaign_history": [], "source.tiktok_ads_source.tiktok_ads.adgroup_history": [], "source.tiktok_ads_source.tiktok_ads.ad_history": [], "source.tiktok_ads_source.tiktok_ads.ad_report_hourly": [], "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly": [], "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly": []}, "child_map": {"model.tiktok_ads.tiktok_ads__ad_group_report": ["test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day.2eb4c2ff6d", "test.tiktok_ads.not_null_tiktok_ads__ad_group_report_ad_group_id.17fb8710f4", "test.tiktok_ads.not_null_tiktok_ads__ad_group_report_date_day.e39164964e"], "model.tiktok_ads.tiktok_ads__url_report": ["test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__url_report_ad_id__date_day.8b73e512af", "test.tiktok_ads.not_null_tiktok_ads__url_report_ad_id.6c41067bd0", "test.tiktok_ads.not_null_tiktok_ads__url_report_date_day.d593573eff"], "model.tiktok_ads.tiktok_ads__account_report": ["test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__account_report_advertiser_id__date_day.7b27a2f43b", "test.tiktok_ads.not_null_tiktok_ads__account_report_advertiser_id.bbeabada6f", "test.tiktok_ads.not_null_tiktok_ads__account_report_date_day.5a77812746"], "model.tiktok_ads.tiktok_ads__campaign_report": ["test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day.cc5f756c69", "test.tiktok_ads.not_null_tiktok_ads__campaign_report_campaign_id.8a2b0c8ef8", "test.tiktok_ads.not_null_tiktok_ads__campaign_report_date_day.3807b0e836"], "model.tiktok_ads.tiktok_ads__ad_report": ["test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_report_ad_id__date_day.15357fac89", "test.tiktok_ads.not_null_tiktok_ads__ad_report_ad_id.2d8166e707", "test.tiktok_ads.not_null_tiktok_ads__ad_report_date_day.d61ee4a5ed"], "model.tiktok_ads.int_tiktok_ads__most_recent_campaign": ["model.tiktok_ads.tiktok_ads__ad_group_report", "model.tiktok_ads.tiktok_ads__ad_report", "model.tiktok_ads.tiktok_ads__campaign_report", "model.tiktok_ads.tiktok_ads__url_report", "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at.39077adf71", "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_campaign_campaign_id.8cefa8981c"], "model.tiktok_ads.int_tiktok_ads__most_recent_ad": ["model.tiktok_ads.tiktok_ads__account_report", "model.tiktok_ads.tiktok_ads__ad_report", "model.tiktok_ads.tiktok_ads__url_report", "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at.f58d824f65", "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_ad_id.14e9c145ca"], "model.tiktok_ads.int_tiktok_ads__most_recent_ad_group": ["model.tiktok_ads.tiktok_ads__ad_group_report", "model.tiktok_ads.tiktok_ads__ad_report", "model.tiktok_ads.tiktok_ads__url_report", "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at.e2e9914076", "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.fcb8c561bc"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly": ["model.tiktok_ads.tiktok_ads__campaign_report", "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34", "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb", "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour.e75e13184c"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly": ["model.tiktok_ads.tiktok_ads__ad_group_report", "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad", "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1", "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour.ca4b495127"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad_group", "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de", "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad"], "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly": ["model.tiktok_ads.tiktok_ads__account_report", "model.tiktok_ads.tiktok_ads__ad_report", "model.tiktok_ads.tiktok_ads__url_report", "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d", "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_ad_id.ee84d783ed", "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour.9e2a2dca81"], "model.tiktok_ads_source.stg_tiktok_ads__advertiser": ["model.tiktok_ads.tiktok_ads__account_report", "model.tiktok_ads.tiktok_ads__ad_group_report", "model.tiktok_ads.tiktok_ads__ad_report", "model.tiktok_ads.tiktok_ads__campaign_report", "model.tiktok_ads.tiktok_ads__url_report", "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def", "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66"], "model.tiktok_ads_source.stg_tiktok_ads__ad_history": ["model.tiktok_ads.int_tiktok_ads__most_recent_ad", "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1", "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_history": ["model.tiktok_ads.int_tiktok_ads__most_recent_campaign", "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b", "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1"], "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history", "model.tiktok_ads_source.stg_tiktok_ads__ad_history"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history", "model.tiktok_ads_source.stg_tiktok_ads__campaign_history"], "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser", "model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "test.tiktok_ads.not_null_tiktok_ads__account_report_date_day.5a77812746": [], "test.tiktok_ads.not_null_tiktok_ads__account_report_advertiser_id.bbeabada6f": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__account_report_advertiser_id__date_day.7b27a2f43b": [], "test.tiktok_ads.not_null_tiktok_ads__ad_report_date_day.d61ee4a5ed": [], "test.tiktok_ads.not_null_tiktok_ads__ad_report_ad_id.2d8166e707": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_report_ad_id__date_day.15357fac89": [], "test.tiktok_ads.not_null_tiktok_ads__ad_group_report_date_day.e39164964e": [], "test.tiktok_ads.not_null_tiktok_ads__ad_group_report_ad_group_id.17fb8710f4": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day.2eb4c2ff6d": [], "test.tiktok_ads.not_null_tiktok_ads__campaign_report_date_day.3807b0e836": [], "test.tiktok_ads.not_null_tiktok_ads__campaign_report_campaign_id.8a2b0c8ef8": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day.cc5f756c69": [], "test.tiktok_ads.not_null_tiktok_ads__url_report_date_day.d593573eff": [], "test.tiktok_ads.not_null_tiktok_ads__url_report_ad_id.6c41067bd0": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__url_report_ad_id__date_day.8b73e512af": [], "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.fcb8c561bc": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at.e2e9914076": [], "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_ad_id.14e9c145ca": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at.f58d824f65": [], "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_campaign_campaign_id.8cefa8981c": [], "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at.39077adf71": [], "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_ad_id.ee84d783ed": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour.9e2a2dca81": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour.ca4b495127": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour.e75e13184c": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34": [], "source.tiktok_ads_source.tiktok_ads.advertiser": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp"], "source.tiktok_ads_source.tiktok_ads.campaign_history": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp"], "source.tiktok_ads_source.tiktok_ads.adgroup_history": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp"], "source.tiktok_ads_source.tiktok_ads.ad_history": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp"], "source.tiktok_ads_source.tiktok_ads.ad_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp"], "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp"], "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp"]}} \ No newline at end of file +{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v4.json", "dbt_version": "1.0.4", "generated_at": "2022-08-26T20:02:11.120390Z", "invocation_id": "9fdbca68-4741-4af7-99ac-be7d5e1618c0", "env": {}, "project_id": "1569d852c0a4744484a39557ad94feef", "user_id": "8929baf0-9bc1-477e-9a57-eb8b0db4da62", "send_anonymous_usage_stats": true, "adapter_type": "postgres"}, "nodes": {"seed.tiktok_ads_source_integration_tests.tiktok_ad_history_data": {"raw_sql": "", "compiled": true, "resource_type": "seed", "depends_on": {"macros": [], "nodes": []}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "materialized": "seed", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "quote_columns": false, "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1", "fqn": ["tiktok_ads_source_integration_tests", "tiktok_ad_history_data"], "unique_id": "seed.tiktok_ads_source_integration_tests.tiktok_ad_history_data", "package_name": "tiktok_ads_source_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests", "path": "tiktok_ad_history_data.csv", "original_file_path": "seeds/tiktok_ad_history_data.csv", "name": "tiktok_ad_history_data", "alias": "tiktok_ad_history_data", "checksum": {"name": "sha256", "checksum": "a23cb08122e58b4b6b75a79b8aaec8018ddb0fa2c2091b3755b92ddf12871abf"}, "tags": [], "refs": [], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"quote_columns": "{{ true if target.type == 'redshift' else false }}"}, "created_at": 1661544121.8387089, "compiled_sql": "", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"tiktok_ads_source_integration_tests_1\".\"tiktok_ad_history_data\""}, "seed.tiktok_ads_source_integration_tests.tiktok_adgroup_report_hourly_data": {"raw_sql": "", "compiled": true, "resource_type": "seed", "depends_on": {"macros": [], "nodes": []}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "materialized": "seed", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "quote_columns": false, "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1", "fqn": ["tiktok_ads_source_integration_tests", "tiktok_adgroup_report_hourly_data"], "unique_id": "seed.tiktok_ads_source_integration_tests.tiktok_adgroup_report_hourly_data", "package_name": "tiktok_ads_source_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests", "path": "tiktok_adgroup_report_hourly_data.csv", "original_file_path": "seeds/tiktok_adgroup_report_hourly_data.csv", "name": "tiktok_adgroup_report_hourly_data", "alias": "tiktok_adgroup_report_hourly_data", "checksum": {"name": "sha256", "checksum": "c86e47500a8c2bd232e46ba2bd55582f97b17193366c430ff22e55f557ffa5e0"}, "tags": [], "refs": [], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"quote_columns": "{{ true if target.type == 'redshift' else false }}"}, "created_at": 1661544121.84461, "compiled_sql": "", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"tiktok_ads_source_integration_tests_1\".\"tiktok_adgroup_report_hourly_data\""}, "seed.tiktok_ads_source_integration_tests.tiktok_campaign_history_data": {"raw_sql": "", "compiled": true, "resource_type": "seed", "depends_on": {"macros": [], "nodes": []}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "materialized": "seed", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "quote_columns": false, "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1", "fqn": ["tiktok_ads_source_integration_tests", "tiktok_campaign_history_data"], "unique_id": "seed.tiktok_ads_source_integration_tests.tiktok_campaign_history_data", "package_name": "tiktok_ads_source_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests", "path": "tiktok_campaign_history_data.csv", "original_file_path": "seeds/tiktok_campaign_history_data.csv", "name": "tiktok_campaign_history_data", "alias": "tiktok_campaign_history_data", "checksum": {"name": "sha256", "checksum": "17b993557179ddbe2864473f23bd7eafd8cae8b87833789478bf0ec162212a4a"}, "tags": [], "refs": [], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"quote_columns": "{{ true if target.type == 'redshift' else false }}"}, "created_at": 1661544121.845644, "compiled_sql": "", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"tiktok_ads_source_integration_tests_1\".\"tiktok_campaign_history_data\""}, "seed.tiktok_ads_source_integration_tests.tiktok_advertiser_data": {"raw_sql": "", "compiled": true, "resource_type": "seed", "depends_on": {"macros": [], "nodes": []}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "materialized": "seed", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "quote_columns": false, "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1", "fqn": ["tiktok_ads_source_integration_tests", "tiktok_advertiser_data"], "unique_id": "seed.tiktok_ads_source_integration_tests.tiktok_advertiser_data", "package_name": "tiktok_ads_source_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests", "path": "tiktok_advertiser_data.csv", "original_file_path": "seeds/tiktok_advertiser_data.csv", "name": "tiktok_advertiser_data", "alias": "tiktok_advertiser_data", "checksum": {"name": "sha256", "checksum": "c9469d87d4c4e87caafdefdbd438d6198d07b8bcab1c76d1c4dc155da2a297b3"}, "tags": [], "refs": [], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"quote_columns": "{{ true if target.type == 'redshift' else false }}"}, "created_at": 1661544121.846598, "compiled_sql": "", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"tiktok_ads_source_integration_tests_1\".\"tiktok_advertiser_data\""}, "seed.tiktok_ads_source_integration_tests.tiktok_ad_report_hourly_data": {"raw_sql": "", "compiled": true, "resource_type": "seed", "depends_on": {"macros": [], "nodes": []}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "materialized": "seed", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "quote_columns": false, "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1", "fqn": ["tiktok_ads_source_integration_tests", "tiktok_ad_report_hourly_data"], "unique_id": "seed.tiktok_ads_source_integration_tests.tiktok_ad_report_hourly_data", "package_name": "tiktok_ads_source_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests", "path": "tiktok_ad_report_hourly_data.csv", "original_file_path": "seeds/tiktok_ad_report_hourly_data.csv", "name": "tiktok_ad_report_hourly_data", "alias": "tiktok_ad_report_hourly_data", "checksum": {"name": "sha256", "checksum": "2516b0b613f1bf3b57ca99e58b95dff99d8addab29406308800372337fa9b629"}, "tags": [], "refs": [], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"quote_columns": "{{ true if target.type == 'redshift' else false }}"}, "created_at": 1661544121.847664, "compiled_sql": "", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"tiktok_ads_source_integration_tests_1\".\"tiktok_ad_report_hourly_data\""}, "seed.tiktok_ads_source_integration_tests.tiktok_campaign_report_hourly_data": {"raw_sql": "", "compiled": true, "resource_type": "seed", "depends_on": {"macros": [], "nodes": []}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "materialized": "seed", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "quote_columns": false, "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1", "fqn": ["tiktok_ads_source_integration_tests", "tiktok_campaign_report_hourly_data"], "unique_id": "seed.tiktok_ads_source_integration_tests.tiktok_campaign_report_hourly_data", "package_name": "tiktok_ads_source_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests", "path": "tiktok_campaign_report_hourly_data.csv", "original_file_path": "seeds/tiktok_campaign_report_hourly_data.csv", "name": "tiktok_campaign_report_hourly_data", "alias": "tiktok_campaign_report_hourly_data", "checksum": {"name": "sha256", "checksum": "01927965b607137c0da80efde5d724a2659046ec9c77d8bbe41245eba08630d3"}, "tags": [], "refs": [], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"quote_columns": "{{ true if target.type == 'redshift' else false }}"}, "created_at": 1661544121.848583, "compiled_sql": "", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"tiktok_ads_source_integration_tests_1\".\"tiktok_campaign_report_hourly_data\""}, "seed.tiktok_ads_source_integration_tests.tiktok_adgroup_history_data": {"raw_sql": "", "compiled": true, "resource_type": "seed", "depends_on": {"macros": [], "nodes": []}, "config": {"enabled": true, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "materialized": "seed", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "quote_columns": false, "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1", "fqn": ["tiktok_ads_source_integration_tests", "tiktok_adgroup_history_data"], "unique_id": "seed.tiktok_ads_source_integration_tests.tiktok_adgroup_history_data", "package_name": "tiktok_ads_source_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests", "path": "tiktok_adgroup_history_data.csv", "original_file_path": "seeds/tiktok_adgroup_history_data.csv", "name": "tiktok_adgroup_history_data", "alias": "tiktok_adgroup_history_data", "checksum": {"name": "sha256", "checksum": "d72ca48dd6be2e96faf07d3d03415510691da2a8cca69f7b8a8bb543c04100a5"}, "tags": [], "refs": [], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"quote_columns": "{{ true if target.type == 'redshift' else false }}"}, "created_at": 1661544121.849698, "compiled_sql": "", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"tiktok_ads_source_integration_tests_1\".\"tiktok_adgroup_history_data\""}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly": {"raw_sql": "{{ config(enabled=var('ad_reporting__tiktok_ads_enabled', true)) }}\n\nwith base as (\n\n select *\n from {{ ref('stg_tiktok_ads__campaign_report_hourly_tmp') }}\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__campaign_report_hourly_tmp')),\n staging_columns=get_campaign_report_hourly_columns()\n )\n }}\n from base\n), \n\nfinal as (\n\n select \n campaign_id,\n cast(stat_time_hour as {{ dbt_utils.type_timestamp() }}) as stat_time_hour,\n cpc, \n cpm,\n ctr,\n impressions,\n clicks,\n spend,\n reach,\n conversion,\n cost_per_conversion,\n conversion_rate,\n likes,\n comments,\n shares,\n profile_visits,\n follows,\n video_play_actions,\n video_watched_2_s,\n video_watched_6_s,\n video_views_p_25,\n video_views_p_50,\n video_views_p_75,\n average_video_play,\n average_video_play_per_user\n\n {{ fivetran_utils.fill_pass_through_columns('tiktok_ads__campaign_hourly_passthrough_metrics') }}\n \n from fields\n)\n\nselect *\nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_campaign_report_hourly_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp", "macro.fivetran_utils.fill_pass_through_columns"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__campaign_report_hourly"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__campaign_report_hourly.sql", "original_file_path": "models/stg_tiktok_ads__campaign_report_hourly.sql", "name": "stg_tiktok_ads__campaign_report_hourly", "alias": "stg_tiktok_ads__campaign_report_hourly", "checksum": {"name": "sha256", "checksum": "2c2bc92ccb26a7f8380b5b2e5215b7c52e10b3ca4937629549065874793b2293"}, "tags": [], "refs": [["stg_tiktok_ads__campaign_report_hourly_tmp"], ["stg_tiktok_ads__campaign_report_hourly_tmp"]], "sources": [], "description": "Each record represent data for each campaign for each hour.", "columns": {"campaign_id": {"name": "campaign_id", "description": "Campaign id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time per user your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__campaign_report_hourly.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads", "enabled": true}, "created_at": 1661544122.091248, "compiled_sql": "\n\nwith base as (\n\n select *\n from \"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__campaign_report_hourly_tmp\"\n), \n\nfields as (\n\n select\n \n \n \n campaign_id\n \n as \n \n campaign_id\n \n, \n \n \n average_video_play\n \n as \n \n average_video_play\n \n, \n \n \n average_video_play_per_user\n \n as \n \n average_video_play_per_user\n \n, \n \n \n clicks\n \n as \n \n clicks\n \n, \n \n \n comments\n \n as \n \n comments\n \n, \n \n \n conversion\n \n as \n \n conversion\n \n, \n \n \n conversion_rate\n \n as \n \n conversion_rate\n \n, \n \n \n cost_per_conversion\n \n as \n \n cost_per_conversion\n \n, \n \n \n cpc\n \n as \n \n cpc\n \n, \n \n \n cpm\n \n as \n \n cpm\n \n, \n \n \n ctr\n \n as \n \n ctr\n \n, \n \n \n follows\n \n as \n \n follows\n \n, \n \n \n impressions\n \n as \n \n impressions\n \n, \n \n \n likes\n \n as \n \n likes\n \n, \n \n \n profile_visits\n \n as \n \n profile_visits\n \n, \n \n \n reach\n \n as \n \n reach\n \n, \n \n \n shares\n \n as \n \n shares\n \n, \n \n \n spend\n \n as \n \n spend\n \n, \n \n \n stat_time_hour\n \n as \n \n stat_time_hour\n \n, \n \n \n video_play_actions\n \n as \n \n video_play_actions\n \n, \n \n \n video_views_p_25\n \n as \n \n video_views_p_25\n \n, \n \n \n video_views_p_50\n \n as \n \n video_views_p_50\n \n, \n \n \n video_views_p_75\n \n as \n \n video_views_p_75\n \n, \n \n \n video_watched_2_s\n \n as \n \n video_watched_2_s\n \n, \n \n \n video_watched_6_s\n \n as \n \n video_watched_6_s\n \n\n\n\n from base\n), \n\nfinal as (\n\n select \n campaign_id,\n cast(stat_time_hour as \n timestamp without time zone\n) as stat_time_hour,\n cpc, \n cpm,\n ctr,\n impressions,\n clicks,\n spend,\n reach,\n conversion,\n cost_per_conversion,\n conversion_rate,\n likes,\n comments,\n shares,\n profile_visits,\n follows,\n video_play_actions,\n video_watched_2_s,\n video_watched_6_s,\n video_views_p_25,\n video_views_p_50,\n video_views_p_75,\n average_video_play,\n average_video_play_per_user\n\n \n\n\n\n\n \n from fields\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__campaign_report_hourly\""}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly": {"raw_sql": "{{ config(enabled=var('ad_reporting__tiktok_ads_enabled', true)) }}\n\nwith base as (\n\n select *\n from {{ ref('stg_tiktok_ads__ad_group_report_hourly_tmp') }}\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__ad_group_report_hourly_tmp')),\n staging_columns=get_ad_group_report_hourly_columns()\n )\n }}\n from base\n), \n\nfinal as (\n\n select \n adgroup_id as ad_group_id,\n cast(stat_time_hour as {{ dbt_utils.type_timestamp() }}) as stat_time_hour, \n cpc, \n cpm, \n ctr, \n impressions, \n clicks, \n spend, \n reach, \n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n\n {{ fivetran_utils.fill_pass_through_columns('tiktok_ads__ad_group_hourly_passthrough_metrics') }}\n\n from fields\n) \n\nselect *\nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_ad_group_report_hourly_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp", "macro.fivetran_utils.fill_pass_through_columns"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__ad_group_report_hourly"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__ad_group_report_hourly.sql", "original_file_path": "models/stg_tiktok_ads__ad_group_report_hourly.sql", "name": "stg_tiktok_ads__ad_group_report_hourly", "alias": "stg_tiktok_ads__ad_group_report_hourly", "checksum": {"name": "sha256", "checksum": "5d0c1cb8954787126a2141c59e4c8b849fe3c13112073fef2b08c553df4d5ad5"}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_report_hourly_tmp"], ["stg_tiktok_ads__ad_group_report_hourly_tmp"]], "sources": [], "description": "Each record represents data for each ad group for each hour.", "columns": {"ad_group_id": {"name": "ad_group_id", "description": "Ad group id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time per user your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__ad_group_report_hourly.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads", "enabled": true}, "created_at": 1661544122.0872152, "compiled_sql": "\n\nwith base as (\n\n select *\n from \"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__ad_group_report_hourly_tmp\"\n), \n\nfields as (\n\n select\n \n \n \n adgroup_id\n \n as \n \n adgroup_id\n \n, \n \n \n average_video_play\n \n as \n \n average_video_play\n \n, \n \n \n average_video_play_per_user\n \n as \n \n average_video_play_per_user\n \n, \n \n \n clicks\n \n as \n \n clicks\n \n, \n \n \n comments\n \n as \n \n comments\n \n, \n \n \n conversion\n \n as \n \n conversion\n \n, \n \n \n conversion_rate\n \n as \n \n conversion_rate\n \n, \n \n \n cost_per_conversion\n \n as \n \n cost_per_conversion\n \n, \n \n \n cpc\n \n as \n \n cpc\n \n, \n \n \n cpm\n \n as \n \n cpm\n \n, \n \n \n ctr\n \n as \n \n ctr\n \n, \n \n \n follows\n \n as \n \n follows\n \n, \n \n \n impressions\n \n as \n \n impressions\n \n, \n \n \n likes\n \n as \n \n likes\n \n, \n \n \n profile_visits\n \n as \n \n profile_visits\n \n, \n \n \n reach\n \n as \n \n reach\n \n, \n \n \n shares\n \n as \n \n shares\n \n, \n \n \n spend\n \n as \n \n spend\n \n, \n \n \n stat_time_hour\n \n as \n \n stat_time_hour\n \n, \n \n \n video_play_actions\n \n as \n \n video_play_actions\n \n, \n \n \n video_views_p_25\n \n as \n \n video_views_p_25\n \n, \n \n \n video_views_p_50\n \n as \n \n video_views_p_50\n \n, \n \n \n video_views_p_75\n \n as \n \n video_views_p_75\n \n, \n \n \n video_watched_2_s\n \n as \n \n video_watched_2_s\n \n, \n \n \n video_watched_6_s\n \n as \n \n video_watched_6_s\n \n\n\n\n from base\n), \n\nfinal as (\n\n select \n adgroup_id as ad_group_id,\n cast(stat_time_hour as \n timestamp without time zone\n) as stat_time_hour, \n cpc, \n cpm, \n ctr, \n impressions, \n clicks, \n spend, \n reach, \n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n\n \n\n\n\n\n\n from fields\n) \n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__ad_group_report_hourly\""}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history": {"raw_sql": "{{ config(enabled=var('ad_reporting__tiktok_ads_enabled', true)) }}\n\nwith base as (\n\n select *\n from {{ ref('stg_tiktok_ads__ad_group_history_tmp') }}\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__ad_group_history_tmp')),\n staging_columns=get_ad_group_history_columns()\n )\n }}\n\n from base\n), \n\nfinal as (\n\n select\n adgroup_id as ad_group_id,\n cast(updated_at as {{ dbt_utils.type_timestamp() }}) as updated_at,\n advertiser_id,\n campaign_id,\n action_days,\n action_categories,\n adgroup_name as ad_group_name,\n age,\n audience_type,\n budget,\n category,\n display_name,\n interest_category_v_2 as interest_category,\n frequency,\n frequency_schedule,\n gender,\n languages, \n landing_page_url,\n row_number() over (partition by adgroup_id order by updated_at desc) = 1 as is_most_recent_record\n from fields\n)\n\nselect * \nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_ad_group_history_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__ad_group_history"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__ad_group_history.sql", "original_file_path": "models/stg_tiktok_ads__ad_group_history.sql", "name": "stg_tiktok_ads__ad_group_history", "alias": "stg_tiktok_ads__ad_group_history", "checksum": {"name": "sha256", "checksum": "6f17a6500d8cf7d6eecca042fe00b62ad408285f7716b933ffb34bdf41daf60b"}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_history_tmp"], ["stg_tiktok_ads__ad_group_history_tmp"]], "sources": [], "description": "Each record represents data for each ad group.", "columns": {"ad_group_id": {"name": "ad_group_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_categories": {"name": "action_categories", "description": "IDs of the action categories (behaviors) that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The Ad group's campaign ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_days": {"name": "action_days", "description": "Action days", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_name": {"name": "ad_group_name", "description": "Ad group name. Character limit is 512 and cannot contain emoji.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "age": {"name": "age", "description": "Age groups you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience_type": {"name": "audience_type", "description": "Audience Type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget": {"name": "budget", "description": "Ad budget. Returns 0.0 when Campaign Budget Optimization (budget_optimize_switch) is on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "category": {"name": "category", "description": "Ad group category.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "display_name": {"name": "display_name", "description": "Display name of ad group.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "interest_category": {"name": "interest_category", "description": "Interest classification. If the interest is specified, users that do not meet interest target will be excluded during delivery.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency": {"name": "frequency", "description": "frequency, together with frequency_schedule, controls how often people see your ad (only available for REACH ads). For example, frequency = 2 frequency_schedule = 3 means \"show ads no more than twice every 3 day\".\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency_schedule": {"name": "frequency_schedule", "description": "frequency, together with frequency, controls how often people see your ad (only available for REACH ads).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "languages": {"name": "languages", "description": "Codes of the languages that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__ad_group_history.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads", "enabled": true}, "created_at": 1661544122.074492, "compiled_sql": "\n\nwith base as (\n\n select *\n from \"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__ad_group_history_tmp\"\n), \n\nfields as (\n\n select\n \n \n \n action_days\n \n as \n \n action_days\n \n, \n \n \n adgroup_id\n \n as \n \n adgroup_id\n \n, \n \n \n adgroup_name\n \n as \n \n adgroup_name\n \n, \n \n \n advertiser_id\n \n as \n \n advertiser_id\n \n, \n \n \n audience_type\n \n as \n \n audience_type\n \n, \n \n \n budget\n \n as \n \n budget\n \n, \n \n \n campaign_id\n \n as \n \n campaign_id\n \n, \n \n \n category\n \n as \n \n category\n \n, \n \n \n display_name\n \n as \n \n display_name\n \n, \n \n \n frequency\n \n as \n \n frequency\n \n, \n \n \n frequency_schedule\n \n as \n \n frequency_schedule\n \n, \n \n \n gender\n \n as \n \n gender\n \n, \n \n \n landing_page_url\n \n as \n \n landing_page_url\n \n, \n \n \n updated_at\n \n as \n \n updated_at\n \n, \n \n \n interest_category_v_2\n \n as \n \n interest_category_v_2\n \n, \n \n \n action_categories\n \n as \n \n action_categories\n \n, \n \n \n age\n \n as \n \n age\n \n, \n \n \n languages\n \n as \n \n languages\n \n\n\n\n\n from base\n), \n\nfinal as (\n\n select\n adgroup_id as ad_group_id,\n cast(updated_at as \n timestamp without time zone\n) as updated_at,\n advertiser_id,\n campaign_id,\n action_days,\n action_categories,\n adgroup_name as ad_group_name,\n age,\n audience_type,\n budget,\n category,\n display_name,\n interest_category_v_2 as interest_category,\n frequency,\n frequency_schedule,\n gender,\n languages, \n landing_page_url,\n row_number() over (partition by adgroup_id order by updated_at desc) = 1 as is_most_recent_record\n from fields\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__ad_group_history\""}, "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly": {"raw_sql": "{{ config(enabled=var('ad_reporting__tiktok_ads_enabled', true)) }}\n\nwith base as (\n\n select *\n from {{ ref('stg_tiktok_ads__ad_report_hourly_tmp') }}\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__ad_report_hourly_tmp')),\n staging_columns=get_ad_report_hourly_columns()\n )\n }}\n from base\n), \n\nfinal as (\n\n select \n ad_id, \n cast(stat_time_hour as {{ dbt_utils.type_timestamp() }}) as stat_time_hour, \n cpc, \n cpm, \n ctr, \n impressions, \n clicks, \n spend, \n reach, \n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n\n {{ fivetran_utils.fill_pass_through_columns('tiktok_ads__ad_hourly_passthrough_metrics') }}\n from fields\n)\n\nselect * \nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_ad_report_hourly_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp", "macro.fivetran_utils.fill_pass_through_columns"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__ad_report_hourly"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__ad_report_hourly.sql", "original_file_path": "models/stg_tiktok_ads__ad_report_hourly.sql", "name": "stg_tiktok_ads__ad_report_hourly", "alias": "stg_tiktok_ads__ad_report_hourly", "checksum": {"name": "sha256", "checksum": "1f2059be82b502ed2cecb9c75baba870edffc38b0da6eb933fbf28dffaf10a7a"}, "tags": [], "refs": [["stg_tiktok_ads__ad_report_hourly_tmp"], ["stg_tiktok_ads__ad_report_hourly_tmp"]], "sources": [], "description": "Each record represents data for each ad for each hour.", "columns": {"ad_id": {"name": "ad_id", "description": "Ad id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time per user your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__ad_report_hourly.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads", "enabled": true}, "created_at": 1661544122.082569, "compiled_sql": "\n\nwith base as (\n\n select *\n from \"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__ad_report_hourly_tmp\"\n), \n\nfields as (\n\n select\n \n \n \n ad_id\n \n as \n \n ad_id\n \n, \n \n \n average_video_play\n \n as \n \n average_video_play\n \n, \n \n \n average_video_play_per_user\n \n as \n \n average_video_play_per_user\n \n, \n \n \n clicks\n \n as \n \n clicks\n \n, \n \n \n comments\n \n as \n \n comments\n \n, \n \n \n conversion\n \n as \n \n conversion\n \n, \n \n \n conversion_rate\n \n as \n \n conversion_rate\n \n, \n \n \n cost_per_conversion\n \n as \n \n cost_per_conversion\n \n, \n \n \n cpc\n \n as \n \n cpc\n \n, \n \n \n cpm\n \n as \n \n cpm\n \n, \n \n \n ctr\n \n as \n \n ctr\n \n, \n \n \n follows\n \n as \n \n follows\n \n, \n \n \n impressions\n \n as \n \n impressions\n \n, \n \n \n likes\n \n as \n \n likes\n \n, \n \n \n profile_visits\n \n as \n \n profile_visits\n \n, \n \n \n reach\n \n as \n \n reach\n \n, \n \n \n shares\n \n as \n \n shares\n \n, \n \n \n spend\n \n as \n \n spend\n \n, \n \n \n stat_time_hour\n \n as \n \n stat_time_hour\n \n, \n \n \n video_play_actions\n \n as \n \n video_play_actions\n \n, \n \n \n video_views_p_25\n \n as \n \n video_views_p_25\n \n, \n \n \n video_views_p_50\n \n as \n \n video_views_p_50\n \n, \n \n \n video_views_p_75\n \n as \n \n video_views_p_75\n \n, \n \n \n video_watched_2_s\n \n as \n \n video_watched_2_s\n \n, \n \n \n video_watched_6_s\n \n as \n \n video_watched_6_s\n \n\n\n\n from base\n), \n\nfinal as (\n\n select \n ad_id, \n cast(stat_time_hour as \n timestamp without time zone\n) as stat_time_hour, \n cpc, \n cpm, \n ctr, \n impressions, \n clicks, \n spend, \n reach, \n conversion, \n cost_per_conversion, \n conversion_rate, \n likes, \n comments, \n shares, \n profile_visits,\n follows, \n video_play_actions, \n video_watched_2_s, \n video_watched_6_s, \n video_views_p_25, \n video_views_p_50,\n video_views_p_75, \n average_video_play, \n average_video_play_per_user\n\n \n\n\n\n\n from fields\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__ad_report_hourly\""}, "model.tiktok_ads_source.stg_tiktok_ads__advertiser": {"raw_sql": "{{ config(enabled=var('ad_reporting__tiktok_ads_enabled', true)) }}\n\nwith base as (\n\n select *\n from {{ ref('stg_tiktok_ads__advertiser_tmp') }}\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__advertiser_tmp')),\n staging_columns=get_advertiser_columns()\n )\n }}\n\n from base\n),\n\nfinal as (\n\n select \n id as advertiser_id, \n address, \n balance, \n company, \n contacter, \n country, \n currency, \n description, \n email, \n industry, \n language,\n name as advertiser_name, \n phone_number, \n telephone, \n timezone\n from fields\n)\n\nselect *\nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_advertiser_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp", "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__advertiser"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__advertiser.sql", "original_file_path": "models/stg_tiktok_ads__advertiser.sql", "name": "stg_tiktok_ads__advertiser", "alias": "stg_tiktok_ads__advertiser", "checksum": {"name": "sha256", "checksum": "759a97a786242ecdb350f1852e0861bbeae8218dc19a4047fee98c96ea0ba8be"}, "tags": [], "refs": [["stg_tiktok_ads__advertiser_tmp"], ["stg_tiktok_ads__advertiser_tmp"]], "sources": [], "description": "Each record represents data for each advertiser.", "columns": {"advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "address": {"name": "address", "description": "Advertiser address information", "meta": {}, "data_type": null, "quote": null, "tags": []}, "balance": {"name": "balance", "description": "Account available balance", "meta": {}, "data_type": null, "quote": null, "tags": []}, "company": {"name": "company", "description": "Advertiser's company name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "contacter": {"name": "contacter", "description": "Contact Person", "meta": {}, "data_type": null, "quote": null, "tags": []}, "country": {"name": "country", "description": "The advertiser's country", "meta": {}, "data_type": null, "quote": null, "tags": []}, "create_time": {"name": "create_time", "description": "Advertiser's create time", "meta": {}, "data_type": null, "quote": null, "tags": []}, "currency": {"name": "currency", "description": "Type of currency used by advertisers", "meta": {}, "data_type": null, "quote": null, "tags": []}, "description": {"name": "description", "description": "Brand description, i.e. promotional content", "meta": {}, "data_type": null, "quote": null, "tags": []}, "email": {"name": "email", "description": "Advertiser contact email, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "industry": {"name": "industry", "description": "Advertiser industry category", "meta": {}, "data_type": null, "quote": null, "tags": []}, "language": {"name": "language", "description": "Language used by advertisers", "meta": {}, "data_type": null, "quote": null, "tags": []}, "license_no": {"name": "license_no", "description": "License number", "meta": {}, "data_type": null, "quote": null, "tags": []}, "license_url": {"name": "license_url", "description": "License preview address, the link is valid for an hour by default.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_name": {"name": "advertiser_name", "description": "Advertiser name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "phone_number": {"name": "phone_number", "description": "Contact mobile number, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "telephone": {"name": "telephone", "description": "Fixed phone number, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "timezone": {"name": "timezone", "description": "Ad account time zone including GMT offset", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__advertiser.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads", "enabled": true}, "created_at": 1661544122.071532, "compiled_sql": "\n\nwith base as (\n\n select *\n from \"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__advertiser_tmp\"\n), \n\nfields as (\n\n select\n \n \n \n address\n \n as \n \n address\n \n, \n \n \n balance\n \n as \n \n balance\n \n, \n \n \n company\n \n as \n \n company\n \n, \n \n \n contacter\n \n as \n \n contacter\n \n, \n \n \n country\n \n as \n \n country\n \n, \n \n \n currency\n \n as \n \n currency\n \n, \n \n \n description\n \n as \n \n description\n \n, \n \n \n email\n \n as \n \n email\n \n, \n \n \n id\n \n as \n \n id\n \n, \n \n \n industry\n \n as \n \n industry\n \n, \n \n \n language\n \n as \n \n language\n \n, \n \n \n name\n \n as \n \n name\n \n, \n \n \n phone_number\n \n as \n \n phone_number\n \n, \n \n \n telephone\n \n as \n \n telephone\n \n, \n \n \n timezone\n \n as \n \n timezone\n \n\n\n\n\n from base\n),\n\nfinal as (\n\n select \n id as advertiser_id, \n address, \n balance, \n company, \n contacter, \n country, \n currency, \n description, \n email, \n industry, \n language,\n name as advertiser_name, \n phone_number, \n telephone, \n timezone\n from fields\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__advertiser\""}, "model.tiktok_ads_source.stg_tiktok_ads__ad_history": {"raw_sql": "{{ config(enabled=var('ad_reporting__tiktok_ads_enabled', true)) }}\n\nwith base as (\n\n select *\n from {{ ref('stg_tiktok_ads__ad_history_tmp') }}\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__ad_history_tmp')),\n staging_columns=get_ad_history_columns()\n )\n }}\n\n from base\n), \n\nfinal as (\n\n select \n ad_id,\n cast(updated_at as {{ dbt_utils.type_timestamp() }}) as updated_at,\n adgroup_id as ad_group_id,\n advertiser_id,\n campaign_id,\n ad_name,\n call_to_action,\n click_tracking_url,\n impression_tracking_url,\n {{ dbt_utils.split_part('landing_page_url', \"'?'\", 1) }} as base_url,\n {{ dbt_utils.get_url_host('landing_page_url') }} as url_host,\n '/' || {{ dbt_utils.get_url_path('landing_page_url') }} as url_path,\n {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_source') }} as utm_source,\n {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_medium') }} as utm_medium,\n {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_campaign') }} as utm_campaign,\n {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_content') }} as utm_content,\n {{ dbt_utils.get_url_parameter('landing_page_url', 'utm_term') }} as utm_term,\n landing_page_url,\n row_number() over (partition by ad_id order by updated_at desc) = 1 as is_most_recent_record\n from fields\n)\n\nselect * \nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_ad_history_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp", "macro.dbt_utils.split_part", "macro.dbt_utils.get_url_host", "macro.dbt_utils.get_url_path", "macro.dbt_utils.get_url_parameter"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__ad_history"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__ad_history.sql", "original_file_path": "models/stg_tiktok_ads__ad_history.sql", "name": "stg_tiktok_ads__ad_history", "alias": "stg_tiktok_ads__ad_history", "checksum": {"name": "sha256", "checksum": "5053436d29ee6e8509235feb281623ffe08680916c5aabb03638be0c21f9ec60"}, "tags": [], "refs": [["stg_tiktok_ads__ad_history_tmp"], ["stg_tiktok_ads__ad_history_tmp"]], "sources": [], "description": "Each record represents data for each ad.", "columns": {"ad_id": {"name": "ad_id", "description": "Ad ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_group_id": {"name": "ad_group_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "base_url": {"name": "base_url", "description": "The base URL of the ad, extracted from the `landing page url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_name": {"name": "ad_name", "description": "Ad Name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "call_to_action": {"name": "call_to_action", "description": "Call to action values.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "click_tracking_url": {"name": "click_tracking_url", "description": "Click monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impression_tracking_url": {"name": "impression_tracking_url", "description": "Display monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_host": {"name": "url_host", "description": "The URL host of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url_path": {"name": "url_path", "description": "The URL path of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_source": {"name": "utm_source", "description": "The utm_source parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_medium": {"name": "utm_medium", "description": "The utm_medium parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_campaign": {"name": "utm_campaign", "description": "The utm_campaign parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_content": {"name": "utm_content", "description": "The utm_content parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "utm_term": {"name": "utm_term", "description": "The utm_term parameter of the ad, extracted from the `landing_page_url`.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__ad_history.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads", "enabled": true}, "created_at": 1661544122.0773308, "compiled_sql": "\n\nwith base as (\n\n select *\n from \"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__ad_history_tmp\"\n), \n\nfields as (\n\n select\n \n \n \n ad_id\n \n as \n \n ad_id\n \n, \n \n \n ad_name\n \n as \n \n ad_name\n \n, \n \n \n adgroup_id\n \n as \n \n adgroup_id\n \n, \n \n \n advertiser_id\n \n as \n \n advertiser_id\n \n, \n \n \n call_to_action\n \n as \n \n call_to_action\n \n, \n \n \n campaign_id\n \n as \n \n campaign_id\n \n, \n \n \n click_tracking_url\n \n as \n \n click_tracking_url\n \n, \n \n \n impression_tracking_url\n \n as \n \n impression_tracking_url\n \n, \n \n \n landing_page_url\n \n as \n \n landing_page_url\n \n, \n \n \n updated_at\n \n as \n \n updated_at\n \n\n\n\n\n from base\n), \n\nfinal as (\n\n select \n ad_id,\n cast(updated_at as \n timestamp without time zone\n) as updated_at,\n adgroup_id as ad_group_id,\n advertiser_id,\n campaign_id,\n ad_name,\n call_to_action,\n click_tracking_url,\n impression_tracking_url,\n \n\n \n \n\n split_part(\n landing_page_url,\n '?',\n 1\n )\n\n\n \n\n as base_url,\n \n \n cast(\n\n \n \n\n split_part(\n \n\n \n \n\n split_part(\n \n\n replace(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'android-app://',\n ''\n )\n \n\n,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n '/',\n 1\n )\n\n\n \n\n,\n '?',\n 1\n )\n\n\n \n\n as \n varchar\n)\n as url_host,\n '/' || \n \n cast(\n\n \n \n\n split_part(\n \n\n right(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n,\n \n \n length(\n \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n\n )-coalesce(\n nullif(\n\n position(\n '/' in \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n\n ), 0),\n \n\n position(\n '?' in \n\n replace(\n \n\n replace(\n landing_page_url,\n 'http://',\n ''\n )\n \n\n,\n 'https://',\n ''\n )\n \n\n\n ) - 1\n )\n ),\n '?',\n 1\n )\n\n\n \n\n as \n varchar\n)\n as url_path,\n nullif(\n\n \n \n\n split_part(\n \n\n \n \n\n split_part(\n landing_page_url,\n 'utm_source=',\n 2\n )\n\n\n \n\n,\n '&',\n 1\n )\n\n\n \n\n,'') as utm_source,\n nullif(\n\n \n \n\n split_part(\n \n\n \n \n\n split_part(\n landing_page_url,\n 'utm_medium=',\n 2\n )\n\n\n \n\n,\n '&',\n 1\n )\n\n\n \n\n,'') as utm_medium,\n nullif(\n\n \n \n\n split_part(\n \n\n \n \n\n split_part(\n landing_page_url,\n 'utm_campaign=',\n 2\n )\n\n\n \n\n,\n '&',\n 1\n )\n\n\n \n\n,'') as utm_campaign,\n nullif(\n\n \n \n\n split_part(\n \n\n \n \n\n split_part(\n landing_page_url,\n 'utm_content=',\n 2\n )\n\n\n \n\n,\n '&',\n 1\n )\n\n\n \n\n,'') as utm_content,\n nullif(\n\n \n \n\n split_part(\n \n\n \n \n\n split_part(\n landing_page_url,\n 'utm_term=',\n 2\n )\n\n\n \n\n,\n '&',\n 1\n )\n\n\n \n\n,'') as utm_term,\n landing_page_url,\n row_number() over (partition by ad_id order by updated_at desc) = 1 as is_most_recent_record\n from fields\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__ad_history\""}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_history": {"raw_sql": "{{ config(enabled=var('ad_reporting__tiktok_ads_enabled', true)) }}\n\nwith base as (\n\n select *\n from {{ ref('stg_tiktok_ads__campaign_history_tmp') }}\n), \n\nfields as (\n\n select\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_tiktok_ads__campaign_history_tmp')),\n staging_columns=get_campaign_history_columns()\n )\n }}\n from base\n), \n\nfinal as (\n\n select \n campaign_id,\n cast(updated_at as {{ dbt_utils.type_timestamp() }}) as updated_at,\n advertiser_id,\n campaign_name,\n campaign_type,\n split_test_variable,\n row_number() over (partition by campaign_id order by updated_at desc) = 1 as is_most_recent_record\n from fields\n)\n\nselect *\nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.tiktok_ads_source.get_campaign_history_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_timestamp"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "stg_tiktok_ads__campaign_history"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "stg_tiktok_ads__campaign_history.sql", "original_file_path": "models/stg_tiktok_ads__campaign_history.sql", "name": "stg_tiktok_ads__campaign_history", "alias": "stg_tiktok_ads__campaign_history", "checksum": {"name": "sha256", "checksum": "16c836c95f7cc17d3baf3e4ac360fbde750e492f12a828db8c5850068f96a30e"}, "tags": [], "refs": [["stg_tiktok_ads__campaign_history_tmp"], ["stg_tiktok_ads__campaign_history_tmp"]], "sources": [], "description": "Each record represents data for each campaign.", "columns": {"campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_type": {"name": "campaign_type", "description": "Campaign Type, indicates the campaign is a regular campaign or iOS 14 campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "split_test_variable": {"name": "split_test_variable", "description": "Split Test variables. Optional values; TARGETING, BIDDING_OPTIMIZATION , CREATIVE.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_most_recent_record": {"name": "is_most_recent_record", "description": "Whether record is the most recent one for this particular grain.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "tiktok_ads_source://models/stg_tiktok_ads.yml", "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads__campaign_history.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "stg_tiktok_ads", "enabled": true}, "created_at": 1661544122.078624, "compiled_sql": "\n\nwith base as (\n\n select *\n from \"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__campaign_history_tmp\"\n), \n\nfields as (\n\n select\n \n \n \n advertiser_id\n \n as \n \n advertiser_id\n \n, \n \n \n campaign_id\n \n as \n \n campaign_id\n \n, \n \n \n campaign_name\n \n as \n \n campaign_name\n \n, \n \n \n campaign_type\n \n as \n \n campaign_type\n \n, \n \n \n split_test_variable\n \n as \n \n split_test_variable\n \n, \n \n \n updated_at\n \n as \n \n updated_at\n \n\n\n\n from base\n), \n\nfinal as (\n\n select \n campaign_id,\n cast(updated_at as \n timestamp without time zone\n) as updated_at,\n advertiser_id,\n campaign_name,\n campaign_type,\n split_test_variable,\n row_number() over (partition by campaign_id order by updated_at desc) = 1 as is_most_recent_record\n from fields\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__campaign_history\""}, "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp": {"raw_sql": "{{ config(enabled=var('ad_reporting__tiktok_ads_enabled', true)) }}\n\nselect *\nfrom {{ var('ad_report_hourly') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.tiktok_ads_source.tiktok_ads.ad_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__ad_report_hourly_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__ad_report_hourly_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__ad_report_hourly_tmp.sql", "name": "stg_tiktok_ads__ad_report_hourly_tmp", "alias": "stg_tiktok_ads__ad_report_hourly_tmp", "checksum": {"name": "sha256", "checksum": "30949b79355e85af66a3df6de9ef124c666c0bf8ecc911ad673eb56cf3124b7e"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "ad_report_hourly"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_report_hourly_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads", "enabled": true}, "created_at": 1661544121.9735732, "compiled_sql": "\n\nselect *\nfrom \"postgres\".\"tiktok_ads_source_integration_tests_1\".\"tiktok_ad_report_hourly_data\"", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__ad_report_hourly_tmp\""}, "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp": {"raw_sql": "{{ config(enabled=var('ad_reporting__tiktok_ads_enabled', true)) }}\n\nselect *\nfrom {{ var('ad_history') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.tiktok_ads_source.tiktok_ads.ad_history"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__ad_history_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__ad_history_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__ad_history_tmp.sql", "name": "stg_tiktok_ads__ad_history_tmp", "alias": "stg_tiktok_ads__ad_history_tmp", "checksum": {"name": "sha256", "checksum": "70d0e01a26a5250c141b3a67fd3b1ffcfceea35645e82096257852badea2b9d2"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "ad_history"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_history_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads", "enabled": true}, "created_at": 1661544121.976979, "compiled_sql": "\n\nselect *\nfrom \"postgres\".\"tiktok_ads_source_integration_tests_1\".\"tiktok_ad_history_data\"", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__ad_history_tmp\""}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp": {"raw_sql": "{{ config(enabled=var('ad_reporting__tiktok_ads_enabled', true)) }}\n\nselect *\nfrom {{ var('ad_group_history') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.tiktok_ads_source.tiktok_ads.adgroup_history"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__ad_group_history_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__ad_group_history_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__ad_group_history_tmp.sql", "name": "stg_tiktok_ads__ad_group_history_tmp", "alias": "stg_tiktok_ads__ad_group_history_tmp", "checksum": {"name": "sha256", "checksum": "656a88662bd5fe65b7e782c1d24ecfc5459e7541ec41b4418f4472f3633aa347"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "adgroup_history"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_group_history_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads", "enabled": true}, "created_at": 1661544121.980187, "compiled_sql": "\n\nselect *\nfrom \"postgres\".\"tiktok_ads_source_integration_tests_1\".\"tiktok_adgroup_history_data\"", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__ad_group_history_tmp\""}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp": {"raw_sql": "{{ config(enabled=var('ad_reporting__tiktok_ads_enabled', true)) }}\n\nselect *\nfrom {{ var('campaign_report_hourly') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.tiktok_ads_source.tiktok_ads.campaign_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__campaign_report_hourly_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__campaign_report_hourly_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__campaign_report_hourly_tmp.sql", "name": "stg_tiktok_ads__campaign_report_hourly_tmp", "alias": "stg_tiktok_ads__campaign_report_hourly_tmp", "checksum": {"name": "sha256", "checksum": "3a734b2b71b67ce84e5c0fadfff18429e2aa52abcae9f16aa3832a7c5e94c25e"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "campaign_report_hourly"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__campaign_report_hourly_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads", "enabled": true}, "created_at": 1661544121.983655, "compiled_sql": "\n\nselect *\nfrom \"postgres\".\"tiktok_ads_source_integration_tests_1\".\"tiktok_campaign_report_hourly_data\"", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__campaign_report_hourly_tmp\""}, "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp": {"raw_sql": "{{ config(enabled=var('ad_reporting__tiktok_ads_enabled', true)) }}\n\nselect *\nfrom {{ var('ad_group_hourly') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__ad_group_report_hourly_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__ad_group_report_hourly_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__ad_group_report_hourly_tmp.sql", "name": "stg_tiktok_ads__ad_group_report_hourly_tmp", "alias": "stg_tiktok_ads__ad_group_report_hourly_tmp", "checksum": {"name": "sha256", "checksum": "5e607a6ea02a4f66c2d50b092e2d37d6b07d0de03b0490dddde773197364937e"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "adgroup_report_hourly"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__ad_group_report_hourly_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads", "enabled": true}, "created_at": 1661544121.9865978, "compiled_sql": "\n\nselect *\nfrom \"postgres\".\"tiktok_ads_source_integration_tests_1\".\"tiktok_adgroup_report_hourly_data\"", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__ad_group_report_hourly_tmp\""}, "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp": {"raw_sql": "{{ config(enabled=var('ad_reporting__tiktok_ads_enabled', true)) }}\n\nselect *\nfrom {{ var('campaign_history') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.tiktok_ads_source.tiktok_ads.campaign_history"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__campaign_history_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__campaign_history_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__campaign_history_tmp.sql", "name": "stg_tiktok_ads__campaign_history_tmp", "alias": "stg_tiktok_ads__campaign_history_tmp", "checksum": {"name": "sha256", "checksum": "1c8e0405cc5ddf7b7748f613590108b0b3f786b44a35ac4382079c19072febe5"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "campaign_history"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__campaign_history_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads", "enabled": true}, "created_at": 1661544121.989386, "compiled_sql": "\n\nselect *\nfrom \"postgres\".\"tiktok_ads_source_integration_tests_1\".\"tiktok_campaign_history_data\"", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__campaign_history_tmp\""}, "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp": {"raw_sql": "{{ config(enabled=var('ad_reporting__tiktok_ads_enabled', true)) }}\n\nselect *\nfrom {{ var('advertiser') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.tiktok_ads_source.tiktok_ads.advertiser"]}, "config": {"enabled": true, "alias": null, "schema": "stg_tiktok_ads", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1_stg_tiktok_ads", "fqn": ["tiktok_ads_source", "tmp", "stg_tiktok_ads__advertiser_tmp"], "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "tmp/stg_tiktok_ads__advertiser_tmp.sql", "original_file_path": "models/tmp/stg_tiktok_ads__advertiser_tmp.sql", "name": "stg_tiktok_ads__advertiser_tmp", "alias": "stg_tiktok_ads__advertiser_tmp", "checksum": {"name": "sha256", "checksum": "43da3da14719af2f23e901aa756fc51b3bd807b1172a7776a811541ee26e8688"}, "tags": [], "refs": [], "sources": [["tiktok_ads", "advertiser"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/tmp/stg_tiktok_ads__advertiser_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "stg_tiktok_ads", "enabled": true}, "created_at": 1661544121.993717, "compiled_sql": "\n\nselect *\nfrom \"postgres\".\"tiktok_ads_source_integration_tests_1\".\"tiktok_advertiser_data\"", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "\"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__advertiser_tmp\""}, "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66": {"raw_sql": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "unique", "kwargs": {"column_name": "advertiser_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__advertiser')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1_dbt_test__audit", "fqn": ["tiktok_ads_source", "unique_stg_tiktok_ads__advertiser_advertiser_id"], "unique_id": "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "unique_stg_tiktok_ads__advertiser_advertiser_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "unique_stg_tiktok_ads__advertiser_advertiser_id", "alias": "unique_stg_tiktok_ads__advertiser_advertiser_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__advertiser"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/unique_stg_tiktok_ads__advertiser_advertiser_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1661544122.095383, "compiled_sql": "\n \n \n\nselect\n advertiser_id as unique_field,\n count(*) as n_records\n\nfrom \"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__advertiser\"\nwhere advertiser_id is not null\ngroup by advertiser_id\nhaving count(*) > 1\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "advertiser_id", "file_key_name": "models.stg_tiktok_ads__advertiser"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "advertiser_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__advertiser')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__advertiser_advertiser_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__advertiser_advertiser_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__advertiser_advertiser_id", "alias": "not_null_stg_tiktok_ads__advertiser_advertiser_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__advertiser"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__advertiser_advertiser_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1661544122.096692, "compiled_sql": "\n \n \n\nselect *\nfrom \"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__advertiser\"\nwhere advertiser_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "advertiser_id", "file_key_name": "models.stg_tiktok_ads__advertiser"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_group_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_group_history')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__ad_group_history_ad_group_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__ad_group_history_ad_group_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__ad_group_history_ad_group_id", "alias": "not_null_stg_tiktok_ads__ad_group_history_ad_group_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__ad_group_history_ad_group_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1661544122.0977159, "compiled_sql": "\n \n \n\nselect *\nfrom \"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__ad_group_history\"\nwhere ad_group_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ad_group_id", "file_key_name": "models.stg_tiktok_ads__ad_group_history"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_group_id", "updated_at"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_group_history')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at", "alias": "dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_353c130a41ba5d6aab13dbda36b226c8"}, "created_at": 1661544122.0988538, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n ad_group_id, updated_at\n from \"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__ad_group_history\"\n group by ad_group_id, updated_at\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.stg_tiktok_ads__ad_group_history"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_history')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__ad_history_ad_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__ad_history_ad_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__ad_history_ad_id", "alias": "not_null_stg_tiktok_ads__ad_history_ad_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__ad_history_ad_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1661544122.106347, "compiled_sql": "\n \n \n\nselect *\nfrom \"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__ad_history\"\nwhere ad_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ad_id", "file_key_name": "models.stg_tiktok_ads__ad_history"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_id", "updated_at"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_history')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at", "alias": "dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_fe2e43690b07f6a6cbd499af54b7738f"}, "created_at": 1661544122.1073868, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n ad_id, updated_at\n from \"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__ad_history\"\n group by ad_id, updated_at\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.stg_tiktok_ads__ad_history"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "campaign_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__campaign_history')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__campaign_history_campaign_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__campaign_history_campaign_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__campaign_history_campaign_id", "alias": "not_null_stg_tiktok_ads__campaign_history_campaign_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__campaign_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__campaign_history_campaign_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1661544122.1103349, "compiled_sql": "\n \n \n\nselect *\nfrom \"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__campaign_history\"\nwhere campaign_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "campaign_id", "file_key_name": "models.stg_tiktok_ads__campaign_history"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["campaign_id", "updated_at"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__campaign_history')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at", "alias": "dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__campaign_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_843ebfc08785d00a296625f469aa2000"}, "created_at": 1661544122.111508, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n campaign_id, updated_at\n from \"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__campaign_history\"\n group by campaign_id, updated_at\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.stg_tiktok_ads__campaign_history"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_ad_id.ee84d783ed": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_report_hourly')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__ad_report_hourly_ad_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_ad_id.ee84d783ed", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__ad_report_hourly_ad_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__ad_report_hourly_ad_id", "alias": "not_null_stg_tiktok_ads__ad_report_hourly_ad_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__ad_report_hourly_ad_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1661544122.114251, "compiled_sql": "\n \n \n\nselect *\nfrom \"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__ad_report_hourly\"\nwhere ad_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ad_id", "file_key_name": "models.stg_tiktok_ads__ad_report_hourly"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour.9e2a2dca81": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "stat_time_hour", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_report_hourly')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour.9e2a2dca81", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour", "alias": "not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1661544122.115433, "compiled_sql": "\n \n \n\nselect *\nfrom \"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__ad_report_hourly\"\nwhere stat_time_hour is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "stat_time_hour", "file_key_name": "models.stg_tiktok_ads__ad_report_hourly"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_id", "stat_time_hour"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_report_hourly')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour", "alias": "dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_e6913172297a173fb855f92cf72b08dc"}, "created_at": 1661544122.116447, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n ad_id, stat_time_hour\n from \"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__ad_report_hourly\"\n group by ad_id, stat_time_hour\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.stg_tiktok_ads__ad_report_hourly"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ad_group_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_group_report_hourly')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id", "alias": "not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1661544122.1192908, "compiled_sql": "\n \n \n\nselect *\nfrom \"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__ad_group_report_hourly\"\nwhere ad_group_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ad_group_id", "file_key_name": "models.stg_tiktok_ads__ad_group_report_hourly"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour.ca4b495127": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "stat_time_hour", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_group_report_hourly')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour.ca4b495127", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour", "alias": "not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1661544122.120436, "compiled_sql": "\n \n \n\nselect *\nfrom \"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__ad_group_report_hourly\"\nwhere stat_time_hour is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "stat_time_hour", "file_key_name": "models.stg_tiktok_ads__ad_group_report_hourly"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["ad_group_id", "stat_time_hour"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__ad_group_report_hourly')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour", "alias": "dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__ad_group_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_b8146651452c0bd776f5ad7184463e60"}, "created_at": 1661544122.121494, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n ad_group_id, stat_time_hour\n from \"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__ad_group_report_hourly\"\n group by ad_group_id, stat_time_hour\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.stg_tiktok_ads__ad_group_report_hourly"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "campaign_id", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__campaign_report_hourly')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id", "alias": "not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__campaign_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1661544122.1244469, "compiled_sql": "\n \n \n\nselect *\nfrom \"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__campaign_report_hourly\"\nwhere campaign_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "campaign_id", "file_key_name": "models.stg_tiktok_ads__campaign_report_hourly"}, "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour.e75e13184c": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "stat_time_hour", "model": "{{ get_where_subquery(ref('stg_tiktok_ads__campaign_report_hourly')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"]}, "config": {"enabled": true, "alias": null, "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1_dbt_test__audit", "fqn": ["tiktok_ads_source", "not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour"], "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour.e75e13184c", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour", "alias": "not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__campaign_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1661544122.1256478, "compiled_sql": "\n \n \n\nselect *\nfrom \"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__campaign_report_hourly\"\nwhere stat_time_hour is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "stat_time_hour", "file_key_name": "models.stg_tiktok_ads__campaign_report_hourly"}, "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["campaign_id", "stat_time_hour"], "model": "{{ get_where_subquery(ref('stg_tiktok_ads__campaign_report_hourly')) }}"}, "namespace": "dbt_utils"}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt_utils.test_unique_combination_of_columns", "macro.dbt.get_where_subquery"], "nodes": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16", "schema": "dbt_test__audit", "database": null, "tags": [], "meta": {}, "materialized": "test", "severity": "ERROR", "store_failures": null, "where": null, "limit": null, "fail_calc": "count(*)", "warn_if": "!= 0", "error_if": "!= 0"}, "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1_dbt_test__audit", "fqn": ["tiktok_ads_source", "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour"], "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16.sql", "original_file_path": "models/stg_tiktok_ads.yml", "name": "dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour", "alias": "dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_tiktok_ads__campaign_report_hourly"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/tiktok_ads_source/models/stg_tiktok_ads.yml/dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_28d20c1f14a23926a21e229d68eb6b16"}, "created_at": 1661544122.127014, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n campaign_id, stat_time_hour\n from \"postgres\".\"tiktok_ads_source_integration_tests_1_stg_tiktok_ads\".\"stg_tiktok_ads__campaign_report_hourly\"\n group by campaign_id, stat_time_hour\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": null, "file_key_name": "models.stg_tiktok_ads__campaign_report_hourly"}}, "sources": {"source.tiktok_ads_source.tiktok_ads.advertiser": {"fqn": ["tiktok_ads_source", "tiktok_ads", "advertiser"], "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1", "unique_id": "source.tiktok_ads_source.tiktok_ads.advertiser", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "advertiser", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "tiktok_advertiser_data", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 48, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Each record represents data for one advertiser.", "columns": {"id": {"name": "id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "address": {"name": "address", "description": "Advertiser address information", "meta": {}, "data_type": null, "quote": null, "tags": []}, "balance": {"name": "balance", "description": "Account available balance", "meta": {}, "data_type": null, "quote": null, "tags": []}, "company": {"name": "company", "description": "Advertiser's company name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "contacter": {"name": "contacter", "description": "Contact Person", "meta": {}, "data_type": null, "quote": null, "tags": []}, "country": {"name": "country", "description": "The advertiser's country", "meta": {}, "data_type": null, "quote": null, "tags": []}, "create_time": {"name": "create_time", "description": "Advertiser's create time", "meta": {}, "data_type": null, "quote": null, "tags": []}, "currency": {"name": "currency", "description": "Type of currency used by advertisers", "meta": {}, "data_type": null, "quote": null, "tags": []}, "description": {"name": "description", "description": "Brand description, i.e. promotional content", "meta": {}, "data_type": null, "quote": null, "tags": []}, "email": {"name": "email", "description": "Advertiser contact email, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "industry": {"name": "industry", "description": "Advertiser industry category", "meta": {}, "data_type": null, "quote": null, "tags": []}, "language": {"name": "language", "description": "Language used by advertisers", "meta": {}, "data_type": null, "quote": null, "tags": []}, "license_no": {"name": "license_no", "description": "License number", "meta": {}, "data_type": null, "quote": null, "tags": []}, "license_url": {"name": "license_url", "description": "License preview address, the link is valid for an hour by default.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "Advertiser name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "phone_number": {"name": "phone_number", "description": "Contact mobile number, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "promotion_area": {"name": "promotion_area", "description": "Operation area", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reason": {"name": "reason", "description": "Reason for rejection", "meta": {}, "data_type": null, "quote": null, "tags": []}, "role": {"name": "role", "description": "Advertiser role", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Advertiser status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "telephone": {"name": "telephone", "description": "Fixed phone number, desensitised data", "meta": {}, "data_type": null, "quote": null, "tags": []}, "timezone": {"name": "timezone", "description": "Ad account time zone including GMT offset", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "\"postgres\".\"tiktok_ads_source_integration_tests_1\".\"tiktok_advertiser_data\"", "created_at": 1661544122.1299121}, "source.tiktok_ads_source.tiktok_ads.campaign_history": {"fqn": ["tiktok_ads_source", "tiktok_ads", "campaign_history"], "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1", "unique_id": "source.tiktok_ads_source.tiktok_ads.campaign_history", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "campaign_history", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "tiktok_campaign_history_data", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 48, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Each record represents a version of a TikTok campaign.", "columns": {"campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget": {"name": "budget", "description": "Campaign budget", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget_mode": {"name": "budget_mode", "description": "Budget type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_name": {"name": "campaign_name", "description": "Campaign name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_type": {"name": "campaign_type", "description": "Campaign Type, indicates the campaign is a regular campaign or iOS 14 campaign.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "create_time": {"name": "create_time", "description": "Time at which the campaign was created.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_new_structure": {"name": "is_new_structure", "description": "Whether the campaign is a new structure (for the same campaign, the structure of campaign, adgroups and ads are the same)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "objective_type": {"name": "objective_type", "description": "Advertising objective.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "opt_status": {"name": "opt_status", "description": "Operation status.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Campaign status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "split_test_variable": {"name": "split_test_variable", "description": "Split Test variables. Optional values; TARGETING, BIDDING_OPTIMIZATION , CREATIVE.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "\"postgres\".\"tiktok_ads_source_integration_tests_1\".\"tiktok_campaign_history_data\"", "created_at": 1661544122.130006}, "source.tiktok_ads_source.tiktok_ads.adgroup_history": {"fqn": ["tiktok_ads_source", "tiktok_ads", "adgroup_history"], "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1", "unique_id": "source.tiktok_ads_source.tiktok_ads.adgroup_history", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "adgroup_history", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "tiktok_adgroup_history_data", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 48, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Each record represents a version of a TikTok ad group.", "columns": {"adgroup_id": {"name": "adgroup_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "The Ad group's campaign ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_categories": {"name": "action_categories", "description": "IDs of the action categories (behaviors) that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "action_days": {"name": "action_days", "description": "The number of days of the time period to include action from.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "adgroup_name": {"name": "adgroup_name", "description": "Ad group name. Character limit is 512 and cannot contain emoji.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "age": {"name": "age", "description": "Age groups you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "android_osv": {"name": "android_osv", "description": "Minimum Android version.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "app_download_url": {"name": "app_download_url", "description": "App download link", "meta": {}, "data_type": null, "quote": null, "tags": []}, "app_id": {"name": "app_id", "description": "The Application id of the promoted app", "meta": {}, "data_type": null, "quote": null, "tags": []}, "app_name": {"name": "app_name", "description": "App name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "app_type": {"name": "app_type", "description": "App type.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience": {"name": "audience", "description": "A list of audience IDs.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "audience_type": {"name": "audience_type", "description": "Audience Type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "bid": {"name": "bid", "description": "CPC, CPM bidding, oCPM learning bidding", "meta": {}, "data_type": null, "quote": null, "tags": []}, "bid_type": {"name": "bid_type", "description": "Bidding Strategy", "meta": {}, "data_type": null, "quote": null, "tags": []}, "billing_event": {"name": "billing_event", "description": "Bid method.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget": {"name": "budget", "description": "Ad budget. Returns 0.0 when Campaign Budget Optimization (budget_optimize_switch) is on.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "budget_mode": {"name": "budget_mode", "description": "Budget mode. This field will be ignored when Campaign Budget Optimization (budget_optimize_switch) is enabled.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "carriers": {"name": "carriers", "description": "Carriers that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "category": {"name": "category", "description": "Ad group category.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "click_tracking_url": {"name": "click_tracking_url", "description": "Click monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "connection_type": {"name": "connection_type", "description": "Device connection types that you want to target. Default; unlimited.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_bid": {"name": "conversion_bid", "description": "oCPM conversion bid", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpv_video_duration": {"name": "cpv_video_duration", "description": "Video playback duration, required if optimize_goal is VIDEO_VIEW. Allowed values; SIX_SECONDS (video playback 6s), TWO_SECONDS (video playback 2s)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "creative_material_mode": {"name": "creative_material_mode", "description": "Creative delivery mode.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "dayparting": {"name": "dayparting", "description": "Ad delivery period, the default is always and the format is 48 * 7 character string, represented by 0 or 1. > That is, with half an hour as the minimum granularity, a day (24 hours) is divided by the minimum granularity(30 mins) from Monday to Sunday. Resulting in a 48*7 format.0 represents not to be delivered, 1 represents delivery. no transmission, full transmission 0, full transmission 1 all represent full time delivery", "meta": {}, "data_type": null, "quote": null, "tags": []}, "deep_bid_type": {"name": "deep_bid_type", "description": "Bidding strategy for in-app events.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "deep_cpabid": {"name": "deep_cpabid", "description": "Deep bid", "meta": {}, "data_type": null, "quote": null, "tags": []}, "deep_external_action": {"name": "deep_external_action", "description": "Deep conversion event.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "display_name": {"name": "display_name", "description": "Display name of ad group.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "enable_inventory_filter": {"name": "enable_inventory_filter", "description": "Inventory filtering (Unsafe videos will not be displayed).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "excluded_audience": {"name": "excluded_audience", "description": "A list of audience ID to be excluded.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "external_action": {"name": "external_action", "description": "Conversion event for the ad group. It is required when the promoted object is an app with tracking urls, or when pixel_id is specified.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "fallback_type": {"name": "fallback_type", "description": "Fallback Type. If the audience do not have the app installed, you can have them fall back to install the app, or to view a specific web page. Not applicable for Deferred Deeplink. Allowed values; APP_INSTALL, WEBSITE, UNSET. If website is chosen, you need to specify the url via landing_page_url field.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency": {"name": "frequency", "description": "frequency, together with frequency_schedule, controls how often people see your ad (only available for REACH ads). For example, frequency = 2 frequency_schedule = 3 means \"show ads no more than twice every 3 day\".\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "frequency_schedule": {"name": "frequency_schedule", "description": "frequency, together with frequency, controls how often people see your ad (only available for REACH ads).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "gender": {"name": "gender", "description": "Gender that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impression_tracking_url": {"name": "impression_tracking_url", "description": "Display monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "interest_category_v2": {"name": "interest_category_v2", "description": "Interest classification. If the interest is specified, users that do not meet interest target will be excluded during delivery.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ios_osv": {"name": "ios_osv", "description": "Minimum iOS version.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_comment_disable": {"name": "is_comment_disable", "description": "Whether to allow comments on your ads on TikTok, Vigo, Helo.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_hfss": {"name": "is_hfss", "description": "Whether the promoted content is HFSS foods (foods that are high in fat, salt, or sugar).", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_new_structure": {"name": "is_new_structure", "description": "Whether the campaign is a new structure.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "keywords": {"name": "keywords", "description": "Keywords used.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "languages": {"name": "languages", "description": "Codes of the languages that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "location": {"name": "location", "description": "IDs of the locations that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "open_url": {"name": "open_url", "description": "The specific location where you want your audience to go if they have your app installed.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "open_url_type": {"name": "open_url_type", "description": "The open URL type.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "operation_system": {"name": "operation_system", "description": "Device operating systems that you want to target.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "opt_status": {"name": "opt_status", "description": "Operation status.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "optimize_goal": {"name": "optimize_goal", "description": "Optimization goal.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "pacing": {"name": "pacing", "description": "You can choose between PACING_MODE_SMOOTH and PACING_MODE_FAST. For PACING_MODE_SMOOTH, the budget is allocated evenly within the scheduled time. PACING_MODE_FAST would consume budget and produce results as soon as possible. \n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "package": {"name": "package", "description": "Package name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "pangle_block_app_list_id": {"name": "pangle_block_app_list_id", "description": "Pangle app block list ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "pixel_id": {"name": "pixel_id", "description": "Pixel ID. Only application for landing pages.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "placement": {"name": "placement", "description": "The apps where you want to deliver your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "placement_type": {"name": "placement_type", "description": "Placement type.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_image": {"name": "profile_image", "description": "Avatar URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "schedule_end_time": {"name": "schedule_end_time", "description": "Ad delivery end time (UTC+0). Format should be YYYY-MM-DD HH:MM:SS", "meta": {}, "data_type": null, "quote": null, "tags": []}, "schedule_start_time": {"name": "schedule_start_time", "description": "Ad delivery start time (UTC+0). Format should be YYYY-MM-DD HH:MM:SS", "meta": {}, "data_type": null, "quote": null, "tags": []}, "schedule_type": {"name": "schedule_type", "description": "The schedule type, which can be either SCHEDULE_START_END or SCHEDULE_FROM_NOW.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "skip_learning_phase": {"name": "skip_learning_phase", "description": "Whether to skip the learning stage.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "statistic_type": {"name": "statistic_type", "description": "conversion bid statistic type", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Ad group status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_actions": {"name": "video_actions", "description": "Number of video actions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_download": {"name": "video_download", "description": "Whether users can download your video ads on TikTok(cannot be updated once created).", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "\"postgres\".\"tiktok_ads_source_integration_tests_1\".\"tiktok_adgroup_history_data\"", "created_at": 1661544122.130144}, "source.tiktok_ads_source.tiktok_ads.ad_history": {"fqn": ["tiktok_ads_source", "tiktok_ads", "ad_history"], "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1", "unique_id": "source.tiktok_ads_source.tiktok_ads.ad_history", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "ad_history", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "tiktok_ad_history_data", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 48, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Each record represents a version of a TikTok ad.", "columns": {"ad_id": {"name": "ad_id", "description": "Ad ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "Time the record was updated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "adgroup_id": {"name": "adgroup_id", "description": "Ad group ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "advertiser_id": {"name": "advertiser_id", "description": "Advertiser ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "campaign_id": {"name": "campaign_id", "description": "Campaign ID", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_name": {"name": "ad_name", "description": "Ad Name.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ad_text": {"name": "ad_text", "description": "The ad text.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "app_name": {"name": "app_name", "description": "The display name of app download ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "call_to_action": {"name": "call_to_action", "description": "Call to action values.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "click_tracking_url": {"name": "click_tracking_url", "description": "Click monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "create_time": {"name": "create_time", "description": "Time at which the ad was created.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "display_name": {"name": "display_name", "description": "The display name of landing page or pure exposure ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "image_ids": {"name": "image_ids", "description": "A list of image IDs.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impression_tracking_url": {"name": "impression_tracking_url", "description": "Display monitoring URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_aco": {"name": "is_aco", "description": "Whether the ad is an automated ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_creative_authorized": {"name": "is_creative_authorized", "description": "Whether you grant displaying some of your ads in our TikTok For Business Creative Center. Only valid for non-US advertisers, the default value is false.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_new_structure": {"name": "is_new_structure", "description": "Whether the campaign is a new structure.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "landing_page_url": {"name": "landing_page_url", "description": "Landing page URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "open_url": {"name": "open_url", "description": "The specific location where you want your audience to go if they have your app installed.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "opt_status": {"name": "opt_status", "description": "Operation status.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "playable_url": {"name": "playable_url", "description": "Playable material url.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_image": {"name": "profile_image", "description": "Avatar URL.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "Ad status.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_id": {"name": "video_id", "description": "The video ID.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "\"postgres\".\"tiktok_ads_source_integration_tests_1\".\"tiktok_ad_history_data\"", "created_at": 1661544122.130238}, "source.tiktok_ads_source.tiktok_ads.ad_report_hourly": {"fqn": ["tiktok_ads_source", "tiktok_ads", "ad_report_hourly"], "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1", "unique_id": "source.tiktok_ads_source.tiktok_ads.ad_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "ad_report_hourly", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "tiktok_ad_report_hourly_data", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 48, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Each record represents data for each ad for each hour.", "columns": {"ad_id": {"name": "ad_id", "description": "Ad id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion": {"name": "real_time_conversion", "description": "The number of times your ad achieved an outcome, based on the objective and settings you selected. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result": {"name": "result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the results. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_result": {"name": "real_time_cost_per_result", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now, please go to the ad group section to view the cost per Result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result": {"name": "real_time_result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As a campaign may have different optimization goals, the total number of result is not supported in campaign section now , Please go to the ad group section to view the result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_view_p_100": {"name": "video_view_p_100", "description": "The number of times your video was played at 100% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion_rate": {"name": "real_time_conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_secondary_goal_result": {"name": "cost_per_secondary_goal_result", "description": "The average cost for each secondary goal result from your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result_rate": {"name": "secondary_goal_result_rate", "description": "The percentage of secondary goal results you achieved out of all of the installs of your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. The total count is calculated based on the time each ad impression occurred.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_conversion": {"name": "real_time_cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result_rate": {"name": "result_rate", "description": "The percentage of results you achieved out of all of the views/clicks on your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the result rate. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result": {"name": "secondary_goal_result", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_result": {"name": "cost_per_result", "description": "The average cost for each result from your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the cost per result. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time your video was played per person, including any time spent replaying the video. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result_rate": {"name": "real_time_result_rate", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now ,Please go to the ad group section to view the Result Rate. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "\"postgres\".\"tiktok_ads_source_integration_tests_1\".\"tiktok_ad_report_hourly_data\"", "created_at": 1661544122.130354}, "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly": {"fqn": ["tiktok_ads_source", "tiktok_ads", "campaign_report_hourly"], "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1", "unique_id": "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "campaign_report_hourly", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "tiktok_campaign_report_hourly_data", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 48, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Each record represents data for each campaign for each hour.", "columns": {"campaign_id": {"name": "campaign_id", "description": "Campaign id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion": {"name": "real_time_conversion", "description": "The number of times your ad achieved an outcome, based on the objective and settings you selected. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result": {"name": "result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the results. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_result": {"name": "real_time_cost_per_result", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now, please go to the ad group section to view the cost per Result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result": {"name": "real_time_result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As a campaign may have different optimization goals, the total number of result is not supported in campaign section now , Please go to the ad group section to view the result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_view_p_100": {"name": "video_view_p_100", "description": "The number of times your video was played at 100% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion_rate": {"name": "real_time_conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_secondary_goal_result": {"name": "cost_per_secondary_goal_result", "description": "The average cost for each secondary goal result from your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result_rate": {"name": "secondary_goal_result_rate", "description": "The percentage of secondary goal results you achieved out of all of the installs of your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. The total count is calculated based on the time each ad impression occurred.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_conversion": {"name": "real_time_cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result_rate": {"name": "result_rate", "description": "The percentage of results you achieved out of all of the views/clicks on your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the result rate. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result": {"name": "secondary_goal_result", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_result": {"name": "cost_per_result", "description": "The average cost for each result from your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the cost per result. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time your video was played per person, including any time spent replaying the video. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result_rate": {"name": "real_time_result_rate", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now ,Please go to the ad group section to view the Result Rate. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "\"postgres\".\"tiktok_ads_source_integration_tests_1\".\"tiktok_campaign_report_hourly_data\"", "created_at": 1661544122.130469}, "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly": {"fqn": ["tiktok_ads_source", "tiktok_ads", "adgroup_report_hourly"], "database": "postgres", "schema": "tiktok_ads_source_integration_tests_1", "unique_id": "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "models/src_tiktok_ads.yml", "original_file_path": "models/src_tiktok_ads.yml", "name": "adgroup_report_hourly", "source_name": "tiktok_ads", "source_description": "", "loader": "fivetran", "identifier": "tiktok_adgroup_report_hourly_data", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 48, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Each record represents data for each ad group for each hour.", "columns": {"adgroup_id": {"name": "adgroup_id", "description": "Ad group id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "stat_time_hour": {"name": "stat_time_hour", "description": "Hour of activity", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_conversion": {"name": "cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion": {"name": "real_time_conversion", "description": "The number of times your ad achieved an outcome, based on the objective and settings you selected. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpc": {"name": "cpc", "description": "The average amount of money you've spent on a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_play_actions": {"name": "video_play_actions", "description": "The number of times your video starts to play. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion_rate": {"name": "conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is calculated based on the time each ad impression occurred.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_75": {"name": "video_views_p_75", "description": "The number of times your video was played at 75% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result": {"name": "result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the results. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_50": {"name": "video_views_p_50", "description": "The number of times your video was played at 50% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "impressions": {"name": "impressions", "description": "The number of times your ads were on screen.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "comments": {"name": "comments", "description": "The number of comments your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_result": {"name": "real_time_cost_per_result", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now, please go to the ad group section to view the cost per Result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "conversion": {"name": "conversion", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result": {"name": "real_time_result", "description": "The number of times your ad achieved an outcome, based on the optimization goal you selected. As a campaign may have different optimization goals, the total number of result is not supported in campaign section now , Please go to the ad group section to view the result. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_view_p_100": {"name": "video_view_p_100", "description": "The number of times your video was played at 100% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shares": {"name": "shares", "description": "The number of shares your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_conversion_rate": {"name": "real_time_conversion_rate", "description": "The percentage of results you received out of all the clicks of your ads. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_secondary_goal_result": {"name": "cost_per_secondary_goal_result", "description": "The average cost for each secondary goal result from your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result_rate": {"name": "secondary_goal_result_rate", "description": "The percentage of secondary goal results you achieved out of all of the installs of your adverts. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. The total count is calculated based on the time each ad impression occurred.\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "clicks": {"name": "clicks", "description": "The number of clicks on your ads.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_1000_reached": {"name": "cost_per_1000_reached", "description": "The average cost to reach 1,000 unique users. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_views_p_25": {"name": "video_views_p_25", "description": "The number of times your video was played at 25% of its length. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reach": {"name": "reach", "description": "The number of unique users who saw your ads at least once. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_cost_per_conversion": {"name": "real_time_cost_per_conversion", "description": "The average amount of money you've spent on a conversion. (The total count is based on when the conversion actually happened.)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits_rate": {"name": "profile_visits_rate", "description": "The rate of profile visits per impression the paid ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play": {"name": "average_video_play", "description": "The average time your video was played per single video view, including any time spent replaying the video.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "profile_visits": {"name": "profile_visits", "description": "The number of profile visits the ad drove during the campaign. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cpm": {"name": "cpm", "description": "The average amount of money you've spent per 1,000 impressions.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ctr": {"name": "ctr", "description": "The percentage of times people saw your ad and performed a click.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_2_s": {"name": "video_watched_2_s", "description": "The number of times your video played for at least 2 seconds. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "follows": {"name": "follows", "description": "The number of new followers that were gained within 1 day of a user seeing a paid ad. This metric is only for Boosted TikToks.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "result_rate": {"name": "result_rate", "description": "The percentage of results you achieved out of all of the views/clicks on your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the result rate. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "video_watched_6_s": {"name": "video_watched_6_s", "description": "The number of times your video played for at least 6 seconds, or completely played. Replays will not be counted.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "secondary_goal_result": {"name": "secondary_goal_result", "description": "The number of times your ad achieved an outcome, based on the secondary goal you selected. As one campaign may have a number of different secondary goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "cost_per_result": {"name": "cost_per_result", "description": "The average cost for each result from your ads. As one campaign may have a number of different optimization goals, this statistic is not supported for campaigns. Please go to ad groups or ads to view the cost per result. (The total count is calculated based on the time each ad impression occurred.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "average_video_play_per_user": {"name": "average_video_play_per_user", "description": "The average time your video was played per person, including any time spent replaying the video. This metric is estimated.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "real_time_result_rate": {"name": "real_time_result_rate", "description": "As a campaign may have different optimization goals, the total number of result is not supported in campaign section now ,Please go to the ad group section to view the Result Rate. (The total count is based on when the conversion actually happened.)\n", "meta": {}, "data_type": null, "quote": null, "tags": []}, "spend": {"name": "spend", "description": "The estimated total amount of money you've spent on your campaign, ad group or ad during its schedule.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "likes": {"name": "likes", "description": "The number of likes your video creative received within 1 day of a user seeing a paid ad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "_fivetran_synced": {"name": "_fivetran_synced", "description": "Timestamp of when Fivetran synced a record.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "\"postgres\".\"tiktok_ads_source_integration_tests_1\".\"tiktok_adgroup_report_hourly_data\"", "created_at": 1661544122.1306639}}, "macros": {"macro.dbt_postgres.postgres__get_catalog": {"unique_id": "macro.dbt_postgres.postgres__get_catalog", "package_name": "dbt_postgres", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/catalog.sql", "original_file_path": "macros/catalog.sql", "name": "postgres__get_catalog", "macro_sql": "{% macro postgres__get_catalog(information_schema, schemas) -%}\n\n {%- call statement('catalog', fetch_result=True) -%}\n {#\n If the user has multiple databases set and the first one is wrong, this will fail.\n But we won't fail in the case where there are multiple quoting-difference-only dbs, which is better.\n #}\n {% set database = information_schema.database %}\n {{ adapter.verify_database(database) }}\n\n select\n '{{ database }}' as table_database,\n sch.nspname as table_schema,\n tbl.relname as table_name,\n case tbl.relkind\n when 'v' then 'VIEW'\n else 'BASE TABLE'\n end as table_type,\n tbl_desc.description as table_comment,\n col.attname as column_name,\n col.attnum as column_index,\n pg_catalog.format_type(col.atttypid, col.atttypmod) as column_type,\n col_desc.description as column_comment,\n pg_get_userbyid(tbl.relowner) as table_owner\n\n from pg_catalog.pg_namespace sch\n join pg_catalog.pg_class tbl on tbl.relnamespace = sch.oid\n join pg_catalog.pg_attribute col on col.attrelid = tbl.oid\n left outer join pg_catalog.pg_description tbl_desc on (tbl_desc.objoid = tbl.oid and tbl_desc.objsubid = 0)\n left outer join pg_catalog.pg_description col_desc on (col_desc.objoid = tbl.oid and col_desc.objsubid = col.attnum)\n\n where (\n {%- for schema in schemas -%}\n upper(sch.nspname) = upper('{{ schema }}'){%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n )\n and not pg_is_other_temp_schema(sch.oid) -- not a temporary schema belonging to another session\n and tbl.relpersistence in ('p', 'u') -- [p]ermanent table or [u]nlogged table. Exclude [t]emporary tables\n and tbl.relkind in ('r', 'v', 'f', 'p') -- o[r]dinary table, [v]iew, [f]oreign table, [p]artitioned table. Other values are [i]ndex, [S]equence, [c]omposite type, [t]OAST table, [m]aterialized view\n and col.attnum > 0 -- negative numbers are used for system columns such as oid\n and not col.attisdropped -- column as not been dropped\n\n order by\n sch.nspname,\n tbl.relname,\n col.attnum\n\n {%- endcall -%}\n\n {{ return(load_result('catalog').table) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.2725601}, "macro.dbt_postgres.postgres_get_relations": {"unique_id": "macro.dbt_postgres.postgres_get_relations", "package_name": "dbt_postgres", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/relations.sql", "original_file_path": "macros/relations.sql", "name": "postgres_get_relations", "macro_sql": "{% macro postgres_get_relations () -%}\n\n {#\n -- in pg_depend, objid is the dependent, refobjid is the referenced object\n -- > a pg_depend entry indicates that the referenced object cannot be\n -- > dropped without also dropping the dependent object.\n #}\n\n {%- call statement('relations', fetch_result=True) -%}\n with relation as (\n select\n pg_rewrite.ev_class as class,\n pg_rewrite.oid as id\n from pg_rewrite\n ),\n class as (\n select\n oid as id,\n relname as name,\n relnamespace as schema,\n relkind as kind\n from pg_class\n ),\n dependency as (\n select\n pg_depend.objid as id,\n pg_depend.refobjid as ref\n from pg_depend\n ),\n schema as (\n select\n pg_namespace.oid as id,\n pg_namespace.nspname as name\n from pg_namespace\n where nspname != 'information_schema' and nspname not like 'pg\\_%'\n ),\n referenced as (\n select\n relation.id AS id,\n referenced_class.name ,\n referenced_class.schema ,\n referenced_class.kind\n from relation\n join class as referenced_class on relation.class=referenced_class.id\n where referenced_class.kind in ('r', 'v')\n ),\n relationships as (\n select\n referenced.name as referenced_name,\n referenced.schema as referenced_schema_id,\n dependent_class.name as dependent_name,\n dependent_class.schema as dependent_schema_id,\n referenced.kind as kind\n from referenced\n join dependency on referenced.id=dependency.id\n join class as dependent_class on dependency.ref=dependent_class.id\n where\n (referenced.name != dependent_class.name or\n referenced.schema != dependent_class.schema)\n )\n\n select\n referenced_schema.name as referenced_schema,\n relationships.referenced_name as referenced_name,\n dependent_schema.name as dependent_schema,\n relationships.dependent_name as dependent_name\n from relationships\n join schema as dependent_schema on relationships.dependent_schema_id=dependent_schema.id\n join schema as referenced_schema on relationships.referenced_schema_id=referenced_schema.id\n group by referenced_schema, referenced_name, dependent_schema, dependent_name\n order by referenced_schema, referenced_name, dependent_schema, dependent_name;\n\n {%- endcall -%}\n\n {{ return(load_result('relations').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.273313}, "macro.dbt_postgres.postgres__create_table_as": {"unique_id": "macro.dbt_postgres.postgres__create_table_as", "package_name": "dbt_postgres", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__create_table_as", "macro_sql": "{% macro postgres__create_table_as(temporary, relation, sql) -%}\n {%- set unlogged = config.get('unlogged', default=false) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n\n create {% if temporary -%}\n temporary\n {%- elif unlogged -%}\n unlogged\n {%- endif %} table {{ relation }}\n as (\n {{ sql }}\n );\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.2791512}, "macro.dbt_postgres.postgres__get_create_index_sql": {"unique_id": "macro.dbt_postgres.postgres__get_create_index_sql", "package_name": "dbt_postgres", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__get_create_index_sql", "macro_sql": "{% macro postgres__get_create_index_sql(relation, index_dict) -%}\n {%- set index_config = adapter.parse_index(index_dict) -%}\n {%- set comma_separated_columns = \", \".join(index_config.columns) -%}\n {%- set index_name = index_config.render(relation) -%}\n\n create {% if index_config.unique -%}\n unique\n {%- endif %} index if not exists\n \"{{ index_name }}\"\n on {{ relation }} {% if index_config.type -%}\n using {{ index_config.type }}\n {%- endif %}\n ({{ comma_separated_columns }});\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.2797508}, "macro.dbt_postgres.postgres__create_schema": {"unique_id": "macro.dbt_postgres.postgres__create_schema", "package_name": "dbt_postgres", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__create_schema", "macro_sql": "{% macro postgres__create_schema(relation) -%}\n {% if relation.database -%}\n {{ adapter.verify_database(relation.database) }}\n {%- endif -%}\n {%- call statement('create_schema') -%}\n create schema if not exists {{ relation.without_identifier().include(database=False) }}\n {%- endcall -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.2801018}, "macro.dbt_postgres.postgres__drop_schema": {"unique_id": "macro.dbt_postgres.postgres__drop_schema", "package_name": "dbt_postgres", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__drop_schema", "macro_sql": "{% macro postgres__drop_schema(relation) -%}\n {% if relation.database -%}\n {{ adapter.verify_database(relation.database) }}\n {%- endif -%}\n {%- call statement('drop_schema') -%}\n drop schema if exists {{ relation.without_identifier().include(database=False) }} cascade\n {%- endcall -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.2804291}, "macro.dbt_postgres.postgres__get_columns_in_relation": {"unique_id": "macro.dbt_postgres.postgres__get_columns_in_relation", "package_name": "dbt_postgres", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__get_columns_in_relation", "macro_sql": "{% macro postgres__get_columns_in_relation(relation) -%}\n {% call statement('get_columns_in_relation', fetch_result=True) %}\n select\n column_name,\n data_type,\n character_maximum_length,\n numeric_precision,\n numeric_scale\n\n from {{ relation.information_schema('columns') }}\n where table_name = '{{ relation.identifier }}'\n {% if relation.schema %}\n and table_schema = '{{ relation.schema }}'\n {% endif %}\n order by ordinal_position\n\n {% endcall %}\n {% set table = load_result('get_columns_in_relation').table %}\n {{ return(sql_convert_columns_in_relation(table)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt.sql_convert_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.280937}, "macro.dbt_postgres.postgres__list_relations_without_caching": {"unique_id": "macro.dbt_postgres.postgres__list_relations_without_caching", "package_name": "dbt_postgres", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__list_relations_without_caching", "macro_sql": "{% macro postgres__list_relations_without_caching(schema_relation) %}\n {% call statement('list_relations_without_caching', fetch_result=True) -%}\n select\n '{{ schema_relation.database }}' as database,\n tablename as name,\n schemaname as schema,\n 'table' as type\n from pg_tables\n where schemaname ilike '{{ schema_relation.schema }}'\n union all\n select\n '{{ schema_relation.database }}' as database,\n viewname as name,\n schemaname as schema,\n 'view' as type\n from pg_views\n where schemaname ilike '{{ schema_relation.schema }}'\n {% endcall %}\n {{ return(load_result('list_relations_without_caching').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.281326}, "macro.dbt_postgres.postgres__information_schema_name": {"unique_id": "macro.dbt_postgres.postgres__information_schema_name", "package_name": "dbt_postgres", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__information_schema_name", "macro_sql": "{% macro postgres__information_schema_name(database) -%}\n {% if database_name -%}\n {{ adapter.verify_database(database_name) }}\n {%- endif -%}\n information_schema\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.2815459}, "macro.dbt_postgres.postgres__list_schemas": {"unique_id": "macro.dbt_postgres.postgres__list_schemas", "package_name": "dbt_postgres", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__list_schemas", "macro_sql": "{% macro postgres__list_schemas(database) %}\n {% if database -%}\n {{ adapter.verify_database(database) }}\n {%- endif -%}\n {% call statement('list_schemas', fetch_result=True, auto_begin=False) %}\n select distinct nspname from pg_namespace\n {% endcall %}\n {{ return(load_result('list_schemas').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.281989}, "macro.dbt_postgres.postgres__check_schema_exists": {"unique_id": "macro.dbt_postgres.postgres__check_schema_exists", "package_name": "dbt_postgres", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__check_schema_exists", "macro_sql": "{% macro postgres__check_schema_exists(information_schema, schema) -%}\n {% if information_schema.database -%}\n {{ adapter.verify_database(information_schema.database) }}\n {%- endif -%}\n {% call statement('check_schema_exists', fetch_result=True, auto_begin=False) %}\n select count(*) from pg_namespace where nspname = '{{ schema }}'\n {% endcall %}\n {{ return(load_result('check_schema_exists').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.2824728}, "macro.dbt_postgres.postgres__current_timestamp": {"unique_id": "macro.dbt_postgres.postgres__current_timestamp", "package_name": "dbt_postgres", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__current_timestamp", "macro_sql": "{% macro postgres__current_timestamp() -%}\n now()\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.2826061}, "macro.dbt_postgres.postgres__snapshot_string_as_time": {"unique_id": "macro.dbt_postgres.postgres__snapshot_string_as_time", "package_name": "dbt_postgres", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__snapshot_string_as_time", "macro_sql": "{% macro postgres__snapshot_string_as_time(timestamp) -%}\n {%- set result = \"'\" ~ timestamp ~ \"'::timestamp without time zone\" -%}\n {{ return(result) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.282811}, "macro.dbt_postgres.postgres__snapshot_get_time": {"unique_id": "macro.dbt_postgres.postgres__snapshot_get_time", "package_name": "dbt_postgres", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__snapshot_get_time", "macro_sql": "{% macro postgres__snapshot_get_time() -%}\n {{ current_timestamp() }}::timestamp without time zone\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.282917}, "macro.dbt_postgres.postgres__make_temp_relation": {"unique_id": "macro.dbt_postgres.postgres__make_temp_relation", "package_name": "dbt_postgres", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__make_temp_relation", "macro_sql": "{% macro postgres__make_temp_relation(base_relation, suffix) %}\n {% set dt = modules.datetime.datetime.now() %}\n {% set dtstring = dt.strftime(\"%H%M%S%f\") %}\n {% set suffix_length = suffix|length + dtstring|length %}\n {% set relation_max_name_length = 63 %}\n {% if suffix_length > relation_max_name_length %}\n {% do exceptions.raise_compiler_error('Temp relation suffix is too long (' ~ suffix|length ~ ' characters). Maximum length is ' ~ (relation_max_name_length - dtstring|length) ~ ' characters.') %}\n {% endif %}\n {% set tmp_identifier = base_relation.identifier[:relation_max_name_length - suffix_length] ~ suffix ~ dtstring %}\n {% do return(base_relation.incorporate(\n path={\n \"identifier\": tmp_identifier,\n \"schema\": none,\n \"database\": none\n })) -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.283942}, "macro.dbt_postgres.postgres_escape_comment": {"unique_id": "macro.dbt_postgres.postgres_escape_comment", "package_name": "dbt_postgres", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres_escape_comment", "macro_sql": "{% macro postgres_escape_comment(comment) -%}\n {% if comment is not string %}\n {% do exceptions.raise_compiler_error('cannot escape a non-string: ' ~ comment) %}\n {% endif %}\n {%- set magic = '$dbt_comment_literal_block$' -%}\n {%- if magic in comment -%}\n {%- do exceptions.raise_compiler_error('The string ' ~ magic ~ ' is not allowed in comments.') -%}\n {%- endif -%}\n {{ magic }}{{ comment }}{{ magic }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.2843862}, "macro.dbt_postgres.postgres__alter_relation_comment": {"unique_id": "macro.dbt_postgres.postgres__alter_relation_comment", "package_name": "dbt_postgres", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__alter_relation_comment", "macro_sql": "{% macro postgres__alter_relation_comment(relation, comment) %}\n {% set escaped_comment = postgres_escape_comment(comment) %}\n comment on {{ relation.type }} {{ relation }} is {{ escaped_comment }};\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres_escape_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.284617}, "macro.dbt_postgres.postgres__alter_column_comment": {"unique_id": "macro.dbt_postgres.postgres__alter_column_comment", "package_name": "dbt_postgres", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/adapters.sql", "original_file_path": "macros/adapters.sql", "name": "postgres__alter_column_comment", "macro_sql": "{% macro postgres__alter_column_comment(relation, column_dict) %}\n {% set existing_columns = adapter.get_columns_in_relation(relation) | map(attribute=\"name\") | list %}\n {% for column_name in column_dict if (column_name in existing_columns) %}\n {% set comment = column_dict[column_name]['description'] %}\n {% set escaped_comment = postgres_escape_comment(comment) %}\n comment on column {{ relation }}.{{ adapter.quote(column_name) if column_dict[column_name]['quote'] else column_name }} is {{ escaped_comment }};\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres_escape_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.285223}, "macro.dbt_postgres.postgres__snapshot_merge_sql": {"unique_id": "macro.dbt_postgres.postgres__snapshot_merge_sql", "package_name": "dbt_postgres", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/postgres", "path": "macros/materializations/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshot_merge.sql", "name": "postgres__snapshot_merge_sql", "macro_sql": "{% macro postgres__snapshot_merge_sql(target, source, insert_cols) -%}\n {%- set insert_cols_csv = insert_cols | join(', ') -%}\n\n update {{ target }}\n set dbt_valid_to = DBT_INTERNAL_SOURCE.dbt_valid_to\n from {{ source }} as DBT_INTERNAL_SOURCE\n where DBT_INTERNAL_SOURCE.dbt_scd_id::text = {{ target }}.dbt_scd_id::text\n and DBT_INTERNAL_SOURCE.dbt_change_type::text in ('update'::text, 'delete'::text)\n and {{ target }}.dbt_valid_to is null;\n\n insert into {{ target }} ({{ insert_cols_csv }})\n select {% for column in insert_cols -%}\n DBT_INTERNAL_SOURCE.{{ column }} {%- if not loop.last %}, {%- endif %}\n {%- endfor %}\n from {{ source }} as DBT_INTERNAL_SOURCE\n where DBT_INTERNAL_SOURCE.dbt_change_type::text = 'insert'::text;\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.286229}, "macro.dbt.run_hooks": {"unique_id": "macro.dbt.run_hooks", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "run_hooks", "macro_sql": "{% macro run_hooks(hooks, inside_transaction=True) %}\n {% for hook in hooks | selectattr('transaction', 'equalto', inside_transaction) %}\n {% if not inside_transaction and loop.first %}\n {% call statement(auto_begin=inside_transaction) %}\n commit;\n {% endcall %}\n {% endif %}\n {% set rendered = render(hook.get('sql')) | trim %}\n {% if (rendered | length) > 0 %}\n {% call statement(auto_begin=inside_transaction) %}\n {{ rendered }}\n {% endcall %}\n {% endif %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.287426}, "macro.dbt.make_hook_config": {"unique_id": "macro.dbt.make_hook_config", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "make_hook_config", "macro_sql": "{% macro make_hook_config(sql, inside_transaction) %}\n {{ tojson({\"sql\": sql, \"transaction\": inside_transaction}) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.287628}, "macro.dbt.before_begin": {"unique_id": "macro.dbt.before_begin", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "before_begin", "macro_sql": "{% macro before_begin(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.287782}, "macro.dbt.in_transaction": {"unique_id": "macro.dbt.in_transaction", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "in_transaction", "macro_sql": "{% macro in_transaction(sql) %}\n {{ make_hook_config(sql, inside_transaction=True) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.287935}, "macro.dbt.after_commit": {"unique_id": "macro.dbt.after_commit", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/hooks.sql", "original_file_path": "macros/materializations/hooks.sql", "name": "after_commit", "macro_sql": "{% macro after_commit(sql) %}\n {{ make_hook_config(sql, inside_transaction=False) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_hook_config"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.288085}, "macro.dbt.set_sql_header": {"unique_id": "macro.dbt.set_sql_header", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "name": "set_sql_header", "macro_sql": "{% macro set_sql_header(config) -%}\n {{ config.set('sql_header', caller()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.288573}, "macro.dbt.should_full_refresh": {"unique_id": "macro.dbt.should_full_refresh", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "name": "should_full_refresh", "macro_sql": "{% macro should_full_refresh() %}\n {% set config_full_refresh = config.get('full_refresh') %}\n {% if config_full_refresh is none %}\n {% set config_full_refresh = flags.FULL_REFRESH %}\n {% endif %}\n {% do return(config_full_refresh) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.288939}, "macro.dbt.should_store_failures": {"unique_id": "macro.dbt.should_store_failures", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/configs.sql", "original_file_path": "macros/materializations/configs.sql", "name": "should_store_failures", "macro_sql": "{% macro should_store_failures() %}\n {% set config_store_failures = config.get('store_failures') %}\n {% if config_store_failures is none %}\n {% set config_store_failures = flags.STORE_FAILURES %}\n {% endif %}\n {% do return(config_store_failures) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.289382}, "macro.dbt.snapshot_merge_sql": {"unique_id": "macro.dbt.snapshot_merge_sql", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshots/snapshot_merge.sql", "name": "snapshot_merge_sql", "macro_sql": "{% macro snapshot_merge_sql(target, source, insert_cols) -%}\n {{ adapter.dispatch('snapshot_merge_sql', 'dbt')(target, source, insert_cols) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__snapshot_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.2905788}, "macro.dbt.default__snapshot_merge_sql": {"unique_id": "macro.dbt.default__snapshot_merge_sql", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshots/snapshot_merge.sql", "name": "default__snapshot_merge_sql", "macro_sql": "{% macro default__snapshot_merge_sql(target, source, insert_cols) -%}\n {%- set insert_cols_csv = insert_cols | join(', ') -%}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on DBT_INTERNAL_SOURCE.dbt_scd_id = DBT_INTERNAL_DEST.dbt_scd_id\n\n when matched\n and DBT_INTERNAL_DEST.dbt_valid_to is null\n and DBT_INTERNAL_SOURCE.dbt_change_type in ('update', 'delete')\n then update\n set dbt_valid_to = DBT_INTERNAL_SOURCE.dbt_valid_to\n\n when not matched\n and DBT_INTERNAL_SOURCE.dbt_change_type = 'insert'\n then insert ({{ insert_cols_csv }})\n values ({{ insert_cols_csv }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.290856}, "macro.dbt.strategy_dispatch": {"unique_id": "macro.dbt.strategy_dispatch", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "strategy_dispatch", "macro_sql": "{% macro strategy_dispatch(name) -%}\n{% set original_name = name %}\n {% if '.' in name %}\n {% set package_name, name = name.split(\".\", 1) %}\n {% else %}\n {% set package_name = none %}\n {% endif %}\n\n {% if package_name is none %}\n {% set package_context = context %}\n {% elif package_name in context %}\n {% set package_context = context[package_name] %}\n {% else %}\n {% set error_msg %}\n Could not find package '{{package_name}}', called with '{{original_name}}'\n {% endset %}\n {{ exceptions.raise_compiler_error(error_msg | trim) }}\n {% endif %}\n\n {%- set search_name = 'snapshot_' ~ name ~ '_strategy' -%}\n\n {% if search_name not in package_context %}\n {% set error_msg %}\n The specified strategy macro '{{name}}' was not found in package '{{ package_name }}'\n {% endset %}\n {{ exceptions.raise_compiler_error(error_msg | trim) }}\n {% endif %}\n {{ return(package_context[search_name]) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.294305}, "macro.dbt.snapshot_hash_arguments": {"unique_id": "macro.dbt.snapshot_hash_arguments", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_hash_arguments", "macro_sql": "{% macro snapshot_hash_arguments(args) -%}\n {{ adapter.dispatch('snapshot_hash_arguments', 'dbt')(args) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.2944891}, "macro.dbt.default__snapshot_hash_arguments": {"unique_id": "macro.dbt.default__snapshot_hash_arguments", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "default__snapshot_hash_arguments", "macro_sql": "{% macro default__snapshot_hash_arguments(args) -%}\n md5({%- for arg in args -%}\n coalesce(cast({{ arg }} as varchar ), '')\n {% if not loop.last %} || '|' || {% endif %}\n {%- endfor -%})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.29472}, "macro.dbt.snapshot_get_time": {"unique_id": "macro.dbt.snapshot_get_time", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_get_time", "macro_sql": "{% macro snapshot_get_time() -%}\n {{ adapter.dispatch('snapshot_get_time', 'dbt')() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.2948742}, "macro.dbt.default__snapshot_get_time": {"unique_id": "macro.dbt.default__snapshot_get_time", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "default__snapshot_get_time", "macro_sql": "{% macro default__snapshot_get_time() -%}\n {{ current_timestamp() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.294973}, "macro.dbt.snapshot_timestamp_strategy": {"unique_id": "macro.dbt.snapshot_timestamp_strategy", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_timestamp_strategy", "macro_sql": "{% macro snapshot_timestamp_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n {% set primary_key = config['unique_key'] %}\n {% set updated_at = config['updated_at'] %}\n {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n\n {#/*\n The snapshot relation might not have an {{ updated_at }} value if the\n snapshot strategy is changed from `check` to `timestamp`. We\n should use a dbt-created column for the comparison in the snapshot\n table instead of assuming that the user-supplied {{ updated_at }}\n will be present in the historical data.\n\n See https://github.com/dbt-labs/dbt-core/issues/2350\n */ #}\n {% set row_changed_expr -%}\n ({{ snapshotted_rel }}.dbt_valid_from < {{ current_rel }}.{{ updated_at }})\n {%- endset %}\n\n {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n {% do return({\n \"unique_key\": primary_key,\n \"updated_at\": updated_at,\n \"row_changed\": row_changed_expr,\n \"scd_id\": scd_id_expr,\n \"invalidate_hard_deletes\": invalidate_hard_deletes\n }) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.295825}, "macro.dbt.snapshot_string_as_time": {"unique_id": "macro.dbt.snapshot_string_as_time", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_string_as_time", "macro_sql": "{% macro snapshot_string_as_time(timestamp) -%}\n {{ adapter.dispatch('snapshot_string_as_time', 'dbt')(timestamp) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__snapshot_string_as_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.295995}, "macro.dbt.default__snapshot_string_as_time": {"unique_id": "macro.dbt.default__snapshot_string_as_time", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "default__snapshot_string_as_time", "macro_sql": "{% macro default__snapshot_string_as_time(timestamp) %}\n {% do exceptions.raise_not_implemented(\n 'snapshot_string_as_time macro not implemented for adapter '+adapter.type()\n ) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.296169}, "macro.dbt.snapshot_check_all_get_existing_columns": {"unique_id": "macro.dbt.snapshot_check_all_get_existing_columns", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_check_all_get_existing_columns", "macro_sql": "{% macro snapshot_check_all_get_existing_columns(node, target_exists) -%}\n {%- set query_columns = get_columns_in_query(node['compiled_sql']) -%}\n {%- if not target_exists -%}\n {# no table yet -> return whatever the query does #}\n {{ return([false, query_columns]) }}\n {%- endif -%}\n {# handle any schema changes #}\n {%- set target_table = node.get('alias', node.get('name')) -%}\n {%- set target_relation = adapter.get_relation(database=node.database, schema=node.schema, identifier=target_table) -%}\n {%- set existing_cols = get_columns_in_query('select * from ' ~ target_relation) -%}\n {%- set ns = namespace() -%} {# handle for-loop scoping with a namespace #}\n {%- set ns.column_added = false -%}\n\n {%- set intersection = [] -%}\n {%- for col in query_columns -%}\n {%- if col in existing_cols -%}\n {%- do intersection.append(col) -%}\n {%- else -%}\n {% set ns.column_added = true %}\n {%- endif -%}\n {%- endfor -%}\n {{ return([ns.column_added, intersection]) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.297167}, "macro.dbt.snapshot_check_strategy": {"unique_id": "macro.dbt.snapshot_check_strategy", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/strategies.sql", "original_file_path": "macros/materializations/snapshots/strategies.sql", "name": "snapshot_check_strategy", "macro_sql": "{% macro snapshot_check_strategy(node, snapshotted_rel, current_rel, config, target_exists) %}\n {% set check_cols_config = config['check_cols'] %}\n {% set primary_key = config['unique_key'] %}\n {% set invalidate_hard_deletes = config.get('invalidate_hard_deletes', false) %}\n \n {% set select_current_time -%}\n select {{ snapshot_get_time() }} as snapshot_start\n {%- endset %}\n\n {#-- don't access the column by name, to avoid dealing with casing issues on snowflake #}\n {%- set now = run_query(select_current_time)[0][0] -%}\n {% if now is none or now is undefined -%}\n {%- do exceptions.raise_compiler_error('Could not get a snapshot start time from the database') -%}\n {%- endif %}\n {% set updated_at = config.get('updated_at', snapshot_string_as_time(now)) %}\n\n {% set column_added = false %}\n\n {% if check_cols_config == 'all' %}\n {% set column_added, check_cols = snapshot_check_all_get_existing_columns(node, target_exists) %}\n {% elif check_cols_config is iterable and (check_cols_config | length) > 0 %}\n {% set check_cols = check_cols_config %}\n {% else %}\n {% do exceptions.raise_compiler_error(\"Invalid value for 'check_cols': \" ~ check_cols_config) %}\n {% endif %}\n\n {%- set row_changed_expr -%}\n (\n {%- if column_added -%}\n TRUE\n {%- else -%}\n {%- for col in check_cols -%}\n {{ snapshotted_rel }}.{{ col }} != {{ current_rel }}.{{ col }}\n or\n (\n (({{ snapshotted_rel }}.{{ col }} is null) and not ({{ current_rel }}.{{ col }} is null))\n or\n ((not {{ snapshotted_rel }}.{{ col }} is null) and ({{ current_rel }}.{{ col }} is null))\n )\n {%- if not loop.last %} or {% endif -%}\n {%- endfor -%}\n {%- endif -%}\n )\n {%- endset %}\n\n {% set scd_id_expr = snapshot_hash_arguments([primary_key, updated_at]) %}\n\n {% do return({\n \"unique_key\": primary_key,\n \"updated_at\": updated_at,\n \"row_changed\": row_changed_expr,\n \"scd_id\": scd_id_expr,\n \"invalidate_hard_deletes\": invalidate_hard_deletes\n }) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.snapshot_get_time", "macro.dbt.run_query", "macro.dbt.snapshot_string_as_time", "macro.dbt.snapshot_check_all_get_existing_columns", "macro.dbt.snapshot_hash_arguments"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.299275}, "macro.dbt.create_columns": {"unique_id": "macro.dbt.create_columns", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "create_columns", "macro_sql": "{% macro create_columns(relation, columns) %}\n {{ adapter.dispatch('create_columns', 'dbt')(relation, columns) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__create_columns"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.302742}, "macro.dbt.default__create_columns": {"unique_id": "macro.dbt.default__create_columns", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "default__create_columns", "macro_sql": "{% macro default__create_columns(relation, columns) %}\n {% for column in columns %}\n {% call statement() %}\n alter table {{ relation }} add column \"{{ column.name }}\" {{ column.data_type }};\n {% endcall %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.303052}, "macro.dbt.post_snapshot": {"unique_id": "macro.dbt.post_snapshot", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "post_snapshot", "macro_sql": "{% macro post_snapshot(staging_relation) %}\n {{ adapter.dispatch('post_snapshot', 'dbt')(staging_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3032289}, "macro.dbt.default__post_snapshot": {"unique_id": "macro.dbt.default__post_snapshot", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "default__post_snapshot", "macro_sql": "{% macro default__post_snapshot(staging_relation) %}\n {# no-op #}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.303317}, "macro.dbt.snapshot_staging_table": {"unique_id": "macro.dbt.snapshot_staging_table", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "snapshot_staging_table", "macro_sql": "{% macro snapshot_staging_table(strategy, source_sql, target_relation) -%}\n {{ adapter.dispatch('snapshot_staging_table', 'dbt')(strategy, source_sql, target_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__snapshot_staging_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3035269}, "macro.dbt.default__snapshot_staging_table": {"unique_id": "macro.dbt.default__snapshot_staging_table", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "default__snapshot_staging_table", "macro_sql": "{% macro default__snapshot_staging_table(strategy, source_sql, target_relation) -%}\n\n with snapshot_query as (\n\n {{ source_sql }}\n\n ),\n\n snapshotted_data as (\n\n select *,\n {{ strategy.unique_key }} as dbt_unique_key\n\n from {{ target_relation }}\n where dbt_valid_to is null\n\n ),\n\n insertions_source_data as (\n\n select\n *,\n {{ strategy.unique_key }} as dbt_unique_key,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to,\n {{ strategy.scd_id }} as dbt_scd_id\n\n from snapshot_query\n ),\n\n updates_source_data as (\n\n select\n *,\n {{ strategy.unique_key }} as dbt_unique_key,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n {{ strategy.updated_at }} as dbt_valid_to\n\n from snapshot_query\n ),\n\n {%- if strategy.invalidate_hard_deletes %}\n\n deletes_source_data as (\n\n select \n *,\n {{ strategy.unique_key }} as dbt_unique_key\n from snapshot_query\n ),\n {% endif %}\n\n insertions as (\n\n select\n 'insert' as dbt_change_type,\n source_data.*\n\n from insertions_source_data as source_data\n left outer join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where snapshotted_data.dbt_unique_key is null\n or (\n snapshotted_data.dbt_unique_key is not null\n and (\n {{ strategy.row_changed }}\n )\n )\n\n ),\n\n updates as (\n\n select\n 'update' as dbt_change_type,\n source_data.*,\n snapshotted_data.dbt_scd_id\n\n from updates_source_data as source_data\n join snapshotted_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where (\n {{ strategy.row_changed }}\n )\n )\n\n {%- if strategy.invalidate_hard_deletes -%}\n ,\n\n deletes as (\n \n select\n 'delete' as dbt_change_type,\n source_data.*,\n {{ snapshot_get_time() }} as dbt_valid_from,\n {{ snapshot_get_time() }} as dbt_updated_at,\n {{ snapshot_get_time() }} as dbt_valid_to,\n snapshotted_data.dbt_scd_id\n \n from snapshotted_data\n left join deletes_source_data as source_data on snapshotted_data.dbt_unique_key = source_data.dbt_unique_key\n where source_data.dbt_unique_key is null\n )\n {%- endif %}\n\n select * from insertions\n union all\n select * from updates\n {%- if strategy.invalidate_hard_deletes %}\n union all\n select * from deletes\n {%- endif %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.snapshot_get_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.30442}, "macro.dbt.build_snapshot_table": {"unique_id": "macro.dbt.build_snapshot_table", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "build_snapshot_table", "macro_sql": "{% macro build_snapshot_table(strategy, sql) -%}\n {{ adapter.dispatch('build_snapshot_table', 'dbt')(strategy, sql) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__build_snapshot_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3046331}, "macro.dbt.default__build_snapshot_table": {"unique_id": "macro.dbt.default__build_snapshot_table", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "default__build_snapshot_table", "macro_sql": "{% macro default__build_snapshot_table(strategy, sql) %}\n\n select *,\n {{ strategy.scd_id }} as dbt_scd_id,\n {{ strategy.updated_at }} as dbt_updated_at,\n {{ strategy.updated_at }} as dbt_valid_from,\n nullif({{ strategy.updated_at }}, {{ strategy.updated_at }}) as dbt_valid_to\n from (\n {{ sql }}\n ) sbq\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3048892}, "macro.dbt.build_snapshot_staging_table": {"unique_id": "macro.dbt.build_snapshot_staging_table", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/helpers.sql", "original_file_path": "macros/materializations/snapshots/helpers.sql", "name": "build_snapshot_staging_table", "macro_sql": "{% macro build_snapshot_staging_table(strategy, sql, target_relation) %}\n {% set tmp_relation = make_temp_relation(target_relation) %}\n\n {% set select = snapshot_staging_table(strategy, sql, target_relation) %}\n\n {% call statement('build_snapshot_staging_relation') %}\n {{ create_table_as(True, tmp_relation, select) }}\n {% endcall %}\n\n {% do return(tmp_relation) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.make_temp_relation", "macro.dbt.snapshot_staging_table", "macro.dbt.statement", "macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.305331}, "macro.dbt.materialization_snapshot_default": {"unique_id": "macro.dbt.materialization_snapshot_default", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshots/snapshot.sql", "original_file_path": "macros/materializations/snapshots/snapshot.sql", "name": "materialization_snapshot_default", "macro_sql": "{% materialization snapshot, default %}\n {%- set config = model['config'] -%}\n\n {%- set target_table = model.get('alias', model.get('name')) -%}\n\n {%- set strategy_name = config.get('strategy') -%}\n {%- set unique_key = config.get('unique_key') %}\n\n {% if not adapter.check_schema_exists(model.database, model.schema) %}\n {% do create_schema(model.database, model.schema) %}\n {% endif %}\n\n {% set target_relation_exists, target_relation = get_or_create_relation(\n database=model.database,\n schema=model.schema,\n identifier=target_table,\n type='table') -%}\n\n {%- if not target_relation.is_table -%}\n {% do exceptions.relation_wrong_type(target_relation, 'table') %}\n {%- endif -%}\n\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set strategy_macro = strategy_dispatch(strategy_name) %}\n {% set strategy = strategy_macro(model, \"snapshotted_data\", \"source_data\", config, target_relation_exists) %}\n\n {% if not target_relation_exists %}\n\n {% set build_sql = build_snapshot_table(strategy, model['compiled_sql']) %}\n {% set final_sql = create_table_as(False, target_relation, build_sql) %}\n\n {% else %}\n\n {{ adapter.valid_snapshot_target(target_relation) }}\n\n {% set staging_table = build_snapshot_staging_table(strategy, sql, target_relation) %}\n\n -- this may no-op if the database does not require column expansion\n {% do adapter.expand_target_column_types(from_relation=staging_table,\n to_relation=target_relation) %}\n\n {% set missing_columns = adapter.get_missing_columns(staging_table, target_relation)\n | rejectattr('name', 'equalto', 'dbt_change_type')\n | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n | rejectattr('name', 'equalto', 'dbt_unique_key')\n | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n | list %}\n\n {% do create_columns(target_relation, missing_columns) %}\n\n {% set source_columns = adapter.get_columns_in_relation(staging_table)\n | rejectattr('name', 'equalto', 'dbt_change_type')\n | rejectattr('name', 'equalto', 'DBT_CHANGE_TYPE')\n | rejectattr('name', 'equalto', 'dbt_unique_key')\n | rejectattr('name', 'equalto', 'DBT_UNIQUE_KEY')\n | list %}\n\n {% set quoted_source_columns = [] %}\n {% for column in source_columns %}\n {% do quoted_source_columns.append(adapter.quote(column.name)) %}\n {% endfor %}\n\n {% set final_sql = snapshot_merge_sql(\n target = target_relation,\n source = staging_table,\n insert_cols = quoted_source_columns\n )\n %}\n\n {% endif %}\n\n {% call statement('main') %}\n {{ final_sql }}\n {% endcall %}\n\n {% do persist_docs(target_relation, model) %}\n\n {% if not target_relation_exists %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {% if staging_table is defined %}\n {% do post_snapshot(staging_table) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_schema", "macro.dbt.get_or_create_relation", "macro.dbt.run_hooks", "macro.dbt.strategy_dispatch", "macro.dbt.build_snapshot_table", "macro.dbt.create_table_as", "macro.dbt.build_snapshot_staging_table", "macro.dbt.create_columns", "macro.dbt.snapshot_merge_sql", "macro.dbt.statement", "macro.dbt.persist_docs", "macro.dbt.create_indexes", "macro.dbt.post_snapshot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.311477}, "macro.dbt.materialization_test_default": {"unique_id": "macro.dbt.materialization_test_default", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/test.sql", "original_file_path": "macros/materializations/tests/test.sql", "name": "materialization_test_default", "macro_sql": "{%- materialization test, default -%}\n\n {% set relations = [] %}\n\n {% if should_store_failures() %}\n\n {% set identifier = model['alias'] %}\n {% set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n {% set target_relation = api.Relation.create(\n identifier=identifier, schema=schema, database=database, type='table') -%} %}\n \n {% if old_relation %}\n {% do adapter.drop_relation(old_relation) %}\n {% endif %}\n \n {% call statement(auto_begin=True) %}\n {{ create_table_as(False, target_relation, sql) }}\n {% endcall %}\n \n {% do relations.append(target_relation) %}\n \n {% set main_sql %}\n select *\n from {{ target_relation }}\n {% endset %}\n \n {{ adapter.commit() }}\n \n {% else %}\n\n {% set main_sql = sql %}\n \n {% endif %}\n\n {% set limit = config.get('limit') %}\n {% set fail_calc = config.get('fail_calc') %}\n {% set warn_if = config.get('warn_if') %}\n {% set error_if = config.get('error_if') %}\n\n {% call statement('main', fetch_result=True) -%}\n\n {{ get_test_sql(main_sql, fail_calc, warn_if, error_if, limit)}}\n\n {%- endcall %}\n \n {{ return({'relations': relations}) }}\n\n{%- endmaterialization -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.should_store_failures", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt.get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.313687}, "macro.dbt.get_test_sql": {"unique_id": "macro.dbt.get_test_sql", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/helpers.sql", "original_file_path": "macros/materializations/tests/helpers.sql", "name": "get_test_sql", "macro_sql": "{% macro get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n {{ adapter.dispatch('get_test_sql', 'dbt')(main_sql, fail_calc, warn_if, error_if, limit) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_test_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3142688}, "macro.dbt.default__get_test_sql": {"unique_id": "macro.dbt.default__get_test_sql", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/helpers.sql", "original_file_path": "macros/materializations/tests/helpers.sql", "name": "default__get_test_sql", "macro_sql": "{% macro default__get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}\n select\n {{ fail_calc }} as failures,\n {{ fail_calc }} {{ warn_if }} as should_warn,\n {{ fail_calc }} {{ error_if }} as should_error\n from (\n {{ main_sql }}\n {{ \"limit \" ~ limit if limit != none }}\n ) dbt_internal_test\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.314589}, "macro.dbt.get_where_subquery": {"unique_id": "macro.dbt.get_where_subquery", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/where_subquery.sql", "original_file_path": "macros/materializations/tests/where_subquery.sql", "name": "get_where_subquery", "macro_sql": "{% macro get_where_subquery(relation) -%}\n {% do return(adapter.dispatch('get_where_subquery', 'dbt')(relation)) %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_where_subquery"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3150332}, "macro.dbt.default__get_where_subquery": {"unique_id": "macro.dbt.default__get_where_subquery", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/tests/where_subquery.sql", "original_file_path": "macros/materializations/tests/where_subquery.sql", "name": "default__get_where_subquery", "macro_sql": "{% macro default__get_where_subquery(relation) -%}\n {% set where = config.get('where', '') %}\n {% if where %}\n {%- set filtered -%}\n (select * from {{ relation }} where {{ where }}) dbt_subquery\n {%- endset -%}\n {% do return(filtered) %}\n {%- else -%}\n {% do return(relation) %}\n {%- endif -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.315419}, "macro.dbt.get_quoted_csv": {"unique_id": "macro.dbt.get_quoted_csv", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "name": "get_quoted_csv", "macro_sql": "{% macro get_quoted_csv(column_names) %}\n \n {% set quoted = [] %}\n {% for col in column_names -%}\n {%- do quoted.append(adapter.quote(col)) -%}\n {%- endfor %}\n\n {%- set dest_cols_csv = quoted | join(', ') -%}\n {{ return(dest_cols_csv) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3162508}, "macro.dbt.diff_columns": {"unique_id": "macro.dbt.diff_columns", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "name": "diff_columns", "macro_sql": "{% macro diff_columns(source_columns, target_columns) %}\n\n {% set result = [] %}\n {% set source_names = source_columns | map(attribute = 'column') | list %}\n {% set target_names = target_columns | map(attribute = 'column') | list %}\n \n {# --check whether the name attribute exists in the target - this does not perform a data type check #}\n {% for sc in source_columns %}\n {% if sc.name not in target_names %}\n {{ result.append(sc) }}\n {% endif %}\n {% endfor %}\n \n {{ return(result) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3167858}, "macro.dbt.diff_column_data_types": {"unique_id": "macro.dbt.diff_column_data_types", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/column_helpers.sql", "original_file_path": "macros/materializations/models/incremental/column_helpers.sql", "name": "diff_column_data_types", "macro_sql": "{% macro diff_column_data_types(source_columns, target_columns) %}\n \n {% set result = [] %}\n {% for sc in source_columns %}\n {% set tc = target_columns | selectattr(\"name\", \"equalto\", sc.name) | list | first %}\n {% if tc %}\n {% if sc.data_type != tc.data_type %}\n {{ result.append( { 'column_name': tc.name, 'new_type': sc.data_type } ) }} \n {% endif %}\n {% endif %}\n {% endfor %}\n\n {{ return(result) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3173919}, "macro.dbt.get_merge_sql": {"unique_id": "macro.dbt.get_merge_sql", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "get_merge_sql", "macro_sql": "{% macro get_merge_sql(target, source, unique_key, dest_columns, predicates=none) -%}\n {{ adapter.dispatch('get_merge_sql', 'dbt')(target, source, unique_key, dest_columns, predicates) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.32012}, "macro.dbt.default__get_merge_sql": {"unique_id": "macro.dbt.default__get_merge_sql", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "default__get_merge_sql", "macro_sql": "{% macro default__get_merge_sql(target, source, unique_key, dest_columns, predicates) -%}\n {%- set predicates = [] if predicates is none else [] + predicates -%}\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n {%- set update_columns = config.get('merge_update_columns', default = dest_columns | map(attribute=\"quoted\") | list) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {% if unique_key %}\n {% set unique_key_match %}\n DBT_INTERNAL_SOURCE.{{ unique_key }} = DBT_INTERNAL_DEST.{{ unique_key }}\n {% endset %}\n {% do predicates.append(unique_key_match) %}\n {% else %}\n {% do predicates.append('FALSE') %}\n {% endif %}\n\n {{ sql_header if sql_header is not none }}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on {{ predicates | join(' and ') }}\n\n {% if unique_key %}\n when matched then update set\n {% for column_name in update_columns -%}\n {{ column_name }} = DBT_INTERNAL_SOURCE.{{ column_name }}\n {%- if not loop.last %}, {%- endif %}\n {%- endfor %}\n {% endif %}\n\n when not matched then insert\n ({{ dest_cols_csv }})\n values\n ({{ dest_cols_csv }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.321255}, "macro.dbt.get_delete_insert_merge_sql": {"unique_id": "macro.dbt.get_delete_insert_merge_sql", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "get_delete_insert_merge_sql", "macro_sql": "{% macro get_delete_insert_merge_sql(target, source, unique_key, dest_columns) -%}\n {{ adapter.dispatch('get_delete_insert_merge_sql', 'dbt')(target, source, unique_key, dest_columns) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_delete_insert_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3214872}, "macro.dbt.default__get_delete_insert_merge_sql": {"unique_id": "macro.dbt.default__get_delete_insert_merge_sql", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "default__get_delete_insert_merge_sql", "macro_sql": "{% macro default__get_delete_insert_merge_sql(target, source, unique_key, dest_columns) -%}\n\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n\n {% if unique_key is not none %}\n delete from {{ target }}\n where ({{ unique_key }}) in (\n select ({{ unique_key }})\n from {{ source }}\n );\n {% endif %}\n\n insert into {{ target }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ source }}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.321895}, "macro.dbt.get_insert_overwrite_merge_sql": {"unique_id": "macro.dbt.get_insert_overwrite_merge_sql", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "get_insert_overwrite_merge_sql", "macro_sql": "{% macro get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header=false) -%}\n {{ adapter.dispatch('get_insert_overwrite_merge_sql', 'dbt')(target, source, dest_columns, predicates, include_sql_header) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_insert_overwrite_merge_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.322159}, "macro.dbt.default__get_insert_overwrite_merge_sql": {"unique_id": "macro.dbt.default__get_insert_overwrite_merge_sql", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/merge.sql", "original_file_path": "macros/materializations/models/incremental/merge.sql", "name": "default__get_insert_overwrite_merge_sql", "macro_sql": "{% macro default__get_insert_overwrite_merge_sql(target, source, dest_columns, predicates, include_sql_header) -%}\n {%- set predicates = [] if predicates is none else [] + predicates -%}\n {%- set dest_cols_csv = get_quoted_csv(dest_columns | map(attribute=\"name\")) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none and include_sql_header }}\n\n merge into {{ target }} as DBT_INTERNAL_DEST\n using {{ source }} as DBT_INTERNAL_SOURCE\n on FALSE\n\n when not matched by source\n {% if predicates %} and {{ predicates | join(' and ') }} {% endif %}\n then delete\n\n when not matched then insert\n ({{ dest_cols_csv }})\n values\n ({{ dest_cols_csv }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_quoted_csv"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3227782}, "macro.dbt.is_incremental": {"unique_id": "macro.dbt.is_incremental", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/is_incremental.sql", "original_file_path": "macros/materializations/models/incremental/is_incremental.sql", "name": "is_incremental", "macro_sql": "{% macro is_incremental() %}\n {#-- do not run introspective queries in parsing #}\n {% if not execute %}\n {{ return(False) }}\n {% else %}\n {% set relation = adapter.get_relation(this.database, this.schema, this.table) %}\n {{ return(relation is not none\n and relation.type == 'table'\n and model.config.materialized == 'incremental'\n and not should_full_refresh()) }}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.should_full_refresh"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3235059}, "macro.dbt.materialization_incremental_default": {"unique_id": "macro.dbt.materialization_incremental_default", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/incremental.sql", "original_file_path": "macros/materializations/models/incremental/incremental.sql", "name": "materialization_incremental_default", "macro_sql": "{% materialization incremental, default -%}\n\n {% set unique_key = config.get('unique_key') %}\n\n {% set target_relation = this.incorporate(type='table') %}\n {% set existing_relation = load_relation(this) %}\n {% set tmp_relation = make_temp_relation(target_relation) %}\n {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n {% set on_schema_change = incremental_validate_on_schema_change(config.get('on_schema_change'), default='ignore') %}\n\n {% set tmp_identifier = model['name'] + '__dbt_tmp' %}\n {% set backup_identifier = model['name'] + \"__dbt_backup\" %}\n\n -- the intermediate_ and backup_ relations should not already exist in the database; get_relation\n -- will return None in that case. Otherwise, we get a relation that we can drop\n -- later, before we try to use this name for the current operation. This has to happen before\n -- BEGIN, in a separate transaction\n {% set preexisting_intermediate_relation = adapter.get_relation(identifier=tmp_identifier, \n schema=schema,\n database=database) %} \n {% set preexisting_backup_relation = adapter.get_relation(identifier=backup_identifier,\n schema=schema,\n database=database) %}\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n {% set to_drop = [] %}\n\n {# -- first check whether we want to full refresh for source view or config reasons #}\n {% set trigger_full_refresh = (full_refresh_mode or existing_relation.is_view) %}\n\n {% if existing_relation is none %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n{% elif trigger_full_refresh %}\n {#-- Make sure the backup doesn't exist so we don't encounter issues with the rename below #}\n {% set tmp_identifier = model['name'] + '__dbt_tmp' %}\n {% set backup_identifier = model['name'] + '__dbt_backup' %}\n {% set intermediate_relation = existing_relation.incorporate(path={\"identifier\": tmp_identifier}) %}\n {% set backup_relation = existing_relation.incorporate(path={\"identifier\": backup_identifier}) %}\n\n {% set build_sql = create_table_as(False, intermediate_relation, sql) %}\n {% set need_swap = true %}\n {% do to_drop.append(backup_relation) %}\n {% else %}\n {% do run_query(create_table_as(True, tmp_relation, sql)) %}\n {% do adapter.expand_target_column_types(\n from_relation=tmp_relation,\n to_relation=target_relation) %}\n {#-- Process schema changes. Returns dict of changes if successful. Use source columns for upserting/merging --#}\n {% set dest_columns = process_schema_changes(on_schema_change, tmp_relation, existing_relation) %}\n {% if not dest_columns %}\n {% set dest_columns = adapter.get_columns_in_relation(existing_relation) %}\n {% endif %}\n {% set build_sql = get_delete_insert_merge_sql(target_relation, tmp_relation, unique_key, dest_columns) %}\n \n {% endif %}\n\n {% call statement(\"main\") %}\n {{ build_sql }}\n {% endcall %}\n\n {% if need_swap %} \n {% do adapter.rename_relation(target_relation, backup_relation) %} \n {% do adapter.rename_relation(intermediate_relation, target_relation) %} \n {% endif %}\n\n {% do persist_docs(target_relation, model) %}\n\n {% if existing_relation is none or existing_relation.is_view or should_full_refresh() %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {% do adapter.commit() %}\n\n {% for rel in to_drop %}\n {% do adapter.drop_relation(rel) %}\n {% endfor %}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.load_relation", "macro.dbt.make_temp_relation", "macro.dbt.should_full_refresh", "macro.dbt.incremental_validate_on_schema_change", "macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.create_table_as", "macro.dbt.run_query", "macro.dbt.process_schema_changes", "macro.dbt.get_delete_insert_merge_sql", "macro.dbt.statement", "macro.dbt.persist_docs", "macro.dbt.create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.328397}, "macro.dbt.incremental_validate_on_schema_change": {"unique_id": "macro.dbt.incremental_validate_on_schema_change", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "name": "incremental_validate_on_schema_change", "macro_sql": "{% macro incremental_validate_on_schema_change(on_schema_change, default='ignore') %}\n \n {% if on_schema_change not in ['sync_all_columns', 'append_new_columns', 'fail', 'ignore'] %}\n \n {% set log_message = 'Invalid value for on_schema_change (%s) specified. Setting default value of %s.' % (on_schema_change, default) %}\n {% do log(log_message) %}\n \n {{ return(default) }}\n\n {% else %}\n\n {{ return(on_schema_change) }}\n \n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.333065}, "macro.dbt.check_for_schema_changes": {"unique_id": "macro.dbt.check_for_schema_changes", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "name": "check_for_schema_changes", "macro_sql": "{% macro check_for_schema_changes(source_relation, target_relation) %}\n \n {% set schema_changed = False %}\n \n {%- set source_columns = adapter.get_columns_in_relation(source_relation) -%}\n {%- set target_columns = adapter.get_columns_in_relation(target_relation) -%}\n {%- set source_not_in_target = diff_columns(source_columns, target_columns) -%}\n {%- set target_not_in_source = diff_columns(target_columns, source_columns) -%}\n\n {% set new_target_types = diff_column_data_types(source_columns, target_columns) %}\n\n {% if source_not_in_target != [] %}\n {% set schema_changed = True %}\n {% elif target_not_in_source != [] or new_target_types != [] %}\n {% set schema_changed = True %}\n {% elif new_target_types != [] %}\n {% set schema_changed = True %}\n {% endif %}\n \n {% set changes_dict = {\n 'schema_changed': schema_changed,\n 'source_not_in_target': source_not_in_target,\n 'target_not_in_source': target_not_in_source,\n 'source_columns': source_columns,\n 'target_columns': target_columns,\n 'new_target_types': new_target_types\n } %}\n\n {% set msg %}\n In {{ target_relation }}:\n Schema changed: {{ schema_changed }}\n Source columns not in target: {{ source_not_in_target }}\n Target columns not in source: {{ target_not_in_source }}\n New column types: {{ new_target_types }}\n {% endset %}\n \n {% do log(msg) %}\n\n {{ return(changes_dict) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.diff_columns", "macro.dbt.diff_column_data_types"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.334292}, "macro.dbt.sync_column_schemas": {"unique_id": "macro.dbt.sync_column_schemas", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "name": "sync_column_schemas", "macro_sql": "{% macro sync_column_schemas(on_schema_change, target_relation, schema_changes_dict) %}\n \n {%- set add_to_target_arr = schema_changes_dict['source_not_in_target'] -%}\n\n {%- if on_schema_change == 'append_new_columns'-%}\n {%- if add_to_target_arr | length > 0 -%}\n {%- do alter_relation_add_remove_columns(target_relation, add_to_target_arr, none) -%}\n {%- endif -%}\n \n {% elif on_schema_change == 'sync_all_columns' %}\n {%- set remove_from_target_arr = schema_changes_dict['target_not_in_source'] -%}\n {%- set new_target_types = schema_changes_dict['new_target_types'] -%}\n \n {% if add_to_target_arr | length > 0 or remove_from_target_arr | length > 0 %} \n {%- do alter_relation_add_remove_columns(target_relation, add_to_target_arr, remove_from_target_arr) -%}\n {% endif %}\n\n {% if new_target_types != [] %}\n {% for ntt in new_target_types %}\n {% set column_name = ntt['column_name'] %}\n {% set new_type = ntt['new_type'] %}\n {% do alter_column_type(target_relation, column_name, new_type) %}\n {% endfor %}\n {% endif %}\n \n {% endif %}\n\n {% set schema_change_message %}\n In {{ target_relation }}:\n Schema change approach: {{ on_schema_change }}\n Columns added: {{ add_to_target_arr }}\n Columns removed: {{ remove_from_target_arr }}\n Data types changed: {{ new_target_types }}\n {% endset %}\n \n {% do log(schema_change_message) %}\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.alter_relation_add_remove_columns", "macro.dbt.alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3354602}, "macro.dbt.process_schema_changes": {"unique_id": "macro.dbt.process_schema_changes", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/incremental/on_schema_change.sql", "original_file_path": "macros/materializations/models/incremental/on_schema_change.sql", "name": "process_schema_changes", "macro_sql": "{% macro process_schema_changes(on_schema_change, source_relation, target_relation) %}\n \n {% if on_schema_change == 'ignore' %}\n\n {{ return({}) }}\n\n {% else %}\n \n {% set schema_changes_dict = check_for_schema_changes(source_relation, target_relation) %}\n \n {% if schema_changes_dict['schema_changed'] %}\n \n {% if on_schema_change == 'fail' %}\n \n {% set fail_msg %}\n The source and target schemas on this incremental model are out of sync!\n They can be reconciled in several ways: \n - set the `on_schema_change` config to either append_new_columns or sync_all_columns, depending on your situation.\n - Re-run the incremental model with `full_refresh: True` to update the target schema.\n - update the schema manually and re-run the process.\n {% endset %}\n \n {% do exceptions.raise_compiler_error(fail_msg) %}\n \n {# -- unless we ignore, run the sync operation per the config #}\n {% else %}\n \n {% do sync_column_schemas(on_schema_change, target_relation, schema_changes_dict) %}\n \n {% endif %}\n \n {% endif %}\n\n {{ return(schema_changes_dict['source_columns']) }}\n \n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.check_for_schema_changes", "macro.dbt.sync_column_schemas"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.336182}, "macro.dbt.materialization_table_default": {"unique_id": "macro.dbt.materialization_table_default", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/table.sql", "original_file_path": "macros/materializations/models/table/table.sql", "name": "materialization_table_default", "macro_sql": "{% materialization table, default %}\n {%- set identifier = model['alias'] -%}\n {%- set tmp_identifier = model['name'] + '__dbt_tmp' -%}\n {%- set backup_identifier = model['name'] + '__dbt_backup' -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier,\n schema=schema,\n database=database,\n type='table') -%}\n {%- set intermediate_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema,\n database=database,\n type='table') -%}\n -- the intermediate_relation should not already exist in the database; get_relation\n -- will return None in that case. Otherwise, we get a relation that we can drop\n -- later, before we try to use this name for the current operation\n {%- set preexisting_intermediate_relation = adapter.get_relation(identifier=tmp_identifier, \n schema=schema,\n database=database) -%}\n /*\n See ../view/view.sql for more information about this relation.\n */\n {%- set backup_relation_type = 'table' if old_relation is none else old_relation.type -%}\n {%- set backup_relation = api.Relation.create(identifier=backup_identifier,\n schema=schema,\n database=database,\n type=backup_relation_type) -%}\n -- as above, the backup_relation should not already exist\n {%- set preexisting_backup_relation = adapter.get_relation(identifier=backup_identifier,\n schema=schema,\n database=database) -%}\n\n\n -- drop the temp relations if they exist already in the database\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% call statement('main') -%}\n {{ get_create_table_as_sql(False, intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n {% if old_relation is not none %}\n {{ adapter.rename_relation(old_relation, backup_relation) }}\n {% endif %}\n\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {% do create_indexes(target_relation) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {% do persist_docs(target_relation, model) %}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n -- finally, drop the existing/backup relation after the commit\n {{ drop_relation_if_exists(backup_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.drop_relation_if_exists", "macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.get_create_table_as_sql", "macro.dbt.create_indexes", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.339823}, "macro.dbt.get_create_table_as_sql": {"unique_id": "macro.dbt.get_create_table_as_sql", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.sql", "name": "get_create_table_as_sql", "macro_sql": "{% macro get_create_table_as_sql(temporary, relation, sql) -%}\n {{ adapter.dispatch('get_create_table_as_sql', 'dbt')(temporary, relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_create_table_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.34032}, "macro.dbt.default__get_create_table_as_sql": {"unique_id": "macro.dbt.default__get_create_table_as_sql", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.sql", "name": "default__get_create_table_as_sql", "macro_sql": "{% macro default__get_create_table_as_sql(temporary, relation, sql) -%}\n {{ return(create_table_as(temporary, relation, sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.340502}, "macro.dbt.create_table_as": {"unique_id": "macro.dbt.create_table_as", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.sql", "name": "create_table_as", "macro_sql": "{% macro create_table_as(temporary, relation, sql) -%}\n {{ adapter.dispatch('create_table_as', 'dbt')(temporary, relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__create_table_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.340697}, "macro.dbt.default__create_table_as": {"unique_id": "macro.dbt.default__create_table_as", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/table/create_table_as.sql", "original_file_path": "macros/materializations/models/table/create_table_as.sql", "name": "default__create_table_as", "macro_sql": "{% macro default__create_table_as(temporary, relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n \n {{ sql_header if sql_header is not none }}\n \n create {% if temporary: -%}temporary{%- endif %} table\n {{ relation.include(database=(not temporary), schema=(not temporary)) }}\n as (\n {{ sql }}\n );\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.341108}, "macro.dbt.materialization_view_default": {"unique_id": "macro.dbt.materialization_view_default", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/view.sql", "original_file_path": "macros/materializations/models/view/view.sql", "name": "materialization_view_default", "macro_sql": "{%- materialization view, default -%}\n\n {%- set identifier = model['alias'] -%}\n {%- set tmp_identifier = model['name'] + '__dbt_tmp' -%}\n {%- set backup_identifier = model['name'] + '__dbt_backup' -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier, schema=schema, database=database,\n type='view') -%}\n {%- set intermediate_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema, database=database, type='view') -%}\n -- the intermediate_relation should not already exist in the database; get_relation\n -- will return None in that case. Otherwise, we get a relation that we can drop\n -- later, before we try to use this name for the current operation\n {%- set preexisting_intermediate_relation = adapter.get_relation(identifier=tmp_identifier, \n schema=schema,\n database=database) -%}\n /*\n This relation (probably) doesn't exist yet. If it does exist, it's a leftover from\n a previous run, and we're going to try to drop it immediately. At the end of this\n materialization, we're going to rename the \"old_relation\" to this identifier,\n and then we're going to drop it. In order to make sure we run the correct one of:\n - drop view ...\n - drop table ...\n\n We need to set the type of this relation to be the type of the old_relation, if it exists,\n or else \"view\" as a sane default if it does not. Note that if the old_relation does not\n exist, then there is nothing to move out of the way and subsequentally drop. In that case,\n this relation will be effectively unused.\n */\n {%- set backup_relation_type = 'view' if old_relation is none else old_relation.type -%}\n {%- set backup_relation = api.Relation.create(identifier=backup_identifier,\n schema=schema, database=database,\n type=backup_relation_type) -%}\n -- as above, the backup_relation should not already exist\n {%- set preexisting_backup_relation = adapter.get_relation(identifier=backup_identifier,\n schema=schema,\n database=database) -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- drop the temp relations if they exist already in the database\n {{ drop_relation_if_exists(preexisting_intermediate_relation) }}\n {{ drop_relation_if_exists(preexisting_backup_relation) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% call statement('main') -%}\n {{ create_view_as(intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n -- move the existing view out of the way\n {% if old_relation is not none %}\n {{ adapter.rename_relation(old_relation, backup_relation) }}\n {% endif %}\n {{ adapter.rename_relation(intermediate_relation, target_relation) }}\n\n {% do persist_docs(target_relation, model) %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {{ drop_relation_if_exists(backup_relation) }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{%- endmaterialization -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.drop_relation_if_exists", "macro.dbt.statement", "macro.dbt.create_view_as", "macro.dbt.persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.345077}, "macro.dbt.handle_existing_table": {"unique_id": "macro.dbt.handle_existing_table", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/helpers.sql", "original_file_path": "macros/materializations/models/view/helpers.sql", "name": "handle_existing_table", "macro_sql": "{% macro handle_existing_table(full_refresh, old_relation) %}\n {{ adapter.dispatch('handle_existing_table', 'dbt')(full_refresh, old_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__handle_existing_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.34562}, "macro.dbt.default__handle_existing_table": {"unique_id": "macro.dbt.default__handle_existing_table", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/helpers.sql", "original_file_path": "macros/materializations/models/view/helpers.sql", "name": "default__handle_existing_table", "macro_sql": "{% macro default__handle_existing_table(full_refresh, old_relation) %}\n {{ log(\"Dropping relation \" ~ old_relation ~ \" because it is of type \" ~ old_relation.type) }}\n {{ adapter.drop_relation(old_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.345849}, "macro.dbt.create_or_replace_view": {"unique_id": "macro.dbt.create_or_replace_view", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_or_replace_view.sql", "original_file_path": "macros/materializations/models/view/create_or_replace_view.sql", "name": "create_or_replace_view", "macro_sql": "{% macro create_or_replace_view() %}\n {%- set identifier = model['alias'] -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {%- set target_relation = api.Relation.create(\n identifier=identifier, schema=schema, database=database,\n type='view') -%}\n\n {{ run_hooks(pre_hooks) }}\n\n -- If there's a table with the same name and we weren't told to full refresh,\n -- that's an error. If we were told to full refresh, drop it. This behavior differs\n -- for Snowflake and BigQuery, so multiple dispatch is used.\n {%- if old_relation is not none and old_relation.is_table -%}\n {{ handle_existing_table(should_full_refresh(), old_relation) }}\n {%- endif -%}\n\n -- build model\n {% call statement('main') -%}\n {{ get_create_view_as_sql(target_relation, sql) }}\n {%- endcall %}\n\n {{ run_hooks(post_hooks) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.handle_existing_table", "macro.dbt.should_full_refresh", "macro.dbt.statement", "macro.dbt.get_create_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.347146}, "macro.dbt.get_create_view_as_sql": {"unique_id": "macro.dbt.get_create_view_as_sql", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.sql", "name": "get_create_view_as_sql", "macro_sql": "{% macro get_create_view_as_sql(relation, sql) -%}\n {{ adapter.dispatch('get_create_view_as_sql', 'dbt')(relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_create_view_as_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.347587}, "macro.dbt.default__get_create_view_as_sql": {"unique_id": "macro.dbt.default__get_create_view_as_sql", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.sql", "name": "default__get_create_view_as_sql", "macro_sql": "{% macro default__get_create_view_as_sql(relation, sql) -%}\n {{ return(create_view_as(relation, sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.347754}, "macro.dbt.create_view_as": {"unique_id": "macro.dbt.create_view_as", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.sql", "name": "create_view_as", "macro_sql": "{% macro create_view_as(relation, sql) -%}\n {{ adapter.dispatch('create_view_as', 'dbt')(relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__create_view_as"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.347939}, "macro.dbt.default__create_view_as": {"unique_id": "macro.dbt.default__create_view_as", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/models/view/create_view_as.sql", "original_file_path": "macros/materializations/models/view/create_view_as.sql", "name": "default__create_view_as", "macro_sql": "{% macro default__create_view_as(relation, sql) -%}\n {%- set sql_header = config.get('sql_header', none) -%}\n\n {{ sql_header if sql_header is not none }}\n create view {{ relation }} as (\n {{ sql }}\n );\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.348207}, "macro.dbt.materialization_seed_default": {"unique_id": "macro.dbt.materialization_seed_default", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/seed.sql", "original_file_path": "macros/materializations/seeds/seed.sql", "name": "materialization_seed_default", "macro_sql": "{% materialization seed, default %}\n\n {%- set identifier = model['alias'] -%}\n {%- set full_refresh_mode = (should_full_refresh()) -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n\n {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {%- set agate_table = load_agate_table() -%}\n {%- do store_result('agate_table', response='OK', agate_table=agate_table) -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- `BEGIN` happens here:\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\n\n -- build model\n {% set create_table_sql = \"\" %}\n {% if exists_as_view %}\n {{ exceptions.raise_compiler_error(\"Cannot seed to '{}', it is a view\".format(old_relation)) }}\n {% elif exists_as_table %}\n {% set create_table_sql = reset_csv_table(model, full_refresh_mode, old_relation, agate_table) %}\n {% else %}\n {% set create_table_sql = create_csv_table(model, agate_table) %}\n {% endif %}\n\n {% set code = 'CREATE' if full_refresh_mode else 'INSERT' %}\n {% set rows_affected = (agate_table.rows | length) %}\n {% set sql = load_csv_rows(model, agate_table) %}\n\n {% call noop_statement('main', code ~ ' ' ~ rows_affected, code, rows_affected) %}\n {{ create_table_sql }};\n -- dbt seed --\n {{ sql }}\n {% endcall %}\n\n {% set target_relation = this.incorporate(type='table') %}\n {% do persist_docs(target_relation, model) %}\n\n {% if full_refresh_mode or not exists_as_table %}\n {% do create_indexes(target_relation) %}\n {% endif %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n -- `COMMIT` happens here\n {{ adapter.commit() }}\n\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.should_full_refresh", "macro.dbt.run_hooks", "macro.dbt.reset_csv_table", "macro.dbt.create_csv_table", "macro.dbt.load_csv_rows", "macro.dbt.noop_statement", "macro.dbt.persist_docs", "macro.dbt.create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.351178}, "macro.dbt.create_csv_table": {"unique_id": "macro.dbt.create_csv_table", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "create_csv_table", "macro_sql": "{% macro create_csv_table(model, agate_table) -%}\n {{ adapter.dispatch('create_csv_table', 'dbt')(model, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3553011}, "macro.dbt.default__create_csv_table": {"unique_id": "macro.dbt.default__create_csv_table", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__create_csv_table", "macro_sql": "{% macro default__create_csv_table(model, agate_table) %}\n {%- set column_override = model['config'].get('column_types', {}) -%}\n {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n\n {% set sql %}\n create table {{ this.render() }} (\n {%- for col_name in agate_table.column_names -%}\n {%- set inferred_type = adapter.convert_type(agate_table, loop.index0) -%}\n {%- set type = column_override.get(col_name, inferred_type) -%}\n {%- set column_name = (col_name | string) -%}\n {{ adapter.quote_seed_column(column_name, quote_seed_column) }} {{ type }} {%- if not loop.last -%}, {%- endif -%}\n {%- endfor -%}\n )\n {% endset %}\n\n {% call statement('_') -%}\n {{ sql }}\n {%- endcall %}\n\n {{ return(sql) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3562398}, "macro.dbt.reset_csv_table": {"unique_id": "macro.dbt.reset_csv_table", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "reset_csv_table", "macro_sql": "{% macro reset_csv_table(model, full_refresh, old_relation, agate_table) -%}\n {{ adapter.dispatch('reset_csv_table', 'dbt')(model, full_refresh, old_relation, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__reset_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.356471}, "macro.dbt.default__reset_csv_table": {"unique_id": "macro.dbt.default__reset_csv_table", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__reset_csv_table", "macro_sql": "{% macro default__reset_csv_table(model, full_refresh, old_relation, agate_table) %}\n {% set sql = \"\" %}\n {% if full_refresh %}\n {{ adapter.drop_relation(old_relation) }}\n {% set sql = create_csv_table(model, agate_table) %}\n {% else %}\n {{ adapter.truncate_relation(old_relation) }}\n {% set sql = \"truncate table \" ~ old_relation %}\n {% endif %}\n\n {{ return(sql) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.create_csv_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3569438}, "macro.dbt.get_binding_char": {"unique_id": "macro.dbt.get_binding_char", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "get_binding_char", "macro_sql": "{% macro get_binding_char() -%}\n {{ adapter.dispatch('get_binding_char', 'dbt')() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_binding_char"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3570821}, "macro.dbt.default__get_binding_char": {"unique_id": "macro.dbt.default__get_binding_char", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__get_binding_char", "macro_sql": "{% macro default__get_binding_char() %}\n {{ return('%s') }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3571892}, "macro.dbt.get_batch_size": {"unique_id": "macro.dbt.get_batch_size", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "get_batch_size", "macro_sql": "{% macro get_batch_size() -%}\n {{ return(adapter.dispatch('get_batch_size', 'dbt')()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_batch_size"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.357343}, "macro.dbt.default__get_batch_size": {"unique_id": "macro.dbt.default__get_batch_size", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__get_batch_size", "macro_sql": "{% macro default__get_batch_size() %}\n {{ return(10000) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.357452}, "macro.dbt.get_seed_column_quoted_csv": {"unique_id": "macro.dbt.get_seed_column_quoted_csv", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "get_seed_column_quoted_csv", "macro_sql": "{% macro get_seed_column_quoted_csv(model, column_names) %}\n {%- set quote_seed_column = model['config'].get('quote_columns', None) -%}\n {% set quoted = [] %}\n {% for col in column_names -%}\n {%- do quoted.append(adapter.quote_seed_column(col, quote_seed_column)) -%}\n {%- endfor %}\n\n {%- set dest_cols_csv = quoted | join(', ') -%}\n {{ return(dest_cols_csv) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.357923}, "macro.dbt.load_csv_rows": {"unique_id": "macro.dbt.load_csv_rows", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "load_csv_rows", "macro_sql": "{% macro load_csv_rows(model, agate_table) -%}\n {{ adapter.dispatch('load_csv_rows', 'dbt')(model, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__load_csv_rows"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3581812}, "macro.dbt.default__load_csv_rows": {"unique_id": "macro.dbt.default__load_csv_rows", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/materializations/seeds/helpers.sql", "original_file_path": "macros/materializations/seeds/helpers.sql", "name": "default__load_csv_rows", "macro_sql": "{% macro default__load_csv_rows(model, agate_table) %}\n\n {% set batch_size = get_batch_size() %}\n\n {% set cols_sql = get_seed_column_quoted_csv(model, agate_table.column_names) %}\n {% set bindings = [] %}\n\n {% set statements = [] %}\n\n {% for chunk in agate_table.rows | batch(batch_size) %}\n {% set bindings = [] %}\n\n {% for row in chunk %}\n {% do bindings.extend(row) %}\n {% endfor %}\n\n {% set sql %}\n insert into {{ this.render() }} ({{ cols_sql }}) values\n {% for row in chunk -%}\n ({%- for column in agate_table.column_names -%}\n {{ get_binding_char() }}\n {%- if not loop.last%},{%- endif %}\n {%- endfor -%})\n {%- if not loop.last%},{%- endif %}\n {%- endfor %}\n {% endset %}\n\n {% do adapter.add_query(sql, bindings=bindings, abridge_sql_log=True) %}\n\n {% if loop.index0 == 0 %}\n {% do statements.append(sql) %}\n {% endif %}\n {% endfor %}\n\n {# Return SQL so we can render it out into the compiled files #}\n {{ return(statements[0]) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_batch_size", "macro.dbt.get_seed_column_quoted_csv", "macro.dbt.get_binding_char"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3594408}, "macro.dbt.generate_alias_name": {"unique_id": "macro.dbt.generate_alias_name", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_alias.sql", "original_file_path": "macros/get_custom_name/get_custom_alias.sql", "name": "generate_alias_name", "macro_sql": "{% macro generate_alias_name(custom_alias_name=none, node=none) -%}\n {% do return(adapter.dispatch('generate_alias_name', 'dbt')(custom_alias_name, node)) %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__generate_alias_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.360063}, "macro.dbt.default__generate_alias_name": {"unique_id": "macro.dbt.default__generate_alias_name", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_alias.sql", "original_file_path": "macros/get_custom_name/get_custom_alias.sql", "name": "default__generate_alias_name", "macro_sql": "{% macro default__generate_alias_name(custom_alias_name=none, node=none) -%}\n\n {%- if custom_alias_name is none -%}\n\n {{ node.name }}\n\n {%- else -%}\n\n {{ custom_alias_name | trim }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3603048}, "macro.dbt.generate_schema_name": {"unique_id": "macro.dbt.generate_schema_name", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "name": "generate_schema_name", "macro_sql": "{% macro generate_schema_name(custom_schema_name=none, node=none) -%}\n {{ return(adapter.dispatch('generate_schema_name', 'dbt')(custom_schema_name, node)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__generate_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.36092}, "macro.dbt.default__generate_schema_name": {"unique_id": "macro.dbt.default__generate_schema_name", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "name": "default__generate_schema_name", "macro_sql": "{% macro default__generate_schema_name(custom_schema_name, node) -%}\n\n {%- set default_schema = target.schema -%}\n {%- if custom_schema_name is none -%}\n\n {{ default_schema }}\n\n {%- else -%}\n\n {{ default_schema }}_{{ custom_schema_name | trim }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.361186}, "macro.dbt.generate_schema_name_for_env": {"unique_id": "macro.dbt.generate_schema_name_for_env", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_schema.sql", "original_file_path": "macros/get_custom_name/get_custom_schema.sql", "name": "generate_schema_name_for_env", "macro_sql": "{% macro generate_schema_name_for_env(custom_schema_name, node) -%}\n\n {%- set default_schema = target.schema -%}\n {%- if target.name == 'prod' and custom_schema_name is not none -%}\n\n {{ custom_schema_name | trim }}\n\n {%- else -%}\n\n {{ default_schema }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.361475}, "macro.dbt.generate_database_name": {"unique_id": "macro.dbt.generate_database_name", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_database.sql", "original_file_path": "macros/get_custom_name/get_custom_database.sql", "name": "generate_database_name", "macro_sql": "{% macro generate_database_name(custom_database_name=none, node=none) -%}\n {% do return(adapter.dispatch('generate_database_name', 'dbt')(custom_database_name, node)) %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__generate_database_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.361949}, "macro.dbt.default__generate_database_name": {"unique_id": "macro.dbt.default__generate_database_name", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/get_custom_name/get_custom_database.sql", "original_file_path": "macros/get_custom_name/get_custom_database.sql", "name": "default__generate_database_name", "macro_sql": "{% macro default__generate_database_name(custom_database_name=none, node=none) -%}\n {%- set default_database = target.database -%}\n {%- if custom_database_name is none -%}\n\n {{ default_database }}\n\n {%- else -%}\n\n {{ custom_database_name }}\n\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3622022}, "macro.dbt.default__test_relationships": {"unique_id": "macro.dbt.default__test_relationships", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/generic_test_sql/relationships.sql", "original_file_path": "macros/generic_test_sql/relationships.sql", "name": "default__test_relationships", "macro_sql": "{% macro default__test_relationships(model, column_name, to, field) %}\n\nwith child as (\n select {{ column_name }} as from_field\n from {{ model }}\n where {{ column_name }} is not null\n),\n\nparent as (\n select {{ field }} as to_field\n from {{ to }}\n)\n\nselect\n from_field\n\nfrom child\nleft join parent\n on child.from_field = parent.to_field\n\nwhere parent.to_field is null\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3626392}, "macro.dbt.default__test_not_null": {"unique_id": "macro.dbt.default__test_not_null", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/generic_test_sql/not_null.sql", "original_file_path": "macros/generic_test_sql/not_null.sql", "name": "default__test_not_null", "macro_sql": "{% macro default__test_not_null(model, column_name) %}\n\nselect *\nfrom {{ model }}\nwhere {{ column_name }} is null\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.362894}, "macro.dbt.default__test_unique": {"unique_id": "macro.dbt.default__test_unique", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/generic_test_sql/unique.sql", "original_file_path": "macros/generic_test_sql/unique.sql", "name": "default__test_unique", "macro_sql": "{% macro default__test_unique(model, column_name) %}\n\nselect\n {{ column_name }} as unique_field,\n count(*) as n_records\n\nfrom {{ model }}\nwhere {{ column_name }} is not null\ngroup by {{ column_name }}\nhaving count(*) > 1\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3632078}, "macro.dbt.default__test_accepted_values": {"unique_id": "macro.dbt.default__test_accepted_values", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/generic_test_sql/accepted_values.sql", "original_file_path": "macros/generic_test_sql/accepted_values.sql", "name": "default__test_accepted_values", "macro_sql": "{% macro default__test_accepted_values(model, column_name, values, quote=True) %}\n\nwith all_values as (\n\n select\n {{ column_name }} as value_field,\n count(*) as n_records\n\n from {{ model }}\n group by {{ column_name }}\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n {% for value in values -%}\n {% if quote -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {%- endfor %}\n)\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.363848}, "macro.dbt.statement": {"unique_id": "macro.dbt.statement", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "name": "statement", "macro_sql": "{% macro statement(name=None, fetch_result=False, auto_begin=True) -%}\n {%- if execute: -%}\n {%- set sql = caller() -%}\n\n {%- if name == 'main' -%}\n {{ log('Writing runtime SQL for node \"{}\"'.format(model['unique_id'])) }}\n {{ write(sql) }}\n {%- endif -%}\n\n {%- set res, table = adapter.execute(sql, auto_begin=auto_begin, fetch=fetch_result) -%}\n {%- if name is not none -%}\n {{ store_result(name, response=res, agate_table=table) }}\n {%- endif -%}\n\n {%- endif -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.365024}, "macro.dbt.noop_statement": {"unique_id": "macro.dbt.noop_statement", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "name": "noop_statement", "macro_sql": "{% macro noop_statement(name=None, message=None, code=None, rows_affected=None, res=None) -%}\n {%- set sql = caller() -%}\n\n {%- if name == 'main' -%}\n {{ log('Writing runtime SQL for node \"{}\"'.format(model['unique_id'])) }}\n {{ write(sql) }}\n {%- endif -%}\n\n {%- if name is not none -%}\n {{ store_raw_result(name, message=message, code=code, rows_affected=rows_affected, agate_table=res) }}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.365621}, "macro.dbt.run_query": {"unique_id": "macro.dbt.run_query", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/etc/statement.sql", "original_file_path": "macros/etc/statement.sql", "name": "run_query", "macro_sql": "{% macro run_query(sql) %}\n {% call statement(\"run_query_statement\", fetch_result=true, auto_begin=false) %}\n {{ sql }}\n {% endcall %}\n\n {% do return(load_result(\"run_query_statement\").table) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3659258}, "macro.dbt.convert_datetime": {"unique_id": "macro.dbt.convert_datetime", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "convert_datetime", "macro_sql": "{% macro convert_datetime(date_str, date_fmt) %}\n\n {% set error_msg -%}\n The provided partition date '{{ date_str }}' does not match the expected format '{{ date_fmt }}'\n {%- endset %}\n\n {% set res = try_or_compiler_error(error_msg, modules.datetime.datetime.strptime, date_str.strip(), date_fmt) %}\n {{ return(res) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.367738}, "macro.dbt.dates_in_range": {"unique_id": "macro.dbt.dates_in_range", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "dates_in_range", "macro_sql": "{% macro dates_in_range(start_date_str, end_date_str=none, in_fmt=\"%Y%m%d\", out_fmt=\"%Y%m%d\") %}\n {% set end_date_str = start_date_str if end_date_str is none else end_date_str %}\n\n {% set start_date = convert_datetime(start_date_str, in_fmt) %}\n {% set end_date = convert_datetime(end_date_str, in_fmt) %}\n\n {% set day_count = (end_date - start_date).days %}\n {% if day_count < 0 %}\n {% set msg -%}\n Partiton start date is after the end date ({{ start_date }}, {{ end_date }})\n {%- endset %}\n\n {{ exceptions.raise_compiler_error(msg, model) }}\n {% endif %}\n\n {% set date_list = [] %}\n {% for i in range(0, day_count + 1) %}\n {% set the_date = (modules.datetime.timedelta(days=i) + start_date) %}\n {% if not out_fmt %}\n {% set _ = date_list.append(the_date) %}\n {% else %}\n {% set _ = date_list.append(the_date.strftime(out_fmt)) %}\n {% endif %}\n {% endfor %}\n\n {{ return(date_list) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.convert_datetime"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.36912}, "macro.dbt.partition_range": {"unique_id": "macro.dbt.partition_range", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "partition_range", "macro_sql": "{% macro partition_range(raw_partition_date, date_fmt='%Y%m%d') %}\n {% set partition_range = (raw_partition_date | string).split(\",\") %}\n\n {% if (partition_range | length) == 1 %}\n {% set start_date = partition_range[0] %}\n {% set end_date = none %}\n {% elif (partition_range | length) == 2 %}\n {% set start_date = partition_range[0] %}\n {% set end_date = partition_range[1] %}\n {% else %}\n {{ exceptions.raise_compiler_error(\"Invalid partition time. Expected format: {Start Date}[,{End Date}]. Got: \" ~ raw_partition_date) }}\n {% endif %}\n\n {{ return(dates_in_range(start_date, end_date, in_fmt=date_fmt)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.dates_in_range"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.369951}, "macro.dbt.py_current_timestring": {"unique_id": "macro.dbt.py_current_timestring", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/etc/datetime.sql", "original_file_path": "macros/etc/datetime.sql", "name": "py_current_timestring", "macro_sql": "{% macro py_current_timestring() %}\n {% set dt = modules.datetime.datetime.now() %}\n {% do return(dt.strftime(\"%Y%m%d%H%M%S%f\")) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.370219}, "macro.dbt.create_schema": {"unique_id": "macro.dbt.create_schema", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "name": "create_schema", "macro_sql": "{% macro create_schema(relation) -%}\n {{ adapter.dispatch('create_schema', 'dbt')(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__create_schema"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3708029}, "macro.dbt.default__create_schema": {"unique_id": "macro.dbt.default__create_schema", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "name": "default__create_schema", "macro_sql": "{% macro default__create_schema(relation) -%}\n {%- call statement('create_schema') -%}\n create schema if not exists {{ relation.without_identifier() }}\n {% endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.371006}, "macro.dbt.drop_schema": {"unique_id": "macro.dbt.drop_schema", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "name": "drop_schema", "macro_sql": "{% macro drop_schema(relation) -%}\n {{ adapter.dispatch('drop_schema', 'dbt')(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__drop_schema"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.371179}, "macro.dbt.default__drop_schema": {"unique_id": "macro.dbt.default__drop_schema", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/schema.sql", "original_file_path": "macros/adapters/schema.sql", "name": "default__drop_schema", "macro_sql": "{% macro default__drop_schema(relation) -%}\n {%- call statement('drop_schema') -%}\n drop schema if exists {{ relation.without_identifier() }} cascade\n {% endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.371367}, "macro.dbt.get_create_index_sql": {"unique_id": "macro.dbt.get_create_index_sql", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "name": "get_create_index_sql", "macro_sql": "{% macro get_create_index_sql(relation, index_dict) -%}\n {{ return(adapter.dispatch('get_create_index_sql', 'dbt')(relation, index_dict)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_create_index_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.371944}, "macro.dbt.default__get_create_index_sql": {"unique_id": "macro.dbt.default__get_create_index_sql", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "name": "default__get_create_index_sql", "macro_sql": "{% macro default__get_create_index_sql(relation, index_dict) -%}\n {% do return(None) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3720891}, "macro.dbt.create_indexes": {"unique_id": "macro.dbt.create_indexes", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "name": "create_indexes", "macro_sql": "{% macro create_indexes(relation) -%}\n {{ adapter.dispatch('create_indexes', 'dbt')(relation) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__create_indexes"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.372252}, "macro.dbt.default__create_indexes": {"unique_id": "macro.dbt.default__create_indexes", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/indexes.sql", "original_file_path": "macros/adapters/indexes.sql", "name": "default__create_indexes", "macro_sql": "{% macro default__create_indexes(relation) -%}\n {%- set _indexes = config.get('indexes', default=[]) -%}\n\n {% for _index_dict in _indexes %}\n {% set create_index_sql = get_create_index_sql(relation, _index_dict) %}\n {% if create_index_sql %}\n {% do run_query(create_index_sql) %}\n {% endif %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.get_create_index_sql", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.372671}, "macro.dbt.make_temp_relation": {"unique_id": "macro.dbt.make_temp_relation", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "make_temp_relation", "macro_sql": "{% macro make_temp_relation(base_relation, suffix='__dbt_tmp') %}\n {{ return(adapter.dispatch('make_temp_relation', 'dbt')(base_relation, suffix))}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__make_temp_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3744}, "macro.dbt.default__make_temp_relation": {"unique_id": "macro.dbt.default__make_temp_relation", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__make_temp_relation", "macro_sql": "{% macro default__make_temp_relation(base_relation, suffix) %}\n {% set tmp_identifier = base_relation.identifier ~ suffix %}\n {% set tmp_relation = base_relation.incorporate(\n path={\"identifier\": tmp_identifier}) -%}\n\n {% do return(tmp_relation) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.374723}, "macro.dbt.drop_relation": {"unique_id": "macro.dbt.drop_relation", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "drop_relation", "macro_sql": "{% macro drop_relation(relation) -%}\n {{ return(adapter.dispatch('drop_relation', 'dbt')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__drop_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.374919}, "macro.dbt.default__drop_relation": {"unique_id": "macro.dbt.default__drop_relation", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__drop_relation", "macro_sql": "{% macro default__drop_relation(relation) -%}\n {% call statement('drop_relation', auto_begin=False) -%}\n drop {{ relation.type }} if exists {{ relation }} cascade\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3751428}, "macro.dbt.truncate_relation": {"unique_id": "macro.dbt.truncate_relation", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "truncate_relation", "macro_sql": "{% macro truncate_relation(relation) -%}\n {{ return(adapter.dispatch('truncate_relation', 'dbt')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__truncate_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.375335}, "macro.dbt.default__truncate_relation": {"unique_id": "macro.dbt.default__truncate_relation", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__truncate_relation", "macro_sql": "{% macro default__truncate_relation(relation) -%}\n {% call statement('truncate_relation') -%}\n truncate table {{ relation }}\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.375496}, "macro.dbt.rename_relation": {"unique_id": "macro.dbt.rename_relation", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "rename_relation", "macro_sql": "{% macro rename_relation(from_relation, to_relation) -%}\n {{ return(adapter.dispatch('rename_relation', 'dbt')(from_relation, to_relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__rename_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.375702}, "macro.dbt.default__rename_relation": {"unique_id": "macro.dbt.default__rename_relation", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__rename_relation", "macro_sql": "{% macro default__rename_relation(from_relation, to_relation) -%}\n {% set target_name = adapter.quote_as_configured(to_relation.identifier, 'identifier') %}\n {% call statement('rename_relation') -%}\n alter table {{ from_relation }} rename to {{ target_name }}\n {%- endcall %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.376006}, "macro.dbt.get_or_create_relation": {"unique_id": "macro.dbt.get_or_create_relation", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "get_or_create_relation", "macro_sql": "{% macro get_or_create_relation(database, schema, identifier, type) -%}\n {{ return(adapter.dispatch('get_or_create_relation', 'dbt')(database, schema, identifier, type)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_or_create_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.376266}, "macro.dbt.default__get_or_create_relation": {"unique_id": "macro.dbt.default__get_or_create_relation", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "default__get_or_create_relation", "macro_sql": "{% macro default__get_or_create_relation(database, schema, identifier, type) %}\n {%- set target_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) %}\n\n {% if target_relation %}\n {% do return([true, target_relation]) %}\n {% endif %}\n\n {%- set new_relation = api.Relation.create(\n database=database,\n schema=schema,\n identifier=identifier,\n type=type\n ) -%}\n {% do return([false, new_relation]) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3769531}, "macro.dbt.load_relation": {"unique_id": "macro.dbt.load_relation", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "load_relation", "macro_sql": "{% macro load_relation(relation) %}\n {% do return(adapter.get_relation(\n database=relation.database,\n schema=relation.schema,\n identifier=relation.identifier\n )) -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3771992}, "macro.dbt.drop_relation_if_exists": {"unique_id": "macro.dbt.drop_relation_if_exists", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/relation.sql", "original_file_path": "macros/adapters/relation.sql", "name": "drop_relation_if_exists", "macro_sql": "{% macro drop_relation_if_exists(relation) %}\n {% if relation is not none %}\n {{ adapter.drop_relation(relation) }}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3774028}, "macro.dbt.current_timestamp": {"unique_id": "macro.dbt.current_timestamp", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "name": "current_timestamp", "macro_sql": "{% macro current_timestamp() -%}\n {{ adapter.dispatch('current_timestamp', 'dbt')() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3780322}, "macro.dbt.default__current_timestamp": {"unique_id": "macro.dbt.default__current_timestamp", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "name": "default__current_timestamp", "macro_sql": "{% macro default__current_timestamp() -%}\n {{ exceptions.raise_not_implemented(\n 'current_timestamp macro not implemented for adapter '+adapter.type()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.378187}, "macro.dbt.collect_freshness": {"unique_id": "macro.dbt.collect_freshness", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "name": "collect_freshness", "macro_sql": "{% macro collect_freshness(source, loaded_at_field, filter) %}\n {{ return(adapter.dispatch('collect_freshness', 'dbt')(source, loaded_at_field, filter))}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__collect_freshness"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3784251}, "macro.dbt.default__collect_freshness": {"unique_id": "macro.dbt.default__collect_freshness", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/freshness.sql", "original_file_path": "macros/adapters/freshness.sql", "name": "default__collect_freshness", "macro_sql": "{% macro default__collect_freshness(source, loaded_at_field, filter) %}\n {% call statement('collect_freshness', fetch_result=True, auto_begin=False) -%}\n select\n max({{ loaded_at_field }}) as max_loaded_at,\n {{ current_timestamp() }} as snapshotted_at\n from {{ source }}\n {% if filter %}\n where {{ filter }}\n {% endif %}\n {% endcall %}\n {{ return(load_result('collect_freshness').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3788722}, "macro.dbt.alter_column_comment": {"unique_id": "macro.dbt.alter_column_comment", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "alter_column_comment", "macro_sql": "{% macro alter_column_comment(relation, column_dict) -%}\n {{ return(adapter.dispatch('alter_column_comment', 'dbt')(relation, column_dict)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.379649}, "macro.dbt.default__alter_column_comment": {"unique_id": "macro.dbt.default__alter_column_comment", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "default__alter_column_comment", "macro_sql": "{% macro default__alter_column_comment(relation, column_dict) -%}\n {{ exceptions.raise_not_implemented(\n 'alter_column_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.379829}, "macro.dbt.alter_relation_comment": {"unique_id": "macro.dbt.alter_relation_comment", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "alter_relation_comment", "macro_sql": "{% macro alter_relation_comment(relation, relation_comment) -%}\n {{ return(adapter.dispatch('alter_relation_comment', 'dbt')(relation, relation_comment)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__alter_relation_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.380043}, "macro.dbt.default__alter_relation_comment": {"unique_id": "macro.dbt.default__alter_relation_comment", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "default__alter_relation_comment", "macro_sql": "{% macro default__alter_relation_comment(relation, relation_comment) -%}\n {{ exceptions.raise_not_implemented(\n 'alter_relation_comment macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.380219}, "macro.dbt.persist_docs": {"unique_id": "macro.dbt.persist_docs", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "persist_docs", "macro_sql": "{% macro persist_docs(relation, model, for_relation=true, for_columns=true) -%}\n {{ return(adapter.dispatch('persist_docs', 'dbt')(relation, model, for_relation, for_columns)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__persist_docs"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.380507}, "macro.dbt.default__persist_docs": {"unique_id": "macro.dbt.default__persist_docs", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/persist_docs.sql", "original_file_path": "macros/adapters/persist_docs.sql", "name": "default__persist_docs", "macro_sql": "{% macro default__persist_docs(relation, model, for_relation, for_columns) -%}\n {% if for_relation and config.persist_relation_docs() and model.description %}\n {% do run_query(alter_relation_comment(relation, model.description)) %}\n {% endif %}\n\n {% if for_columns and config.persist_column_docs() and model.columns %}\n {% do run_query(alter_column_comment(relation, model.columns)) %}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query", "macro.dbt.alter_relation_comment", "macro.dbt.alter_column_comment"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3810198}, "macro.dbt.get_catalog": {"unique_id": "macro.dbt.get_catalog", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "get_catalog", "macro_sql": "{% macro get_catalog(information_schema, schemas) -%}\n {{ return(adapter.dispatch('get_catalog', 'dbt')(information_schema, schemas)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_catalog"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3826308}, "macro.dbt.default__get_catalog": {"unique_id": "macro.dbt.default__get_catalog", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__get_catalog", "macro_sql": "{% macro default__get_catalog(information_schema, schemas) -%}\n\n {% set typename = adapter.type() %}\n {% set msg -%}\n get_catalog not implemented for {{ typename }}\n {%- endset %}\n\n {{ exceptions.raise_compiler_error(msg) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.382897}, "macro.dbt.information_schema_name": {"unique_id": "macro.dbt.information_schema_name", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "information_schema_name", "macro_sql": "{% macro information_schema_name(database) %}\n {{ return(adapter.dispatch('information_schema_name', 'dbt')(database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__information_schema_name"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.383086}, "macro.dbt.default__information_schema_name": {"unique_id": "macro.dbt.default__information_schema_name", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__information_schema_name", "macro_sql": "{% macro default__information_schema_name(database) -%}\n {%- if database -%}\n {{ database }}.INFORMATION_SCHEMA\n {%- else -%}\n INFORMATION_SCHEMA\n {%- endif -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.383241}, "macro.dbt.list_schemas": {"unique_id": "macro.dbt.list_schemas", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "list_schemas", "macro_sql": "{% macro list_schemas(database) -%}\n {{ return(adapter.dispatch('list_schemas', 'dbt')(database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__list_schemas"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.383421}, "macro.dbt.default__list_schemas": {"unique_id": "macro.dbt.default__list_schemas", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__list_schemas", "macro_sql": "{% macro default__list_schemas(database) -%}\n {% set sql %}\n select distinct schema_name\n from {{ information_schema_name(database) }}.SCHEMATA\n where catalog_name ilike '{{ database }}'\n {% endset %}\n {{ return(run_query(sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.information_schema_name", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.383667}, "macro.dbt.check_schema_exists": {"unique_id": "macro.dbt.check_schema_exists", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "check_schema_exists", "macro_sql": "{% macro check_schema_exists(information_schema, schema) -%}\n {{ return(adapter.dispatch('check_schema_exists', 'dbt')(information_schema, schema)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__check_schema_exists"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.383886}, "macro.dbt.default__check_schema_exists": {"unique_id": "macro.dbt.default__check_schema_exists", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__check_schema_exists", "macro_sql": "{% macro default__check_schema_exists(information_schema, schema) -%}\n {% set sql -%}\n select count(*)\n from {{ information_schema.replace(information_schema_view='SCHEMATA') }}\n where catalog_name='{{ information_schema.database }}'\n and schema_name='{{ schema }}'\n {%- endset %}\n {{ return(run_query(sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.replace", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.384289}, "macro.dbt.list_relations_without_caching": {"unique_id": "macro.dbt.list_relations_without_caching", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "list_relations_without_caching", "macro_sql": "{% macro list_relations_without_caching(schema_relation) %}\n {{ return(adapter.dispatch('list_relations_without_caching', 'dbt')(schema_relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__list_relations_without_caching"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3844821}, "macro.dbt.default__list_relations_without_caching": {"unique_id": "macro.dbt.default__list_relations_without_caching", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/metadata.sql", "original_file_path": "macros/adapters/metadata.sql", "name": "default__list_relations_without_caching", "macro_sql": "{% macro default__list_relations_without_caching(schema_relation) %}\n {{ exceptions.raise_not_implemented(\n 'list_relations_without_caching macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3846421}, "macro.dbt.get_columns_in_relation": {"unique_id": "macro.dbt.get_columns_in_relation", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "get_columns_in_relation", "macro_sql": "{% macro get_columns_in_relation(relation) -%}\n {{ return(adapter.dispatch('get_columns_in_relation', 'dbt')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_postgres.postgres__get_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.386494}, "macro.dbt.default__get_columns_in_relation": {"unique_id": "macro.dbt.default__get_columns_in_relation", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "default__get_columns_in_relation", "macro_sql": "{% macro default__get_columns_in_relation(relation) -%}\n {{ exceptions.raise_not_implemented(\n 'get_columns_in_relation macro not implemented for adapter '+adapter.type()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.38666}, "macro.dbt.sql_convert_columns_in_relation": {"unique_id": "macro.dbt.sql_convert_columns_in_relation", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "sql_convert_columns_in_relation", "macro_sql": "{% macro sql_convert_columns_in_relation(table) -%}\n {% set columns = [] %}\n {% for row in table %}\n {% do columns.append(api.Column(*row)) %}\n {% endfor %}\n {{ return(columns) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.386979}, "macro.dbt.get_columns_in_query": {"unique_id": "macro.dbt.get_columns_in_query", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "get_columns_in_query", "macro_sql": "{% macro get_columns_in_query(select_sql) -%}\n {{ return(adapter.dispatch('get_columns_in_query', 'dbt')(select_sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__get_columns_in_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3871639}, "macro.dbt.default__get_columns_in_query": {"unique_id": "macro.dbt.default__get_columns_in_query", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "default__get_columns_in_query", "macro_sql": "{% macro default__get_columns_in_query(select_sql) %}\n {% call statement('get_columns_in_query', fetch_result=True, auto_begin=False) -%}\n select * from (\n {{ select_sql }}\n ) as __dbt_sbq\n where false\n limit 0\n {% endcall %}\n\n {{ return(load_result('get_columns_in_query').table.columns | map(attribute='name') | list) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.38751}, "macro.dbt.alter_column_type": {"unique_id": "macro.dbt.alter_column_type", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "alter_column_type", "macro_sql": "{% macro alter_column_type(relation, column_name, new_column_type) -%}\n {{ return(adapter.dispatch('alter_column_type', 'dbt')(relation, column_name, new_column_type)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__alter_column_type"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.387743}, "macro.dbt.default__alter_column_type": {"unique_id": "macro.dbt.default__alter_column_type", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "default__alter_column_type", "macro_sql": "{% macro default__alter_column_type(relation, column_name, new_column_type) -%}\n {#\n 1. Create a new column (w/ temp name and correct type)\n 2. Copy data over to it\n 3. Drop the existing column (cascade!)\n 4. Rename the new column to existing column\n #}\n {%- set tmp_column = column_name + \"__dbt_alter\" -%}\n\n {% call statement('alter_column_type') %}\n alter table {{ relation }} add column {{ adapter.quote(tmp_column) }} {{ new_column_type }};\n update {{ relation }} set {{ adapter.quote(tmp_column) }} = {{ adapter.quote(column_name) }};\n alter table {{ relation }} drop column {{ adapter.quote(column_name) }} cascade;\n alter table {{ relation }} rename column {{ adapter.quote(tmp_column) }} to {{ adapter.quote(column_name) }}\n {% endcall %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.38835}, "macro.dbt.alter_relation_add_remove_columns": {"unique_id": "macro.dbt.alter_relation_add_remove_columns", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "alter_relation_add_remove_columns", "macro_sql": "{% macro alter_relation_add_remove_columns(relation, add_columns = none, remove_columns = none) -%}\n {{ return(adapter.dispatch('alter_relation_add_remove_columns', 'dbt')(relation, add_columns, remove_columns)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__alter_relation_add_remove_columns"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.388612}, "macro.dbt.default__alter_relation_add_remove_columns": {"unique_id": "macro.dbt.default__alter_relation_add_remove_columns", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "macros/adapters/columns.sql", "original_file_path": "macros/adapters/columns.sql", "name": "default__alter_relation_add_remove_columns", "macro_sql": "{% macro default__alter_relation_add_remove_columns(relation, add_columns, remove_columns) %}\n \n {% if add_columns is none %}\n {% set add_columns = [] %}\n {% endif %}\n {% if remove_columns is none %}\n {% set remove_columns = [] %}\n {% endif %}\n \n {% set sql -%}\n \n alter {{ relation.type }} {{ relation }}\n \n {% for column in add_columns %}\n add column {{ column.name }} {{ column.data_type }}{{ ',' if not loop.last }}\n {% endfor %}{{ ',' if add_columns and remove_columns }}\n \n {% for column in remove_columns %}\n drop column {{ column.name }}{{ ',' if not loop.last }}\n {% endfor %}\n \n {%- endset -%}\n\n {% do run_query(sql) %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.389418}, "macro.dbt.test_unique": {"unique_id": "macro.dbt.test_unique", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "name": "test_unique", "macro_sql": "{% test unique(model, column_name) %}\n {% set macro = adapter.dispatch('test_unique', 'dbt') %}\n {{ macro(model, column_name) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__test_unique"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.390081}, "macro.dbt.test_not_null": {"unique_id": "macro.dbt.test_not_null", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "name": "test_not_null", "macro_sql": "{% test not_null(model, column_name) %}\n {% set macro = adapter.dispatch('test_not_null', 'dbt') %}\n {{ macro(model, column_name) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__test_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.39032}, "macro.dbt.test_accepted_values": {"unique_id": "macro.dbt.test_accepted_values", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "name": "test_accepted_values", "macro_sql": "{% test accepted_values(model, column_name, values, quote=True) %}\n {% set macro = adapter.dispatch('test_accepted_values', 'dbt') %}\n {{ macro(model, column_name, values, quote) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__test_accepted_values"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.390611}, "macro.dbt.test_relationships": {"unique_id": "macro.dbt.test_relationships", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "tests/generic/builtin.sql", "original_file_path": "tests/generic/builtin.sql", "name": "test_relationships", "macro_sql": "{% test relationships(model, column_name, to, field) %}\n {% set macro = adapter.dispatch('test_relationships', 'dbt') %}\n {{ macro(model, column_name, to, field) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.default__test_relationships"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3908951}, "macro.dbt_utils.except": {"unique_id": "macro.dbt_utils.except", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/except.sql", "original_file_path": "macros/cross_db_utils/except.sql", "name": "except", "macro_sql": "{% macro except() %}\n {{ return(adapter.dispatch('except', 'dbt_utils')()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__except"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.391241}, "macro.dbt_utils.default__except": {"unique_id": "macro.dbt_utils.default__except", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/except.sql", "original_file_path": "macros/cross_db_utils/except.sql", "name": "default__except", "macro_sql": "{% macro default__except() %}\n\n except\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.391326}, "macro.dbt_utils.bigquery__except": {"unique_id": "macro.dbt_utils.bigquery__except", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/except.sql", "original_file_path": "macros/cross_db_utils/except.sql", "name": "bigquery__except", "macro_sql": "{% macro bigquery__except() %}\n\n except distinct\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3913999}, "macro.dbt_utils.replace": {"unique_id": "macro.dbt_utils.replace", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/replace.sql", "original_file_path": "macros/cross_db_utils/replace.sql", "name": "replace", "macro_sql": "{% macro replace(field, old_chars, new_chars) -%}\n {{ return(adapter.dispatch('replace', 'dbt_utils') (field, old_chars, new_chars)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__replace"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.391818}, "macro.dbt_utils.default__replace": {"unique_id": "macro.dbt_utils.default__replace", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/replace.sql", "original_file_path": "macros/cross_db_utils/replace.sql", "name": "default__replace", "macro_sql": "{% macro default__replace(field, old_chars, new_chars) %}\n\n replace(\n {{ field }},\n {{ old_chars }},\n {{ new_chars }}\n )\n \n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.391983}, "macro.dbt_utils.concat": {"unique_id": "macro.dbt_utils.concat", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/concat.sql", "original_file_path": "macros/cross_db_utils/concat.sql", "name": "concat", "macro_sql": "{% macro concat(fields) -%}\n {{ return(adapter.dispatch('concat', 'dbt_utils')(fields)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__concat"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.392311}, "macro.dbt_utils.default__concat": {"unique_id": "macro.dbt_utils.default__concat", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/concat.sql", "original_file_path": "macros/cross_db_utils/concat.sql", "name": "default__concat", "macro_sql": "{% macro default__concat(fields) -%}\n {{ fields|join(' || ') }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.392535}, "macro.dbt_utils.type_string": {"unique_id": "macro.dbt_utils.type_string", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_string", "macro_sql": "\n\n{%- macro type_string() -%}\n {{ return(adapter.dispatch('type_string', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.postgres__type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3932748}, "macro.dbt_utils.default__type_string": {"unique_id": "macro.dbt_utils.default__type_string", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_string", "macro_sql": "{% macro default__type_string() %}\n string\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.393348}, "macro.dbt_utils.redshift__type_string": {"unique_id": "macro.dbt_utils.redshift__type_string", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "redshift__type_string", "macro_sql": "\n\n{%- macro redshift__type_string() -%}\n varchar\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.393418}, "macro.dbt_utils.postgres__type_string": {"unique_id": "macro.dbt_utils.postgres__type_string", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "postgres__type_string", "macro_sql": "{% macro postgres__type_string() %}\n varchar\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.393486}, "macro.dbt_utils.snowflake__type_string": {"unique_id": "macro.dbt_utils.snowflake__type_string", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "snowflake__type_string", "macro_sql": "{% macro snowflake__type_string() %}\n varchar\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3935559}, "macro.dbt_utils.type_timestamp": {"unique_id": "macro.dbt_utils.type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_timestamp", "macro_sql": "\n\n{%- macro type_timestamp() -%}\n {{ return(adapter.dispatch('type_timestamp', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.postgres__type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.393714}, "macro.dbt_utils.default__type_timestamp": {"unique_id": "macro.dbt_utils.default__type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_timestamp", "macro_sql": "{% macro default__type_timestamp() %}\n timestamp\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.39379}, "macro.dbt_utils.postgres__type_timestamp": {"unique_id": "macro.dbt_utils.postgres__type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "postgres__type_timestamp", "macro_sql": "{% macro postgres__type_timestamp() %}\n timestamp without time zone\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.393861}, "macro.dbt_utils.snowflake__type_timestamp": {"unique_id": "macro.dbt_utils.snowflake__type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "snowflake__type_timestamp", "macro_sql": "{% macro snowflake__type_timestamp() %}\n timestamp_ntz\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3939588}, "macro.dbt_utils.type_float": {"unique_id": "macro.dbt_utils.type_float", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_float", "macro_sql": "\n\n{%- macro type_float() -%}\n {{ return(adapter.dispatch('type_float', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__type_float"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.39413}, "macro.dbt_utils.default__type_float": {"unique_id": "macro.dbt_utils.default__type_float", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_float", "macro_sql": "{% macro default__type_float() %}\n float\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.394204}, "macro.dbt_utils.bigquery__type_float": {"unique_id": "macro.dbt_utils.bigquery__type_float", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_float", "macro_sql": "{% macro bigquery__type_float() %}\n float64\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3942778}, "macro.dbt_utils.type_numeric": {"unique_id": "macro.dbt_utils.type_numeric", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_numeric", "macro_sql": "\n\n{%- macro type_numeric() -%}\n {{ return(adapter.dispatch('type_numeric', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3944378}, "macro.dbt_utils.default__type_numeric": {"unique_id": "macro.dbt_utils.default__type_numeric", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_numeric", "macro_sql": "{% macro default__type_numeric() %}\n numeric(28, 6)\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.39451}, "macro.dbt_utils.bigquery__type_numeric": {"unique_id": "macro.dbt_utils.bigquery__type_numeric", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_numeric", "macro_sql": "{% macro bigquery__type_numeric() %}\n numeric\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.394578}, "macro.dbt_utils.type_bigint": {"unique_id": "macro.dbt_utils.type_bigint", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_bigint", "macro_sql": "\n\n{%- macro type_bigint() -%}\n {{ return(adapter.dispatch('type_bigint', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__type_bigint"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.394738}, "macro.dbt_utils.default__type_bigint": {"unique_id": "macro.dbt_utils.default__type_bigint", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_bigint", "macro_sql": "{% macro default__type_bigint() %}\n bigint\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3948119}, "macro.dbt_utils.bigquery__type_bigint": {"unique_id": "macro.dbt_utils.bigquery__type_bigint", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_bigint", "macro_sql": "{% macro bigquery__type_bigint() %}\n int64\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3948789}, "macro.dbt_utils.type_int": {"unique_id": "macro.dbt_utils.type_int", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "type_int", "macro_sql": "\n\n{%- macro type_int() -%}\n {{ return(adapter.dispatch('type_int', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__type_int"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.395285}, "macro.dbt_utils.default__type_int": {"unique_id": "macro.dbt_utils.default__type_int", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "default__type_int", "macro_sql": "{% macro default__type_int() %}\n int\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.395359}, "macro.dbt_utils.bigquery__type_int": {"unique_id": "macro.dbt_utils.bigquery__type_int", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datatypes.sql", "original_file_path": "macros/cross_db_utils/datatypes.sql", "name": "bigquery__type_int", "macro_sql": "{% macro bigquery__type_int() %}\n int64\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.395427}, "macro.dbt_utils._is_relation": {"unique_id": "macro.dbt_utils._is_relation", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/_is_relation.sql", "original_file_path": "macros/cross_db_utils/_is_relation.sql", "name": "_is_relation", "macro_sql": "{% macro _is_relation(obj, macro) %}\n {%- if not (obj is mapping and obj.get('metadata', {}).get('type', '').endswith('Relation')) -%}\n {%- do exceptions.raise_compiler_error(\"Macro \" ~ macro ~ \" expected a Relation but received the value: \" ~ obj) -%}\n {%- endif -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.396023}, "macro.dbt_utils.cast_array_to_string": {"unique_id": "macro.dbt_utils.cast_array_to_string", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_array_to_string.sql", "original_file_path": "macros/cross_db_utils/cast_array_to_string.sql", "name": "cast_array_to_string", "macro_sql": "{% macro cast_array_to_string(array) %}\n {{ adapter.dispatch('cast_array_to_string', 'dbt_utils') (array) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.postgres__cast_array_to_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3964942}, "macro.dbt_utils.default__cast_array_to_string": {"unique_id": "macro.dbt_utils.default__cast_array_to_string", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_array_to_string.sql", "original_file_path": "macros/cross_db_utils/cast_array_to_string.sql", "name": "default__cast_array_to_string", "macro_sql": "{% macro default__cast_array_to_string(array) %}\n cast({{ array }} as {{ dbt_utils.type_string() }})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.396634}, "macro.dbt_utils.postgres__cast_array_to_string": {"unique_id": "macro.dbt_utils.postgres__cast_array_to_string", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_array_to_string.sql", "original_file_path": "macros/cross_db_utils/cast_array_to_string.sql", "name": "postgres__cast_array_to_string", "macro_sql": "{% macro postgres__cast_array_to_string(array) %}\n {%- set array_as_string -%}cast({{ array }} as {{ dbt_utils.type_string() }}){%- endset -%}\n {{ dbt_utils.replace(dbt_utils.replace(array_as_string,\"'}'\",\"']'\"),\"'{'\",\"'['\") }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string", "macro.dbt_utils.replace"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.396947}, "macro.dbt_utils.redshift__cast_array_to_string": {"unique_id": "macro.dbt_utils.redshift__cast_array_to_string", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_array_to_string.sql", "original_file_path": "macros/cross_db_utils/cast_array_to_string.sql", "name": "redshift__cast_array_to_string", "macro_sql": "{% macro redshift__cast_array_to_string(array) %}\n cast({{ array }} as {{ dbt_utils.type_string() }})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.397089}, "macro.dbt_utils.bigquery__cast_array_to_string": {"unique_id": "macro.dbt_utils.bigquery__cast_array_to_string", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_array_to_string.sql", "original_file_path": "macros/cross_db_utils/cast_array_to_string.sql", "name": "bigquery__cast_array_to_string", "macro_sql": "{% macro bigquery__cast_array_to_string(array) %}\n '['||(select string_agg(cast(element as string), ',') from unnest({{ array }}) element)||']'\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.397195}, "macro.dbt_utils.length": {"unique_id": "macro.dbt_utils.length", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/length.sql", "original_file_path": "macros/cross_db_utils/length.sql", "name": "length", "macro_sql": "{% macro length(expression) -%}\n {{ return(adapter.dispatch('length', 'dbt_utils') (expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__length"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.397572}, "macro.dbt_utils.default__length": {"unique_id": "macro.dbt_utils.default__length", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/length.sql", "original_file_path": "macros/cross_db_utils/length.sql", "name": "default__length", "macro_sql": "{% macro default__length(expression) %}\n \n length(\n {{ expression }}\n )\n \n{%- endmacro -%}\n\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.397679}, "macro.dbt_utils.redshift__length": {"unique_id": "macro.dbt_utils.redshift__length", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/length.sql", "original_file_path": "macros/cross_db_utils/length.sql", "name": "redshift__length", "macro_sql": "{% macro redshift__length(expression) %}\n\n len(\n {{ expression }}\n )\n \n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3977861}, "macro.dbt_utils.dateadd": {"unique_id": "macro.dbt_utils.dateadd", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "dateadd", "macro_sql": "{% macro dateadd(datepart, interval, from_date_or_timestamp) %}\n {{ return(adapter.dispatch('dateadd', 'dbt_utils')(datepart, interval, from_date_or_timestamp)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.postgres__dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3984}, "macro.dbt_utils.default__dateadd": {"unique_id": "macro.dbt_utils.default__dateadd", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "default__dateadd", "macro_sql": "{% macro default__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n dateadd(\n {{ datepart }},\n {{ interval }},\n {{ from_date_or_timestamp }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3985658}, "macro.dbt_utils.bigquery__dateadd": {"unique_id": "macro.dbt_utils.bigquery__dateadd", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "bigquery__dateadd", "macro_sql": "{% macro bigquery__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n datetime_add(\n cast( {{ from_date_or_timestamp }} as datetime),\n interval {{ interval }} {{ datepart }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.398725}, "macro.dbt_utils.postgres__dateadd": {"unique_id": "macro.dbt_utils.postgres__dateadd", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "postgres__dateadd", "macro_sql": "{% macro postgres__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n {{ from_date_or_timestamp }} + ((interval '1 {{ datepart }}') * ({{ interval }}))\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.398885}, "macro.dbt_utils.redshift__dateadd": {"unique_id": "macro.dbt_utils.redshift__dateadd", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/dateadd.sql", "original_file_path": "macros/cross_db_utils/dateadd.sql", "name": "redshift__dateadd", "macro_sql": "{% macro redshift__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n {{ return(dbt_utils.default__dateadd(datepart, interval, from_date_or_timestamp)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3990788}, "macro.dbt_utils.intersect": {"unique_id": "macro.dbt_utils.intersect", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/intersect.sql", "original_file_path": "macros/cross_db_utils/intersect.sql", "name": "intersect", "macro_sql": "{% macro intersect() %}\n {{ return(adapter.dispatch('intersect', 'dbt_utils')()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__intersect"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.399421}, "macro.dbt_utils.default__intersect": {"unique_id": "macro.dbt_utils.default__intersect", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/intersect.sql", "original_file_path": "macros/cross_db_utils/intersect.sql", "name": "default__intersect", "macro_sql": "{% macro default__intersect() %}\n\n intersect\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3994958}, "macro.dbt_utils.bigquery__intersect": {"unique_id": "macro.dbt_utils.bigquery__intersect", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/intersect.sql", "original_file_path": "macros/cross_db_utils/intersect.sql", "name": "bigquery__intersect", "macro_sql": "{% macro bigquery__intersect() %}\n\n intersect distinct\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3995671}, "macro.dbt_utils.escape_single_quotes": {"unique_id": "macro.dbt_utils.escape_single_quotes", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/escape_single_quotes.sql", "original_file_path": "macros/cross_db_utils/escape_single_quotes.sql", "name": "escape_single_quotes", "macro_sql": "{% macro escape_single_quotes(expression) %}\n {{ return(adapter.dispatch('escape_single_quotes', 'dbt_utils') (expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__escape_single_quotes"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.3999748}, "macro.dbt_utils.default__escape_single_quotes": {"unique_id": "macro.dbt_utils.default__escape_single_quotes", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/escape_single_quotes.sql", "original_file_path": "macros/cross_db_utils/escape_single_quotes.sql", "name": "default__escape_single_quotes", "macro_sql": "{% macro default__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\",\"''\") }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.400126}, "macro.dbt_utils.snowflake__escape_single_quotes": {"unique_id": "macro.dbt_utils.snowflake__escape_single_quotes", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/escape_single_quotes.sql", "original_file_path": "macros/cross_db_utils/escape_single_quotes.sql", "name": "snowflake__escape_single_quotes", "macro_sql": "{% macro snowflake__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\", \"\\\\'\") }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.42397}, "macro.dbt_utils.bigquery__escape_single_quotes": {"unique_id": "macro.dbt_utils.bigquery__escape_single_quotes", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/escape_single_quotes.sql", "original_file_path": "macros/cross_db_utils/escape_single_quotes.sql", "name": "bigquery__escape_single_quotes", "macro_sql": "{% macro bigquery__escape_single_quotes(expression) -%}\n{{ expression | replace(\"'\", \"\\\\'\") }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.424166}, "macro.dbt_utils.right": {"unique_id": "macro.dbt_utils.right", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "right", "macro_sql": "{% macro right(string_text, length_expression) -%}\n {{ return(adapter.dispatch('right', 'dbt_utils') (string_text, length_expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__right"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.425112}, "macro.dbt_utils.default__right": {"unique_id": "macro.dbt_utils.default__right", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "default__right", "macro_sql": "{% macro default__right(string_text, length_expression) %}\n\n right(\n {{ string_text }},\n {{ length_expression }}\n )\n \n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.42526}, "macro.dbt_utils.bigquery__right": {"unique_id": "macro.dbt_utils.bigquery__right", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "bigquery__right", "macro_sql": "{% macro bigquery__right(string_text, length_expression) %}\n\n case when {{ length_expression }} = 0 \n then ''\n else \n substr(\n {{ string_text }},\n -1 * ({{ length_expression }})\n )\n end\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.425419}, "macro.dbt_utils.snowflake__right": {"unique_id": "macro.dbt_utils.snowflake__right", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/right.sql", "original_file_path": "macros/cross_db_utils/right.sql", "name": "snowflake__right", "macro_sql": "{% macro snowflake__right(string_text, length_expression) %}\n\n case when {{ length_expression }} = 0 \n then ''\n else \n right(\n {{ string_text }},\n {{ length_expression }}\n )\n end\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.425575}, "macro.dbt_utils.listagg": {"unique_id": "macro.dbt_utils.listagg", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/listagg.sql", "original_file_path": "macros/cross_db_utils/listagg.sql", "name": "listagg", "macro_sql": "{% macro listagg(measure, delimiter_text=\"','\", order_by_clause=none, limit_num=none) -%}\n {{ return(adapter.dispatch('listagg', 'dbt_utils') (measure, delimiter_text, order_by_clause, limit_num)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.postgres__listagg"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.427934}, "macro.dbt_utils.default__listagg": {"unique_id": "macro.dbt_utils.default__listagg", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/listagg.sql", "original_file_path": "macros/cross_db_utils/listagg.sql", "name": "default__listagg", "macro_sql": "{% macro default__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n\n {% if limit_num -%}\n array_to_string(\n array_slice(\n array_agg(\n {{ measure }}\n ){% if order_by_clause -%}\n within group ({{ order_by_clause }})\n {%- endif %}\n ,0\n ,{{ limit_num }}\n ),\n {{ delimiter_text }}\n )\n {%- else %}\n listagg(\n {{ measure }},\n {{ delimiter_text }}\n )\n {% if order_by_clause -%}\n within group ({{ order_by_clause }})\n {%- endif %}\n {%- endif %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.428349}, "macro.dbt_utils.bigquery__listagg": {"unique_id": "macro.dbt_utils.bigquery__listagg", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/listagg.sql", "original_file_path": "macros/cross_db_utils/listagg.sql", "name": "bigquery__listagg", "macro_sql": "{% macro bigquery__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n\n string_agg(\n {{ measure }},\n {{ delimiter_text }}\n {% if order_by_clause -%}\n {{ order_by_clause }}\n {%- endif %}\n {% if limit_num -%}\n limit {{ limit_num }}\n {%- endif %}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.428627}, "macro.dbt_utils.postgres__listagg": {"unique_id": "macro.dbt_utils.postgres__listagg", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/listagg.sql", "original_file_path": "macros/cross_db_utils/listagg.sql", "name": "postgres__listagg", "macro_sql": "{% macro postgres__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n \n {% if limit_num -%}\n array_to_string(\n (array_agg(\n {{ measure }}\n {% if order_by_clause -%}\n {{ order_by_clause }}\n {%- endif %}\n ))[1:{{ limit_num }}],\n {{ delimiter_text }}\n )\n {%- else %}\n string_agg(\n {{ measure }},\n {{ delimiter_text }}\n {% if order_by_clause -%}\n {{ order_by_clause }}\n {%- endif %}\n )\n {%- endif %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.429027}, "macro.dbt_utils.redshift__listagg": {"unique_id": "macro.dbt_utils.redshift__listagg", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/listagg.sql", "original_file_path": "macros/cross_db_utils/listagg.sql", "name": "redshift__listagg", "macro_sql": "{% macro redshift__listagg(measure, delimiter_text, order_by_clause, limit_num) -%}\n\n {% if limit_num -%}\n {% set ns = namespace() %}\n {% set ns.delimiter_text_regex = delimiter_text|trim(\"'\") %}\n {% set special_chars %}\\,^,$,.,|,?,*,+,(,),[,],{,}{% endset %} \n {%- for char in special_chars.split(',') -%}\n {% set escape_char %}\\\\{{ char }}{% endset %}\n {% set ns.delimiter_text_regex = ns.delimiter_text_regex|replace(char,escape_char) %}\n {%- endfor -%}\n\n {% set regex %}'([^{{ ns.delimiter_text_regex }}]+{{ ns.delimiter_text_regex }}){1,{{ limit_num - 1}}}[^{{ ns.delimiter_text_regex }}]+'{% endset %}\n regexp_substr(\n listagg(\n {{ measure }},\n {{ delimiter_text }}\n )\n {% if order_by_clause -%}\n within group ({{ order_by_clause }})\n {%- endif %}\n ,{{ regex }}\n )\n {%- else %}\n listagg(\n {{ measure }},\n {{ delimiter_text }}\n )\n {% if order_by_clause -%}\n within group ({{ order_by_clause }})\n {%- endif %}\n {%- endif %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.43}, "macro.dbt_utils.datediff": {"unique_id": "macro.dbt_utils.datediff", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "datediff", "macro_sql": "{% macro datediff(first_date, second_date, datepart) %}\n {{ return(adapter.dispatch('datediff', 'dbt_utils')(first_date, second_date, datepart)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.postgres__datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.432645}, "macro.dbt_utils.default__datediff": {"unique_id": "macro.dbt_utils.default__datediff", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "default__datediff", "macro_sql": "{% macro default__datediff(first_date, second_date, datepart) -%}\n\n datediff(\n {{ datepart }},\n {{ first_date }},\n {{ second_date }}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.432811}, "macro.dbt_utils.bigquery__datediff": {"unique_id": "macro.dbt_utils.bigquery__datediff", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "bigquery__datediff", "macro_sql": "{% macro bigquery__datediff(first_date, second_date, datepart) -%}\n\n datetime_diff(\n cast({{second_date}} as datetime),\n cast({{first_date}} as datetime),\n {{datepart}}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4329689}, "macro.dbt_utils.postgres__datediff": {"unique_id": "macro.dbt_utils.postgres__datediff", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "postgres__datediff", "macro_sql": "{% macro postgres__datediff(first_date, second_date, datepart) -%}\n\n {% if datepart == 'year' %}\n (date_part('year', ({{second_date}})::date) - date_part('year', ({{first_date}})::date))\n {% elif datepart == 'quarter' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 4 + date_part('quarter', ({{second_date}})::date) - date_part('quarter', ({{first_date}})::date))\n {% elif datepart == 'month' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 12 + date_part('month', ({{second_date}})::date) - date_part('month', ({{first_date}})::date))\n {% elif datepart == 'day' %}\n (({{second_date}})::date - ({{first_date}})::date)\n {% elif datepart == 'week' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} / 7 + case\n when date_part('dow', ({{first_date}})::timestamp) <= date_part('dow', ({{second_date}})::timestamp) then\n case when {{first_date}} <= {{second_date}} then 0 else -1 end\n else\n case when {{first_date}} <= {{second_date}} then 1 else 0 end\n end)\n {% elif datepart == 'hour' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} * 24 + date_part('hour', ({{second_date}})::timestamp) - date_part('hour', ({{first_date}})::timestamp))\n {% elif datepart == 'minute' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'hour') }} * 60 + date_part('minute', ({{second_date}})::timestamp) - date_part('minute', ({{first_date}})::timestamp))\n {% elif datepart == 'second' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60 + floor(date_part('second', ({{second_date}})::timestamp)) - floor(date_part('second', ({{first_date}})::timestamp)))\n {% elif datepart == 'millisecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000 + floor(date_part('millisecond', ({{second_date}})::timestamp)) - floor(date_part('millisecond', ({{first_date}})::timestamp)))\n {% elif datepart == 'microsecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000000 + floor(date_part('microsecond', ({{second_date}})::timestamp)) - floor(date_part('microsecond', ({{first_date}})::timestamp)))\n {% else %}\n {{ exceptions.raise_compiler_error(\"Unsupported datepart for macro datediff in postgres: {!r}\".format(datepart)) }}\n {% endif %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.434794}, "macro.dbt_utils.redshift__datediff": {"unique_id": "macro.dbt_utils.redshift__datediff", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/datediff.sql", "original_file_path": "macros/cross_db_utils/datediff.sql", "name": "redshift__datediff", "macro_sql": "{% macro redshift__datediff(first_date, second_date, datepart) -%}\n\n {{ return(dbt_utils.default__datediff(first_date, second_date, datepart)) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.435019}, "macro.dbt_utils.safe_cast": {"unique_id": "macro.dbt_utils.safe_cast", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "safe_cast", "macro_sql": "{% macro safe_cast(field, type) %}\n {{ return(adapter.dispatch('safe_cast', 'dbt_utils') (field, type)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__safe_cast"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4355469}, "macro.dbt_utils.default__safe_cast": {"unique_id": "macro.dbt_utils.default__safe_cast", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "default__safe_cast", "macro_sql": "{% macro default__safe_cast(field, type) %}\n {# most databases don't support this function yet\n so we just need to use cast #}\n cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.43569}, "macro.dbt_utils.snowflake__safe_cast": {"unique_id": "macro.dbt_utils.snowflake__safe_cast", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "snowflake__safe_cast", "macro_sql": "{% macro snowflake__safe_cast(field, type) %}\n try_cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.435816}, "macro.dbt_utils.bigquery__safe_cast": {"unique_id": "macro.dbt_utils.bigquery__safe_cast", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/safe_cast.sql", "original_file_path": "macros/cross_db_utils/safe_cast.sql", "name": "bigquery__safe_cast", "macro_sql": "{% macro bigquery__safe_cast(field, type) %}\n safe_cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4359412}, "macro.dbt_utils.hash": {"unique_id": "macro.dbt_utils.hash", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/hash.sql", "original_file_path": "macros/cross_db_utils/hash.sql", "name": "hash", "macro_sql": "{% macro hash(field) -%}\n {{ return(adapter.dispatch('hash', 'dbt_utils') (field)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__hash"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.436306}, "macro.dbt_utils.default__hash": {"unique_id": "macro.dbt_utils.default__hash", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/hash.sql", "original_file_path": "macros/cross_db_utils/hash.sql", "name": "default__hash", "macro_sql": "{% macro default__hash(field) -%}\n md5(cast({{field}} as {{dbt_utils.type_string()}}))\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.436447}, "macro.dbt_utils.bigquery__hash": {"unique_id": "macro.dbt_utils.bigquery__hash", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/hash.sql", "original_file_path": "macros/cross_db_utils/hash.sql", "name": "bigquery__hash", "macro_sql": "{% macro bigquery__hash(field) -%}\n to_hex({{dbt_utils.default__hash(field)}})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__hash"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.436576}, "macro.dbt_utils.cast_bool_to_text": {"unique_id": "macro.dbt_utils.cast_bool_to_text", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_bool_to_text.sql", "original_file_path": "macros/cross_db_utils/cast_bool_to_text.sql", "name": "cast_bool_to_text", "macro_sql": "{% macro cast_bool_to_text(field) %}\n {{ adapter.dispatch('cast_bool_to_text', 'dbt_utils') (field) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.436951}, "macro.dbt_utils.default__cast_bool_to_text": {"unique_id": "macro.dbt_utils.default__cast_bool_to_text", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_bool_to_text.sql", "original_file_path": "macros/cross_db_utils/cast_bool_to_text.sql", "name": "default__cast_bool_to_text", "macro_sql": "{% macro default__cast_bool_to_text(field) %}\n cast({{ field }} as {{ dbt_utils.type_string() }})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.437089}, "macro.dbt_utils.redshift__cast_bool_to_text": {"unique_id": "macro.dbt_utils.redshift__cast_bool_to_text", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/cast_bool_to_text.sql", "original_file_path": "macros/cross_db_utils/cast_bool_to_text.sql", "name": "redshift__cast_bool_to_text", "macro_sql": "{% macro redshift__cast_bool_to_text(field) %}\n case\n when {{ field }} is true then 'true'\n when {{ field }} is false then 'false'\n end::text\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.437213}, "macro.dbt_utils.identifier": {"unique_id": "macro.dbt_utils.identifier", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/identifier.sql", "original_file_path": "macros/cross_db_utils/identifier.sql", "name": "identifier", "macro_sql": "{% macro identifier(value) %}\t\n {%- set error_message = '\n Warning: the `identifier` macro is no longer supported and will be deprecated in a future release of dbt-utils. \\\n Use `adapter.quote` instead. The {}.{} model triggered this warning. \\\n '.format(model.package_name, model.name) -%}\n {%- do exceptions.warn(error_message) -%}\n {{ return(adapter.dispatch('identifier', 'dbt_utils') (value)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__identifier"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4377542}, "macro.dbt_utils.default__identifier": {"unique_id": "macro.dbt_utils.default__identifier", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/identifier.sql", "original_file_path": "macros/cross_db_utils/identifier.sql", "name": "default__identifier", "macro_sql": "{% macro default__identifier(value) -%}\t\n \"{{ value }}\"\t\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.437862}, "macro.dbt_utils.bigquery__identifier": {"unique_id": "macro.dbt_utils.bigquery__identifier", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/identifier.sql", "original_file_path": "macros/cross_db_utils/identifier.sql", "name": "bigquery__identifier", "macro_sql": "{% macro bigquery__identifier(value) -%}\t\n `{{ value }}`\t\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4379609}, "macro.dbt_utils.any_value": {"unique_id": "macro.dbt_utils.any_value", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/any_value.sql", "original_file_path": "macros/cross_db_utils/any_value.sql", "name": "any_value", "macro_sql": "{% macro any_value(expression) -%}\n {{ return(adapter.dispatch('any_value', 'dbt_utils') (expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.postgres__any_value"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.438318}, "macro.dbt_utils.default__any_value": {"unique_id": "macro.dbt_utils.default__any_value", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/any_value.sql", "original_file_path": "macros/cross_db_utils/any_value.sql", "name": "default__any_value", "macro_sql": "{% macro default__any_value(expression) -%}\n \n any_value({{ expression }})\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.438425}, "macro.dbt_utils.postgres__any_value": {"unique_id": "macro.dbt_utils.postgres__any_value", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/any_value.sql", "original_file_path": "macros/cross_db_utils/any_value.sql", "name": "postgres__any_value", "macro_sql": "{% macro postgres__any_value(expression) -%}\n {#- /*Postgres doesn't support any_value, so we're using min() to get the same result*/ -#}\n min({{ expression }})\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4385312}, "macro.dbt_utils.position": {"unique_id": "macro.dbt_utils.position", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/position.sql", "original_file_path": "macros/cross_db_utils/position.sql", "name": "position", "macro_sql": "{% macro position(substring_text, string_text) -%}\n {{ return(adapter.dispatch('position', 'dbt_utils') (substring_text, string_text)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__position"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.43898}, "macro.dbt_utils.default__position": {"unique_id": "macro.dbt_utils.default__position", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/position.sql", "original_file_path": "macros/cross_db_utils/position.sql", "name": "default__position", "macro_sql": "{% macro default__position(substring_text, string_text) %}\n\n position(\n {{ substring_text }} in {{ string_text }}\n )\n \n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4391391}, "macro.dbt_utils.bigquery__position": {"unique_id": "macro.dbt_utils.bigquery__position", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/position.sql", "original_file_path": "macros/cross_db_utils/position.sql", "name": "bigquery__position", "macro_sql": "{% macro bigquery__position(substring_text, string_text) %}\n\n strpos(\n {{ string_text }},\n {{ substring_text }}\n \n )\n \n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.439314}, "macro.dbt_utils.string_literal": {"unique_id": "macro.dbt_utils.string_literal", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/literal.sql", "original_file_path": "macros/cross_db_utils/literal.sql", "name": "string_literal", "macro_sql": "{%- macro string_literal(value) -%}\n {{ return(adapter.dispatch('string_literal', 'dbt_utils') (value)) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__string_literal"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.439789}, "macro.dbt_utils.default__string_literal": {"unique_id": "macro.dbt_utils.default__string_literal", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/literal.sql", "original_file_path": "macros/cross_db_utils/literal.sql", "name": "default__string_literal", "macro_sql": "{% macro default__string_literal(value) -%}\n '{{ value }}'\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.439904}, "macro.dbt_utils.current_timestamp": {"unique_id": "macro.dbt_utils.current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "current_timestamp", "macro_sql": "{% macro current_timestamp() -%}\n {{ return(adapter.dispatch('current_timestamp', 'dbt_utils')()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.440542}, "macro.dbt_utils.default__current_timestamp": {"unique_id": "macro.dbt_utils.default__current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "default__current_timestamp", "macro_sql": "{% macro default__current_timestamp() %}\n current_timestamp::{{dbt_utils.type_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.440659}, "macro.dbt_utils.redshift__current_timestamp": {"unique_id": "macro.dbt_utils.redshift__current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "redshift__current_timestamp", "macro_sql": "{% macro redshift__current_timestamp() %}\n getdate()\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.440734}, "macro.dbt_utils.bigquery__current_timestamp": {"unique_id": "macro.dbt_utils.bigquery__current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "bigquery__current_timestamp", "macro_sql": "{% macro bigquery__current_timestamp() %}\n current_timestamp\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4408078}, "macro.dbt_utils.current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "current_timestamp_in_utc", "macro_sql": "{% macro current_timestamp_in_utc() -%}\n {{ return(adapter.dispatch('current_timestamp_in_utc', 'dbt_utils')()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.postgres__current_timestamp_in_utc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.440971}, "macro.dbt_utils.default__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.default__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "default__current_timestamp_in_utc", "macro_sql": "{% macro default__current_timestamp_in_utc() %}\n {{dbt_utils.current_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.441087}, "macro.dbt_utils.snowflake__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.snowflake__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "snowflake__current_timestamp_in_utc", "macro_sql": "{% macro snowflake__current_timestamp_in_utc() %}\n convert_timezone('UTC', {{dbt_utils.current_timestamp()}})::{{dbt_utils.type_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.current_timestamp", "macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4412339}, "macro.dbt_utils.postgres__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.postgres__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "postgres__current_timestamp_in_utc", "macro_sql": "{% macro postgres__current_timestamp_in_utc() %}\n (current_timestamp at time zone 'utc')::{{dbt_utils.type_timestamp()}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.441349}, "macro.dbt_utils.redshift__current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.redshift__current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/cross_db_utils/current_timestamp.sql", "name": "redshift__current_timestamp_in_utc", "macro_sql": "{% macro redshift__current_timestamp_in_utc() %}\n {{ return(dbt_utils.default__current_timestamp_in_utc()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__current_timestamp_in_utc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.441483}, "macro.dbt_utils.width_bucket": {"unique_id": "macro.dbt_utils.width_bucket", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "width_bucket", "macro_sql": "{% macro width_bucket(expr, min_value, max_value, num_buckets) %}\n {{ return(adapter.dispatch('width_bucket', 'dbt_utils') (expr, min_value, max_value, num_buckets)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__width_bucket"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.442951}, "macro.dbt_utils.default__width_bucket": {"unique_id": "macro.dbt_utils.default__width_bucket", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "default__width_bucket", "macro_sql": "{% macro default__width_bucket(expr, min_value, max_value, num_buckets) -%}\n\n {% set bin_size -%}\n (( {{ max_value }} - {{ min_value }} ) / {{ num_buckets }} )\n {%- endset %}\n (\n -- to break ties when the amount is eaxtly at the bucket egde\n case\n when\n mod(\n {{ dbt_utils.safe_cast(expr, dbt_utils.type_numeric() ) }},\n {{ dbt_utils.safe_cast(bin_size, dbt_utils.type_numeric() ) }}\n ) = 0\n then 1\n else 0\n end\n ) +\n -- Anything over max_value goes the N+1 bucket\n least(\n ceil(\n ({{ expr }} - {{ min_value }})/{{ bin_size }}\n ),\n {{ num_buckets }} + 1\n )\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.safe_cast", "macro.dbt_utils.type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.443428}, "macro.dbt_utils.redshift__width_bucket": {"unique_id": "macro.dbt_utils.redshift__width_bucket", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "redshift__width_bucket", "macro_sql": "{% macro redshift__width_bucket(expr, min_value, max_value, num_buckets) -%}\n\n {% set bin_size -%}\n (( {{ max_value }} - {{ min_value }} ) / {{ num_buckets }} )\n {%- endset %}\n (\n -- to break ties when the amount is exactly at the bucket edge\n case\n when\n {{ dbt_utils.safe_cast(expr, dbt_utils.type_numeric() ) }} %\n {{ dbt_utils.safe_cast(bin_size, dbt_utils.type_numeric() ) }}\n = 0\n then 1\n else 0\n end\n ) +\n -- Anything over max_value goes the N+1 bucket\n least(\n ceil(\n ({{ expr }} - {{ min_value }})/{{ bin_size }}\n ),\n {{ num_buckets }} + 1\n )\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.safe_cast", "macro.dbt_utils.type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4439082}, "macro.dbt_utils.snowflake__width_bucket": {"unique_id": "macro.dbt_utils.snowflake__width_bucket", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/width_bucket.sql", "original_file_path": "macros/cross_db_utils/width_bucket.sql", "name": "snowflake__width_bucket", "macro_sql": "{% macro snowflake__width_bucket(expr, min_value, max_value, num_buckets) %}\n width_bucket({{ expr }}, {{ min_value }}, {{ max_value }}, {{ num_buckets }} )\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.444101}, "macro.dbt_utils.array_concat": {"unique_id": "macro.dbt_utils.array_concat", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_concat.sql", "original_file_path": "macros/cross_db_utils/array_concat.sql", "name": "array_concat", "macro_sql": "{% macro array_concat(array_1, array_2) -%}\n {{ return(adapter.dispatch('array_concat', 'dbt_utils')(array_1, array_2)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__array_concat"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.444566}, "macro.dbt_utils.default__array_concat": {"unique_id": "macro.dbt_utils.default__array_concat", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_concat.sql", "original_file_path": "macros/cross_db_utils/array_concat.sql", "name": "default__array_concat", "macro_sql": "{% macro default__array_concat(array_1, array_2) -%}\n array_cat({{ array_1 }}, {{ array_2 }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.444698}, "macro.dbt_utils.bigquery__array_concat": {"unique_id": "macro.dbt_utils.bigquery__array_concat", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_concat.sql", "original_file_path": "macros/cross_db_utils/array_concat.sql", "name": "bigquery__array_concat", "macro_sql": "{% macro bigquery__array_concat(array_1, array_2) -%}\n array_concat({{ array_1 }}, {{ array_2 }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4448261}, "macro.dbt_utils.redshift__array_concat": {"unique_id": "macro.dbt_utils.redshift__array_concat", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_concat.sql", "original_file_path": "macros/cross_db_utils/array_concat.sql", "name": "redshift__array_concat", "macro_sql": "{% macro redshift__array_concat(array_1, array_2) -%}\n array_concat({{ array_1 }}, {{ array_2 }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.444957}, "macro.dbt_utils.bool_or": {"unique_id": "macro.dbt_utils.bool_or", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/bool_or.sql", "original_file_path": "macros/cross_db_utils/bool_or.sql", "name": "bool_or", "macro_sql": "{% macro bool_or(expression) -%}\n {{ return(adapter.dispatch('bool_or', 'dbt_utils') (expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__bool_or"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.445359}, "macro.dbt_utils.default__bool_or": {"unique_id": "macro.dbt_utils.default__bool_or", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/bool_or.sql", "original_file_path": "macros/cross_db_utils/bool_or.sql", "name": "default__bool_or", "macro_sql": "{% macro default__bool_or(expression) -%}\n \n bool_or({{ expression }})\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.445465}, "macro.dbt_utils.snowflake__bool_or": {"unique_id": "macro.dbt_utils.snowflake__bool_or", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/bool_or.sql", "original_file_path": "macros/cross_db_utils/bool_or.sql", "name": "snowflake__bool_or", "macro_sql": "{% macro snowflake__bool_or(expression) -%}\n \n boolor_agg({{ expression }})\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4456499}, "macro.dbt_utils.bigquery__bool_or": {"unique_id": "macro.dbt_utils.bigquery__bool_or", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/bool_or.sql", "original_file_path": "macros/cross_db_utils/bool_or.sql", "name": "bigquery__bool_or", "macro_sql": "{% macro bigquery__bool_or(expression) -%}\n \n logical_or({{ expression }})\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.445751}, "macro.dbt_utils.last_day": {"unique_id": "macro.dbt_utils.last_day", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "last_day", "macro_sql": "{% macro last_day(date, datepart) %}\n {{ return(adapter.dispatch('last_day', 'dbt_utils') (date, datepart)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.postgres__last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.446369}, "macro.dbt_utils.default_last_day": {"unique_id": "macro.dbt_utils.default_last_day", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "default_last_day", "macro_sql": "\n\n\n{%- macro default_last_day(date, datepart) -%}\n cast(\n {{dbt_utils.dateadd('day', '-1',\n dbt_utils.dateadd(datepart, '1', dbt_utils.date_trunc(datepart, date))\n )}}\n as date)\n{%- endmacro -%}\n\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd", "macro.dbt_utils.date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.446642}, "macro.dbt_utils.default__last_day": {"unique_id": "macro.dbt_utils.default__last_day", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "default__last_day", "macro_sql": "{% macro default__last_day(date, datepart) -%}\n {{dbt_utils.default_last_day(date, datepart)}}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default_last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4467928}, "macro.dbt_utils.postgres__last_day": {"unique_id": "macro.dbt_utils.postgres__last_day", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "postgres__last_day", "macro_sql": "{% macro postgres__last_day(date, datepart) -%}\n\n {%- if datepart == 'quarter' -%}\n -- postgres dateadd does not support quarter interval.\n cast(\n {{dbt_utils.dateadd('day', '-1',\n dbt_utils.dateadd('month', '3', dbt_utils.date_trunc(datepart, date))\n )}}\n as date)\n {%- else -%}\n {{dbt_utils.default_last_day(date, datepart)}}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd", "macro.dbt_utils.date_trunc", "macro.dbt_utils.default_last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4471948}, "macro.dbt_utils.redshift__last_day": {"unique_id": "macro.dbt_utils.redshift__last_day", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/last_day.sql", "original_file_path": "macros/cross_db_utils/last_day.sql", "name": "redshift__last_day", "macro_sql": "{% macro redshift__last_day(date, datepart) %}\n\n {{ return(dbt_utils.default__last_day(date, datepart)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__last_day"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.447378}, "macro.dbt_utils.split_part": {"unique_id": "macro.dbt_utils.split_part", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "split_part", "macro_sql": "{% macro split_part(string_text, delimiter_text, part_number) %}\n {{ return(adapter.dispatch('split_part', 'dbt_utils') (string_text, delimiter_text, part_number)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.postgres__split_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.44886}, "macro.dbt_utils.default__split_part": {"unique_id": "macro.dbt_utils.default__split_part", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "default__split_part", "macro_sql": "{% macro default__split_part(string_text, delimiter_text, part_number) %}\n\n split_part(\n {{ string_text }},\n {{ delimiter_text }},\n {{ part_number }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.449023}, "macro.dbt_utils._split_part_negative": {"unique_id": "macro.dbt_utils._split_part_negative", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "_split_part_negative", "macro_sql": "{% macro _split_part_negative(string_text, delimiter_text, part_number) %}\n\n split_part(\n {{ string_text }},\n {{ delimiter_text }},\n length({{ string_text }}) \n - length(\n replace({{ string_text }}, {{ delimiter_text }}, '')\n ) + 2 {{ part_number }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4492538}, "macro.dbt_utils.postgres__split_part": {"unique_id": "macro.dbt_utils.postgres__split_part", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "postgres__split_part", "macro_sql": "{% macro postgres__split_part(string_text, delimiter_text, part_number) %}\n\n {% if part_number >= 0 %}\n {{ dbt_utils.default__split_part(string_text, delimiter_text, part_number) }}\n {% else %}\n {{ dbt_utils._split_part_negative(string_text, delimiter_text, part_number) }}\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__split_part", "macro.dbt_utils._split_part_negative"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.449593}, "macro.dbt_utils.redshift__split_part": {"unique_id": "macro.dbt_utils.redshift__split_part", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "redshift__split_part", "macro_sql": "{% macro redshift__split_part(string_text, delimiter_text, part_number) %}\n\n {% if part_number >= 0 %}\n {{ dbt_utils.default__split_part(string_text, delimiter_text, part_number) }}\n {% else %}\n {{ dbt_utils._split_part_negative(string_text, delimiter_text, part_number) }}\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__split_part", "macro.dbt_utils._split_part_negative"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4499252}, "macro.dbt_utils.bigquery__split_part": {"unique_id": "macro.dbt_utils.bigquery__split_part", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/split_part.sql", "original_file_path": "macros/cross_db_utils/split_part.sql", "name": "bigquery__split_part", "macro_sql": "{% macro bigquery__split_part(string_text, delimiter_text, part_number) %}\n\n {% if part_number >= 0 %}\n split(\n {{ string_text }},\n {{ delimiter_text }}\n )[safe_offset({{ part_number - 1 }})]\n {% else %}\n split(\n {{ string_text }},\n {{ delimiter_text }}\n )[safe_offset(\n length({{ string_text }}) \n - length(\n replace({{ string_text }}, {{ delimiter_text }}, '')\n ) + 1\n )]\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4502861}, "macro.dbt_utils.date_trunc": {"unique_id": "macro.dbt_utils.date_trunc", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/date_trunc.sql", "original_file_path": "macros/cross_db_utils/date_trunc.sql", "name": "date_trunc", "macro_sql": "{% macro date_trunc(datepart, date) -%}\n {{ return(adapter.dispatch('date_trunc', 'dbt_utils') (datepart, date)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__date_trunc"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.450727}, "macro.dbt_utils.default__date_trunc": {"unique_id": "macro.dbt_utils.default__date_trunc", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/date_trunc.sql", "original_file_path": "macros/cross_db_utils/date_trunc.sql", "name": "default__date_trunc", "macro_sql": "{% macro default__date_trunc(datepart, date) -%}\n date_trunc('{{datepart}}', {{date}})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.45086}, "macro.dbt_utils.bigquery__date_trunc": {"unique_id": "macro.dbt_utils.bigquery__date_trunc", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/date_trunc.sql", "original_file_path": "macros/cross_db_utils/date_trunc.sql", "name": "bigquery__date_trunc", "macro_sql": "{% macro bigquery__date_trunc(datepart, date) -%}\n timestamp_trunc(\n cast({{date}} as timestamp),\n {{datepart}}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.45099}, "macro.dbt_utils.array_construct": {"unique_id": "macro.dbt_utils.array_construct", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_construct.sql", "original_file_path": "macros/cross_db_utils/array_construct.sql", "name": "array_construct", "macro_sql": "{% macro array_construct(inputs = [], data_type = api.Column.translate_type('integer')) -%}\n {{ return(adapter.dispatch('array_construct', 'dbt_utils')(inputs, data_type)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__array_construct"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.451554}, "macro.dbt_utils.default__array_construct": {"unique_id": "macro.dbt_utils.default__array_construct", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_construct.sql", "original_file_path": "macros/cross_db_utils/array_construct.sql", "name": "default__array_construct", "macro_sql": "{% macro default__array_construct(inputs, data_type) -%}\n {% if inputs|length > 0 %}\n array[ {{ inputs|join(' , ') }} ]\n {% else %}\n array[]::{{data_type}}[]\n {% endif %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.451791}, "macro.dbt_utils.snowflake__array_construct": {"unique_id": "macro.dbt_utils.snowflake__array_construct", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_construct.sql", "original_file_path": "macros/cross_db_utils/array_construct.sql", "name": "snowflake__array_construct", "macro_sql": "{% macro snowflake__array_construct(inputs, data_type) -%}\n array_construct( {{ inputs|join(' , ') }} )\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4519281}, "macro.dbt_utils.redshift__array_construct": {"unique_id": "macro.dbt_utils.redshift__array_construct", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_construct.sql", "original_file_path": "macros/cross_db_utils/array_construct.sql", "name": "redshift__array_construct", "macro_sql": "{% macro redshift__array_construct(inputs, data_type) -%}\n array( {{ inputs|join(' , ') }} )\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.452062}, "macro.dbt_utils.bigquery__array_construct": {"unique_id": "macro.dbt_utils.bigquery__array_construct", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_construct.sql", "original_file_path": "macros/cross_db_utils/array_construct.sql", "name": "bigquery__array_construct", "macro_sql": "{% macro bigquery__array_construct(inputs, data_type) -%}\n [ {{ inputs|join(' , ') }} ]\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4522681}, "macro.dbt_utils._is_ephemeral": {"unique_id": "macro.dbt_utils._is_ephemeral", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/_is_ephemeral.sql", "original_file_path": "macros/cross_db_utils/_is_ephemeral.sql", "name": "_is_ephemeral", "macro_sql": "{% macro _is_ephemeral(obj, macro) %}\n {%- if obj.is_cte -%}\n {% set ephemeral_prefix = api.Relation.add_ephemeral_prefix('') %}\n {% if obj.name.startswith(ephemeral_prefix) %}\n {% set model_name = obj.name[(ephemeral_prefix|length):] %}\n {% else %}\n {% set model_name = obj.name %}\n {%- endif -%}\n {% set error_message %}\nThe `{{ macro }}` macro cannot be used with ephemeral models, as it relies on the information schema.\n\n`{{ model_name }}` is an ephemeral model. Consider making it a view or table instead.\n {% endset %}\n {%- do exceptions.raise_compiler_error(error_message) -%}\n {%- endif -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.453132}, "macro.dbt_utils.array_append": {"unique_id": "macro.dbt_utils.array_append", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_append.sql", "original_file_path": "macros/cross_db_utils/array_append.sql", "name": "array_append", "macro_sql": "{% macro array_append(array, new_element) -%}\n {{ return(adapter.dispatch('array_append', 'dbt_utils')(array, new_element)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__array_append"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4536169}, "macro.dbt_utils.default__array_append": {"unique_id": "macro.dbt_utils.default__array_append", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_append.sql", "original_file_path": "macros/cross_db_utils/array_append.sql", "name": "default__array_append", "macro_sql": "{% macro default__array_append(array, new_element) -%}\n array_append({{ array }}, {{ new_element }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.453761}, "macro.dbt_utils.bigquery__array_append": {"unique_id": "macro.dbt_utils.bigquery__array_append", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_append.sql", "original_file_path": "macros/cross_db_utils/array_append.sql", "name": "bigquery__array_append", "macro_sql": "{% macro bigquery__array_append(array, new_element) -%}\n {{ dbt_utils.array_concat(array, dbt_utils.array_construct([new_element])) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.array_concat", "macro.dbt_utils.array_construct"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.453953}, "macro.dbt_utils.redshift__array_append": {"unique_id": "macro.dbt_utils.redshift__array_append", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/cross_db_utils/array_append.sql", "original_file_path": "macros/cross_db_utils/array_append.sql", "name": "redshift__array_append", "macro_sql": "{% macro redshift__array_append(array, new_element) -%}\n {{ dbt_utils.array_concat(array, dbt_utils.array_construct([new_element])) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.array_concat", "macro.dbt_utils.array_construct"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4541361}, "macro.dbt_utils.get_period_boundaries": {"unique_id": "macro.dbt_utils.get_period_boundaries", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "get_period_boundaries", "macro_sql": "{% macro get_period_boundaries(target_schema, target_table, timestamp_field, start_date, stop_date, period) -%}\n {{ return(adapter.dispatch('get_period_boundaries', 'dbt_utils')(target_schema, target_table, timestamp_field, start_date, stop_date, period)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_period_boundaries"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.459989}, "macro.dbt_utils.default__get_period_boundaries": {"unique_id": "macro.dbt_utils.default__get_period_boundaries", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "default__get_period_boundaries", "macro_sql": "{% macro default__get_period_boundaries(target_schema, target_table, timestamp_field, start_date, stop_date, period) -%}\n\n {% call statement('period_boundaries', fetch_result=True) -%}\n with data as (\n select\n coalesce(max(\"{{timestamp_field}}\"), '{{start_date}}')::timestamp as start_timestamp,\n coalesce(\n {{dbt_utils.dateadd('millisecond',\n -1,\n \"nullif('\" ~ stop_date ~ \"','')::timestamp\")}},\n {{dbt_utils.current_timestamp()}}\n ) as stop_timestamp\n from \"{{target_schema}}\".\"{{target_table}}\"\n )\n\n select\n start_timestamp,\n stop_timestamp,\n {{dbt_utils.datediff('start_timestamp',\n 'stop_timestamp',\n period)}} + 1 as num_periods\n from data\n {%- endcall %}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.dateadd", "macro.dbt_utils.current_timestamp", "macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.460532}, "macro.dbt_utils.get_period_sql": {"unique_id": "macro.dbt_utils.get_period_sql", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "get_period_sql", "macro_sql": "{% macro get_period_sql(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset) -%}\n {{ return(adapter.dispatch('get_period_sql', 'dbt_utils')(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_period_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.460865}, "macro.dbt_utils.default__get_period_sql": {"unique_id": "macro.dbt_utils.default__get_period_sql", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "default__get_period_sql", "macro_sql": "{% macro default__get_period_sql(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset) -%}\n\n {%- set period_filter -%}\n (\"{{timestamp_field}}\" > '{{start_timestamp}}'::timestamp + interval '{{offset}} {{period}}' and\n \"{{timestamp_field}}\" <= '{{start_timestamp}}'::timestamp + interval '{{offset}} {{period}}' + interval '1 {{period}}' and\n \"{{timestamp_field}}\" < '{{stop_timestamp}}'::timestamp)\n {%- endset -%}\n\n {%- set filtered_sql = sql | replace(\"__PERIOD_FILTER__\", period_filter) -%}\n\n select\n {{target_cols_csv}}\n from (\n {{filtered_sql}}\n )\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4613702}, "macro.dbt_utils.materialization_insert_by_period_default": {"unique_id": "macro.dbt_utils.materialization_insert_by_period_default", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/materializations/insert_by_period_materialization.sql", "original_file_path": "macros/materializations/insert_by_period_materialization.sql", "name": "materialization_insert_by_period_default", "macro_sql": "{% materialization insert_by_period, default -%}\n {%- set timestamp_field = config.require('timestamp_field') -%}\n {%- set start_date = config.require('start_date') -%}\n {%- set stop_date = config.get('stop_date') or '' -%}\n {%- set period = config.get('period') or 'week' -%}\n\n {%- if sql.find('__PERIOD_FILTER__') == -1 -%}\n {%- set error_message -%}\n Model '{{ model.unique_id }}' does not include the required string '__PERIOD_FILTER__' in its sql\n {%- endset -%}\n {{ exceptions.raise_compiler_error(error_message) }}\n {%- endif -%}\n\n {%- set identifier = model['name'] -%}\n\n {%- set old_relation = adapter.get_relation(database=database, schema=schema, identifier=identifier) -%}\n {%- set target_relation = api.Relation.create(identifier=identifier, schema=schema, type='table') -%}\n\n {%- set non_destructive_mode = (flags.NON_DESTRUCTIVE == True) -%}\n {%- set full_refresh_mode = (flags.FULL_REFRESH == True) -%}\n\n {%- set exists_as_table = (old_relation is not none and old_relation.is_table) -%}\n {%- set exists_not_as_table = (old_relation is not none and not old_relation.is_table) -%}\n\n {%- set should_truncate = (non_destructive_mode and full_refresh_mode and exists_as_table) -%}\n {%- set should_drop = (not should_truncate and (full_refresh_mode or exists_not_as_table)) -%}\n {%- set force_create = (flags.FULL_REFRESH and not flags.NON_DESTRUCTIVE) -%}\n\n -- setup\n {% if old_relation is none -%}\n -- noop\n {%- elif should_truncate -%}\n {{adapter.truncate_relation(old_relation)}}\n {%- elif should_drop -%}\n {{adapter.drop_relation(old_relation)}}\n {%- set old_relation = none -%}\n {%- endif %}\n\n {{run_hooks(pre_hooks, inside_transaction=False)}}\n\n -- `begin` happens here, so `commit` after it to finish the transaction\n {{run_hooks(pre_hooks, inside_transaction=True)}}\n {% call statement() -%}\n begin; -- make extra sure we've closed out the transaction\n commit;\n {%- endcall %}\n\n -- build model\n {% if force_create or old_relation is none -%}\n {# Create an empty target table -#}\n {% call statement('main') -%}\n {%- set empty_sql = sql | replace(\"__PERIOD_FILTER__\", 'false') -%}\n {{create_table_as(False, target_relation, empty_sql)}}\n {%- endcall %}\n {%- endif %}\n\n {% set _ = dbt_utils.get_period_boundaries(schema,\n identifier,\n timestamp_field,\n start_date,\n stop_date,\n period) %}\n {%- set start_timestamp = load_result('period_boundaries')['data'][0][0] | string -%}\n {%- set stop_timestamp = load_result('period_boundaries')['data'][0][1] | string -%}\n {%- set num_periods = load_result('period_boundaries')['data'][0][2] | int -%}\n\n {% set target_columns = adapter.get_columns_in_relation(target_relation) %}\n {%- set target_cols_csv = target_columns | map(attribute='quoted') | join(', ') -%}\n {%- set loop_vars = {'sum_rows_inserted': 0} -%}\n\n -- commit each period as a separate transaction\n {% for i in range(num_periods) -%}\n {%- set msg = \"Running for \" ~ period ~ \" \" ~ (i + 1) ~ \" of \" ~ (num_periods) -%}\n {{ dbt_utils.log_info(msg) }}\n\n {%- set tmp_identifier = model['name'] ~ '__dbt_incremental_period' ~ i ~ '_tmp' -%}\n {%- set tmp_relation = api.Relation.create(identifier=tmp_identifier,\n schema=schema, type='table') -%}\n {% call statement() -%}\n {% set tmp_table_sql = dbt_utils.get_period_sql(target_cols_csv,\n sql,\n timestamp_field,\n period,\n start_timestamp,\n stop_timestamp,\n i) %}\n {{dbt.create_table_as(True, tmp_relation, tmp_table_sql)}}\n {%- endcall %}\n\n {{adapter.expand_target_column_types(from_relation=tmp_relation,\n to_relation=target_relation)}}\n {%- set name = 'main-' ~ i -%}\n {% call statement(name, fetch_result=True) -%}\n insert into {{target_relation}} ({{target_cols_csv}})\n (\n select\n {{target_cols_csv}}\n from {{tmp_relation.include(schema=False)}}\n );\n {%- endcall %}\n {% set result = load_result('main-' ~ i) %}\n {% if 'response' in result.keys() %} {# added in v0.19.0 #}\n {% set rows_inserted = result['response']['rows_affected'] %}\n {% else %} {# older versions #}\n {% set rows_inserted = result['status'].split(\" \")[2] | int %}\n {% endif %}\n \n {%- set sum_rows_inserted = loop_vars['sum_rows_inserted'] + rows_inserted -%}\n {%- if loop_vars.update({'sum_rows_inserted': sum_rows_inserted}) %} {% endif -%}\n\n {%- set msg = \"Ran for \" ~ period ~ \" \" ~ (i + 1) ~ \" of \" ~ (num_periods) ~ \"; \" ~ rows_inserted ~ \" records inserted\" -%}\n {{ dbt_utils.log_info(msg) }}\n\n {%- endfor %}\n\n {% call statement() -%}\n begin;\n {%- endcall %}\n\n {{run_hooks(post_hooks, inside_transaction=True)}}\n\n {% call statement() -%}\n commit;\n {%- endcall %}\n\n {{run_hooks(post_hooks, inside_transaction=False)}}\n\n {%- set status_string = \"INSERT \" ~ loop_vars['sum_rows_inserted'] -%}\n\n {% call noop_statement('main', status_string) -%}\n -- no-op\n {%- endcall %}\n\n -- Return the relations created in this materialization\n {{ return({'relations': [target_relation]}) }} \n\n{%- endmaterialization %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_hooks", "macro.dbt.statement", "macro.dbt.create_table_as", "macro.dbt_utils.get_period_boundaries", "macro.dbt_utils.log_info", "macro.dbt_utils.get_period_sql", "macro.dbt.noop_statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.466655}, "macro.dbt_utils.get_url_host": {"unique_id": "macro.dbt_utils.get_url_host", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "name": "get_url_host", "macro_sql": "{% macro get_url_host(field) -%}\n {{ return(adapter.dispatch('get_url_host', 'dbt_utils')(field)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_url_host"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4672918}, "macro.dbt_utils.default__get_url_host": {"unique_id": "macro.dbt_utils.default__get_url_host", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/web/get_url_host.sql", "original_file_path": "macros/web/get_url_host.sql", "name": "default__get_url_host", "macro_sql": "{% macro default__get_url_host(field) -%}\n\n{%- set parsed =\n dbt_utils.split_part(\n dbt_utils.split_part(\n dbt_utils.replace(\n dbt_utils.replace(\n dbt_utils.replace(field, \"'android-app://'\", \"''\"\n ), \"'http://'\", \"''\"\n ), \"'https://'\", \"''\"\n ), \"'/'\", 1\n ), \"'?'\", 1\n )\n\n-%}\n\n\n {{ dbt_utils.safe_cast(\n parsed,\n dbt_utils.type_string()\n )}}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.split_part", "macro.dbt_utils.replace", "macro.dbt_utils.safe_cast", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.467791}, "macro.dbt_utils.get_url_path": {"unique_id": "macro.dbt_utils.get_url_path", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "name": "get_url_path", "macro_sql": "{% macro get_url_path(field) -%}\n {{ return(adapter.dispatch('get_url_path', 'dbt_utils')(field)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_url_path"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.468354}, "macro.dbt_utils.default__get_url_path": {"unique_id": "macro.dbt_utils.default__get_url_path", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/web/get_url_path.sql", "original_file_path": "macros/web/get_url_path.sql", "name": "default__get_url_path", "macro_sql": "{% macro default__get_url_path(field) -%}\n\n {%- set stripped_url = \n dbt_utils.replace(\n dbt_utils.replace(field, \"'http://'\", \"''\"), \"'https://'\", \"''\")\n -%}\n\n {%- set first_slash_pos -%}\n coalesce(\n nullif({{dbt_utils.position(\"'/'\", stripped_url)}}, 0),\n {{dbt_utils.position(\"'?'\", stripped_url)}} - 1\n )\n {%- endset -%}\n\n {%- set parsed_path =\n dbt_utils.split_part(\n dbt_utils.right(\n stripped_url, \n dbt_utils.length(stripped_url) ~ \"-\" ~ first_slash_pos\n ), \n \"'?'\", 1\n )\n -%}\n\n {{ dbt_utils.safe_cast(\n parsed_path,\n dbt_utils.type_string()\n )}}\n \n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.replace", "macro.dbt_utils.position", "macro.dbt_utils.split_part", "macro.dbt_utils.right", "macro.dbt_utils.length", "macro.dbt_utils.safe_cast", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4690309}, "macro.dbt_utils.get_url_parameter": {"unique_id": "macro.dbt_utils.get_url_parameter", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "name": "get_url_parameter", "macro_sql": "{% macro get_url_parameter(field, url_parameter) -%}\n {{ return(adapter.dispatch('get_url_parameter', 'dbt_utils')(field, url_parameter)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_url_parameter"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.469443}, "macro.dbt_utils.default__get_url_parameter": {"unique_id": "macro.dbt_utils.default__get_url_parameter", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/web/get_url_parameter.sql", "original_file_path": "macros/web/get_url_parameter.sql", "name": "default__get_url_parameter", "macro_sql": "{% macro default__get_url_parameter(field, url_parameter) -%}\n\n{%- set formatted_url_parameter = \"'\" + url_parameter + \"='\" -%}\n\n{%- set split = dbt_utils.split_part(dbt_utils.split_part(field, formatted_url_parameter, 2), \"'&'\", 1) -%}\n\nnullif({{ split }},'')\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.split_part"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.469769}, "macro.dbt_utils.test_fewer_rows_than": {"unique_id": "macro.dbt_utils.test_fewer_rows_than", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/fewer_rows_than.sql", "original_file_path": "macros/generic_tests/fewer_rows_than.sql", "name": "test_fewer_rows_than", "macro_sql": "{% test fewer_rows_than(model, compare_model) %}\n {{ return(adapter.dispatch('test_fewer_rows_than', 'dbt_utils')(model, compare_model)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_fewer_rows_than"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.470379}, "macro.dbt_utils.default__test_fewer_rows_than": {"unique_id": "macro.dbt_utils.default__test_fewer_rows_than", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/fewer_rows_than.sql", "original_file_path": "macros/generic_tests/fewer_rows_than.sql", "name": "default__test_fewer_rows_than", "macro_sql": "{% macro default__test_fewer_rows_than(model, compare_model) %}\n\n{{ config(fail_calc = 'coalesce(row_count_delta, 0)') }}\n\nwith a as (\n\n select count(*) as count_our_model from {{ model }}\n\n),\nb as (\n\n select count(*) as count_comparison_model from {{ compare_model }}\n\n),\ncounts as (\n\n select\n count_our_model,\n count_comparison_model\n from a\n cross join b\n\n),\nfinal as (\n\n select *,\n case\n -- fail the test if we have more rows than the reference model and return the row count delta\n when count_our_model > count_comparison_model then (count_our_model - count_comparison_model)\n -- fail the test if they are the same number\n when count_our_model = count_comparison_model then 1\n -- pass the test if the delta is positive (i.e. return the number 0)\n else 0\n end as row_count_delta\n from counts\n\n)\n\nselect * from final\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4706109}, "macro.dbt_utils.test_equal_rowcount": {"unique_id": "macro.dbt_utils.test_equal_rowcount", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/equal_rowcount.sql", "original_file_path": "macros/generic_tests/equal_rowcount.sql", "name": "test_equal_rowcount", "macro_sql": "{% test equal_rowcount(model, compare_model) %}\n {{ return(adapter.dispatch('test_equal_rowcount', 'dbt_utils')(model, compare_model)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_equal_rowcount"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4710941}, "macro.dbt_utils.default__test_equal_rowcount": {"unique_id": "macro.dbt_utils.default__test_equal_rowcount", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/equal_rowcount.sql", "original_file_path": "macros/generic_tests/equal_rowcount.sql", "name": "default__test_equal_rowcount", "macro_sql": "{% macro default__test_equal_rowcount(model, compare_model) %}\n\n{#-- Needs to be set at parse time, before we return '' below --#}\n{{ config(fail_calc = 'coalesce(diff_count, 0)') }}\n\n{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n{%- if not execute -%}\n {{ return('') }}\n{% endif %}\n\nwith a as (\n\n select count(*) as count_a from {{ model }}\n\n),\nb as (\n\n select count(*) as count_b from {{ compare_model }}\n\n),\nfinal as (\n\n select\n count_a,\n count_b,\n abs(count_a - count_b) as diff_count\n from a\n cross join b\n\n)\n\nselect * from final\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.471413}, "macro.dbt_utils.test_relationships_where": {"unique_id": "macro.dbt_utils.test_relationships_where", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/relationships_where.sql", "original_file_path": "macros/generic_tests/relationships_where.sql", "name": "test_relationships_where", "macro_sql": "{% test relationships_where(model, column_name, to, field, from_condition=\"1=1\", to_condition=\"1=1\") %}\n {{ return(adapter.dispatch('test_relationships_where', 'dbt_utils')(model, column_name, to, field, from_condition, to_condition)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_relationships_where"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4721658}, "macro.dbt_utils.default__test_relationships_where": {"unique_id": "macro.dbt_utils.default__test_relationships_where", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/relationships_where.sql", "original_file_path": "macros/generic_tests/relationships_where.sql", "name": "default__test_relationships_where", "macro_sql": "{% macro default__test_relationships_where(model, column_name, to, field, from_condition=\"1=1\", to_condition=\"1=1\") %}\n\n{# T-SQL has no boolean data type so we use 1=1 which returns TRUE #}\n{# ref https://stackoverflow.com/a/7170753/3842610 #}\n\nwith left_table as (\n\n select\n {{column_name}} as id\n\n from {{model}}\n\n where {{column_name}} is not null\n and {{from_condition}}\n\n),\n\nright_table as (\n\n select\n {{field}} as id\n\n from {{to}}\n\n where {{field}} is not null\n and {{to_condition}}\n\n),\n\nexceptions as (\n\n select\n left_table.id,\n right_table.id as right_id\n\n from left_table\n\n left join right_table\n on left_table.id = right_table.id\n\n where right_table.id is null\n\n)\n\nselect * from exceptions\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.472524}, "macro.dbt_utils.test_recency": {"unique_id": "macro.dbt_utils.test_recency", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/recency.sql", "original_file_path": "macros/generic_tests/recency.sql", "name": "test_recency", "macro_sql": "{% test recency(model, field, datepart, interval) %}\n {{ return(adapter.dispatch('test_recency', 'dbt_utils')(model, field, datepart, interval)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_recency"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4730182}, "macro.dbt_utils.default__test_recency": {"unique_id": "macro.dbt_utils.default__test_recency", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/recency.sql", "original_file_path": "macros/generic_tests/recency.sql", "name": "default__test_recency", "macro_sql": "{% macro default__test_recency(model, field, datepart, interval) %}\n\n{% set threshold = dbt_utils.dateadd(datepart, interval * -1, dbt_utils.current_timestamp()) %}\n\nwith recency as (\n\n select max({{field}}) as most_recent\n from {{ model }}\n\n)\n\nselect\n\n most_recent,\n {{ threshold }} as threshold\n\nfrom recency\nwhere most_recent < {{ threshold }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd", "macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.473353}, "macro.dbt_utils.test_not_constant": {"unique_id": "macro.dbt_utils.test_not_constant", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/not_constant.sql", "original_file_path": "macros/generic_tests/not_constant.sql", "name": "test_not_constant", "macro_sql": "{% test not_constant(model, column_name) %}\n {{ return(adapter.dispatch('test_not_constant', 'dbt_utils')(model, column_name)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_not_constant"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.473755}, "macro.dbt_utils.default__test_not_constant": {"unique_id": "macro.dbt_utils.default__test_not_constant", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/not_constant.sql", "original_file_path": "macros/generic_tests/not_constant.sql", "name": "default__test_not_constant", "macro_sql": "{% macro default__test_not_constant(model, column_name) %}\n\n\nselect\n {# In TSQL, subquery aggregate columns need aliases #}\n {# thus: a filler col name, 'filler_column' #}\n count(distinct {{ column_name }}) as filler_column\n\nfrom {{ model }}\n\nhaving count(distinct {{ column_name }}) = 1\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4739342}, "macro.dbt_utils.test_accepted_range": {"unique_id": "macro.dbt_utils.test_accepted_range", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/accepted_range.sql", "original_file_path": "macros/generic_tests/accepted_range.sql", "name": "test_accepted_range", "macro_sql": "{% test accepted_range(model, column_name, min_value=none, max_value=none, inclusive=true) %}\n {{ return(adapter.dispatch('test_accepted_range', 'dbt_utils')(model, column_name, min_value, max_value, inclusive)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_accepted_range"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.474598}, "macro.dbt_utils.default__test_accepted_range": {"unique_id": "macro.dbt_utils.default__test_accepted_range", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/accepted_range.sql", "original_file_path": "macros/generic_tests/accepted_range.sql", "name": "default__test_accepted_range", "macro_sql": "{% macro default__test_accepted_range(model, column_name, min_value=none, max_value=none, inclusive=true) %}\n\nwith meet_condition as(\n select *\n from {{ model }}\n),\n\nvalidation_errors as (\n select *\n from meet_condition\n where\n -- never true, defaults to an empty result set. Exists to ensure any combo of the `or` clauses below succeeds\n 1 = 2\n\n {%- if min_value is not none %}\n -- records with a value >= min_value are permitted. The `not` flips this to find records that don't meet the rule.\n or not {{ column_name }} > {{- \"=\" if inclusive }} {{ min_value }}\n {%- endif %}\n\n {%- if max_value is not none %}\n -- records with a value <= max_value are permitted. The `not` flips this to find records that don't meet the rule.\n or not {{ column_name }} < {{- \"=\" if inclusive }} {{ max_value }}\n {%- endif %}\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4751732}, "macro.dbt_utils.test_not_accepted_values": {"unique_id": "macro.dbt_utils.test_not_accepted_values", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/not_accepted_values.sql", "original_file_path": "macros/generic_tests/not_accepted_values.sql", "name": "test_not_accepted_values", "macro_sql": "{% test not_accepted_values(model, column_name, values, quote=True) %}\n {{ return(adapter.dispatch('test_not_accepted_values', 'dbt_utils')(model, column_name, values, quote)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_not_accepted_values"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4758022}, "macro.dbt_utils.default__test_not_accepted_values": {"unique_id": "macro.dbt_utils.default__test_not_accepted_values", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/not_accepted_values.sql", "original_file_path": "macros/generic_tests/not_accepted_values.sql", "name": "default__test_not_accepted_values", "macro_sql": "{% macro default__test_not_accepted_values(model, column_name, values, quote=True) %}\nwith all_values as (\n\n select distinct\n {{ column_name }} as value_field\n\n from {{ model }}\n\n),\n\nvalidation_errors as (\n\n select\n value_field\n\n from all_values\n where value_field in (\n {% for value in values -%}\n {% if quote -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {%- endfor %}\n )\n\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.476195}, "macro.dbt_utils.test_unique_where": {"unique_id": "macro.dbt_utils.test_unique_where", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/test_unique_where.sql", "original_file_path": "macros/generic_tests/test_unique_where.sql", "name": "test_unique_where", "macro_sql": "{% test unique_where(model, column_name) %}\r\n {%- set deprecation_warning = '\r\n Warning: `dbt_utils.unique_where` is no longer supported.\r\n Starting in dbt v0.20.0, the built-in `unique` test supports a `where` config.\r\n ' -%}\r\n {%- do exceptions.warn(deprecation_warning) -%}\r\n {{ return(adapter.dispatch('test_unique_where', 'dbt_utils')(model, column_name)) }}\r\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_unique_where"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.476688}, "macro.dbt_utils.default__test_unique_where": {"unique_id": "macro.dbt_utils.default__test_unique_where", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/test_unique_where.sql", "original_file_path": "macros/generic_tests/test_unique_where.sql", "name": "default__test_unique_where", "macro_sql": "{% macro default__test_unique_where(model, column_name) %}\r\n {{ return(test_unique(model, column_name)) }}\r\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.test_unique"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4768598}, "macro.dbt_utils.test_at_least_one": {"unique_id": "macro.dbt_utils.test_at_least_one", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/at_least_one.sql", "original_file_path": "macros/generic_tests/at_least_one.sql", "name": "test_at_least_one", "macro_sql": "{% test at_least_one(model, column_name) %}\n {{ return(adapter.dispatch('test_at_least_one', 'dbt_utils')(model, column_name)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_at_least_one"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.477258}, "macro.dbt_utils.default__test_at_least_one": {"unique_id": "macro.dbt_utils.default__test_at_least_one", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/at_least_one.sql", "original_file_path": "macros/generic_tests/at_least_one.sql", "name": "default__test_at_least_one", "macro_sql": "{% macro default__test_at_least_one(model, column_name) %}\n\nselect *\nfrom (\n select\n {# In TSQL, subquery aggregate columns need aliases #}\n {# thus: a filler col name, 'filler_column' #}\n count({{ column_name }}) as filler_column\n\n from {{ model }}\n\n having count({{ column_name }}) = 0\n\n) validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.477437}, "macro.dbt_utils.test_unique_combination_of_columns": {"unique_id": "macro.dbt_utils.test_unique_combination_of_columns", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/unique_combination_of_columns.sql", "original_file_path": "macros/generic_tests/unique_combination_of_columns.sql", "name": "test_unique_combination_of_columns", "macro_sql": "{% test unique_combination_of_columns(model, combination_of_columns, quote_columns=false) %}\n {{ return(adapter.dispatch('test_unique_combination_of_columns', 'dbt_utils')(model, combination_of_columns, quote_columns)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_unique_combination_of_columns"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.478103}, "macro.dbt_utils.default__test_unique_combination_of_columns": {"unique_id": "macro.dbt_utils.default__test_unique_combination_of_columns", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/unique_combination_of_columns.sql", "original_file_path": "macros/generic_tests/unique_combination_of_columns.sql", "name": "default__test_unique_combination_of_columns", "macro_sql": "{% macro default__test_unique_combination_of_columns(model, combination_of_columns, quote_columns=false) %}\n\n{% if not quote_columns %}\n {%- set column_list=combination_of_columns %}\n{% elif quote_columns %}\n {%- set column_list=[] %}\n {% for column in combination_of_columns -%}\n {% set column_list = column_list.append( adapter.quote(column) ) %}\n {%- endfor %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`quote_columns` argument for unique_combination_of_columns test must be one of [True, False] Got: '\" ~ quote ~\"'.'\"\n ) }}\n{% endif %}\n\n{%- set columns_csv=column_list | join(', ') %}\n\n\nwith validation_errors as (\n\n select\n {{ columns_csv }}\n from {{ model }}\n group by {{ columns_csv }}\n having count(*) > 1\n\n)\n\nselect *\nfrom validation_errors\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.47876}, "macro.dbt_utils.test_cardinality_equality": {"unique_id": "macro.dbt_utils.test_cardinality_equality", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/cardinality_equality.sql", "original_file_path": "macros/generic_tests/cardinality_equality.sql", "name": "test_cardinality_equality", "macro_sql": "{% test cardinality_equality(model, column_name, to, field) %}\n {{ return(adapter.dispatch('test_cardinality_equality', 'dbt_utils')(model, column_name, to, field)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_cardinality_equality"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.479393}, "macro.dbt_utils.default__test_cardinality_equality": {"unique_id": "macro.dbt_utils.default__test_cardinality_equality", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/cardinality_equality.sql", "original_file_path": "macros/generic_tests/cardinality_equality.sql", "name": "default__test_cardinality_equality", "macro_sql": "{% macro default__test_cardinality_equality(model, column_name, to, field) %}\n\n{# T-SQL does not let you use numbers as aliases for columns #}\n{# Thus, no \"GROUP BY 1\" #}\n\nwith table_a as (\nselect\n {{ column_name }},\n count(*) as num_rows\nfrom {{ model }}\ngroup by {{ column_name }}\n),\n\ntable_b as (\nselect\n {{ field }},\n count(*) as num_rows\nfrom {{ to }}\ngroup by {{ field }}\n),\n\nexcept_a as (\n select *\n from table_a\n {{ dbt_utils.except() }}\n select *\n from table_b\n),\n\nexcept_b as (\n select *\n from table_b\n {{ dbt_utils.except() }}\n select *\n from table_a\n),\n\nunioned as (\n select *\n from except_a\n union all\n select *\n from except_b\n)\n\nselect *\nfrom unioned\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.except"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.479742}, "macro.dbt_utils.test_expression_is_true": {"unique_id": "macro.dbt_utils.test_expression_is_true", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/expression_is_true.sql", "original_file_path": "macros/generic_tests/expression_is_true.sql", "name": "test_expression_is_true", "macro_sql": "{% test expression_is_true(model, expression, column_name=None, condition='1=1') %}\n{# T-SQL has no boolean data type so we use 1=1 which returns TRUE #}\n{# ref https://stackoverflow.com/a/7170753/3842610 #}\n {{ return(adapter.dispatch('test_expression_is_true', 'dbt_utils')(model, expression, column_name, condition)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_expression_is_true"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.480278}, "macro.dbt_utils.default__test_expression_is_true": {"unique_id": "macro.dbt_utils.default__test_expression_is_true", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/expression_is_true.sql", "original_file_path": "macros/generic_tests/expression_is_true.sql", "name": "default__test_expression_is_true", "macro_sql": "{% macro default__test_expression_is_true(model, expression, column_name, condition) %}\n\nwith meet_condition as (\n select * from {{ model }} where {{ condition }}\n)\n\nselect\n *\nfrom meet_condition\n{% if column_name is none %}\nwhere not({{ expression }})\n{%- else %}\nwhere not({{ column_name }} {{ expression }})\n{%- endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.480575}, "macro.dbt_utils.test_not_null_proportion": {"unique_id": "macro.dbt_utils.test_not_null_proportion", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/not_null_proportion.sql", "original_file_path": "macros/generic_tests/not_null_proportion.sql", "name": "test_not_null_proportion", "macro_sql": "{% macro test_not_null_proportion(model) %}\n {{ return(adapter.dispatch('test_not_null_proportion', 'dbt_utils')(model, **kwargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_not_null_proportion"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.481066}, "macro.dbt_utils.default__test_not_null_proportion": {"unique_id": "macro.dbt_utils.default__test_not_null_proportion", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/not_null_proportion.sql", "original_file_path": "macros/generic_tests/not_null_proportion.sql", "name": "default__test_not_null_proportion", "macro_sql": "{% macro default__test_not_null_proportion(model) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}\n{% set at_least = kwargs.get('at_least', kwargs.get('arg')) %}\n{% set at_most = kwargs.get('at_most', kwargs.get('arg', 1)) %}\n\nwith validation as (\n select\n sum(case when {{ column_name }} is null then 0 else 1 end) / cast(count(*) as numeric) as not_null_proportion\n from {{ model }}\n),\nvalidation_errors as (\n select\n not_null_proportion\n from validation\n where not_null_proportion < {{ at_least }} or not_null_proportion > {{ at_most }}\n)\nselect\n *\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.481604}, "macro.dbt_utils.test_sequential_values": {"unique_id": "macro.dbt_utils.test_sequential_values", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/sequential_values.sql", "original_file_path": "macros/generic_tests/sequential_values.sql", "name": "test_sequential_values", "macro_sql": "{% test sequential_values(model, column_name, interval=1, datepart=None) %}\n\n {{ return(adapter.dispatch('test_sequential_values', 'dbt_utils')(model, column_name, interval, datepart)) }}\n\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_sequential_values"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4823308}, "macro.dbt_utils.default__test_sequential_values": {"unique_id": "macro.dbt_utils.default__test_sequential_values", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/sequential_values.sql", "original_file_path": "macros/generic_tests/sequential_values.sql", "name": "default__test_sequential_values", "macro_sql": "{% macro default__test_sequential_values(model, column_name, interval=1, datepart=None) %}\n\n{% set previous_column_name = \"previous_\" ~ dbt_utils.slugify(column_name) %}\n\nwith windowed as (\n\n select\n {{ column_name }},\n lag({{ column_name }}) over (\n order by {{ column_name }}\n ) as {{ previous_column_name }}\n from {{ model }}\n),\n\nvalidation_errors as (\n select\n *\n from windowed\n {% if datepart %}\n where not(cast({{ column_name }} as {{ dbt_utils.type_timestamp() }})= cast({{ dbt_utils.dateadd(datepart, interval, previous_column_name) }} as {{ dbt_utils.type_timestamp() }}))\n {% else %}\n where not({{ column_name }} = {{ previous_column_name }} + {{ interval }})\n {% endif %}\n)\n\nselect *\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.slugify", "macro.dbt_utils.type_timestamp", "macro.dbt_utils.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.483049}, "macro.dbt_utils.test_not_null_where": {"unique_id": "macro.dbt_utils.test_not_null_where", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/test_not_null_where.sql", "original_file_path": "macros/generic_tests/test_not_null_where.sql", "name": "test_not_null_where", "macro_sql": "{% test not_null_where(model, column_name) %}\r\n {%- set deprecation_warning = '\r\n Warning: `dbt_utils.not_null_where` is no longer supported.\r\n Starting in dbt v0.20.0, the built-in `not_null` test supports a `where` config.\r\n ' -%}\r\n {%- do exceptions.warn(deprecation_warning) -%}\r\n {{ return(adapter.dispatch('test_not_null_where', 'dbt_utils')(model, column_name)) }}\r\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_not_null_where"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4835489}, "macro.dbt_utils.default__test_not_null_where": {"unique_id": "macro.dbt_utils.default__test_not_null_where", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/test_not_null_where.sql", "original_file_path": "macros/generic_tests/test_not_null_where.sql", "name": "default__test_not_null_where", "macro_sql": "{% macro default__test_not_null_where(model, column_name) %}\r\n {{ return(test_not_null(model, column_name)) }}\r\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.test_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4837198}, "macro.dbt_utils.test_equality": {"unique_id": "macro.dbt_utils.test_equality", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/equality.sql", "original_file_path": "macros/generic_tests/equality.sql", "name": "test_equality", "macro_sql": "{% test equality(model, compare_model, compare_columns=None) %}\n {{ return(adapter.dispatch('test_equality', 'dbt_utils')(model, compare_model, compare_columns)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_equality"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.484513}, "macro.dbt_utils.default__test_equality": {"unique_id": "macro.dbt_utils.default__test_equality", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/equality.sql", "original_file_path": "macros/generic_tests/equality.sql", "name": "default__test_equality", "macro_sql": "{% macro default__test_equality(model, compare_model, compare_columns=None) %}\n\n{% set set_diff %}\n count(*) + coalesce(abs(\n sum(case when which_diff = 'a_minus_b' then 1 else 0 end) -\n sum(case when which_diff = 'b_minus_a' then 1 else 0 end)\n ), 0)\n{% endset %}\n\n{#-- Needs to be set at parse time, before we return '' below --#}\n{{ config(fail_calc = set_diff) }}\n\n{#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n{%- if not execute -%}\n {{ return('') }}\n{% endif %}\n\n-- setup\n{%- do dbt_utils._is_relation(model, 'test_equality') -%}\n\n{#-\nIf the compare_cols arg is provided, we can run this test without querying the\ninformation schema\u00a0\u2014 this allows the model to be an ephemeral model\n-#}\n\n{%- if not compare_columns -%}\n {%- do dbt_utils._is_ephemeral(model, 'test_equality') -%}\n {%- set compare_columns = adapter.get_columns_in_relation(model) | map(attribute='quoted') -%}\n{%- endif -%}\n\n{% set compare_cols_csv = compare_columns | join(', ') %}\n\nwith a as (\n\n select * from {{ model }}\n\n),\n\nb as (\n\n select * from {{ compare_model }}\n\n),\n\na_minus_b as (\n\n select {{compare_cols_csv}} from a\n {{ dbt_utils.except() }}\n select {{compare_cols_csv}} from b\n\n),\n\nb_minus_a as (\n\n select {{compare_cols_csv}} from b\n {{ dbt_utils.except() }}\n select {{compare_cols_csv}} from a\n\n),\n\nunioned as (\n\n select 'a_minus_b' as which_diff, a_minus_b.* from a_minus_b\n union all\n select 'b_minus_a' as which_diff, b_minus_a.* from b_minus_a\n\n)\n\nselect * from unioned\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.except"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.485419}, "macro.dbt_utils.test_mutually_exclusive_ranges": {"unique_id": "macro.dbt_utils.test_mutually_exclusive_ranges", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/mutually_exclusive_ranges.sql", "original_file_path": "macros/generic_tests/mutually_exclusive_ranges.sql", "name": "test_mutually_exclusive_ranges", "macro_sql": "{% test mutually_exclusive_ranges(model, lower_bound_column, upper_bound_column, partition_by=None, gaps='allowed', zero_length_range_allowed=False) %}\n {{ return(adapter.dispatch('test_mutually_exclusive_ranges', 'dbt_utils')(model, lower_bound_column, upper_bound_column, partition_by, gaps, zero_length_range_allowed)) }}\n{% endtest %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__test_mutually_exclusive_ranges"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4885492}, "macro.dbt_utils.default__test_mutually_exclusive_ranges": {"unique_id": "macro.dbt_utils.default__test_mutually_exclusive_ranges", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/generic_tests/mutually_exclusive_ranges.sql", "original_file_path": "macros/generic_tests/mutually_exclusive_ranges.sql", "name": "default__test_mutually_exclusive_ranges", "macro_sql": "{% macro default__test_mutually_exclusive_ranges(model, lower_bound_column, upper_bound_column, partition_by=None, gaps='allowed', zero_length_range_allowed=False) %}\n{% if gaps == 'not_allowed' %}\n {% set allow_gaps_operator='=' %}\n {% set allow_gaps_operator_in_words='equal_to' %}\n{% elif gaps == 'allowed' %}\n {% set allow_gaps_operator='<=' %}\n {% set allow_gaps_operator_in_words='less_than_or_equal_to' %}\n{% elif gaps == 'required' %}\n {% set allow_gaps_operator='<' %}\n {% set allow_gaps_operator_in_words='less_than' %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`gaps` argument for mutually_exclusive_ranges test must be one of ['not_allowed', 'allowed', 'required'] Got: '\" ~ gaps ~\"'.'\"\n ) }}\n{% endif %}\n{% if not zero_length_range_allowed %}\n {% set allow_zero_length_operator='<' %}\n {% set allow_zero_length_operator_in_words='less_than' %}\n{% elif zero_length_range_allowed %}\n {% set allow_zero_length_operator='<=' %}\n {% set allow_zero_length_operator_in_words='less_than_or_equal_to' %}\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"`zero_length_range_allowed` argument for mutually_exclusive_ranges test must be one of [true, false] Got: '\" ~ zero_length_range_allowed ~\"'.'\"\n ) }}\n{% endif %}\n\n{% set partition_clause=\"partition by \" ~ partition_by if partition_by else '' %}\n\nwith window_functions as (\n\n select\n {% if partition_by %}\n {{ partition_by }} as partition_by_col,\n {% endif %}\n {{ lower_bound_column }} as lower_bound,\n {{ upper_bound_column }} as upper_bound,\n\n lead({{ lower_bound_column }}) over (\n {{ partition_clause }}\n order by {{ lower_bound_column }}\n ) as next_lower_bound,\n\n row_number() over (\n {{ partition_clause }}\n order by {{ lower_bound_column }} desc\n ) = 1 as is_last_record\n\n from {{ model }}\n\n),\n\ncalc as (\n -- We want to return records where one of our assumptions fails, so we'll use\n -- the `not` function with `and` statements so we can write our assumptions nore cleanly\n select\n *,\n\n -- For each record: lower_bound should be < upper_bound.\n -- Coalesce it to return an error on the null case (implicit assumption\n -- these columns are not_null)\n coalesce(\n lower_bound {{ allow_zero_length_operator }} upper_bound,\n false\n ) as lower_bound_{{ allow_zero_length_operator_in_words }}_upper_bound,\n\n -- For each record: upper_bound {{ allow_gaps_operator }} the next lower_bound.\n -- Coalesce it to handle null cases for the last record.\n coalesce(\n upper_bound {{ allow_gaps_operator }} next_lower_bound,\n is_last_record,\n false\n ) as upper_bound_{{ allow_gaps_operator_in_words }}_next_lower_bound\n\n from window_functions\n\n),\n\nvalidation_errors as (\n\n select\n *\n from calc\n\n where not(\n -- THE FOLLOWING SHOULD BE TRUE --\n lower_bound_{{ allow_zero_length_operator_in_words }}_upper_bound\n and upper_bound_{{ allow_gaps_operator_in_words }}_next_lower_bound\n )\n)\n\nselect * from validation_errors\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.490067}, "macro.dbt_utils.pretty_log_format": {"unique_id": "macro.dbt_utils.pretty_log_format", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_log_format.sql", "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", "name": "pretty_log_format", "macro_sql": "{% macro pretty_log_format(message) %}\n {{ return(adapter.dispatch('pretty_log_format', 'dbt_utils')(message)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__pretty_log_format"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.490474}, "macro.dbt_utils.default__pretty_log_format": {"unique_id": "macro.dbt_utils.default__pretty_log_format", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_log_format.sql", "original_file_path": "macros/jinja_helpers/pretty_log_format.sql", "name": "default__pretty_log_format", "macro_sql": "{% macro default__pretty_log_format(message) %}\n {{ return( dbt_utils.pretty_time() ~ ' + ' ~ message) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.pretty_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.490643}, "macro.dbt_utils.pretty_time": {"unique_id": "macro.dbt_utils.pretty_time", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_time.sql", "original_file_path": "macros/jinja_helpers/pretty_time.sql", "name": "pretty_time", "macro_sql": "{% macro pretty_time(format='%H:%M:%S') %}\n {{ return(adapter.dispatch('pretty_time', 'dbt_utils')(format)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__pretty_time"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.491009}, "macro.dbt_utils.default__pretty_time": {"unique_id": "macro.dbt_utils.default__pretty_time", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/pretty_time.sql", "original_file_path": "macros/jinja_helpers/pretty_time.sql", "name": "default__pretty_time", "macro_sql": "{% macro default__pretty_time(format='%H:%M:%S') %}\n {{ return(modules.datetime.datetime.now().strftime(format)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4912288}, "macro.dbt_utils.log_info": {"unique_id": "macro.dbt_utils.log_info", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/log_info.sql", "original_file_path": "macros/jinja_helpers/log_info.sql", "name": "log_info", "macro_sql": "{% macro log_info(message) %}\n {{ return(adapter.dispatch('log_info', 'dbt_utils')(message)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__log_info"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4915688}, "macro.dbt_utils.default__log_info": {"unique_id": "macro.dbt_utils.default__log_info", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/log_info.sql", "original_file_path": "macros/jinja_helpers/log_info.sql", "name": "default__log_info", "macro_sql": "{% macro default__log_info(message) %}\n {{ log(dbt_utils.pretty_log_format(message), info=True) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.pretty_log_format"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4917529}, "macro.dbt_utils.slugify": {"unique_id": "macro.dbt_utils.slugify", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/jinja_helpers/slugify.sql", "original_file_path": "macros/jinja_helpers/slugify.sql", "name": "slugify", "macro_sql": "{% macro slugify(string) %}\n\n{#- Lower case the string -#}\n{% set string = string | lower %}\n{#- Replace spaces and dashes with underscores -#}\n{% set string = modules.re.sub('[ -]+', '_', string) %}\n{#- Only take letters, numbers, and underscores -#}\n{% set string = modules.re.sub('[^a-z0-9_]+', '', string) %}\n\n{{ return(string) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.492322}, "macro.dbt_utils.get_intervals_between": {"unique_id": "macro.dbt_utils.get_intervals_between", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "get_intervals_between", "macro_sql": "{% macro get_intervals_between(start_date, end_date, datepart) -%}\n {{ return(adapter.dispatch('get_intervals_between', 'dbt_utils')(start_date, end_date, datepart)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_intervals_between"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.493098}, "macro.dbt_utils.default__get_intervals_between": {"unique_id": "macro.dbt_utils.default__get_intervals_between", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "default__get_intervals_between", "macro_sql": "{% macro default__get_intervals_between(start_date, end_date, datepart) -%}\n {%- call statement('get_intervals_between', fetch_result=True) %}\n\n select {{dbt_utils.datediff(start_date, end_date, datepart)}}\n\n {%- endcall -%}\n\n {%- set value_list = load_result('get_intervals_between') -%}\n\n {%- if value_list and value_list['data'] -%}\n {%- set values = value_list['data'] | map(attribute=0) | list %}\n {{ return(values[0]) }}\n {%- else -%}\n {{ return(1) }}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4937248}, "macro.dbt_utils.date_spine": {"unique_id": "macro.dbt_utils.date_spine", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "date_spine", "macro_sql": "{% macro date_spine(datepart, start_date, end_date) %}\n {{ return(adapter.dispatch('date_spine', 'dbt_utils')(datepart, start_date, end_date)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__date_spine"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.493973}, "macro.dbt_utils.default__date_spine": {"unique_id": "macro.dbt_utils.default__date_spine", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/date_spine.sql", "original_file_path": "macros/sql/date_spine.sql", "name": "default__date_spine", "macro_sql": "{% macro default__date_spine(datepart, start_date, end_date) %}\n\n\n{# call as follows:\n\ndate_spine(\n \"day\",\n \"to_date('01/01/2016', 'mm/dd/yyyy')\",\n \"dateadd(week, 1, current_date)\"\n) #}\n\n\nwith rawdata as (\n\n {{dbt_utils.generate_series(\n dbt_utils.get_intervals_between(start_date, end_date, datepart)\n )}}\n\n),\n\nall_periods as (\n\n select (\n {{\n dbt_utils.dateadd(\n datepart,\n \"row_number() over (order by 1) - 1\",\n start_date\n )\n }}\n ) as date_{{datepart}}\n from rawdata\n\n),\n\nfiltered as (\n\n select *\n from all_periods\n where date_{{datepart}} <= {{ end_date }}\n\n)\n\nselect * from filtered\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.generate_series", "macro.dbt_utils.get_intervals_between", "macro.dbt_utils.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.4943519}, "macro.dbt_utils.nullcheck_table": {"unique_id": "macro.dbt_utils.nullcheck_table", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "name": "nullcheck_table", "macro_sql": "{% macro nullcheck_table(relation) %}\n {{ return(adapter.dispatch('nullcheck_table', 'dbt_utils')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__nullcheck_table"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.494797}, "macro.dbt_utils.default__nullcheck_table": {"unique_id": "macro.dbt_utils.default__nullcheck_table", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck_table.sql", "original_file_path": "macros/sql/nullcheck_table.sql", "name": "default__nullcheck_table", "macro_sql": "{% macro default__nullcheck_table(relation) %}\n\n {%- do dbt_utils._is_relation(relation, 'nullcheck_table') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'nullcheck_table') -%}\n {% set cols = adapter.get_columns_in_relation(relation) %}\n\n select {{ dbt_utils.nullcheck(cols) }}\n from {{relation}}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.nullcheck"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.495264}, "macro.dbt_utils.get_relations_by_pattern": {"unique_id": "macro.dbt_utils.get_relations_by_pattern", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "name": "get_relations_by_pattern", "macro_sql": "{% macro get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_relations_by_pattern', 'dbt_utils')(schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.496036}, "macro.dbt_utils.default__get_relations_by_pattern": {"unique_id": "macro.dbt_utils.default__get_relations_by_pattern", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_pattern.sql", "original_file_path": "macros/sql/get_relations_by_pattern.sql", "name": "default__get_relations_by_pattern", "macro_sql": "{% macro default__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n {{ dbt_utils.get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude, database) }}\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=database,\n schema=row.table_schema,\n identifier=row.table_name,\n type=row.table_type\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.496935}, "macro.dbt_utils.get_powers_of_two": {"unique_id": "macro.dbt_utils.get_powers_of_two", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "get_powers_of_two", "macro_sql": "{% macro get_powers_of_two(upper_bound) %}\n {{ return(adapter.dispatch('get_powers_of_two', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.497962}, "macro.dbt_utils.default__get_powers_of_two": {"unique_id": "macro.dbt_utils.default__get_powers_of_two", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "default__get_powers_of_two", "macro_sql": "{% macro default__get_powers_of_two(upper_bound) %}\n\n {% if upper_bound <= 0 %}\n {{ exceptions.raise_compiler_error(\"upper bound must be positive\") }}\n {% endif %}\n\n {% for _ in range(1, 100) %}\n {% if upper_bound <= 2 ** loop.index %}{{ return(loop.index) }}{% endif %}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.498419}, "macro.dbt_utils.generate_series": {"unique_id": "macro.dbt_utils.generate_series", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "generate_series", "macro_sql": "{% macro generate_series(upper_bound) %}\n {{ return(adapter.dispatch('generate_series', 'dbt_utils')(upper_bound)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__generate_series"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.498626}, "macro.dbt_utils.default__generate_series": {"unique_id": "macro.dbt_utils.default__generate_series", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/generate_series.sql", "original_file_path": "macros/sql/generate_series.sql", "name": "default__generate_series", "macro_sql": "{% macro default__generate_series(upper_bound) %}\n\n {% set n = dbt_utils.get_powers_of_two(upper_bound) %}\n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n {% for i in range(n) %}\n p{{i}}.generated_number * power(2, {{i}})\n {% if not loop.last %} + {% endif %}\n {% endfor %}\n + 1\n as generated_number\n\n from\n\n {% for i in range(n) %}\n p as p{{i}}\n {% if not loop.last %} cross join {% endif %}\n {% endfor %}\n\n )\n\n select *\n from unioned\n where generated_number <= {{upper_bound}}\n order by generated_number\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.get_powers_of_two"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.499181}, "macro.dbt_utils.get_relations_by_prefix": {"unique_id": "macro.dbt_utils.get_relations_by_prefix", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "name": "get_relations_by_prefix", "macro_sql": "{% macro get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_relations_by_prefix', 'dbt_utils')(schema, prefix, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_relations_by_prefix"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.500032}, "macro.dbt_utils.default__get_relations_by_prefix": {"unique_id": "macro.dbt_utils.default__get_relations_by_prefix", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_relations_by_prefix.sql", "original_file_path": "macros/sql/get_relations_by_prefix.sql", "name": "default__get_relations_by_prefix", "macro_sql": "{% macro default__get_relations_by_prefix(schema, prefix, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n {{ dbt_utils.get_tables_by_prefix_sql(schema, prefix, exclude, database) }}\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=database,\n schema=row.table_schema,\n identifier=row.table_name,\n type=row.table_type\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.get_tables_by_prefix_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.500941}, "macro.dbt_utils.get_tables_by_prefix_sql": {"unique_id": "macro.dbt_utils.get_tables_by_prefix_sql", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "name": "get_tables_by_prefix_sql", "macro_sql": "{% macro get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_tables_by_prefix_sql', 'dbt_utils')(schema, prefix, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_tables_by_prefix_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.501534}, "macro.dbt_utils.default__get_tables_by_prefix_sql": {"unique_id": "macro.dbt_utils.default__get_tables_by_prefix_sql", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_prefix_sql.sql", "original_file_path": "macros/sql/get_tables_by_prefix_sql.sql", "name": "default__get_tables_by_prefix_sql", "macro_sql": "{% macro default__get_tables_by_prefix_sql(schema, prefix, exclude='', database=target.database) %}\n\n {{ dbt_utils.get_tables_by_pattern_sql(\n schema_pattern = schema,\n table_pattern = prefix ~ '%',\n exclude = exclude,\n database = database\n ) }}\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5018492}, "macro.dbt_utils.star": {"unique_id": "macro.dbt_utils.star", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "name": "star", "macro_sql": "{% macro star(from, relation_alias=False, except=[], prefix='', suffix='') -%}\n {{ return(adapter.dispatch('star', 'dbt_utils')(from, relation_alias, except, prefix, suffix)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__star"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.502795}, "macro.dbt_utils.default__star": {"unique_id": "macro.dbt_utils.default__star", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/star.sql", "original_file_path": "macros/sql/star.sql", "name": "default__star", "macro_sql": "{% macro default__star(from, relation_alias=False, except=[], prefix='', suffix='') -%}\n {%- do dbt_utils._is_relation(from, 'star') -%}\n {%- do dbt_utils._is_ephemeral(from, 'star') -%}\n\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {{ return('*') }}\n {% endif %}\n\n {% set cols = dbt_utils.get_filtered_columns_in_relation(from, except) %}\n\n {%- if cols|length <= 0 -%}\n {{- return('*') -}}\n {%- else -%}\n {%- for col in cols %}\n {%- if relation_alias %}{{ relation_alias }}.{% else %}{%- endif -%}{{ adapter.quote(col)|trim }} {%- if prefix!='' or suffix!='' %} as {{ adapter.quote(prefix ~ col ~ suffix)|trim }} {%- endif -%}\n {%- if not loop.last %},{{ '\\n ' }}{% endif %}\n {%- endfor -%}\n {% endif %}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.get_filtered_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.503923}, "macro.dbt_utils.unpivot": {"unique_id": "macro.dbt_utils.unpivot", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "name": "unpivot", "macro_sql": "{% macro unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value', table=none) -%}\n {{ return(adapter.dispatch('unpivot', 'dbt_utils')(relation, cast_to, exclude, remove, field_name, value_name, table)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__unpivot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.505871}, "macro.dbt_utils.default__unpivot": {"unique_id": "macro.dbt_utils.default__unpivot", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/unpivot.sql", "original_file_path": "macros/sql/unpivot.sql", "name": "default__unpivot", "macro_sql": "{% macro default__unpivot(relation=none, cast_to='varchar', exclude=none, remove=none, field_name='field_name', value_name='value', table=none) -%}\n\n {% if table %}\n {%- set error_message = '\n Warning: the `unpivot` macro no longer accepts a `table` parameter. \\\n This parameter will be deprecated in a future release of dbt-utils. Use the `relation` parameter instead. \\\n The {}.{} model triggered this warning. \\\n '.format(model.package_name, model.name) -%}\n {%- do exceptions.warn(error_message) -%}\n {% endif %}\n\n {% if relation and table %}\n {{ exceptions.raise_compiler_error(\"Error: both the `relation` and `table` parameters were provided to `unpivot` macro. Choose one only (we recommend `relation`).\") }}\n {% elif not relation and table %}\n {% set relation=table %}\n {% elif not relation and not table %}\n {{ exceptions.raise_compiler_error(\"Error: argument `relation` is required for `unpivot` macro.\") }}\n {% endif %}\n\n {%- set exclude = exclude if exclude is not none else [] %}\n {%- set remove = remove if remove is not none else [] %}\n\n {%- set include_cols = [] %}\n\n {%- set table_columns = {} %}\n\n {%- do table_columns.update({relation: []}) %}\n\n {%- do dbt_utils._is_relation(relation, 'unpivot') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'unpivot') -%}\n {%- set cols = adapter.get_columns_in_relation(relation) %}\n\n {%- for col in cols -%}\n {%- if col.column.lower() not in remove|map('lower') and col.column.lower() not in exclude|map('lower') -%}\n {% do include_cols.append(col) %}\n {%- endif %}\n {%- endfor %}\n\n\n {%- for col in include_cols -%}\n select\n {%- for exclude_col in exclude %}\n {{ exclude_col }},\n {%- endfor %}\n\n cast('{{ col.column }}' as {{ dbt_utils.type_string() }}) as {{ field_name }},\n cast( {% if col.data_type == 'boolean' %}\n {{ dbt_utils.cast_bool_to_text(col.column) }}\n {% else %}\n {{ col.column }}\n {% endif %}\n as {{ cast_to }}) as {{ value_name }}\n\n from {{ relation }}\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n {%- endfor -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.type_string", "macro.dbt_utils.cast_bool_to_text"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.508286}, "macro.dbt_utils.union_relations": {"unique_id": "macro.dbt_utils.union_relations", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "name": "union_relations", "macro_sql": "{%- macro union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation', where=none) -%}\n {{ return(adapter.dispatch('union_relations', 'dbt_utils')(relations, column_override, include, exclude, source_column_name, where)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__union_relations"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.510962}, "macro.dbt_utils.default__union_relations": {"unique_id": "macro.dbt_utils.default__union_relations", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/union.sql", "original_file_path": "macros/sql/union.sql", "name": "default__union_relations", "macro_sql": "\n\n{%- macro default__union_relations(relations, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_relation', where=none) -%}\n\n {%- if exclude and include -%}\n {{ exceptions.raise_compiler_error(\"Both an exclude and include list were provided to the `union` macro. Only one is allowed\") }}\n {%- endif -%}\n\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. -#}\n {%- if not execute %}\n {{ return('') }}\n {% endif -%}\n\n {%- set column_override = column_override if column_override is not none else {} -%}\n\n {%- set relation_columns = {} -%}\n {%- set column_superset = {} -%}\n\n {%- for relation in relations -%}\n\n {%- do relation_columns.update({relation: []}) -%}\n\n {%- do dbt_utils._is_relation(relation, 'union_relations') -%}\n {%- do dbt_utils._is_ephemeral(relation, 'union_relations') -%}\n {%- set cols = adapter.get_columns_in_relation(relation) -%}\n {%- for col in cols -%}\n\n {#- If an exclude list was provided and the column is in the list, do nothing -#}\n {%- if exclude and col.column in exclude -%}\n\n {#- If an include list was provided and the column is not in the list, do nothing -#}\n {%- elif include and col.column not in include -%}\n\n {#- Otherwise add the column to the column superset -#}\n {%- else -%}\n\n {#- update the list of columns in this relation -#}\n {%- do relation_columns[relation].append(col.column) -%}\n\n {%- if col.column in column_superset -%}\n\n {%- set stored = column_superset[col.column] -%}\n {%- if col.is_string() and stored.is_string() and col.string_size() > stored.string_size() -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif %}\n\n {%- else -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif -%}\n\n {%- endif -%}\n\n {%- endfor -%}\n {%- endfor -%}\n\n {%- set ordered_column_names = column_superset.keys() -%}\n {%- set dbt_command = flags.WHICH -%}\n\n\n {% if dbt_command in ['run', 'build'] %}\n {% if (include | length > 0 or exclude | length > 0) and not column_superset.keys() %}\n {%- set relations_string -%}\n {%- for relation in relations -%}\n {{ relation.name }}\n {%- if not loop.last %}, {% endif -%}\n {%- endfor -%}\n {%- endset -%}\n\n {%- set error_message -%}\n There were no columns found to union for relations {{ relations_string }}\n {%- endset -%}\n\n {{ exceptions.raise_compiler_error(error_message) }}\n {%- endif -%}\n {%- endif -%}\n\n {%- for relation in relations %}\n\n (\n select\n\n cast({{ dbt_utils.string_literal(relation) }} as {{ dbt_utils.type_string() }}) as {{ source_column_name }},\n {% for col_name in ordered_column_names -%}\n\n {%- set col = column_superset[col_name] %}\n {%- set col_type = column_override.get(col.column, col.data_type) %}\n {%- set col_name = adapter.quote(col_name) if col_name in relation_columns[relation] else 'null' %}\n cast({{ col_name }} as {{ col_type }}) as {{ col.quoted }} {% if not loop.last %},{% endif -%}\n\n {%- endfor %}\n\n from {{ relation }}\n\n {% if where -%}\n where {{ where }}\n {%- endif %}\n )\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n\n {%- endfor -%}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral", "macro.dbt_utils.string_literal", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.514318}, "macro.dbt_utils.group_by": {"unique_id": "macro.dbt_utils.group_by", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "name": "group_by", "macro_sql": "{%- macro group_by(n) -%}\n {{ return(adapter.dispatch('group_by', 'dbt_utils')(n)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__group_by"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.514859}, "macro.dbt_utils.default__group_by": {"unique_id": "macro.dbt_utils.default__group_by", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/groupby.sql", "original_file_path": "macros/sql/groupby.sql", "name": "default__group_by", "macro_sql": "\n\n{%- macro default__group_by(n) -%}\n\n group by {% for i in range(1, n + 1) -%}\n {{ i }}{{ ',' if not loop.last }} \n {%- endfor -%}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.515133}, "macro.dbt_utils.deduplicate": {"unique_id": "macro.dbt_utils.deduplicate", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "name": "deduplicate", "macro_sql": "{%- macro deduplicate(relation, partition_by, order_by=none, relation_alias=none) -%}\n\n {%- set error_message_group_by -%}\nWarning: the `group_by` parameter of the `deduplicate` macro is no longer supported and will be deprecated in a future release of dbt-utils.\nUse `partition_by` instead.\nThe {{ model.package_name }}.{{ model.name }} model triggered this warning.\n {%- endset -%}\n\n {% if kwargs.get('group_by') %}\n {%- do exceptions.warn(error_message_group_by) -%}\n {%- endif -%}\n\n {%- set error_message_order_by -%}\nWarning: `order_by` as an optional parameter of the `deduplicate` macro is no longer supported and will be deprecated in a future release of dbt-utils.\nSupply a non-null value for `order_by` instead.\nThe {{ model.package_name }}.{{ model.name }} model triggered this warning.\n {%- endset -%}\n\n {% if not order_by %}\n {%- do exceptions.warn(error_message_order_by) -%}\n {%- endif -%}\n\n {%- set error_message_alias -%}\nWarning: the `relation_alias` parameter of the `deduplicate` macro is no longer supported and will be deprecated in a future release of dbt-utils.\nIf you were using `relation_alias` to point to a CTE previously then you can now pass the alias directly to `relation` instead.\nThe {{ model.package_name }}.{{ model.name }} model triggered this warning.\n {%- endset -%}\n\n {% if relation_alias %}\n {%- do exceptions.warn(error_message_alias) -%}\n {%- endif -%}\n\n {% set partition_by = partition_by or kwargs.get('group_by') %}\n {% set relation = relation_alias or relation %}\n {% set order_by = order_by or \"'1'\" %}\n\n {{ return(adapter.dispatch('deduplicate', 'dbt_utils')(relation, partition_by, order_by)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.postgres__deduplicate"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.517783}, "macro.dbt_utils.default__deduplicate": {"unique_id": "macro.dbt_utils.default__deduplicate", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "name": "default__deduplicate", "macro_sql": "\n\n{%- macro default__deduplicate(relation, partition_by, order_by) -%}\n\n with row_numbered as (\n select\n _inner.*,\n row_number() over (\n partition by {{ partition_by }}\n order by {{ order_by }}\n ) as rn\n from {{ relation }} as _inner\n )\n\n select\n distinct data.*\n from {{ relation }} as data\n {#\n -- Not all DBs will support natural joins but the ones that do include:\n -- Oracle, MySQL, SQLite, Redshift, Teradata, Materialize, Databricks\n -- Apache Spark, SingleStore, Vertica\n -- Those that do not appear to support natural joins include:\n -- SQLServer, Trino, Presto, Rockset, Athena\n #}\n natural join row_numbered\n where row_numbered.rn = 1\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5180402}, "macro.dbt_utils.redshift__deduplicate": {"unique_id": "macro.dbt_utils.redshift__deduplicate", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "name": "redshift__deduplicate", "macro_sql": "{% macro redshift__deduplicate(relation, partition_by, order_by) -%}\n\n {{ return(dbt_utils.default__deduplicate(relation, partition_by, order_by=order_by)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__deduplicate"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.518243}, "macro.dbt_utils.postgres__deduplicate": {"unique_id": "macro.dbt_utils.postgres__deduplicate", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "name": "postgres__deduplicate", "macro_sql": "\n{%- macro postgres__deduplicate(relation, partition_by, order_by) -%}\n\n select\n distinct on ({{ partition_by }}) *\n from {{ relation }}\n order by {{ partition_by }}{{ ',' ~ order_by }}\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5184388}, "macro.dbt_utils.snowflake__deduplicate": {"unique_id": "macro.dbt_utils.snowflake__deduplicate", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "name": "snowflake__deduplicate", "macro_sql": "\n{%- macro snowflake__deduplicate(relation, partition_by, order_by) -%}\n\n select *\n from {{ relation }}\n qualify\n row_number() over (\n partition by {{ partition_by }}\n order by {{ order_by }}\n ) = 1\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.518605}, "macro.dbt_utils.bigquery__deduplicate": {"unique_id": "macro.dbt_utils.bigquery__deduplicate", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/deduplicate.sql", "original_file_path": "macros/sql/deduplicate.sql", "name": "bigquery__deduplicate", "macro_sql": "\n{%- macro bigquery__deduplicate(relation, partition_by, order_by) -%}\n\n select unique.*\n from (\n select\n array_agg (\n original\n order by {{ order_by }}\n limit 1\n )[offset(0)] unique\n from {{ relation }} original\n group by {{ partition_by }}\n )\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.518775}, "macro.dbt_utils.surrogate_key": {"unique_id": "macro.dbt_utils.surrogate_key", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "name": "surrogate_key", "macro_sql": "{%- macro surrogate_key(field_list) -%}\n {# needed for safe_add to allow for non-keyword arguments see SO post #}\n {# https://stackoverflow.com/questions/13944751/args-kwargs-in-jinja2-macros #}\n {% set frustrating_jinja_feature = varargs %}\n {{ return(adapter.dispatch('surrogate_key', 'dbt_utils')(field_list, *varargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__surrogate_key"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.519476}, "macro.dbt_utils.default__surrogate_key": {"unique_id": "macro.dbt_utils.default__surrogate_key", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/surrogate_key.sql", "original_file_path": "macros/sql/surrogate_key.sql", "name": "default__surrogate_key", "macro_sql": "\n\n{%- macro default__surrogate_key(field_list) -%}\n\n{%- if varargs|length >= 1 or field_list is string %}\n\n{%- set error_message = '\nWarning: the `surrogate_key` macro now takes a single list argument instead of \\\nmultiple string arguments. Support for multiple string arguments will be \\\ndeprecated in a future release of dbt-utils. The {}.{} model triggered this warning. \\\n'.format(model.package_name, model.name) -%}\n\n{%- do exceptions.warn(error_message) -%}\n\n{# first argument is not included in varargs, so add first element to field_list_xf #}\n{%- set field_list_xf = [field_list] -%}\n\n{%- for field in varargs %}\n{%- set _ = field_list_xf.append(field) -%}\n{%- endfor -%}\n\n{%- else -%}\n\n{# if using list, just set field_list_xf as field_list #}\n{%- set field_list_xf = field_list -%}\n\n{%- endif -%}\n\n\n{%- set fields = [] -%}\n\n{%- for field in field_list_xf -%}\n\n {%- set _ = fields.append(\n \"coalesce(cast(\" ~ field ~ \" as \" ~ dbt_utils.type_string() ~ \"), '')\"\n ) -%}\n\n {%- if not loop.last %}\n {%- set _ = fields.append(\"'-'\") -%}\n {%- endif -%}\n\n{%- endfor -%}\n\n{{dbt_utils.hash(dbt_utils.concat(fields))}}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string", "macro.dbt_utils.hash", "macro.dbt_utils.concat"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.520427}, "macro.dbt_utils.safe_add": {"unique_id": "macro.dbt_utils.safe_add", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "name": "safe_add", "macro_sql": "{%- macro safe_add() -%}\n {# needed for safe_add to allow for non-keyword arguments see SO post #}\n {# https://stackoverflow.com/questions/13944751/args-kwargs-in-jinja2-macros #}\n {% set frustrating_jinja_feature = varargs %}\n {{ return(adapter.dispatch('safe_add', 'dbt_utils')(*varargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__safe_add"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5209112}, "macro.dbt_utils.default__safe_add": {"unique_id": "macro.dbt_utils.default__safe_add", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/safe_add.sql", "original_file_path": "macros/sql/safe_add.sql", "name": "default__safe_add", "macro_sql": "\n\n{%- macro default__safe_add() -%}\n\n{% set fields = [] %}\n\n{%- for field in varargs -%}\n\n {% do fields.append(\"coalesce(\" ~ field ~ \", 0)\") %}\n\n{%- endfor -%}\n\n{{ fields|join(' +\\n ') }}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5212202}, "macro.dbt_utils.nullcheck": {"unique_id": "macro.dbt_utils.nullcheck", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "name": "nullcheck", "macro_sql": "{% macro nullcheck(cols) %}\n {{ return(adapter.dispatch('nullcheck', 'dbt_utils')(cols)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__nullcheck"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.521626}, "macro.dbt_utils.default__nullcheck": {"unique_id": "macro.dbt_utils.default__nullcheck", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/nullcheck.sql", "original_file_path": "macros/sql/nullcheck.sql", "name": "default__nullcheck", "macro_sql": "{% macro default__nullcheck(cols) %}\n{%- for col in cols %}\n\n {% if col.is_string() -%}\n\n nullif({{col.name}},'') as {{col.name}}\n\n {%- else -%}\n\n {{col.name}}\n\n {%- endif -%}\n\n{%- if not loop.last -%} , {%- endif -%}\n\n{%- endfor -%}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.521955}, "macro.dbt_utils.get_tables_by_pattern_sql": {"unique_id": "macro.dbt_utils.get_tables_by_pattern_sql", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "get_tables_by_pattern_sql", "macro_sql": "{% macro get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(adapter.dispatch('get_tables_by_pattern_sql', 'dbt_utils')\n (schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_tables_by_pattern_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.523455}, "macro.dbt_utils.default__get_tables_by_pattern_sql": {"unique_id": "macro.dbt_utils.default__get_tables_by_pattern_sql", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "default__get_tables_by_pattern_sql", "macro_sql": "{% macro default__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n select distinct\n table_schema as \"table_schema\",\n table_name as \"table_name\",\n {{ dbt_utils.get_table_types_sql() }}\n from {{ database }}.information_schema.tables\n where table_schema ilike '{{ schema_pattern }}'\n and table_name ilike '{{ table_pattern }}'\n and table_name not ilike '{{ exclude }}'\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.523732}, "macro.dbt_utils.bigquery__get_tables_by_pattern_sql": {"unique_id": "macro.dbt_utils.bigquery__get_tables_by_pattern_sql", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "bigquery__get_tables_by_pattern_sql", "macro_sql": "{% macro bigquery__get_tables_by_pattern_sql(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {% if '%' in schema_pattern %}\n {% set schemata=dbt_utils._bigquery__get_matching_schemata(schema_pattern, database) %}\n {% else %}\n {% set schemata=[schema_pattern] %}\n {% endif %}\n\n {% set sql %}\n {% for schema in schemata %}\n select distinct\n table_schema,\n table_name,\n {{ dbt_utils.get_table_types_sql() }}\n\n from {{ adapter.quote(database) }}.{{ schema }}.INFORMATION_SCHEMA.TABLES\n where lower(table_name) like lower ('{{ table_pattern }}')\n and lower(table_name) not like lower ('{{ exclude }}')\n\n {% if not loop.last %} union all {% endif %}\n\n {% endfor %}\n {% endset %}\n\n {{ return(sql) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._bigquery__get_matching_schemata", "macro.dbt_utils.get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.524747}, "macro.dbt_utils._bigquery__get_matching_schemata": {"unique_id": "macro.dbt_utils._bigquery__get_matching_schemata", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_tables_by_pattern_sql.sql", "original_file_path": "macros/sql/get_tables_by_pattern_sql.sql", "name": "_bigquery__get_matching_schemata", "macro_sql": "{% macro _bigquery__get_matching_schemata(schema_pattern, database) %}\n {% if execute %}\n\n {% set sql %}\n select schema_name from {{ adapter.quote(database) }}.INFORMATION_SCHEMA.SCHEMATA\n where lower(schema_name) like lower('{{ schema_pattern }}')\n {% endset %}\n\n {% set results=run_query(sql) %}\n\n {% set schemata=results.columns['schema_name'].values() %}\n\n {{ return(schemata) }}\n\n {% else %}\n\n {{ return([]) }}\n\n {% endif %}\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5252638}, "macro.dbt_utils.get_column_values": {"unique_id": "macro.dbt_utils.get_column_values", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "name": "get_column_values", "macro_sql": "{% macro get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none, where=none) -%}\n {{ return(adapter.dispatch('get_column_values', 'dbt_utils')(table, column, order_by, max_records, default, where)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_column_values"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.526409}, "macro.dbt_utils.default__get_column_values": {"unique_id": "macro.dbt_utils.default__get_column_values", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_column_values.sql", "original_file_path": "macros/sql/get_column_values.sql", "name": "default__get_column_values", "macro_sql": "{% macro default__get_column_values(table, column, order_by='count(*) desc', max_records=none, default=none, where=none) -%}\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {% set default = [] if not default %}\n {{ return(default) }}\n {% endif %}\n\n {%- do dbt_utils._is_ephemeral(table, 'get_column_values') -%}\n\n {# Not all relations are tables. Renaming for internal clarity without breaking functionality for anyone using named arguments #}\n {# TODO: Change the method signature in a future 0.x.0 release #}\n {%- set target_relation = table -%}\n\n {# adapter.load_relation is a convenience wrapper to avoid building a Relation when we already have one #}\n {% set relation_exists = (load_relation(target_relation)) is not none %}\n\n {%- call statement('get_column_values', fetch_result=true) %}\n\n {%- if not relation_exists and default is none -%}\n\n {{ exceptions.raise_compiler_error(\"In get_column_values(): relation \" ~ target_relation ~ \" does not exist and no default value was provided.\") }}\n\n {%- elif not relation_exists and default is not none -%}\n\n {{ log(\"Relation \" ~ target_relation ~ \" does not exist. Returning the default value: \" ~ default) }}\n\n {{ return(default) }}\n\n {%- else -%}\n\n\n select\n {{ column }} as value\n\n from {{ target_relation }}\n\n {% if where is not none %}\n where {{ where }}\n {% endif %}\n\n group by {{ column }}\n order by {{ order_by }}\n\n {% if max_records is not none %}\n limit {{ max_records }}\n {% endif %}\n\n {% endif %}\n\n {%- endcall -%}\n\n {%- set value_list = load_result('get_column_values') -%}\n\n {%- if value_list and value_list['data'] -%}\n {%- set values = value_list['data'] | map(attribute=0) | list %}\n {{ return(values) }}\n {%- else -%}\n {{ return(default) }}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_ephemeral", "macro.dbt.load_relation", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.527914}, "macro.dbt_utils.pivot": {"unique_id": "macro.dbt_utils.pivot", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "name": "pivot", "macro_sql": "{% macro pivot(column,\n values,\n alias=True,\n agg='sum',\n cmp='=',\n prefix='',\n suffix='',\n then_value=1,\n else_value=0,\n quote_identifiers=True,\n distinct=False) %}\n {{ return(adapter.dispatch('pivot', 'dbt_utils')(column, values, alias, agg, cmp, prefix, suffix, then_value, else_value, quote_identifiers, distinct)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__pivot"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5289972}, "macro.dbt_utils.default__pivot": {"unique_id": "macro.dbt_utils.default__pivot", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/pivot.sql", "original_file_path": "macros/sql/pivot.sql", "name": "default__pivot", "macro_sql": "{% macro default__pivot(column,\n values,\n alias=True,\n agg='sum',\n cmp='=',\n prefix='',\n suffix='',\n then_value=1,\n else_value=0,\n quote_identifiers=True,\n distinct=False) %}\n {% for value in values %}\n {{ agg }}(\n {% if distinct %} distinct {% endif %}\n case\n when {{ column }} {{ cmp }} '{{ dbt_utils.escape_single_quotes(value) }}'\n then {{ then_value }}\n else {{ else_value }}\n end\n )\n {% if alias %}\n {% if quote_identifiers %}\n as {{ adapter.quote(prefix ~ value ~ suffix) }}\n {% else %}\n as {{ dbt_utils.slugify(prefix ~ value ~ suffix) }}\n {% endif %}\n {% endif %}\n {% if not loop.last %},{% endif %}\n {% endfor %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.escape_single_quotes", "macro.dbt_utils.slugify"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.52982}, "macro.dbt_utils.get_filtered_columns_in_relation": {"unique_id": "macro.dbt_utils.get_filtered_columns_in_relation", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_filtered_columns_in_relation.sql", "original_file_path": "macros/sql/get_filtered_columns_in_relation.sql", "name": "get_filtered_columns_in_relation", "macro_sql": "{% macro get_filtered_columns_in_relation(from, except=[]) -%}\n {{ return(adapter.dispatch('get_filtered_columns_in_relation', 'dbt_utils')(from, except)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_filtered_columns_in_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.530345}, "macro.dbt_utils.default__get_filtered_columns_in_relation": {"unique_id": "macro.dbt_utils.default__get_filtered_columns_in_relation", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_filtered_columns_in_relation.sql", "original_file_path": "macros/sql/get_filtered_columns_in_relation.sql", "name": "default__get_filtered_columns_in_relation", "macro_sql": "{% macro default__get_filtered_columns_in_relation(from, except=[]) -%}\n {%- do dbt_utils._is_relation(from, 'get_filtered_columns_in_relation') -%}\n {%- do dbt_utils._is_ephemeral(from, 'get_filtered_columns_in_relation') -%}\n\n {# -- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. #}\n {%- if not execute -%}\n {{ return('') }}\n {% endif %}\n\n {%- set include_cols = [] %}\n {%- set cols = adapter.get_columns_in_relation(from) -%}\n {%- set except = except | map(\"lower\") | list %}\n {%- for col in cols -%}\n {%- if col.column|lower not in except -%}\n {% do include_cols.append(col.column) %}\n {%- endif %}\n {%- endfor %}\n\n {{ return(include_cols) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils._is_ephemeral"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.531126}, "macro.dbt_utils.get_query_results_as_dict": {"unique_id": "macro.dbt_utils.get_query_results_as_dict", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "name": "get_query_results_as_dict", "macro_sql": "{% macro get_query_results_as_dict(query) %}\n {{ return(adapter.dispatch('get_query_results_as_dict', 'dbt_utils')(query)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__get_query_results_as_dict"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.531602}, "macro.dbt_utils.default__get_query_results_as_dict": {"unique_id": "macro.dbt_utils.default__get_query_results_as_dict", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_query_results_as_dict.sql", "original_file_path": "macros/sql/get_query_results_as_dict.sql", "name": "default__get_query_results_as_dict", "macro_sql": "{% macro default__get_query_results_as_dict(query) %}\n\n{# This macro returns a dictionary of the form {column_name: (tuple_of_results)} #}\n\n {%- call statement('get_query_results', fetch_result=True,auto_begin=false) -%}\n\n {{ query }}\n\n {%- endcall -%}\n\n {% set sql_results={} %}\n\n {%- if execute -%}\n {% set sql_results_table = load_result('get_query_results').table.columns %}\n {% for column_name, column in sql_results_table.items() %}\n {% do sql_results.update({column_name: column.values()}) %}\n {% endfor %}\n {%- endif -%}\n\n {{ return(sql_results) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.532198}, "macro.dbt_utils.get_table_types_sql": {"unique_id": "macro.dbt_utils.get_table_types_sql", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "name": "get_table_types_sql", "macro_sql": "{%- macro get_table_types_sql() -%}\n {{ return(adapter.dispatch('get_table_types_sql', 'dbt_utils')()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.postgres__get_table_types_sql"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5327208}, "macro.dbt_utils.default__get_table_types_sql": {"unique_id": "macro.dbt_utils.default__get_table_types_sql", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "name": "default__get_table_types_sql", "macro_sql": "{% macro default__get_table_types_sql() %}\n case table_type\n when 'BASE TABLE' then 'table'\n when 'EXTERNAL TABLE' then 'external'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as \"table_type\"\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5328078}, "macro.dbt_utils.postgres__get_table_types_sql": {"unique_id": "macro.dbt_utils.postgres__get_table_types_sql", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "name": "postgres__get_table_types_sql", "macro_sql": "{% macro postgres__get_table_types_sql() %}\n case table_type\n when 'BASE TABLE' then 'table'\n when 'FOREIGN' then 'external'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as \"table_type\"\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.53289}, "macro.dbt_utils.bigquery__get_table_types_sql": {"unique_id": "macro.dbt_utils.bigquery__get_table_types_sql", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/get_table_types_sql.sql", "original_file_path": "macros/sql/get_table_types_sql.sql", "name": "bigquery__get_table_types_sql", "macro_sql": "{% macro bigquery__get_table_types_sql() %}\n case table_type\n when 'BASE TABLE' then 'table'\n when 'EXTERNAL TABLE' then 'external'\n when 'MATERIALIZED VIEW' then 'materializedview'\n else lower(table_type)\n end as `table_type`\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.532969}, "macro.dbt_utils.degrees_to_radians": {"unique_id": "macro.dbt_utils.degrees_to_radians", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "degrees_to_radians", "macro_sql": "{% macro degrees_to_radians(degrees) -%}\n acos(-1) * {{degrees}} / 180\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.534027}, "macro.dbt_utils.haversine_distance": {"unique_id": "macro.dbt_utils.haversine_distance", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "haversine_distance", "macro_sql": "{% macro haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n {{ return(adapter.dispatch('haversine_distance', 'dbt_utils')(lat1,lon1,lat2,lon2,unit)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.default__haversine_distance"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5343099}, "macro.dbt_utils.default__haversine_distance": {"unique_id": "macro.dbt_utils.default__haversine_distance", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "default__haversine_distance", "macro_sql": "{% macro default__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{%- if unit == 'mi' %}\n {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n {% set conversion_rate = 1.60934 %}\n{% else %}\n {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n\n 2 * 3961 * asin(sqrt(power((sin(radians(({{ lat2 }} - {{ lat1 }}) / 2))), 2) +\n cos(radians({{lat1}})) * cos(radians({{lat2}})) *\n power((sin(radians(({{ lon2 }} - {{ lon1 }}) / 2))), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.535114}, "macro.dbt_utils.bigquery__haversine_distance": {"unique_id": "macro.dbt_utils.bigquery__haversine_distance", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/dbt_utils", "path": "macros/sql/haversine_distance.sql", "original_file_path": "macros/sql/haversine_distance.sql", "name": "bigquery__haversine_distance", "macro_sql": "{% macro bigquery__haversine_distance(lat1, lon1, lat2, lon2, unit='mi') -%}\n{% set radians_lat1 = dbt_utils.degrees_to_radians(lat1) %}\n{% set radians_lat2 = dbt_utils.degrees_to_radians(lat2) %}\n{% set radians_lon1 = dbt_utils.degrees_to_radians(lon1) %}\n{% set radians_lon2 = dbt_utils.degrees_to_radians(lon2) %}\n{%- if unit == 'mi' %}\n {% set conversion_rate = 1 %}\n{% elif unit == 'km' %}\n {% set conversion_rate = 1.60934 %}\n{% else %}\n {{ exceptions.raise_compiler_error(\"unit input must be one of 'mi' or 'km'. Got \" ~ unit) }}\n{% endif %}\n 2 * 3961 * asin(sqrt(power(sin(({{ radians_lat2 }} - {{ radians_lat1 }}) / 2), 2) +\n cos({{ radians_lat1 }}) * cos({{ radians_lat2 }}) *\n power(sin(({{ radians_lon2 }} - {{ radians_lon1 }}) / 2), 2))) * {{ conversion_rate }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.degrees_to_radians"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.535991}, "macro.spark_utils.get_tables": {"unique_id": "macro.spark_utils.get_tables", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "get_tables", "macro_sql": "{% macro get_tables(table_regex_pattern='.*') %}\n\n {% set tables = [] %}\n {% for database in spark__list_schemas('not_used') %}\n {% for table in spark__list_relations_without_caching(database[0]) %}\n {% set db_tablename = database[0] ~ \".\" ~ table[1] %}\n {% set is_match = modules.re.match(table_regex_pattern, db_tablename) %}\n {% if is_match %}\n {% call statement('table_detail', fetch_result=True) -%}\n describe extended {{ db_tablename }}\n {% endcall %}\n\n {% set table_type = load_result('table_detail').table|reverse|selectattr(0, 'in', ('type', 'TYPE', 'Type'))|first %}\n {% if table_type[1]|lower != 'view' %}\n {{ tables.append(db_tablename) }}\n {% endif %}\n {% endif %}\n {% endfor %}\n {% endfor %}\n {{ return(tables) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.540967}, "macro.spark_utils.get_delta_tables": {"unique_id": "macro.spark_utils.get_delta_tables", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "get_delta_tables", "macro_sql": "{% macro get_delta_tables(table_regex_pattern='.*') %}\n\n {% set delta_tables = [] %}\n {% for db_tablename in get_tables(table_regex_pattern) %}\n {% call statement('table_detail', fetch_result=True) -%}\n describe extended {{ db_tablename }}\n {% endcall %}\n\n {% set table_type = load_result('table_detail').table|reverse|selectattr(0, 'in', ('provider', 'PROVIDER', 'Provider'))|first %}\n {% if table_type[1]|lower == 'delta' %}\n {{ delta_tables.append(db_tablename) }}\n {% endif %}\n {% endfor %}\n {{ return(delta_tables) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_tables", "macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.541676}, "macro.spark_utils.get_statistic_columns": {"unique_id": "macro.spark_utils.get_statistic_columns", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "get_statistic_columns", "macro_sql": "{% macro get_statistic_columns(table) %}\n\n {% call statement('input_columns', fetch_result=True) %}\n SHOW COLUMNS IN {{ table }}\n {% endcall %}\n {% set input_columns = load_result('input_columns').table %}\n\n {% set output_columns = [] %}\n {% for column in input_columns %}\n {% call statement('column_information', fetch_result=True) %}\n DESCRIBE TABLE {{ table }} `{{ column[0] }}`\n {% endcall %}\n {% if not load_result('column_information').table[1][1].startswith('struct') and not load_result('column_information').table[1][1].startswith('array') %}\n {{ output_columns.append('`' ~ column[0] ~ '`') }}\n {% endif %}\n {% endfor %}\n {{ return(output_columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.542588}, "macro.spark_utils.spark_optimize_delta_tables": {"unique_id": "macro.spark_utils.spark_optimize_delta_tables", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "spark_optimize_delta_tables", "macro_sql": "{% macro spark_optimize_delta_tables(table_regex_pattern='.*') %}\n\n {% for table in get_delta_tables(table_regex_pattern) %}\n {% set start=modules.datetime.datetime.now() %}\n {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n {{ dbt_utils.log_info(message_prefix ~ \" Optimizing \" ~ table) }}\n {% do run_query(\"optimize \" ~ table) %}\n {% set end=modules.datetime.datetime.now() %}\n {% set total_seconds = (end - start).total_seconds() | round(2) %}\n {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_delta_tables", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.54335}, "macro.spark_utils.spark_vacuum_delta_tables": {"unique_id": "macro.spark_utils.spark_vacuum_delta_tables", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "spark_vacuum_delta_tables", "macro_sql": "{% macro spark_vacuum_delta_tables(table_regex_pattern='.*') %}\n\n {% for table in get_delta_tables(table_regex_pattern) %}\n {% set start=modules.datetime.datetime.now() %}\n {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n {{ dbt_utils.log_info(message_prefix ~ \" Vacuuming \" ~ table) }}\n {% do run_query(\"vacuum \" ~ table) %}\n {% set end=modules.datetime.datetime.now() %}\n {% set total_seconds = (end - start).total_seconds() | round(2) %}\n {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_delta_tables", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.544107}, "macro.spark_utils.spark_analyze_tables": {"unique_id": "macro.spark_utils.spark_analyze_tables", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/spark_utils", "path": "macros/maintenance_operation.sql", "original_file_path": "macros/maintenance_operation.sql", "name": "spark_analyze_tables", "macro_sql": "{% macro spark_analyze_tables(table_regex_pattern='.*') %}\n\n {% for table in get_tables(table_regex_pattern) %}\n {% set start=modules.datetime.datetime.now() %}\n {% set columns = get_statistic_columns(table) | join(',') %}\n {% set message_prefix=loop.index ~ \" of \" ~ loop.length %}\n {{ dbt_utils.log_info(message_prefix ~ \" Analyzing \" ~ table) }}\n {% if columns != '' %}\n {% do run_query(\"analyze table \" ~ table ~ \" compute statistics for columns \" ~ columns) %}\n {% endif %}\n {% set end=modules.datetime.datetime.now() %}\n {% set total_seconds = (end - start).total_seconds() | round(2) %}\n {{ dbt_utils.log_info(message_prefix ~ \" Finished \" ~ table ~ \" in \" ~ total_seconds ~ \"s\") }}\n {% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.get_tables", "macro.spark_utils.get_statistic_columns", "macro.dbt_utils.log_info", "macro.dbt.run_query"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5450282}, "macro.spark_utils.spark__concat": {"unique_id": "macro.spark_utils.spark__concat", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/concat.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/concat.sql", "name": "spark__concat", "macro_sql": "{% macro spark__concat(fields) -%}\n concat({{ fields|join(', ') }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.545331}, "macro.spark_utils.spark__type_numeric": {"unique_id": "macro.spark_utils.spark__type_numeric", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/datatypes.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/datatypes.sql", "name": "spark__type_numeric", "macro_sql": "{% macro spark__type_numeric() %}\n decimal(28, 6)\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.545515}, "macro.spark_utils.spark__dateadd": {"unique_id": "macro.spark_utils.spark__dateadd", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/dateadd.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/dateadd.sql", "name": "spark__dateadd", "macro_sql": "{% macro spark__dateadd(datepart, interval, from_date_or_timestamp) %}\n\n {%- set clock_component -%}\n {# make sure the dates + timestamps are real, otherwise raise an error asap #}\n to_unix_timestamp({{ spark_utils.assert_not_null('to_timestamp', from_date_or_timestamp) }})\n - to_unix_timestamp({{ spark_utils.assert_not_null('date', from_date_or_timestamp) }})\n {%- endset -%}\n\n {%- if datepart in ['day', 'week'] -%}\n \n {%- set multiplier = 7 if datepart == 'week' else 1 -%}\n\n to_timestamp(\n to_unix_timestamp(\n date_add(\n {{ spark_utils.assert_not_null('date', from_date_or_timestamp) }},\n cast({{interval}} * {{multiplier}} as int)\n )\n ) + {{clock_component}}\n )\n\n {%- elif datepart in ['month', 'quarter', 'year'] -%}\n \n {%- set multiplier -%} \n {%- if datepart == 'month' -%} 1\n {%- elif datepart == 'quarter' -%} 3\n {%- elif datepart == 'year' -%} 12\n {%- endif -%}\n {%- endset -%}\n\n to_timestamp(\n to_unix_timestamp(\n add_months(\n {{ spark_utils.assert_not_null('date', from_date_or_timestamp) }},\n cast({{interval}} * {{multiplier}} as int)\n )\n ) + {{clock_component}}\n )\n\n {%- elif datepart in ('hour', 'minute', 'second', 'millisecond', 'microsecond') -%}\n \n {%- set multiplier -%} \n {%- if datepart == 'hour' -%} 3600\n {%- elif datepart == 'minute' -%} 60\n {%- elif datepart == 'second' -%} 1\n {%- elif datepart == 'millisecond' -%} (1/1000000)\n {%- elif datepart == 'microsecond' -%} (1/1000000)\n {%- endif -%}\n {%- endset -%}\n\n to_timestamp(\n {{ spark_utils.assert_not_null('to_unix_timestamp', from_date_or_timestamp) }}\n + cast({{interval}} * {{multiplier}} as int)\n )\n\n {%- else -%}\n\n {{ exceptions.raise_compiler_error(\"macro dateadd not implemented for datepart ~ '\" ~ datepart ~ \"' ~ on Spark\") }}\n\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.548506}, "macro.spark_utils.spark__datediff": {"unique_id": "macro.spark_utils.spark__datediff", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/datediff.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/datediff.sql", "name": "spark__datediff", "macro_sql": "{% macro spark__datediff(first_date, second_date, datepart) %}\n\n {%- if datepart in ['day', 'week', 'month', 'quarter', 'year'] -%}\n \n {# make sure the dates are real, otherwise raise an error asap #}\n {% set first_date = spark_utils.assert_not_null('date', first_date) %}\n {% set second_date = spark_utils.assert_not_null('date', second_date) %}\n \n {%- endif -%}\n \n {%- if datepart == 'day' -%}\n \n datediff({{second_date}}, {{first_date}})\n \n {%- elif datepart == 'week' -%}\n \n case when {{first_date}} < {{second_date}}\n then floor(datediff({{second_date}}, {{first_date}})/7)\n else ceil(datediff({{second_date}}, {{first_date}})/7)\n end\n \n -- did we cross a week boundary (Sunday)?\n + case\n when {{first_date}} < {{second_date}} and dayofweek({{second_date}}) < dayofweek({{first_date}}) then 1\n when {{first_date}} > {{second_date}} and dayofweek({{second_date}}) > dayofweek({{first_date}}) then -1\n else 0 end\n\n {%- elif datepart == 'month' -%}\n\n case when {{first_date}} < {{second_date}}\n then floor(months_between(date({{second_date}}), date({{first_date}})))\n else ceil(months_between(date({{second_date}}), date({{first_date}})))\n end\n \n -- did we cross a month boundary?\n + case\n when {{first_date}} < {{second_date}} and dayofmonth({{second_date}}) < dayofmonth({{first_date}}) then 1\n when {{first_date}} > {{second_date}} and dayofmonth({{second_date}}) > dayofmonth({{first_date}}) then -1\n else 0 end\n \n {%- elif datepart == 'quarter' -%}\n \n case when {{first_date}} < {{second_date}}\n then floor(months_between(date({{second_date}}), date({{first_date}}))/3)\n else ceil(months_between(date({{second_date}}), date({{first_date}}))/3)\n end\n \n -- did we cross a quarter boundary?\n + case\n when {{first_date}} < {{second_date}} and (\n (dayofyear({{second_date}}) - (quarter({{second_date}}) * 365/4))\n < (dayofyear({{first_date}}) - (quarter({{first_date}}) * 365/4))\n ) then 1\n when {{first_date}} > {{second_date}} and (\n (dayofyear({{second_date}}) - (quarter({{second_date}}) * 365/4))\n > (dayofyear({{first_date}}) - (quarter({{first_date}}) * 365/4))\n ) then -1\n else 0 end\n\n {%- elif datepart == 'year' -%}\n \n year({{second_date}}) - year({{first_date}})\n\n {%- elif datepart in ('hour', 'minute', 'second', 'millisecond', 'microsecond') -%}\n \n {%- set divisor -%} \n {%- if datepart == 'hour' -%} 3600\n {%- elif datepart == 'minute' -%} 60\n {%- elif datepart == 'second' -%} 1\n {%- elif datepart == 'millisecond' -%} (1/1000)\n {%- elif datepart == 'microsecond' -%} (1/1000000)\n {%- endif -%}\n {%- endset -%}\n\n case when {{first_date}} < {{second_date}}\n then ceil((\n {# make sure the timestamps are real, otherwise raise an error asap #}\n {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', second_date)) }}\n - {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', first_date)) }}\n ) / {{divisor}})\n else floor((\n {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', second_date)) }}\n - {{ spark_utils.assert_not_null('to_unix_timestamp', spark_utils.assert_not_null('to_timestamp', first_date)) }}\n ) / {{divisor}})\n end\n \n {% if datepart == 'millisecond' %}\n + cast(date_format({{second_date}}, 'SSS') as int)\n - cast(date_format({{first_date}}, 'SSS') as int)\n {% endif %}\n \n {% if datepart == 'microsecond' %} \n {% set capture_str = '[0-9]{4}-[0-9]{2}-[0-9]{2}.[0-9]{2}:[0-9]{2}:[0-9]{2}.([0-9]{6})' %}\n -- Spark doesn't really support microseconds, so this is a massive hack!\n -- It will only work if the timestamp-string is of the format\n -- 'yyyy-MM-dd-HH mm.ss.SSSSSS'\n + cast(regexp_extract({{second_date}}, '{{capture_str}}', 1) as int)\n - cast(regexp_extract({{first_date}}, '{{capture_str}}', 1) as int) \n {% endif %}\n\n {%- else -%}\n\n {{ exceptions.raise_compiler_error(\"macro datediff not implemented for datepart ~ '\" ~ datepart ~ \"' ~ on Spark\") }}\n\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5564768}, "macro.spark_utils.spark__current_timestamp": {"unique_id": "macro.spark_utils.spark__current_timestamp", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "name": "spark__current_timestamp", "macro_sql": "{% macro spark__current_timestamp() %}\n current_timestamp()\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5568378}, "macro.spark_utils.spark__current_timestamp_in_utc": {"unique_id": "macro.spark_utils.spark__current_timestamp_in_utc", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/current_timestamp.sql", "name": "spark__current_timestamp_in_utc", "macro_sql": "{% macro spark__current_timestamp_in_utc() %}\n unix_timestamp()\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.556917}, "macro.spark_utils.spark__split_part": {"unique_id": "macro.spark_utils.spark__split_part", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/spark_utils", "path": "macros/dbt_utils/cross_db_utils/split_part.sql", "original_file_path": "macros/dbt_utils/cross_db_utils/split_part.sql", "name": "spark__split_part", "macro_sql": "{% macro spark__split_part(string_text, delimiter_text, part_number) %}\n\n {% set delimiter_expr %}\n \n -- escape if starts with a special character\n case when regexp_extract({{ delimiter_text }}, '([^A-Za-z0-9])(.*)', 1) != '_'\n then concat('\\\\', {{ delimiter_text }})\n else {{ delimiter_text }} end\n \n {% endset %}\n\n {% set split_part_expr %}\n \n split(\n {{ string_text }},\n {{ delimiter_expr }}\n )[({{ part_number - 1 }})]\n \n {% endset %}\n \n {{ return(split_part_expr) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.557791}, "macro.spark_utils.spark__get_relations_by_pattern": {"unique_id": "macro.spark_utils.spark__get_relations_by_pattern", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_relations_by_pattern", "macro_sql": "{% macro spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n\n {%- call statement('get_tables', fetch_result=True) %}\n\n show table extended in {{ schema_pattern }} like '{{ table_pattern }}'\n\n {%- endcall -%}\n\n {%- set table_list = load_result('get_tables') -%}\n\n {%- if table_list and table_list['table'] -%}\n {%- set tbl_relations = [] -%}\n {%- for row in table_list['table'] -%}\n {%- set tbl_relation = api.Relation.create(\n database=None,\n schema=row[0],\n identifier=row[1],\n type=('view' if 'Type: VIEW' in row[3] else 'table')\n ) -%}\n {%- do tbl_relations.append(tbl_relation) -%}\n {%- endfor -%}\n\n {{ return(tbl_relations) }}\n {%- else -%}\n {{ return([]) }}\n {%- endif -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.559694}, "macro.spark_utils.spark__get_relations_by_prefix": {"unique_id": "macro.spark_utils.spark__get_relations_by_prefix", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_relations_by_prefix", "macro_sql": "{% macro spark__get_relations_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {% set table_pattern = table_pattern ~ '*' %}\n {{ return(spark_utils.spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.560065}, "macro.spark_utils.spark__get_tables_by_pattern": {"unique_id": "macro.spark_utils.spark__get_tables_by_pattern", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_tables_by_pattern", "macro_sql": "{% macro spark__get_tables_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(spark_utils.spark__get_relations_by_pattern(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_pattern"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.560361}, "macro.spark_utils.spark__get_tables_by_prefix": {"unique_id": "macro.spark_utils.spark__get_tables_by_prefix", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/spark_utils", "path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "original_file_path": "macros/dbt_utils/sql/get_relations_by_prefix.sql", "name": "spark__get_tables_by_prefix", "macro_sql": "{% macro spark__get_tables_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database) %}\n {{ return(spark_utils.spark__get_relations_by_prefix(schema_pattern, table_pattern, exclude='', database=target.database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.spark__get_relations_by_prefix"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5606441}, "macro.spark_utils.assert_not_null": {"unique_id": "macro.spark_utils.assert_not_null", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/spark_utils", "path": "macros/etc/assert_not_null.sql", "original_file_path": "macros/etc/assert_not_null.sql", "name": "assert_not_null", "macro_sql": "{% macro assert_not_null(function, arg) -%}\n {{ return(adapter.dispatch('assert_not_null', 'spark_utils')(function, arg)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.spark_utils.default__assert_not_null"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.561132}, "macro.spark_utils.default__assert_not_null": {"unique_id": "macro.spark_utils.default__assert_not_null", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/spark_utils", "path": "macros/etc/assert_not_null.sql", "original_file_path": "macros/etc/assert_not_null.sql", "name": "default__assert_not_null", "macro_sql": "{% macro default__assert_not_null(function, arg) %}\n\n coalesce({{function}}({{arg}}), nvl2({{function}}({{arg}}), assert_true({{function}}({{arg}}) is not null), null))\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.561345}, "macro.spark_utils.spark__convert_timezone": {"unique_id": "macro.spark_utils.spark__convert_timezone", "package_name": "spark_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/spark_utils", "path": "macros/snowplow/convert_timezone.sql", "original_file_path": "macros/snowplow/convert_timezone.sql", "name": "spark__convert_timezone", "macro_sql": "{% macro spark__convert_timezone(in_tz, out_tz, in_timestamp) %}\n from_utc_timestamp(to_utc_timestamp({{in_timestamp}}, {{in_tz}}), {{out_tz}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5616488}, "macro.fivetran_utils.enabled_vars": {"unique_id": "macro.fivetran_utils.enabled_vars", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/enabled_vars.sql", "original_file_path": "macros/enabled_vars.sql", "name": "enabled_vars", "macro_sql": "{% macro enabled_vars(vars) %}\n\n{% for v in vars %}\n \n {% if var(v, True) == False %}\n {{ return(False) }}\n {% endif %}\n\n{% endfor %}\n\n{{ return(True) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.562134}, "macro.fivetran_utils.percentile": {"unique_id": "macro.fivetran_utils.percentile", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "percentile", "macro_sql": "{% macro percentile(percentile_field, partition_field, percent) -%}\n\n{{ adapter.dispatch('percentile', 'fivetran_utils') (percentile_field, partition_field, percent) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.postgres__percentile"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.563126}, "macro.fivetran_utils.default__percentile": {"unique_id": "macro.fivetran_utils.default__percentile", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "default__percentile", "macro_sql": "{% macro default__percentile(percentile_field, partition_field, percent) %}\n\n percentile_cont( \n {{ percent }} )\n within group ( order by {{ percentile_field }} )\n over ( partition by {{ partition_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.563307}, "macro.fivetran_utils.redshift__percentile": {"unique_id": "macro.fivetran_utils.redshift__percentile", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "redshift__percentile", "macro_sql": "{% macro redshift__percentile(percentile_field, partition_field, percent) %}\n\n percentile_cont( \n {{ percent }} )\n within group ( order by {{ percentile_field }} )\n over ( partition by {{ partition_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.563484}, "macro.fivetran_utils.bigquery__percentile": {"unique_id": "macro.fivetran_utils.bigquery__percentile", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "bigquery__percentile", "macro_sql": "{% macro bigquery__percentile(percentile_field, partition_field, percent) %}\n\n percentile_cont( \n {{ percentile_field }}, \n {{ percent }}) \n over (partition by {{ partition_field }} \n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.563655}, "macro.fivetran_utils.postgres__percentile": {"unique_id": "macro.fivetran_utils.postgres__percentile", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "postgres__percentile", "macro_sql": "{% macro postgres__percentile(percentile_field, partition_field, percent) %}\n\n percentile_cont( \n {{ percent }} )\n within group ( order by {{ percentile_field }} )\n /* have to group by partition field */\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.563817}, "macro.fivetran_utils.spark__percentile": {"unique_id": "macro.fivetran_utils.spark__percentile", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/percentile.sql", "original_file_path": "macros/percentile.sql", "name": "spark__percentile", "macro_sql": "{% macro spark__percentile(percentile_field, partition_field, percent) %}\n\n percentile( \n {{ percentile_field }}, \n {{ percent }}) \n over (partition by {{ partition_field }} \n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.563991}, "macro.fivetran_utils.pivot_json_extract": {"unique_id": "macro.fivetran_utils.pivot_json_extract", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/pivot_json_extract.sql", "original_file_path": "macros/pivot_json_extract.sql", "name": "pivot_json_extract", "macro_sql": "{% macro pivot_json_extract(string, list_of_properties) %}\n\n{%- for property in list_of_properties -%}\n\nreplace( {{ fivetran_utils.json_extract(string, property) }}, '\"', '') as {{ property | replace(' ', '_') | lower }}\n\n{%- if not loop.last -%},{%- endif %}\n{% endfor -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.json_extract"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5645041}, "macro.fivetran_utils.persist_pass_through_columns": {"unique_id": "macro.fivetran_utils.persist_pass_through_columns", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/persist_pass_through_columns.sql", "original_file_path": "macros/persist_pass_through_columns.sql", "name": "persist_pass_through_columns", "macro_sql": "{% macro persist_pass_through_columns(pass_through_variable, identifier=none, transform='') %}\n\n{% if var(pass_through_variable, none) %}\n {% for field in var(pass_through_variable) %}\n , {{ transform ~ '(' ~ (identifier ~ '.' if identifier else '') ~ (field.alias if field.alias else field.name) ~ ')' }} as {{ field.alias if field.alias else field.name }}\n {% endfor %}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5653179}, "macro.fivetran_utils.json_parse": {"unique_id": "macro.fivetran_utils.json_parse", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "json_parse", "macro_sql": "{% macro json_parse(string, string_path) -%}\n\n{{ adapter.dispatch('json_parse', 'fivetran_utils') (string, string_path) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.postgres__json_parse"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5664058}, "macro.fivetran_utils.default__json_parse": {"unique_id": "macro.fivetran_utils.default__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "default__json_parse", "macro_sql": "{% macro default__json_parse(string, string_path) %}\n\n json_extract_path_text({{string}}, {%- for s in string_path -%}'{{ s }}'{%- if not loop.last -%},{%- endif -%}{%- endfor -%} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.566648}, "macro.fivetran_utils.redshift__json_parse": {"unique_id": "macro.fivetran_utils.redshift__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "redshift__json_parse", "macro_sql": "{% macro redshift__json_parse(string, string_path) %}\n\n json_extract_path_text({{string}}, {%- for s in string_path -%}'{{ s }}'{%- if not loop.last -%},{%- endif -%}{%- endfor -%} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5668879}, "macro.fivetran_utils.bigquery__json_parse": {"unique_id": "macro.fivetran_utils.bigquery__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "bigquery__json_parse", "macro_sql": "{% macro bigquery__json_parse(string, string_path) %}\n\n \n json_extract_scalar({{string}}, '$.{%- for s in string_path -%}{{ s }}{%- if not loop.last -%}.{%- endif -%}{%- endfor -%} ')\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.567124}, "macro.fivetran_utils.postgres__json_parse": {"unique_id": "macro.fivetran_utils.postgres__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "postgres__json_parse", "macro_sql": "{% macro postgres__json_parse(string, string_path) %}\n\n {{string}}::json #>> '{ {%- for s in string_path -%}{{ s }}{%- if not loop.last -%},{%- endif -%}{%- endfor -%} }'\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.567459}, "macro.fivetran_utils.snowflake__json_parse": {"unique_id": "macro.fivetran_utils.snowflake__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "snowflake__json_parse", "macro_sql": "{% macro snowflake__json_parse(string, string_path) %}\n\n parse_json( {{string}} ) {%- for s in string_path -%}{% if s is number %}[{{ s }}]{% else %}['{{ s }}']{% endif %}{%- endfor -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5678332}, "macro.fivetran_utils.spark__json_parse": {"unique_id": "macro.fivetran_utils.spark__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/json_parse.sql", "original_file_path": "macros/json_parse.sql", "name": "spark__json_parse", "macro_sql": "{% macro spark__json_parse(string, string_path) %}\n\n {{string}} : {%- for s in string_path -%}{% if s is number %}[{{ s }}]{% else %}['{{ s }}']{% endif %}{%- endfor -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5681221}, "macro.fivetran_utils.max_bool": {"unique_id": "macro.fivetran_utils.max_bool", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "name": "max_bool", "macro_sql": "{% macro max_bool(boolean_field) -%}\n\n{{ adapter.dispatch('max_bool', 'fivetran_utils') (boolean_field) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__max_bool"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5686772}, "macro.fivetran_utils.default__max_bool": {"unique_id": "macro.fivetran_utils.default__max_bool", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "name": "default__max_bool", "macro_sql": "{% macro default__max_bool(boolean_field) %}\n\n bool_or( {{ boolean_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.568786}, "macro.fivetran_utils.snowflake__max_bool": {"unique_id": "macro.fivetran_utils.snowflake__max_bool", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "name": "snowflake__max_bool", "macro_sql": "{% macro snowflake__max_bool(boolean_field) %}\n\n max( {{ boolean_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5688891}, "macro.fivetran_utils.bigquery__max_bool": {"unique_id": "macro.fivetran_utils.bigquery__max_bool", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/max_bool.sql", "original_file_path": "macros/max_bool.sql", "name": "bigquery__max_bool", "macro_sql": "{% macro bigquery__max_bool(boolean_field) %}\n\n max( {{ boolean_field }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.569001}, "macro.fivetran_utils.calculated_fields": {"unique_id": "macro.fivetran_utils.calculated_fields", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/calculated_fields.sql", "original_file_path": "macros/calculated_fields.sql", "name": "calculated_fields", "macro_sql": "{% macro calculated_fields(variable) -%}\n\n{% if var(variable, none) %}\n {% for field in var(variable) %}\n , {{ field.transform_sql }} as {{ field.name }} \n {% endfor %}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.569493}, "macro.fivetran_utils.seed_data_helper": {"unique_id": "macro.fivetran_utils.seed_data_helper", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/seed_data_helper.sql", "original_file_path": "macros/seed_data_helper.sql", "name": "seed_data_helper", "macro_sql": "{% macro seed_data_helper(seed_name, warehouses) %}\n\n{% if target.type in warehouses %}\n {% for w in warehouses %}\n {% if target.type == w %}\n {{ return(ref(seed_name ~ \"_\" ~ w ~ \"\")) }}\n {% endif %}\n {% endfor %}\n{% else %}\n{{ return(ref(seed_name)) }}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.570184}, "macro.fivetran_utils.fill_pass_through_columns": {"unique_id": "macro.fivetran_utils.fill_pass_through_columns", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/fill_pass_through_columns.sql", "original_file_path": "macros/fill_pass_through_columns.sql", "name": "fill_pass_through_columns", "macro_sql": "{% macro fill_pass_through_columns(pass_through_variable) %}\n\n{% if var(pass_through_variable) %}\n {% for field in var(pass_through_variable) %}\n {% if field.transform_sql %}\n , {{ field.transform_sql }} as {{ field.alias if field.alias else field.name }}\n {% else %}\n , {{ field.alias if field.alias else field.name }}\n {% endif %}\n {% endfor %}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.570893}, "macro.fivetran_utils.string_agg": {"unique_id": "macro.fivetran_utils.string_agg", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "string_agg", "macro_sql": "{% macro string_agg(field_to_agg, delimiter) -%}\n\n{{ adapter.dispatch('string_agg', 'fivetran_utils') (field_to_agg, delimiter) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__string_agg"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.571442}, "macro.fivetran_utils.default__string_agg": {"unique_id": "macro.fivetran_utils.default__string_agg", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "default__string_agg", "macro_sql": "{% macro default__string_agg(field_to_agg, delimiter) %}\n string_agg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.571583}, "macro.fivetran_utils.snowflake__string_agg": {"unique_id": "macro.fivetran_utils.snowflake__string_agg", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "snowflake__string_agg", "macro_sql": "{% macro snowflake__string_agg(field_to_agg, delimiter) %}\n listagg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.57172}, "macro.fivetran_utils.redshift__string_agg": {"unique_id": "macro.fivetran_utils.redshift__string_agg", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "redshift__string_agg", "macro_sql": "{% macro redshift__string_agg(field_to_agg, delimiter) %}\n listagg({{ field_to_agg }}, {{ delimiter }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5718558}, "macro.fivetran_utils.spark__string_agg": {"unique_id": "macro.fivetran_utils.spark__string_agg", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/string_agg.sql", "original_file_path": "macros/string_agg.sql", "name": "spark__string_agg", "macro_sql": "{% macro spark__string_agg(field_to_agg, delimiter) %}\n -- collect set will remove duplicates\n replace(replace(replace(cast( collect_set({{ field_to_agg }}) as string), '[', ''), ']', ''), ', ', {{ delimiter }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.571997}, "macro.fivetran_utils.timestamp_diff": {"unique_id": "macro.fivetran_utils.timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "timestamp_diff", "macro_sql": "{% macro timestamp_diff(first_date, second_date, datepart) %}\n {{ adapter.dispatch('timestamp_diff', 'fivetran_utils')(first_date, second_date, datepart) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.postgres__timestamp_diff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.574978}, "macro.fivetran_utils.default__timestamp_diff": {"unique_id": "macro.fivetran_utils.default__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "default__timestamp_diff", "macro_sql": "{% macro default__timestamp_diff(first_date, second_date, datepart) %}\n\n datediff(\n {{ datepart }},\n {{ first_date }},\n {{ second_date }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.57515}, "macro.fivetran_utils.redshift__timestamp_diff": {"unique_id": "macro.fivetran_utils.redshift__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "redshift__timestamp_diff", "macro_sql": "{% macro redshift__timestamp_diff(first_date, second_date, datepart) %}\n\n datediff(\n {{ datepart }},\n {{ first_date }},\n {{ second_date }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.575319}, "macro.fivetran_utils.bigquery__timestamp_diff": {"unique_id": "macro.fivetran_utils.bigquery__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "bigquery__timestamp_diff", "macro_sql": "{% macro bigquery__timestamp_diff(first_date, second_date, datepart) %}\n\n timestamp_diff(\n {{second_date}},\n {{first_date}},\n {{datepart}}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5754821}, "macro.fivetran_utils.postgres__timestamp_diff": {"unique_id": "macro.fivetran_utils.postgres__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.sql", "name": "postgres__timestamp_diff", "macro_sql": "{% macro postgres__timestamp_diff(first_date, second_date, datepart) %}\n\n {% if datepart == 'year' %}\n (date_part('year', ({{second_date}})::date) - date_part('year', ({{first_date}})::date))\n {% elif datepart == 'quarter' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 4 + date_part('quarter', ({{second_date}})::date) - date_part('quarter', ({{first_date}})::date))\n {% elif datepart == 'month' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'year') }} * 12 + date_part('month', ({{second_date}})::date) - date_part('month', ({{first_date}})::date))\n {% elif datepart == 'day' %}\n (({{second_date}})::date - ({{first_date}})::date)\n {% elif datepart == 'week' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} / 7 + case\n when date_part('dow', ({{first_date}})::timestamp) <= date_part('dow', ({{second_date}})::timestamp) then\n case when {{first_date}} <= {{second_date}} then 0 else -1 end\n else\n case when {{first_date}} <= {{second_date}} then 1 else 0 end\n end)\n {% elif datepart == 'hour' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'day') }} * 24 + date_part('hour', ({{second_date}})::timestamp) - date_part('hour', ({{first_date}})::timestamp))\n {% elif datepart == 'minute' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'hour') }} * 60 + date_part('minute', ({{second_date}})::timestamp) - date_part('minute', ({{first_date}})::timestamp))\n {% elif datepart == 'second' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60 + floor(date_part('second', ({{second_date}})::timestamp)) - floor(date_part('second', ({{first_date}})::timestamp)))\n {% elif datepart == 'millisecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000 + floor(date_part('millisecond', ({{second_date}})::timestamp)) - floor(date_part('millisecond', ({{first_date}})::timestamp)))\n {% elif datepart == 'microsecond' %}\n ({{ dbt_utils.datediff(first_date, second_date, 'minute') }} * 60000000 + floor(date_part('microsecond', ({{second_date}})::timestamp)) - floor(date_part('microsecond', ({{first_date}})::timestamp)))\n {% else %}\n {{ exceptions.raise_compiler_error(\"Unsupported datepart for macro datediff in postgres: {!r}\".format(datepart)) }}\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.datediff"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.577264}, "macro.fivetran_utils.try_cast": {"unique_id": "macro.fivetran_utils.try_cast", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "try_cast", "macro_sql": "{% macro try_cast(field, type) %}\n {{ adapter.dispatch('try_cast', 'fivetran_utils') (field, type) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.postgres__try_cast"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5782652}, "macro.fivetran_utils.default__safe_cast": {"unique_id": "macro.fivetran_utils.default__safe_cast", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "default__safe_cast", "macro_sql": "{% macro default__safe_cast(field, type) %}\n {# most databases don't support this function yet\n so we just need to use cast #}\n cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.578413}, "macro.fivetran_utils.redshift__try_cast": {"unique_id": "macro.fivetran_utils.redshift__try_cast", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "redshift__try_cast", "macro_sql": "{% macro redshift__try_cast(field, type) %}\n{%- if type == 'numeric' -%}\n\n case\n when trim({{field}}) ~ '^(0|[1-9][0-9]*)$' then trim({{field}})\n else null\n end::{{type}}\n\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"non-numeric datatypes are not currently supported\") }}\n\n{% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.578698}, "macro.fivetran_utils.postgres__try_cast": {"unique_id": "macro.fivetran_utils.postgres__try_cast", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "postgres__try_cast", "macro_sql": "{% macro postgres__try_cast(field, type) %}\n{%- if type == 'numeric' -%}\n\n case\n when replace(cast({{field}} as varchar),cast(' ' as varchar),cast('' as varchar)) ~ '^(0|[1-9][0-9]*)$' \n then replace(cast({{field}} as varchar),cast(' ' as varchar),cast('' as varchar))\n else null\n end::{{type}}\n\n{% else %}\n {{ exceptions.raise_compiler_error(\n \"non-numeric datatypes are not currently supported\") }}\n\n{% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.578999}, "macro.fivetran_utils.snowflake__try_cast": {"unique_id": "macro.fivetran_utils.snowflake__try_cast", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "snowflake__try_cast", "macro_sql": "{% macro snowflake__try_cast(field, type) %}\n try_cast(cast({{field}} as varchar) as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.579134}, "macro.fivetran_utils.bigquery__try_cast": {"unique_id": "macro.fivetran_utils.bigquery__try_cast", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "bigquery__try_cast", "macro_sql": "{% macro bigquery__try_cast(field, type) %}\n safe_cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.579266}, "macro.fivetran_utils.spark__try_cast": {"unique_id": "macro.fivetran_utils.spark__try_cast", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/try_cast.sql", "original_file_path": "macros/try_cast.sql", "name": "spark__try_cast", "macro_sql": "{% macro spark__try_cast(field, type) %}\n try_cast({{field}} as {{type}})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.579394}, "macro.fivetran_utils.source_relation": {"unique_id": "macro.fivetran_utils.source_relation", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/source_relation.sql", "original_file_path": "macros/source_relation.sql", "name": "source_relation", "macro_sql": "{% macro source_relation(union_schema_variable='union_schemas', union_database_variable='union_databases') -%}\n\n{{ adapter.dispatch('source_relation', 'fivetran_utils') (union_schema_variable, union_database_variable) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__source_relation"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.58}, "macro.fivetran_utils.default__source_relation": {"unique_id": "macro.fivetran_utils.default__source_relation", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/source_relation.sql", "original_file_path": "macros/source_relation.sql", "name": "default__source_relation", "macro_sql": "{% macro default__source_relation(union_schema_variable, union_database_variable) %}\n\n{% if var(union_schema_variable, none) %}\n, case\n {% for schema in var(union_schema_variable) %}\n when lower(replace(replace(_dbt_source_relation,'\"',''),'`','')) like '%.{{ schema|lower }}.%' then '{{ schema|lower }}'\n {% endfor %}\n end as source_relation\n{% elif var(union_database_variable, none) %}\n, case\n {% for database in var(union_database_variable) %}\n when lower(replace(replace(_dbt_source_relation,'\"',''),'`','')) like '%{{ database|lower }}.%' then '{{ database|lower }}'\n {% endfor %}\n end as source_relation\n{% else %}\n, cast('' as {{ dbt_utils.type_string() }}) as source_relation\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5806022}, "macro.fivetran_utils.first_value": {"unique_id": "macro.fivetran_utils.first_value", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "name": "first_value", "macro_sql": "{% macro first_value(first_value_field, partition_field, order_by_field, order=\"asc\") -%}\n\n{{ adapter.dispatch('first_value', 'fivetran_utils') (first_value_field, partition_field, order_by_field, order) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__first_value"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.581176}, "macro.fivetran_utils.default__first_value": {"unique_id": "macro.fivetran_utils.default__first_value", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "name": "default__first_value", "macro_sql": "{% macro default__first_value(first_value_field, partition_field, order_by_field, order=\"asc\") %}\n\n first_value( {{ first_value_field }} ignore nulls ) over (partition by {{ partition_field }} order by {{ order_by_field }} {{ order }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.581388}, "macro.fivetran_utils.redshift__first_value": {"unique_id": "macro.fivetran_utils.redshift__first_value", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/first_value.sql", "original_file_path": "macros/first_value.sql", "name": "redshift__first_value", "macro_sql": "{% macro redshift__first_value(first_value_field, partition_field, order_by_field, order=\"asc\") %}\n\n first_value( {{ first_value_field }} ignore nulls ) over (partition by {{ partition_field }} order by {{ order_by_field }} {{ order }} , {{ partition_field }} rows unbounded preceding )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5816278}, "macro.fivetran_utils.add_dbt_source_relation": {"unique_id": "macro.fivetran_utils.add_dbt_source_relation", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/add_dbt_source_relation.sql", "original_file_path": "macros/add_dbt_source_relation.sql", "name": "add_dbt_source_relation", "macro_sql": "{% macro add_dbt_source_relation() %}\n\n{% if var('union_schemas', none) or var('union_databases', none) %}\n, _dbt_source_relation\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.582022}, "macro.fivetran_utils.add_pass_through_columns": {"unique_id": "macro.fivetran_utils.add_pass_through_columns", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/add_pass_through_columns.sql", "original_file_path": "macros/add_pass_through_columns.sql", "name": "add_pass_through_columns", "macro_sql": "{% macro add_pass_through_columns(base_columns, pass_through_var) %}\n\n {% if pass_through_var %}\n\n {% for column in pass_through_var %}\n\n {% if column.alias %}\n\n {% do base_columns.append({ \"name\": column.name, \"alias\": column.alias, \"datatype\": column.datatype if column.datatype else dbt_utils.type_string()}) %}\n\n {% else %}\n\n {% do base_columns.append({ \"name\": column.name, \"datatype\": column.datatype if column.datatype else dbt_utils.type_string()}) %}\n \n {% endif %}\n\n {% endfor %}\n\n {% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.583114}, "macro.fivetran_utils.union_relations": {"unique_id": "macro.fivetran_utils.union_relations", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/union_relations.sql", "original_file_path": "macros/union_relations.sql", "name": "union_relations", "macro_sql": "{%- macro union_relations(relations, aliases=none, column_override=none, include=[], exclude=[], source_column_name=none) -%}\n\n {%- if exclude and include -%}\n {{ exceptions.raise_compiler_error(\"Both an exclude and include list were provided to the `union` macro. Only one is allowed\") }}\n {%- endif -%}\n\n {#-- Prevent querying of db in parsing mode. This works because this macro does not create any new refs. -#}\n {%- if not execute %}\n {{ return('') }}\n {% endif -%}\n\n {%- set column_override = column_override if column_override is not none else {} -%}\n {%- set source_column_name = source_column_name if source_column_name is not none else '_dbt_source_relation' -%}\n\n {%- set relation_columns = {} -%}\n {%- set column_superset = {} -%}\n\n {%- for relation in relations -%}\n\n {%- do relation_columns.update({relation: []}) -%}\n\n {%- do dbt_utils._is_relation(relation, 'union_relations') -%}\n {%- set cols = adapter.get_columns_in_relation(relation) -%}\n {%- for col in cols -%}\n\n {#- If an exclude list was provided and the column is in the list, do nothing -#}\n {%- if exclude and col.column in exclude -%}\n\n {#- If an include list was provided and the column is not in the list, do nothing -#}\n {%- elif include and col.column not in include -%}\n\n {#- Otherwise add the column to the column superset -#}\n {%- else -%}\n\n {#- update the list of columns in this relation -#}\n {%- do relation_columns[relation].append(col.column) -%}\n\n {%- if col.column in column_superset -%}\n\n {%- set stored = column_superset[col.column] -%}\n {%- if col.is_string() and stored.is_string() and col.string_size() > stored.string_size() -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif %}\n\n {%- else -%}\n\n {%- do column_superset.update({col.column: col}) -%}\n\n {%- endif -%}\n\n {%- endif -%}\n\n {%- endfor -%}\n {%- endfor -%}\n\n {%- set ordered_column_names = column_superset.keys() -%}\n\n {%- for relation in relations %}\n\n (\n select\n\n cast({{ dbt_utils.string_literal(relation) }} as {{ dbt_utils.type_string() }}) as {{ source_column_name }},\n {% for col_name in ordered_column_names -%}\n\n {%- set col = column_superset[col_name] %}\n {%- set col_type = column_override.get(col.column, col.data_type) %}\n {%- set col_name = adapter.quote(col_name) if col_name in relation_columns[relation] else 'null' %}\n cast({{ col_name }} as {{ col_type }}) as {{ col.quoted }} {% if not loop.last %},{% endif -%}\n\n {%- endfor %}\n\n from {{ aliases[loop.index0] if aliases else relation }}\n )\n\n {% if not loop.last -%}\n union all\n {% endif -%}\n\n {%- endfor -%}\n\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils._is_relation", "macro.dbt_utils.string_literal", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5870998}, "macro.fivetran_utils.union_tables": {"unique_id": "macro.fivetran_utils.union_tables", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/union_relations.sql", "original_file_path": "macros/union_relations.sql", "name": "union_tables", "macro_sql": "{%- macro union_tables(tables, column_override=none, include=[], exclude=[], source_column_name='_dbt_source_table') -%}\n\n {%- do exceptions.warn(\"Warning: the `union_tables` macro is no longer supported and will be deprecated in a future release of dbt-utils. Use the `union_relations` macro instead\") -%}\n\n {{ return(dbt_utils.union_relations(tables, column_override, include, exclude, source_column_name)) }}\n\n{%- endmacro -%}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.union_relations"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5874822}, "macro.fivetran_utils.snowflake_seed_data": {"unique_id": "macro.fivetran_utils.snowflake_seed_data", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/snowflake_seed_data.sql", "original_file_path": "macros/snowflake_seed_data.sql", "name": "snowflake_seed_data", "macro_sql": "{% macro snowflake_seed_data(seed_name) %}\n\n{% if target.type == 'snowflake' %}\n{{ return(ref(seed_name ~ '_snowflake')) }}\n{% else %}\n{{ return(ref(seed_name)) }}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.588002}, "macro.fivetran_utils.fill_staging_columns": {"unique_id": "macro.fivetran_utils.fill_staging_columns", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/fill_staging_columns.sql", "original_file_path": "macros/fill_staging_columns.sql", "name": "fill_staging_columns", "macro_sql": "{% macro fill_staging_columns(source_columns, staging_columns) -%}\n\n{%- set source_column_names = source_columns|map(attribute='name')|map('lower')|list -%}\n\n{%- for column in staging_columns %}\n {% if column.name|lower in source_column_names -%}\n {{ fivetran_utils.quote_column(column) }} as \n {%- if 'alias' in column %} {{ column.alias }} {% else %} {{ fivetran_utils.quote_column(column) }} {%- endif -%}\n {%- else -%}\n cast(null as {{ column.datatype }})\n {%- if 'alias' in column %} as {{ column.alias }} {% else %} as {{ fivetran_utils.quote_column(column) }} {% endif -%}\n {%- endif -%}\n {%- if not loop.last -%} , {% endif -%}\n{% endfor %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.quote_column"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.589586}, "macro.fivetran_utils.quote_column": {"unique_id": "macro.fivetran_utils.quote_column", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/fill_staging_columns.sql", "original_file_path": "macros/fill_staging_columns.sql", "name": "quote_column", "macro_sql": "{% macro quote_column(column) %}\n {% if 'quote' in column %}\n {% if column.quote %}\n {% if target.type in ('bigquery', 'spark') %}\n `{{ column.name }}`\n {% elif target.type == 'snowflake' %}\n \"{{ column.name | upper }}\"\n {% else %}\n \"{{ column.name }}\"\n {% endif %}\n {% else %}\n {{ column.name }}\n {% endif %}\n {% else %}\n {{ column.name }}\n {% endif %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.590165}, "macro.fivetran_utils.json_extract": {"unique_id": "macro.fivetran_utils.json_extract", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "json_extract", "macro_sql": "{% macro json_extract(string, string_path) -%}\n\n{{ adapter.dispatch('json_extract', 'fivetran_utils') (string, string_path) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.postgres__json_extract"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.590838}, "macro.fivetran_utils.default__json_extract": {"unique_id": "macro.fivetran_utils.default__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "default__json_extract", "macro_sql": "{% macro default__json_extract(string, string_path) %}\n\n json_extract_path_text({{string}}, {{ \"'\" ~ string_path ~ \"'\" }} )\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5909991}, "macro.fivetran_utils.snowflake__json_extract": {"unique_id": "macro.fivetran_utils.snowflake__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "snowflake__json_extract", "macro_sql": "{% macro snowflake__json_extract(string, string_path) %}\n\n json_extract_path_text(try_parse_json( {{string}} ), {{ \"'\" ~ string_path ~ \"'\" }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5911522}, "macro.fivetran_utils.redshift__json_extract": {"unique_id": "macro.fivetran_utils.redshift__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "redshift__json_extract", "macro_sql": "{% macro redshift__json_extract(string, string_path) %}\n\n case when is_valid_json( {{string}} ) then json_extract_path_text({{string}}, {{ \"'\" ~ string_path ~ \"'\" }} ) else null end\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.591325}, "macro.fivetran_utils.bigquery__json_extract": {"unique_id": "macro.fivetran_utils.bigquery__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "bigquery__json_extract", "macro_sql": "{% macro bigquery__json_extract(string, string_path) %}\n\n json_extract_scalar({{string}}, {{ \"'$.\" ~ string_path ~ \"'\" }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.591481}, "macro.fivetran_utils.postgres__json_extract": {"unique_id": "macro.fivetran_utils.postgres__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/json_extract.sql", "original_file_path": "macros/json_extract.sql", "name": "postgres__json_extract", "macro_sql": "{% macro postgres__json_extract(string, string_path) %}\n\n {{string}}::json->>{{\"'\" ~ string_path ~ \"'\" }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.591634}, "macro.fivetran_utils.collect_freshness": {"unique_id": "macro.fivetran_utils.collect_freshness", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/collect_freshness.sql", "original_file_path": "macros/collect_freshness.sql", "name": "collect_freshness", "macro_sql": "{% macro collect_freshness(source, loaded_at_field, filter) %}\n {{ return(adapter.dispatch('collect_freshness')(source, loaded_at_field, filter))}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__collect_freshness"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.592555}, "macro.fivetran_utils.default__collect_freshness": {"unique_id": "macro.fivetran_utils.default__collect_freshness", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/collect_freshness.sql", "original_file_path": "macros/collect_freshness.sql", "name": "default__collect_freshness", "macro_sql": "{% macro default__collect_freshness(source, loaded_at_field, filter) %}\n {% call statement('collect_freshness', fetch_result=True, auto_begin=False) -%}\n\n {%- set enabled_array = [] -%}\n {% for node in graph.sources.values() %}\n {% if node.identifier == source.identifier %}\n {% if (node.meta['is_enabled'] | default(true)) %}\n {%- do enabled_array.append(1) -%}\n {% endif %}\n {% endif %}\n {% endfor %}\n {% set is_enabled = (enabled_array != []) %}\n\n select\n {% if is_enabled %}\n max({{ loaded_at_field }})\n {% else %} \n {{ current_timestamp() }} {% endif %} as max_loaded_at,\n {{ current_timestamp() }} as snapshotted_at\n\n {% if is_enabled %}\n from {{ source }}\n {% if filter %}\n where {{ filter }}\n {% endif %}\n {% endif %}\n\n {% endcall %}\n {{ return(load_result('collect_freshness').table) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt.statement", "macro.dbt_utils.current_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5935528}, "macro.fivetran_utils.timestamp_add": {"unique_id": "macro.fivetran_utils.timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "timestamp_add", "macro_sql": "{% macro timestamp_add(datepart, interval, from_timestamp) -%}\n\n{{ adapter.dispatch('timestamp_add', 'fivetran_utils') (datepart, interval, from_timestamp) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.postgres__timestamp_add"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.594413}, "macro.fivetran_utils.default__timestamp_add": {"unique_id": "macro.fivetran_utils.default__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "default__timestamp_add", "macro_sql": "{% macro default__timestamp_add(datepart, interval, from_timestamp) %}\n\n timestampadd(\n {{ datepart }},\n {{ interval }},\n {{ from_timestamp }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.594578}, "macro.fivetran_utils.bigquery__timestamp_add": {"unique_id": "macro.fivetran_utils.bigquery__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "bigquery__timestamp_add", "macro_sql": "{% macro bigquery__timestamp_add(datepart, interval, from_timestamp) %}\n\n timestamp_add({{ from_timestamp }}, interval {{ interval }} {{ datepart }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5947342}, "macro.fivetran_utils.redshift__timestamp_add": {"unique_id": "macro.fivetran_utils.redshift__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "redshift__timestamp_add", "macro_sql": "{% macro redshift__timestamp_add(datepart, interval, from_timestamp) %}\n\n dateadd(\n {{ datepart }},\n {{ interval }},\n {{ from_timestamp }}\n )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5948951}, "macro.fivetran_utils.postgres__timestamp_add": {"unique_id": "macro.fivetran_utils.postgres__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "postgres__timestamp_add", "macro_sql": "{% macro postgres__timestamp_add(datepart, interval, from_timestamp) %}\n\n {{ from_timestamp }} + ((interval '1 {{ datepart }}') * ({{ interval }}))\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.595048}, "macro.fivetran_utils.spark__timestamp_add": {"unique_id": "macro.fivetran_utils.spark__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/timestamp_add.sql", "original_file_path": "macros/timestamp_add.sql", "name": "spark__timestamp_add", "macro_sql": "{% macro spark__timestamp_add(datepart, interval, from_timestamp) %}\n\n {{ dbt_utils.dateadd(datepart, interval, from_timestamp) }}\n \n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.595222}, "macro.fivetran_utils.ceiling": {"unique_id": "macro.fivetran_utils.ceiling", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "name": "ceiling", "macro_sql": "{% macro ceiling(num) -%}\n\n{{ adapter.dispatch('ceiling', 'fivetran_utils') (num) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__ceiling"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.595555}, "macro.fivetran_utils.default__ceiling": {"unique_id": "macro.fivetran_utils.default__ceiling", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "name": "default__ceiling", "macro_sql": "{% macro default__ceiling(num) %}\n ceiling({{ num }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5957508}, "macro.fivetran_utils.snowflake__ceiling": {"unique_id": "macro.fivetran_utils.snowflake__ceiling", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "name": "snowflake__ceiling", "macro_sql": "{% macro snowflake__ceiling(num) %}\n ceil({{ num }})\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.595855}, "macro.fivetran_utils.remove_prefix_from_columns": {"unique_id": "macro.fivetran_utils.remove_prefix_from_columns", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/remove_prefix_from_columns.sql", "original_file_path": "macros/remove_prefix_from_columns.sql", "name": "remove_prefix_from_columns", "macro_sql": "{% macro remove_prefix_from_columns(columns, prefix='', exclude=[]) %}\n\n {%- for col in columns if col.name not in exclude -%}\n {%- if col.name[:prefix|length]|lower == prefix -%}\n {{ col.name }} as {{ col.name[prefix|length:] }}\n {%- else -%}\n {{ col.name }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {% endfor -%}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.596564}, "macro.fivetran_utils.union_data": {"unique_id": "macro.fivetran_utils.union_data", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/union_data.sql", "original_file_path": "macros/union_data.sql", "name": "union_data", "macro_sql": "{% macro union_data(table_identifier, database_variable, schema_variable, default_database, default_schema, default_variable, union_schema_variable='union_schemas', union_database_variable='union_databases') -%}\n\n{{ adapter.dispatch('union_data', 'fivetran_utils') (\n table_identifier, \n database_variable, \n schema_variable, \n default_database, \n default_schema, \n default_variable,\n union_schema_variable,\n union_database_variable\n ) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__union_data"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5977888}, "macro.fivetran_utils.default__union_data": {"unique_id": "macro.fivetran_utils.default__union_data", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/union_data.sql", "original_file_path": "macros/union_data.sql", "name": "default__union_data", "macro_sql": "{% macro default__union_data(\n table_identifier, \n database_variable, \n schema_variable, \n default_database, \n default_schema, \n default_variable,\n union_schema_variable,\n union_database_variable\n ) %}\n\n{% if var(union_schema_variable, none) %}\n\n {% set relations = [] %}\n \n {% if var(union_schema_variable) is string %}\n {% set trimmed = var(union_schema_variable)|trim('[')|trim(']') %}\n {% set schemas = trimmed.split(',')|map('trim',\" \")|map('trim','\"')|map('trim',\"'\") %}\n {% else %}\n {% set schemas = var(union_schema_variable) %}\n {% endif %}\n\n {% for schema in var(union_schema_variable) %}\n\n {% set relation=adapter.get_relation(\n database=var(database_variable, default_database),\n schema=schema,\n identifier=table_identifier\n ) -%}\n \n {% set relation_exists=relation is not none %}\n\n {% if relation_exists %}\n\n {% do relations.append(relation) %}\n \n {% endif %}\n\n {% endfor %}\n\n {{ dbt_utils.union_relations(relations) }}\n\n{% elif var(union_database_variable, none) %}\n\n {% set relations = [] %}\n\n {% for database in var(union_database_variable) %}\n\n {% set relation=adapter.get_relation(\n database=database,\n schema=var(schema_variable, default_schema),\n identifier=table_identifier\n ) -%}\n\n {% set relation_exists=relation is not none %}\n\n {% if relation_exists %}\n\n {% do relations.append(relation) %}\n \n {% endif %}\n\n {% endfor %}\n\n {{ dbt_utils.union_relations(relations) }}\n\n{% else %}\n\n select * \n from {{ var(default_variable) }}\n\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.union_relations"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.5995378}, "macro.fivetran_utils.dummy_coalesce_value": {"unique_id": "macro.fivetran_utils.dummy_coalesce_value", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/dummy_coalesce_value.sql", "original_file_path": "macros/dummy_coalesce_value.sql", "name": "dummy_coalesce_value", "macro_sql": "{% macro dummy_coalesce_value(column) %}\n\n{% set coalesce_value = {\n 'STRING': \"'DUMMY_STRING'\",\n 'BOOLEAN': 'null',\n 'INT': 999999999,\n 'FLOAT': 999999999.99,\n 'TIMESTAMP': 'cast(\"2099-12-31\" as timestamp)',\n 'DATE': 'cast(\"2099-12-31\" as date)',\n} %}\n\n{% if column.is_float() %}\n{{ return(coalesce_value['FLOAT']) }}\n\n{% elif column.is_numeric() %}\n{{ return(coalesce_value['INT']) }}\n\n{% elif column.is_string() %}\n{{ return(coalesce_value['STRING']) }}\n\n{% elif column.data_type|lower == 'boolean' %}\n{{ return(coalesce_value['BOOLEAN']) }}\n\n{% elif 'timestamp' in column.data_type|lower %}\n{{ return(coalesce_value['TIMESTAMP']) }}\n\n{% elif 'date' in column.data_type|lower %}\n{{ return(coalesce_value['DATE']) }}\n\n{% elif 'int' in column.data_type|lower %}\n{{ return(coalesce_value['INT']) }}\n\n{% endif %}\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.601061}, "macro.fivetran_utils.array_agg": {"unique_id": "macro.fivetran_utils.array_agg", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "name": "array_agg", "macro_sql": "{% macro array_agg(field_to_agg) -%}\n\n{{ adapter.dispatch('array_agg', 'fivetran_utils') (field_to_agg) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.fivetran_utils.default__array_agg"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.601428}, "macro.fivetran_utils.default__array_agg": {"unique_id": "macro.fivetran_utils.default__array_agg", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "name": "default__array_agg", "macro_sql": "{% macro default__array_agg(field_to_agg) %}\n array_agg({{ field_to_agg }})\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.601532}, "macro.fivetran_utils.redshift__array_agg": {"unique_id": "macro.fivetran_utils.redshift__array_agg", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "name": "redshift__array_agg", "macro_sql": "{% macro redshift__array_agg(field_to_agg) %}\n listagg({{ field_to_agg }}, ',')\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.6016362}, "macro.fivetran_utils.empty_variable_warning": {"unique_id": "macro.fivetran_utils.empty_variable_warning", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/empty_variable_warning.sql", "original_file_path": "macros/empty_variable_warning.sql", "name": "empty_variable_warning", "macro_sql": "{% macro empty_variable_warning(variable, downstream_model) %}\n\n{% if not var(variable) %}\n{{ log(\n \"\"\"\n Warning: You have passed an empty list to the \"\"\" ~ variable ~ \"\"\".\n As a result, you won't see the history of any columns in the \"\"\" ~ downstream_model ~ \"\"\" model.\n \"\"\",\n info=True\n) }}\n{% endif %}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.602132}, "macro.fivetran_utils.enabled_vars_one_true": {"unique_id": "macro.fivetran_utils.enabled_vars_one_true", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/fivetran_utils", "path": "macros/enabled_vars_one_true.sql", "original_file_path": "macros/enabled_vars_one_true.sql", "name": "enabled_vars_one_true", "macro_sql": "{% macro enabled_vars_one_true(vars) %}\n\n{% for v in vars %}\n \n {% if var(v, False) == True %}\n {{ return(True) }}\n {% endif %}\n\n{% endfor %}\n\n{{ return(False) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.602612}, "macro.tiktok_ads_source.get_ad_group_history_columns": {"unique_id": "macro.tiktok_ads_source.get_ad_group_history_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "macros/get_ad_group_history_columns.sql", "original_file_path": "macros/get_ad_group_history_columns.sql", "name": "get_ad_group_history_columns", "macro_sql": "{% macro get_ad_group_history_columns() %}\n\n{% set columns = [\n {\"name\": \"action_days\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"adgroup_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"adgroup_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"advertiser_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"audience_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"budget\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"category\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"display_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"frequency\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"frequency_schedule\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"gender\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"landing_page_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"updated_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"interest_category_v_2\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"action_categories\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"age\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"languages\", \"datatype\": dbt_utils.type_string()}\n\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_numeric", "macro.dbt_utils.type_string", "macro.dbt_utils.type_float", "macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.6048992}, "macro.tiktok_ads_source.get_ad_group_report_hourly_columns": {"unique_id": "macro.tiktok_ads_source.get_ad_group_report_hourly_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "macros/get_ad_group_report_hourly_columns.sql", "original_file_path": "macros/get_ad_group_report_hourly_columns.sql", "name": "get_ad_group_report_hourly_columns", "macro_sql": "{% macro get_ad_group_report_hourly_columns() %}\n\n{% set columns = [\n {\"name\": \"adgroup_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"average_video_play\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"average_video_play_per_user\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"clicks\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"comments\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_conversion\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cpc\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cpm\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"ctr\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"follows\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"impressions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"likes\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"profile_visits\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"reach\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"shares\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"spend\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"stat_time_hour\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"video_play_actions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_25\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_50\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_75\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_2_s\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_6_s\", \"datatype\": dbt_utils.type_numeric()}\n] %}\n\n{{ return(columns) }}\n\n{{ fivetran_utils.add_pass_through_columns(columns, var('tiktok_ads__ad_group_hourly_passthrough_metrics')) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_numeric", "macro.dbt_utils.type_float", "macro.dbt_utils.type_timestamp", "macro.fivetran_utils.add_pass_through_columns"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.608063}, "macro.tiktok_ads_source.get_advertiser_columns": {"unique_id": "macro.tiktok_ads_source.get_advertiser_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "macros/get_advertiser_columns.sql", "original_file_path": "macros/get_advertiser_columns.sql", "name": "get_advertiser_columns", "macro_sql": "{% macro get_advertiser_columns() %}\n\n{% set columns = [\n {\"name\": \"address\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"balance\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"company\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"contacter\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"country\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"currency\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"description\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"email\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"industry\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"language\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"phone_number\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"telephone\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"timezone\", \"datatype\": dbt_utils.type_string()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string", "macro.dbt_utils.type_float", "macro.dbt_utils.type_numeric"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.6099799}, "macro.tiktok_ads_source.get_campaign_history_columns": {"unique_id": "macro.tiktok_ads_source.get_campaign_history_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "macros/get_campaign_history_columns.sql", "original_file_path": "macros/get_campaign_history_columns.sql", "name": "get_campaign_history_columns", "macro_sql": "{% macro get_campaign_history_columns() %}\n\n{% set columns = [\n {\"name\": \"advertiser_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"campaign_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"split_test_variable\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"updated_at\", \"datatype\": dbt_utils.type_timestamp()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_numeric", "macro.dbt_utils.type_string", "macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.6109471}, "macro.tiktok_ads_source.get_campaign_report_hourly_columns": {"unique_id": "macro.tiktok_ads_source.get_campaign_report_hourly_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "macros/get_campaign_report_hourly_columns.sql", "original_file_path": "macros/get_campaign_report_hourly_columns.sql", "name": "get_campaign_report_hourly_columns", "macro_sql": "{% macro get_campaign_report_hourly_columns() %}\n\n{% set columns = [\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"average_video_play\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"average_video_play_per_user\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"clicks\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"comments\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_conversion\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cpc\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cpm\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"ctr\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"follows\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"impressions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"likes\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"profile_visits\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"reach\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"shares\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"spend\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"stat_time_hour\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"video_play_actions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_25\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_50\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_75\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_2_s\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_6_s\", \"datatype\": dbt_utils.type_numeric()}\n] %}\n\n{{ return(columns) }}\n\n{{ fivetran_utils.add_pass_through_columns(columns, var('tiktok_ads__campaign_hourly_passthrough_metrics')) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_numeric", "macro.dbt_utils.type_float", "macro.dbt_utils.type_timestamp", "macro.fivetran_utils.add_pass_through_columns"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.614196}, "macro.tiktok_ads_source.get_ad_history_columns": {"unique_id": "macro.tiktok_ads_source.get_ad_history_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "macros/get_ad_history_columns.sql", "original_file_path": "macros/get_ad_history_columns.sql", "name": "get_ad_history_columns", "macro_sql": "{% macro get_ad_history_columns() %}\n\n{% set columns = [\n {\"name\": \"ad_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"ad_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"adgroup_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"advertiser_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"call_to_action\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"campaign_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"click_tracking_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"impression_tracking_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"landing_page_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"updated_at\", \"datatype\": dbt_utils.type_timestamp()}\n\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_numeric", "macro.dbt_utils.type_string", "macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.615783}, "macro.tiktok_ads_source.get_ad_report_hourly_columns": {"unique_id": "macro.tiktok_ads_source.get_ad_report_hourly_columns", "package_name": "tiktok_ads_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/ad_reporting/tiktok/dbt_tiktok_ads_source/integration_tests/dbt_packages/tiktok_ads_source", "path": "macros/get_ad_report_hourly_columns.sql", "original_file_path": "macros/get_ad_report_hourly_columns.sql", "name": "get_ad_report_hourly_columns", "macro_sql": "{% macro get_ad_report_hourly_columns() %}\n\n{% set columns = [\n {\"name\": \"ad_id\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"average_video_play\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"average_video_play_per_user\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"clicks\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"comments\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"conversion_rate\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cost_per_conversion\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cpc\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"cpm\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"ctr\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"follows\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"impressions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"likes\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"profile_visits\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"reach\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"shares\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"spend\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"stat_time_hour\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"video_play_actions\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_25\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_50\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_views_p_75\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_2_s\", \"datatype\": dbt_utils.type_numeric()},\n {\"name\": \"video_watched_6_s\", \"datatype\": dbt_utils.type_numeric()}\n] %}\n\n{{ return(columns) }}\n\n{{ fivetran_utils.add_pass_through_columns(columns, var('tiktok_ads__ad_hourly_passthrough_metrics')) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_numeric", "macro.dbt_utils.type_float", "macro.dbt_utils.type_timestamp", "macro.fivetran_utils.add_pass_through_columns"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1661544121.6188931}}, "docs": {"dbt.__overview__": {"unique_id": "dbt.__overview__", "package_name": "dbt", "root_path": "/opt/homebrew/Cellar/dbt-postgres/1.0.4/libexec/lib/python3.9/site-packages/dbt/include/global_project", "path": "overview.md", "original_file_path": "docs/overview.md", "name": "__overview__", "block_contents": "### Welcome!\n\nWelcome to the auto-generated documentation for your dbt project!\n\n### Navigation\n\nYou can use the `Project` and `Database` navigation tabs on the left side of the window to explore the models\nin your project.\n\n#### Project Tab\nThe `Project` tab mirrors the directory structure of your dbt project. In this tab, you can see all of the\nmodels defined in your dbt project, as well as models imported from dbt packages.\n\n#### Database Tab\nThe `Database` tab also exposes your models, but in a format that looks more like a database explorer. This view\nshows relations (tables and views) grouped into database schemas. Note that ephemeral models are _not_ shown\nin this interface, as they do not exist in the database.\n\n### Graph Exploration\nYou can click the blue icon on the bottom-right corner of the page to view the lineage graph of your models.\n\nOn model pages, you'll see the immediate parents and children of the model you're exploring. By clicking the `Expand`\nbutton at the top-right of this lineage pane, you'll be able to see all of the models that are used to build,\nor are built from, the model you're exploring.\n\nOnce expanded, you'll be able to use the `--select` and `--exclude` model selection syntax to filter the\nmodels in the graph. For more information on model selection, check out the [dbt docs](https://docs.getdbt.com/docs/model-selection-syntax).\n\nNote that you can also right-click on models to interactively filter and explore the graph.\n\n---\n\n### More information\n\n- [What is dbt](https://docs.getdbt.com/docs/introduction)?\n- Read the [dbt viewpoint](https://docs.getdbt.com/docs/viewpoint)\n- [Installation](https://docs.getdbt.com/docs/installation)\n- Join the [dbt Community](https://www.getdbt.com/community/) for questions and discussion"}}, "exposures": {}, "metrics": {}, "selectors": {}, "disabled": {}, "parent_map": {"seed.tiktok_ads_source_integration_tests.tiktok_ad_history_data": [], "seed.tiktok_ads_source_integration_tests.tiktok_adgroup_report_hourly_data": [], "seed.tiktok_ads_source_integration_tests.tiktok_campaign_history_data": [], "seed.tiktok_ads_source_integration_tests.tiktok_advertiser_data": [], "seed.tiktok_ads_source_integration_tests.tiktok_ad_report_hourly_data": [], "seed.tiktok_ads_source_integration_tests.tiktok_campaign_report_hourly_data": [], "seed.tiktok_ads_source_integration_tests.tiktok_adgroup_history_data": [], "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__advertiser": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp", "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__ad_history": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_history": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp", "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp"], "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp": ["source.tiktok_ads_source.tiktok_ads.ad_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp": ["source.tiktok_ads_source.tiktok_ads.ad_history"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp": ["source.tiktok_ads_source.tiktok_ads.adgroup_history"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp": ["source.tiktok_ads_source.tiktok_ads.campaign_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp": ["source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp": ["source.tiktok_ads_source.tiktok_ads.campaign_history"], "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp": ["source.tiktok_ads_source.tiktok_ads.advertiser"], "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_ad_id.ee84d783ed": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour.9e2a2dca81": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour.ca4b495127": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"], "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour.e75e13184c": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"], "source.tiktok_ads_source.tiktok_ads.advertiser": [], "source.tiktok_ads_source.tiktok_ads.campaign_history": [], "source.tiktok_ads_source.tiktok_ads.adgroup_history": [], "source.tiktok_ads_source.tiktok_ads.ad_history": [], "source.tiktok_ads_source.tiktok_ads.ad_report_hourly": [], "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly": [], "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly": []}, "child_map": {"seed.tiktok_ads_source_integration_tests.tiktok_ad_history_data": [], "seed.tiktok_ads_source_integration_tests.tiktok_adgroup_report_hourly_data": [], "seed.tiktok_ads_source_integration_tests.tiktok_campaign_history_data": [], "seed.tiktok_ads_source_integration_tests.tiktok_advertiser_data": [], "seed.tiktok_ads_source_integration_tests.tiktok_ad_report_hourly_data": [], "seed.tiktok_ads_source_integration_tests.tiktok_campaign_report_hourly_data": [], "seed.tiktok_ads_source_integration_tests.tiktok_adgroup_history_data": [], "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly": ["test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34", "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb", "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour.e75e13184c"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly": ["test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad", "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1", "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour.ca4b495127"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history": ["test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de", "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad"], "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly": ["test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d", "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_ad_id.ee84d783ed", "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour.9e2a2dca81"], "model.tiktok_ads_source.stg_tiktok_ads__advertiser": ["test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def", "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66"], "model.tiktok_ads_source.stg_tiktok_ads__ad_history": ["test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1", "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_history": ["test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b", "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1"], "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history", "model.tiktok_ads_source.stg_tiktok_ads__ad_history"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly", "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"], "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history", "model.tiktok_ads_source.stg_tiktok_ads__campaign_history"], "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser", "model.tiktok_ads_source.stg_tiktok_ads__advertiser"], "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_ad_id.ee84d783ed": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour.9e2a2dca81": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour.ca4b495127": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb": [], "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour.e75e13184c": [], "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34": [], "source.tiktok_ads_source.tiktok_ads.advertiser": ["model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp"], "source.tiktok_ads_source.tiktok_ads.campaign_history": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp"], "source.tiktok_ads_source.tiktok_ads.adgroup_history": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp"], "source.tiktok_ads_source.tiktok_ads.ad_history": ["model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp"], "source.tiktok_ads_source.tiktok_ads.ad_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp"], "source.tiktok_ads_source.tiktok_ads.campaign_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp"], "source.tiktok_ads_source.tiktok_ads.adgroup_report_hourly": ["model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp"]}} \ No newline at end of file diff --git a/docs/run_results.json b/docs/run_results.json index 9257fd9..0e6529f 100644 --- a/docs/run_results.json +++ b/docs/run_results.json @@ -1 +1 @@ -{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/run-results/v4.json", "dbt_version": "1.0.0", "generated_at": "2022-07-28T16:21:12.570906Z", "invocation_id": "73d9028b-4406-406d-9101-01780cecfbb9", "env": {}}, "results": [{"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.068325Z", "completed_at": "2022-07-28T16:21:11.090293Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.091156Z", "completed_at": "2022-07-28T16:21:11.091195Z"}], "thread_id": "Thread-1", "execution_time": 0.026488065719604492, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.069018Z", "completed_at": "2022-07-28T16:21:11.090890Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.092955Z", "completed_at": "2022-07-28T16:21:11.092966Z"}], "thread_id": "Thread-2", "execution_time": 0.027742862701416016, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.075447Z", "completed_at": "2022-07-28T16:21:11.091440Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.093627Z", "completed_at": "2022-07-28T16:21:11.093638Z"}], "thread_id": "Thread-3", "execution_time": 0.0279691219329834, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.075673Z", "completed_at": "2022-07-28T16:21:11.091644Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.093947Z", "completed_at": "2022-07-28T16:21:11.093958Z"}], "thread_id": "Thread-4", "execution_time": 0.027974843978881836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.097901Z", "completed_at": "2022-07-28T16:21:11.105289Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.122391Z", "completed_at": "2022-07-28T16:21:11.122409Z"}], "thread_id": "Thread-1", "execution_time": 0.028783082962036133, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.104794Z", "completed_at": "2022-07-28T16:21:11.124407Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.126970Z", "completed_at": "2022-07-28T16:21:11.126982Z"}], "thread_id": "Thread-3", "execution_time": 0.037214040756225586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.104449Z", "completed_at": "2022-07-28T16:21:11.125455Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.134915Z", "completed_at": "2022-07-28T16:21:11.134928Z"}], "thread_id": "Thread-2", "execution_time": 0.03870391845703125, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.126241Z", "completed_at": "2022-07-28T16:21:11.615795Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.616155Z", "completed_at": "2022-07-28T16:21:11.616166Z"}], "thread_id": "Thread-1", "execution_time": 0.49252915382385254, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.140923Z", "completed_at": "2022-07-28T16:21:11.637321Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.637664Z", "completed_at": "2022-07-28T16:21:11.637673Z"}], "thread_id": "Thread-2", "execution_time": 0.49871373176574707, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.140723Z", "completed_at": "2022-07-28T16:21:11.754491Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.758504Z", "completed_at": "2022-07-28T16:21:11.758514Z"}], "thread_id": "Thread-3", "execution_time": 0.6203320026397705, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.105097Z", "completed_at": "2022-07-28T16:21:11.763441Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.764740Z", "completed_at": "2022-07-28T16:21:11.764749Z"}], "thread_id": "Thread-4", "execution_time": 0.666701078414917, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.765955Z", "completed_at": "2022-07-28T16:21:11.779778Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.780054Z", "completed_at": "2022-07-28T16:21:11.780062Z"}], "thread_id": "Thread-4", "execution_time": 0.014925956726074219, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.781410Z", "completed_at": "2022-07-28T16:21:11.787909Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.788162Z", "completed_at": "2022-07-28T16:21:11.788169Z"}], "thread_id": "Thread-4", "execution_time": 0.0075190067291259766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.789154Z", "completed_at": "2022-07-28T16:21:11.793480Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.794227Z", "completed_at": "2022-07-28T16:21:11.794260Z"}], "thread_id": "Thread-4", "execution_time": 0.0059320926666259766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour.ca4b495127"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.795566Z", "completed_at": "2022-07-28T16:21:11.799910Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.800165Z", "completed_at": "2022-07-28T16:21:11.800171Z"}], "thread_id": "Thread-4", "execution_time": 0.005239009857177734, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.801246Z", "completed_at": "2022-07-28T16:21:11.805132Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.805412Z", "completed_at": "2022-07-28T16:21:11.805419Z"}], "thread_id": "Thread-4", "execution_time": 0.004843711853027344, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_ad_id.ee84d783ed"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.806283Z", "completed_at": "2022-07-28T16:21:11.810030Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.810290Z", "completed_at": "2022-07-28T16:21:11.810297Z"}], "thread_id": "Thread-4", "execution_time": 0.004577159881591797, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour.9e2a2dca81"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.816183Z", "completed_at": "2022-07-28T16:21:11.820571Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.820993Z", "completed_at": "2022-07-28T16:21:11.821015Z"}], "thread_id": "Thread-4", "execution_time": 0.00578618049621582, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.823359Z", "completed_at": "2022-07-28T16:21:11.826797Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.827396Z", "completed_at": "2022-07-28T16:21:11.827403Z"}], "thread_id": "Thread-4", "execution_time": 0.006294965744018555, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.833345Z", "completed_at": "2022-07-28T16:21:11.837982Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.838247Z", "completed_at": "2022-07-28T16:21:11.838253Z"}], "thread_id": "Thread-4", "execution_time": 0.005467891693115234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.839158Z", "completed_at": "2022-07-28T16:21:11.842407Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.842814Z", "completed_at": "2022-07-28T16:21:11.842822Z"}], "thread_id": "Thread-4", "execution_time": 0.0043408870697021484, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.843730Z", "completed_at": "2022-07-28T16:21:11.862142Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.862428Z", "completed_at": "2022-07-28T16:21:11.862438Z"}], "thread_id": "Thread-4", "execution_time": 0.01930069923400879, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_ad_id__updated_at.f58d824f65"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.863367Z", "completed_at": "2022-07-28T16:21:11.869161Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.869421Z", "completed_at": "2022-07-28T16:21:11.869428Z"}], "thread_id": "Thread-4", "execution_time": 0.006623029708862305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_ad_id.14e9c145ca"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.870315Z", "completed_at": "2022-07-28T16:21:11.877417Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.877673Z", "completed_at": "2022-07-28T16:21:11.877680Z"}], "thread_id": "Thread-4", "execution_time": 0.007972955703735352, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_ad_group_ad_group_id__updated_at.e2e9914076"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.878537Z", "completed_at": "2022-07-28T16:21:11.883296Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:11.883599Z", "completed_at": "2022-07-28T16:21:11.883606Z"}], "thread_id": "Thread-4", "execution_time": 0.0056247711181640625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_ad_group_ad_group_id.fcb8c561bc"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.629302Z", "completed_at": "2022-07-28T16:21:12.138409Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.138740Z", "completed_at": "2022-07-28T16:21:12.138750Z"}], "thread_id": "Thread-1", "execution_time": 0.5140399932861328, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.144633Z", "completed_at": "2022-07-28T16:21:12.168490Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.168874Z", "completed_at": "2022-07-28T16:21:12.168885Z"}], "thread_id": "Thread-1", "execution_time": 0.027053117752075195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.144310Z", "completed_at": "2022-07-28T16:21:12.169982Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.171651Z", "completed_at": "2022-07-28T16:21:12.171659Z"}], "thread_id": "Thread-4", "execution_time": 0.030555009841918945, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.638923Z", "completed_at": "2022-07-28T16:21:12.177715Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.216179Z", "completed_at": "2022-07-28T16:21:12.216191Z"}], "thread_id": "Thread-2", "execution_time": 0.58514404296875, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.171900Z", "completed_at": "2022-07-28T16:21:12.227541Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.228751Z", "completed_at": "2022-07-28T16:21:12.228760Z"}], "thread_id": "Thread-1", "execution_time": 0.0684669017791748, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads.tiktok_ads__account_report"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:11.759897Z", "completed_at": "2022-07-28T16:21:12.228619Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.239347Z", "completed_at": "2022-07-28T16:21:12.239360Z"}], "thread_id": "Thread-3", "execution_time": 0.4814000129699707, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.228308Z", "completed_at": "2022-07-28T16:21:12.240157Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.242495Z", "completed_at": "2022-07-28T16:21:12.242505Z"}], "thread_id": "Thread-4", "execution_time": 0.018278121948242188, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.228473Z", "completed_at": "2022-07-28T16:21:12.240880Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.242955Z", "completed_at": "2022-07-28T16:21:12.242963Z"}], "thread_id": "Thread-2", "execution_time": 0.017102956771850586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.243117Z", "completed_at": "2022-07-28T16:21:12.256227Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.258059Z", "completed_at": "2022-07-28T16:21:12.258070Z"}], "thread_id": "Thread-1", "execution_time": 0.02609419822692871, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour.e75e13184c"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.249564Z", "completed_at": "2022-07-28T16:21:12.257830Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.267984Z", "completed_at": "2022-07-28T16:21:12.267994Z"}], "thread_id": "Thread-3", "execution_time": 0.026739835739135742, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__account_report_advertiser_id__date_day.7b27a2f43b"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.257617Z", "completed_at": "2022-07-28T16:21:12.268868Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.270701Z", "completed_at": "2022-07-28T16:21:12.270709Z"}], "thread_id": "Thread-2", "execution_time": 0.01612997055053711, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.not_null_tiktok_ads__account_report_date_day.5a77812746"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.257450Z", "completed_at": "2022-07-28T16:21:12.269102Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.270972Z", "completed_at": "2022-07-28T16:21:12.270997Z"}], "thread_id": "Thread-4", "execution_time": 0.022071123123168945, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.not_null_tiktok_ads__account_report_advertiser_id.bbeabada6f"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.276945Z", "completed_at": "2022-07-28T16:21:12.285033Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.292153Z", "completed_at": "2022-07-28T16:21:12.292180Z"}], "thread_id": "Thread-3", "execution_time": 0.02172708511352539, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.284740Z", "completed_at": "2022-07-28T16:21:12.292508Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.310565Z", "completed_at": "2022-07-28T16:21:12.310585Z"}], "thread_id": "Thread-2", "execution_time": 0.08010220527648926, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.293152Z", "completed_at": "2022-07-28T16:21:12.377747Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.415749Z", "completed_at": "2022-07-28T16:21:12.415762Z"}], "thread_id": "Thread-4", "execution_time": 0.12711620330810547, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads.tiktok_ads__ad_group_report"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.293489Z", "completed_at": "2022-07-28T16:21:12.383468Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.416503Z", "completed_at": "2022-07-28T16:21:12.416531Z"}], "thread_id": "Thread-1", "execution_time": 0.136322021484375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads.tiktok_ads__ad_report"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.377520Z", "completed_at": "2022-07-28T16:21:12.422563Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.467138Z", "completed_at": "2022-07-28T16:21:12.467147Z"}], "thread_id": "Thread-3", "execution_time": 0.12116503715515137, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads.tiktok_ads__campaign_report"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.415962Z", "completed_at": "2022-07-28T16:21:12.467936Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.478288Z", "completed_at": "2022-07-28T16:21:12.478298Z"}], "thread_id": "Thread-2", "execution_time": 0.10742497444152832, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads.tiktok_ads__url_report"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.468549Z", "completed_at": "2022-07-28T16:21:12.485999Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.492368Z", "completed_at": "2022-07-28T16:21:12.492381Z"}], "thread_id": "Thread-4", "execution_time": 0.0265347957611084, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_int_tiktok_ads__most_recent_campaign_campaign_id__updated_at.39077adf71"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.469159Z", "completed_at": "2022-07-28T16:21:12.486871Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.493420Z", "completed_at": "2022-07-28T16:21:12.493429Z"}], "thread_id": "Thread-1", "execution_time": 0.0271451473236084, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.not_null_int_tiktok_ads__most_recent_campaign_campaign_id.8cefa8981c"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.486566Z", "completed_at": "2022-07-28T16:21:12.493787Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.501307Z", "completed_at": "2022-07-28T16:21:12.501322Z"}], "thread_id": "Thread-3", "execution_time": 0.023773908615112305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_group_report_ad_group_id__date_day.2eb4c2ff6d"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.493612Z", "completed_at": "2022-07-28T16:21:12.502045Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.507709Z", "completed_at": "2022-07-28T16:21:12.507720Z"}], "thread_id": "Thread-2", "execution_time": 0.026862144470214844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.not_null_tiktok_ads__ad_group_report_ad_group_id.17fb8710f4"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.502515Z", "completed_at": "2022-07-28T16:21:12.514330Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.519615Z", "completed_at": "2022-07-28T16:21:12.519639Z"}], "thread_id": "Thread-4", "execution_time": 0.019835233688354492, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.not_null_tiktok_ads__ad_group_report_date_day.e39164964e"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.507465Z", "completed_at": "2022-07-28T16:21:12.515200Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.520851Z", "completed_at": "2022-07-28T16:21:12.520882Z"}], "thread_id": "Thread-1", "execution_time": 0.020378828048706055, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__ad_report_ad_id__date_day.15357fac89"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.514868Z", "completed_at": "2022-07-28T16:21:12.521396Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.527473Z", "completed_at": "2022-07-28T16:21:12.527482Z"}], "thread_id": "Thread-3", "execution_time": 0.02046799659729004, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.not_null_tiktok_ads__ad_report_ad_id.2d8166e707"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.521173Z", "completed_at": "2022-07-28T16:21:12.528116Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.534750Z", "completed_at": "2022-07-28T16:21:12.534759Z"}], "thread_id": "Thread-2", "execution_time": 0.026067018508911133, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.not_null_tiktok_ads__ad_report_date_day.d61ee4a5ed"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.528580Z", "completed_at": "2022-07-28T16:21:12.541693Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.543084Z", "completed_at": "2022-07-28T16:21:12.543094Z"}], "thread_id": "Thread-4", "execution_time": 0.02095317840576172, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__campaign_report_campaign_id__date_day.cc5f756c69"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.534572Z", "completed_at": "2022-07-28T16:21:12.542671Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.548018Z", "completed_at": "2022-07-28T16:21:12.548030Z"}], "thread_id": "Thread-1", "execution_time": 0.021209001541137695, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.not_null_tiktok_ads__campaign_report_campaign_id.8a2b0c8ef8"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.542525Z", "completed_at": "2022-07-28T16:21:12.548721Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.556181Z", "completed_at": "2022-07-28T16:21:12.556195Z"}], "thread_id": "Thread-3", "execution_time": 0.02240729331970215, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.not_null_tiktok_ads__campaign_report_date_day.3807b0e836"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.548246Z", "completed_at": "2022-07-28T16:21:12.557066Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.562825Z", "completed_at": "2022-07-28T16:21:12.562834Z"}], "thread_id": "Thread-2", "execution_time": 0.024405956268310547, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.dbt_utils_unique_combination_of_columns_tiktok_ads__url_report_ad_id__date_day.8b73e512af"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.556803Z", "completed_at": "2022-07-28T16:21:12.567597Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.568195Z", "completed_at": "2022-07-28T16:21:12.568205Z"}], "thread_id": "Thread-4", "execution_time": 0.013918876647949219, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.not_null_tiktok_ads__url_report_ad_id.6c41067bd0"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-07-28T16:21:12.562492Z", "completed_at": "2022-07-28T16:21:12.568648Z"}, {"name": "execute", "started_at": "2022-07-28T16:21:12.569064Z", "completed_at": "2022-07-28T16:21:12.569071Z"}], "thread_id": "Thread-1", "execution_time": 0.012896060943603516, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads.not_null_tiktok_ads__url_report_date_day.d593573eff"}], "elapsed_time": 2.4011290073394775, "args": {"write_json": true, "use_colors": true, "printer_width": 80, "version_check": true, "partial_parse": true, "static_parser": true, "profiles_dir": "/Users/renee.li/.dbt", "send_anonymous_usage_stats": true, "event_buffer_size": 100000, "compile": true, "which": "generate", "rpc_method": "docs.generate", "indirect_selection": "eager"}} \ No newline at end of file +{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/run-results/v4.json", "dbt_version": "1.0.4", "generated_at": "2022-08-26T20:02:12.569909Z", "invocation_id": "9fdbca68-4741-4af7-99ac-be7d5e1618c0", "env": {}}, "results": [{"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:11.850778Z", "completed_at": "2022-08-26T20:02:11.856042Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:11.862744Z", "completed_at": "2022-08-26T20:02:11.862761Z"}], "thread_id": "Thread-4", "execution_time": 0.012812137603759766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:11.853304Z", "completed_at": "2022-08-26T20:02:11.861739Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:11.863522Z", "completed_at": "2022-08-26T20:02:11.863527Z"}], "thread_id": "Thread-1", "execution_time": 0.014765024185180664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:11.855738Z", "completed_at": "2022-08-26T20:02:11.862877Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:11.864081Z", "completed_at": "2022-08-26T20:02:11.864085Z"}], "thread_id": "Thread-3", "execution_time": 0.015077829360961914, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:11.855884Z", "completed_at": "2022-08-26T20:02:11.863360Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:11.864859Z", "completed_at": "2022-08-26T20:02:11.864865Z"}], "thread_id": "Thread-2", "execution_time": 0.015987873077392578, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:11.866171Z", "completed_at": "2022-08-26T20:02:11.872316Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:11.875913Z", "completed_at": "2022-08-26T20:02:11.875922Z"}], "thread_id": "Thread-4", "execution_time": 0.011881113052368164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:11.869554Z", "completed_at": "2022-08-26T20:02:11.875777Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:11.876566Z", "completed_at": "2022-08-26T20:02:11.876570Z"}], "thread_id": "Thread-1", "execution_time": 0.01099085807800293, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:11.872478Z", "completed_at": "2022-08-26T20:02:11.876029Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:11.876776Z", "completed_at": "2022-08-26T20:02:11.876779Z"}], "thread_id": "Thread-2", "execution_time": 0.008059263229370117, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.tiktok_ads_source_integration_tests.tiktok_ad_history_data"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:11.869843Z", "completed_at": "2022-08-26T20:02:11.876089Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:11.876880Z", "completed_at": "2022-08-26T20:02:11.876882Z"}], "thread_id": "Thread-3", "execution_time": 0.010905027389526367, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:11.878059Z", "completed_at": "2022-08-26T20:02:11.881236Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:11.885651Z", "completed_at": "2022-08-26T20:02:11.885660Z"}], "thread_id": "Thread-4", "execution_time": 0.009119987487792969, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.tiktok_ads_source_integration_tests.tiktok_ad_report_hourly_data"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:11.881117Z", "completed_at": "2022-08-26T20:02:11.885516Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:11.886516Z", "completed_at": "2022-08-26T20:02:11.886520Z"}], "thread_id": "Thread-1", "execution_time": 0.009266138076782227, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.tiktok_ads_source_integration_tests.tiktok_adgroup_history_data"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:11.881340Z", "completed_at": "2022-08-26T20:02:11.885772Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:11.886912Z", "completed_at": "2022-08-26T20:02:11.886918Z"}], "thread_id": "Thread-2", "execution_time": 0.009424924850463867, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.tiktok_ads_source_integration_tests.tiktok_adgroup_report_hourly_data"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:11.881418Z", "completed_at": "2022-08-26T20:02:11.885874Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:11.887026Z", "completed_at": "2022-08-26T20:02:11.887030Z"}], "thread_id": "Thread-3", "execution_time": 0.009459972381591797, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.tiktok_ads_source_integration_tests.tiktok_advertiser_data"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:11.888510Z", "completed_at": "2022-08-26T20:02:11.890584Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:11.904204Z", "completed_at": "2022-08-26T20:02:11.904211Z"}], "thread_id": "Thread-4", "execution_time": 0.01733088493347168, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.tiktok_ads_source_integration_tests.tiktok_campaign_history_data"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:11.890493Z", "completed_at": "2022-08-26T20:02:11.904105Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:11.904982Z", "completed_at": "2022-08-26T20:02:11.904988Z"}], "thread_id": "Thread-1", "execution_time": 0.017188072204589844, "adapter_response": {}, "message": null, "failures": null, "unique_id": "seed.tiktok_ads_source_integration_tests.tiktok_campaign_report_hourly_data"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:11.890759Z", "completed_at": "2022-08-26T20:02:12.167780Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:12.168196Z", "completed_at": "2022-08-26T20:02:12.168205Z"}], "thread_id": "Thread-3", "execution_time": 0.30421876907348633, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:11.890676Z", "completed_at": "2022-08-26T20:02:12.167910Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:12.168293Z", "completed_at": "2022-08-26T20:02:12.168296Z"}], "thread_id": "Thread-2", "execution_time": 0.3056769371032715, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_report_hourly"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:11.906080Z", "completed_at": "2022-08-26T20:02:12.251931Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:12.252149Z", "completed_at": "2022-08-26T20:02:12.252157Z"}], "thread_id": "Thread-4", "execution_time": 0.37087011337280273, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:11.910853Z", "completed_at": "2022-08-26T20:02:12.252368Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:12.252528Z", "completed_at": "2022-08-26T20:02:12.252532Z"}], "thread_id": "Thread-1", "execution_time": 0.3758530616760254, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__ad_group_report_hourly"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:12.282179Z", "completed_at": "2022-08-26T20:02:12.289666Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:12.289823Z", "completed_at": "2022-08-26T20:02:12.289829Z"}], "thread_id": "Thread-1", "execution_time": 0.007979869842529297, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_history_ad_group_id__updated_at.cec78c01de"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:12.290321Z", "completed_at": "2022-08-26T20:02:12.293589Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:12.293725Z", "completed_at": "2022-08-26T20:02:12.293729Z"}], "thread_id": "Thread-1", "execution_time": 0.0037102699279785156, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_history_ad_group_id.04778d7fad"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:12.294189Z", "completed_at": "2022-08-26T20:02:12.296635Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:12.296774Z", "completed_at": "2022-08-26T20:02:12.296778Z"}], "thread_id": "Thread-1", "execution_time": 0.002878904342651367, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_report_hourly_ad_id__stat_time_hour.e70f8cef6d"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:12.297234Z", "completed_at": "2022-08-26T20:02:12.299801Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:12.299942Z", "completed_at": "2022-08-26T20:02:12.299947Z"}], "thread_id": "Thread-1", "execution_time": 0.0030100345611572266, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_ad_id.ee84d783ed"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:12.300414Z", "completed_at": "2022-08-26T20:02:12.302452Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:12.302592Z", "completed_at": "2022-08-26T20:02:12.302596Z"}], "thread_id": "Thread-1", "execution_time": 0.0024781227111816406, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_report_hourly_stat_time_hour.9e2a2dca81"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:12.303067Z", "completed_at": "2022-08-26T20:02:12.305535Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:12.305678Z", "completed_at": "2022-08-26T20:02:12.305683Z"}], "thread_id": "Thread-1", "execution_time": 0.0029261112213134766, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_history_ad_id__updated_at.66b86b4dd1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:12.306177Z", "completed_at": "2022-08-26T20:02:12.308443Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:12.308591Z", "completed_at": "2022-08-26T20:02:12.308595Z"}], "thread_id": "Thread-1", "execution_time": 0.002741098403930664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_history_ad_id.4ffd05b23a"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:12.309103Z", "completed_at": "2022-08-26T20:02:12.311846Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:12.312027Z", "completed_at": "2022-08-26T20:02:12.312033Z"}], "thread_id": "Thread-1", "execution_time": 0.0032677650451660156, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__ad_group_report_hourly_ad_group_id__stat_time_hour.1aeaeb71ad"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:12.312677Z", "completed_at": "2022-08-26T20:02:12.315077Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:12.315239Z", "completed_at": "2022-08-26T20:02:12.315244Z"}], "thread_id": "Thread-1", "execution_time": 0.0029838085174560547, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_ad_group_id.8da17119f1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:12.315818Z", "completed_at": "2022-08-26T20:02:12.318909Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:12.319057Z", "completed_at": "2022-08-26T20:02:12.319062Z"}], "thread_id": "Thread-1", "execution_time": 0.00362396240234375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__ad_group_report_hourly_stat_time_hour.ca4b495127"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:12.200064Z", "completed_at": "2022-08-26T20:02:12.462381Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:12.462775Z", "completed_at": "2022-08-26T20:02:12.462791Z"}], "thread_id": "Thread-2", "execution_time": 0.2887916564941406, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:12.194044Z", "completed_at": "2022-08-26T20:02:12.463017Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:12.463146Z", "completed_at": "2022-08-26T20:02:12.463149Z"}], "thread_id": "Thread-3", "execution_time": 0.2952260971069336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__advertiser"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:12.489714Z", "completed_at": "2022-08-26T20:02:12.497773Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:12.498037Z", "completed_at": "2022-08-26T20:02:12.498043Z"}], "thread_id": "Thread-1", "execution_time": 0.009263038635253906, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_history_campaign_id__updated_at.72bf07011b"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:12.493492Z", "completed_at": "2022-08-26T20:02:12.498447Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:12.498891Z", "completed_at": "2022-08-26T20:02:12.498894Z"}], "thread_id": "Thread-3", "execution_time": 0.009592771530151367, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__advertiser_advertiser_id.5deab92def"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:12.493407Z", "completed_at": "2022-08-26T20:02:12.498621Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:12.499023Z", "completed_at": "2022-08-26T20:02:12.499026Z"}], "thread_id": "Thread-2", "execution_time": 0.013349771499633789, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_history_campaign_id.7f9147d1e1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:12.498958Z", "completed_at": "2022-08-26T20:02:12.503137Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:12.503280Z", "completed_at": "2022-08-26T20:02:12.503285Z"}], "thread_id": "Thread-1", "execution_time": 0.004900932312011719, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.unique_stg_tiktok_ads__advertiser_advertiser_id.078391ba66"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:12.277088Z", "completed_at": "2022-08-26T20:02:12.532532Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:12.532683Z", "completed_at": "2022-08-26T20:02:12.532690Z"}], "thread_id": "Thread-4", "execution_time": 0.2827157974243164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.tiktok_ads_source.stg_tiktok_ads__campaign_report_hourly"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:12.560140Z", "completed_at": "2022-08-26T20:02:12.563689Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:12.567956Z", "completed_at": "2022-08-26T20:02:12.567963Z"}], "thread_id": "Thread-3", "execution_time": 0.008278846740722656, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.dbt_utils_unique_combination_of_columns_stg_tiktok_ads__campaign_report_hourly_campaign_id__stat_time_hour.8e4a1e4b34"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:12.563821Z", "completed_at": "2022-08-26T20:02:12.568435Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:12.568715Z", "completed_at": "2022-08-26T20:02:12.568718Z"}], "thread_id": "Thread-1", "execution_time": 0.0055119991302490234, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_stat_time_hour.e75e13184c"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-08-26T20:02:12.563759Z", "completed_at": "2022-08-26T20:02:12.568496Z"}, {"name": "execute", "started_at": "2022-08-26T20:02:12.568784Z", "completed_at": "2022-08-26T20:02:12.568787Z"}], "thread_id": "Thread-2", "execution_time": 0.005841970443725586, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.tiktok_ads_source.not_null_stg_tiktok_ads__campaign_report_hourly_campaign_id.ef898379fb"}], "elapsed_time": 1.377197027206421, "args": {"write_json": true, "use_colors": true, "printer_width": 80, "version_check": true, "partial_parse": true, "static_parser": true, "profiles_dir": "/Users/joseph.markiewicz/.dbt", "send_anonymous_usage_stats": true, "event_buffer_size": 100000, "target": "postgres", "compile": true, "which": "generate", "rpc_method": "docs.generate", "indirect_selection": "eager"}} \ No newline at end of file diff --git a/integration_tests/dbt_project.yml b/integration_tests/dbt_project.yml index a1927bf..a819cc3 100644 --- a/integration_tests/dbt_project.yml +++ b/integration_tests/dbt_project.yml @@ -1,4 +1,4 @@ -name: 'tiktok_ads_source_integration_tests_1' +name: 'tiktok_ads_source_integration_tests' version: '0.2.0' profile: 'integration_tests' config-version: 2 diff --git a/models/src_tiktok_ads.yml b/models/src_tiktok_ads.yml index 0e3389a..693d9c5 100644 --- a/models/src_tiktok_ads.yml +++ b/models/src_tiktok_ads.yml @@ -11,12 +11,13 @@ sources: freshness: warn_after: {count: 48, period: hour} error_after: {count: 168, period: hour} + + config: + enabled: "{{ var('ad_reporting__tiktok_ads_enabled', true) }}" tables: - name: advertiser identifier: "{{ var('tiktok_ads__advertiser_identifier', 'advertiser') }}" - config: - enabled: "{{ var('ad_reporting__tiktok_ads_enabled', true) }}" description: Each record represents data for one advertiser. columns: - name: id @@ -68,8 +69,6 @@ sources: - name: campaign_history identifier: "{{ var('tiktok_ads__campaign_history_identifier', 'campaign_history') }}" - config: - enabled: "{{ var('ad_reporting__tiktok_ads_enabled', true) }}" description: Each record represents a version of a TikTok campaign. columns: - name: campaign_id @@ -99,11 +98,8 @@ sources: - name: split_test_variable description: Split Test variables. Optional values; TARGETING, BIDDING_OPTIMIZATION , CREATIVE. - - name: adgroup_history identifier: "{{ var('tiktok_ads__ad_group_history_identifier', 'adgroup_history') }}" - config: - enabled: "{{ var('ad_reporting__tiktok_ads_enabled', true) }}" description: Each record represents a version of a TikTok ad group. columns: - name: adgroup_id @@ -254,11 +250,8 @@ sources: - name: video_download description: Whether users can download your video ads on TikTok(cannot be updated once created). - - name: ad_history identifier: "{{ var('tiktok_ads__ad_history_identifier', 'ad_history') }}" - config: - enabled: "{{ var('ad_reporting__tiktok_ads_enabled', true) }}" description: Each record represents a version of a TikTok ad. columns: - name: ad_id @@ -314,8 +307,6 @@ sources: - name: ad_report_hourly identifier: "{{ var('tiktok_ads__ad_report_hourly_identifier', 'ad_report_hourly') }}" - config: - enabled: "{{ var('ad_reporting__tiktok_ads_enabled', true) }}" description: Each record represents data for each ad for each hour. columns: - name: ad_id @@ -432,11 +423,8 @@ sources: - name: _fivetran_synced description: Timestamp of when Fivetran synced a record. - - name: campaign_report_hourly identifier: "{{ var('tiktok_ads__campaign_report_hourly_identifier', 'campaign_report_hourly') }}" - config: - enabled: "{{ var('ad_reporting__tiktok_ads_enabled', true) }}" description: Each record represents data for each campaign for each hour. columns: - name: campaign_id @@ -555,11 +543,8 @@ sources: - name: _fivetran_synced description: Timestamp of when Fivetran synced a record. - - name: adgroup_report_hourly identifier: "{{ var('tiktok_ads__ad_group_report_hourly_identifier', 'adgroup_report_hourly') }}" - config: - enabled: "{{ var('ad_reporting__tiktok_ads_enabled', true) }}" description: Each record represents data for each ad group for each hour. columns: - name: adgroup_id diff --git a/models/stg_tiktok_ads__ad_group_report_hourly.sql b/models/stg_tiktok_ads__ad_group_report_hourly.sql index 3be98cf..a42fb10 100644 --- a/models/stg_tiktok_ads__ad_group_report_hourly.sql +++ b/models/stg_tiktok_ads__ad_group_report_hourly.sql @@ -15,11 +15,6 @@ fields as ( staging_columns=get_ad_group_report_hourly_columns() ) }} - - {% for metric in var('tiktok_ads__ad_group_hourly_passthrough_metrics', []) %} - , {{ metric }} - {% endfor %} - from base ), @@ -53,6 +48,7 @@ final as ( average_video_play_per_user {{ fivetran_utils.fill_pass_through_columns('tiktok_ads__ad_group_hourly_passthrough_metrics') }} + from fields ) diff --git a/models/stg_tiktok_ads__ad_report_hourly.sql b/models/stg_tiktok_ads__ad_report_hourly.sql index dbf23f3..9d1fdf8 100644 --- a/models/stg_tiktok_ads__ad_report_hourly.sql +++ b/models/stg_tiktok_ads__ad_report_hourly.sql @@ -15,11 +15,6 @@ fields as ( staging_columns=get_ad_report_hourly_columns() ) }} - - {% for metric in var('tiktok_ads__ad_hourly_passthrough_metrics', []) %} - , {{ metric }} - {% endfor %} - from base ), diff --git a/models/stg_tiktok_ads__campaign_history.sql b/models/stg_tiktok_ads__campaign_history.sql index 211d210..5cb0d38 100644 --- a/models/stg_tiktok_ads__campaign_history.sql +++ b/models/stg_tiktok_ads__campaign_history.sql @@ -15,7 +15,6 @@ fields as ( staging_columns=get_campaign_history_columns() ) }} - from base ), diff --git a/models/stg_tiktok_ads__campaign_report_hourly.sql b/models/stg_tiktok_ads__campaign_report_hourly.sql index 62f9daa..582c880 100644 --- a/models/stg_tiktok_ads__campaign_report_hourly.sql +++ b/models/stg_tiktok_ads__campaign_report_hourly.sql @@ -15,11 +15,6 @@ fields as ( staging_columns=get_campaign_report_hourly_columns() ) }} - - {% for metric in var('tiktok_ads__campaign_hourly_passthrough_metrics', []) %} - , {{ metric }} - {% endfor %} - from base ), @@ -53,6 +48,7 @@ final as ( average_video_play_per_user {{ fivetran_utils.fill_pass_through_columns('tiktok_ads__campaign_hourly_passthrough_metrics') }} + from fields ) diff --git a/packages.yml b/packages.yml index fbc10c2..6ed7ed9 100644 --- a/packages.yml +++ b/packages.yml @@ -1,8 +1,5 @@ packages: -# - package: fivetran/fivetran_utils -# version: [">=0.3.0", "<0.4.0"] - - git: https://github.com/fivetran/dbt_fivetran_utils.git - revision: feature/transform-persist - warn-unpinned: false + - package: fivetran/fivetran_utils + version: [">=0.3.0", "<0.4.0"] - package: dbt-labs/spark_utils version: [">=0.3.0", "<0.4.0"] From cffccbbb90f4316e31f890f2d1fe5a56318f8dcc Mon Sep 17 00:00:00 2001 From: fivetran-joemarkiewicz Date: Fri, 26 Aug 2022 15:12:27 -0500 Subject: [PATCH 40/41] minor changelog update --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a22cf3..ea2b05c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ PR [#3](https://github.com/fivetran/dbt_tiktok_ads_source/pull/3) applies the fo - `tiktok_ads__ad_group_hourly_passthrough_metrics` - `tiktok_ads__ad_hourly_passthrough_metrics` - `tiktok_ads__campaign_hourly_passthrough_metrics` -> This applies to all passthrough columns within the `dbt_snapchat_ads_source` package and not just the `tiktok_ads__ad_group_hourly_passthrough_metrics` example. +> This applies to all passthrough columns within the `dbt_tiktok_ads_source` package and not just the `tiktok_ads__ad_group_hourly_passthrough_metrics` example. ```yml vars: tiktok_ads__ad_group_hourly_passthrough_metrics: From 2b7f35040facb0c7b5562bc79e929dffe4f17eed Mon Sep 17 00:00:00 2001 From: fivetran-sheringuyen <94874400+fivetran-sheringuyen@users.noreply.github.com> Date: Thu, 1 Sep 2022 07:53:03 -0800 Subject: [PATCH 41/41] updating readme --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 3b4f634..cbd8f5d 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ vars: ``` ## (Optional) Step 4: Additional configurations +
Expand for configurations ### Passing Through Additional Metrics By default, this package will select `clicks`, `impressions`, and `cost` from the source reporting tables to store into the staging models. If you would like to pass through additional metrics to the staging models, add the below configurations to your `dbt_project.yml` file. These variables allow for the pass-through fields to be aliased (`alias`) if desired, but not required. Use the below format for declaring the respective pass-through variables: @@ -84,9 +85,15 @@ vars: tiktok_ads__identifier: your_table_name ``` +
+ ## (Optional) Step 5: Orchestrate your models with Fivetran Transformations for dbt Coreā„¢ +
Expand for more details + Fivetran offers the ability for you to orchestrate your dbt project through [Fivetran Transformations for dbt Coreā„¢](https://fivetran.com/docs/transformations/dbt). Learn how to set up your project for orchestration through Fivetran in our [Transformations for dbt Coreā„¢ setup guides](https://fivetran.com/docs/transformations/dbt#setupguide). +
+ # šŸ” Does this package have dependencies? This dbt package is dependent on the following dbt packages. Please be aware that these dependencies are installed by default within this package. For more information on the following packages, refer to the [dbt hub](https://hub.getdbt.com/) site. > IMPORTANT: If you have any of these dependent packages in your own `packages.yml` file, we highly recommend that you remove them from your root `packages.yml` to avoid package version conflicts.