diff --git a/.circleci/config.yml b/.circleci/config.yml index 0d320e0c..02ad3464 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -30,8 +30,9 @@ jobs: cd integration_tests dbt deps dbt seed --target redshift --full-refresh + dbt run --vars '{using_schedules: false, using_domain_names: false, using_user_tags: false, using_ticket_form_history: false, using_organization_tags: false}' --target redshift --full-refresh dbt run --target redshift --full-refresh - dbt run --vars '{using_schedules: false, using_domain_names: false, using_user_tags: false, using_ticket_form_history: false, using_organization_tags: false}' --target redshift + dbt run --target redshift dbt test --target redshift - run: name: "Run Tests - Postgres" @@ -41,8 +42,9 @@ jobs: cd integration_tests dbt deps dbt seed --target postgres --full-refresh + dbt run --vars '{using_schedules: false, using_domain_names: false, using_user_tags: false, using_ticket_form_history: false, using_organization_tags: false}' --target postgres --full-refresh dbt run --target postgres --full-refresh - dbt run --vars '{using_schedules: false, using_domain_names: false, using_user_tags: false, using_ticket_form_history: false, using_organization_tags: false}' --target postgres + dbt run --target postgres dbt test --target postgres - run: name: "Run Tests - Snowflake" @@ -52,8 +54,9 @@ jobs: cd integration_tests dbt deps dbt seed --target snowflake --full-refresh + dbt run --vars '{using_schedules: false, using_domain_names: false, using_user_tags: false, using_ticket_form_history: false, using_organization_tags: false}' --target snowflake --full-refresh dbt run --target snowflake --full-refresh - dbt run --vars '{using_schedules: false, using_domain_names: false, using_user_tags: false, using_ticket_form_history: false, using_organization_tags: false}' --target snowflake + dbt run --target snowflake dbt test --target snowflake - run: name: "Run Tests - BigQuery" @@ -66,8 +69,9 @@ jobs: cd integration_tests dbt deps dbt seed --target bigquery --full-refresh + dbt run --vars '{using_schedules: false, using_domain_names: false, using_user_tags: false, using_ticket_form_history: false, using_organization_tags: false}' --target bigquery --full-refresh dbt run --target bigquery --full-refresh - dbt run --vars '{using_schedules: false, using_domain_names: false, using_user_tags: false, using_ticket_form_history: false, using_organization_tags: false}' --target bigquery + dbt run --target bigquery dbt test --target bigquery - save_cache: key: deps2-{{ .Branch }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 15de5d31..fe7bf0f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +# dbt_zendesk v0.8.0 +# 🚨 Breaking Changes 🚨 +- The logic used to generate the `zendesk__ticket_backlog` model was updated to more accurately map backlog changes to tickets. As the underlying `zendesk__ticket_field_history` model is incremental, we recommend a `--full-refresh` after installing this latest version of the package. ([#61](https://github.com/fivetran/dbt_zendesk/pull/61)) +# Features +- Addition of the [DECISIONLOG.md](https://github.com/fivetran/dbt_zendesk/blob/main/DECISIONLOG.md). This file contains detailed explanations for the opinionated transformation logic found within this dbt package. ([#59](https://github.com/fivetran/dbt_zendesk/pull/59)) +# Bug Fixes +- Added logic required to account for the `first_reply_time` when the first commenter is an internal comment and there are no previous external comments applied to the ticket. ([#59](https://github.com/fivetran/dbt_zendesk/pull/59)) +- For those using schedules, incorporates Daylight Savings Time to use the proper timezone offsets for calculating UTC timestamps. Business minute metrics are more accurately calculated, as previously the package did not acknowledge daylight time and only used the standard time offsets ([#62](https://github.com/fivetran/dbt_zendesk/issues/62)). + +## Under the Hood +- Updated the incremental logic within `int_zendesk__field_history_scd` to include an additional partition for `ticket_id`. This allows for a more accurate generation of ticket backlog records. ([#61](https://github.com/fivetran/dbt_zendesk/pull/61)) +- Corrected the spelling of the partition field within the cte in `int_zendesk__field_history_scd` to be `partition` opposed to `patition`. ([#61](https://github.com/fivetran/dbt_zendesk/pull/61)) # dbt_zendesk v0.8.0-b1 🎉 dbt v1.0.0 Compatibility Pre Release 🎉 An official dbt v1.0.0 compatible version of the package will be released once existing feature/bug PRs are merged. ## 🚨 Breaking Changes 🚨 diff --git a/DECISIONLOG.md b/DECISIONLOG.md index fee1e877..c3ac55eb 100644 --- a/DECISIONLOG.md +++ b/DECISIONLOG.md @@ -1,10 +1,114 @@ -### Zendesk Backlog Tickets +# Decision Log + +## Zendesk Backlog Tickets - You may find some discrepancies between what Zendesk reports and our model the total number of backlog tickets on a given day. After investigating this we have realized this is due to Zendesk taking a snapshot of each day sometime in the 23rd hour as stated in their [article.](https://support.zendesk.com/hc/en-us/articles/4408819342490-Why-does-the-Backlog-dataset-only-show-the-Backlog-recorded-Hour-as-23-). - + ``` Because backlog data is captured on a per-day basis, it cannot be segmented hourly. The Backlog recorded - Hour is listed as 23 because data is captured daily between 11 pm, 12 am, or 1 am depending on factors like Daylight Saving Time (DST). For more information, see the article: Analyzing your ticket backlog history with Explore. ``` - While Zendesk doesn't segment their backlog data per hour, on the other hand we always try to model our data starting at a greater granularity. This means we start by taking the _hour_ from the timestamp field from the Zendesk source tables then bringing it to _day_. Therefore there will be edge cases where tickets updated near the end of day may fall into different statuses, depending on whether you're looking at the Zendesk Backlog dashboard or our model outputs. + +## Business Time Metrics +When developing this package we noticed Zendesk reported ticket response times in business minutes based on the last schedule which is applied to the ticket. However, we felt this is not an accurate representation of the true ticket elapsed time in business minutes. Therefore, we took the opinionated decision to apply logic within our transformations to calculate the cumulative elapsed time in business minutes of a ticket across **all** schedules which the ticket was assigned during it's lifetime. + +Below is a quick explanation of how this is calculated within the dbt package for **first_reply_time_business_minutes** as well as how this differs from Zendesk's logic: +> Note: While this is an example of `first_reply_time_business_minutes`, the logic is the same for other business minute metrics. + +- A ticket (`941606`) is created on `2020-09-29 17:01:38 UTC` and first solved at `2020-10-01 15:03:44 UTC`. +- When the ticket was created it was assigned the schedule `Level 1 Chicago` + - The schedule intervals are expressed as the number of minutes since the start of the week. + - Sunday is considered the start of the week. +- The `Level 1 Chicago` schedule can be interpreted as the following: + +| **start_time_utc** | **end_time_utc** | +| ------------------ | ----------------- | +| 720 | 1560 | +| 2160 | 3000 | +| 3600 | 4440 | +| 5040 | 5880 | +| 6480 | 7320 | +| 7920 | 8760 | +| 9360 | 10200 | + +- Looking closer into the ticket, we also see another schedule `Level 2 San Francisco` was assigned to the ticket on `2020-09-30 19:01:25 UTC` +- The `Level 2 San Francisco` schedule can be interpreted as the following: + +| **start_time_utc** | **end_time_utc** | +| ------------------ | ----------------- | +| 2340 | 2910 | +| 3780 | 4350 | +| 5220 | 5790 | +| 6660 | 7230 | +| 8100 | 8670 | + +- Now that we know the ticket had two schedules, let's see the comments exchanged within this ticket to capture when the `first_reply_time` was recorded. + +| **ticket_id** | **field_name** | **is_public** | **commenter_role** | **valid_starting_at** | +| ------------- | -------------- | ------------- | ------------------ | --------------------- | +| 941606 | comment | TRUE | external_comment | 2020-09-29 17:01:38 UTC | +| 941606 | comment | FALSE | internal_comment | 2020-09-30 19:01:25 UTC | +| 941606 | comment | TRUE | internal_comment | 2020-09-30 19:01:46 UTC | +| 941606 | comment | TRUE | internal_comment | 2020-10-01 15:03:44 UTC | + +- Seeing the comments made to the ticket, we understand that the customer commented on the ticket at `2020-09-29 17:01:38 UTC` and the first **public** internal comment was made at `2020-09-30 19:01:46 UTC`. +- In comparison of the two schedules associated with this ticket, we can see that the `Level 1 Chicago` schedule was set for almost the entire duration of the ticket before the first reply. Whereas, the `Level 2 San Francisco` schedule was only set for 21 seconds. + - Regardless, we will be using both schedules in the calculation of the `first_reply_time_business_minutes`. +- Now that we have the schedules, the schedule intervals, and the first_reply_time we can calculate the total elapsed `first_reply_time_business_minutes`. But, let's first convert the UTC timestamps to the Zendesk-esque intervals expressed within the schedules: +> The `Interval Results` are calculate via: `(Full Days From Sunday * 24 * 60) + (Hours * 60) + Minutes` + +| **Action** | **Timestamp** | **Full Days from Sunday** | **Hours** | **Minutes** | **Interval Result** | +| ---------- | ------------- | ------------------------- | --------- | ----------- | ------------------- | +| Ticket Created and Schedule set to Level 1 Chicago | `Tuesday, September 29, 2020 at 5:01:38 PM` | 2 | 17 | 2 | 3902 | +| Schedule changed to Level 2 San Francisco | `Wednesday, September 30, 2020 at 7:01:25 PM` | 3 | 19 | 1.25 | 5461.25 | +| First Public Internal Comment | `Wednesday, September 30, 2020 at 7:01:46 PM` | 3 | 19 | 1.46 | 5461.46 | + +- With the Interval Results obtained above, we can see where these overlap within the schedules. + +**Level 1 Chicago** +> Overlap was from 3902 to 5461.25 and falls within two intervals + +| **start_time_utc** | **end_time_utc** | +| ------------------ | ----------------- | +| 720 | 1560 | +| 2160 | 3000 | +| >**3600**< | >**4440**< | +| >**5040**< | >**5880**< | +| 6480 | 7320 | +| 7920 | 8760 | +| 9360 | 10200 | + +**Level 2 San Francisco** +> Only overlap was from 5461.25 to 5461.46 and falls within one interval + +| **start_time_utc** | **end_time_utc** | +| ------------------ | ----------------- | +| 2340 | 2910 | +| 3780 | 4350 | +| >**5220**< | >**5790**< | +| 6660 | 7230 | +| 8100 | 8670 | + +- Now let's figure out the overlapping duration + +| **Schedule** | **Schedule start_time_utc** | **Schedule end_time_utc** | **Ticket Start** | **Ticket End** | **Difference** | +|----| ------------------ | -----------------| ------------------ | -----------------| ------------------ | +| `Level 1 Chicago` | 3600 | >**4440**< | >**3902**< | 5461.25 | 538 | +| `Level 1 Chicago` | >**5040**< | 5880 | 3902 | >**5461.25**< | 421.25 | +| `Level 2 San Francisco` | >**5220**< (We use **5461.25** to account for overlap) | 5790 | 5462 | >**5461.46**< | .21 | + +- Adding the differences above we arrive at a total `first_reply_time_business_minutes` of 959.46 minutes. + +- So how does Zendesk calculate this? + - Instead of taking into account the various schedules used by the ticket, Zendesk will instead use the **last** schedule applied to the ticket to record the duration in business minutes. +- Therefore, in the example above Zendesk will **only** use the `Level 2 San Francisco` schedule when calculating the `first_reply_time_business_minutes` for ticket `941606`. + - Below is an example of how Zendesk calculates this: + +| **Schedule** | **Schedule start_time_utc** | **Schedule end_time_utc** | **Ticket Start** | **Ticket End** | **Difference** | +|----| ------------------ | -----------------| ------------------ | -----------------| ------------------ | +| `Level 2 San Francisco` | 3780 | >**4350**< | 3902 | 5461.46 | 448 | +| `Level 2 San Francisco` | >**5220**< | 5790 | 3902 | 5461.46 | 241.46 | + +- Adding the differences above we arrive at a total `first_reply_time_business_minutes` of 689.46 minutes. \ No newline at end of file diff --git a/README.md b/README.md index 3c4d9b41..f86ad9e5 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Include in your `packages.yml` to stay up to date with the latest release! ```yaml packages: - package: fivetran/zendesk - version: 0.8.0-b1 + version: [">=0.8.0", "<0.9.0"] ``` ## Package Maintenance The Fivetran team maintaining this package **only** maintains the latest version. We highly recommend you keep your `packages.yml` updated with the [dbt hub latest version](https://hub.getdbt.com/fivetran/zendesk/latest/). You may refer to the [CHANGELOG](/CHANGELOG.md) and release notes for more information on changes across versions. @@ -137,7 +137,9 @@ vars: zendesk: ticket_field_history_timeframe_years: integer_number_of_years # default = 50 (everything) ``` - +## Opinionated Modelling Decisions +### Business Time Metrics Logic +This dbt package takes an opinionated stance on how business time metrics are calculated. The dbt package takes **all** schedules into account when calculating the business time duration. Whereas, the Zendesk UI logic takes into account **only** the latest schedule assigned to the ticket. If you would like a deeper explanation of the logic used by default in the dbt package you may reference the [DECISIONLOG](/DECISIONLOG.md). ## Database support This package is compatible with BigQuery, Snowflake, Redshift and Postgres. diff --git a/dbt_project.yml b/dbt_project.yml index 49387bf8..5c3f34f0 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -43,6 +43,8 @@ vars: ticket_tag: "{{ ref('stg_zendesk__ticket_tag') }}" user_tag: "{{ ref('stg_zendesk__user_tag') }}" user: "{{ ref('stg_zendesk__user') }}" + daylight_time: "{{ ref('stg_zendesk__daylight_time') }}" + time_zone: "{{ ref('stg_zendesk__time_zone') }}" using_schedules: true using_domain_names: true using_user_tags: true diff --git a/docs/catalog.json b/docs/catalog.json index 4f06355e..9e24954a 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": "0.19.0", "generated_at": "2021-03-11T15:26:24.851484Z", "invocation_id": "ecff4bad-3dd9-4165-89b8-5ed23819450a", "env": {}}, "nodes": {"model.zendesk.int_zendesk__ticket_historical_status": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "name": "int_zendesk__ticket_historical_status", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "comment": null, "index": 1, "name": "ticket_id"}, "valid_starting_at": {"type": "TIMESTAMP", "comment": null, "index": 2, "name": "valid_starting_at"}, "valid_ending_at": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "valid_ending_at"}, "status_duration_calendar_minutes": {"type": "INT64", "comment": null, "index": 4, "name": "status_duration_calendar_minutes"}, "status": {"type": "STRING", "comment": null, "index": 5, "name": "status"}, "ticket_status_counter": {"type": "INT64", "comment": null, "index": 6, "name": "ticket_status_counter"}, "unique_status_counter": {"type": "INT64", "comment": null, "index": 7, "name": "unique_status_counter"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 18.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 888.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.int_zendesk__ticket_historical_status"}, "model.zendesk.int_zendesk__ticket_schedules": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "name": "int_zendesk__ticket_schedules", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "comment": null, "index": 1, "name": "ticket_id"}, "schedule_id": {"type": "STRING", "comment": null, "index": 2, "name": "schedule_id"}, "schedule_created_at": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "schedule_created_at"}, "schedule_invalidated_at": {"type": "TIMESTAMP", "comment": null, "index": 4, "name": "schedule_invalidated_at"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 11.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 388.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.int_zendesk__ticket_schedules"}, "model.zendesk.int_zendesk__requester_wait_time_calendar_hours": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "name": "int_zendesk__requester_wait_time_calendar_hours", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "comment": null, "index": 1, "name": "ticket_id"}, "valid_starting_at": {"type": "TIMESTAMP", "comment": null, "index": 2, "name": "valid_starting_at"}, "valid_ending_at": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "valid_ending_at"}, "ticket_status": {"type": "STRING", "comment": null, "index": 4, "name": "ticket_status"}, "sla_applied_at": {"type": "TIMESTAMP", "comment": null, "index": 5, "name": "sla_applied_at"}, "target": {"type": "INT64", "comment": null, "index": 6, "name": "target"}, "sla_policy_name": {"type": "STRING", "comment": null, "index": 7, "name": "sla_policy_name"}, "ticket_created_at": {"type": "TIMESTAMP", "comment": null, "index": 8, "name": "ticket_created_at"}, "in_business_hours": {"type": "STRING", "comment": null, "index": 9, "name": "in_business_hours"}, "calendar_minutes": {"type": "INT64", "comment": null, "index": 10, "name": "calendar_minutes"}, "running_total_calendar_minutes": {"type": "INT64", "comment": null, "index": 11, "name": "running_total_calendar_minutes"}, "remaining_target_minutes": {"type": "INT64", "comment": null, "index": 12, "name": "remaining_target_minutes"}, "is_breached_during_schedule": {"type": "BOOL", "comment": null, "index": 13, "name": "is_breached_during_schedule"}, "breach_minutes": {"type": "INT64", "comment": null, "index": 14, "name": "breach_minutes"}, "sla_breach_at": {"type": "TIMESTAMP", "comment": null, "index": 15, "name": "sla_breach_at"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 0.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 0.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.int_zendesk__requester_wait_time_calendar_hours"}, "model.zendesk.int_zendesk__requester_wait_time_business_hours": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "name": "int_zendesk__requester_wait_time_business_hours", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "comment": null, "index": 1, "name": "ticket_id"}, "sla_applied_at": {"type": "TIMESTAMP", "comment": null, "index": 2, "name": "sla_applied_at"}, "target": {"type": "INT64", "comment": null, "index": 3, "name": "target"}, "sla_policy_name": {"type": "STRING", "comment": null, "index": 4, "name": "sla_policy_name"}, "valid_starting_at": {"type": "TIMESTAMP", "comment": null, "index": 5, "name": "valid_starting_at"}, "valid_ending_at": {"type": "TIMESTAMP", "comment": null, "index": 6, "name": "valid_ending_at"}, "week_number": {"type": "FLOAT64", "comment": null, "index": 7, "name": "week_number"}, "ticket_week_start_time_minute": {"type": "FLOAT64", "comment": null, "index": 8, "name": "ticket_week_start_time_minute"}, "ticket_week_end_time_minute": {"type": "FLOAT64", "comment": null, "index": 9, "name": "ticket_week_end_time_minute"}, "schedule_start_time": {"type": "INT64", "comment": null, "index": 10, "name": "schedule_start_time"}, "schedule_end_time": {"type": "INT64", "comment": null, "index": 11, "name": "schedule_end_time"}, "scheduled_minutes": {"type": "FLOAT64", "comment": null, "index": 12, "name": "scheduled_minutes"}, "running_total_scheduled_minutes": {"type": "FLOAT64", "comment": null, "index": 13, "name": "running_total_scheduled_minutes"}, "remaining_target_minutes": {"type": "FLOAT64", "comment": null, "index": 14, "name": "remaining_target_minutes"}, "lag_check": {"type": "FLOAT64", "comment": null, "index": 15, "name": "lag_check"}, "is_breached_during_schedule": {"type": "BOOL", "comment": null, "index": 16, "name": "is_breached_during_schedule"}, "breach_minutes": {"type": "FLOAT64", "comment": null, "index": 17, "name": "breach_minutes"}, "breach_minutes_from_week": {"type": "FLOAT64", "comment": null, "index": 18, "name": "breach_minutes_from_week"}, "sla_breach_at": {"type": "TIMESTAMP", "comment": null, "index": 19, "name": "sla_breach_at"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 0.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 0.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.int_zendesk__requester_wait_time_business_hours"}, "model.zendesk.int_zendesk__ticket_aggregates": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "name": "int_zendesk__ticket_aggregates", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "comment": null, "index": 1, "name": "ticket_id"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 2, "name": "_fivetran_synced"}, "assignee_id": {"type": "INT64", "comment": null, "index": 3, "name": "assignee_id"}, "brand_id": {"type": "INT64", "comment": null, "index": 4, "name": "brand_id"}, "created_at": {"type": "TIMESTAMP", "comment": null, "index": 5, "name": "created_at"}, "description": {"type": "STRING", "comment": null, "index": 6, "name": "description"}, "due_at": {"type": "TIMESTAMP", "comment": null, "index": 7, "name": "due_at"}, "group_id": {"type": "INT64", "comment": null, "index": 8, "name": "group_id"}, "external_id": {"type": "INT64", "comment": null, "index": 9, "name": "external_id"}, "is_public": {"type": "BOOL", "comment": null, "index": 10, "name": "is_public"}, "organization_id": {"type": "INT64", "comment": null, "index": 11, "name": "organization_id"}, "priority": {"type": "INT64", "comment": null, "index": 12, "name": "priority"}, "recipient": {"type": "STRING", "comment": null, "index": 13, "name": "recipient"}, "requester_id": {"type": "INT64", "comment": null, "index": 14, "name": "requester_id"}, "status": {"type": "STRING", "comment": null, "index": 15, "name": "status"}, "subject": {"type": "STRING", "comment": null, "index": 16, "name": "subject"}, "problem_id": {"type": "INT64", "comment": null, "index": 17, "name": "problem_id"}, "submitter_id": {"type": "INT64", "comment": null, "index": 18, "name": "submitter_id"}, "ticket_form_id": {"type": "INT64", "comment": null, "index": 19, "name": "ticket_form_id"}, "type": {"type": "STRING", "comment": null, "index": 20, "name": "type"}, "updated_at": {"type": "DATETIME", "comment": null, "index": 21, "name": "updated_at"}, "url": {"type": "STRING", "comment": null, "index": 22, "name": "url"}, "created_channel": {"type": "STRING", "comment": null, "index": 23, "name": "created_channel"}, "source_from_id": {"type": "INT64", "comment": null, "index": 24, "name": "source_from_id"}, "source_from_title": {"type": "INT64", "comment": null, "index": 25, "name": "source_from_title"}, "source_rel": {"type": "INT64", "comment": null, "index": 26, "name": "source_rel"}, "source_to_address": {"type": "STRING", "comment": null, "index": 27, "name": "source_to_address"}, "source_to_name": {"type": "STRING", "comment": null, "index": 28, "name": "source_to_name"}, "is_incident": {"type": "BOOL", "comment": null, "index": 29, "name": "is_incident"}, "ticket_brand_name": {"type": "STRING", "comment": null, "index": 30, "name": "ticket_brand_name"}, "ticket_tags": {"type": "STRING", "comment": null, "index": 31, "name": "ticket_tags"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 10.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 2132.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.int_zendesk__ticket_aggregates"}, "model.zendesk.int_zendesk__updates": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "name": "int_zendesk__updates", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "comment": null, "index": 1, "name": "ticket_id"}, "field_name": {"type": "STRING", "comment": null, "index": 2, "name": "field_name"}, "value": {"type": "STRING", "comment": null, "index": 3, "name": "value"}, "is_public": {"type": "BOOL", "comment": null, "index": 4, "name": "is_public"}, "user_id": {"type": "INT64", "comment": null, "index": 5, "name": "user_id"}, "valid_starting_at": {"type": "TIMESTAMP", "comment": null, "index": 6, "name": "valid_starting_at"}, "valid_ending_at": {"type": "TIMESTAMP", "comment": null, "index": 7, "name": "valid_ending_at"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 40.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 1604.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.int_zendesk__updates"}, "model.zendesk.int_zendesk__organization_aggregates": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "name": "int_zendesk__organization_aggregates", "comment": null, "owner": null}, "columns": {"organization_id": {"type": "INT64", "comment": null, "index": 1, "name": "organization_id"}, "created_at": {"type": "TIMESTAMP", "comment": null, "index": 2, "name": "created_at"}, "updated_at": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "updated_at"}, "details": {"type": "INT64", "comment": null, "index": 4, "name": "details"}, "name": {"type": "STRING", "comment": null, "index": 5, "name": "name"}, "external_id": {"type": "INT64", "comment": null, "index": 6, "name": "external_id"}, "organization_tags": {"type": "STRING", "comment": null, "index": 7, "name": "organization_tags"}, "domain_names": {"type": "STRING", "comment": null, "index": 8, "name": "domain_names"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 10.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 311.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.int_zendesk__organization_aggregates"}, "model.zendesk.int_zendesk__latest_ticket_form": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "name": "int_zendesk__latest_ticket_form", "comment": null, "owner": null}, "columns": {"ticket_form_id": {"type": "INT64", "comment": null, "index": 1, "name": "ticket_form_id"}, "created_at": {"type": "DATETIME", "comment": null, "index": 2, "name": "created_at"}, "updated_at": {"type": "DATETIME", "comment": null, "index": 3, "name": "updated_at"}, "display_name": {"type": "STRING", "comment": null, "index": 4, "name": "display_name"}, "is_active": {"type": "BOOL", "comment": null, "index": 5, "name": "is_active"}, "name": {"type": "STRING", "comment": null, "index": 6, "name": "name"}, "latest_form_index": {"type": "INT64", "comment": null, "index": 7, "name": "latest_form_index"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 3.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 303.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.int_zendesk__latest_ticket_form"}, "model.zendesk.int_zendesk__agent_work_time_filtered_statuses": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "name": "int_zendesk__agent_work_time_filtered_statuses", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "comment": null, "index": 1, "name": "ticket_id"}, "valid_starting_at": {"type": "TIMESTAMP", "comment": null, "index": 2, "name": "valid_starting_at"}, "valid_ending_at": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "valid_ending_at"}, "ticket_status": {"type": "STRING", "comment": null, "index": 4, "name": "ticket_status"}, "sla_applied_at": {"type": "TIMESTAMP", "comment": null, "index": 5, "name": "sla_applied_at"}, "target": {"type": "INT64", "comment": null, "index": 6, "name": "target"}, "sla_policy_name": {"type": "STRING", "comment": null, "index": 7, "name": "sla_policy_name"}, "ticket_created_at": {"type": "TIMESTAMP", "comment": null, "index": 8, "name": "ticket_created_at"}, "in_business_hours": {"type": "STRING", "comment": null, "index": 9, "name": "in_business_hours"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 0.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 0.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.int_zendesk__agent_work_time_filtered_statuses"}, "model.zendesk.int_zendesk__ticket_historical_group": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "name": "int_zendesk__ticket_historical_group", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "comment": null, "index": 1, "name": "ticket_id"}, "group_stations_count": {"type": "INT64", "comment": null, "index": 2, "name": "group_stations_count"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 0.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 0.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.int_zendesk__ticket_historical_group"}, "model.zendesk.int_zendesk__field_history_pivot": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "name": "int_zendesk__field_history_pivot", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "comment": null, "index": 1, "name": "ticket_id"}, "date_day": {"type": "DATE", "comment": null, "index": 2, "name": "date_day"}, "status": {"type": "STRING", "comment": null, "index": 3, "name": "status"}, "priority": {"type": "STRING", "comment": null, "index": 4, "name": "priority"}, "assignee_id": {"type": "STRING", "comment": null, "index": 5, "name": "assignee_id"}, "ticket_day_id": {"type": "STRING", "comment": null, "index": 6, "name": "ticket_day_id"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 17.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 984.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "partitioning_type": {"id": "partitioning_type", "label": "Partitioned By", "value": "date_day", "description": "The partitioning column for this table", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.int_zendesk__field_history_pivot"}, "model.zendesk.int_zendesk__reply_time_combined": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "name": "int_zendesk__reply_time_combined", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "comment": null, "index": 1, "name": "ticket_id"}, "sla_policy_name": {"type": "STRING", "comment": null, "index": 2, "name": "sla_policy_name"}, "metric": {"type": "STRING", "comment": null, "index": 3, "name": "metric"}, "sla_applied_at": {"type": "TIMESTAMP", "comment": null, "index": 4, "name": "sla_applied_at"}, "target": {"type": "INT64", "comment": null, "index": 5, "name": "target"}, "in_business_hours": {"type": "STRING", "comment": null, "index": 6, "name": "in_business_hours"}, "sla_breach_at": {"type": "TIMESTAMP", "comment": null, "index": 7, "name": "sla_breach_at"}, "agent_reply_at": {"type": "TIMESTAMP", "comment": null, "index": 8, "name": "agent_reply_at"}, "next_solved_at": {"type": "TIMESTAMP", "comment": null, "index": 9, "name": "next_solved_at"}, "updated_sla_policy_starts_at": {"type": "TIMESTAMP", "comment": null, "index": 10, "name": "updated_sla_policy_starts_at"}, "is_stale_sla_policy": {"type": "BOOL", "comment": null, "index": 11, "name": "is_stale_sla_policy"}, "is_sla_breached": {"type": "BOOL", "comment": null, "index": 12, "name": "is_sla_breached"}, "sla_elapsed_time": {"type": "INT64", "comment": null, "index": 13, "name": "sla_elapsed_time"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 0.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 0.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.int_zendesk__reply_time_combined"}, "model.zendesk.int_zendesk__reply_time_calendar_hours": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "name": "int_zendesk__reply_time_calendar_hours", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "comment": null, "index": 1, "name": "ticket_id"}, "ticket_created_at": {"type": "TIMESTAMP", "comment": null, "index": 2, "name": "ticket_created_at"}, "ticket_current_status": {"type": "STRING", "comment": null, "index": 3, "name": "ticket_current_status"}, "metric": {"type": "STRING", "comment": null, "index": 4, "name": "metric"}, "sla_applied_at": {"type": "TIMESTAMP", "comment": null, "index": 5, "name": "sla_applied_at"}, "target": {"type": "INT64", "comment": null, "index": 6, "name": "target"}, "in_business_hours": {"type": "STRING", "comment": null, "index": 7, "name": "in_business_hours"}, "sla_policy_name": {"type": "STRING", "comment": null, "index": 8, "name": "sla_policy_name"}, "sla_breach_at": {"type": "TIMESTAMP", "comment": null, "index": 9, "name": "sla_breach_at"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 0.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 0.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.int_zendesk__reply_time_calendar_hours"}, "model.zendesk.int_zendesk__ticket_historical_satisfaction": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "name": "int_zendesk__ticket_historical_satisfaction", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "comment": null, "index": 1, "name": "ticket_id"}, "latest_satisfaction_reason": {"type": "STRING", "comment": null, "index": 2, "name": "latest_satisfaction_reason"}, "latest_satisfaction_comment": {"type": "STRING", "comment": null, "index": 3, "name": "latest_satisfaction_comment"}, "first_satisfaction_score": {"type": "STRING", "comment": null, "index": 4, "name": "first_satisfaction_score"}, "latest_satisfaction_score": {"type": "STRING", "comment": null, "index": 5, "name": "latest_satisfaction_score"}, "count_satisfaction_scores": {"type": "INT64", "comment": null, "index": 6, "name": "count_satisfaction_scores"}, "is_good_to_bad_satisfaction_score": {"type": "BOOL", "comment": null, "index": 7, "name": "is_good_to_bad_satisfaction_score"}, "is_bad_to_good_satisfaction_score": {"type": "BOOL", "comment": null, "index": 8, "name": "is_bad_to_good_satisfaction_score"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 0.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 0.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.int_zendesk__ticket_historical_satisfaction"}, "model.zendesk.int_zendesk__field_history_scd": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "name": "int_zendesk__field_history_scd", "comment": null, "owner": null}, "columns": {"valid_from": {"type": "DATE", "comment": null, "index": 1, "name": "valid_from"}, "ticket_id": {"type": "INT64", "comment": null, "index": 2, "name": "ticket_id"}, "ticket_day_id": {"type": "STRING", "comment": null, "index": 3, "name": "ticket_day_id"}, "status": {"type": "STRING", "comment": null, "index": 4, "name": "status"}, "priority": {"type": "STRING", "comment": null, "index": 5, "name": "priority"}, "assignee_id": {"type": "STRING", "comment": null, "index": 6, "name": "assignee_id"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 17.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 984.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.int_zendesk__field_history_scd"}, "model.zendesk.int_zendesk__sla_policy_applied": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "name": "int_zendesk__sla_policy_applied", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "comment": null, "index": 1, "name": "ticket_id"}, "ticket_created_at": {"type": "TIMESTAMP", "comment": null, "index": 2, "name": "ticket_created_at"}, "ticket_current_status": {"type": "STRING", "comment": null, "index": 3, "name": "ticket_current_status"}, "metric": {"type": "STRING", "comment": null, "index": 4, "name": "metric"}, "sla_applied_at": {"type": "TIMESTAMP", "comment": null, "index": 5, "name": "sla_applied_at"}, "target": {"type": "INT64", "comment": null, "index": 6, "name": "target"}, "in_business_hours": {"type": "STRING", "comment": null, "index": 7, "name": "in_business_hours"}, "sla_policy_name": {"type": "STRING", "comment": null, "index": 8, "name": "sla_policy_name"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 0.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 0.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.int_zendesk__sla_policy_applied"}, "model.zendesk.int_zendesk__agent_work_time_business_hours": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "name": "int_zendesk__agent_work_time_business_hours", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "comment": null, "index": 1, "name": "ticket_id"}, "sla_applied_at": {"type": "TIMESTAMP", "comment": null, "index": 2, "name": "sla_applied_at"}, "target": {"type": "INT64", "comment": null, "index": 3, "name": "target"}, "sla_policy_name": {"type": "STRING", "comment": null, "index": 4, "name": "sla_policy_name"}, "valid_starting_at": {"type": "TIMESTAMP", "comment": null, "index": 5, "name": "valid_starting_at"}, "valid_ending_at": {"type": "TIMESTAMP", "comment": null, "index": 6, "name": "valid_ending_at"}, "week_number": {"type": "FLOAT64", "comment": null, "index": 7, "name": "week_number"}, "ticket_week_start_time_minute": {"type": "FLOAT64", "comment": null, "index": 8, "name": "ticket_week_start_time_minute"}, "ticket_week_end_time_minute": {"type": "FLOAT64", "comment": null, "index": 9, "name": "ticket_week_end_time_minute"}, "schedule_start_time": {"type": "INT64", "comment": null, "index": 10, "name": "schedule_start_time"}, "schedule_end_time": {"type": "INT64", "comment": null, "index": 11, "name": "schedule_end_time"}, "scheduled_minutes": {"type": "FLOAT64", "comment": null, "index": 12, "name": "scheduled_minutes"}, "running_total_scheduled_minutes": {"type": "FLOAT64", "comment": null, "index": 13, "name": "running_total_scheduled_minutes"}, "remaining_target_minutes": {"type": "FLOAT64", "comment": null, "index": 14, "name": "remaining_target_minutes"}, "lag_check": {"type": "FLOAT64", "comment": null, "index": 15, "name": "lag_check"}, "is_breached_during_schedule": {"type": "BOOL", "comment": null, "index": 16, "name": "is_breached_during_schedule"}, "breach_minutes": {"type": "FLOAT64", "comment": null, "index": 17, "name": "breach_minutes"}, "breach_minutes_from_week": {"type": "FLOAT64", "comment": null, "index": 18, "name": "breach_minutes_from_week"}, "sla_breach_at": {"type": "TIMESTAMP", "comment": null, "index": 19, "name": "sla_breach_at"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 0.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 0.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.int_zendesk__agent_work_time_business_hours"}, "model.zendesk.int_zendesk__field_calendar_spine": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "name": "int_zendesk__field_calendar_spine", "comment": null, "owner": null}, "columns": {"date_day": {"type": "DATE", "comment": null, "index": 1, "name": "date_day"}, "ticket_id": {"type": "INT64", "comment": null, "index": 2, "name": "ticket_id"}, "ticket_day_id": {"type": "STRING", "comment": null, "index": 3, "name": "ticket_day_id"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 2732.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 136600.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "partitioning_type": {"id": "partitioning_type", "label": "Partitioned By", "value": "date_day", "description": "The partitioning column for this table", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.int_zendesk__field_calendar_spine"}, "model.zendesk.int_zendesk__ticket_historical_assignee": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "name": "int_zendesk__ticket_historical_assignee", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "comment": null, "index": 1, "name": "ticket_id"}, "first_agent_assignment_date": {"type": "TIMESTAMP", "comment": null, "index": 2, "name": "first_agent_assignment_date"}, "first_assignee_id": {"type": "STRING", "comment": null, "index": 3, "name": "first_assignee_id"}, "last_agent_assignment_date": {"type": "TIMESTAMP", "comment": null, "index": 4, "name": "last_agent_assignment_date"}, "last_assignee_id": {"type": "STRING", "comment": null, "index": 5, "name": "last_assignee_id"}, "assignee_stations_count": {"type": "INT64", "comment": null, "index": 6, "name": "assignee_stations_count"}, "unique_assignee_count": {"type": "INT64", "comment": null, "index": 7, "name": "unique_assignee_count"}, "ticket_unassigned_duration_calendar_minutes": {"type": "FLOAT64", "comment": null, "index": 8, "name": "ticket_unassigned_duration_calendar_minutes"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 1.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 52.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.int_zendesk__ticket_historical_assignee"}, "model.zendesk.int_zendesk__user_aggregates": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "name": "int_zendesk__user_aggregates", "comment": null, "owner": null}, "columns": {"user_id": {"type": "INT64", "comment": null, "index": 1, "name": "user_id"}, "external_id": {"type": "STRING", "comment": null, "index": 2, "name": "external_id"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "_fivetran_synced"}, "created_at": {"type": "TIMESTAMP", "comment": null, "index": 4, "name": "created_at"}, "updated_at": {"type": "DATETIME", "comment": null, "index": 5, "name": "updated_at"}, "email": {"type": "STRING", "comment": null, "index": 6, "name": "email"}, "name": {"type": "STRING", "comment": null, "index": 7, "name": "name"}, "organization_id": {"type": "INT64", "comment": null, "index": 8, "name": "organization_id"}, "role": {"type": "STRING", "comment": null, "index": 9, "name": "role"}, "ticket_restriction": {"type": "STRING", "comment": null, "index": 10, "name": "ticket_restriction"}, "time_zone": {"type": "STRING", "comment": null, "index": 11, "name": "time_zone"}, "locale": {"type": "STRING", "comment": null, "index": 12, "name": "locale"}, "is_active": {"type": "BOOL", "comment": null, "index": 13, "name": "is_active"}, "is_suspended": {"type": "BOOL", "comment": null, "index": 14, "name": "is_suspended"}, "last_login_at": {"type": "TIMESTAMP", "comment": null, "index": 15, "name": "last_login_at"}, "user_tags": {"type": "STRING", "comment": null, "index": 16, "name": "user_tags"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 10.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 1290.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.int_zendesk__user_aggregates"}, "model.zendesk.int_zendesk__assignee_updates": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "name": "int_zendesk__assignee_updates", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "comment": null, "index": 1, "name": "ticket_id"}, "assignee_id": {"type": "INT64", "comment": null, "index": 2, "name": "assignee_id"}, "last_updated": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "last_updated"}, "total_updates": {"type": "INT64", "comment": null, "index": 4, "name": "total_updates"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 10.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 224.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.int_zendesk__assignee_updates"}, "model.zendesk.int_zendesk__requester_updates": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "name": "int_zendesk__requester_updates", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "comment": null, "index": 1, "name": "ticket_id"}, "requester_id": {"type": "INT64", "comment": null, "index": 2, "name": "requester_id"}, "last_updated": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "last_updated"}, "total_updates": {"type": "INT64", "comment": null, "index": 4, "name": "total_updates"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 10.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 240.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.int_zendesk__requester_updates"}, "model.zendesk.int_zendesk__requester_wait_time_filtered_statuses": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "name": "int_zendesk__requester_wait_time_filtered_statuses", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "comment": null, "index": 1, "name": "ticket_id"}, "valid_starting_at": {"type": "TIMESTAMP", "comment": null, "index": 2, "name": "valid_starting_at"}, "valid_ending_at": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "valid_ending_at"}, "ticket_status": {"type": "STRING", "comment": null, "index": 4, "name": "ticket_status"}, "sla_applied_at": {"type": "TIMESTAMP", "comment": null, "index": 5, "name": "sla_applied_at"}, "target": {"type": "INT64", "comment": null, "index": 6, "name": "target"}, "sla_policy_name": {"type": "STRING", "comment": null, "index": 7, "name": "sla_policy_name"}, "ticket_created_at": {"type": "TIMESTAMP", "comment": null, "index": 8, "name": "ticket_created_at"}, "in_business_hours": {"type": "STRING", "comment": null, "index": 9, "name": "in_business_hours"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 0.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 0.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.int_zendesk__requester_wait_time_filtered_statuses"}, "model.zendesk.int_zendesk__comment_metrics": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "name": "int_zendesk__comment_metrics", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "comment": null, "index": 1, "name": "ticket_id"}, "last_comment_added_at": {"type": "TIMESTAMP", "comment": null, "index": 2, "name": "last_comment_added_at"}, "count_agent_comments": {"type": "INT64", "comment": null, "index": 3, "name": "count_agent_comments"}, "count_end_user_comments": {"type": "INT64", "comment": null, "index": 4, "name": "count_end_user_comments"}, "count_public_comments": {"type": "INT64", "comment": null, "index": 5, "name": "count_public_comments"}, "count_internal_comments": {"type": "INT64", "comment": null, "index": 6, "name": "count_internal_comments"}, "total_comments": {"type": "INT64", "comment": null, "index": 7, "name": "total_comments"}, "is_one_touch_resolution": {"type": "BOOL", "comment": null, "index": 8, "name": "is_one_touch_resolution"}, "is_two_touch_resolution": {"type": "BOOL", "comment": null, "index": 9, "name": "is_two_touch_resolution"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 0.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 0.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.int_zendesk__comment_metrics"}, "model.zendesk.int_zendesk__reply_time_business_hours": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "name": "int_zendesk__reply_time_business_hours", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "comment": null, "index": 1, "name": "ticket_id"}, "sla_policy_name": {"type": "STRING", "comment": null, "index": 2, "name": "sla_policy_name"}, "metric": {"type": "STRING", "comment": null, "index": 3, "name": "metric"}, "sla_applied_at": {"type": "TIMESTAMP", "comment": null, "index": 4, "name": "sla_applied_at"}, "target": {"type": "INT64", "comment": null, "index": 5, "name": "target"}, "in_business_hours": {"type": "STRING", "comment": null, "index": 6, "name": "in_business_hours"}, "sla_breach_at": {"type": "TIMESTAMP", "comment": null, "index": 7, "name": "sla_breach_at"}, "is_breached_during_schedule": {"type": "BOOL", "comment": null, "index": 8, "name": "is_breached_during_schedule"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 0.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 0.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.int_zendesk__reply_time_business_hours"}, "model.zendesk.int_zendesk__agent_work_time_calendar_hours": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "name": "int_zendesk__agent_work_time_calendar_hours", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "comment": null, "index": 1, "name": "ticket_id"}, "valid_starting_at": {"type": "TIMESTAMP", "comment": null, "index": 2, "name": "valid_starting_at"}, "valid_ending_at": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "valid_ending_at"}, "ticket_status": {"type": "STRING", "comment": null, "index": 4, "name": "ticket_status"}, "sla_applied_at": {"type": "TIMESTAMP", "comment": null, "index": 5, "name": "sla_applied_at"}, "target": {"type": "INT64", "comment": null, "index": 6, "name": "target"}, "sla_policy_name": {"type": "STRING", "comment": null, "index": 7, "name": "sla_policy_name"}, "ticket_created_at": {"type": "TIMESTAMP", "comment": null, "index": 8, "name": "ticket_created_at"}, "in_business_hours": {"type": "STRING", "comment": null, "index": 9, "name": "in_business_hours"}, "calendar_minutes": {"type": "INT64", "comment": null, "index": 10, "name": "calendar_minutes"}, "running_total_calendar_minutes": {"type": "INT64", "comment": null, "index": 11, "name": "running_total_calendar_minutes"}, "remaining_target_minutes": {"type": "INT64", "comment": null, "index": 12, "name": "remaining_target_minutes"}, "is_breached_during_schedule": {"type": "BOOL", "comment": null, "index": 13, "name": "is_breached_during_schedule"}, "breach_minutes": {"type": "INT64", "comment": null, "index": 14, "name": "breach_minutes"}, "sla_breach_at": {"type": "TIMESTAMP", "comment": null, "index": 15, "name": "sla_breach_at"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 0.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 0.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.int_zendesk__agent_work_time_calendar_hours"}, "model.zendesk.zendesk__ticket_summary": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "name": "zendesk__ticket_summary", "comment": null, "owner": null}, "columns": {"user_count": {"type": "INT64", "comment": null, "index": 1, "name": "user_count"}, "active_agent_count": {"type": "INT64", "comment": null, "index": 2, "name": "active_agent_count"}, "deleted_user_count": {"type": "INT64", "comment": null, "index": 3, "name": "deleted_user_count"}, "end_user_count": {"type": "INT64", "comment": null, "index": 4, "name": "end_user_count"}, "suspended_user_count": {"type": "INT64", "comment": null, "index": 5, "name": "suspended_user_count"}, "new_ticket_count": {"type": "INT64", "comment": null, "index": 6, "name": "new_ticket_count"}, "on_hold_ticket_count": {"type": "INT64", "comment": null, "index": 7, "name": "on_hold_ticket_count"}, "open_ticket_count": {"type": "INT64", "comment": null, "index": 8, "name": "open_ticket_count"}, "pending_ticket_count": {"type": "INT64", "comment": null, "index": 9, "name": "pending_ticket_count"}, "solved_ticket_count": {"type": "INT64", "comment": null, "index": 10, "name": "solved_ticket_count"}, "problem_ticket_count": {"type": "INT64", "comment": null, "index": 11, "name": "problem_ticket_count"}, "assigned_ticket_count": {"type": "INT64", "comment": null, "index": 12, "name": "assigned_ticket_count"}, "reassigned_ticket_count": {"type": "INT64", "comment": null, "index": 13, "name": "reassigned_ticket_count"}, "reopened_ticket_count": {"type": "INT64", "comment": null, "index": 14, "name": "reopened_ticket_count"}, "surveyed_satisfaction_ticket_count": {"type": "INT64", "comment": null, "index": 15, "name": "surveyed_satisfaction_ticket_count"}, "unassigned_unsolved_ticket_count": {"type": "INT64", "comment": null, "index": 16, "name": "unassigned_unsolved_ticket_count"}, "unreplied_ticket_count": {"type": "INT64", "comment": null, "index": 17, "name": "unreplied_ticket_count"}, "unreplied_unsolved_ticket_count": {"type": "INT64", "comment": null, "index": 18, "name": "unreplied_unsolved_ticket_count"}, "unsolved_ticket_count": {"type": "INT64", "comment": null, "index": 19, "name": "unsolved_ticket_count"}, "recovered_ticket_count": {"type": "INT64", "comment": null, "index": 20, "name": "recovered_ticket_count"}, "deleted_ticket_count": {"type": "INT64", "comment": null, "index": 21, "name": "deleted_ticket_count"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 1.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 40.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.zendesk__ticket_summary"}, "seed.zendesk_integration_tests.ticket_schedule_data": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "name": "ticket_schedule_data", "comment": null, "owner": null}, "columns": {"created_at": {"type": "TIMESTAMP", "comment": null, "index": 1, "name": "created_at"}, "ticket_id": {"type": "INT64", "comment": null, "index": 2, "name": "ticket_id"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "_fivetran_synced"}, "schedule_id": {"type": "INT64", "comment": null, "index": 4, "name": "schedule_id"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 10.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 320.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "seed.zendesk_integration_tests.ticket_schedule_data"}, "seed.zendesk_integration_tests.ticket_field_history_data": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "name": "ticket_field_history_data", "comment": null, "owner": null}, "columns": {"field_name": {"type": "STRING", "comment": null, "index": 1, "name": "field_name"}, "ticket_id": {"type": "INT64", "comment": null, "index": 2, "name": "ticket_id"}, "updated": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "updated"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 4, "name": "_fivetran_synced"}, "user_id": {"type": "INT64", "comment": null, "index": 5, "name": "user_id"}, "value": {"type": "STRING", "comment": null, "index": 6, "name": "value"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 20.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 805.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "seed.zendesk_integration_tests.ticket_field_history_data"}, "seed.zendesk_integration_tests.brand_data": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "name": "brand_data", "comment": null, "owner": null}, "columns": {"id": {"type": "INT64", "comment": null, "index": 1, "name": "id"}, "_fivetran_deleted": {"type": "BOOL", "comment": null, "index": 2, "name": "_fivetran_deleted"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "_fivetran_synced"}, "active": {"type": "BOOL", "comment": null, "index": 4, "name": "active"}, "brand_url": {"type": "STRING", "comment": null, "index": 5, "name": "brand_url"}, "default": {"type": "BOOL", "comment": null, "index": 6, "name": "default"}, "has_help_center": {"type": "BOOL", "comment": null, "index": 7, "name": "has_help_center"}, "help_center_state": {"type": "STRING", "comment": null, "index": 8, "name": "help_center_state"}, "logo_content_type": {"type": "STRING", "comment": null, "index": 9, "name": "logo_content_type"}, "logo_content_url": {"type": "STRING", "comment": null, "index": 10, "name": "logo_content_url"}, "logo_deleted": {"type": "BOOL", "comment": null, "index": 11, "name": "logo_deleted"}, "logo_file_name": {"type": "STRING", "comment": null, "index": 12, "name": "logo_file_name"}, "logo_height": {"type": "INT64", "comment": null, "index": 13, "name": "logo_height"}, "logo_id": {"type": "INT64", "comment": null, "index": 14, "name": "logo_id"}, "logo_inline": {"type": "BOOL", "comment": null, "index": 15, "name": "logo_inline"}, "logo_mapped_content_url": {"type": "STRING", "comment": null, "index": 16, "name": "logo_mapped_content_url"}, "logo_size": {"type": "INT64", "comment": null, "index": 17, "name": "logo_size"}, "logo_url": {"type": "STRING", "comment": null, "index": 18, "name": "logo_url"}, "logo_width": {"type": "INT64", "comment": null, "index": 19, "name": "logo_width"}, "name": {"type": "STRING", "comment": null, "index": 20, "name": "name"}, "subdomain": {"type": "STRING", "comment": null, "index": 21, "name": "subdomain"}, "url": {"type": "STRING", "comment": null, "index": 22, "name": "url"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 1.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 346.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "seed.zendesk_integration_tests.brand_data"}, "seed.zendesk_integration_tests.ticket_form_history_data": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "name": "ticket_form_history_data", "comment": null, "owner": null}, "columns": {"id": {"type": "INT64", "comment": null, "index": 1, "name": "id"}, "updated_at": {"type": "DATETIME", "comment": null, "index": 2, "name": "updated_at"}, "_fivetran_deleted": {"type": "BOOL", "comment": null, "index": 3, "name": "_fivetran_deleted"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 4, "name": "_fivetran_synced"}, "active": {"type": "BOOL", "comment": null, "index": 5, "name": "active"}, "created_at": {"type": "DATETIME", "comment": null, "index": 6, "name": "created_at"}, "display_name": {"type": "STRING", "comment": null, "index": 7, "name": "display_name"}, "end_user_visible": {"type": "BOOL", "comment": null, "index": 8, "name": "end_user_visible"}, "name": {"type": "STRING", "comment": null, "index": 9, "name": "name"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 15.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 1545.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "seed.zendesk_integration_tests.ticket_form_history_data"}, "seed.zendesk_integration_tests.user_data": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "name": "user_data", "comment": null, "owner": null}, "columns": {"id": {"type": "INT64", "comment": null, "index": 1, "name": "id"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 2, "name": "_fivetran_synced"}, "active": {"type": "BOOL", "comment": null, "index": 3, "name": "active"}, "alias": {"type": "INT64", "comment": null, "index": 4, "name": "alias"}, "authenticity_token": {"type": "INT64", "comment": null, "index": 5, "name": "authenticity_token"}, "chat_only": {"type": "BOOL", "comment": null, "index": 6, "name": "chat_only"}, "created_at": {"type": "TIMESTAMP", "comment": null, "index": 7, "name": "created_at"}, "details": {"type": "INT64", "comment": null, "index": 8, "name": "details"}, "email": {"type": "STRING", "comment": null, "index": 9, "name": "email"}, "external_id": {"type": "STRING", "comment": null, "index": 10, "name": "external_id"}, "last_login_at": {"type": "TIMESTAMP", "comment": null, "index": 11, "name": "last_login_at"}, "locale": {"type": "STRING", "comment": null, "index": 12, "name": "locale"}, "locale_id": {"type": "INT64", "comment": null, "index": 13, "name": "locale_id"}, "moderator": {"type": "BOOL", "comment": null, "index": 14, "name": "moderator"}, "name": {"type": "STRING", "comment": null, "index": 15, "name": "name"}, "notes": {"type": "INT64", "comment": null, "index": 16, "name": "notes"}, "only_private_comments": {"type": "BOOL", "comment": null, "index": 17, "name": "only_private_comments"}, "organization_id": {"type": "INT64", "comment": null, "index": 18, "name": "organization_id"}, "phone": {"type": "INT64", "comment": null, "index": 19, "name": "phone"}, "remote_photo_url": {"type": "INT64", "comment": null, "index": 20, "name": "remote_photo_url"}, "restricted_agent": {"type": "BOOL", "comment": null, "index": 21, "name": "restricted_agent"}, "role": {"type": "STRING", "comment": null, "index": 22, "name": "role"}, "shared": {"type": "BOOL", "comment": null, "index": 23, "name": "shared"}, "shared_agent": {"type": "BOOL", "comment": null, "index": 24, "name": "shared_agent"}, "signature": {"type": "INT64", "comment": null, "index": 25, "name": "signature"}, "suspended": {"type": "BOOL", "comment": null, "index": 26, "name": "suspended"}, "ticket_restriction": {"type": "STRING", "comment": null, "index": 27, "name": "ticket_restriction"}, "time_zone": {"type": "STRING", "comment": null, "index": 28, "name": "time_zone"}, "two_factor_auth_enabled": {"type": "BOOL", "comment": null, "index": 29, "name": "two_factor_auth_enabled"}, "updated_at": {"type": "DATETIME", "comment": null, "index": 30, "name": "updated_at"}, "url": {"type": "STRING", "comment": null, "index": 31, "name": "url"}, "verified": {"type": "BOOL", "comment": null, "index": 32, "name": "verified"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 10.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 2100.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "seed.zendesk_integration_tests.user_data"}, "seed.zendesk_integration_tests.domain_name_data": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "name": "domain_name_data", "comment": null, "owner": null}, "columns": {"index": {"type": "INT64", "comment": null, "index": 1, "name": "index"}, "organization_id": {"type": "INT64", "comment": null, "index": 2, "name": "organization_id"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "_fivetran_synced"}, "domain_name": {"type": "STRING", "comment": null, "index": 4, "name": "domain_name"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 10.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 580.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "seed.zendesk_integration_tests.domain_name_data"}, "seed.zendesk_integration_tests.ticket_comment_data": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "name": "ticket_comment_data", "comment": null, "owner": null}, "columns": {"id": {"type": "INT64", "comment": null, "index": 1, "name": "id"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 2, "name": "_fivetran_synced"}, "body": {"type": "STRING", "comment": null, "index": 3, "name": "body"}, "created": {"type": "TIMESTAMP", "comment": null, "index": 4, "name": "created"}, "facebook_comment": {"type": "BOOL", "comment": null, "index": 5, "name": "facebook_comment"}, "public": {"type": "BOOL", "comment": null, "index": 6, "name": "public"}, "ticket_id": {"type": "INT64", "comment": null, "index": 7, "name": "ticket_id"}, "tweet": {"type": "BOOL", "comment": null, "index": 8, "name": "tweet"}, "user_id": {"type": "INT64", "comment": null, "index": 9, "name": "user_id"}, "voice_comment": {"type": "BOOL", "comment": null, "index": 10, "name": "voice_comment"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 20.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 1031.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "seed.zendesk_integration_tests.ticket_comment_data"}, "seed.zendesk_integration_tests.user_tag_data": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "name": "user_tag_data", "comment": null, "owner": null}, "columns": {"tag": {"type": "STRING", "comment": null, "index": 1, "name": "tag"}, "user_id": {"type": "INT64", "comment": null, "index": 2, "name": "user_id"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "_fivetran_synced"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 10.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 500.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "seed.zendesk_integration_tests.user_tag_data"}, "model.zendesk.zendesk__ticket_enriched": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "name": "zendesk__ticket_enriched", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "comment": null, "index": 1, "name": "ticket_id"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 2, "name": "_fivetran_synced"}, "assignee_id": {"type": "INT64", "comment": null, "index": 3, "name": "assignee_id"}, "brand_id": {"type": "INT64", "comment": null, "index": 4, "name": "brand_id"}, "created_at": {"type": "TIMESTAMP", "comment": null, "index": 5, "name": "created_at"}, "description": {"type": "STRING", "comment": null, "index": 6, "name": "description"}, "due_at": {"type": "TIMESTAMP", "comment": null, "index": 7, "name": "due_at"}, "group_id": {"type": "INT64", "comment": null, "index": 8, "name": "group_id"}, "external_id": {"type": "INT64", "comment": null, "index": 9, "name": "external_id"}, "is_public": {"type": "BOOL", "comment": null, "index": 10, "name": "is_public"}, "organization_id": {"type": "INT64", "comment": null, "index": 11, "name": "organization_id"}, "priority": {"type": "INT64", "comment": null, "index": 12, "name": "priority"}, "recipient": {"type": "STRING", "comment": null, "index": 13, "name": "recipient"}, "requester_id": {"type": "INT64", "comment": null, "index": 14, "name": "requester_id"}, "status": {"type": "STRING", "comment": null, "index": 15, "name": "status"}, "subject": {"type": "STRING", "comment": null, "index": 16, "name": "subject"}, "problem_id": {"type": "INT64", "comment": null, "index": 17, "name": "problem_id"}, "submitter_id": {"type": "INT64", "comment": null, "index": 18, "name": "submitter_id"}, "ticket_form_id": {"type": "INT64", "comment": null, "index": 19, "name": "ticket_form_id"}, "type": {"type": "STRING", "comment": null, "index": 20, "name": "type"}, "updated_at": {"type": "DATETIME", "comment": null, "index": 21, "name": "updated_at"}, "url": {"type": "STRING", "comment": null, "index": 22, "name": "url"}, "created_channel": {"type": "STRING", "comment": null, "index": 23, "name": "created_channel"}, "source_from_id": {"type": "INT64", "comment": null, "index": 24, "name": "source_from_id"}, "source_from_title": {"type": "INT64", "comment": null, "index": 25, "name": "source_from_title"}, "source_rel": {"type": "INT64", "comment": null, "index": 26, "name": "source_rel"}, "source_to_address": {"type": "STRING", "comment": null, "index": 27, "name": "source_to_address"}, "source_to_name": {"type": "STRING", "comment": null, "index": 28, "name": "source_to_name"}, "is_incident": {"type": "BOOL", "comment": null, "index": 29, "name": "is_incident"}, "ticket_brand_name": {"type": "STRING", "comment": null, "index": 30, "name": "ticket_brand_name"}, "ticket_tags": {"type": "STRING", "comment": null, "index": 31, "name": "ticket_tags"}, "ticket_form_name": {"type": "STRING", "comment": null, "index": 32, "name": "ticket_form_name"}, "ticket_total_satisfaction_scores": {"type": "INT64", "comment": null, "index": 33, "name": "ticket_total_satisfaction_scores"}, "ticket_first_satisfaction_score": {"type": "STRING", "comment": null, "index": 34, "name": "ticket_first_satisfaction_score"}, "ticket_satisfaction_score": {"type": "STRING", "comment": null, "index": 35, "name": "ticket_satisfaction_score"}, "ticket_satisfaction_comment": {"type": "STRING", "comment": null, "index": 36, "name": "ticket_satisfaction_comment"}, "ticket_satisfaction_reason": {"type": "STRING", "comment": null, "index": 37, "name": "ticket_satisfaction_reason"}, "is_good_to_bad_satisfaction_score": {"type": "BOOL", "comment": null, "index": 38, "name": "is_good_to_bad_satisfaction_score"}, "is_bad_to_good_satisfaction_score": {"type": "BOOL", "comment": null, "index": 39, "name": "is_bad_to_good_satisfaction_score"}, "ticket_organization_domain_names": {"type": "STRING", "comment": null, "index": 40, "name": "ticket_organization_domain_names"}, "requester_organization_domain_names": {"type": "STRING", "comment": null, "index": 41, "name": "requester_organization_domain_names"}, "requester_external_id": {"type": "STRING", "comment": null, "index": 42, "name": "requester_external_id"}, "requester_created_at": {"type": "TIMESTAMP", "comment": null, "index": 43, "name": "requester_created_at"}, "requester_updated_at": {"type": "DATETIME", "comment": null, "index": 44, "name": "requester_updated_at"}, "requester_role": {"type": "STRING", "comment": null, "index": 45, "name": "requester_role"}, "requester_email": {"type": "STRING", "comment": null, "index": 46, "name": "requester_email"}, "requester_name": {"type": "STRING", "comment": null, "index": 47, "name": "requester_name"}, "is_requester_active": {"type": "BOOL", "comment": null, "index": 48, "name": "is_requester_active"}, "requester_locale": {"type": "STRING", "comment": null, "index": 49, "name": "requester_locale"}, "requester_time_zone": {"type": "STRING", "comment": null, "index": 50, "name": "requester_time_zone"}, "requester_ticket_update_count": {"type": "INT64", "comment": null, "index": 51, "name": "requester_ticket_update_count"}, "requester_ticket_last_update_at": {"type": "TIMESTAMP", "comment": null, "index": 52, "name": "requester_ticket_last_update_at"}, "requester_last_login_at": {"type": "TIMESTAMP", "comment": null, "index": 53, "name": "requester_last_login_at"}, "requester_organization_id": {"type": "INT64", "comment": null, "index": 54, "name": "requester_organization_id"}, "requester_organization_name": {"type": "STRING", "comment": null, "index": 55, "name": "requester_organization_name"}, "requester_organization_tags": {"type": "STRING", "comment": null, "index": 56, "name": "requester_organization_tags"}, "requester_organization_external_id": {"type": "INT64", "comment": null, "index": 57, "name": "requester_organization_external_id"}, "requester_organization_created_at": {"type": "TIMESTAMP", "comment": null, "index": 58, "name": "requester_organization_created_at"}, "requester_organization_updated_at": {"type": "TIMESTAMP", "comment": null, "index": 59, "name": "requester_organization_updated_at"}, "submitter_external_id": {"type": "STRING", "comment": null, "index": 60, "name": "submitter_external_id"}, "submitter_role": {"type": "STRING", "comment": null, "index": 61, "name": "submitter_role"}, "is_agent_submitted": {"type": "BOOL", "comment": null, "index": 62, "name": "is_agent_submitted"}, "submitter_email": {"type": "STRING", "comment": null, "index": 63, "name": "submitter_email"}, "submitter_name": {"type": "STRING", "comment": null, "index": 64, "name": "submitter_name"}, "is_submitter_active": {"type": "BOOL", "comment": null, "index": 65, "name": "is_submitter_active"}, "submitter_locale": {"type": "STRING", "comment": null, "index": 66, "name": "submitter_locale"}, "submitter_time_zone": {"type": "STRING", "comment": null, "index": 67, "name": "submitter_time_zone"}, "assignee_external_id": {"type": "STRING", "comment": null, "index": 68, "name": "assignee_external_id"}, "assignee_role": {"type": "STRING", "comment": null, "index": 69, "name": "assignee_role"}, "assignee_email": {"type": "STRING", "comment": null, "index": 70, "name": "assignee_email"}, "assignee_name": {"type": "STRING", "comment": null, "index": 71, "name": "assignee_name"}, "is_assignee_active": {"type": "BOOL", "comment": null, "index": 72, "name": "is_assignee_active"}, "assignee_locale": {"type": "STRING", "comment": null, "index": 73, "name": "assignee_locale"}, "assignee_time_zone": {"type": "STRING", "comment": null, "index": 74, "name": "assignee_time_zone"}, "assignee_ticket_update_count": {"type": "INT64", "comment": null, "index": 75, "name": "assignee_ticket_update_count"}, "assignee_ticket_last_update_at": {"type": "TIMESTAMP", "comment": null, "index": 76, "name": "assignee_ticket_last_update_at"}, "assignee_last_login_at": {"type": "TIMESTAMP", "comment": null, "index": 77, "name": "assignee_last_login_at"}, "group_name": {"type": "STRING", "comment": null, "index": 78, "name": "group_name"}, "organization_name": {"type": "STRING", "comment": null, "index": 79, "name": "organization_name"}, "requester_tag": {"type": "STRING", "comment": null, "index": 80, "name": "requester_tag"}, "submitter_tag": {"type": "STRING", "comment": null, "index": 81, "name": "submitter_tag"}, "assignee_tag": {"type": "STRING", "comment": null, "index": 82, "name": "assignee_tag"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 0.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 0.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.zendesk__ticket_enriched"}, "seed.zendesk_integration_tests.ticket_data": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "name": "ticket_data", "comment": null, "owner": null}, "columns": {"id": {"type": "INT64", "comment": null, "index": 1, "name": "id"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 2, "name": "_fivetran_synced"}, "allow_channelback": {"type": "BOOL", "comment": null, "index": 3, "name": "allow_channelback"}, "assignee_id": {"type": "INT64", "comment": null, "index": 4, "name": "assignee_id"}, "brand_id": {"type": "INT64", "comment": null, "index": 5, "name": "brand_id"}, "created_at": {"type": "TIMESTAMP", "comment": null, "index": 6, "name": "created_at"}, "description": {"type": "STRING", "comment": null, "index": 7, "name": "description"}, "due_at": {"type": "TIMESTAMP", "comment": null, "index": 8, "name": "due_at"}, "external_id": {"type": "INT64", "comment": null, "index": 9, "name": "external_id"}, "forum_topic_id": {"type": "INT64", "comment": null, "index": 10, "name": "forum_topic_id"}, "group_id": {"type": "INT64", "comment": null, "index": 11, "name": "group_id"}, "has_incidents": {"type": "BOOL", "comment": null, "index": 12, "name": "has_incidents"}, "is_public": {"type": "BOOL", "comment": null, "index": 13, "name": "is_public"}, "organization_id": {"type": "INT64", "comment": null, "index": 14, "name": "organization_id"}, "priority": {"type": "INT64", "comment": null, "index": 15, "name": "priority"}, "problem_id": {"type": "INT64", "comment": null, "index": 16, "name": "problem_id"}, "recipient": {"type": "STRING", "comment": null, "index": 17, "name": "recipient"}, "requester_id": {"type": "INT64", "comment": null, "index": 18, "name": "requester_id"}, "status": {"type": "STRING", "comment": null, "index": 19, "name": "status"}, "subject": {"type": "STRING", "comment": null, "index": 20, "name": "subject"}, "submitter_id": {"type": "INT64", "comment": null, "index": 21, "name": "submitter_id"}, "system_client": {"type": "INT64", "comment": null, "index": 22, "name": "system_client"}, "ticket_form_id": {"type": "INT64", "comment": null, "index": 23, "name": "ticket_form_id"}, "type": {"type": "STRING", "comment": null, "index": 24, "name": "type"}, "updated_at": {"type": "DATETIME", "comment": null, "index": 25, "name": "updated_at"}, "url": {"type": "STRING", "comment": null, "index": 26, "name": "url"}, "via_channel": {"type": "STRING", "comment": null, "index": 27, "name": "via_channel"}, "via_source_from_id": {"type": "INT64", "comment": null, "index": 28, "name": "via_source_from_id"}, "via_source_from_title": {"type": "INT64", "comment": null, "index": 29, "name": "via_source_from_title"}, "via_source_rel": {"type": "INT64", "comment": null, "index": 30, "name": "via_source_rel"}, "via_source_to_address": {"type": "STRING", "comment": null, "index": 31, "name": "via_source_to_address"}, "via_source_to_name": {"type": "STRING", "comment": null, "index": 32, "name": "via_source_to_name"}, "merged_ticket_ids": {"type": "STRING", "comment": null, "index": 33, "name": "merged_ticket_ids"}, "via_source_from_address": {"type": "INT64", "comment": null, "index": 34, "name": "via_source_from_address"}, "followup_ids": {"type": "STRING", "comment": null, "index": 35, "name": "followup_ids"}, "via_followup_source_id": {"type": "INT64", "comment": null, "index": 36, "name": "via_followup_source_id"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 10.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 2186.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "seed.zendesk_integration_tests.ticket_data"}, "model.zendesk.zendesk__ticket_field_history": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "name": "zendesk__ticket_field_history", "comment": null, "owner": null}, "columns": {"date_day": {"type": "DATE", "comment": null, "index": 1, "name": "date_day"}, "ticket_id": {"type": "INT64", "comment": null, "index": 2, "name": "ticket_id"}, "status": {"type": "STRING", "comment": null, "index": 3, "name": "status"}, "priority": {"type": "STRING", "comment": null, "index": 4, "name": "priority"}, "assignee_id": {"type": "STRING", "comment": null, "index": 5, "name": "assignee_id"}, "ticket_day_id": {"type": "STRING", "comment": null, "index": 6, "name": "ticket_day_id"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 2672.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 135120.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "partitioning_type": {"id": "partitioning_type", "label": "Partitioned By", "value": "date_day", "description": "The partitioning column for this table", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.zendesk__ticket_field_history"}, "seed.zendesk_integration_tests.ticket_tag_data": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "name": "ticket_tag_data", "comment": null, "owner": null}, "columns": {"tag": {"type": "STRING", "comment": null, "index": 1, "name": "tag"}, "ticket_id": {"type": "INT64", "comment": null, "index": 2, "name": "ticket_id"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "_fivetran_synced"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 10.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 261.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "seed.zendesk_integration_tests.ticket_tag_data"}, "model.zendesk.zendesk__ticket_metrics": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "name": "zendesk__ticket_metrics", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "comment": null, "index": 1, "name": "ticket_id"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 2, "name": "_fivetran_synced"}, "assignee_id": {"type": "INT64", "comment": null, "index": 3, "name": "assignee_id"}, "brand_id": {"type": "INT64", "comment": null, "index": 4, "name": "brand_id"}, "created_at": {"type": "TIMESTAMP", "comment": null, "index": 5, "name": "created_at"}, "description": {"type": "STRING", "comment": null, "index": 6, "name": "description"}, "due_at": {"type": "TIMESTAMP", "comment": null, "index": 7, "name": "due_at"}, "group_id": {"type": "INT64", "comment": null, "index": 8, "name": "group_id"}, "external_id": {"type": "INT64", "comment": null, "index": 9, "name": "external_id"}, "is_public": {"type": "BOOL", "comment": null, "index": 10, "name": "is_public"}, "organization_id": {"type": "INT64", "comment": null, "index": 11, "name": "organization_id"}, "priority": {"type": "INT64", "comment": null, "index": 12, "name": "priority"}, "recipient": {"type": "STRING", "comment": null, "index": 13, "name": "recipient"}, "requester_id": {"type": "INT64", "comment": null, "index": 14, "name": "requester_id"}, "status": {"type": "STRING", "comment": null, "index": 15, "name": "status"}, "subject": {"type": "STRING", "comment": null, "index": 16, "name": "subject"}, "problem_id": {"type": "INT64", "comment": null, "index": 17, "name": "problem_id"}, "submitter_id": {"type": "INT64", "comment": null, "index": 18, "name": "submitter_id"}, "ticket_form_id": {"type": "INT64", "comment": null, "index": 19, "name": "ticket_form_id"}, "type": {"type": "STRING", "comment": null, "index": 20, "name": "type"}, "updated_at": {"type": "DATETIME", "comment": null, "index": 21, "name": "updated_at"}, "url": {"type": "STRING", "comment": null, "index": 22, "name": "url"}, "created_channel": {"type": "STRING", "comment": null, "index": 23, "name": "created_channel"}, "source_from_id": {"type": "INT64", "comment": null, "index": 24, "name": "source_from_id"}, "source_from_title": {"type": "INT64", "comment": null, "index": 25, "name": "source_from_title"}, "source_rel": {"type": "INT64", "comment": null, "index": 26, "name": "source_rel"}, "source_to_address": {"type": "STRING", "comment": null, "index": 27, "name": "source_to_address"}, "source_to_name": {"type": "STRING", "comment": null, "index": 28, "name": "source_to_name"}, "is_incident": {"type": "BOOL", "comment": null, "index": 29, "name": "is_incident"}, "ticket_brand_name": {"type": "STRING", "comment": null, "index": 30, "name": "ticket_brand_name"}, "ticket_tags": {"type": "STRING", "comment": null, "index": 31, "name": "ticket_tags"}, "ticket_form_name": {"type": "STRING", "comment": null, "index": 32, "name": "ticket_form_name"}, "ticket_total_satisfaction_scores": {"type": "INT64", "comment": null, "index": 33, "name": "ticket_total_satisfaction_scores"}, "ticket_first_satisfaction_score": {"type": "STRING", "comment": null, "index": 34, "name": "ticket_first_satisfaction_score"}, "ticket_satisfaction_score": {"type": "STRING", "comment": null, "index": 35, "name": "ticket_satisfaction_score"}, "ticket_satisfaction_comment": {"type": "STRING", "comment": null, "index": 36, "name": "ticket_satisfaction_comment"}, "ticket_satisfaction_reason": {"type": "STRING", "comment": null, "index": 37, "name": "ticket_satisfaction_reason"}, "is_good_to_bad_satisfaction_score": {"type": "BOOL", "comment": null, "index": 38, "name": "is_good_to_bad_satisfaction_score"}, "is_bad_to_good_satisfaction_score": {"type": "BOOL", "comment": null, "index": 39, "name": "is_bad_to_good_satisfaction_score"}, "ticket_organization_domain_names": {"type": "STRING", "comment": null, "index": 40, "name": "ticket_organization_domain_names"}, "requester_organization_domain_names": {"type": "STRING", "comment": null, "index": 41, "name": "requester_organization_domain_names"}, "requester_external_id": {"type": "STRING", "comment": null, "index": 42, "name": "requester_external_id"}, "requester_created_at": {"type": "TIMESTAMP", "comment": null, "index": 43, "name": "requester_created_at"}, "requester_updated_at": {"type": "DATETIME", "comment": null, "index": 44, "name": "requester_updated_at"}, "requester_role": {"type": "STRING", "comment": null, "index": 45, "name": "requester_role"}, "requester_email": {"type": "STRING", "comment": null, "index": 46, "name": "requester_email"}, "requester_name": {"type": "STRING", "comment": null, "index": 47, "name": "requester_name"}, "is_requester_active": {"type": "BOOL", "comment": null, "index": 48, "name": "is_requester_active"}, "requester_locale": {"type": "STRING", "comment": null, "index": 49, "name": "requester_locale"}, "requester_time_zone": {"type": "STRING", "comment": null, "index": 50, "name": "requester_time_zone"}, "requester_ticket_update_count": {"type": "INT64", "comment": null, "index": 51, "name": "requester_ticket_update_count"}, "requester_ticket_last_update_at": {"type": "TIMESTAMP", "comment": null, "index": 52, "name": "requester_ticket_last_update_at"}, "requester_last_login_at": {"type": "TIMESTAMP", "comment": null, "index": 53, "name": "requester_last_login_at"}, "requester_organization_id": {"type": "INT64", "comment": null, "index": 54, "name": "requester_organization_id"}, "requester_organization_name": {"type": "STRING", "comment": null, "index": 55, "name": "requester_organization_name"}, "requester_organization_tags": {"type": "STRING", "comment": null, "index": 56, "name": "requester_organization_tags"}, "requester_organization_external_id": {"type": "INT64", "comment": null, "index": 57, "name": "requester_organization_external_id"}, "requester_organization_created_at": {"type": "TIMESTAMP", "comment": null, "index": 58, "name": "requester_organization_created_at"}, "requester_organization_updated_at": {"type": "TIMESTAMP", "comment": null, "index": 59, "name": "requester_organization_updated_at"}, "submitter_external_id": {"type": "STRING", "comment": null, "index": 60, "name": "submitter_external_id"}, "submitter_role": {"type": "STRING", "comment": null, "index": 61, "name": "submitter_role"}, "is_agent_submitted": {"type": "BOOL", "comment": null, "index": 62, "name": "is_agent_submitted"}, "submitter_email": {"type": "STRING", "comment": null, "index": 63, "name": "submitter_email"}, "submitter_name": {"type": "STRING", "comment": null, "index": 64, "name": "submitter_name"}, "is_submitter_active": {"type": "BOOL", "comment": null, "index": 65, "name": "is_submitter_active"}, "submitter_locale": {"type": "STRING", "comment": null, "index": 66, "name": "submitter_locale"}, "submitter_time_zone": {"type": "STRING", "comment": null, "index": 67, "name": "submitter_time_zone"}, "assignee_external_id": {"type": "STRING", "comment": null, "index": 68, "name": "assignee_external_id"}, "assignee_role": {"type": "STRING", "comment": null, "index": 69, "name": "assignee_role"}, "assignee_email": {"type": "STRING", "comment": null, "index": 70, "name": "assignee_email"}, "assignee_name": {"type": "STRING", "comment": null, "index": 71, "name": "assignee_name"}, "is_assignee_active": {"type": "BOOL", "comment": null, "index": 72, "name": "is_assignee_active"}, "assignee_locale": {"type": "STRING", "comment": null, "index": 73, "name": "assignee_locale"}, "assignee_time_zone": {"type": "STRING", "comment": null, "index": 74, "name": "assignee_time_zone"}, "assignee_ticket_update_count": {"type": "INT64", "comment": null, "index": 75, "name": "assignee_ticket_update_count"}, "assignee_ticket_last_update_at": {"type": "TIMESTAMP", "comment": null, "index": 76, "name": "assignee_ticket_last_update_at"}, "assignee_last_login_at": {"type": "TIMESTAMP", "comment": null, "index": 77, "name": "assignee_last_login_at"}, "group_name": {"type": "STRING", "comment": null, "index": 78, "name": "group_name"}, "organization_name": {"type": "STRING", "comment": null, "index": 79, "name": "organization_name"}, "requester_tag": {"type": "STRING", "comment": null, "index": 80, "name": "requester_tag"}, "submitter_tag": {"type": "STRING", "comment": null, "index": 81, "name": "submitter_tag"}, "assignee_tag": {"type": "STRING", "comment": null, "index": 82, "name": "assignee_tag"}, "first_reply_time_calendar_minutes": {"type": "INT64", "comment": null, "index": 83, "name": "first_reply_time_calendar_minutes"}, "total_reply_time_calendar_minutes": {"type": "INT64", "comment": null, "index": 84, "name": "total_reply_time_calendar_minutes"}, "count_agent_comments": {"type": "INT64", "comment": null, "index": 85, "name": "count_agent_comments"}, "count_end_user_comments": {"type": "INT64", "comment": null, "index": 86, "name": "count_end_user_comments"}, "count_internal_comments": {"type": "INT64", "comment": null, "index": 87, "name": "count_internal_comments"}, "count_public_comments": {"type": "INT64", "comment": null, "index": 88, "name": "count_public_comments"}, "total_comments": {"type": "INT64", "comment": null, "index": 89, "name": "total_comments"}, "ticket_last_comment_date": {"type": "TIMESTAMP", "comment": null, "index": 90, "name": "ticket_last_comment_date"}, "unique_assignee_count": {"type": "INT64", "comment": null, "index": 91, "name": "unique_assignee_count"}, "assignee_stations_count": {"type": "INT64", "comment": null, "index": 92, "name": "assignee_stations_count"}, "group_stations_count": {"type": "INT64", "comment": null, "index": 93, "name": "group_stations_count"}, "first_assignee_id": {"type": "STRING", "comment": null, "index": 94, "name": "first_assignee_id"}, "last_assignee_id": {"type": "STRING", "comment": null, "index": 95, "name": "last_assignee_id"}, "first_agent_assignment_date": {"type": "TIMESTAMP", "comment": null, "index": 96, "name": "first_agent_assignment_date"}, "last_agent_assignment_date": {"type": "TIMESTAMP", "comment": null, "index": 97, "name": "last_agent_assignment_date"}, "first_solved_at": {"type": "TIMESTAMP", "comment": null, "index": 98, "name": "first_solved_at"}, "last_solved_at": {"type": "TIMESTAMP", "comment": null, "index": 99, "name": "last_solved_at"}, "first_assignment_to_resolution_calendar_minutes": {"type": "INT64", "comment": null, "index": 100, "name": "first_assignment_to_resolution_calendar_minutes"}, "last_assignment_to_resolution_calendar_minutes": {"type": "INT64", "comment": null, "index": 101, "name": "last_assignment_to_resolution_calendar_minutes"}, "ticket_unassigned_duration_calendar_minutes": {"type": "FLOAT64", "comment": null, "index": 102, "name": "ticket_unassigned_duration_calendar_minutes"}, "first_resolution_calendar_minutes": {"type": "INT64", "comment": null, "index": 103, "name": "first_resolution_calendar_minutes"}, "final_resolution_calendar_minutes": {"type": "INT64", "comment": null, "index": 104, "name": "final_resolution_calendar_minutes"}, "count_resolutions": {"type": "INT64", "comment": null, "index": 105, "name": "count_resolutions"}, "count_reopens": {"type": "INT64", "comment": null, "index": 106, "name": "count_reopens"}, "ticket_deleted_count": {"type": "INT64", "comment": null, "index": 107, "name": "ticket_deleted_count"}, "total_ticket_recoveries": {"type": "INT64", "comment": null, "index": 108, "name": "total_ticket_recoveries"}, "last_status_assignment_date": {"type": "TIMESTAMP", "comment": null, "index": 109, "name": "last_status_assignment_date"}, "new_status_duration_in_calendar_minutes": {"type": "INT64", "comment": null, "index": 110, "name": "new_status_duration_in_calendar_minutes"}, "open_status_duration_in_calendar_minutes": {"type": "INT64", "comment": null, "index": 111, "name": "open_status_duration_in_calendar_minutes"}, "agent_wait_time_in_calendar_minutes": {"type": "INT64", "comment": null, "index": 112, "name": "agent_wait_time_in_calendar_minutes"}, "requester_wait_time_in_calendar_minutes": {"type": "INT64", "comment": null, "index": 113, "name": "requester_wait_time_in_calendar_minutes"}, "agent_work_time_in_calendar_minutes": {"type": "INT64", "comment": null, "index": 114, "name": "agent_work_time_in_calendar_minutes"}, "on_hold_time_in_calendar_minutes": {"type": "INT64", "comment": null, "index": 115, "name": "on_hold_time_in_calendar_minutes"}, "total_agent_replies": {"type": "INT64", "comment": null, "index": 116, "name": "total_agent_replies"}, "requester_last_login_age_minutes": {"type": "FLOAT64", "comment": null, "index": 117, "name": "requester_last_login_age_minutes"}, "assignee_last_login_age_minutes": {"type": "FLOAT64", "comment": null, "index": 118, "name": "assignee_last_login_age_minutes"}, "unsolved_ticket_age_minutes": {"type": "FLOAT64", "comment": null, "index": 119, "name": "unsolved_ticket_age_minutes"}, "unsolved_ticket_age_since_update_minutes": {"type": "FLOAT64", "comment": null, "index": 120, "name": "unsolved_ticket_age_since_update_minutes"}, "is_one_touch_resolution": {"type": "BOOL", "comment": null, "index": 121, "name": "is_one_touch_resolution"}, "is_two_touch_resolution": {"type": "BOOL", "comment": null, "index": 122, "name": "is_two_touch_resolution"}, "is_multi_touch_resolution": {"type": "BOOL", "comment": null, "index": 123, "name": "is_multi_touch_resolution"}, "first_resolution_business_minutes": {"type": "FLOAT64", "comment": null, "index": 124, "name": "first_resolution_business_minutes"}, "full_resolution_business_minutes": {"type": "FLOAT64", "comment": null, "index": 125, "name": "full_resolution_business_minutes"}, "first_reply_time_business_minutes": {"type": "FLOAT64", "comment": null, "index": 126, "name": "first_reply_time_business_minutes"}, "agent_wait_time_in_business_minutes": {"type": "FLOAT64", "comment": null, "index": 127, "name": "agent_wait_time_in_business_minutes"}, "requester_wait_time_in_business_minutes": {"type": "FLOAT64", "comment": null, "index": 128, "name": "requester_wait_time_in_business_minutes"}, "agent_work_time_in_business_minutes": {"type": "FLOAT64", "comment": null, "index": 129, "name": "agent_work_time_in_business_minutes"}, "on_hold_time_in_business_minutes": {"type": "FLOAT64", "comment": null, "index": 130, "name": "on_hold_time_in_business_minutes"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 0.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 0.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.zendesk__ticket_metrics"}, "model.zendesk.zendesk__ticket_backlog": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "name": "zendesk__ticket_backlog", "comment": null, "owner": null}, "columns": {"date_day": {"type": "DATE", "comment": null, "index": 1, "name": "date_day"}, "ticket_id": {"type": "INT64", "comment": null, "index": 2, "name": "ticket_id"}, "status": {"type": "STRING", "comment": null, "index": 3, "name": "status"}, "created_channel": {"type": "STRING", "comment": null, "index": 4, "name": "created_channel"}, "assignee_name": {"type": "STRING", "comment": null, "index": 5, "name": "assignee_name"}, "priority": {"type": "STRING", "comment": null, "index": 6, "name": "priority"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 0.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 0.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.zendesk__ticket_backlog"}, "seed.zendesk_integration_tests.organization_data": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "name": "organization_data", "comment": null, "owner": null}, "columns": {"id": {"type": "INT64", "comment": null, "index": 1, "name": "id"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 2, "name": "_fivetran_synced"}, "created_at": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "created_at"}, "details": {"type": "INT64", "comment": null, "index": 4, "name": "details"}, "external_id": {"type": "INT64", "comment": null, "index": 5, "name": "external_id"}, "group_id": {"type": "INT64", "comment": null, "index": 6, "name": "group_id"}, "name": {"type": "STRING", "comment": null, "index": 7, "name": "name"}, "notes": {"type": "INT64", "comment": null, "index": 8, "name": "notes"}, "shared_comments": {"type": "BOOL", "comment": null, "index": 9, "name": "shared_comments"}, "shared_tickets": {"type": "BOOL", "comment": null, "index": 10, "name": "shared_tickets"}, "updated_at": {"type": "TIMESTAMP", "comment": null, "index": 11, "name": "updated_at"}, "url": {"type": "STRING", "comment": null, "index": 12, "name": "url"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 10.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 1011.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "seed.zendesk_integration_tests.organization_data"}, "seed.zendesk_integration_tests.user_tag_data_snowflake": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "name": "user_tag_data_snowflake", "comment": null, "owner": null}, "columns": {"TAG": {"type": "STRING", "comment": null, "index": 1, "name": "TAG"}, "user_id": {"type": "INT64", "comment": null, "index": 2, "name": "user_id"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "_fivetran_synced"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 10.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 500.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "seed.zendesk_integration_tests.user_tag_data_snowflake"}, "seed.zendesk_integration_tests.schedule_data": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "name": "schedule_data", "comment": null, "owner": null}, "columns": {"end_time": {"type": "INT64", "comment": null, "index": 1, "name": "end_time"}, "id": {"type": "INT64", "comment": null, "index": 2, "name": "id"}, "start_time": {"type": "INT64", "comment": null, "index": 3, "name": "start_time"}, "_fivetran_deleted": {"type": "BOOL", "comment": null, "index": 4, "name": "_fivetran_deleted"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 5, "name": "_fivetran_synced"}, "end_time_utc": {"type": "INT64", "comment": null, "index": 6, "name": "end_time_utc"}, "name": {"type": "STRING", "comment": null, "index": 7, "name": "name"}, "start_time_utc": {"type": "INT64", "comment": null, "index": 8, "name": "start_time_utc"}, "time_zone": {"type": "STRING", "comment": null, "index": 9, "name": "time_zone"}, "created_at": {"type": "TIMESTAMP", "comment": null, "index": 10, "name": "created_at"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 5.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 480.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "seed.zendesk_integration_tests.schedule_data"}, "model.zendesk.zendesk__sla_policies": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "name": "zendesk__sla_policies", "comment": null, "owner": null}, "columns": {"sla_event_id": {"type": "STRING", "comment": null, "index": 1, "name": "sla_event_id"}, "ticket_id": {"type": "INT64", "comment": null, "index": 2, "name": "ticket_id"}, "sla_policy_name": {"type": "STRING", "comment": null, "index": 3, "name": "sla_policy_name"}, "metric": {"type": "STRING", "comment": null, "index": 4, "name": "metric"}, "sla_applied_at": {"type": "TIMESTAMP", "comment": null, "index": 5, "name": "sla_applied_at"}, "target": {"type": "INT64", "comment": null, "index": 6, "name": "target"}, "in_business_hours": {"type": "STRING", "comment": null, "index": 7, "name": "in_business_hours"}, "sla_breach_at": {"type": "TIMESTAMP", "comment": null, "index": 8, "name": "sla_breach_at"}, "sla_elapsed_time": {"type": "FLOAT64", "comment": null, "index": 9, "name": "sla_elapsed_time"}, "is_active_sla": {"type": "BOOL", "comment": null, "index": 10, "name": "is_active_sla"}, "is_sla_breach": {"type": "BOOL", "comment": null, "index": 11, "name": "is_sla_breach"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 0.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 0.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk.zendesk__sla_policies"}, "seed.zendesk_integration_tests.group_data": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "name": "group_data", "comment": null, "owner": null}, "columns": {"id": {"type": "INT64", "comment": null, "index": 1, "name": "id"}, "_fivetran_deleted": {"type": "BOOL", "comment": null, "index": 2, "name": "_fivetran_deleted"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "_fivetran_synced"}, "created_at": {"type": "TIMESTAMP", "comment": null, "index": 4, "name": "created_at"}, "name": {"type": "STRING", "comment": null, "index": 5, "name": "name"}, "updated_at": {"type": "TIMESTAMP", "comment": null, "index": 6, "name": "updated_at"}, "url": {"type": "STRING", "comment": null, "index": 7, "name": "url"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 8.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 879.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "seed.zendesk_integration_tests.group_data"}, "seed.zendesk_integration_tests.organization_tag_data": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "name": "organization_tag_data", "comment": null, "owner": null}, "columns": {"organization_id": {"type": "INT64", "comment": null, "index": 1, "name": "organization_id"}, "tag": {"type": "STRING", "comment": null, "index": 2, "name": "tag"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "_fivetran_synced"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 12.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 600.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "seed.zendesk_integration_tests.organization_tag_data"}, "seed.zendesk_integration_tests.organization_tag_data_snowflake": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "name": "organization_tag_data_snowflake", "comment": null, "owner": null}, "columns": {"organization_id": {"type": "INT64", "comment": null, "index": 1, "name": "organization_id"}, "TAG": {"type": "STRING", "comment": null, "index": 2, "name": "TAG"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "_fivetran_synced"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 12.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 600.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "seed.zendesk_integration_tests.organization_tag_data_snowflake"}, "model.zendesk_source.stg_zendesk__user_tmp": {"metadata": {"type": "view", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "name": "stg_zendesk__user_tmp", "comment": null, "owner": null}, "columns": {"id": {"type": "INT64", "comment": null, "index": 1, "name": "id"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 2, "name": "_fivetran_synced"}, "active": {"type": "BOOL", "comment": null, "index": 3, "name": "active"}, "alias": {"type": "INT64", "comment": null, "index": 4, "name": "alias"}, "authenticity_token": {"type": "INT64", "comment": null, "index": 5, "name": "authenticity_token"}, "chat_only": {"type": "BOOL", "comment": null, "index": 6, "name": "chat_only"}, "created_at": {"type": "TIMESTAMP", "comment": null, "index": 7, "name": "created_at"}, "details": {"type": "INT64", "comment": null, "index": 8, "name": "details"}, "email": {"type": "STRING", "comment": null, "index": 9, "name": "email"}, "external_id": {"type": "STRING", "comment": null, "index": 10, "name": "external_id"}, "last_login_at": {"type": "TIMESTAMP", "comment": null, "index": 11, "name": "last_login_at"}, "locale": {"type": "STRING", "comment": null, "index": 12, "name": "locale"}, "locale_id": {"type": "INT64", "comment": null, "index": 13, "name": "locale_id"}, "moderator": {"type": "BOOL", "comment": null, "index": 14, "name": "moderator"}, "name": {"type": "STRING", "comment": null, "index": 15, "name": "name"}, "notes": {"type": "INT64", "comment": null, "index": 16, "name": "notes"}, "only_private_comments": {"type": "BOOL", "comment": null, "index": 17, "name": "only_private_comments"}, "organization_id": {"type": "INT64", "comment": null, "index": 18, "name": "organization_id"}, "phone": {"type": "INT64", "comment": null, "index": 19, "name": "phone"}, "remote_photo_url": {"type": "INT64", "comment": null, "index": 20, "name": "remote_photo_url"}, "restricted_agent": {"type": "BOOL", "comment": null, "index": 21, "name": "restricted_agent"}, "role": {"type": "STRING", "comment": null, "index": 22, "name": "role"}, "shared": {"type": "BOOL", "comment": null, "index": 23, "name": "shared"}, "shared_agent": {"type": "BOOL", "comment": null, "index": 24, "name": "shared_agent"}, "signature": {"type": "INT64", "comment": null, "index": 25, "name": "signature"}, "suspended": {"type": "BOOL", "comment": null, "index": 26, "name": "suspended"}, "ticket_restriction": {"type": "STRING", "comment": null, "index": 27, "name": "ticket_restriction"}, "time_zone": {"type": "STRING", "comment": null, "index": 28, "name": "time_zone"}, "two_factor_auth_enabled": {"type": "BOOL", "comment": null, "index": 29, "name": "two_factor_auth_enabled"}, "updated_at": {"type": "DATETIME", "comment": null, "index": 30, "name": "updated_at"}, "url": {"type": "STRING", "comment": null, "index": 31, "name": "url"}, "verified": {"type": "BOOL", "comment": null, "index": 32, "name": "verified"}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk_source.stg_zendesk__user_tmp"}, "model.zendesk_source.stg_zendesk__ticket_field_history_tmp": {"metadata": {"type": "view", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "name": "stg_zendesk__ticket_field_history_tmp", "comment": null, "owner": null}, "columns": {"field_name": {"type": "STRING", "comment": null, "index": 1, "name": "field_name"}, "ticket_id": {"type": "INT64", "comment": null, "index": 2, "name": "ticket_id"}, "updated": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "updated"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 4, "name": "_fivetran_synced"}, "user_id": {"type": "INT64", "comment": null, "index": 5, "name": "user_id"}, "value": {"type": "STRING", "comment": null, "index": 6, "name": "value"}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk_source.stg_zendesk__ticket_field_history_tmp"}, "model.zendesk_source.stg_zendesk__ticket_comment": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "name": "stg_zendesk__ticket_comment", "comment": null, "owner": null}, "columns": {"ticket_comment_id": {"type": "INT64", "comment": null, "index": 1, "name": "ticket_comment_id"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 2, "name": "_fivetran_synced"}, "body": {"type": "STRING", "comment": null, "index": 3, "name": "body"}, "created_at": {"type": "TIMESTAMP", "comment": null, "index": 4, "name": "created_at"}, "is_public": {"type": "BOOL", "comment": null, "index": 5, "name": "is_public"}, "ticket_id": {"type": "INT64", "comment": null, "index": 6, "name": "ticket_id"}, "user_id": {"type": "INT64", "comment": null, "index": 7, "name": "user_id"}, "is_facebook_comment": {"type": "BOOL", "comment": null, "index": 8, "name": "is_facebook_comment"}, "is_tweet": {"type": "BOOL", "comment": null, "index": 9, "name": "is_tweet"}, "is_voice_comment": {"type": "BOOL", "comment": null, "index": 10, "name": "is_voice_comment"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 20.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 1031.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk_source.stg_zendesk__ticket_comment"}, "model.zendesk_source.stg_zendesk__schedule_tmp": {"metadata": {"type": "view", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "name": "stg_zendesk__schedule_tmp", "comment": null, "owner": null}, "columns": {"end_time": {"type": "INT64", "comment": null, "index": 1, "name": "end_time"}, "id": {"type": "INT64", "comment": null, "index": 2, "name": "id"}, "start_time": {"type": "INT64", "comment": null, "index": 3, "name": "start_time"}, "_fivetran_deleted": {"type": "BOOL", "comment": null, "index": 4, "name": "_fivetran_deleted"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 5, "name": "_fivetran_synced"}, "end_time_utc": {"type": "INT64", "comment": null, "index": 6, "name": "end_time_utc"}, "name": {"type": "STRING", "comment": null, "index": 7, "name": "name"}, "start_time_utc": {"type": "INT64", "comment": null, "index": 8, "name": "start_time_utc"}, "time_zone": {"type": "STRING", "comment": null, "index": 9, "name": "time_zone"}, "created_at": {"type": "TIMESTAMP", "comment": null, "index": 10, "name": "created_at"}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk_source.stg_zendesk__schedule_tmp"}, "model.zendesk_source.stg_zendesk__ticket_field_history": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "name": "stg_zendesk__ticket_field_history", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "comment": null, "index": 1, "name": "ticket_id"}, "field_name": {"type": "STRING", "comment": null, "index": 2, "name": "field_name"}, "valid_starting_at": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "valid_starting_at"}, "valid_ending_at": {"type": "TIMESTAMP", "comment": null, "index": 4, "name": "valid_ending_at"}, "value": {"type": "STRING", "comment": null, "index": 5, "name": "value"}, "user_id": {"type": "INT64", "comment": null, "index": 6, "name": "user_id"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 20.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 669.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk_source.stg_zendesk__ticket_field_history"}, "model.zendesk_source.stg_zendesk__organization_tag": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "name": "stg_zendesk__organization_tag", "comment": null, "owner": null}, "columns": {"organization_id": {"type": "INT64", "comment": null, "index": 1, "name": "organization_id"}, "tags": {"type": "STRING", "comment": null, "index": 2, "name": "tags"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 12.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 504.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk_source.stg_zendesk__organization_tag"}, "model.zendesk_source.stg_zendesk__ticket_tag_tmp": {"metadata": {"type": "view", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "name": "stg_zendesk__ticket_tag_tmp", "comment": null, "owner": null}, "columns": {"tag": {"type": "STRING", "comment": null, "index": 1, "name": "tag"}, "ticket_id": {"type": "INT64", "comment": null, "index": 2, "name": "ticket_id"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "_fivetran_synced"}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk_source.stg_zendesk__ticket_tag_tmp"}, "model.zendesk_source.stg_zendesk__brand_tmp": {"metadata": {"type": "view", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "name": "stg_zendesk__brand_tmp", "comment": null, "owner": null}, "columns": {"id": {"type": "INT64", "comment": null, "index": 1, "name": "id"}, "_fivetran_deleted": {"type": "BOOL", "comment": null, "index": 2, "name": "_fivetran_deleted"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "_fivetran_synced"}, "active": {"type": "BOOL", "comment": null, "index": 4, "name": "active"}, "brand_url": {"type": "STRING", "comment": null, "index": 5, "name": "brand_url"}, "default": {"type": "BOOL", "comment": null, "index": 6, "name": "default"}, "has_help_center": {"type": "BOOL", "comment": null, "index": 7, "name": "has_help_center"}, "help_center_state": {"type": "STRING", "comment": null, "index": 8, "name": "help_center_state"}, "logo_content_type": {"type": "STRING", "comment": null, "index": 9, "name": "logo_content_type"}, "logo_content_url": {"type": "STRING", "comment": null, "index": 10, "name": "logo_content_url"}, "logo_deleted": {"type": "BOOL", "comment": null, "index": 11, "name": "logo_deleted"}, "logo_file_name": {"type": "STRING", "comment": null, "index": 12, "name": "logo_file_name"}, "logo_height": {"type": "INT64", "comment": null, "index": 13, "name": "logo_height"}, "logo_id": {"type": "INT64", "comment": null, "index": 14, "name": "logo_id"}, "logo_inline": {"type": "BOOL", "comment": null, "index": 15, "name": "logo_inline"}, "logo_mapped_content_url": {"type": "STRING", "comment": null, "index": 16, "name": "logo_mapped_content_url"}, "logo_size": {"type": "INT64", "comment": null, "index": 17, "name": "logo_size"}, "logo_url": {"type": "STRING", "comment": null, "index": 18, "name": "logo_url"}, "logo_width": {"type": "INT64", "comment": null, "index": 19, "name": "logo_width"}, "name": {"type": "STRING", "comment": null, "index": 20, "name": "name"}, "subdomain": {"type": "STRING", "comment": null, "index": 21, "name": "subdomain"}, "url": {"type": "STRING", "comment": null, "index": 22, "name": "url"}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk_source.stg_zendesk__brand_tmp"}, "model.zendesk_source.stg_zendesk__domain_name": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "name": "stg_zendesk__domain_name", "comment": null, "owner": null}, "columns": {"organization_id": {"type": "INT64", "comment": null, "index": 1, "name": "organization_id"}, "domain_name": {"type": "STRING", "comment": null, "index": 2, "name": "domain_name"}, "index": {"type": "INT64", "comment": null, "index": 3, "name": "index"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 10.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 500.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk_source.stg_zendesk__domain_name"}, "model.zendesk_source.stg_zendesk__ticket_tmp": {"metadata": {"type": "view", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "name": "stg_zendesk__ticket_tmp", "comment": null, "owner": null}, "columns": {"id": {"type": "INT64", "comment": null, "index": 1, "name": "id"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 2, "name": "_fivetran_synced"}, "allow_channelback": {"type": "BOOL", "comment": null, "index": 3, "name": "allow_channelback"}, "assignee_id": {"type": "INT64", "comment": null, "index": 4, "name": "assignee_id"}, "brand_id": {"type": "INT64", "comment": null, "index": 5, "name": "brand_id"}, "created_at": {"type": "TIMESTAMP", "comment": null, "index": 6, "name": "created_at"}, "description": {"type": "STRING", "comment": null, "index": 7, "name": "description"}, "due_at": {"type": "TIMESTAMP", "comment": null, "index": 8, "name": "due_at"}, "external_id": {"type": "INT64", "comment": null, "index": 9, "name": "external_id"}, "forum_topic_id": {"type": "INT64", "comment": null, "index": 10, "name": "forum_topic_id"}, "group_id": {"type": "INT64", "comment": null, "index": 11, "name": "group_id"}, "has_incidents": {"type": "BOOL", "comment": null, "index": 12, "name": "has_incidents"}, "is_public": {"type": "BOOL", "comment": null, "index": 13, "name": "is_public"}, "organization_id": {"type": "INT64", "comment": null, "index": 14, "name": "organization_id"}, "priority": {"type": "INT64", "comment": null, "index": 15, "name": "priority"}, "problem_id": {"type": "INT64", "comment": null, "index": 16, "name": "problem_id"}, "recipient": {"type": "STRING", "comment": null, "index": 17, "name": "recipient"}, "requester_id": {"type": "INT64", "comment": null, "index": 18, "name": "requester_id"}, "status": {"type": "STRING", "comment": null, "index": 19, "name": "status"}, "subject": {"type": "STRING", "comment": null, "index": 20, "name": "subject"}, "submitter_id": {"type": "INT64", "comment": null, "index": 21, "name": "submitter_id"}, "system_client": {"type": "INT64", "comment": null, "index": 22, "name": "system_client"}, "ticket_form_id": {"type": "INT64", "comment": null, "index": 23, "name": "ticket_form_id"}, "type": {"type": "STRING", "comment": null, "index": 24, "name": "type"}, "updated_at": {"type": "DATETIME", "comment": null, "index": 25, "name": "updated_at"}, "url": {"type": "STRING", "comment": null, "index": 26, "name": "url"}, "via_channel": {"type": "STRING", "comment": null, "index": 27, "name": "via_channel"}, "via_source_from_id": {"type": "INT64", "comment": null, "index": 28, "name": "via_source_from_id"}, "via_source_from_title": {"type": "INT64", "comment": null, "index": 29, "name": "via_source_from_title"}, "via_source_rel": {"type": "INT64", "comment": null, "index": 30, "name": "via_source_rel"}, "via_source_to_address": {"type": "STRING", "comment": null, "index": 31, "name": "via_source_to_address"}, "via_source_to_name": {"type": "STRING", "comment": null, "index": 32, "name": "via_source_to_name"}, "merged_ticket_ids": {"type": "STRING", "comment": null, "index": 33, "name": "merged_ticket_ids"}, "via_source_from_address": {"type": "INT64", "comment": null, "index": 34, "name": "via_source_from_address"}, "followup_ids": {"type": "STRING", "comment": null, "index": 35, "name": "followup_ids"}, "via_followup_source_id": {"type": "INT64", "comment": null, "index": 36, "name": "via_followup_source_id"}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk_source.stg_zendesk__ticket_tmp"}, "model.zendesk_source.stg_zendesk__user_tag": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "name": "stg_zendesk__user_tag", "comment": null, "owner": null}, "columns": {"user_id": {"type": "INT64", "comment": null, "index": 1, "name": "user_id"}, "tags": {"type": "STRING", "comment": null, "index": 2, "name": "tags"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 10.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 420.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk_source.stg_zendesk__user_tag"}, "model.zendesk_source.stg_zendesk__group": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "name": "stg_zendesk__group", "comment": null, "owner": null}, "columns": {"group_id": {"type": "INT64", "comment": null, "index": 1, "name": "group_id"}, "name": {"type": "STRING", "comment": null, "index": 2, "name": "name"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 8.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 255.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk_source.stg_zendesk__group"}, "model.zendesk_source.stg_zendesk__user_tag_tmp": {"metadata": {"type": "view", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "name": "stg_zendesk__user_tag_tmp", "comment": null, "owner": null}, "columns": {"tag": {"type": "STRING", "comment": null, "index": 1, "name": "tag"}, "user_id": {"type": "INT64", "comment": null, "index": 2, "name": "user_id"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "_fivetran_synced"}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk_source.stg_zendesk__user_tag_tmp"}, "model.zendesk_source.stg_zendesk__ticket_comment_tmp": {"metadata": {"type": "view", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "name": "stg_zendesk__ticket_comment_tmp", "comment": null, "owner": null}, "columns": {"id": {"type": "INT64", "comment": null, "index": 1, "name": "id"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 2, "name": "_fivetran_synced"}, "body": {"type": "STRING", "comment": null, "index": 3, "name": "body"}, "created": {"type": "TIMESTAMP", "comment": null, "index": 4, "name": "created"}, "facebook_comment": {"type": "BOOL", "comment": null, "index": 5, "name": "facebook_comment"}, "public": {"type": "BOOL", "comment": null, "index": 6, "name": "public"}, "ticket_id": {"type": "INT64", "comment": null, "index": 7, "name": "ticket_id"}, "tweet": {"type": "BOOL", "comment": null, "index": 8, "name": "tweet"}, "user_id": {"type": "INT64", "comment": null, "index": 9, "name": "user_id"}, "voice_comment": {"type": "BOOL", "comment": null, "index": 10, "name": "voice_comment"}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk_source.stg_zendesk__ticket_comment_tmp"}, "model.zendesk_source.stg_zendesk__brand": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "name": "stg_zendesk__brand", "comment": null, "owner": null}, "columns": {"brand_id": {"type": "INT64", "comment": null, "index": 1, "name": "brand_id"}, "brand_url": {"type": "STRING", "comment": null, "index": 2, "name": "brand_url"}, "name": {"type": "STRING", "comment": null, "index": 3, "name": "name"}, "subdomain": {"type": "STRING", "comment": null, "index": 4, "name": "subdomain"}, "is_active": {"type": "BOOL", "comment": null, "index": 5, "name": "is_active"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 1.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 111.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk_source.stg_zendesk__brand"}, "model.zendesk_source.stg_zendesk__organization_tag_tmp": {"metadata": {"type": "view", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "name": "stg_zendesk__organization_tag_tmp", "comment": null, "owner": null}, "columns": {"organization_id": {"type": "INT64", "comment": null, "index": 1, "name": "organization_id"}, "tag": {"type": "STRING", "comment": null, "index": 2, "name": "tag"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "_fivetran_synced"}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk_source.stg_zendesk__organization_tag_tmp"}, "model.zendesk_source.stg_zendesk__ticket_schedule_tmp": {"metadata": {"type": "view", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "name": "stg_zendesk__ticket_schedule_tmp", "comment": null, "owner": null}, "columns": {"_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 1, "name": "_fivetran_synced"}, "created_at": {"type": "TIMESTAMP", "comment": null, "index": 2, "name": "created_at"}, "schedule_id": {"type": "INT64", "comment": null, "index": 3, "name": "schedule_id"}, "ticket_id": {"type": "INT64", "comment": null, "index": 4, "name": "ticket_id"}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk_source.stg_zendesk__ticket_schedule_tmp"}, "model.zendesk_source.stg_zendesk__schedule": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "name": "stg_zendesk__schedule", "comment": null, "owner": null}, "columns": {"schedule_id": {"type": "STRING", "comment": null, "index": 1, "name": "schedule_id"}, "end_time_utc": {"type": "INT64", "comment": null, "index": 2, "name": "end_time_utc"}, "start_time_utc": {"type": "INT64", "comment": null, "index": 3, "name": "start_time_utc"}, "schedule_name": {"type": "STRING", "comment": null, "index": 4, "name": "schedule_name"}, "created_at": {"type": "TIMESTAMP", "comment": null, "index": 5, "name": "created_at"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 5.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 245.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk_source.stg_zendesk__schedule"}, "model.zendesk_source.stg_zendesk__organization_tmp": {"metadata": {"type": "view", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "name": "stg_zendesk__organization_tmp", "comment": null, "owner": null}, "columns": {"id": {"type": "INT64", "comment": null, "index": 1, "name": "id"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 2, "name": "_fivetran_synced"}, "created_at": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "created_at"}, "details": {"type": "INT64", "comment": null, "index": 4, "name": "details"}, "external_id": {"type": "INT64", "comment": null, "index": 5, "name": "external_id"}, "group_id": {"type": "INT64", "comment": null, "index": 6, "name": "group_id"}, "name": {"type": "STRING", "comment": null, "index": 7, "name": "name"}, "notes": {"type": "INT64", "comment": null, "index": 8, "name": "notes"}, "shared_comments": {"type": "BOOL", "comment": null, "index": 9, "name": "shared_comments"}, "shared_tickets": {"type": "BOOL", "comment": null, "index": 10, "name": "shared_tickets"}, "updated_at": {"type": "TIMESTAMP", "comment": null, "index": 11, "name": "updated_at"}, "url": {"type": "STRING", "comment": null, "index": 12, "name": "url"}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk_source.stg_zendesk__organization_tmp"}, "model.zendesk_source.stg_zendesk__domain_name_tmp": {"metadata": {"type": "view", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "name": "stg_zendesk__domain_name_tmp", "comment": null, "owner": null}, "columns": {"index": {"type": "INT64", "comment": null, "index": 1, "name": "index"}, "organization_id": {"type": "INT64", "comment": null, "index": 2, "name": "organization_id"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "_fivetran_synced"}, "domain_name": {"type": "STRING", "comment": null, "index": 4, "name": "domain_name"}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk_source.stg_zendesk__domain_name_tmp"}, "model.zendesk_source.stg_zendesk__group_tmp": {"metadata": {"type": "view", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "name": "stg_zendesk__group_tmp", "comment": null, "owner": null}, "columns": {"id": {"type": "INT64", "comment": null, "index": 1, "name": "id"}, "_fivetran_deleted": {"type": "BOOL", "comment": null, "index": 2, "name": "_fivetran_deleted"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "_fivetran_synced"}, "created_at": {"type": "TIMESTAMP", "comment": null, "index": 4, "name": "created_at"}, "name": {"type": "STRING", "comment": null, "index": 5, "name": "name"}, "updated_at": {"type": "TIMESTAMP", "comment": null, "index": 6, "name": "updated_at"}, "url": {"type": "STRING", "comment": null, "index": 7, "name": "url"}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk_source.stg_zendesk__group_tmp"}, "model.zendesk_source.stg_zendesk__ticket_schedule": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "name": "stg_zendesk__ticket_schedule", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "comment": null, "index": 1, "name": "ticket_id"}, "created_at": {"type": "TIMESTAMP", "comment": null, "index": 2, "name": "created_at"}, "schedule_id": {"type": "STRING", "comment": null, "index": 3, "name": "schedule_id"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 1.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 0.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk_source.stg_zendesk__ticket_schedule"}, "model.zendesk_source.stg_zendesk__ticket_form_history_tmp": {"metadata": {"type": "view", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "name": "stg_zendesk__ticket_form_history_tmp", "comment": null, "owner": null}, "columns": {"id": {"type": "INT64", "comment": null, "index": 1, "name": "id"}, "updated_at": {"type": "DATETIME", "comment": null, "index": 2, "name": "updated_at"}, "_fivetran_deleted": {"type": "BOOL", "comment": null, "index": 3, "name": "_fivetran_deleted"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 4, "name": "_fivetran_synced"}, "active": {"type": "BOOL", "comment": null, "index": 5, "name": "active"}, "created_at": {"type": "DATETIME", "comment": null, "index": 6, "name": "created_at"}, "display_name": {"type": "STRING", "comment": null, "index": 7, "name": "display_name"}, "end_user_visible": {"type": "BOOL", "comment": null, "index": 8, "name": "end_user_visible"}, "name": {"type": "STRING", "comment": null, "index": 9, "name": "name"}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk_source.stg_zendesk__ticket_form_history_tmp"}, "model.zendesk_source.stg_zendesk__ticket": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "name": "stg_zendesk__ticket", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "comment": null, "index": 1, "name": "ticket_id"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 2, "name": "_fivetran_synced"}, "assignee_id": {"type": "INT64", "comment": null, "index": 3, "name": "assignee_id"}, "brand_id": {"type": "INT64", "comment": null, "index": 4, "name": "brand_id"}, "created_at": {"type": "TIMESTAMP", "comment": null, "index": 5, "name": "created_at"}, "description": {"type": "STRING", "comment": null, "index": 6, "name": "description"}, "due_at": {"type": "TIMESTAMP", "comment": null, "index": 7, "name": "due_at"}, "group_id": {"type": "INT64", "comment": null, "index": 8, "name": "group_id"}, "external_id": {"type": "INT64", "comment": null, "index": 9, "name": "external_id"}, "is_public": {"type": "BOOL", "comment": null, "index": 10, "name": "is_public"}, "organization_id": {"type": "INT64", "comment": null, "index": 11, "name": "organization_id"}, "priority": {"type": "INT64", "comment": null, "index": 12, "name": "priority"}, "recipient": {"type": "STRING", "comment": null, "index": 13, "name": "recipient"}, "requester_id": {"type": "INT64", "comment": null, "index": 14, "name": "requester_id"}, "status": {"type": "STRING", "comment": null, "index": 15, "name": "status"}, "subject": {"type": "STRING", "comment": null, "index": 16, "name": "subject"}, "problem_id": {"type": "INT64", "comment": null, "index": 17, "name": "problem_id"}, "submitter_id": {"type": "INT64", "comment": null, "index": 18, "name": "submitter_id"}, "ticket_form_id": {"type": "INT64", "comment": null, "index": 19, "name": "ticket_form_id"}, "type": {"type": "STRING", "comment": null, "index": 20, "name": "type"}, "updated_at": {"type": "DATETIME", "comment": null, "index": 21, "name": "updated_at"}, "url": {"type": "STRING", "comment": null, "index": 22, "name": "url"}, "created_channel": {"type": "STRING", "comment": null, "index": 23, "name": "created_channel"}, "source_from_id": {"type": "INT64", "comment": null, "index": 24, "name": "source_from_id"}, "source_from_title": {"type": "INT64", "comment": null, "index": 25, "name": "source_from_title"}, "source_rel": {"type": "INT64", "comment": null, "index": 26, "name": "source_rel"}, "source_to_address": {"type": "STRING", "comment": null, "index": 27, "name": "source_to_address"}, "source_to_name": {"type": "STRING", "comment": null, "index": 28, "name": "source_to_name"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 10.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 2122.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk_source.stg_zendesk__ticket"}, "model.zendesk_source.stg_zendesk__ticket_tag": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "name": "stg_zendesk__ticket_tag", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "comment": null, "index": 1, "name": "ticket_id"}, "tags": {"type": "STRING", "comment": null, "index": 2, "name": "tags"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 10.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 181.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk_source.stg_zendesk__ticket_tag"}, "model.zendesk_source.stg_zendesk__user": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "name": "stg_zendesk__user", "comment": null, "owner": null}, "columns": {"user_id": {"type": "INT64", "comment": null, "index": 1, "name": "user_id"}, "external_id": {"type": "STRING", "comment": null, "index": 2, "name": "external_id"}, "_fivetran_synced": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "_fivetran_synced"}, "created_at": {"type": "TIMESTAMP", "comment": null, "index": 4, "name": "created_at"}, "updated_at": {"type": "DATETIME", "comment": null, "index": 5, "name": "updated_at"}, "email": {"type": "STRING", "comment": null, "index": 6, "name": "email"}, "name": {"type": "STRING", "comment": null, "index": 7, "name": "name"}, "organization_id": {"type": "INT64", "comment": null, "index": 8, "name": "organization_id"}, "role": {"type": "STRING", "comment": null, "index": 9, "name": "role"}, "ticket_restriction": {"type": "STRING", "comment": null, "index": 10, "name": "ticket_restriction"}, "time_zone": {"type": "STRING", "comment": null, "index": 11, "name": "time_zone"}, "locale": {"type": "STRING", "comment": null, "index": 12, "name": "locale"}, "is_active": {"type": "BOOL", "comment": null, "index": 13, "name": "is_active"}, "is_suspended": {"type": "BOOL", "comment": null, "index": 14, "name": "is_suspended"}, "last_login_at": {"type": "TIMESTAMP", "comment": null, "index": 15, "name": "last_login_at"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 10.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 1290.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk_source.stg_zendesk__user"}, "model.zendesk_source.stg_zendesk__organization": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "name": "stg_zendesk__organization", "comment": null, "owner": null}, "columns": {"organization_id": {"type": "INT64", "comment": null, "index": 1, "name": "organization_id"}, "created_at": {"type": "TIMESTAMP", "comment": null, "index": 2, "name": "created_at"}, "updated_at": {"type": "TIMESTAMP", "comment": null, "index": 3, "name": "updated_at"}, "details": {"type": "INT64", "comment": null, "index": 4, "name": "details"}, "name": {"type": "STRING", "comment": null, "index": 5, "name": "name"}, "external_id": {"type": "INT64", "comment": null, "index": 6, "name": "external_id"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 10.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 311.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk_source.stg_zendesk__organization"}, "model.zendesk_source.stg_zendesk__ticket_form_history": {"metadata": {"type": "table", "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "name": "stg_zendesk__ticket_form_history", "comment": null, "owner": null}, "columns": {"ticket_form_id": {"type": "INT64", "comment": null, "index": 1, "name": "ticket_form_id"}, "created_at": {"type": "DATETIME", "comment": null, "index": 2, "name": "created_at"}, "updated_at": {"type": "DATETIME", "comment": null, "index": 3, "name": "updated_at"}, "display_name": {"type": "STRING", "comment": null, "index": 4, "name": "display_name"}, "is_active": {"type": "BOOL", "comment": null, "index": 5, "name": "is_active"}, "name": {"type": "STRING", "comment": null, "index": 6, "name": "name"}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 15.0, "description": "Approximate count of rows in this table", "include": true}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 1395.0, "description": "Approximate size of table as reported by BigQuery", "include": true}, "has_stats": {"id": "has_stats", "label": "Has Stats?", "value": true, "description": "Indicates whether there are statistics for this table", "include": false}}, "unique_id": "model.zendesk_source.stg_zendesk__ticket_form_history"}}, "sources": {}, "errors": null} \ No newline at end of file +{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/catalog/v1.json", "dbt_version": "1.0.1", "generated_at": "2022-02-11T22:35:52.425997Z", "invocation_id": "98c5cc93-363f-4652-bdde-d79dc6e6d77e", "env": {}}, "nodes": {"model.zendesk.int_zendesk__ticket_reply_times_calendar": {"metadata": {"type": "table", "schema": "dbt_zendesk", "name": "int_zendesk__ticket_reply_times_calendar", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "first_reply_time_calendar_minutes": {"type": "FLOAT64", "index": 2, "name": "first_reply_time_calendar_minutes", "comment": null}, "total_reply_time_calendar_minutes": {"type": "FLOAT64", "index": 3, "name": "total_reply_time_calendar_minutes", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 50891.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 976616.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.zendesk.int_zendesk__ticket_reply_times_calendar"}, "model.zendesk.int_zendesk__ticket_first_resolution_time_business": {"metadata": {"type": "table", "schema": "dbt_zendesk", "name": "int_zendesk__ticket_first_resolution_time_business", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "first_resolution_business_minutes": {"type": "FLOAT64", "index": 2, "name": "first_resolution_business_minutes", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 30625.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 490000.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.zendesk.int_zendesk__ticket_first_resolution_time_business"}, "model.zendesk.int_zendesk__comments_enriched": {"metadata": {"type": "table", "schema": "dbt_zendesk", "name": "int_zendesk__comments_enriched", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "field_name": {"type": "STRING", "index": 2, "name": "field_name", "comment": null}, "value": {"type": "STRING", "index": 3, "name": "value", "comment": null}, "is_public": {"type": "BOOL", "index": 4, "name": "is_public", "comment": null}, "user_id": {"type": "INT64", "index": 5, "name": "user_id", "comment": null}, "valid_starting_at": {"type": "TIMESTAMP", "index": 6, "name": "valid_starting_at", "comment": null}, "valid_ending_at": {"type": "TIMESTAMP", "index": 7, "name": "valid_ending_at", "comment": null}, "ticket_created_date": {"type": "TIMESTAMP", "index": 8, "name": "ticket_created_date", "comment": null}, "commenter_role": {"type": "STRING", "index": 9, "name": "commenter_role", "comment": null}, "previous_commenter_role": {"type": "STRING", "index": 10, "name": "previous_commenter_role", "comment": null}, "last_comment_added_at": {"type": "TIMESTAMP", "index": 11, "name": "last_comment_added_at", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 550306.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 357267901.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.zendesk.int_zendesk__comments_enriched"}, "model.zendesk.int_zendesk__ticket_full_resolution_time_business": {"metadata": {"type": "table", "schema": "dbt_zendesk", "name": "int_zendesk__ticket_full_resolution_time_business", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "full_resolution_business_minutes": {"type": "FLOAT64", "index": 2, "name": "full_resolution_business_minutes", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 30625.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 490000.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.zendesk.int_zendesk__ticket_full_resolution_time_business"}, "model.zendesk.int_zendesk__ticket_resolution_times_calendar": {"metadata": {"type": "table", "schema": "dbt_zendesk", "name": "int_zendesk__ticket_resolution_times_calendar", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 2, "name": "created_at", "comment": null}, "first_solved_at": {"type": "TIMESTAMP", "index": 3, "name": "first_solved_at", "comment": null}, "last_solved_at": {"type": "TIMESTAMP", "index": 4, "name": "last_solved_at", "comment": null}, "unique_assignee_count": {"type": "INT64", "index": 5, "name": "unique_assignee_count", "comment": null}, "assignee_stations_count": {"type": "INT64", "index": 6, "name": "assignee_stations_count", "comment": null}, "group_stations_count": {"type": "INT64", "index": 7, "name": "group_stations_count", "comment": null}, "first_assignee_id": {"type": "STRING", "index": 8, "name": "first_assignee_id", "comment": null}, "last_assignee_id": {"type": "STRING", "index": 9, "name": "last_assignee_id", "comment": null}, "first_agent_assignment_date": {"type": "TIMESTAMP", "index": 10, "name": "first_agent_assignment_date", "comment": null}, "last_agent_assignment_date": {"type": "TIMESTAMP", "index": 11, "name": "last_agent_assignment_date", "comment": null}, "ticket_unassigned_duration_calendar_minutes": {"type": "FLOAT64", "index": 12, "name": "ticket_unassigned_duration_calendar_minutes", "comment": null}, "total_resolutions": {"type": "INT64", "index": 13, "name": "total_resolutions", "comment": null}, "count_reopens": {"type": "INT64", "index": 14, "name": "count_reopens", "comment": null}, "first_assignment_to_resolution_calendar_minutes": {"type": "INT64", "index": 15, "name": "first_assignment_to_resolution_calendar_minutes", "comment": null}, "last_assignment_to_resolution_calendar_minutes": {"type": "INT64", "index": 16, "name": "last_assignment_to_resolution_calendar_minutes", "comment": null}, "first_resolution_calendar_minutes": {"type": "INT64", "index": 17, "name": "first_resolution_calendar_minutes", "comment": null}, "final_resolution_calendar_minutes": {"type": "INT64", "index": 18, "name": "final_resolution_calendar_minutes", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 50891.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 6166221.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.zendesk.int_zendesk__ticket_resolution_times_calendar"}, "model.zendesk.zendesk__sla_policies": {"metadata": {"type": "table", "schema": "dbt_zendesk", "name": "zendesk__sla_policies", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"sla_event_id": {"type": "STRING", "index": 1, "name": "sla_event_id", "comment": null}, "ticket_id": {"type": "INT64", "index": 2, "name": "ticket_id", "comment": null}, "sla_policy_name": {"type": "STRING", "index": 3, "name": "sla_policy_name", "comment": null}, "metric": {"type": "STRING", "index": 4, "name": "metric", "comment": null}, "sla_applied_at": {"type": "TIMESTAMP", "index": 5, "name": "sla_applied_at", "comment": null}, "target": {"type": "INT64", "index": 6, "name": "target", "comment": null}, "in_business_hours": {"type": "BOOL", "index": 7, "name": "in_business_hours", "comment": null}, "sla_breach_at": {"type": "TIMESTAMP", "index": 8, "name": "sla_breach_at", "comment": null}, "sla_elapsed_time": {"type": "FLOAT64", "index": 9, "name": "sla_elapsed_time", "comment": null}, "is_active_sla": {"type": "BOOL", "index": 10, "name": "is_active_sla", "comment": null}, "is_sla_breach": {"type": "BOOL", "index": 11, "name": "is_sla_breach", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 38316.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 4788084.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.zendesk.zendesk__sla_policies"}, "model.zendesk.int_zendesk__ticket_reply_times": {"metadata": {"type": "table", "schema": "dbt_zendesk", "name": "int_zendesk__ticket_reply_times", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "end_user_comment_created_at": {"type": "TIMESTAMP", "index": 2, "name": "end_user_comment_created_at", "comment": null}, "is_first_comment": {"type": "BOOL", "index": 3, "name": "is_first_comment", "comment": null}, "agent_responded_at": {"type": "TIMESTAMP", "index": 4, "name": "agent_responded_at", "comment": null}, "reply_time_calendar_minutes": {"type": "FLOAT64", "index": 5, "name": "reply_time_calendar_minutes", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 122106.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 3706410.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.zendesk.int_zendesk__ticket_reply_times"}, "model.zendesk.zendesk__ticket_backlog": {"metadata": {"type": "table", "schema": "dbt_zendesk", "name": "zendesk__ticket_backlog", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"date_day": {"type": "DATE", "index": 1, "name": "date_day", "comment": null}, "ticket_id": {"type": "INT64", "index": 2, "name": "ticket_id", "comment": null}, "status": {"type": "STRING", "index": 3, "name": "status", "comment": null}, "created_channel": {"type": "STRING", "index": 4, "name": "created_channel", "comment": null}, "assignee_name": {"type": "STRING", "index": 5, "name": "assignee_name", "comment": null}, "priority": {"type": "STRING", "index": 6, "name": "priority", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 738568.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 33937402.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.zendesk.zendesk__ticket_backlog"}, "model.zendesk.zendesk__ticket_field_history": {"metadata": {"type": "table", "schema": "dbt_zendesk", "name": "zendesk__ticket_field_history", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_day_id": {"type": "STRING", "index": 1, "name": "ticket_day_id", "comment": null}, "date_day": {"type": "DATE", "index": 2, "name": "date_day", "comment": null}, "ticket_id": {"type": "INT64", "index": 3, "name": "ticket_id", "comment": null}, "status": {"type": "STRING", "index": 4, "name": "status", "comment": null}, "priority": {"type": "STRING", "index": 5, "name": "priority", "comment": null}, "assignee_id": {"type": "STRING", "index": 6, "name": "assignee_id", "comment": null}}, "stats": {"partitioning_type": {"id": "partitioning_type", "label": "Partitioned By", "value": "date_day", "include": true, "description": "The partitioning column for this table"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 2629943.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 203627480.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.zendesk.zendesk__ticket_field_history"}, "model.zendesk.zendesk__ticket_metrics": {"metadata": {"type": "table", "schema": "dbt_zendesk", "name": "zendesk__ticket_metrics", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 2, "name": "_fivetran_synced", "comment": null}, "assignee_id": {"type": "INT64", "index": 3, "name": "assignee_id", "comment": null}, "brand_id": {"type": "INT64", "index": 4, "name": "brand_id", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 5, "name": "created_at", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 6, "name": "updated_at", "comment": null}, "description": {"type": "STRING", "index": 7, "name": "description", "comment": null}, "due_at": {"type": "TIMESTAMP", "index": 8, "name": "due_at", "comment": null}, "group_id": {"type": "INT64", "index": 9, "name": "group_id", "comment": null}, "external_id": {"type": "STRING", "index": 10, "name": "external_id", "comment": null}, "is_public": {"type": "BOOL", "index": 11, "name": "is_public", "comment": null}, "organization_id": {"type": "INT64", "index": 12, "name": "organization_id", "comment": null}, "priority": {"type": "STRING", "index": 13, "name": "priority", "comment": null}, "recipient": {"type": "STRING", "index": 14, "name": "recipient", "comment": null}, "requester_id": {"type": "INT64", "index": 15, "name": "requester_id", "comment": null}, "status": {"type": "STRING", "index": 16, "name": "status", "comment": null}, "subject": {"type": "STRING", "index": 17, "name": "subject", "comment": null}, "problem_id": {"type": "INT64", "index": 18, "name": "problem_id", "comment": null}, "submitter_id": {"type": "INT64", "index": 19, "name": "submitter_id", "comment": null}, "ticket_form_id": {"type": "INT64", "index": 20, "name": "ticket_form_id", "comment": null}, "type": {"type": "STRING", "index": 21, "name": "type", "comment": null}, "url": {"type": "STRING", "index": 22, "name": "url", "comment": null}, "created_channel": {"type": "STRING", "index": 23, "name": "created_channel", "comment": null}, "source_from_id": {"type": "INT64", "index": 24, "name": "source_from_id", "comment": null}, "source_from_title": {"type": "STRING", "index": 25, "name": "source_from_title", "comment": null}, "source_rel": {"type": "STRING", "index": 26, "name": "source_rel", "comment": null}, "source_to_address": {"type": "STRING", "index": 27, "name": "source_to_address", "comment": null}, "source_to_name": {"type": "STRING", "index": 28, "name": "source_to_name", "comment": null}, "is_incident": {"type": "BOOL", "index": 29, "name": "is_incident", "comment": null}, "ticket_brand_name": {"type": "STRING", "index": 30, "name": "ticket_brand_name", "comment": null}, "ticket_tags": {"type": "STRING", "index": 31, "name": "ticket_tags", "comment": null}, "ticket_form_name": {"type": "STRING", "index": 32, "name": "ticket_form_name", "comment": null}, "ticket_total_satisfaction_scores": {"type": "INT64", "index": 33, "name": "ticket_total_satisfaction_scores", "comment": null}, "ticket_first_satisfaction_score": {"type": "STRING", "index": 34, "name": "ticket_first_satisfaction_score", "comment": null}, "ticket_satisfaction_score": {"type": "STRING", "index": 35, "name": "ticket_satisfaction_score", "comment": null}, "ticket_satisfaction_comment": {"type": "STRING", "index": 36, "name": "ticket_satisfaction_comment", "comment": null}, "ticket_satisfaction_reason": {"type": "STRING", "index": 37, "name": "ticket_satisfaction_reason", "comment": null}, "is_good_to_bad_satisfaction_score": {"type": "BOOL", "index": 38, "name": "is_good_to_bad_satisfaction_score", "comment": null}, "is_bad_to_good_satisfaction_score": {"type": "BOOL", "index": 39, "name": "is_bad_to_good_satisfaction_score", "comment": null}, "ticket_organization_domain_names": {"type": "STRING", "index": 40, "name": "ticket_organization_domain_names", "comment": null}, "requester_organization_domain_names": {"type": "STRING", "index": 41, "name": "requester_organization_domain_names", "comment": null}, "requester_external_id": {"type": "STRING", "index": 42, "name": "requester_external_id", "comment": null}, "requester_created_at": {"type": "TIMESTAMP", "index": 43, "name": "requester_created_at", "comment": null}, "requester_updated_at": {"type": "TIMESTAMP", "index": 44, "name": "requester_updated_at", "comment": null}, "requester_role": {"type": "STRING", "index": 45, "name": "requester_role", "comment": null}, "requester_email": {"type": "STRING", "index": 46, "name": "requester_email", "comment": null}, "requester_name": {"type": "STRING", "index": 47, "name": "requester_name", "comment": null}, "is_requester_active": {"type": "BOOL", "index": 48, "name": "is_requester_active", "comment": null}, "requester_locale": {"type": "STRING", "index": 49, "name": "requester_locale", "comment": null}, "requester_time_zone": {"type": "STRING", "index": 50, "name": "requester_time_zone", "comment": null}, "requester_ticket_update_count": {"type": "INT64", "index": 51, "name": "requester_ticket_update_count", "comment": null}, "requester_ticket_last_update_at": {"type": "TIMESTAMP", "index": 52, "name": "requester_ticket_last_update_at", "comment": null}, "requester_last_login_at": {"type": "TIMESTAMP", "index": 53, "name": "requester_last_login_at", "comment": null}, "requester_organization_id": {"type": "INT64", "index": 54, "name": "requester_organization_id", "comment": null}, "requester_organization_name": {"type": "STRING", "index": 55, "name": "requester_organization_name", "comment": null}, "requester_organization_tags": {"type": "STRING", "index": 56, "name": "requester_organization_tags", "comment": null}, "requester_organization_external_id": {"type": "STRING", "index": 57, "name": "requester_organization_external_id", "comment": null}, "requester_organization_created_at": {"type": "TIMESTAMP", "index": 58, "name": "requester_organization_created_at", "comment": null}, "requester_organization_updated_at": {"type": "TIMESTAMP", "index": 59, "name": "requester_organization_updated_at", "comment": null}, "submitter_external_id": {"type": "STRING", "index": 60, "name": "submitter_external_id", "comment": null}, "submitter_role": {"type": "STRING", "index": 61, "name": "submitter_role", "comment": null}, "is_agent_submitted": {"type": "BOOL", "index": 62, "name": "is_agent_submitted", "comment": null}, "submitter_email": {"type": "STRING", "index": 63, "name": "submitter_email", "comment": null}, "submitter_name": {"type": "STRING", "index": 64, "name": "submitter_name", "comment": null}, "is_submitter_active": {"type": "BOOL", "index": 65, "name": "is_submitter_active", "comment": null}, "submitter_locale": {"type": "STRING", "index": 66, "name": "submitter_locale", "comment": null}, "submitter_time_zone": {"type": "STRING", "index": 67, "name": "submitter_time_zone", "comment": null}, "assignee_external_id": {"type": "STRING", "index": 68, "name": "assignee_external_id", "comment": null}, "assignee_role": {"type": "STRING", "index": 69, "name": "assignee_role", "comment": null}, "assignee_email": {"type": "STRING", "index": 70, "name": "assignee_email", "comment": null}, "assignee_name": {"type": "STRING", "index": 71, "name": "assignee_name", "comment": null}, "is_assignee_active": {"type": "BOOL", "index": 72, "name": "is_assignee_active", "comment": null}, "assignee_locale": {"type": "STRING", "index": 73, "name": "assignee_locale", "comment": null}, "assignee_time_zone": {"type": "STRING", "index": 74, "name": "assignee_time_zone", "comment": null}, "assignee_ticket_update_count": {"type": "INT64", "index": 75, "name": "assignee_ticket_update_count", "comment": null}, "assignee_ticket_last_update_at": {"type": "TIMESTAMP", "index": 76, "name": "assignee_ticket_last_update_at", "comment": null}, "assignee_last_login_at": {"type": "TIMESTAMP", "index": 77, "name": "assignee_last_login_at", "comment": null}, "group_name": {"type": "STRING", "index": 78, "name": "group_name", "comment": null}, "organization_name": {"type": "STRING", "index": 79, "name": "organization_name", "comment": null}, "requester_tag": {"type": "STRING", "index": 80, "name": "requester_tag", "comment": null}, "submitter_tag": {"type": "STRING", "index": 81, "name": "submitter_tag", "comment": null}, "assignee_tag": {"type": "STRING", "index": 82, "name": "assignee_tag", "comment": null}, "first_reply_time_calendar_minutes": {"type": "FLOAT64", "index": 83, "name": "first_reply_time_calendar_minutes", "comment": null}, "total_reply_time_calendar_minutes": {"type": "FLOAT64", "index": 84, "name": "total_reply_time_calendar_minutes", "comment": null}, "count_agent_comments": {"type": "INT64", "index": 85, "name": "count_agent_comments", "comment": null}, "count_public_agent_comments": {"type": "INT64", "index": 86, "name": "count_public_agent_comments", "comment": null}, "count_end_user_comments": {"type": "INT64", "index": 87, "name": "count_end_user_comments", "comment": null}, "count_public_comments": {"type": "INT64", "index": 88, "name": "count_public_comments", "comment": null}, "count_internal_comments": {"type": "INT64", "index": 89, "name": "count_internal_comments", "comment": null}, "total_comments": {"type": "INT64", "index": 90, "name": "total_comments", "comment": null}, "count_ticket_handoffs": {"type": "INT64", "index": 91, "name": "count_ticket_handoffs", "comment": null}, "ticket_last_comment_date": {"type": "TIMESTAMP", "index": 92, "name": "ticket_last_comment_date", "comment": null}, "unique_assignee_count": {"type": "INT64", "index": 93, "name": "unique_assignee_count", "comment": null}, "assignee_stations_count": {"type": "INT64", "index": 94, "name": "assignee_stations_count", "comment": null}, "group_stations_count": {"type": "INT64", "index": 95, "name": "group_stations_count", "comment": null}, "first_assignee_id": {"type": "STRING", "index": 96, "name": "first_assignee_id", "comment": null}, "last_assignee_id": {"type": "STRING", "index": 97, "name": "last_assignee_id", "comment": null}, "first_agent_assignment_date": {"type": "TIMESTAMP", "index": 98, "name": "first_agent_assignment_date", "comment": null}, "last_agent_assignment_date": {"type": "TIMESTAMP", "index": 99, "name": "last_agent_assignment_date", "comment": null}, "first_solved_at": {"type": "TIMESTAMP", "index": 100, "name": "first_solved_at", "comment": null}, "last_solved_at": {"type": "TIMESTAMP", "index": 101, "name": "last_solved_at", "comment": null}, "first_assignment_to_resolution_calendar_minutes": {"type": "INT64", "index": 102, "name": "first_assignment_to_resolution_calendar_minutes", "comment": null}, "last_assignment_to_resolution_calendar_minutes": {"type": "INT64", "index": 103, "name": "last_assignment_to_resolution_calendar_minutes", "comment": null}, "ticket_unassigned_duration_calendar_minutes": {"type": "FLOAT64", "index": 104, "name": "ticket_unassigned_duration_calendar_minutes", "comment": null}, "first_resolution_calendar_minutes": {"type": "INT64", "index": 105, "name": "first_resolution_calendar_minutes", "comment": null}, "final_resolution_calendar_minutes": {"type": "INT64", "index": 106, "name": "final_resolution_calendar_minutes", "comment": null}, "count_resolutions": {"type": "INT64", "index": 107, "name": "count_resolutions", "comment": null}, "count_reopens": {"type": "INT64", "index": 108, "name": "count_reopens", "comment": null}, "ticket_deleted_count": {"type": "INT64", "index": 109, "name": "ticket_deleted_count", "comment": null}, "total_ticket_recoveries": {"type": "INT64", "index": 110, "name": "total_ticket_recoveries", "comment": null}, "last_status_assignment_date": {"type": "TIMESTAMP", "index": 111, "name": "last_status_assignment_date", "comment": null}, "new_status_duration_in_calendar_minutes": {"type": "INT64", "index": 112, "name": "new_status_duration_in_calendar_minutes", "comment": null}, "open_status_duration_in_calendar_minutes": {"type": "INT64", "index": 113, "name": "open_status_duration_in_calendar_minutes", "comment": null}, "agent_wait_time_in_calendar_minutes": {"type": "INT64", "index": 114, "name": "agent_wait_time_in_calendar_minutes", "comment": null}, "requester_wait_time_in_calendar_minutes": {"type": "INT64", "index": 115, "name": "requester_wait_time_in_calendar_minutes", "comment": null}, "agent_work_time_in_calendar_minutes": {"type": "INT64", "index": 116, "name": "agent_work_time_in_calendar_minutes", "comment": null}, "on_hold_time_in_calendar_minutes": {"type": "INT64", "index": 117, "name": "on_hold_time_in_calendar_minutes", "comment": null}, "total_agent_replies": {"type": "INT64", "index": 118, "name": "total_agent_replies", "comment": null}, "requester_last_login_age_minutes": {"type": "FLOAT64", "index": 119, "name": "requester_last_login_age_minutes", "comment": null}, "assignee_last_login_age_minutes": {"type": "FLOAT64", "index": 120, "name": "assignee_last_login_age_minutes", "comment": null}, "unsolved_ticket_age_minutes": {"type": "FLOAT64", "index": 121, "name": "unsolved_ticket_age_minutes", "comment": null}, "unsolved_ticket_age_since_update_minutes": {"type": "FLOAT64", "index": 122, "name": "unsolved_ticket_age_since_update_minutes", "comment": null}, "is_one_touch_resolution": {"type": "BOOL", "index": 123, "name": "is_one_touch_resolution", "comment": null}, "is_two_touch_resolution": {"type": "BOOL", "index": 124, "name": "is_two_touch_resolution", "comment": null}, "is_multi_touch_resolution": {"type": "BOOL", "index": 125, "name": "is_multi_touch_resolution", "comment": null}, "first_resolution_business_minutes": {"type": "FLOAT64", "index": 126, "name": "first_resolution_business_minutes", "comment": null}, "full_resolution_business_minutes": {"type": "FLOAT64", "index": 127, "name": "full_resolution_business_minutes", "comment": null}, "first_reply_time_business_minutes": {"type": "FLOAT64", "index": 128, "name": "first_reply_time_business_minutes", "comment": null}, "agent_wait_time_in_business_minutes": {"type": "FLOAT64", "index": 129, "name": "agent_wait_time_in_business_minutes", "comment": null}, "requester_wait_time_in_business_minutes": {"type": "FLOAT64", "index": 130, "name": "requester_wait_time_in_business_minutes", "comment": null}, "agent_work_time_in_business_minutes": {"type": "FLOAT64", "index": 131, "name": "agent_work_time_in_business_minutes", "comment": null}, "on_hold_time_in_business_minutes": {"type": "FLOAT64", "index": 132, "name": "on_hold_time_in_business_minutes", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 50892.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 85418525.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.zendesk.zendesk__ticket_metrics"}, "model.zendesk.int_zendesk__ticket_first_reply_time_business": {"metadata": {"type": "table", "schema": "dbt_zendesk", "name": "int_zendesk__ticket_first_reply_time_business", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "first_reply_time_business_minutes": {"type": "FLOAT64", "index": 2, "name": "first_reply_time_business_minutes", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 35593.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 569488.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.zendesk.int_zendesk__ticket_first_reply_time_business"}, "model.zendesk.int_zendesk__ticket_work_time_business": {"metadata": {"type": "table", "schema": "dbt_zendesk", "name": "int_zendesk__ticket_work_time_business", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "agent_wait_time_in_business_minutes": {"type": "FLOAT64", "index": 2, "name": "agent_wait_time_in_business_minutes", "comment": null}, "requester_wait_time_in_business_minutes": {"type": "FLOAT64", "index": 3, "name": "requester_wait_time_in_business_minutes", "comment": null}, "agent_work_time_in_business_minutes": {"type": "FLOAT64", "index": 4, "name": "agent_work_time_in_business_minutes", "comment": null}, "on_hold_time_in_business_minutes": {"type": "FLOAT64", "index": 5, "name": "on_hold_time_in_business_minutes", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 48188.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 1927520.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.zendesk.int_zendesk__ticket_work_time_business"}, "model.zendesk.int_zendesk__ticket_work_time_calendar": {"metadata": {"type": "table", "schema": "dbt_zendesk", "name": "int_zendesk__ticket_work_time_calendar", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "last_status_assignment_date": {"type": "TIMESTAMP", "index": 2, "name": "last_status_assignment_date", "comment": null}, "ticket_deleted_count": {"type": "INT64", "index": 3, "name": "ticket_deleted_count", "comment": null}, "agent_wait_time_in_calendar_minutes": {"type": "INT64", "index": 4, "name": "agent_wait_time_in_calendar_minutes", "comment": null}, "requester_wait_time_in_calendar_minutes": {"type": "INT64", "index": 5, "name": "requester_wait_time_in_calendar_minutes", "comment": null}, "agent_work_time_in_calendar_minutes": {"type": "INT64", "index": 6, "name": "agent_work_time_in_calendar_minutes", "comment": null}, "on_hold_time_in_calendar_minutes": {"type": "INT64", "index": 7, "name": "on_hold_time_in_calendar_minutes", "comment": null}, "new_status_duration_in_calendar_minutes": {"type": "INT64", "index": 8, "name": "new_status_duration_in_calendar_minutes", "comment": null}, "open_status_duration_in_calendar_minutes": {"type": "INT64", "index": 9, "name": "open_status_duration_in_calendar_minutes", "comment": null}, "total_ticket_recoveries": {"type": "INT64", "index": 10, "name": "total_ticket_recoveries", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 50890.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 4071200.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.zendesk.int_zendesk__ticket_work_time_calendar"}, "model.zendesk.zendesk__ticket_summary": {"metadata": {"type": "table", "schema": "dbt_zendesk", "name": "zendesk__ticket_summary", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"user_count": {"type": "INT64", "index": 1, "name": "user_count", "comment": null}, "active_agent_count": {"type": "INT64", "index": 2, "name": "active_agent_count", "comment": null}, "deleted_user_count": {"type": "INT64", "index": 3, "name": "deleted_user_count", "comment": null}, "end_user_count": {"type": "INT64", "index": 4, "name": "end_user_count", "comment": null}, "suspended_user_count": {"type": "INT64", "index": 5, "name": "suspended_user_count", "comment": null}, "new_ticket_count": {"type": "INT64", "index": 6, "name": "new_ticket_count", "comment": null}, "on_hold_ticket_count": {"type": "INT64", "index": 7, "name": "on_hold_ticket_count", "comment": null}, "open_ticket_count": {"type": "INT64", "index": 8, "name": "open_ticket_count", "comment": null}, "pending_ticket_count": {"type": "INT64", "index": 9, "name": "pending_ticket_count", "comment": null}, "solved_ticket_count": {"type": "INT64", "index": 10, "name": "solved_ticket_count", "comment": null}, "problem_ticket_count": {"type": "INT64", "index": 11, "name": "problem_ticket_count", "comment": null}, "assigned_ticket_count": {"type": "INT64", "index": 12, "name": "assigned_ticket_count", "comment": null}, "reassigned_ticket_count": {"type": "INT64", "index": 13, "name": "reassigned_ticket_count", "comment": null}, "reopened_ticket_count": {"type": "INT64", "index": 14, "name": "reopened_ticket_count", "comment": null}, "surveyed_satisfaction_ticket_count": {"type": "INT64", "index": 15, "name": "surveyed_satisfaction_ticket_count", "comment": null}, "unassigned_unsolved_ticket_count": {"type": "INT64", "index": 16, "name": "unassigned_unsolved_ticket_count", "comment": null}, "unreplied_ticket_count": {"type": "INT64", "index": 17, "name": "unreplied_ticket_count", "comment": null}, "unreplied_unsolved_ticket_count": {"type": "INT64", "index": 18, "name": "unreplied_unsolved_ticket_count", "comment": null}, "unsolved_ticket_count": {"type": "INT64", "index": 19, "name": "unsolved_ticket_count", "comment": null}, "recovered_ticket_count": {"type": "INT64", "index": 20, "name": "recovered_ticket_count", "comment": null}, "deleted_ticket_count": {"type": "INT64", "index": 21, "name": "deleted_ticket_count", "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": 168.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.zendesk.zendesk__ticket_summary"}, "model.zendesk.zendesk__ticket_enriched": {"metadata": {"type": "table", "schema": "dbt_zendesk", "name": "zendesk__ticket_enriched", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 2, "name": "_fivetran_synced", "comment": null}, "assignee_id": {"type": "INT64", "index": 3, "name": "assignee_id", "comment": null}, "brand_id": {"type": "INT64", "index": 4, "name": "brand_id", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 5, "name": "created_at", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 6, "name": "updated_at", "comment": null}, "description": {"type": "STRING", "index": 7, "name": "description", "comment": null}, "due_at": {"type": "TIMESTAMP", "index": 8, "name": "due_at", "comment": null}, "group_id": {"type": "INT64", "index": 9, "name": "group_id", "comment": null}, "external_id": {"type": "STRING", "index": 10, "name": "external_id", "comment": null}, "is_public": {"type": "BOOL", "index": 11, "name": "is_public", "comment": null}, "organization_id": {"type": "INT64", "index": 12, "name": "organization_id", "comment": null}, "priority": {"type": "STRING", "index": 13, "name": "priority", "comment": null}, "recipient": {"type": "STRING", "index": 14, "name": "recipient", "comment": null}, "requester_id": {"type": "INT64", "index": 15, "name": "requester_id", "comment": null}, "status": {"type": "STRING", "index": 16, "name": "status", "comment": null}, "subject": {"type": "STRING", "index": 17, "name": "subject", "comment": null}, "problem_id": {"type": "INT64", "index": 18, "name": "problem_id", "comment": null}, "submitter_id": {"type": "INT64", "index": 19, "name": "submitter_id", "comment": null}, "ticket_form_id": {"type": "INT64", "index": 20, "name": "ticket_form_id", "comment": null}, "type": {"type": "STRING", "index": 21, "name": "type", "comment": null}, "url": {"type": "STRING", "index": 22, "name": "url", "comment": null}, "created_channel": {"type": "STRING", "index": 23, "name": "created_channel", "comment": null}, "source_from_id": {"type": "INT64", "index": 24, "name": "source_from_id", "comment": null}, "source_from_title": {"type": "STRING", "index": 25, "name": "source_from_title", "comment": null}, "source_rel": {"type": "STRING", "index": 26, "name": "source_rel", "comment": null}, "source_to_address": {"type": "STRING", "index": 27, "name": "source_to_address", "comment": null}, "source_to_name": {"type": "STRING", "index": 28, "name": "source_to_name", "comment": null}, "is_incident": {"type": "BOOL", "index": 29, "name": "is_incident", "comment": null}, "ticket_brand_name": {"type": "STRING", "index": 30, "name": "ticket_brand_name", "comment": null}, "ticket_tags": {"type": "STRING", "index": 31, "name": "ticket_tags", "comment": null}, "ticket_form_name": {"type": "STRING", "index": 32, "name": "ticket_form_name", "comment": null}, "ticket_total_satisfaction_scores": {"type": "INT64", "index": 33, "name": "ticket_total_satisfaction_scores", "comment": null}, "ticket_first_satisfaction_score": {"type": "STRING", "index": 34, "name": "ticket_first_satisfaction_score", "comment": null}, "ticket_satisfaction_score": {"type": "STRING", "index": 35, "name": "ticket_satisfaction_score", "comment": null}, "ticket_satisfaction_comment": {"type": "STRING", "index": 36, "name": "ticket_satisfaction_comment", "comment": null}, "ticket_satisfaction_reason": {"type": "STRING", "index": 37, "name": "ticket_satisfaction_reason", "comment": null}, "is_good_to_bad_satisfaction_score": {"type": "BOOL", "index": 38, "name": "is_good_to_bad_satisfaction_score", "comment": null}, "is_bad_to_good_satisfaction_score": {"type": "BOOL", "index": 39, "name": "is_bad_to_good_satisfaction_score", "comment": null}, "ticket_organization_domain_names": {"type": "STRING", "index": 40, "name": "ticket_organization_domain_names", "comment": null}, "requester_organization_domain_names": {"type": "STRING", "index": 41, "name": "requester_organization_domain_names", "comment": null}, "requester_external_id": {"type": "STRING", "index": 42, "name": "requester_external_id", "comment": null}, "requester_created_at": {"type": "TIMESTAMP", "index": 43, "name": "requester_created_at", "comment": null}, "requester_updated_at": {"type": "TIMESTAMP", "index": 44, "name": "requester_updated_at", "comment": null}, "requester_role": {"type": "STRING", "index": 45, "name": "requester_role", "comment": null}, "requester_email": {"type": "STRING", "index": 46, "name": "requester_email", "comment": null}, "requester_name": {"type": "STRING", "index": 47, "name": "requester_name", "comment": null}, "is_requester_active": {"type": "BOOL", "index": 48, "name": "is_requester_active", "comment": null}, "requester_locale": {"type": "STRING", "index": 49, "name": "requester_locale", "comment": null}, "requester_time_zone": {"type": "STRING", "index": 50, "name": "requester_time_zone", "comment": null}, "requester_ticket_update_count": {"type": "INT64", "index": 51, "name": "requester_ticket_update_count", "comment": null}, "requester_ticket_last_update_at": {"type": "TIMESTAMP", "index": 52, "name": "requester_ticket_last_update_at", "comment": null}, "requester_last_login_at": {"type": "TIMESTAMP", "index": 53, "name": "requester_last_login_at", "comment": null}, "requester_organization_id": {"type": "INT64", "index": 54, "name": "requester_organization_id", "comment": null}, "requester_organization_name": {"type": "STRING", "index": 55, "name": "requester_organization_name", "comment": null}, "requester_organization_tags": {"type": "STRING", "index": 56, "name": "requester_organization_tags", "comment": null}, "requester_organization_external_id": {"type": "STRING", "index": 57, "name": "requester_organization_external_id", "comment": null}, "requester_organization_created_at": {"type": "TIMESTAMP", "index": 58, "name": "requester_organization_created_at", "comment": null}, "requester_organization_updated_at": {"type": "TIMESTAMP", "index": 59, "name": "requester_organization_updated_at", "comment": null}, "submitter_external_id": {"type": "STRING", "index": 60, "name": "submitter_external_id", "comment": null}, "submitter_role": {"type": "STRING", "index": 61, "name": "submitter_role", "comment": null}, "is_agent_submitted": {"type": "BOOL", "index": 62, "name": "is_agent_submitted", "comment": null}, "submitter_email": {"type": "STRING", "index": 63, "name": "submitter_email", "comment": null}, "submitter_name": {"type": "STRING", "index": 64, "name": "submitter_name", "comment": null}, "is_submitter_active": {"type": "BOOL", "index": 65, "name": "is_submitter_active", "comment": null}, "submitter_locale": {"type": "STRING", "index": 66, "name": "submitter_locale", "comment": null}, "submitter_time_zone": {"type": "STRING", "index": 67, "name": "submitter_time_zone", "comment": null}, "assignee_external_id": {"type": "STRING", "index": 68, "name": "assignee_external_id", "comment": null}, "assignee_role": {"type": "STRING", "index": 69, "name": "assignee_role", "comment": null}, "assignee_email": {"type": "STRING", "index": 70, "name": "assignee_email", "comment": null}, "assignee_name": {"type": "STRING", "index": 71, "name": "assignee_name", "comment": null}, "is_assignee_active": {"type": "BOOL", "index": 72, "name": "is_assignee_active", "comment": null}, "assignee_locale": {"type": "STRING", "index": 73, "name": "assignee_locale", "comment": null}, "assignee_time_zone": {"type": "STRING", "index": 74, "name": "assignee_time_zone", "comment": null}, "assignee_ticket_update_count": {"type": "INT64", "index": 75, "name": "assignee_ticket_update_count", "comment": null}, "assignee_ticket_last_update_at": {"type": "TIMESTAMP", "index": 76, "name": "assignee_ticket_last_update_at", "comment": null}, "assignee_last_login_at": {"type": "TIMESTAMP", "index": 77, "name": "assignee_last_login_at", "comment": null}, "group_name": {"type": "STRING", "index": 78, "name": "group_name", "comment": null}, "organization_name": {"type": "STRING", "index": 79, "name": "organization_name", "comment": null}, "requester_tag": {"type": "STRING", "index": 80, "name": "requester_tag", "comment": null}, "submitter_tag": {"type": "STRING", "index": 81, "name": "submitter_tag", "comment": null}, "assignee_tag": {"type": "STRING", "index": 82, "name": "assignee_tag", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 50892.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 68956370.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.zendesk.zendesk__ticket_enriched"}, "model.zendesk.int_zendesk__reply_time_combined": {"metadata": {"type": "table", "schema": "dbt_zendesk_intermediate", "name": "int_zendesk__reply_time_combined", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "sla_policy_name": {"type": "STRING", "index": 2, "name": "sla_policy_name", "comment": null}, "metric": {"type": "STRING", "index": 3, "name": "metric", "comment": null}, "sla_applied_at": {"type": "TIMESTAMP", "index": 4, "name": "sla_applied_at", "comment": null}, "target": {"type": "INT64", "index": 5, "name": "target", "comment": null}, "in_business_hours": {"type": "BOOL", "index": 6, "name": "in_business_hours", "comment": null}, "sla_breach_at": {"type": "TIMESTAMP", "index": 7, "name": "sla_breach_at", "comment": null}, "agent_reply_at": {"type": "TIMESTAMP", "index": 8, "name": "agent_reply_at", "comment": null}, "next_solved_at": {"type": "TIMESTAMP", "index": 9, "name": "next_solved_at", "comment": null}, "updated_sla_policy_starts_at": {"type": "TIMESTAMP", "index": 10, "name": "updated_sla_policy_starts_at", "comment": null}, "is_stale_sla_policy": {"type": "BOOL", "index": 11, "name": "is_stale_sla_policy", "comment": null}, "is_sla_breached": {"type": "BOOL", "index": 12, "name": "is_sla_breached", "comment": null}, "sla_elapsed_time": {"type": "INT64", "index": 13, "name": "sla_elapsed_time", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 38316.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 4148164.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.zendesk.int_zendesk__reply_time_combined"}, "model.zendesk.int_zendesk__field_history_pivot": {"metadata": {"type": "table", "schema": "dbt_zendesk_intermediate", "name": "int_zendesk__field_history_pivot", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "date_day": {"type": "DATE", "index": 2, "name": "date_day", "comment": null}, "status": {"type": "STRING", "index": 3, "name": "status", "comment": null}, "priority": {"type": "STRING", "index": 4, "name": "priority", "comment": null}, "assignee_id": {"type": "STRING", "index": 5, "name": "assignee_id", "comment": null}, "ticket_day_id": {"type": "STRING", "index": 6, "name": "ticket_day_id", "comment": null}}, "stats": {"partitioning_type": {"id": "partitioning_type", "label": "Partitioned By", "value": "date_day", "include": true, "description": "The partitioning column for this table"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 239418.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 14715603.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.zendesk.int_zendesk__field_history_pivot"}, "model.zendesk.int_zendesk__ticket_historical_assignee": {"metadata": {"type": "table", "schema": "dbt_zendesk_intermediate", "name": "int_zendesk__ticket_historical_assignee", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "first_agent_assignment_date": {"type": "TIMESTAMP", "index": 2, "name": "first_agent_assignment_date", "comment": null}, "first_assignee_id": {"type": "STRING", "index": 3, "name": "first_assignee_id", "comment": null}, "last_agent_assignment_date": {"type": "TIMESTAMP", "index": 4, "name": "last_agent_assignment_date", "comment": null}, "last_assignee_id": {"type": "STRING", "index": 5, "name": "last_assignee_id", "comment": null}, "assignee_stations_count": {"type": "INT64", "index": 6, "name": "assignee_stations_count", "comment": null}, "unique_assignee_count": {"type": "INT64", "index": 7, "name": "unique_assignee_count", "comment": null}, "ticket_unassigned_duration_calendar_minutes": {"type": "FLOAT64", "index": 8, "name": "ticket_unassigned_duration_calendar_minutes", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 43796.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 3341047.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.zendesk.int_zendesk__ticket_historical_assignee"}, "model.zendesk.int_zendesk__schedule_spine": {"metadata": {"type": "table", "schema": "dbt_zendesk_intermediate", "name": "int_zendesk__schedule_spine", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"schedule_id": {"type": "STRING", "index": 1, "name": "schedule_id", "comment": null}, "time_zone": {"type": "STRING", "index": 2, "name": "time_zone", "comment": null}, "start_time": {"type": "INT64", "index": 3, "name": "start_time", "comment": null}, "end_time": {"type": "INT64", "index": 4, "name": "end_time", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 5, "name": "created_at", "comment": null}, "schedule_name": {"type": "STRING", "index": 6, "name": "schedule_name", "comment": null}, "start_time_utc": {"type": "INT64", "index": 7, "name": "start_time_utc", "comment": null}, "end_time_utc": {"type": "INT64", "index": 8, "name": "end_time_utc", "comment": null}, "valid_from": {"type": "DATETIME", "index": 9, "name": "valid_from", "comment": null}, "valid_until": {"type": "DATETIME", "index": 10, "name": "valid_until", "comment": null}, "unqiue_schedule_spine_key": {"type": "STRING", "index": 11, "name": "unqiue_schedule_spine_key", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 7.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 882.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.zendesk.int_zendesk__schedule_spine"}, "model.zendesk.int_zendesk__assignee_updates": {"metadata": {"type": "table", "schema": "dbt_zendesk_intermediate", "name": "int_zendesk__assignee_updates", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "assignee_id": {"type": "INT64", "index": 2, "name": "assignee_id", "comment": null}, "last_updated": {"type": "TIMESTAMP", "index": 3, "name": "last_updated", "comment": null}, "total_updates": {"type": "INT64", "index": 4, "name": "total_updates", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 50892.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 1507832.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.zendesk.int_zendesk__assignee_updates"}, "model.zendesk.int_zendesk__ticket_schedules": {"metadata": {"type": "table", "schema": "dbt_zendesk_intermediate", "name": "int_zendesk__ticket_schedules", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "schedule_id": {"type": "STRING", "index": 2, "name": "schedule_id", "comment": null}, "schedule_created_at": {"type": "TIMESTAMP", "index": 3, "name": "schedule_created_at", "comment": null}, "schedule_invalidated_at": {"type": "TIMESTAMP", "index": 4, "name": "schedule_invalidated_at", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 50893.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 1984796.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.zendesk.int_zendesk__ticket_schedules"}, "model.zendesk.int_zendesk__updates": {"metadata": {"type": "table", "schema": "dbt_zendesk_intermediate", "name": "int_zendesk__updates", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "field_name": {"type": "STRING", "index": 2, "name": "field_name", "comment": null}, "value": {"type": "STRING", "index": 3, "name": "value", "comment": null}, "is_public": {"type": "BOOL", "index": 4, "name": "is_public", "comment": null}, "user_id": {"type": "INT64", "index": 5, "name": "user_id", "comment": null}, "valid_starting_at": {"type": "TIMESTAMP", "index": 6, "name": "valid_starting_at", "comment": null}, "valid_ending_at": {"type": "TIMESTAMP", "index": 7, "name": "valid_ending_at", "comment": null}, "ticket_created_date": {"type": "TIMESTAMP", "index": 8, "name": "ticket_created_date", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 2104332.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 452709634.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.zendesk.int_zendesk__updates"}, "model.zendesk.int_zendesk__requester_wait_time_business_hours": {"metadata": {"type": "table", "schema": "dbt_zendesk_intermediate", "name": "int_zendesk__requester_wait_time_business_hours", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "sla_applied_at": {"type": "TIMESTAMP", "index": 2, "name": "sla_applied_at", "comment": null}, "target": {"type": "INT64", "index": 3, "name": "target", "comment": null}, "sla_policy_name": {"type": "STRING", "index": 4, "name": "sla_policy_name", "comment": null}, "valid_starting_at": {"type": "TIMESTAMP", "index": 5, "name": "valid_starting_at", "comment": null}, "valid_ending_at": {"type": "TIMESTAMP", "index": 6, "name": "valid_ending_at", "comment": null}, "week_number": {"type": "FLOAT64", "index": 7, "name": "week_number", "comment": null}, "ticket_week_start_time_minute": {"type": "FLOAT64", "index": 8, "name": "ticket_week_start_time_minute", "comment": null}, "ticket_week_end_time_minute": {"type": "FLOAT64", "index": 9, "name": "ticket_week_end_time_minute", "comment": null}, "schedule_start_time": {"type": "INT64", "index": 10, "name": "schedule_start_time", "comment": null}, "schedule_end_time": {"type": "INT64", "index": 11, "name": "schedule_end_time", "comment": null}, "scheduled_minutes": {"type": "FLOAT64", "index": 12, "name": "scheduled_minutes", "comment": null}, "running_total_scheduled_minutes": {"type": "FLOAT64", "index": 13, "name": "running_total_scheduled_minutes", "comment": null}, "remaining_target_minutes": {"type": "FLOAT64", "index": 14, "name": "remaining_target_minutes", "comment": null}, "lag_check": {"type": "FLOAT64", "index": 15, "name": "lag_check", "comment": null}, "is_breached_during_schedule": {"type": "BOOL", "index": 16, "name": "is_breached_during_schedule", "comment": null}, "breach_minutes": {"type": "FLOAT64", "index": 17, "name": "breach_minutes", "comment": null}, "breach_minutes_from_week": {"type": "FLOAT64", "index": 18, "name": "breach_minutes_from_week", "comment": null}, "sla_breach_at": {"type": "TIMESTAMP", "index": 19, "name": "sla_breach_at", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 0.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 0.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.zendesk.int_zendesk__requester_wait_time_business_hours"}, "model.zendesk.int_zendesk__requester_wait_time_calendar_hours": {"metadata": {"type": "table", "schema": "dbt_zendesk_intermediate", "name": "int_zendesk__requester_wait_time_calendar_hours", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "valid_starting_at": {"type": "TIMESTAMP", "index": 2, "name": "valid_starting_at", "comment": null}, "valid_ending_at": {"type": "TIMESTAMP", "index": 3, "name": "valid_ending_at", "comment": null}, "ticket_status": {"type": "STRING", "index": 4, "name": "ticket_status", "comment": null}, "sla_applied_at": {"type": "TIMESTAMP", "index": 5, "name": "sla_applied_at", "comment": null}, "target": {"type": "INT64", "index": 6, "name": "target", "comment": null}, "sla_policy_name": {"type": "STRING", "index": 7, "name": "sla_policy_name", "comment": null}, "ticket_created_at": {"type": "TIMESTAMP", "index": 8, "name": "ticket_created_at", "comment": null}, "in_business_hours": {"type": "BOOL", "index": 9, "name": "in_business_hours", "comment": null}, "calendar_minutes": {"type": "INT64", "index": 10, "name": "calendar_minutes", "comment": null}, "running_total_calendar_minutes": {"type": "INT64", "index": 11, "name": "running_total_calendar_minutes", "comment": null}, "remaining_target_minutes": {"type": "INT64", "index": 12, "name": "remaining_target_minutes", "comment": null}, "is_breached_during_schedule": {"type": "BOOL", "index": 13, "name": "is_breached_during_schedule", "comment": null}, "breach_minutes": {"type": "INT64", "index": 14, "name": "breach_minutes", "comment": null}, "sla_breach_at": {"type": "TIMESTAMP", "index": 15, "name": "sla_breach_at", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 0.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 0.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.zendesk.int_zendesk__requester_wait_time_calendar_hours"}, "model.zendesk.int_zendesk__ticket_historical_group": {"metadata": {"type": "table", "schema": "dbt_zendesk_intermediate", "name": "int_zendesk__ticket_historical_group", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "group_stations_count": {"type": "INT64", "index": 2, "name": "group_stations_count", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 50233.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 803728.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.zendesk.int_zendesk__ticket_historical_group"}, "model.zendesk.int_zendesk__agent_work_time_calendar_hours": {"metadata": {"type": "table", "schema": "dbt_zendesk_intermediate", "name": "int_zendesk__agent_work_time_calendar_hours", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "valid_starting_at": {"type": "TIMESTAMP", "index": 2, "name": "valid_starting_at", "comment": null}, "valid_ending_at": {"type": "TIMESTAMP", "index": 3, "name": "valid_ending_at", "comment": null}, "ticket_status": {"type": "STRING", "index": 4, "name": "ticket_status", "comment": null}, "sla_applied_at": {"type": "TIMESTAMP", "index": 5, "name": "sla_applied_at", "comment": null}, "target": {"type": "INT64", "index": 6, "name": "target", "comment": null}, "sla_policy_name": {"type": "STRING", "index": 7, "name": "sla_policy_name", "comment": null}, "ticket_created_at": {"type": "TIMESTAMP", "index": 8, "name": "ticket_created_at", "comment": null}, "in_business_hours": {"type": "BOOL", "index": 9, "name": "in_business_hours", "comment": null}, "calendar_minutes": {"type": "INT64", "index": 10, "name": "calendar_minutes", "comment": null}, "running_total_calendar_minutes": {"type": "INT64", "index": 11, "name": "running_total_calendar_minutes", "comment": null}, "remaining_target_minutes": {"type": "INT64", "index": 12, "name": "remaining_target_minutes", "comment": null}, "is_breached_during_schedule": {"type": "BOOL", "index": 13, "name": "is_breached_during_schedule", "comment": null}, "breach_minutes": {"type": "INT64", "index": 14, "name": "breach_minutes", "comment": null}, "sla_breach_at": {"type": "TIMESTAMP", "index": 15, "name": "sla_breach_at", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 0.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 0.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.zendesk.int_zendesk__agent_work_time_calendar_hours"}, "model.zendesk.int_zendesk__reply_time_business_hours": {"metadata": {"type": "table", "schema": "dbt_zendesk_intermediate", "name": "int_zendesk__reply_time_business_hours", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "sla_policy_name": {"type": "STRING", "index": 2, "name": "sla_policy_name", "comment": null}, "metric": {"type": "STRING", "index": 3, "name": "metric", "comment": null}, "sla_applied_at": {"type": "TIMESTAMP", "index": 4, "name": "sla_applied_at", "comment": null}, "target": {"type": "INT64", "index": 5, "name": "target", "comment": null}, "in_business_hours": {"type": "BOOL", "index": 6, "name": "in_business_hours", "comment": null}, "sla_breach_at": {"type": "TIMESTAMP", "index": 7, "name": "sla_breach_at", "comment": null}, "is_breached_during_schedule": {"type": "BOOL", "index": 8, "name": "is_breached_during_schedule", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 134.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 10452.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.zendesk.int_zendesk__reply_time_business_hours"}, "model.zendesk.int_zendesk__ticket_aggregates": {"metadata": {"type": "table", "schema": "dbt_zendesk_intermediate", "name": "int_zendesk__ticket_aggregates", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 2, "name": "_fivetran_synced", "comment": null}, "assignee_id": {"type": "INT64", "index": 3, "name": "assignee_id", "comment": null}, "brand_id": {"type": "INT64", "index": 4, "name": "brand_id", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 5, "name": "created_at", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 6, "name": "updated_at", "comment": null}, "description": {"type": "STRING", "index": 7, "name": "description", "comment": null}, "due_at": {"type": "TIMESTAMP", "index": 8, "name": "due_at", "comment": null}, "group_id": {"type": "INT64", "index": 9, "name": "group_id", "comment": null}, "external_id": {"type": "STRING", "index": 10, "name": "external_id", "comment": null}, "is_public": {"type": "BOOL", "index": 11, "name": "is_public", "comment": null}, "organization_id": {"type": "INT64", "index": 12, "name": "organization_id", "comment": null}, "priority": {"type": "STRING", "index": 13, "name": "priority", "comment": null}, "recipient": {"type": "STRING", "index": 14, "name": "recipient", "comment": null}, "requester_id": {"type": "INT64", "index": 15, "name": "requester_id", "comment": null}, "status": {"type": "STRING", "index": 16, "name": "status", "comment": null}, "subject": {"type": "STRING", "index": 17, "name": "subject", "comment": null}, "problem_id": {"type": "INT64", "index": 18, "name": "problem_id", "comment": null}, "submitter_id": {"type": "INT64", "index": 19, "name": "submitter_id", "comment": null}, "ticket_form_id": {"type": "INT64", "index": 20, "name": "ticket_form_id", "comment": null}, "type": {"type": "STRING", "index": 21, "name": "type", "comment": null}, "url": {"type": "STRING", "index": 22, "name": "url", "comment": null}, "created_channel": {"type": "STRING", "index": 23, "name": "created_channel", "comment": null}, "source_from_id": {"type": "INT64", "index": 24, "name": "source_from_id", "comment": null}, "source_from_title": {"type": "STRING", "index": 25, "name": "source_from_title", "comment": null}, "source_rel": {"type": "STRING", "index": 26, "name": "source_rel", "comment": null}, "source_to_address": {"type": "STRING", "index": 27, "name": "source_to_address", "comment": null}, "source_to_name": {"type": "STRING", "index": 28, "name": "source_to_name", "comment": null}, "is_incident": {"type": "BOOL", "index": 29, "name": "is_incident", "comment": null}, "ticket_brand_name": {"type": "STRING", "index": 30, "name": "ticket_brand_name", "comment": null}, "ticket_tags": {"type": "STRING", "index": 31, "name": "ticket_tags", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 50892.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 46511763.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.zendesk.int_zendesk__ticket_aggregates"}, "model.zendesk.int_zendesk__reply_time_calendar_hours": {"metadata": {"type": "table", "schema": "dbt_zendesk_intermediate", "name": "int_zendesk__reply_time_calendar_hours", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "ticket_created_at": {"type": "TIMESTAMP", "index": 2, "name": "ticket_created_at", "comment": null}, "ticket_current_status": {"type": "STRING", "index": 3, "name": "ticket_current_status", "comment": null}, "metric": {"type": "STRING", "index": 4, "name": "metric", "comment": null}, "latest_sla": {"type": "INT64", "index": 5, "name": "latest_sla", "comment": null}, "sla_applied_at": {"type": "TIMESTAMP", "index": 6, "name": "sla_applied_at", "comment": null}, "target": {"type": "INT64", "index": 7, "name": "target", "comment": null}, "in_business_hours": {"type": "BOOL", "index": 8, "name": "in_business_hours", "comment": null}, "sla_policy_name": {"type": "STRING", "index": 9, "name": "sla_policy_name", "comment": null}, "sla_breach_at": {"type": "TIMESTAMP", "index": 10, "name": "sla_breach_at", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 38305.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 4017943.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.zendesk.int_zendesk__reply_time_calendar_hours"}, "model.zendesk.int_zendesk__field_calendar_spine": {"metadata": {"type": "table", "schema": "dbt_zendesk_intermediate", "name": "int_zendesk__field_calendar_spine", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"date_day": {"type": "DATE", "index": 1, "name": "date_day", "comment": null}, "ticket_id": {"type": "INT64", "index": 2, "name": "ticket_id", "comment": null}, "ticket_day_id": {"type": "STRING", "index": 3, "name": "ticket_day_id", "comment": null}}, "stats": {"partitioning_type": {"id": "partitioning_type", "label": "Partitioned By", "value": "date_day", "include": true, "description": "The partitioning column for this table"}, "num_rows": {"id": "num_rows", "label": "# Rows", "value": 2629943.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 131497150.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.zendesk.int_zendesk__field_calendar_spine"}, "model.zendesk.int_zendesk__ticket_historical_status": {"metadata": {"type": "table", "schema": "dbt_zendesk_intermediate", "name": "int_zendesk__ticket_historical_status", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "valid_starting_at": {"type": "TIMESTAMP", "index": 2, "name": "valid_starting_at", "comment": null}, "valid_ending_at": {"type": "TIMESTAMP", "index": 3, "name": "valid_ending_at", "comment": null}, "status_duration_calendar_minutes": {"type": "INT64", "index": 4, "name": "status_duration_calendar_minutes", "comment": null}, "status": {"type": "STRING", "index": 5, "name": "status", "comment": null}, "ticket_status_counter": {"type": "INT64", "index": 6, "name": "ticket_status_counter", "comment": null}, "unique_status_counter": {"type": "INT64", "index": 7, "name": "unique_status_counter", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 414902.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 22396194.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.zendesk.int_zendesk__ticket_historical_status"}, "model.zendesk.int_zendesk__agent_work_time_filtered_statuses": {"metadata": {"type": "table", "schema": "dbt_zendesk_intermediate", "name": "int_zendesk__agent_work_time_filtered_statuses", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "valid_starting_at": {"type": "TIMESTAMP", "index": 2, "name": "valid_starting_at", "comment": null}, "valid_ending_at": {"type": "TIMESTAMP", "index": 3, "name": "valid_ending_at", "comment": null}, "ticket_status": {"type": "STRING", "index": 4, "name": "ticket_status", "comment": null}, "sla_applied_at": {"type": "TIMESTAMP", "index": 5, "name": "sla_applied_at", "comment": null}, "target": {"type": "INT64", "index": 6, "name": "target", "comment": null}, "sla_policy_name": {"type": "STRING", "index": 7, "name": "sla_policy_name", "comment": null}, "ticket_created_at": {"type": "TIMESTAMP", "index": 8, "name": "ticket_created_at", "comment": null}, "in_business_hours": {"type": "BOOL", "index": 9, "name": "in_business_hours", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 0.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 0.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.zendesk.int_zendesk__agent_work_time_filtered_statuses"}, "model.zendesk.int_zendesk__latest_ticket_form": {"metadata": {"type": "table", "schema": "dbt_zendesk_intermediate", "name": "int_zendesk__latest_ticket_form", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_form_id": {"type": "INT64", "index": 1, "name": "ticket_form_id", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 2, "name": "created_at", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 3, "name": "updated_at", "comment": null}, "display_name": {"type": "STRING", "index": 4, "name": "display_name", "comment": null}, "is_active": {"type": "BOOL", "index": 5, "name": "is_active", "comment": null}, "name": {"type": "STRING", "index": 6, "name": "name", "comment": null}, "latest_form_index": {"type": "INT64", "index": 7, "name": "latest_form_index", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 12.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 1162.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.zendesk.int_zendesk__latest_ticket_form"}, "model.zendesk.int_zendesk__sla_policy_applied": {"metadata": {"type": "table", "schema": "dbt_zendesk_intermediate", "name": "int_zendesk__sla_policy_applied", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "ticket_created_at": {"type": "TIMESTAMP", "index": 2, "name": "ticket_created_at", "comment": null}, "ticket_current_status": {"type": "STRING", "index": 3, "name": "ticket_current_status", "comment": null}, "metric": {"type": "STRING", "index": 4, "name": "metric", "comment": null}, "latest_sla": {"type": "INT64", "index": 5, "name": "latest_sla", "comment": null}, "sla_applied_at": {"type": "TIMESTAMP", "index": 6, "name": "sla_applied_at", "comment": null}, "target": {"type": "INT64", "index": 7, "name": "target", "comment": null}, "in_business_hours": {"type": "BOOL", "index": 8, "name": "in_business_hours", "comment": null}, "sla_policy_name": {"type": "STRING", "index": 9, "name": "sla_policy_name", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 38319.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 3712805.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.zendesk.int_zendesk__sla_policy_applied"}, "model.zendesk.int_zendesk__user_aggregates": {"metadata": {"type": "table", "schema": "dbt_zendesk_intermediate", "name": "int_zendesk__user_aggregates", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"user_id": {"type": "INT64", "index": 1, "name": "user_id", "comment": null}, "external_id": {"type": "STRING", "index": 2, "name": "external_id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "last_login_at": {"type": "TIMESTAMP", "index": 4, "name": "last_login_at", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 5, "name": "created_at", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 6, "name": "updated_at", "comment": null}, "email": {"type": "STRING", "index": 7, "name": "email", "comment": null}, "name": {"type": "STRING", "index": 8, "name": "name", "comment": null}, "organization_id": {"type": "INT64", "index": 9, "name": "organization_id", "comment": null}, "role": {"type": "STRING", "index": 10, "name": "role", "comment": null}, "ticket_restriction": {"type": "STRING", "index": 11, "name": "ticket_restriction", "comment": null}, "time_zone": {"type": "STRING", "index": 12, "name": "time_zone", "comment": null}, "locale": {"type": "STRING", "index": 13, "name": "locale", "comment": null}, "is_active": {"type": "BOOL", "index": 14, "name": "is_active", "comment": null}, "is_suspended": {"type": "BOOL", "index": 15, "name": "is_suspended", "comment": null}, "user_tags": {"type": "STRING", "index": 16, "name": "user_tags", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 52850.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 6683039.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.zendesk.int_zendesk__user_aggregates"}, "model.zendesk.int_zendesk__organization_aggregates": {"metadata": {"type": "table", "schema": "dbt_zendesk_intermediate", "name": "int_zendesk__organization_aggregates", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"organization_id": {"type": "INT64", "index": 1, "name": "organization_id", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 2, "name": "created_at", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 3, "name": "updated_at", "comment": null}, "details": {"type": "STRING", "index": 4, "name": "details", "comment": null}, "name": {"type": "STRING", "index": 5, "name": "name", "comment": null}, "external_id": {"type": "STRING", "index": 6, "name": "external_id", "comment": null}, "organization_tags": {"type": "STRING", "index": 7, "name": "organization_tags", "comment": null}, "domain_names": {"type": "STRING", "index": 8, "name": "domain_names", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 483724.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 41973103.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.zendesk.int_zendesk__organization_aggregates"}, "model.zendesk.int_zendesk__agent_work_time_business_hours": {"metadata": {"type": "table", "schema": "dbt_zendesk_intermediate", "name": "int_zendesk__agent_work_time_business_hours", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "sla_applied_at": {"type": "TIMESTAMP", "index": 2, "name": "sla_applied_at", "comment": null}, "target": {"type": "INT64", "index": 3, "name": "target", "comment": null}, "sla_policy_name": {"type": "STRING", "index": 4, "name": "sla_policy_name", "comment": null}, "valid_starting_at": {"type": "TIMESTAMP", "index": 5, "name": "valid_starting_at", "comment": null}, "valid_ending_at": {"type": "TIMESTAMP", "index": 6, "name": "valid_ending_at", "comment": null}, "week_number": {"type": "FLOAT64", "index": 7, "name": "week_number", "comment": null}, "ticket_week_start_time_minute": {"type": "FLOAT64", "index": 8, "name": "ticket_week_start_time_minute", "comment": null}, "ticket_week_end_time_minute": {"type": "FLOAT64", "index": 9, "name": "ticket_week_end_time_minute", "comment": null}, "schedule_start_time": {"type": "INT64", "index": 10, "name": "schedule_start_time", "comment": null}, "schedule_end_time": {"type": "INT64", "index": 11, "name": "schedule_end_time", "comment": null}, "scheduled_minutes": {"type": "FLOAT64", "index": 12, "name": "scheduled_minutes", "comment": null}, "running_total_scheduled_minutes": {"type": "FLOAT64", "index": 13, "name": "running_total_scheduled_minutes", "comment": null}, "remaining_target_minutes": {"type": "FLOAT64", "index": 14, "name": "remaining_target_minutes", "comment": null}, "lag_check": {"type": "FLOAT64", "index": 15, "name": "lag_check", "comment": null}, "is_breached_during_schedule": {"type": "BOOL", "index": 16, "name": "is_breached_during_schedule", "comment": null}, "breach_minutes": {"type": "FLOAT64", "index": 17, "name": "breach_minutes", "comment": null}, "breach_minutes_from_week": {"type": "FLOAT64", "index": 18, "name": "breach_minutes_from_week", "comment": null}, "sla_breach_at": {"type": "TIMESTAMP", "index": 19, "name": "sla_breach_at", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 0.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 0.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.zendesk.int_zendesk__agent_work_time_business_hours"}, "model.zendesk.int_zendesk__field_history_scd": {"metadata": {"type": "table", "schema": "dbt_zendesk_intermediate", "name": "int_zendesk__field_history_scd", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"valid_from": {"type": "DATE", "index": 1, "name": "valid_from", "comment": null}, "ticket_id": {"type": "INT64", "index": 2, "name": "ticket_id", "comment": null}, "ticket_day_id": {"type": "STRING", "index": 3, "name": "ticket_day_id", "comment": null}, "status": {"type": "STRING", "index": 4, "name": "status", "comment": null}, "priority": {"type": "STRING", "index": 5, "name": "priority", "comment": null}, "assignee_id": {"type": "STRING", "index": 6, "name": "assignee_id", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 239418.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 18647410.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.zendesk.int_zendesk__field_history_scd"}, "model.zendesk.int_zendesk__comment_metrics": {"metadata": {"type": "table", "schema": "dbt_zendesk_intermediate", "name": "int_zendesk__comment_metrics", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "last_comment_added_at": {"type": "TIMESTAMP", "index": 2, "name": "last_comment_added_at", "comment": null}, "count_public_agent_comments": {"type": "INT64", "index": 3, "name": "count_public_agent_comments", "comment": null}, "count_agent_comments": {"type": "INT64", "index": 4, "name": "count_agent_comments", "comment": null}, "count_end_user_comments": {"type": "INT64", "index": 5, "name": "count_end_user_comments", "comment": null}, "count_public_comments": {"type": "INT64", "index": 6, "name": "count_public_comments", "comment": null}, "count_internal_comments": {"type": "INT64", "index": 7, "name": "count_internal_comments", "comment": null}, "total_comments": {"type": "INT64", "index": 8, "name": "total_comments", "comment": null}, "count_ticket_handoffs": {"type": "INT64", "index": 9, "name": "count_ticket_handoffs", "comment": null}, "is_one_touch_resolution": {"type": "BOOL", "index": 10, "name": "is_one_touch_resolution", "comment": null}, "is_two_touch_resolution": {"type": "BOOL", "index": 11, "name": "is_two_touch_resolution", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 50471.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 3734854.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.zendesk.int_zendesk__comment_metrics"}, "model.zendesk.int_zendesk__requester_updates": {"metadata": {"type": "table", "schema": "dbt_zendesk_intermediate", "name": "int_zendesk__requester_updates", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "requester_id": {"type": "INT64", "index": 2, "name": "requester_id", "comment": null}, "last_updated": {"type": "TIMESTAMP", "index": 3, "name": "last_updated", "comment": null}, "total_updates": {"type": "INT64", "index": 4, "name": "total_updates", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 50892.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 1615872.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.zendesk.int_zendesk__requester_updates"}, "model.zendesk.int_zendesk__requester_wait_time_filtered_statuses": {"metadata": {"type": "table", "schema": "dbt_zendesk_intermediate", "name": "int_zendesk__requester_wait_time_filtered_statuses", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "valid_starting_at": {"type": "TIMESTAMP", "index": 2, "name": "valid_starting_at", "comment": null}, "valid_ending_at": {"type": "TIMESTAMP", "index": 3, "name": "valid_ending_at", "comment": null}, "ticket_status": {"type": "STRING", "index": 4, "name": "ticket_status", "comment": null}, "sla_applied_at": {"type": "TIMESTAMP", "index": 5, "name": "sla_applied_at", "comment": null}, "target": {"type": "INT64", "index": 6, "name": "target", "comment": null}, "sla_policy_name": {"type": "STRING", "index": 7, "name": "sla_policy_name", "comment": null}, "ticket_created_at": {"type": "TIMESTAMP", "index": 8, "name": "ticket_created_at", "comment": null}, "in_business_hours": {"type": "BOOL", "index": 9, "name": "in_business_hours", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 0.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 0.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.zendesk.int_zendesk__requester_wait_time_filtered_statuses"}, "model.zendesk.int_zendesk__ticket_historical_satisfaction": {"metadata": {"type": "table", "schema": "dbt_zendesk_intermediate", "name": "int_zendesk__ticket_historical_satisfaction", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "latest_satisfaction_reason": {"type": "STRING", "index": 2, "name": "latest_satisfaction_reason", "comment": null}, "latest_satisfaction_comment": {"type": "STRING", "index": 3, "name": "latest_satisfaction_comment", "comment": null}, "first_satisfaction_score": {"type": "STRING", "index": 4, "name": "first_satisfaction_score", "comment": null}, "latest_satisfaction_score": {"type": "STRING", "index": 5, "name": "latest_satisfaction_score", "comment": null}, "count_satisfaction_scores": {"type": "INT64", "index": 6, "name": "count_satisfaction_scores", "comment": null}, "is_good_to_bad_satisfaction_score": {"type": "BOOL", "index": 7, "name": "is_good_to_bad_satisfaction_score", "comment": null}, "is_bad_to_good_satisfaction_score": {"type": "BOOL", "index": 8, "name": "is_bad_to_good_satisfaction_score", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 19585.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 529423.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.zendesk.int_zendesk__ticket_historical_satisfaction"}, "model.zendesk_source.stg_zendesk__ticket_form_history": {"metadata": {"type": "table", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__ticket_form_history", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_form_id": {"type": "INT64", "index": 1, "name": "ticket_form_id", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 2, "name": "created_at", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 3, "name": "updated_at", "comment": null}, "display_name": {"type": "STRING", "index": 4, "name": "display_name", "comment": null}, "is_active": {"type": "BOOL", "index": 5, "name": "is_active", "comment": null}, "name": {"type": "STRING", "index": 6, "name": "name", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 235.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 20324.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.zendesk_source.stg_zendesk__ticket_form_history"}, "model.zendesk_source.stg_zendesk__ticket_comment": {"metadata": {"type": "table", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__ticket_comment", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_comment_id": {"type": "INT64", "index": 1, "name": "ticket_comment_id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 2, "name": "_fivetran_synced", "comment": null}, "body": {"type": "STRING", "index": 3, "name": "body", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 4, "name": "created_at", "comment": null}, "is_public": {"type": "BOOL", "index": 5, "name": "is_public", "comment": null}, "ticket_id": {"type": "INT64", "index": 6, "name": "ticket_id", "comment": null}, "user_id": {"type": "INT64", "index": 7, "name": "user_id", "comment": null}, "is_facebook_comment": {"type": "BOOL", "index": 8, "name": "is_facebook_comment", "comment": null}, "is_tweet": {"type": "BOOL", "index": 9, "name": "is_tweet", "comment": null}, "is_voice_comment": {"type": "BOOL", "index": 10, "name": "is_voice_comment", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 550325.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 329812966.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.zendesk_source.stg_zendesk__ticket_comment"}, "model.zendesk_source.stg_zendesk__user": {"metadata": {"type": "table", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__user", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"user_id": {"type": "INT64", "index": 1, "name": "user_id", "comment": null}, "external_id": {"type": "STRING", "index": 2, "name": "external_id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "last_login_at": {"type": "TIMESTAMP", "index": 4, "name": "last_login_at", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 5, "name": "created_at", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 6, "name": "updated_at", "comment": null}, "email": {"type": "STRING", "index": 7, "name": "email", "comment": null}, "name": {"type": "STRING", "index": 8, "name": "name", "comment": null}, "organization_id": {"type": "INT64", "index": 9, "name": "organization_id", "comment": null}, "role": {"type": "STRING", "index": 10, "name": "role", "comment": null}, "ticket_restriction": {"type": "STRING", "index": 11, "name": "ticket_restriction", "comment": null}, "time_zone": {"type": "STRING", "index": 12, "name": "time_zone", "comment": null}, "locale": {"type": "STRING", "index": 13, "name": "locale", "comment": null}, "is_active": {"type": "BOOL", "index": 14, "name": "is_active", "comment": null}, "is_suspended": {"type": "BOOL", "index": 15, "name": "is_suspended", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 52850.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 6682869.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.zendesk_source.stg_zendesk__user"}, "model.zendesk_source.stg_zendesk__organization_tag": {"metadata": {"type": "table", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__organization_tag", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"organization_id": {"type": "INT64", "index": 1, "name": "organization_id", "comment": null}, "tags": {"type": "STRING", "index": 2, "name": "tags", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 989290.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 20552952.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.zendesk_source.stg_zendesk__organization_tag"}, "model.zendesk_source.stg_zendesk__ticket_tmp": {"metadata": {"type": "view", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__ticket_tmp", "database": "dbt-package-testing", "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}, "allow_channelback": {"type": "BOOL", "index": 3, "name": "allow_channelback", "comment": null}, "assignee_id": {"type": "INT64", "index": 4, "name": "assignee_id", "comment": null}, "brand_id": {"type": "INT64", "index": 5, "name": "brand_id", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 6, "name": "created_at", "comment": null}, "custom_additional_details": {"type": "STRING", "index": 7, "name": "custom_additional_details", "comment": null}, "custom_alternatives": {"type": "STRING", "index": 8, "name": "custom_alternatives", "comment": null}, "custom_connector": {"type": "STRING", "index": 9, "name": "custom_connector", "comment": null}, "custom_consent_to_access": {"type": "BOOL", "index": 10, "name": "custom_consent_to_access", "comment": null}, "custom_current_state": {"type": "STRING", "index": 11, "name": "custom_current_state", "comment": null}, "custom_error_messages": {"type": "STRING", "index": 12, "name": "custom_error_messages", "comment": null}, "custom_git_zen_data": {"type": "STRING", "index": 13, "name": "custom_git_zen_data", "comment": null}, "custom_origin": {"type": "STRING", "index": 14, "name": "custom_origin", "comment": null}, "custom_proposed_solution": {"type": "STRING", "index": 15, "name": "custom_proposed_solution", "comment": null}, "custom_severity": {"type": "STRING", "index": 16, "name": "custom_severity", "comment": null}, "custom_sql_query": {"type": "STRING", "index": 17, "name": "custom_sql_query", "comment": null}, "custom_steps_to_reproduce": {"type": "STRING", "index": 18, "name": "custom_steps_to_reproduce", "comment": null}, "description": {"type": "STRING", "index": 19, "name": "description", "comment": null}, "due_at": {"type": "TIMESTAMP", "index": 20, "name": "due_at", "comment": null}, "external_id": {"type": "STRING", "index": 21, "name": "external_id", "comment": null}, "forum_topic_id": {"type": "INT64", "index": 22, "name": "forum_topic_id", "comment": null}, "group_id": {"type": "INT64", "index": 23, "name": "group_id", "comment": null}, "has_incidents": {"type": "BOOL", "index": 24, "name": "has_incidents", "comment": null}, "is_public": {"type": "BOOL", "index": 25, "name": "is_public", "comment": null}, "organization_id": {"type": "INT64", "index": 26, "name": "organization_id", "comment": null}, "priority": {"type": "STRING", "index": 27, "name": "priority", "comment": null}, "problem_id": {"type": "INT64", "index": 28, "name": "problem_id", "comment": null}, "recipient": {"type": "STRING", "index": 29, "name": "recipient", "comment": null}, "requester_id": {"type": "INT64", "index": 30, "name": "requester_id", "comment": null}, "status": {"type": "STRING", "index": 31, "name": "status", "comment": null}, "subject": {"type": "STRING", "index": 32, "name": "subject", "comment": null}, "submitter_id": {"type": "INT64", "index": 33, "name": "submitter_id", "comment": null}, "system_client": {"type": "STRING", "index": 34, "name": "system_client", "comment": null}, "system_ip_address": {"type": "STRING", "index": 35, "name": "system_ip_address", "comment": null}, "system_json_email_identifier": {"type": "STRING", "index": 36, "name": "system_json_email_identifier", "comment": null}, "system_latitude": {"type": "FLOAT64", "index": 37, "name": "system_latitude", "comment": null}, "system_location": {"type": "STRING", "index": 38, "name": "system_location", "comment": null}, "system_longitude": {"type": "FLOAT64", "index": 39, "name": "system_longitude", "comment": null}, "system_message_id": {"type": "STRING", "index": 40, "name": "system_message_id", "comment": null}, "system_raw_email_identifier": {"type": "STRING", "index": 41, "name": "system_raw_email_identifier", "comment": null}, "ticket_form_id": {"type": "INT64", "index": 42, "name": "ticket_form_id", "comment": null}, "type": {"type": "STRING", "index": 43, "name": "type", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 44, "name": "updated_at", "comment": null}, "url": {"type": "STRING", "index": 45, "name": "url", "comment": null}, "via_channel": {"type": "STRING", "index": 46, "name": "via_channel", "comment": null}, "via_source_from_id": {"type": "INT64", "index": 47, "name": "via_source_from_id", "comment": null}, "via_source_from_title": {"type": "STRING", "index": 48, "name": "via_source_from_title", "comment": null}, "via_source_rel": {"type": "STRING", "index": 49, "name": "via_source_rel", "comment": null}, "via_source_to_address": {"type": "STRING", "index": 50, "name": "via_source_to_address", "comment": null}, "via_source_to_name": {"type": "STRING", "index": 51, "name": "via_source_to_name", "comment": null}, "custom_sfdc_case_": {"type": "STRING", "index": 52, "name": "custom_sfdc_case_", "comment": null}, "custom_connector_type": {"type": "STRING", "index": 53, "name": "custom_connector_type", "comment": null}, "custom_se_notes": {"type": "STRING", "index": 54, "name": "custom_se_notes", "comment": null}, "custom_warehouse_id": {"type": "STRING", "index": 55, "name": "custom_warehouse_id", "comment": null}, "custom_github_link": {"type": "STRING", "index": 56, "name": "custom_github_link", "comment": null}, "custom_classification": {"type": "STRING", "index": 57, "name": "custom_classification", "comment": null}, "custom_ticket_priority": {"type": "STRING", "index": 58, "name": "custom_ticket_priority", "comment": null}, "custom_customer_risk": {"type": "STRING", "index": 59, "name": "custom_customer_risk", "comment": null}, "system_machine_generated": {"type": "BOOL", "index": 60, "name": "system_machine_generated", "comment": null}, "custom_escalated": {"type": "BOOL", "index": 61, "name": "custom_escalated", "comment": null}, "custom_issue_escalation_notes": {"type": "STRING", "index": 62, "name": "custom_issue_escalation_notes", "comment": null}, "custom_se_manager_notes": {"type": "STRING", "index": 63, "name": "custom_se_manager_notes", "comment": null}, "custom_related_to": {"type": "STRING", "index": 64, "name": "custom_related_to", "comment": null}, "merged_ticket_ids": {"type": "STRING", "index": 65, "name": "merged_ticket_ids", "comment": null}, "custom_connector_name": {"type": "STRING", "index": 66, "name": "custom_connector_name", "comment": null}, "custom_destination_type": {"type": "STRING", "index": 67, "name": "custom_destination_type", "comment": null}, "custom_group_id": {"type": "STRING", "index": 68, "name": "custom_group_id", "comment": null}, "custom_fivetran_warehouse": {"type": "STRING", "index": 69, "name": "custom_fivetran_warehouse", "comment": null}, "custom_slack_channel_id": {"type": "STRING", "index": 70, "name": "custom_slack_channel_id", "comment": null}, "custom_ticket_quality": {"type": "BOOL", "index": 71, "name": "custom_ticket_quality", "comment": null}, "via_source_from_address": {"type": "STRING", "index": 72, "name": "via_source_from_address", "comment": null}, "custom_escalation_reason": {"type": "STRING", "index": 73, "name": "custom_escalation_reason", "comment": null}, "followup_ids": {"type": "STRING", "index": 74, "name": "followup_ids", "comment": null}, "via_followup_source_id": {"type": "INT64", "index": 75, "name": "via_followup_source_id", "comment": null}, "custom_post_id": {"type": "INT64", "index": 76, "name": "custom_post_id", "comment": null}, "custom_post_name": {"type": "STRING", "index": 77, "name": "custom_post_name", "comment": null}, "custom_post_path": {"type": "STRING", "index": 78, "name": "custom_post_path", "comment": null}, "custom_grant_access_status": {"type": "STRING", "index": 79, "name": "custom_grant_access_status", "comment": null}, "custom_grant_access_service": {"type": "STRING", "index": 80, "name": "custom_grant_access_service", "comment": null}, "custom_grant_access_scope": {"type": "STRING", "index": 81, "name": "custom_grant_access_scope", "comment": null}, "custom_grant_access_schema": {"type": "STRING", "index": 82, "name": "custom_grant_access_schema", "comment": null}, "custom_grant_access_group": {"type": "STRING", "index": 83, "name": "custom_grant_access_group", "comment": null}, "custom_grant_access_expiration": {"type": "STRING", "index": 84, "name": "custom_grant_access_expiration", "comment": null}, "custom_grant_access_approved_at": {"type": "STRING", "index": 85, "name": "custom_grant_access_approved_at", "comment": null}, "custom_grant_access_group_name": {"type": "STRING", "index": 86, "name": "custom_grant_access_group_name", "comment": null}, "custom_grant_access_revoked_at": {"type": "STRING", "index": 87, "name": "custom_grant_access_revoked_at", "comment": null}, "custom_bug_sub_category": {"type": "STRING", "index": 88, "name": "custom_bug_sub_category", "comment": null}, "custom_fivetran_group_name": {"type": "STRING", "index": 89, "name": "custom_fivetran_group_name", "comment": null}, "custom_fivetran_destination_type": {"type": "STRING", "index": 90, "name": "custom_fivetran_destination_type", "comment": null}, "custom_subcategory_bug": {"type": "STRING", "index": 91, "name": "custom_subcategory_bug", "comment": null}, "custom_sub_classification_bug": {"type": "STRING", "index": 92, "name": "custom_sub_classification_bug", "comment": null}, "custom_sub_classification_data_integrity": {"type": "STRING", "index": 93, "name": "custom_sub_classification_data_integrity", "comment": null}, "custom_sub_classification_account_management": {"type": "STRING", "index": 94, "name": "custom_sub_classification_account_management", "comment": null}, "custom_sub_classification_other": {"type": "STRING", "index": 95, "name": "custom_sub_classification_other", "comment": null}, "custom_sub_classification_sync_issue": {"type": "STRING", "index": 96, "name": "custom_sub_classification_sync_issue", "comment": null}, "custom_sub_classification_education_needed": {"type": "STRING", "index": 97, "name": "custom_sub_classification_education_needed", "comment": null}, "custom_sub_classification_connector_issue": {"type": "STRING", "index": 98, "name": "custom_sub_classification_connector_issue", "comment": null}, "custom_sub_classification_network_security": {"type": "STRING", "index": 99, "name": "custom_sub_classification_network_security", "comment": null}, "custom_sub_classification_incident": {"type": "STRING", "index": 100, "name": "custom_sub_classification_incident", "comment": null}, "custom_sub_classification_feature_flag": {"type": "STRING", "index": 101, "name": "custom_sub_classification_feature_flag", "comment": null}, "custom_sub_classification_fivetran_platform": {"type": "STRING", "index": 102, "name": "custom_sub_classification_fivetran_platform", "comment": null}, "custom_sub_classification_destination_issue": {"type": "STRING", "index": 103, "name": "custom_sub_classification_destination_issue", "comment": null}, "custom_sub_classification_transformations": {"type": "STRING", "index": 104, "name": "custom_sub_classification_transformations", "comment": null}, "custom_sub_classification_billing": {"type": "STRING", "index": 105, "name": "custom_sub_classification_billing", "comment": null}, "custom_sub_classification_sales_inquiry": {"type": "STRING", "index": 106, "name": "custom_sub_classification_sales_inquiry", "comment": null}, "custom_reopen": {"type": "TIMESTAMP", "index": 107, "name": "custom_reopen", "comment": null}, "custom_total_time_spent_sec_": {"type": "INT64", "index": 108, "name": "custom_total_time_spent_sec_", "comment": null}, "custom_time_spent_last_update_sec_": {"type": "INT64", "index": 109, "name": "custom_time_spent_last_update_sec_", "comment": null}, "custom_fivetran_account_status": {"type": "STRING", "index": 110, "name": "custom_fivetran_account_status", "comment": null}, "custom_snooze": {"type": "TIMESTAMP", "index": 111, "name": "custom_snooze", "comment": null}, "custom_customer_data_check": {"type": "BOOL", "index": 112, "name": "custom_customer_data_check", "comment": null}, "custom_screenshot_of_connector_s_setup_page_included": {"type": "BOOL", "index": 113, "name": "custom_screenshot_of_connector_s_setup_page_included", "comment": null}, "custom_on_hold_reason_": {"type": "STRING", "index": 114, "name": "custom_on_hold_reason_", "comment": null}, "custom_request_type_": {"type": "STRING", "index": 115, "name": "custom_request_type_", "comment": null}, "custom_screenshot_of_transformation_setup_page_included": {"type": "BOOL", "index": 116, "name": "custom_screenshot_of_transformation_setup_page_included", "comment": null}, "custom_account_level": {"type": "STRING", "index": 117, "name": "custom_account_level", "comment": null}, "custom_pbf_": {"type": "STRING", "index": 118, "name": "custom_pbf_", "comment": null}, "custom_reported_severity_": {"type": "STRING", "index": 119, "name": "custom_reported_severity_", "comment": null}, "custom_error_shown_in_connector_s_setup_page_": {"type": "STRING", "index": 120, "name": "custom_error_shown_in_connector_s_setup_page_", "comment": null}, "custom_details_of_issue_with_alert_shown_in_connector_s_dashboard_": {"type": "STRING", "index": 121, "name": "custom_details_of_issue_with_alert_shown_in_connector_s_dashboard_", "comment": null}, "custom_query_used_to_verify_data_integrity_": {"type": "STRING", "index": 122, "name": "custom_query_used_to_verify_data_integrity_", "comment": null}, "custom_unique_ids_for_source_records_not_showing_": {"type": "STRING", "index": 123, "name": "custom_unique_ids_for_source_records_not_showing_", "comment": null}, "custom_number_of_end_customers_impacted_due_to_inquiry_": {"type": "STRING", "index": 124, "name": "custom_number_of_end_customers_impacted_due_to_inquiry_", "comment": null}, "custom_error_shown_in_logs_status_bar_in_connector_s_dashboard_": {"type": "STRING", "index": 125, "name": "custom_error_shown_in_logs_status_bar_in_connector_s_dashboard_", "comment": null}, "custom_name_of_schema_table_column_seen_in_source_not_showing_in_the_destination_": {"type": "STRING", "index": 126, "name": "custom_name_of_schema_table_column_seen_in_source_not_showing_in_the_destination_", "comment": null}, "custom_steps_taken_that_lead_to_ui_error_": {"type": "STRING", "index": 127, "name": "custom_steps_taken_that_lead_to_ui_error_", "comment": null}, "custom_user_s_email_address_and_current_role_": {"type": "STRING", "index": 128, "name": "custom_user_s_email_address_and_current_role_", "comment": null}, "custom_estimated_number_of_records_of_mar_dispute_": {"type": "STRING", "index": 129, "name": "custom_estimated_number_of_records_of_mar_dispute_", "comment": null}, "custom_reasoning_for_mar_dispute_": {"type": "STRING", "index": 130, "name": "custom_reasoning_for_mar_dispute_", "comment": null}, "custom_date_range_of_mar_dispute_": {"type": "STRING", "index": 131, "name": "custom_date_range_of_mar_dispute_", "comment": null}, "custom_support_case_numbers_related_to_mar_dispute_": {"type": "STRING", "index": 132, "name": "custom_support_case_numbers_related_to_mar_dispute_", "comment": null}, "custom_type_of_ssh_setup_being_used_": {"type": "STRING", "index": 133, "name": "custom_type_of_ssh_setup_being_used_", "comment": null}, "custom_ticket_note_": {"type": "STRING", "index": 134, "name": "custom_ticket_note_", "comment": null}, "custom_support_case_numbers_related_to_sla_dispute_": {"type": "STRING", "index": 135, "name": "custom_support_case_numbers_related_to_sla_dispute_", "comment": null}, "custom_estimated_number_of_records_of_sla_dispute_": {"type": "INT64", "index": 136, "name": "custom_estimated_number_of_records_of_sla_dispute_", "comment": null}, "custom_date_range_of_sla_dispute_": {"type": "STRING", "index": 137, "name": "custom_date_range_of_sla_dispute_", "comment": null}, "custom_reasoning_for_sla_dispute_": {"type": "STRING", "index": 138, "name": "custom_reasoning_for_sla_dispute_", "comment": null}, "custom_security_request_type_": {"type": "STRING", "index": 139, "name": "custom_security_request_type_", "comment": null}, "custom_account_id": {"type": "STRING", "index": 140, "name": "custom_account_id", "comment": null}, "custom_grant_access_account_name": {"type": "STRING", "index": 141, "name": "custom_grant_access_account_name", "comment": null}, "custom_account_name": {"type": "STRING", "index": 142, "name": "custom_account_name", "comment": null}, "custom_grant_access_account": {"type": "STRING", "index": 143, "name": "custom_grant_access_account", "comment": null}, "custom_snooze_state": {"type": "STRING", "index": 144, "name": "custom_snooze_state", "comment": null}, "custom_snoozed_until": {"type": "STRING", "index": 145, "name": "custom_snoozed_until", "comment": null}, "custom_on_hold_reason_security_": {"type": "STRING", "index": 146, "name": "custom_on_hold_reason_security_", "comment": null}, "custom_classification_old": {"type": "STRING", "index": 147, "name": "custom_classification_old", "comment": null}, "custom_sub_classification_data_integrity_old": {"type": "STRING", "index": 148, "name": "custom_sub_classification_data_integrity_old", "comment": null}, "custom_sub_classification_sync_issue_old": {"type": "STRING", "index": 149, "name": "custom_sub_classification_sync_issue_old", "comment": null}, "custom_reason_for_ticket_creation_classification_": {"type": "STRING", "index": 150, "name": "custom_reason_for_ticket_creation_classification_", "comment": null}, "custom_sub_classification_billing_old": {"type": "STRING", "index": 151, "name": "custom_sub_classification_billing_old", "comment": null}, "custom_sub_classification_feature_flag_old": {"type": "STRING", "index": 152, "name": "custom_sub_classification_feature_flag_old", "comment": null}, "custom_sub_classification_education_needed_old": {"type": "STRING", "index": 153, "name": "custom_sub_classification_education_needed_old", "comment": null}, "custom_sub_classification_transformations_old": {"type": "STRING", "index": 154, "name": "custom_sub_classification_transformations_old", "comment": null}, "custom_sub_classification_bug_old": {"type": "STRING", "index": 155, "name": "custom_sub_classification_bug_old", "comment": null}, "custom_sub_classification_destination_issue_old": {"type": "STRING", "index": 156, "name": "custom_sub_classification_destination_issue_old", "comment": null}, "custom_resolution_description_": {"type": "STRING", "index": 157, "name": "custom_resolution_description_", "comment": null}, "custom_sub_classification_network_security_old": {"type": "STRING", "index": 158, "name": "custom_sub_classification_network_security_old", "comment": null}, "custom_sub_classification_connector_issue_old": {"type": "STRING", "index": 159, "name": "custom_sub_classification_connector_issue_old", "comment": null}, "custom_sub_classification_incident_old": {"type": "STRING", "index": 160, "name": "custom_sub_classification_incident_old", "comment": null}, "custom_sub_classification_other_old": {"type": "STRING", "index": 161, "name": "custom_sub_classification_other_old", "comment": null}, "custom_sub_classification_fivetran_platform_old": {"type": "STRING", "index": 162, "name": "custom_sub_classification_fivetran_platform_old", "comment": null}, "custom_sub_classification_account_management_old": {"type": "STRING", "index": 163, "name": "custom_sub_classification_account_management_old", "comment": null}, "custom_sub_classification_sales_inquiry_old": {"type": "STRING", "index": 164, "name": "custom_sub_classification_sales_inquiry_old", "comment": null}, "custom_logs_improvement_note": {"type": "STRING", "index": 165, "name": "custom_logs_improvement_note", "comment": null}, "custom_logs_improvement": {"type": "STRING", "index": 166, "name": "custom_logs_improvement", "comment": null}, "custom_hub_os_": {"type": "STRING", "index": 167, "name": "custom_hub_os_", "comment": null}, "custom_environment_": {"type": "STRING", "index": 168, "name": "custom_environment_", "comment": null}, "custom_source_os_": {"type": "STRING", "index": 169, "name": "custom_source_os_", "comment": null}, "custom_target_os_": {"type": "STRING", "index": 170, "name": "custom_target_os_", "comment": null}, "custom_source_": {"type": "STRING", "index": 171, "name": "custom_source_", "comment": null}, "custom_source_dbms_": {"type": "STRING", "index": 172, "name": "custom_source_dbms_", "comment": null}, "custom_target_dbms_": {"type": "STRING", "index": 173, "name": "custom_target_dbms_", "comment": null}, "custom_hub_dbms_": {"type": "STRING", "index": 174, "name": "custom_hub_dbms_", "comment": null}, "custom_hub_": {"type": "STRING", "index": 175, "name": "custom_hub_", "comment": null}, "custom_target_": {"type": "STRING", "index": 176, "name": "custom_target_", "comment": null}, "custom_reason_for_ticket_classification_": {"type": "STRING", "index": 177, "name": "custom_reason_for_ticket_classification_", "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.zendesk_source.stg_zendesk__ticket_tmp"}, "model.zendesk_source.stg_zendesk__ticket_field_history": {"metadata": {"type": "table", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__ticket_field_history", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "field_name": {"type": "STRING", "index": 2, "name": "field_name", "comment": null}, "valid_starting_at": {"type": "TIMESTAMP", "index": 3, "name": "valid_starting_at", "comment": null}, "valid_ending_at": {"type": "TIMESTAMP", "index": 4, "name": "valid_ending_at", "comment": null}, "value": {"type": "STRING", "index": 5, "name": "value", "comment": null}, "user_id": {"type": "INT64", "index": 6, "name": "user_id", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 1554007.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 107566430.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.zendesk_source.stg_zendesk__ticket_field_history"}, "model.zendesk_source.stg_zendesk__ticket_form_history_tmp": {"metadata": {"type": "view", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__ticket_form_history_tmp", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"id": {"type": "INT64", "index": 1, "name": "id", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 2, "name": "updated_at", "comment": null}, "_fivetran_deleted": {"type": "BOOL", "index": 3, "name": "_fivetran_deleted", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 4, "name": "_fivetran_synced", "comment": null}, "active": {"type": "BOOL", "index": 5, "name": "active", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 6, "name": "created_at", "comment": null}, "display_name": {"type": "STRING", "index": 7, "name": "display_name", "comment": null}, "end_user_visible": {"type": "BOOL", "index": 8, "name": "end_user_visible", "comment": null}, "name": {"type": "STRING", "index": 9, "name": "name", "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.zendesk_source.stg_zendesk__ticket_form_history_tmp"}, "model.zendesk_source.stg_zendesk__user_tag_tmp": {"metadata": {"type": "view", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__user_tag_tmp", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"tag": {"type": "STRING", "index": 1, "name": "tag", "comment": null}, "user_id": {"type": "INT64", "index": 2, "name": "user_id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "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.zendesk_source.stg_zendesk__user_tag_tmp"}, "model.zendesk_source.stg_zendesk__schedule": {"metadata": {"type": "table", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__schedule", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"schedule_id": {"type": "STRING", "index": 1, "name": "schedule_id", "comment": null}, "end_time": {"type": "INT64", "index": 2, "name": "end_time", "comment": null}, "start_time": {"type": "INT64", "index": 3, "name": "start_time", "comment": null}, "schedule_name": {"type": "STRING", "index": 4, "name": "schedule_name", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 5, "name": "created_at", "comment": null}, "time_zone": {"type": "STRING", "index": 6, "name": "time_zone", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 7.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 420.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.zendesk_source.stg_zendesk__schedule"}, "model.zendesk_source.stg_zendesk__ticket_tag": {"metadata": {"type": "table", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__ticket_tag", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "tags": {"type": "STRING", "index": 2, "name": "tags", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 417342.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 10919600.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.zendesk_source.stg_zendesk__ticket_tag"}, "model.zendesk_source.stg_zendesk__ticket_schedule": {"metadata": {"type": "table", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__ticket_schedule", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 2, "name": "created_at", "comment": null}, "schedule_id": {"type": "STRING", "index": 3, "name": "schedule_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": 0.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.zendesk_source.stg_zendesk__ticket_schedule"}, "model.zendesk_source.stg_zendesk__ticket_schedule_tmp": {"metadata": {"type": "view", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__ticket_schedule_tmp", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"_fivetran_synced": {"type": "TIMESTAMP", "index": 1, "name": "_fivetran_synced", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 2, "name": "created_at", "comment": null}, "schedule_id": {"type": "INT64", "index": 3, "name": "schedule_id", "comment": null}, "ticket_id": {"type": "INT64", "index": 4, "name": "ticket_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.zendesk_source.stg_zendesk__ticket_schedule_tmp"}, "model.zendesk_source.stg_zendesk__time_zone": {"metadata": {"type": "table", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__time_zone", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"standard_offset": {"type": "STRING", "index": 1, "name": "standard_offset", "comment": null}, "time_zone": {"type": "STRING", "index": 2, "name": "time_zone", "comment": null}, "standard_offset_minutes": {"type": "INT64", "index": 3, "name": "standard_offset_minutes", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 151.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 4035.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.zendesk_source.stg_zendesk__time_zone"}, "model.zendesk_source.stg_zendesk__time_zone_tmp": {"metadata": {"type": "view", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__time_zone_tmp", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"time_zone": {"type": "STRING", "index": 1, "name": "time_zone", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 2, "name": "_fivetran_synced", "comment": null}, "standard_offset": {"type": "STRING", "index": 3, "name": "standard_offset", "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.zendesk_source.stg_zendesk__time_zone_tmp"}, "model.zendesk_source.stg_zendesk__domain_name_tmp": {"metadata": {"type": "view", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__domain_name_tmp", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"index": {"type": "INT64", "index": 1, "name": "index", "comment": null}, "organization_id": {"type": "INT64", "index": 2, "name": "organization_id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "domain_name": {"type": "STRING", "index": 4, "name": "domain_name", "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.zendesk_source.stg_zendesk__domain_name_tmp"}, "model.zendesk_source.stg_zendesk__organization": {"metadata": {"type": "table", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__organization", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"organization_id": {"type": "INT64", "index": 1, "name": "organization_id", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 2, "name": "created_at", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 3, "name": "updated_at", "comment": null}, "details": {"type": "STRING", "index": 4, "name": "details", "comment": null}, "name": {"type": "STRING", "index": 5, "name": "name", "comment": null}, "external_id": {"type": "STRING", "index": 6, "name": "external_id", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 483724.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 21784254.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.zendesk_source.stg_zendesk__organization"}, "model.zendesk_source.stg_zendesk__group": {"metadata": {"type": "table", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__group", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"group_id": {"type": "INT64", "index": 1, "name": "group_id", "comment": null}, "name": {"type": "STRING", "index": 2, "name": "name", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 19.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 534.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.zendesk_source.stg_zendesk__group"}, "model.zendesk_source.stg_zendesk__daylight_time": {"metadata": {"type": "table", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__daylight_time", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"daylight_end_utc": {"type": "DATETIME", "index": 1, "name": "daylight_end_utc", "comment": null}, "daylight_offset": {"type": "INT64", "index": 2, "name": "daylight_offset", "comment": null}, "daylight_start_utc": {"type": "DATETIME", "index": 3, "name": "daylight_start_utc", "comment": null}, "time_zone": {"type": "STRING", "index": 4, "name": "time_zone", "comment": null}, "year": {"type": "INT64", "index": 5, "name": "year", "comment": null}, "daylight_offset_minutes": {"type": "INT64", "index": 6, "name": "daylight_offset_minutes", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 2938.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 150474.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.zendesk_source.stg_zendesk__daylight_time"}, "model.zendesk_source.stg_zendesk__ticket_tag_tmp": {"metadata": {"type": "view", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__ticket_tag_tmp", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"tag": {"type": "STRING", "index": 1, "name": "tag", "comment": null}, "ticket_id": {"type": "INT64", "index": 2, "name": "ticket_id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "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.zendesk_source.stg_zendesk__ticket_tag_tmp"}, "model.zendesk_source.stg_zendesk__schedule_tmp": {"metadata": {"type": "view", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__schedule_tmp", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"end_time": {"type": "INT64", "index": 1, "name": "end_time", "comment": null}, "id": {"type": "INT64", "index": 2, "name": "id", "comment": null}, "start_time": {"type": "INT64", "index": 3, "name": "start_time", "comment": null}, "_fivetran_deleted": {"type": "BOOL", "index": 4, "name": "_fivetran_deleted", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 5, "name": "_fivetran_synced", "comment": null}, "end_time_utc": {"type": "INT64", "index": 6, "name": "end_time_utc", "comment": null}, "name": {"type": "STRING", "index": 7, "name": "name", "comment": null}, "start_time_utc": {"type": "INT64", "index": 8, "name": "start_time_utc", "comment": null}, "time_zone": {"type": "STRING", "index": 9, "name": "time_zone", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 10, "name": "created_at", "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.zendesk_source.stg_zendesk__schedule_tmp"}, "model.zendesk_source.stg_zendesk__user_tmp": {"metadata": {"type": "view", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__user_tmp", "database": "dbt-package-testing", "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}, "active": {"type": "BOOL", "index": 3, "name": "active", "comment": null}, "alias": {"type": "STRING", "index": 4, "name": "alias", "comment": null}, "authenticity_token": {"type": "STRING", "index": 5, "name": "authenticity_token", "comment": null}, "chat_only": {"type": "BOOL", "index": 6, "name": "chat_only", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 7, "name": "created_at", "comment": null}, "custom_role_id": {"type": "INT64", "index": 8, "name": "custom_role_id", "comment": null}, "custom_test": {"type": "STRING", "index": 9, "name": "custom_test", "comment": null}, "details": {"type": "STRING", "index": 10, "name": "details", "comment": null}, "email": {"type": "STRING", "index": 11, "name": "email", "comment": null}, "external_id": {"type": "STRING", "index": 12, "name": "external_id", "comment": null}, "last_login_at": {"type": "TIMESTAMP", "index": 13, "name": "last_login_at", "comment": null}, "locale": {"type": "STRING", "index": 14, "name": "locale", "comment": null}, "locale_id": {"type": "INT64", "index": 15, "name": "locale_id", "comment": null}, "moderator": {"type": "BOOL", "index": 16, "name": "moderator", "comment": null}, "name": {"type": "STRING", "index": 17, "name": "name", "comment": null}, "notes": {"type": "STRING", "index": 18, "name": "notes", "comment": null}, "only_private_comments": {"type": "BOOL", "index": 19, "name": "only_private_comments", "comment": null}, "organization_id": {"type": "INT64", "index": 20, "name": "organization_id", "comment": null}, "phone": {"type": "STRING", "index": 21, "name": "phone", "comment": null}, "remote_photo_url": {"type": "STRING", "index": 22, "name": "remote_photo_url", "comment": null}, "restricted_agent": {"type": "BOOL", "index": 23, "name": "restricted_agent", "comment": null}, "role": {"type": "STRING", "index": 24, "name": "role", "comment": null}, "shared": {"type": "BOOL", "index": 25, "name": "shared", "comment": null}, "shared_agent": {"type": "BOOL", "index": 26, "name": "shared_agent", "comment": null}, "signature": {"type": "STRING", "index": 27, "name": "signature", "comment": null}, "suspended": {"type": "BOOL", "index": 28, "name": "suspended", "comment": null}, "ticket_restriction": {"type": "STRING", "index": 29, "name": "ticket_restriction", "comment": null}, "time_zone": {"type": "STRING", "index": 30, "name": "time_zone", "comment": null}, "two_factor_auth_enabled": {"type": "BOOL", "index": 31, "name": "two_factor_auth_enabled", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 32, "name": "updated_at", "comment": null}, "url": {"type": "STRING", "index": 33, "name": "url", "comment": null}, "verified": {"type": "BOOL", "index": 34, "name": "verified", "comment": null}, "custom_test_user_field": {"type": "STRING", "index": 35, "name": "custom_test_user_field", "comment": null}, "custom_birthday": {"type": "TIMESTAMP", "index": 36, "name": "custom_birthday", "comment": null}, "custom_int": {"type": "STRING", "index": 37, "name": "custom_int", "comment": null}, "custom_integrations": {"type": "STRING", "index": 38, "name": "custom_integrations", "comment": null}, "custom_account": {"type": "STRING", "index": 39, "name": "custom_account", "comment": null}, "custom_group": {"type": "STRING", "index": 40, "name": "custom_group", "comment": null}, "custom_fivetran_account_id": {"type": "STRING", "index": 41, "name": "custom_fivetran_account_id", "comment": null}, "custom_fivetran_group_id": {"type": "STRING", "index": 42, "name": "custom_fivetran_group_id", "comment": null}, "custom_fivetran_user_id": {"type": "STRING", "index": 43, "name": "custom_fivetran_user_id", "comment": null}, "custom_fivetran_group_name": {"type": "STRING", "index": 44, "name": "custom_fivetran_group_name", "comment": null}, "custom_fivetran_destination_type": {"type": "STRING", "index": 45, "name": "custom_fivetran_destination_type", "comment": null}, "custom_fivetran_account_status": {"type": "STRING", "index": 46, "name": "custom_fivetran_account_status", "comment": null}, "iana_time_zone": {"type": "STRING", "index": 47, "name": "iana_time_zone", "comment": null}, "report_csv": {"type": "BOOL", "index": 48, "name": "report_csv", "comment": null}, "default_group_id": {"type": "INT64", "index": 49, "name": "default_group_id", "comment": null}, "custom_fivetran_account_name": {"type": "STRING", "index": 50, "name": "custom_fivetran_account_name", "comment": null}, "custom_hvr_customer": {"type": "BOOL", "index": 51, "name": "custom_hvr_customer", "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.zendesk_source.stg_zendesk__user_tmp"}, "model.zendesk_source.stg_zendesk__daylight_time_tmp": {"metadata": {"type": "view", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__daylight_time_tmp", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"time_zone": {"type": "STRING", "index": 1, "name": "time_zone", "comment": null}, "year": {"type": "INT64", "index": 2, "name": "year", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "daylight_end_utc": {"type": "DATETIME", "index": 4, "name": "daylight_end_utc", "comment": null}, "daylight_offset": {"type": "INT64", "index": 5, "name": "daylight_offset", "comment": null}, "daylight_start_utc": {"type": "DATETIME", "index": 6, "name": "daylight_start_utc", "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.zendesk_source.stg_zendesk__daylight_time_tmp"}, "model.zendesk_source.stg_zendesk__organization_tag_tmp": {"metadata": {"type": "view", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__organization_tag_tmp", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"organization_id": {"type": "INT64", "index": 1, "name": "organization_id", "comment": null}, "tag": {"type": "STRING", "index": 2, "name": "tag", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "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.zendesk_source.stg_zendesk__organization_tag_tmp"}, "model.zendesk_source.stg_zendesk__group_tmp": {"metadata": {"type": "view", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__group_tmp", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"id": {"type": "INT64", "index": 1, "name": "id", "comment": null}, "_fivetran_deleted": {"type": "BOOL", "index": 2, "name": "_fivetran_deleted", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 4, "name": "created_at", "comment": null}, "name": {"type": "STRING", "index": 5, "name": "name", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 6, "name": "updated_at", "comment": null}, "url": {"type": "STRING", "index": 7, "name": "url", "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.zendesk_source.stg_zendesk__group_tmp"}, "model.zendesk_source.stg_zendesk__ticket": {"metadata": {"type": "table", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__ticket", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"ticket_id": {"type": "INT64", "index": 1, "name": "ticket_id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 2, "name": "_fivetran_synced", "comment": null}, "assignee_id": {"type": "INT64", "index": 3, "name": "assignee_id", "comment": null}, "brand_id": {"type": "INT64", "index": 4, "name": "brand_id", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 5, "name": "created_at", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 6, "name": "updated_at", "comment": null}, "description": {"type": "STRING", "index": 7, "name": "description", "comment": null}, "due_at": {"type": "TIMESTAMP", "index": 8, "name": "due_at", "comment": null}, "group_id": {"type": "INT64", "index": 9, "name": "group_id", "comment": null}, "external_id": {"type": "STRING", "index": 10, "name": "external_id", "comment": null}, "is_public": {"type": "BOOL", "index": 11, "name": "is_public", "comment": null}, "organization_id": {"type": "INT64", "index": 12, "name": "organization_id", "comment": null}, "priority": {"type": "STRING", "index": 13, "name": "priority", "comment": null}, "recipient": {"type": "STRING", "index": 14, "name": "recipient", "comment": null}, "requester_id": {"type": "INT64", "index": 15, "name": "requester_id", "comment": null}, "status": {"type": "STRING", "index": 16, "name": "status", "comment": null}, "subject": {"type": "STRING", "index": 17, "name": "subject", "comment": null}, "problem_id": {"type": "INT64", "index": 18, "name": "problem_id", "comment": null}, "submitter_id": {"type": "INT64", "index": 19, "name": "submitter_id", "comment": null}, "ticket_form_id": {"type": "INT64", "index": 20, "name": "ticket_form_id", "comment": null}, "type": {"type": "STRING", "index": 21, "name": "type", "comment": null}, "url": {"type": "STRING", "index": 22, "name": "url", "comment": null}, "created_channel": {"type": "STRING", "index": 23, "name": "created_channel", "comment": null}, "source_from_id": {"type": "INT64", "index": 24, "name": "source_from_id", "comment": null}, "source_from_title": {"type": "STRING", "index": 25, "name": "source_from_title", "comment": null}, "source_rel": {"type": "STRING", "index": 26, "name": "source_rel", "comment": null}, "source_to_address": {"type": "STRING", "index": 27, "name": "source_to_address", "comment": null}, "source_to_name": {"type": "STRING", "index": 28, "name": "source_to_name", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 50892.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 37963951.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.zendesk_source.stg_zendesk__ticket"}, "model.zendesk_source.stg_zendesk__organization_tmp": {"metadata": {"type": "view", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__organization_tmp", "database": "dbt-package-testing", "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}, "created_at": {"type": "TIMESTAMP", "index": 3, "name": "created_at", "comment": null}, "custom_account_id": {"type": "STRING", "index": 4, "name": "custom_account_id", "comment": null}, "custom_account_owner": {"type": "STRING", "index": 5, "name": "custom_account_owner", "comment": null}, "custom_account_owner_email": {"type": "STRING", "index": 6, "name": "custom_account_owner_email", "comment": null}, "custom_funnel_stage": {"type": "STRING", "index": 7, "name": "custom_funnel_stage", "comment": null}, "custom_last_modified_date": {"type": "TIMESTAMP", "index": 8, "name": "custom_last_modified_date", "comment": null}, "custom_type": {"type": "STRING", "index": 9, "name": "custom_type", "comment": null}, "details": {"type": "STRING", "index": 10, "name": "details", "comment": null}, "external_id": {"type": "STRING", "index": 11, "name": "external_id", "comment": null}, "group_id": {"type": "INT64", "index": 12, "name": "group_id", "comment": null}, "name": {"type": "STRING", "index": 13, "name": "name", "comment": null}, "notes": {"type": "STRING", "index": 14, "name": "notes", "comment": null}, "shared_comments": {"type": "BOOL", "index": 15, "name": "shared_comments", "comment": null}, "shared_tickets": {"type": "BOOL", "index": 16, "name": "shared_tickets", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 17, "name": "updated_at", "comment": null}, "url": {"type": "STRING", "index": 18, "name": "url", "comment": null}, "custom_assigned_se": {"type": "STRING", "index": 19, "name": "custom_assigned_se", "comment": null}, "custom_sync_with_salesforce": {"type": "BOOL", "index": 20, "name": "custom_sync_with_salesforce", "comment": null}, "custom_partner_type": {"type": "STRING", "index": 21, "name": "custom_partner_type", "comment": null}, "custom_partner_tier": {"type": "STRING", "index": 22, "name": "custom_partner_tier", "comment": null}, "custom_platform_level": {"type": "STRING", "index": 23, "name": "custom_platform_level", "comment": null}, "custom_last_sync_time": {"type": "TIMESTAMP", "index": 24, "name": "custom_last_sync_time", "comment": null}, "custom_account_status": {"type": "STRING", "index": 25, "name": "custom_account_status", "comment": null}, "custom_health_score": {"type": "FLOAT64", "index": 26, "name": "custom_health_score", "comment": null}, "custom_region": {"type": "STRING", "index": 27, "name": "custom_region", "comment": null}, "custom_segment": {"type": "STRING", "index": 28, "name": "custom_segment", "comment": null}, "custom_customer_type": {"type": "STRING", "index": 29, "name": "custom_customer_type", "comment": null}, "custom_first_won_date": {"type": "TIMESTAMP", "index": 30, "name": "custom_first_won_date", "comment": null}, "custom_assigned_tsm_email": {"type": "STRING", "index": 31, "name": "custom_assigned_tsm_email", "comment": null}, "custom_us_only_support": {"type": "BOOL", "index": 32, "name": "custom_us_only_support", "comment": null}, "custom_account_level": {"type": "STRING", "index": 33, "name": "custom_account_level", "comment": null}, "custom_vip_org": {"type": "BOOL", "index": 34, "name": "custom_vip_org", "comment": null}, "custom_bcf": {"type": "BOOL", "index": 35, "name": "custom_bcf", "comment": null}, "custom_pbf_account": {"type": "BOOL", "index": 36, "name": "custom_pbf_account", "comment": null}, "custom_hvr_update": {"type": "BOOL", "index": 37, "name": "custom_hvr_update", "comment": null}, "custom_hvr_migrated_account": {"type": "BOOL", "index": 38, "name": "custom_hvr_migrated_account", "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.zendesk_source.stg_zendesk__organization_tmp"}, "model.zendesk_source.stg_zendesk__ticket_comment_tmp": {"metadata": {"type": "view", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__ticket_comment_tmp", "database": "dbt-package-testing", "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}, "body": {"type": "STRING", "index": 3, "name": "body", "comment": null}, "created": {"type": "TIMESTAMP", "index": 4, "name": "created", "comment": null}, "facebook_comment": {"type": "BOOL", "index": 5, "name": "facebook_comment", "comment": null}, "public": {"type": "BOOL", "index": 6, "name": "public", "comment": null}, "ticket_id": {"type": "INT64", "index": 7, "name": "ticket_id", "comment": null}, "tweet": {"type": "BOOL", "index": 8, "name": "tweet", "comment": null}, "user_id": {"type": "INT64", "index": 9, "name": "user_id", "comment": null}, "voice_comment": {"type": "BOOL", "index": 10, "name": "voice_comment", "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.zendesk_source.stg_zendesk__ticket_comment_tmp"}, "model.zendesk_source.stg_zendesk__brand": {"metadata": {"type": "table", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__brand", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"brand_id": {"type": "INT64", "index": 1, "name": "brand_id", "comment": null}, "brand_url": {"type": "STRING", "index": 2, "name": "brand_url", "comment": null}, "name": {"type": "STRING", "index": 3, "name": "name", "comment": null}, "subdomain": {"type": "STRING", "index": 4, "name": "subdomain", "comment": null}, "is_active": {"type": "BOOL", "index": 5, "name": "is_active", "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": 71.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.zendesk_source.stg_zendesk__brand"}, "model.zendesk_source.stg_zendesk__domain_name": {"metadata": {"type": "table", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__domain_name", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"organization_id": {"type": "INT64", "index": 1, "name": "organization_id", "comment": null}, "domain_name": {"type": "STRING", "index": 2, "name": "domain_name", "comment": null}, "index": {"type": "INT64", "index": 3, "name": "index", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 468298.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 15042985.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.zendesk_source.stg_zendesk__domain_name"}, "model.zendesk_source.stg_zendesk__user_tag": {"metadata": {"type": "table", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__user_tag", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"user_id": {"type": "INT64", "index": 1, "name": "user_id", "comment": null}, "tags": {"type": "STRING", "index": 2, "name": "tags", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 11.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 258.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.zendesk_source.stg_zendesk__user_tag"}, "model.zendesk_source.stg_zendesk__ticket_field_history_tmp": {"metadata": {"type": "view", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__ticket_field_history_tmp", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"field_name": {"type": "STRING", "index": 1, "name": "field_name", "comment": null}, "ticket_id": {"type": "INT64", "index": 2, "name": "ticket_id", "comment": null}, "updated": {"type": "TIMESTAMP", "index": 3, "name": "updated", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 4, "name": "_fivetran_synced", "comment": null}, "user_id": {"type": "INT64", "index": 5, "name": "user_id", "comment": null}, "value": {"type": "STRING", "index": 6, "name": "value", "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.zendesk_source.stg_zendesk__ticket_field_history_tmp"}, "model.zendesk_source.stg_zendesk__brand_tmp": {"metadata": {"type": "view", "schema": "dbt_zendesk_staging", "name": "stg_zendesk__brand_tmp", "database": "dbt-package-testing", "comment": null, "owner": null}, "columns": {"id": {"type": "INT64", "index": 1, "name": "id", "comment": null}, "_fivetran_deleted": {"type": "BOOL", "index": 2, "name": "_fivetran_deleted", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "active": {"type": "BOOL", "index": 4, "name": "active", "comment": null}, "brand_url": {"type": "STRING", "index": 5, "name": "brand_url", "comment": null}, "default": {"type": "BOOL", "index": 6, "name": "default", "comment": null}, "has_help_center": {"type": "BOOL", "index": 7, "name": "has_help_center", "comment": null}, "help_center_state": {"type": "STRING", "index": 8, "name": "help_center_state", "comment": null}, "logo_content_type": {"type": "STRING", "index": 9, "name": "logo_content_type", "comment": null}, "logo_content_url": {"type": "STRING", "index": 10, "name": "logo_content_url", "comment": null}, "logo_deleted": {"type": "BOOL", "index": 11, "name": "logo_deleted", "comment": null}, "logo_file_name": {"type": "STRING", "index": 12, "name": "logo_file_name", "comment": null}, "logo_height": {"type": "INT64", "index": 13, "name": "logo_height", "comment": null}, "logo_id": {"type": "INT64", "index": 14, "name": "logo_id", "comment": null}, "logo_inline": {"type": "BOOL", "index": 15, "name": "logo_inline", "comment": null}, "logo_mapped_content_url": {"type": "STRING", "index": 16, "name": "logo_mapped_content_url", "comment": null}, "logo_size": {"type": "INT64", "index": 17, "name": "logo_size", "comment": null}, "logo_url": {"type": "STRING", "index": 18, "name": "logo_url", "comment": null}, "logo_width": {"type": "INT64", "index": 19, "name": "logo_width", "comment": null}, "name": {"type": "STRING", "index": 20, "name": "name", "comment": null}, "subdomain": {"type": "STRING", "index": 21, "name": "subdomain", "comment": null}, "url": {"type": "STRING", "index": 22, "name": "url", "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.zendesk_source.stg_zendesk__brand_tmp"}}, "sources": {"source.zendesk_source.zendesk.organization_tag": {"metadata": {"type": "table", "schema": "zendesk_new", "name": "organization_tag", "database": "db", "comment": null, "owner": null}, "columns": {"organization_id": {"type": "INT64", "index": 1, "name": "organization_id", "comment": null}, "tag": {"type": "STRING", "index": 2, "name": "tag", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 989366.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 28469239.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.zendesk_source.zendesk.organization_tag"}, "source.zendesk_source.zendesk.organization": {"metadata": {"type": "table", "schema": "zendesk_new", "name": "organization", "database": "db", "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}, "created_at": {"type": "TIMESTAMP", "index": 3, "name": "created_at", "comment": null}, "custom_account_id": {"type": "STRING", "index": 4, "name": "custom_account_id", "comment": null}, "custom_account_owner": {"type": "STRING", "index": 5, "name": "custom_account_owner", "comment": null}, "custom_account_owner_email": {"type": "STRING", "index": 6, "name": "custom_account_owner_email", "comment": null}, "custom_funnel_stage": {"type": "STRING", "index": 7, "name": "custom_funnel_stage", "comment": null}, "custom_last_modified_date": {"type": "TIMESTAMP", "index": 8, "name": "custom_last_modified_date", "comment": null}, "custom_type": {"type": "STRING", "index": 9, "name": "custom_type", "comment": null}, "details": {"type": "STRING", "index": 10, "name": "details", "comment": null}, "external_id": {"type": "STRING", "index": 11, "name": "external_id", "comment": null}, "group_id": {"type": "INT64", "index": 12, "name": "group_id", "comment": null}, "name": {"type": "STRING", "index": 13, "name": "name", "comment": null}, "notes": {"type": "STRING", "index": 14, "name": "notes", "comment": null}, "shared_comments": {"type": "BOOL", "index": 15, "name": "shared_comments", "comment": null}, "shared_tickets": {"type": "BOOL", "index": 16, "name": "shared_tickets", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 17, "name": "updated_at", "comment": null}, "url": {"type": "STRING", "index": 18, "name": "url", "comment": null}, "custom_assigned_se": {"type": "STRING", "index": 19, "name": "custom_assigned_se", "comment": null}, "custom_sync_with_salesforce": {"type": "BOOL", "index": 20, "name": "custom_sync_with_salesforce", "comment": null}, "custom_partner_type": {"type": "STRING", "index": 21, "name": "custom_partner_type", "comment": null}, "custom_partner_tier": {"type": "STRING", "index": 22, "name": "custom_partner_tier", "comment": null}, "custom_platform_level": {"type": "STRING", "index": 23, "name": "custom_platform_level", "comment": null}, "custom_last_sync_time": {"type": "TIMESTAMP", "index": 24, "name": "custom_last_sync_time", "comment": null}, "custom_account_status": {"type": "STRING", "index": 25, "name": "custom_account_status", "comment": null}, "custom_health_score": {"type": "FLOAT64", "index": 26, "name": "custom_health_score", "comment": null}, "custom_region": {"type": "STRING", "index": 27, "name": "custom_region", "comment": null}, "custom_segment": {"type": "STRING", "index": 28, "name": "custom_segment", "comment": null}, "custom_customer_type": {"type": "STRING", "index": 29, "name": "custom_customer_type", "comment": null}, "custom_first_won_date": {"type": "TIMESTAMP", "index": 30, "name": "custom_first_won_date", "comment": null}, "custom_assigned_tsm_email": {"type": "STRING", "index": 31, "name": "custom_assigned_tsm_email", "comment": null}, "custom_us_only_support": {"type": "BOOL", "index": 32, "name": "custom_us_only_support", "comment": null}, "custom_account_level": {"type": "STRING", "index": 33, "name": "custom_account_level", "comment": null}, "custom_vip_org": {"type": "BOOL", "index": 34, "name": "custom_vip_org", "comment": null}, "custom_bcf": {"type": "BOOL", "index": 35, "name": "custom_bcf", "comment": null}, "custom_pbf_account": {"type": "BOOL", "index": 36, "name": "custom_pbf_account", "comment": null}, "custom_hvr_update": {"type": "BOOL", "index": 37, "name": "custom_hvr_update", "comment": null}, "custom_hvr_migrated_account": {"type": "BOOL", "index": 38, "name": "custom_hvr_migrated_account", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 483740.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 123415719.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.zendesk_source.zendesk.organization"}, "source.zendesk_source.zendesk.time_zone": {"metadata": {"type": "table", "schema": "zendesk_new", "name": "time_zone", "database": "db", "comment": null, "owner": null}, "columns": {"time_zone": {"type": "STRING", "index": 1, "name": "time_zone", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 2, "name": "_fivetran_synced", "comment": null}, "standard_offset": {"type": "STRING", "index": 3, "name": "standard_offset", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 151.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 4035.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.zendesk_source.zendesk.time_zone"}, "source.zendesk_source.zendesk.domain_name": {"metadata": {"type": "table", "schema": "zendesk_new", "name": "domain_name", "database": "db", "comment": null, "owner": null}, "columns": {"index": {"type": "INT64", "index": 1, "name": "index", "comment": null}, "organization_id": {"type": "INT64", "index": 2, "name": "organization_id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "domain_name": {"type": "STRING", "index": 4, "name": "domain_name", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 468312.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 18789914.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.zendesk_source.zendesk.domain_name"}, "source.zendesk_source.zendesk.brand": {"metadata": {"type": "table", "schema": "zendesk_new", "name": "brand", "database": "db", "comment": null, "owner": null}, "columns": {"id": {"type": "INT64", "index": 1, "name": "id", "comment": null}, "_fivetran_deleted": {"type": "BOOL", "index": 2, "name": "_fivetran_deleted", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "active": {"type": "BOOL", "index": 4, "name": "active", "comment": null}, "brand_url": {"type": "STRING", "index": 5, "name": "brand_url", "comment": null}, "default": {"type": "BOOL", "index": 6, "name": "default", "comment": null}, "has_help_center": {"type": "BOOL", "index": 7, "name": "has_help_center", "comment": null}, "help_center_state": {"type": "STRING", "index": 8, "name": "help_center_state", "comment": null}, "logo_content_type": {"type": "STRING", "index": 9, "name": "logo_content_type", "comment": null}, "logo_content_url": {"type": "STRING", "index": 10, "name": "logo_content_url", "comment": null}, "logo_deleted": {"type": "BOOL", "index": 11, "name": "logo_deleted", "comment": null}, "logo_file_name": {"type": "STRING", "index": 12, "name": "logo_file_name", "comment": null}, "logo_height": {"type": "INT64", "index": 13, "name": "logo_height", "comment": null}, "logo_id": {"type": "INT64", "index": 14, "name": "logo_id", "comment": null}, "logo_inline": {"type": "BOOL", "index": 15, "name": "logo_inline", "comment": null}, "logo_mapped_content_url": {"type": "STRING", "index": 16, "name": "logo_mapped_content_url", "comment": null}, "logo_size": {"type": "INT64", "index": 17, "name": "logo_size", "comment": null}, "logo_url": {"type": "STRING", "index": 18, "name": "logo_url", "comment": null}, "logo_width": {"type": "INT64", "index": 19, "name": "logo_width", "comment": null}, "name": {"type": "STRING", "index": 20, "name": "name", "comment": null}, "subdomain": {"type": "STRING", "index": 21, "name": "subdomain", "comment": null}, "url": {"type": "STRING", "index": 22, "name": "url", "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": 458.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.zendesk_source.zendesk.brand"}, "source.zendesk_source.zendesk.group": {"metadata": {"type": "table", "schema": "zendesk_new", "name": "group", "database": "db", "comment": null, "owner": null}, "columns": {"id": {"type": "INT64", "index": 1, "name": "id", "comment": null}, "_fivetran_deleted": {"type": "BOOL", "index": 2, "name": "_fivetran_deleted", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 4, "name": "created_at", "comment": null}, "name": {"type": "STRING", "index": 5, "name": "name", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 6, "name": "updated_at", "comment": null}, "url": {"type": "STRING", "index": 7, "name": "url", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 37.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 4367.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.zendesk_source.zendesk.group"}, "source.zendesk_source.zendesk.daylight_time": {"metadata": {"type": "table", "schema": "zendesk_new", "name": "daylight_time", "database": "db", "comment": null, "owner": null}, "columns": {"time_zone": {"type": "STRING", "index": 1, "name": "time_zone", "comment": null}, "year": {"type": "INT64", "index": 2, "name": "year", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}, "daylight_end_utc": {"type": "DATETIME", "index": 4, "name": "daylight_end_utc", "comment": null}, "daylight_offset": {"type": "INT64", "index": 5, "name": "daylight_offset", "comment": null}, "daylight_start_utc": {"type": "DATETIME", "index": 6, "name": "daylight_start_utc", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 2938.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 150474.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.zendesk_source.zendesk.daylight_time"}, "source.zendesk_source.zendesk.ticket_field_history": {"metadata": {"type": "table", "schema": "zendesk_new", "name": "ticket_field_history", "database": "db", "comment": null, "owner": null}, "columns": {"field_name": {"type": "STRING", "index": 1, "name": "field_name", "comment": null}, "ticket_id": {"type": "INT64", "index": 2, "name": "ticket_id", "comment": null}, "updated": {"type": "TIMESTAMP", "index": 3, "name": "updated", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 4, "name": "_fivetran_synced", "comment": null}, "user_id": {"type": "INT64", "index": 5, "name": "user_id", "comment": null}, "value": {"type": "STRING", "index": 6, "name": "value", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 1554182.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 115960588.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.zendesk_source.zendesk.ticket_field_history"}, "source.zendesk_source.zendesk.user_tag": {"metadata": {"type": "table", "schema": "zendesk_new", "name": "user_tag", "database": "db", "comment": null, "owner": null}, "columns": {"tag": {"type": "STRING", "index": 1, "name": "tag", "comment": null}, "user_id": {"type": "INT64", "index": 2, "name": "user_id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 11.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 346.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.zendesk_source.zendesk.user_tag"}, "source.zendesk_source.zendesk.ticket_tag": {"metadata": {"type": "table", "schema": "zendesk_new", "name": "ticket_tag", "database": "db", "comment": null, "owner": null}, "columns": {"tag": {"type": "STRING", "index": 1, "name": "tag", "comment": null}, "ticket_id": {"type": "INT64", "index": 2, "name": "ticket_id", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 3, "name": "_fivetran_synced", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 417391.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 14260105.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.zendesk_source.zendesk.ticket_tag"}, "source.zendesk_source.zendesk.ticket_comment": {"metadata": {"type": "table", "schema": "zendesk_new", "name": "ticket_comment", "database": "db", "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}, "body": {"type": "STRING", "index": 3, "name": "body", "comment": null}, "created": {"type": "TIMESTAMP", "index": 4, "name": "created", "comment": null}, "facebook_comment": {"type": "BOOL", "index": 5, "name": "facebook_comment", "comment": null}, "public": {"type": "BOOL", "index": 6, "name": "public", "comment": null}, "ticket_id": {"type": "INT64", "index": 7, "name": "ticket_id", "comment": null}, "tweet": {"type": "BOOL", "index": 8, "name": "tweet", "comment": null}, "user_id": {"type": "INT64", "index": 9, "name": "user_id", "comment": null}, "voice_comment": {"type": "BOOL", "index": 10, "name": "voice_comment", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 550409.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 329859048.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.zendesk_source.zendesk.ticket_comment"}, "source.zendesk_source.zendesk.ticket": {"metadata": {"type": "table", "schema": "zendesk_new", "name": "ticket", "database": "db", "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}, "allow_channelback": {"type": "BOOL", "index": 3, "name": "allow_channelback", "comment": null}, "assignee_id": {"type": "INT64", "index": 4, "name": "assignee_id", "comment": null}, "brand_id": {"type": "INT64", "index": 5, "name": "brand_id", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 6, "name": "created_at", "comment": null}, "custom_additional_details": {"type": "STRING", "index": 7, "name": "custom_additional_details", "comment": null}, "custom_alternatives": {"type": "STRING", "index": 8, "name": "custom_alternatives", "comment": null}, "custom_connector": {"type": "STRING", "index": 9, "name": "custom_connector", "comment": null}, "custom_consent_to_access": {"type": "BOOL", "index": 10, "name": "custom_consent_to_access", "comment": null}, "custom_current_state": {"type": "STRING", "index": 11, "name": "custom_current_state", "comment": null}, "custom_error_messages": {"type": "STRING", "index": 12, "name": "custom_error_messages", "comment": null}, "custom_git_zen_data": {"type": "STRING", "index": 13, "name": "custom_git_zen_data", "comment": null}, "custom_origin": {"type": "STRING", "index": 14, "name": "custom_origin", "comment": null}, "custom_proposed_solution": {"type": "STRING", "index": 15, "name": "custom_proposed_solution", "comment": null}, "custom_severity": {"type": "STRING", "index": 16, "name": "custom_severity", "comment": null}, "custom_sql_query": {"type": "STRING", "index": 17, "name": "custom_sql_query", "comment": null}, "custom_steps_to_reproduce": {"type": "STRING", "index": 18, "name": "custom_steps_to_reproduce", "comment": null}, "description": {"type": "STRING", "index": 19, "name": "description", "comment": null}, "due_at": {"type": "TIMESTAMP", "index": 20, "name": "due_at", "comment": null}, "external_id": {"type": "STRING", "index": 21, "name": "external_id", "comment": null}, "forum_topic_id": {"type": "INT64", "index": 22, "name": "forum_topic_id", "comment": null}, "group_id": {"type": "INT64", "index": 23, "name": "group_id", "comment": null}, "has_incidents": {"type": "BOOL", "index": 24, "name": "has_incidents", "comment": null}, "is_public": {"type": "BOOL", "index": 25, "name": "is_public", "comment": null}, "organization_id": {"type": "INT64", "index": 26, "name": "organization_id", "comment": null}, "priority": {"type": "STRING", "index": 27, "name": "priority", "comment": null}, "problem_id": {"type": "INT64", "index": 28, "name": "problem_id", "comment": null}, "recipient": {"type": "STRING", "index": 29, "name": "recipient", "comment": null}, "requester_id": {"type": "INT64", "index": 30, "name": "requester_id", "comment": null}, "status": {"type": "STRING", "index": 31, "name": "status", "comment": null}, "subject": {"type": "STRING", "index": 32, "name": "subject", "comment": null}, "submitter_id": {"type": "INT64", "index": 33, "name": "submitter_id", "comment": null}, "system_client": {"type": "STRING", "index": 34, "name": "system_client", "comment": null}, "system_ip_address": {"type": "STRING", "index": 35, "name": "system_ip_address", "comment": null}, "system_json_email_identifier": {"type": "STRING", "index": 36, "name": "system_json_email_identifier", "comment": null}, "system_latitude": {"type": "FLOAT64", "index": 37, "name": "system_latitude", "comment": null}, "system_location": {"type": "STRING", "index": 38, "name": "system_location", "comment": null}, "system_longitude": {"type": "FLOAT64", "index": 39, "name": "system_longitude", "comment": null}, "system_message_id": {"type": "STRING", "index": 40, "name": "system_message_id", "comment": null}, "system_raw_email_identifier": {"type": "STRING", "index": 41, "name": "system_raw_email_identifier", "comment": null}, "ticket_form_id": {"type": "INT64", "index": 42, "name": "ticket_form_id", "comment": null}, "type": {"type": "STRING", "index": 43, "name": "type", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 44, "name": "updated_at", "comment": null}, "url": {"type": "STRING", "index": 45, "name": "url", "comment": null}, "via_channel": {"type": "STRING", "index": 46, "name": "via_channel", "comment": null}, "via_source_from_id": {"type": "INT64", "index": 47, "name": "via_source_from_id", "comment": null}, "via_source_from_title": {"type": "STRING", "index": 48, "name": "via_source_from_title", "comment": null}, "via_source_rel": {"type": "STRING", "index": 49, "name": "via_source_rel", "comment": null}, "via_source_to_address": {"type": "STRING", "index": 50, "name": "via_source_to_address", "comment": null}, "via_source_to_name": {"type": "STRING", "index": 51, "name": "via_source_to_name", "comment": null}, "custom_sfdc_case_": {"type": "STRING", "index": 52, "name": "custom_sfdc_case_", "comment": null}, "custom_connector_type": {"type": "STRING", "index": 53, "name": "custom_connector_type", "comment": null}, "custom_se_notes": {"type": "STRING", "index": 54, "name": "custom_se_notes", "comment": null}, "custom_warehouse_id": {"type": "STRING", "index": 55, "name": "custom_warehouse_id", "comment": null}, "custom_github_link": {"type": "STRING", "index": 56, "name": "custom_github_link", "comment": null}, "custom_classification": {"type": "STRING", "index": 57, "name": "custom_classification", "comment": null}, "custom_ticket_priority": {"type": "STRING", "index": 58, "name": "custom_ticket_priority", "comment": null}, "custom_customer_risk": {"type": "STRING", "index": 59, "name": "custom_customer_risk", "comment": null}, "system_machine_generated": {"type": "BOOL", "index": 60, "name": "system_machine_generated", "comment": null}, "custom_escalated": {"type": "BOOL", "index": 61, "name": "custom_escalated", "comment": null}, "custom_issue_escalation_notes": {"type": "STRING", "index": 62, "name": "custom_issue_escalation_notes", "comment": null}, "custom_se_manager_notes": {"type": "STRING", "index": 63, "name": "custom_se_manager_notes", "comment": null}, "custom_related_to": {"type": "STRING", "index": 64, "name": "custom_related_to", "comment": null}, "merged_ticket_ids": {"type": "STRING", "index": 65, "name": "merged_ticket_ids", "comment": null}, "custom_connector_name": {"type": "STRING", "index": 66, "name": "custom_connector_name", "comment": null}, "custom_destination_type": {"type": "STRING", "index": 67, "name": "custom_destination_type", "comment": null}, "custom_group_id": {"type": "STRING", "index": 68, "name": "custom_group_id", "comment": null}, "custom_fivetran_warehouse": {"type": "STRING", "index": 69, "name": "custom_fivetran_warehouse", "comment": null}, "custom_slack_channel_id": {"type": "STRING", "index": 70, "name": "custom_slack_channel_id", "comment": null}, "custom_ticket_quality": {"type": "BOOL", "index": 71, "name": "custom_ticket_quality", "comment": null}, "via_source_from_address": {"type": "STRING", "index": 72, "name": "via_source_from_address", "comment": null}, "custom_escalation_reason": {"type": "STRING", "index": 73, "name": "custom_escalation_reason", "comment": null}, "followup_ids": {"type": "STRING", "index": 74, "name": "followup_ids", "comment": null}, "via_followup_source_id": {"type": "INT64", "index": 75, "name": "via_followup_source_id", "comment": null}, "custom_post_id": {"type": "INT64", "index": 76, "name": "custom_post_id", "comment": null}, "custom_post_name": {"type": "STRING", "index": 77, "name": "custom_post_name", "comment": null}, "custom_post_path": {"type": "STRING", "index": 78, "name": "custom_post_path", "comment": null}, "custom_grant_access_status": {"type": "STRING", "index": 79, "name": "custom_grant_access_status", "comment": null}, "custom_grant_access_service": {"type": "STRING", "index": 80, "name": "custom_grant_access_service", "comment": null}, "custom_grant_access_scope": {"type": "STRING", "index": 81, "name": "custom_grant_access_scope", "comment": null}, "custom_grant_access_schema": {"type": "STRING", "index": 82, "name": "custom_grant_access_schema", "comment": null}, "custom_grant_access_group": {"type": "STRING", "index": 83, "name": "custom_grant_access_group", "comment": null}, "custom_grant_access_expiration": {"type": "STRING", "index": 84, "name": "custom_grant_access_expiration", "comment": null}, "custom_grant_access_approved_at": {"type": "STRING", "index": 85, "name": "custom_grant_access_approved_at", "comment": null}, "custom_grant_access_group_name": {"type": "STRING", "index": 86, "name": "custom_grant_access_group_name", "comment": null}, "custom_grant_access_revoked_at": {"type": "STRING", "index": 87, "name": "custom_grant_access_revoked_at", "comment": null}, "custom_bug_sub_category": {"type": "STRING", "index": 88, "name": "custom_bug_sub_category", "comment": null}, "custom_fivetran_group_name": {"type": "STRING", "index": 89, "name": "custom_fivetran_group_name", "comment": null}, "custom_fivetran_destination_type": {"type": "STRING", "index": 90, "name": "custom_fivetran_destination_type", "comment": null}, "custom_subcategory_bug": {"type": "STRING", "index": 91, "name": "custom_subcategory_bug", "comment": null}, "custom_sub_classification_bug": {"type": "STRING", "index": 92, "name": "custom_sub_classification_bug", "comment": null}, "custom_sub_classification_data_integrity": {"type": "STRING", "index": 93, "name": "custom_sub_classification_data_integrity", "comment": null}, "custom_sub_classification_account_management": {"type": "STRING", "index": 94, "name": "custom_sub_classification_account_management", "comment": null}, "custom_sub_classification_other": {"type": "STRING", "index": 95, "name": "custom_sub_classification_other", "comment": null}, "custom_sub_classification_sync_issue": {"type": "STRING", "index": 96, "name": "custom_sub_classification_sync_issue", "comment": null}, "custom_sub_classification_education_needed": {"type": "STRING", "index": 97, "name": "custom_sub_classification_education_needed", "comment": null}, "custom_sub_classification_connector_issue": {"type": "STRING", "index": 98, "name": "custom_sub_classification_connector_issue", "comment": null}, "custom_sub_classification_network_security": {"type": "STRING", "index": 99, "name": "custom_sub_classification_network_security", "comment": null}, "custom_sub_classification_incident": {"type": "STRING", "index": 100, "name": "custom_sub_classification_incident", "comment": null}, "custom_sub_classification_feature_flag": {"type": "STRING", "index": 101, "name": "custom_sub_classification_feature_flag", "comment": null}, "custom_sub_classification_fivetran_platform": {"type": "STRING", "index": 102, "name": "custom_sub_classification_fivetran_platform", "comment": null}, "custom_sub_classification_destination_issue": {"type": "STRING", "index": 103, "name": "custom_sub_classification_destination_issue", "comment": null}, "custom_sub_classification_transformations": {"type": "STRING", "index": 104, "name": "custom_sub_classification_transformations", "comment": null}, "custom_sub_classification_billing": {"type": "STRING", "index": 105, "name": "custom_sub_classification_billing", "comment": null}, "custom_sub_classification_sales_inquiry": {"type": "STRING", "index": 106, "name": "custom_sub_classification_sales_inquiry", "comment": null}, "custom_reopen": {"type": "TIMESTAMP", "index": 107, "name": "custom_reopen", "comment": null}, "custom_total_time_spent_sec_": {"type": "INT64", "index": 108, "name": "custom_total_time_spent_sec_", "comment": null}, "custom_time_spent_last_update_sec_": {"type": "INT64", "index": 109, "name": "custom_time_spent_last_update_sec_", "comment": null}, "custom_fivetran_account_status": {"type": "STRING", "index": 110, "name": "custom_fivetran_account_status", "comment": null}, "custom_snooze": {"type": "TIMESTAMP", "index": 111, "name": "custom_snooze", "comment": null}, "custom_customer_data_check": {"type": "BOOL", "index": 112, "name": "custom_customer_data_check", "comment": null}, "custom_screenshot_of_connector_s_setup_page_included": {"type": "BOOL", "index": 113, "name": "custom_screenshot_of_connector_s_setup_page_included", "comment": null}, "custom_on_hold_reason_": {"type": "STRING", "index": 114, "name": "custom_on_hold_reason_", "comment": null}, "custom_request_type_": {"type": "STRING", "index": 115, "name": "custom_request_type_", "comment": null}, "custom_screenshot_of_transformation_setup_page_included": {"type": "BOOL", "index": 116, "name": "custom_screenshot_of_transformation_setup_page_included", "comment": null}, "custom_account_level": {"type": "STRING", "index": 117, "name": "custom_account_level", "comment": null}, "custom_pbf_": {"type": "STRING", "index": 118, "name": "custom_pbf_", "comment": null}, "custom_reported_severity_": {"type": "STRING", "index": 119, "name": "custom_reported_severity_", "comment": null}, "custom_error_shown_in_connector_s_setup_page_": {"type": "STRING", "index": 120, "name": "custom_error_shown_in_connector_s_setup_page_", "comment": null}, "custom_details_of_issue_with_alert_shown_in_connector_s_dashboard_": {"type": "STRING", "index": 121, "name": "custom_details_of_issue_with_alert_shown_in_connector_s_dashboard_", "comment": null}, "custom_query_used_to_verify_data_integrity_": {"type": "STRING", "index": 122, "name": "custom_query_used_to_verify_data_integrity_", "comment": null}, "custom_unique_ids_for_source_records_not_showing_": {"type": "STRING", "index": 123, "name": "custom_unique_ids_for_source_records_not_showing_", "comment": null}, "custom_number_of_end_customers_impacted_due_to_inquiry_": {"type": "STRING", "index": 124, "name": "custom_number_of_end_customers_impacted_due_to_inquiry_", "comment": null}, "custom_error_shown_in_logs_status_bar_in_connector_s_dashboard_": {"type": "STRING", "index": 125, "name": "custom_error_shown_in_logs_status_bar_in_connector_s_dashboard_", "comment": null}, "custom_name_of_schema_table_column_seen_in_source_not_showing_in_the_destination_": {"type": "STRING", "index": 126, "name": "custom_name_of_schema_table_column_seen_in_source_not_showing_in_the_destination_", "comment": null}, "custom_steps_taken_that_lead_to_ui_error_": {"type": "STRING", "index": 127, "name": "custom_steps_taken_that_lead_to_ui_error_", "comment": null}, "custom_user_s_email_address_and_current_role_": {"type": "STRING", "index": 128, "name": "custom_user_s_email_address_and_current_role_", "comment": null}, "custom_estimated_number_of_records_of_mar_dispute_": {"type": "STRING", "index": 129, "name": "custom_estimated_number_of_records_of_mar_dispute_", "comment": null}, "custom_reasoning_for_mar_dispute_": {"type": "STRING", "index": 130, "name": "custom_reasoning_for_mar_dispute_", "comment": null}, "custom_date_range_of_mar_dispute_": {"type": "STRING", "index": 131, "name": "custom_date_range_of_mar_dispute_", "comment": null}, "custom_support_case_numbers_related_to_mar_dispute_": {"type": "STRING", "index": 132, "name": "custom_support_case_numbers_related_to_mar_dispute_", "comment": null}, "custom_type_of_ssh_setup_being_used_": {"type": "STRING", "index": 133, "name": "custom_type_of_ssh_setup_being_used_", "comment": null}, "custom_ticket_note_": {"type": "STRING", "index": 134, "name": "custom_ticket_note_", "comment": null}, "custom_support_case_numbers_related_to_sla_dispute_": {"type": "STRING", "index": 135, "name": "custom_support_case_numbers_related_to_sla_dispute_", "comment": null}, "custom_estimated_number_of_records_of_sla_dispute_": {"type": "INT64", "index": 136, "name": "custom_estimated_number_of_records_of_sla_dispute_", "comment": null}, "custom_date_range_of_sla_dispute_": {"type": "STRING", "index": 137, "name": "custom_date_range_of_sla_dispute_", "comment": null}, "custom_reasoning_for_sla_dispute_": {"type": "STRING", "index": 138, "name": "custom_reasoning_for_sla_dispute_", "comment": null}, "custom_security_request_type_": {"type": "STRING", "index": 139, "name": "custom_security_request_type_", "comment": null}, "custom_account_id": {"type": "STRING", "index": 140, "name": "custom_account_id", "comment": null}, "custom_grant_access_account_name": {"type": "STRING", "index": 141, "name": "custom_grant_access_account_name", "comment": null}, "custom_account_name": {"type": "STRING", "index": 142, "name": "custom_account_name", "comment": null}, "custom_grant_access_account": {"type": "STRING", "index": 143, "name": "custom_grant_access_account", "comment": null}, "custom_snooze_state": {"type": "STRING", "index": 144, "name": "custom_snooze_state", "comment": null}, "custom_snoozed_until": {"type": "STRING", "index": 145, "name": "custom_snoozed_until", "comment": null}, "custom_on_hold_reason_security_": {"type": "STRING", "index": 146, "name": "custom_on_hold_reason_security_", "comment": null}, "custom_classification_old": {"type": "STRING", "index": 147, "name": "custom_classification_old", "comment": null}, "custom_sub_classification_data_integrity_old": {"type": "STRING", "index": 148, "name": "custom_sub_classification_data_integrity_old", "comment": null}, "custom_sub_classification_sync_issue_old": {"type": "STRING", "index": 149, "name": "custom_sub_classification_sync_issue_old", "comment": null}, "custom_reason_for_ticket_creation_classification_": {"type": "STRING", "index": 150, "name": "custom_reason_for_ticket_creation_classification_", "comment": null}, "custom_sub_classification_billing_old": {"type": "STRING", "index": 151, "name": "custom_sub_classification_billing_old", "comment": null}, "custom_sub_classification_feature_flag_old": {"type": "STRING", "index": 152, "name": "custom_sub_classification_feature_flag_old", "comment": null}, "custom_sub_classification_education_needed_old": {"type": "STRING", "index": 153, "name": "custom_sub_classification_education_needed_old", "comment": null}, "custom_sub_classification_transformations_old": {"type": "STRING", "index": 154, "name": "custom_sub_classification_transformations_old", "comment": null}, "custom_sub_classification_bug_old": {"type": "STRING", "index": 155, "name": "custom_sub_classification_bug_old", "comment": null}, "custom_sub_classification_destination_issue_old": {"type": "STRING", "index": 156, "name": "custom_sub_classification_destination_issue_old", "comment": null}, "custom_resolution_description_": {"type": "STRING", "index": 157, "name": "custom_resolution_description_", "comment": null}, "custom_sub_classification_network_security_old": {"type": "STRING", "index": 158, "name": "custom_sub_classification_network_security_old", "comment": null}, "custom_sub_classification_connector_issue_old": {"type": "STRING", "index": 159, "name": "custom_sub_classification_connector_issue_old", "comment": null}, "custom_sub_classification_incident_old": {"type": "STRING", "index": 160, "name": "custom_sub_classification_incident_old", "comment": null}, "custom_sub_classification_other_old": {"type": "STRING", "index": 161, "name": "custom_sub_classification_other_old", "comment": null}, "custom_sub_classification_fivetran_platform_old": {"type": "STRING", "index": 162, "name": "custom_sub_classification_fivetran_platform_old", "comment": null}, "custom_sub_classification_account_management_old": {"type": "STRING", "index": 163, "name": "custom_sub_classification_account_management_old", "comment": null}, "custom_sub_classification_sales_inquiry_old": {"type": "STRING", "index": 164, "name": "custom_sub_classification_sales_inquiry_old", "comment": null}, "custom_logs_improvement_note": {"type": "STRING", "index": 165, "name": "custom_logs_improvement_note", "comment": null}, "custom_logs_improvement": {"type": "STRING", "index": 166, "name": "custom_logs_improvement", "comment": null}, "custom_hub_os_": {"type": "STRING", "index": 167, "name": "custom_hub_os_", "comment": null}, "custom_environment_": {"type": "STRING", "index": 168, "name": "custom_environment_", "comment": null}, "custom_source_os_": {"type": "STRING", "index": 169, "name": "custom_source_os_", "comment": null}, "custom_target_os_": {"type": "STRING", "index": 170, "name": "custom_target_os_", "comment": null}, "custom_source_": {"type": "STRING", "index": 171, "name": "custom_source_", "comment": null}, "custom_source_dbms_": {"type": "STRING", "index": 172, "name": "custom_source_dbms_", "comment": null}, "custom_target_dbms_": {"type": "STRING", "index": 173, "name": "custom_target_dbms_", "comment": null}, "custom_hub_dbms_": {"type": "STRING", "index": 174, "name": "custom_hub_dbms_", "comment": null}, "custom_hub_": {"type": "STRING", "index": 175, "name": "custom_hub_", "comment": null}, "custom_target_": {"type": "STRING", "index": 176, "name": "custom_target_", "comment": null}, "custom_reason_for_ticket_classification_": {"type": "STRING", "index": 177, "name": "custom_reason_for_ticket_classification_", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 50897.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 58380307.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.zendesk_source.zendesk.ticket"}, "source.zendesk_source.zendesk.user": {"metadata": {"type": "table", "schema": "zendesk_new", "name": "user", "database": "db", "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}, "active": {"type": "BOOL", "index": 3, "name": "active", "comment": null}, "alias": {"type": "STRING", "index": 4, "name": "alias", "comment": null}, "authenticity_token": {"type": "STRING", "index": 5, "name": "authenticity_token", "comment": null}, "chat_only": {"type": "BOOL", "index": 6, "name": "chat_only", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 7, "name": "created_at", "comment": null}, "custom_role_id": {"type": "INT64", "index": 8, "name": "custom_role_id", "comment": null}, "custom_test": {"type": "STRING", "index": 9, "name": "custom_test", "comment": null}, "details": {"type": "STRING", "index": 10, "name": "details", "comment": null}, "email": {"type": "STRING", "index": 11, "name": "email", "comment": null}, "external_id": {"type": "STRING", "index": 12, "name": "external_id", "comment": null}, "last_login_at": {"type": "TIMESTAMP", "index": 13, "name": "last_login_at", "comment": null}, "locale": {"type": "STRING", "index": 14, "name": "locale", "comment": null}, "locale_id": {"type": "INT64", "index": 15, "name": "locale_id", "comment": null}, "moderator": {"type": "BOOL", "index": 16, "name": "moderator", "comment": null}, "name": {"type": "STRING", "index": 17, "name": "name", "comment": null}, "notes": {"type": "STRING", "index": 18, "name": "notes", "comment": null}, "only_private_comments": {"type": "BOOL", "index": 19, "name": "only_private_comments", "comment": null}, "organization_id": {"type": "INT64", "index": 20, "name": "organization_id", "comment": null}, "phone": {"type": "STRING", "index": 21, "name": "phone", "comment": null}, "remote_photo_url": {"type": "STRING", "index": 22, "name": "remote_photo_url", "comment": null}, "restricted_agent": {"type": "BOOL", "index": 23, "name": "restricted_agent", "comment": null}, "role": {"type": "STRING", "index": 24, "name": "role", "comment": null}, "shared": {"type": "BOOL", "index": 25, "name": "shared", "comment": null}, "shared_agent": {"type": "BOOL", "index": 26, "name": "shared_agent", "comment": null}, "signature": {"type": "STRING", "index": 27, "name": "signature", "comment": null}, "suspended": {"type": "BOOL", "index": 28, "name": "suspended", "comment": null}, "ticket_restriction": {"type": "STRING", "index": 29, "name": "ticket_restriction", "comment": null}, "time_zone": {"type": "STRING", "index": 30, "name": "time_zone", "comment": null}, "two_factor_auth_enabled": {"type": "BOOL", "index": 31, "name": "two_factor_auth_enabled", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 32, "name": "updated_at", "comment": null}, "url": {"type": "STRING", "index": 33, "name": "url", "comment": null}, "verified": {"type": "BOOL", "index": 34, "name": "verified", "comment": null}, "custom_test_user_field": {"type": "STRING", "index": 35, "name": "custom_test_user_field", "comment": null}, "custom_birthday": {"type": "TIMESTAMP", "index": 36, "name": "custom_birthday", "comment": null}, "custom_int": {"type": "STRING", "index": 37, "name": "custom_int", "comment": null}, "custom_integrations": {"type": "STRING", "index": 38, "name": "custom_integrations", "comment": null}, "custom_account": {"type": "STRING", "index": 39, "name": "custom_account", "comment": null}, "custom_group": {"type": "STRING", "index": 40, "name": "custom_group", "comment": null}, "custom_fivetran_account_id": {"type": "STRING", "index": 41, "name": "custom_fivetran_account_id", "comment": null}, "custom_fivetran_group_id": {"type": "STRING", "index": 42, "name": "custom_fivetran_group_id", "comment": null}, "custom_fivetran_user_id": {"type": "STRING", "index": 43, "name": "custom_fivetran_user_id", "comment": null}, "custom_fivetran_group_name": {"type": "STRING", "index": 44, "name": "custom_fivetran_group_name", "comment": null}, "custom_fivetran_destination_type": {"type": "STRING", "index": 45, "name": "custom_fivetran_destination_type", "comment": null}, "custom_fivetran_account_status": {"type": "STRING", "index": 46, "name": "custom_fivetran_account_status", "comment": null}, "iana_time_zone": {"type": "STRING", "index": 47, "name": "iana_time_zone", "comment": null}, "report_csv": {"type": "BOOL", "index": 48, "name": "report_csv", "comment": null}, "default_group_id": {"type": "INT64", "index": 49, "name": "default_group_id", "comment": null}, "custom_fivetran_account_name": {"type": "STRING", "index": 50, "name": "custom_fivetran_account_name", "comment": null}, "custom_hvr_customer": {"type": "BOOL", "index": 51, "name": "custom_hvr_customer", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 52856.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 12635310.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.zendesk_source.zendesk.user"}, "source.zendesk_source.zendesk.schedule": {"metadata": {"type": "table", "schema": "zendesk_new", "name": "schedule", "database": "db", "comment": null, "owner": null}, "columns": {"end_time": {"type": "INT64", "index": 1, "name": "end_time", "comment": null}, "id": {"type": "INT64", "index": 2, "name": "id", "comment": null}, "start_time": {"type": "INT64", "index": 3, "name": "start_time", "comment": null}, "_fivetran_deleted": {"type": "BOOL", "index": 4, "name": "_fivetran_deleted", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 5, "name": "_fivetran_synced", "comment": null}, "end_time_utc": {"type": "INT64", "index": 6, "name": "end_time_utc", "comment": null}, "name": {"type": "STRING", "index": 7, "name": "name", "comment": null}, "start_time_utc": {"type": "INT64", "index": 8, "name": "start_time_utc", "comment": null}, "time_zone": {"type": "STRING", "index": 9, "name": "time_zone", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 10, "name": "created_at", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 22.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 2016.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.zendesk_source.zendesk.schedule"}, "source.zendesk_source.zendesk.ticket_form_history": {"metadata": {"type": "table", "schema": "zendesk_new", "name": "ticket_form_history", "database": "db", "comment": null, "owner": null}, "columns": {"id": {"type": "INT64", "index": 1, "name": "id", "comment": null}, "updated_at": {"type": "TIMESTAMP", "index": 2, "name": "updated_at", "comment": null}, "_fivetran_deleted": {"type": "BOOL", "index": 3, "name": "_fivetran_deleted", "comment": null}, "_fivetran_synced": {"type": "TIMESTAMP", "index": 4, "name": "_fivetran_synced", "comment": null}, "active": {"type": "BOOL", "index": 5, "name": "active", "comment": null}, "created_at": {"type": "TIMESTAMP", "index": 6, "name": "created_at", "comment": null}, "display_name": {"type": "STRING", "index": 7, "name": "display_name", "comment": null}, "end_user_visible": {"type": "BOOL", "index": 8, "name": "end_user_visible", "comment": null}, "name": {"type": "STRING", "index": 9, "name": "name", "comment": null}}, "stats": {"num_rows": {"id": "num_rows", "label": "# Rows", "value": 235.0, "include": true, "description": "Approximate count of rows in this table"}, "num_bytes": {"id": "num_bytes", "label": "Approximate Size", "value": 22674.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.zendesk_source.zendesk.ticket_form_history"}}, "errors": null} \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 360349ab..0c4d0ec4 100644 --- a/docs/index.html +++ b/docs/index.html @@ -8,7 +8,7 @@ - + @@ -16,17 +16,17 @@ - + - +
icons
- diff --git a/docs/manifest.json b/docs/manifest.json index 04ba43c4..6111f04d 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -1 +1 @@ -{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v1.json", "dbt_version": "0.19.0", "generated_at": "2021-03-11T15:26:11.128045Z", "invocation_id": "ecff4bad-3dd9-4165-89b8-5ed23819450a", "env": {}, "project_id": "b8a12ac1bacdf035438fc7646299ce11", "user_id": "57178664-37b2-4047-9572-68ec8b488cd7", "send_anonymous_usage_stats": true, "adapter_type": "bigquery"}, "nodes": {"seed.zendesk_integration_tests.organization_tag_data_snowflake": {"raw_sql": "", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk_integration_tests", "organization_tag_data_snowflake"], "unique_id": "seed.zendesk_integration_tests.organization_tag_data_snowflake", "package_name": "zendesk_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests", "path": "organization_tag_data_snowflake.csv", "original_file_path": "data/organization_tag_data_snowflake.csv", "name": "organization_tag_data_snowflake", "resource_type": "seed", "alias": "organization_tag_data_snowflake", "checksum": {"name": "sha256", "checksum": "d9219b78d44b8b4620100b064a3af350fb5fa2046bdb0c376a09bade7a99f6f7"}, "config": {"enabled": true, "materialized": "seed", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {"_fivetran_synced": "timestamp"}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "quote_columns": false}, "tags": [], "refs": [], "sources": [], "depends_on": {"macros": [], "nodes": []}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"quote_columns": "{{ true if target.type == 'redshift' else false }}", "column_types": {"_fivetran_synced": "timestamp"}}, "compiled_sql": "", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`organization_tag_data_snowflake`"}, "seed.zendesk_integration_tests.organization_tag_data": {"raw_sql": "", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk_integration_tests", "organization_tag_data"], "unique_id": "seed.zendesk_integration_tests.organization_tag_data", "package_name": "zendesk_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests", "path": "organization_tag_data.csv", "original_file_path": "data/organization_tag_data.csv", "name": "organization_tag_data", "resource_type": "seed", "alias": "organization_tag_data", "checksum": {"name": "sha256", "checksum": "adebcb3827e908ab449435adc556aadf587cfad4103cab2c840d3d9fddc16e20"}, "config": {"enabled": true, "materialized": "seed", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "organization_id": "int64"}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "quote_columns": false}, "tags": [], "refs": [], "sources": [], "depends_on": {"macros": [], "nodes": []}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"quote_columns": "{{ true if target.type == 'redshift' else false }}", "column_types": {"organization_id": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "_fivetran_synced": "timestamp"}}, "compiled_sql": "", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`organization_tag_data`"}, "seed.zendesk_integration_tests.ticket_comment_data": {"raw_sql": "", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk_integration_tests", "ticket_comment_data"], "unique_id": "seed.zendesk_integration_tests.ticket_comment_data", "package_name": "zendesk_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests", "path": "ticket_comment_data.csv", "original_file_path": "data/ticket_comment_data.csv", "name": "ticket_comment_data", "resource_type": "seed", "alias": "ticket_comment_data", "checksum": {"name": "sha256", "checksum": "033e18229b848b4809699f04f39605771faf437e583a1aefe1af5625f0ac7de5"}, "config": {"enabled": true, "materialized": "seed", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "id": "int64", "user_id": "int64", "created": "timestamp"}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "quote_columns": false}, "tags": [], "refs": [], "sources": [], "depends_on": {"macros": [], "nodes": []}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"quote_columns": "{{ true if target.type == 'redshift' else false }}", "column_types": {"id": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "user_id": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "created": "timestamp"}}, "compiled_sql": "", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`ticket_comment_data`"}, "seed.zendesk_integration_tests.brand_data": {"raw_sql": "", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk_integration_tests", "brand_data"], "unique_id": "seed.zendesk_integration_tests.brand_data", "package_name": "zendesk_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests", "path": "brand_data.csv", "original_file_path": "data/brand_data.csv", "name": "brand_data", "resource_type": "seed", "alias": "brand_data", "checksum": {"name": "sha256", "checksum": "203980ef5845715ee0758982a85b96a30c8e4b06fbda7f104705bd4cdd586aa9"}, "config": {"enabled": true, "materialized": "seed", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "id": "int64"}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "quote_columns": false}, "tags": [], "refs": [], "sources": [], "depends_on": {"macros": [], "nodes": []}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"quote_columns": "{{ true if target.type == 'redshift' else false }}", "column_types": {"id": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "_fivetran_synced": "timestamp"}}, "compiled_sql": "", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`brand_data`"}, "seed.zendesk_integration_tests.domain_name_data": {"raw_sql": "", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk_integration_tests", "domain_name_data"], "unique_id": "seed.zendesk_integration_tests.domain_name_data", "package_name": "zendesk_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests", "path": "domain_name_data.csv", "original_file_path": "data/domain_name_data.csv", "name": "domain_name_data", "resource_type": "seed", "alias": "domain_name_data", "checksum": {"name": "sha256", "checksum": "3bf711417f9269957353aa9e1ddd28ada8bd74e03128a4b8c94e694a560a09cf"}, "config": {"enabled": true, "materialized": "seed", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "organization_id": "int64"}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "quote_columns": false}, "tags": [], "refs": [], "sources": [], "depends_on": {"macros": [], "nodes": []}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"quote_columns": "{{ true if target.type == 'redshift' else false }}", "column_types": {"organization_id": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "_fivetran_synced": "timestamp"}}, "compiled_sql": "", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`domain_name_data`"}, "seed.zendesk_integration_tests.user_tag_data_snowflake": {"raw_sql": "", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk_integration_tests", "user_tag_data_snowflake"], "unique_id": "seed.zendesk_integration_tests.user_tag_data_snowflake", "package_name": "zendesk_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests", "path": "user_tag_data_snowflake.csv", "original_file_path": "data/user_tag_data_snowflake.csv", "name": "user_tag_data_snowflake", "resource_type": "seed", "alias": "user_tag_data_snowflake", "checksum": {"name": "sha256", "checksum": "7c2274e05f81c1f9906a6a4a217c4493bf003a151402391069f49c64cf9ec5fb"}, "config": {"enabled": true, "materialized": "seed", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {"_fivetran_synced": "timestamp"}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "quote_columns": false}, "tags": [], "refs": [], "sources": [], "depends_on": {"macros": [], "nodes": []}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"quote_columns": "{{ true if target.type == 'redshift' else false }}", "column_types": {"_fivetran_synced": "timestamp"}}, "compiled_sql": "", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`user_tag_data_snowflake`"}, "seed.zendesk_integration_tests.ticket_field_history_data": {"raw_sql": "", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk_integration_tests", "ticket_field_history_data"], "unique_id": "seed.zendesk_integration_tests.ticket_field_history_data", "package_name": "zendesk_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests", "path": "ticket_field_history_data.csv", "original_file_path": "data/ticket_field_history_data.csv", "name": "ticket_field_history_data", "resource_type": "seed", "alias": "ticket_field_history_data", "checksum": {"name": "sha256", "checksum": "45c59dedcdf851242cac587e9fa78139af11d4fa855f366aa68175b8a65dc34e"}, "config": {"enabled": true, "materialized": "seed", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "ticket_id": "int64", "user_id": "int64", "updated": "timestamp"}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "quote_columns": false}, "tags": [], "refs": [], "sources": [], "depends_on": {"macros": [], "nodes": []}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"quote_columns": "{{ true if target.type == 'redshift' else false }}", "column_types": {"ticket_id": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "user_id": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "updated": "timestamp"}}, "compiled_sql": "", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`ticket_field_history_data`"}, "seed.zendesk_integration_tests.ticket_data": {"raw_sql": "", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk_integration_tests", "ticket_data"], "unique_id": "seed.zendesk_integration_tests.ticket_data", "package_name": "zendesk_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests", "path": "ticket_data.csv", "original_file_path": "data/ticket_data.csv", "name": "ticket_data", "resource_type": "seed", "alias": "ticket_data", "checksum": {"name": "sha256", "checksum": "38b3a717b1d25f7fb4c3b6d122f58cfdab69f036f35f22a7a873d7844a867fba"}, "config": {"enabled": true, "materialized": "seed", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "id": "int64", "created_at": "timestamp", "due_at": "timestamp", "assignee_id": "int64", "brand_id": "int64", "external_id": "int64", "forum_topic_id": "int64", "group_id": "int64", "organization_id": "int64", "problem_id": "int64", "requester_id": "int64", "submitter_id": "int64", "ticket_form_id": "int64", "type": "string"}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "quote_columns": false}, "tags": [], "refs": [], "sources": [], "depends_on": {"macros": [], "nodes": []}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"quote_columns": "{{ true if target.type == 'redshift' else false }}", "column_types": {"id": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "created_at": "timestamp", "due_at": "timestamp", "assignee_id": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "brand_id": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "external_id": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "forum_topic_id": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "group_id": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "organization_id": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "problem_id": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "requester_id": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "submitter_id": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "ticket_form_id": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "type": "{{ 'varchar(100)' if target.type == 'redshift' else 'string'}}"}}, "compiled_sql": "", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`ticket_data`"}, "seed.zendesk_integration_tests.ticket_schedule_data": {"raw_sql": "", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk_integration_tests", "ticket_schedule_data"], "unique_id": "seed.zendesk_integration_tests.ticket_schedule_data", "package_name": "zendesk_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests", "path": "ticket_schedule_data.csv", "original_file_path": "data/ticket_schedule_data.csv", "name": "ticket_schedule_data", "resource_type": "seed", "alias": "ticket_schedule_data", "checksum": {"name": "sha256", "checksum": "dc4892d18f3730242f5319bb24498d77a4c32a666b6b4d5c0eec0d4dafd7224b"}, "config": {"enabled": true, "materialized": "seed", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "ticket_id": "int64", "schedule_id": "int64", "created_at": "timestamp"}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "quote_columns": false}, "tags": [], "refs": [], "sources": [], "depends_on": {"macros": [], "nodes": []}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"quote_columns": "{{ true if target.type == 'redshift' else false }}", "column_types": {"ticket_id": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "schedule_id": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "created_at": "timestamp"}}, "compiled_sql": "", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`ticket_schedule_data`"}, "seed.zendesk_integration_tests.user_data": {"raw_sql": "", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk_integration_tests", "user_data"], "unique_id": "seed.zendesk_integration_tests.user_data", "package_name": "zendesk_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests", "path": "user_data.csv", "original_file_path": "data/user_data.csv", "name": "user_data", "resource_type": "seed", "alias": "user_data", "checksum": {"name": "sha256", "checksum": "5ff511dfd43e7fceaabfd0c4a2e36552c75c173616b9b3745c6646f37e3a78be"}, "config": {"enabled": true, "materialized": "seed", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "id": "int64", "external_id": "string", "locale_id": "int64", "organization_id": "int64", "created_at": "timestamp", "last_login_at": "timestamp"}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "quote_columns": false}, "tags": [], "refs": [], "sources": [], "depends_on": {"macros": [], "nodes": []}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"quote_columns": "{{ true if target.type == 'redshift' else false }}", "column_types": {"id": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "external_id": "{{ 'varchar(100)' if target.type == 'redshift' else 'string'}}", "locale_id": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "organization_id": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "created_at": "timestamp", "last_login_at": "timestamp"}, "enabled": "{{ true if target.type != 'snowflake' else false }}"}, "compiled_sql": "", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`user_data`"}, "seed.zendesk_integration_tests.schedule_data": {"raw_sql": "", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk_integration_tests", "schedule_data"], "unique_id": "seed.zendesk_integration_tests.schedule_data", "package_name": "zendesk_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests", "path": "schedule_data.csv", "original_file_path": "data/schedule_data.csv", "name": "schedule_data", "resource_type": "seed", "alias": "schedule_data", "checksum": {"name": "sha256", "checksum": "e2596e44df02b53d13b850f9742084141b7b75755baae603c8d3db6b8354107a"}, "config": {"enabled": true, "materialized": "seed", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "id": "int64", "end_time": "int64", "start_time": "int64", "end_time_utc": "int64", "start_time_utc": "int64", "created_at": "timestamp"}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "quote_columns": false}, "tags": [], "refs": [], "sources": [], "depends_on": {"macros": [], "nodes": []}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"quote_columns": "{{ true if target.type == 'redshift' else false }}", "column_types": {"id": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "end_time": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "start_time": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "end_time_utc": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "start_time_utc": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "created_at": "timestamp"}}, "compiled_sql": "", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`schedule_data`"}, "seed.zendesk_integration_tests.ticket_tag_data": {"raw_sql": "", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk_integration_tests", "ticket_tag_data"], "unique_id": "seed.zendesk_integration_tests.ticket_tag_data", "package_name": "zendesk_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests", "path": "ticket_tag_data.csv", "original_file_path": "data/ticket_tag_data.csv", "name": "ticket_tag_data", "resource_type": "seed", "alias": "ticket_tag_data", "checksum": {"name": "sha256", "checksum": "020b25c3247e21387702778ce0af4e5a5b8b3aee62daaa05f48c643489b57ea0"}, "config": {"enabled": true, "materialized": "seed", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {"_fivetran_synced": "timestamp"}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "quote_columns": false}, "tags": [], "refs": [], "sources": [], "depends_on": {"macros": [], "nodes": []}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"quote_columns": "{{ true if target.type == 'redshift' else false }}", "column_types": {"_fivetran_synced": "timestamp"}}, "compiled_sql": "", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`ticket_tag_data`"}, "seed.zendesk_integration_tests.organization_data": {"raw_sql": "", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk_integration_tests", "organization_data"], "unique_id": "seed.zendesk_integration_tests.organization_data", "package_name": "zendesk_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests", "path": "organization_data.csv", "original_file_path": "data/organization_data.csv", "name": "organization_data", "resource_type": "seed", "alias": "organization_data", "checksum": {"name": "sha256", "checksum": "b3e00faed1ea214f73182b110c5f55653a5b43f2bc082dcb87f6c63dea5303c3"}, "config": {"enabled": true, "materialized": "seed", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "id": "int64", "created_at": "timestamp", "updated_at": "timestamp"}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "quote_columns": false}, "tags": [], "refs": [], "sources": [], "depends_on": {"macros": [], "nodes": []}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"quote_columns": "{{ true if target.type == 'redshift' else false }}", "column_types": {"id": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "created_at": "timestamp", "updated_at": "timestamp"}}, "compiled_sql": "", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`organization_data`"}, "seed.zendesk_integration_tests.ticket_form_history_data": {"raw_sql": "", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk_integration_tests", "ticket_form_history_data"], "unique_id": "seed.zendesk_integration_tests.ticket_form_history_data", "package_name": "zendesk_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests", "path": "ticket_form_history_data.csv", "original_file_path": "data/ticket_form_history_data.csv", "name": "ticket_form_history_data", "resource_type": "seed", "alias": "ticket_form_history_data", "checksum": {"name": "sha256", "checksum": "a5b4edef05a0baa9acac87db3eea1ac0ba55865809db778ff458e20b7352c665"}, "config": {"enabled": true, "materialized": "seed", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "id": "int64"}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "quote_columns": false}, "tags": [], "refs": [], "sources": [], "depends_on": {"macros": [], "nodes": []}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"quote_columns": "{{ true if target.type == 'redshift' else false }}", "column_types": {"id": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "_fivetran_synced": "timestamp"}}, "compiled_sql": "", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`ticket_form_history_data`"}, "seed.zendesk_integration_tests.group_data": {"raw_sql": "", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk_integration_tests", "group_data"], "unique_id": "seed.zendesk_integration_tests.group_data", "package_name": "zendesk_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests", "path": "group_data.csv", "original_file_path": "data/group_data.csv", "name": "group_data", "resource_type": "seed", "alias": "group_data", "checksum": {"name": "sha256", "checksum": "ded51f1b267e9785ca862ca30656faa2485b5814d834ea35de6892702c3dbd1a"}, "config": {"enabled": true, "materialized": "seed", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "id": "int64", "created_at": "timestamp", "updated_at": "timestamp"}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "quote_columns": false}, "tags": [], "refs": [], "sources": [], "depends_on": {"macros": [], "nodes": []}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"quote_columns": "{{ true if target.type == 'redshift' else false }}", "column_types": {"id": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "created_at": "timestamp", "updated_at": "timestamp"}}, "compiled_sql": "", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`group_data`"}, "seed.zendesk_integration_tests.user_tag_data": {"raw_sql": "", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk_integration_tests", "user_tag_data"], "unique_id": "seed.zendesk_integration_tests.user_tag_data", "package_name": "zendesk_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests", "path": "user_tag_data.csv", "original_file_path": "data/user_tag_data.csv", "name": "user_tag_data", "resource_type": "seed", "alias": "user_tag_data", "checksum": {"name": "sha256", "checksum": "fde0d85263495e783fd6fb342940a4dcd67c39581d55bfc9b28935d24367a096"}, "config": {"enabled": true, "materialized": "seed", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "user_id": "int64"}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "quote_columns": false}, "tags": [], "refs": [], "sources": [], "depends_on": {"macros": [], "nodes": []}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"quote_columns": "{{ true if target.type == 'redshift' else false }}", "column_types": {"user_id": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "_fivetran_synced": "timestamp"}}, "compiled_sql": "", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`user_tag_data`"}, "model.zendesk.zendesk__ticket_enriched": {"raw_sql": "-- this model enriches the ticket table with ticket-related dimensions. This table will not include any metrics.\n-- for metrics, see ticket_metrics!\n\nwith ticket as (\n\n select *\n from {{ ref('int_zendesk__ticket_aggregates') }}\n\n--If you use using_ticket_form_history this will be included, if not it will be ignored.\n{% if var('using_ticket_form_history', True) %}\n), latest_ticket_form as (\n\n select *\n from {{ ref('int_zendesk__latest_ticket_form') }}\n{% endif %}\n\n), latest_satisfaction_ratings as (\n\n select *\n from {{ ref('int_zendesk__ticket_historical_satisfaction') }}\n\n), users as (\n\n select *\n from {{ ref('int_zendesk__user_aggregates') }}\n\n), requester_updates as (\n\n select *\n from {{ ref('int_zendesk__requester_updates') }}\n\n), assignee_updates as (\n\n select *\n from {{ ref('int_zendesk__assignee_updates') }}\n\n), ticket_group as (\n \n select *\n from {{ ref('stg_zendesk__group') }}\n\n), organization as (\n\n select *\n from {{ ref('int_zendesk__organization_aggregates') }}\n\n), joined as (\n\n select \n\n ticket.*,\n\n --If you use using_ticket_form_history this will be included, if not it will be ignored.\n {% if var('using_ticket_form_history', True) %}\n latest_ticket_form.name as ticket_form_name,\n {% endif %}\n\n latest_satisfaction_ratings.count_satisfaction_scores as ticket_total_satisfaction_scores,\n latest_satisfaction_ratings.first_satisfaction_score as ticket_first_satisfaction_score,\n latest_satisfaction_ratings.latest_satisfaction_score as ticket_satisfaction_score,\n latest_satisfaction_ratings.latest_satisfaction_comment as ticket_satisfaction_comment,\n latest_satisfaction_ratings.latest_satisfaction_reason as ticket_satisfaction_reason,\n latest_satisfaction_ratings.is_good_to_bad_satisfaction_score,\n latest_satisfaction_ratings.is_bad_to_good_satisfaction_score,\n\n --If you use using_domain_names tags this will be included, if not it will be ignored.\n {% if var('using_domain_names', True) %}\n organization.domain_names as ticket_organization_domain_names,\n requester_org.domain_names as requester_organization_domain_names,\n {% endif %}\n\n requester.external_id as requester_external_id,\n requester.created_at as requester_created_at,\n requester.updated_at as requester_updated_at,\n requester.role as requester_role,\n requester.email as requester_email,\n requester.name as requester_name,\n requester.is_active as is_requester_active,\n requester.locale as requester_locale,\n requester.time_zone as requester_time_zone,\n coalesce(requester_updates.total_updates, 0) as requester_ticket_update_count,\n requester_updates.last_updated as requester_ticket_last_update_at,\n requester.last_login_at as requester_last_login_at,\n requester.organization_id as requester_organization_id,\n requester_org.name as requester_organization_name,\n\n --If you use organization tags this will be included, if not it will be ignored.\n {% if var('using_organization_tags', True) %}\n requester_org.organization_tags as requester_organization_tags,\n {% endif %}\n requester_org.external_id as requester_organization_external_id,\n requester_org.created_at as requester_organization_created_at,\n requester_org.updated_at as requester_organization_updated_at,\n submitter.external_id as submitter_external_id,\n submitter.role as submitter_role,\n case when submitter.role in ('Agent','Admin') \n then true \n else false\n end as is_agent_submitted,\n submitter.email as submitter_email,\n submitter.name as submitter_name,\n submitter.is_active as is_submitter_active,\n submitter.locale as submitter_locale,\n submitter.time_zone as submitter_time_zone,\n assignee.external_id as assignee_external_id,\n assignee.role as assignee_role,\n assignee.email as assignee_email,\n assignee.name as assignee_name,\n assignee.is_active as is_assignee_active,\n assignee.locale as assignee_locale,\n assignee.time_zone as assignee_time_zone,\n coalesce(assignee_updates.total_updates, 0) as assignee_ticket_update_count,\n assignee_updates.last_updated as assignee_ticket_last_update_at,\n assignee.last_login_at as assignee_last_login_at,\n ticket_group.name as group_name,\n organization.name as organization_name,\n\n --If you use using_user_tags this will be included, if not it will be ignored.\n {% if var('using_user_tags', True) %}\n requester.user_tags as requester_tag,\n submitter.user_tags as submitter_tag,\n assignee.user_tags as assignee_tag\n {% endif %}\n\n \n from ticket\n\n --Requester Joins\n join users as requester\n on requester.user_id = ticket.requester_id\n\n left join organization as requester_org\n on requester_org.organization_id = requester.organization_id\n\n left join requester_updates\n on requester_updates.ticket_id = ticket.ticket_id\n and requester_updates.requester_id = ticket.requester_id\n \n --Submitter Joins\n join users as submitter\n on submitter.user_id = ticket.submitter_id\n \n --Assignee Joins\n left join users as assignee\n on assignee.user_id = ticket.assignee_id\n\n left join assignee_updates\n on assignee_updates.ticket_id = ticket.ticket_id\n and assignee_updates.assignee_id = ticket.assignee_id\n\n --Ticket, Org, and Brand Joins\n left join ticket_group\n on ticket_group.group_id = ticket.group_id\n\n --If you use using_ticket_form_history this will be included, if not it will be ignored.\n {% if var('using_ticket_form_history', True) %}\n left join latest_ticket_form\n on latest_ticket_form.ticket_form_id = ticket.ticket_form_id\n {% endif %}\n\n left join organization\n on organization.organization_id = ticket.organization_id\n\n left join latest_satisfaction_ratings\n on latest_satisfaction_ratings.ticket_id = ticket.ticket_id\n)\n\nselect *\nfrom joined", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk", "zendesk__ticket_enriched"], "unique_id": "model.zendesk.zendesk__ticket_enriched", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "zendesk__ticket_enriched.sql", "original_file_path": "models/zendesk__ticket_enriched.sql", "name": "zendesk__ticket_enriched", "resource_type": "model", "alias": "zendesk__ticket_enriched", "checksum": {"name": "sha256", "checksum": "cf5263a861f78b4c3f759e0762ec8e1af33d010d9a1713d11ae9a533f461c7b6"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["int_zendesk__ticket_aggregates"], ["int_zendesk__latest_ticket_form"], ["int_zendesk__ticket_historical_satisfaction"], ["int_zendesk__user_aggregates"], ["int_zendesk__requester_updates"], ["int_zendesk__assignee_updates"], ["stg_zendesk__group"], ["int_zendesk__organization_aggregates"]], "sources": [], "depends_on": {"macros": [], "nodes": ["model.zendesk.int_zendesk__ticket_aggregates", "model.zendesk.int_zendesk__latest_ticket_form", "model.zendesk.int_zendesk__ticket_historical_satisfaction", "model.zendesk.int_zendesk__user_aggregates", "model.zendesk.int_zendesk__requester_updates", "model.zendesk.int_zendesk__assignee_updates", "model.zendesk_source.stg_zendesk__group", "model.zendesk.int_zendesk__organization_aggregates"]}, "description": "Each record represents a Zendesk ticket, enriched with data about it's tags, assignees, requester, submitter, organization and group.", "columns": {"ticket_id": {"name": "ticket_id", "description": "Automatically assigned when the ticket is created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url": {"name": "url", "description": "The API url of this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_id": {"name": "assignee_id", "description": "The agent currently assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_role": {"name": "assignee_role", "description": "The role of the agent currently assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_email": {"name": "assignee_email", "description": "The email of the agent currently assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_name": {"name": "assignee_name", "description": "The name of the agent currently assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "brand_id": {"name": "brand_id", "description": "Enterprise only. The id of the brand this ticket is associated with", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "When this record was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "type": {"name": "type", "description": "The type of this ticket, possible values are problem, incident, question or task", "meta": {}, "data_type": null, "quote": null, "tags": []}, "subject": {"name": "subject", "description": "The value of the subject field for this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "description": {"name": "description", "description": "Read-only first comment on the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "priority": {"name": "priority", "description": "The urgency with which the ticket should be addressed, possible values are urgent, high, normal and low", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "The state of the ticket, possible values are new, open, pending, hold, solved and closed", "meta": {}, "data_type": null, "quote": null, "tags": []}, "recipient": {"name": "recipient", "description": "The original recipient e-mail address of the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_id": {"name": "requester_id", "description": "The user who requested this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_role": {"name": "requester_role", "description": "The role of the user who requested this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_email": {"name": "requester_email", "description": "The email of the user who requested this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_name": {"name": "requester_name", "description": "The name of the user who requested this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_id": {"name": "submitter_id", "description": "The user who submitted the ticket. The submitter always becomes the author of the first comment on the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_role": {"name": "submitter_role", "description": "The role of the user who submitted the ticket.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_email": {"name": "submitter_email", "description": "The email of the user who submitted the ticket.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_name": {"name": "submitter_name", "description": "The name of the user who submitted the ticket.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "organization_id": {"name": "organization_id", "description": "The organization of the requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "organization_name": {"name": "organization_name", "description": "The name of the organization of the requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "external_id": {"name": "external_id", "description": "The external id of the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "group_id": {"name": "group_id", "description": "The group this ticket is assigned to", "meta": {}, "data_type": null, "quote": null, "tags": []}, "group_name": {"name": "group_name", "description": "The name of the group this ticket is assigned to", "meta": {}, "data_type": null, "quote": null, "tags": []}, "due_at": {"name": "due_at", "description": "If this is a ticket of type \"task\" it has a due date. Due date format uses ISO 8601 format.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_form_id": {"name": "ticket_form_id", "description": "Enterprise only. The id of the ticket form to render for the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_public": {"name": "is_public", "description": "Is true if any comments are public, false otherwise", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "When this record last got updated", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_channel": {"name": "created_channel", "description": "The channel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_from_id": {"name": "source_from_id", "description": "The channel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_from_title": {"name": "source_from_title", "description": "The channel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_rel": {"name": "source_rel", "description": "The rel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_to_address": {"name": "source_to_address", "description": "The address of the source the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_to_name": {"name": "source_to_name", "description": "The name of the source the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_tags": {"name": "ticket_tags", "description": "A list of all tags assigned to this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "problem_id": {"name": "problem_id", "description": "The reference to the problem if the ticket is listed as a problem", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_incident": {"name": "is_incident", "description": "Boolean indicating whether the ticket is listed as an incident", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_brand_name": {"name": "ticket_brand_name", "description": "The brand name of with the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_form_name": {"name": "ticket_form_name", "description": "The form name of the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_satisfaction_rating": {"name": "ticket_satisfaction_rating", "description": "The ticket satisfaction rating", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_satisfaction_comment": {"name": "ticket_satisfaction_comment", "description": "The ticket satisfaction comment", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_satisfaction_reason": {"name": "ticket_satisfaction_reason", "description": "The ticket satisfaction reason", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_organization_domain_names": {"name": "ticket_organization_domain_names", "description": "The organization associated with the ticket domain names", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_organization_domain_names": {"name": "requester_organization_domain_names", "description": "The ticket requesters organization domain names", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_external_id": {"name": "requester_external_id", "description": "The ticket requester external id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_created_at": {"name": "requester_created_at", "description": "The date the ticket requester was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_updated_at": {"name": "requester_updated_at", "description": "The date the ticket requester was last updated", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_requester_active": {"name": "is_requester_active", "description": "Boolean indicating whether the requester is currently active", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_locale": {"name": "requester_locale", "description": "The locale of the ticket requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_time_zone": {"name": "requester_time_zone", "description": "The timezone of the ticket requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_ticket_update_count": {"name": "requester_ticket_update_count", "description": "The number of times the requester has updated the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_ticket_last_update_at": {"name": "requester_ticket_last_update_at", "description": "The last date the requester updated the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_last_login_at": {"name": "requester_last_login_at", "description": "The last login of the ticket requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_organization_id": {"name": "requester_organization_id", "description": "The organization id of the ticket requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_organization_name": {"name": "requester_organization_name", "description": "The organization name of the ticket requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_organization_tags": {"name": "requester_organization_tags", "description": "The organization tags of the ticket requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_organization_external_id": {"name": "requester_organization_external_id", "description": "The organization external id of the ticket requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_organization_created_at": {"name": "requester_organization_created_at", "description": "The date the ticket requesters organization was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_organization_updated_at": {"name": "requester_organization_updated_at", "description": "The date the ticket requesters organization was last updated", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_external_id": {"name": "submitter_external_id", "description": "The ticket submitter external id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_agent_submitted": {"name": "is_agent_submitted", "description": "Boolean indicating if the submitter has an agent role", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_submitter_active": {"name": "is_submitter_active", "description": "Boolean indicating if the ticket submitter is active", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_locale": {"name": "submitter_locale", "description": "The locale of the ticket submitter", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_time_zone": {"name": "submitter_time_zone", "description": "The time zone of the ticket submitter", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_external_id": {"name": "assignee_external_id", "description": "The external id of the ticket assignee", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_assignee_active": {"name": "is_assignee_active", "description": "Boolean indicating if the ticket assignee is active", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_locale": {"name": "assignee_locale", "description": "The locale of the ticket assignee", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_time_zone": {"name": "assignee_time_zone", "description": "The time zone of the ticket assignee", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_ticket_update_count": {"name": "assignee_ticket_update_count", "description": "The number of times the ticket assignee has updated the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_ticket_last_update_at": {"name": "assignee_ticket_last_update_at", "description": "The last date the ticket assignee updated the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_last_login_at": {"name": "assignee_last_login_at", "description": "The date the ticket assignee last logged in", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_tag": {"name": "requester_tag", "description": "The tags associated with the ticket requester.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_tag": {"name": "submitter_tag", "description": "The tags associated with the ticket submitter.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_tag": {"name": "assignee_tag", "description": "The tags associated with the ticket assignee.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_total_satisfaction_scores": {"name": "ticket_total_satisfaction_scores", "description": "The total number of satisfaction scores the ticket received.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_first_satisfaction_score": {"name": "ticket_first_satisfaction_score", "description": "The first satisfaction score the ticket received.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_satisfaction_score": {"name": "ticket_satisfaction_score", "description": "The latest satisfaction score the ticket received.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_good_to_bad_satisfaction_score": {"name": "is_good_to_bad_satisfaction_score", "description": "Boolean indicating if the ticket had a satisfaction score went from good to bad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_bad_to_good_satisfaction_score": {"name": "is_bad_to_good_satisfaction_score", "description": "Boolean indicating if the ticket had a satisfaction score went from bad to good.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/zendesk.yml", "build_path": "target/compiled/zendesk/models/zendesk__ticket_enriched.sql", "deferred": false, "unrendered_config": {"materialized": "table"}, "compiled_sql": "-- this model enriches the ticket table with ticket-related dimensions. This table will not include any metrics.\n-- for metrics, see ticket_metrics!\n\nwith ticket as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_aggregates`\n\n--If you use using_ticket_form_history this will be included, if not it will be ignored.\n\n), latest_ticket_form as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__latest_ticket_form`\n\n\n), latest_satisfaction_ratings as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_historical_satisfaction`\n\n), users as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__user_aggregates`\n\n), requester_updates as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__requester_updates`\n\n), assignee_updates as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__assignee_updates`\n\n), ticket_group as (\n \n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__group`\n\n), organization as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__organization_aggregates`\n\n), joined as (\n\n select \n\n ticket.*,\n\n --If you use using_ticket_form_history this will be included, if not it will be ignored.\n \n latest_ticket_form.name as ticket_form_name,\n \n\n latest_satisfaction_ratings.count_satisfaction_scores as ticket_total_satisfaction_scores,\n latest_satisfaction_ratings.first_satisfaction_score as ticket_first_satisfaction_score,\n latest_satisfaction_ratings.latest_satisfaction_score as ticket_satisfaction_score,\n latest_satisfaction_ratings.latest_satisfaction_comment as ticket_satisfaction_comment,\n latest_satisfaction_ratings.latest_satisfaction_reason as ticket_satisfaction_reason,\n latest_satisfaction_ratings.is_good_to_bad_satisfaction_score,\n latest_satisfaction_ratings.is_bad_to_good_satisfaction_score,\n\n --If you use using_domain_names tags this will be included, if not it will be ignored.\n \n organization.domain_names as ticket_organization_domain_names,\n requester_org.domain_names as requester_organization_domain_names,\n \n\n requester.external_id as requester_external_id,\n requester.created_at as requester_created_at,\n requester.updated_at as requester_updated_at,\n requester.role as requester_role,\n requester.email as requester_email,\n requester.name as requester_name,\n requester.is_active as is_requester_active,\n requester.locale as requester_locale,\n requester.time_zone as requester_time_zone,\n coalesce(requester_updates.total_updates, 0) as requester_ticket_update_count,\n requester_updates.last_updated as requester_ticket_last_update_at,\n requester.last_login_at as requester_last_login_at,\n requester.organization_id as requester_organization_id,\n requester_org.name as requester_organization_name,\n\n --If you use organization tags this will be included, if not it will be ignored.\n \n requester_org.organization_tags as requester_organization_tags,\n \n requester_org.external_id as requester_organization_external_id,\n requester_org.created_at as requester_organization_created_at,\n requester_org.updated_at as requester_organization_updated_at,\n submitter.external_id as submitter_external_id,\n submitter.role as submitter_role,\n case when submitter.role in ('Agent','Admin') \n then true \n else false\n end as is_agent_submitted,\n submitter.email as submitter_email,\n submitter.name as submitter_name,\n submitter.is_active as is_submitter_active,\n submitter.locale as submitter_locale,\n submitter.time_zone as submitter_time_zone,\n assignee.external_id as assignee_external_id,\n assignee.role as assignee_role,\n assignee.email as assignee_email,\n assignee.name as assignee_name,\n assignee.is_active as is_assignee_active,\n assignee.locale as assignee_locale,\n assignee.time_zone as assignee_time_zone,\n coalesce(assignee_updates.total_updates, 0) as assignee_ticket_update_count,\n assignee_updates.last_updated as assignee_ticket_last_update_at,\n assignee.last_login_at as assignee_last_login_at,\n ticket_group.name as group_name,\n organization.name as organization_name,\n\n --If you use using_user_tags this will be included, if not it will be ignored.\n \n requester.user_tags as requester_tag,\n submitter.user_tags as submitter_tag,\n assignee.user_tags as assignee_tag\n \n\n \n from ticket\n\n --Requester Joins\n join users as requester\n on requester.user_id = ticket.requester_id\n\n left join organization as requester_org\n on requester_org.organization_id = requester.organization_id\n\n left join requester_updates\n on requester_updates.ticket_id = ticket.ticket_id\n and requester_updates.requester_id = ticket.requester_id\n \n --Submitter Joins\n join users as submitter\n on submitter.user_id = ticket.submitter_id\n \n --Assignee Joins\n left join users as assignee\n on assignee.user_id = ticket.assignee_id\n\n left join assignee_updates\n on assignee_updates.ticket_id = ticket.ticket_id\n and assignee_updates.assignee_id = ticket.assignee_id\n\n --Ticket, Org, and Brand Joins\n left join ticket_group\n on ticket_group.group_id = ticket.group_id\n\n --If you use using_ticket_form_history this will be included, if not it will be ignored.\n \n left join latest_ticket_form\n on latest_ticket_form.ticket_form_id = ticket.ticket_form_id\n \n\n left join organization\n on organization.organization_id = ticket.organization_id\n\n left join latest_satisfaction_ratings\n on latest_satisfaction_ratings.ticket_id = ticket.ticket_id\n)\n\nselect *\nfrom joined", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`zendesk__ticket_enriched`"}, "model.zendesk.zendesk__ticket_metrics": {"raw_sql": "with ticket_enriched as (\n\n select *\n from {{ ref('zendesk__ticket_enriched') }}\n\n), ticket_resolution_times_calendar as (\n\n select *\n from {{ ref('int_zendesk__ticket_resolution_times_calendar') }}\n\n), ticket_reply_times_calendar as (\n\n select *\n from {{ ref('int_zendesk__ticket_reply_times_calendar') }}\n\n), ticket_comments as (\n\n select *\n from {{ ref('int_zendesk__comment_metrics') }}\n\n), ticket_work_time_calendar as (\n\n select *\n from {{ ref('int_zendesk__ticket_work_time_calendar') }}\n\n-- business hour CTEs\n{% if var('using_schedules', True) %}\n\n), ticket_first_resolution_time_business as (\n\n select *\n from {{ ref('int_zendesk__ticket_first_resolution_time_business') }}\n\n), ticket_full_resolution_time_business as (\n\n select *\n from {{ ref('int_zendesk__ticket_full_resolution_time_business') }}\n\n), ticket_work_time_business as (\n\n select *\n from {{ ref('int_zendesk__ticket_work_time_business') }}\n\n), ticket_first_reply_time_business as (\n\n select *\n from {{ ref('int_zendesk__ticket_first_reply_time_business') }}\n\n{% endif %}\n-- end business hour CTEs\n\n), calendar_hour_metrics as (\n\nselect\n ticket_enriched.*,\n ticket_reply_times_calendar.first_reply_time_calendar_minutes,\n ticket_reply_times_calendar.total_reply_time_calendar_minutes,\n coalesce(ticket_comments.count_agent_comments, 0) as count_agent_comments,\n coalesce(ticket_comments.count_end_user_comments, 0) as count_end_user_comments,\n coalesce(ticket_comments.count_internal_comments, 0) as count_internal_comments,\n coalesce(ticket_comments.count_public_comments, 0) as count_public_comments,\n coalesce(ticket_comments.total_comments, 0) as total_comments,\n ticket_comments.last_comment_added_at as ticket_last_comment_date,\n ticket_resolution_times_calendar.unique_assignee_count,\n ticket_resolution_times_calendar.assignee_stations_count,\n ticket_resolution_times_calendar.group_stations_count,\n ticket_resolution_times_calendar.first_assignee_id,\n ticket_resolution_times_calendar.last_assignee_id,\n ticket_resolution_times_calendar.first_agent_assignment_date,\n ticket_resolution_times_calendar.last_agent_assignment_date,\n ticket_resolution_times_calendar.first_solved_at,\n ticket_resolution_times_calendar.last_solved_at,\n ticket_resolution_times_calendar.first_assignment_to_resolution_calendar_minutes,\n ticket_resolution_times_calendar.last_assignment_to_resolution_calendar_minutes,\n ticket_resolution_times_calendar.ticket_unassigned_duration_calendar_minutes,\n ticket_resolution_times_calendar.first_resolution_calendar_minutes,\n ticket_resolution_times_calendar.final_resolution_calendar_minutes,\n ticket_resolution_times_calendar.total_resolutions as count_resolutions,\n ticket_resolution_times_calendar.count_reopens,\n ticket_work_time_calendar.ticket_deleted_count,\n ticket_work_time_calendar.total_ticket_recoveries,\n ticket_work_time_calendar.last_status_assignment_date,\n ticket_work_time_calendar.new_status_duration_in_calendar_minutes,\n ticket_work_time_calendar.open_status_duration_in_calendar_minutes,\n ticket_work_time_calendar.agent_wait_time_in_calendar_minutes,\n ticket_work_time_calendar.requester_wait_time_in_calendar_minutes,\n ticket_work_time_calendar.agent_work_time_in_calendar_minutes,\n ticket_work_time_calendar.on_hold_time_in_calendar_minutes,\n ticket_comments.count_internal_comments as total_agent_replies,\n \n case when ticket_enriched.is_requester_active = true and ticket_enriched.requester_last_login_at is not null\n then round(({{ dbt_utils.datediff(\"ticket_enriched.requester_last_login_at\", dbt_utils.current_timestamp(), 'second') }} /60),2)\n end as requester_last_login_age_minutes,\n case when ticket_enriched.is_assignee_active = true and ticket_enriched.assignee_last_login_at is not null\n then round(({{ dbt_utils.datediff(\"ticket_enriched.assignee_last_login_at\", dbt_utils.current_timestamp(), 'second') }} /60),2)\n end as assignee_last_login_age_minutes,\n case when lower(ticket_enriched.status) not in ('solved','closed')\n then round(({{ dbt_utils.datediff(\"ticket_enriched.created_at\", dbt_utils.current_timestamp(), 'second') }} /60),2)\n end as unsolved_ticket_age_minutes,\n case when lower(ticket_enriched.status) not in ('solved','closed')\n then round(({{ dbt_utils.datediff(\"ticket_enriched.updated_at\", dbt_utils.current_timestamp(), 'second') }} /60),2)\n end as unsolved_ticket_age_since_update_minutes,\n case when lower(ticket_enriched.status) in ('solved','closed') and ticket_comments.is_one_touch_resolution \n then true\n else false\n end as is_one_touch_resolution,\n case when lower(ticket_enriched.status) in ('solved','closed') and ticket_comments.is_two_touch_resolution \n then true\n else false \n end as is_two_touch_resolution,\n case when lower(ticket_enriched.status) in ('solved','closed') and not ticket_comments.is_one_touch_resolution \n then true\n else false \n end as is_multi_touch_resolution\n\n\nfrom ticket_enriched\n\nleft join ticket_reply_times_calendar\n using (ticket_id)\n\nleft join ticket_resolution_times_calendar\n using (ticket_id)\n\nleft join ticket_work_time_calendar\n using (ticket_id)\n\nleft join ticket_comments\n using(ticket_id)\n\n{% if var('using_schedules', True) %}\n\n), business_hour_metrics as (\n\n select \n ticket_enriched.ticket_id,\n ticket_first_resolution_time_business.first_resolution_business_minutes,\n ticket_full_resolution_time_business.full_resolution_business_minutes,\n ticket_first_reply_time_business.first_reply_time_business_minutes,\n ticket_work_time_business.agent_wait_time_in_business_minutes,\n ticket_work_time_business.requester_wait_time_in_business_minutes,\n ticket_work_time_business.agent_work_time_in_business_minutes,\n ticket_work_time_business.on_hold_time_in_business_minutes\n\n from ticket_enriched\n\n left join ticket_first_resolution_time_business\n using (ticket_id)\n\n left join ticket_full_resolution_time_business\n using (ticket_id)\n \n left join ticket_first_reply_time_business\n using (ticket_id) \n \n left join ticket_work_time_business\n using (ticket_id)\n\n)\n\nselect\n calendar_hour_metrics.*,\n business_hour_metrics.first_resolution_business_minutes,\n business_hour_metrics.full_resolution_business_minutes,\n business_hour_metrics.first_reply_time_business_minutes,\n business_hour_metrics.agent_wait_time_in_business_minutes,\n business_hour_metrics.requester_wait_time_in_business_minutes,\n business_hour_metrics.agent_work_time_in_business_minutes,\n business_hour_metrics.on_hold_time_in_business_minutes\n\nfrom calendar_hour_metrics\n\nleft join business_hour_metrics \n using (ticket_id)\n\n{% else %}\n\n) \n\nselect *\nfrom calendar_hour_metrics\n\n{% endif %}", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk", "zendesk__ticket_metrics"], "unique_id": "model.zendesk.zendesk__ticket_metrics", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "zendesk__ticket_metrics.sql", "original_file_path": "models/zendesk__ticket_metrics.sql", "name": "zendesk__ticket_metrics", "resource_type": "model", "alias": "zendesk__ticket_metrics", "checksum": {"name": "sha256", "checksum": "025c84a8f2b562efc6f770eb481e3722b96a1ccb1c08c6d1f0f20531d26f6bb6"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["zendesk__ticket_enriched"], ["int_zendesk__ticket_resolution_times_calendar"], ["int_zendesk__ticket_reply_times_calendar"], ["int_zendesk__comment_metrics"], ["int_zendesk__ticket_work_time_calendar"], ["int_zendesk__ticket_first_resolution_time_business"], ["int_zendesk__ticket_full_resolution_time_business"], ["int_zendesk__ticket_work_time_business"], ["int_zendesk__ticket_first_reply_time_business"]], "sources": [], "depends_on": {"macros": ["macro.dbt_utils.current_timestamp", "macro.dbt_utils.datediff"], "nodes": ["model.zendesk.zendesk__ticket_enriched", "model.zendesk.int_zendesk__ticket_resolution_times_calendar", "model.zendesk.int_zendesk__ticket_reply_times_calendar", "model.zendesk.int_zendesk__comment_metrics", "model.zendesk.int_zendesk__ticket_work_time_calendar", "model.zendesk.int_zendesk__ticket_first_resolution_time_business", "model.zendesk.int_zendesk__ticket_full_resolution_time_business", "model.zendesk.int_zendesk__ticket_work_time_business", "model.zendesk.int_zendesk__ticket_first_reply_time_business"]}, "description": "Each record represents a Zendesk ticket, enriched with metrics about reply times, resolution times and work times. Calendar and business hours are supported", "columns": {"first_reply_time_calendar_minutes": {"name": "first_reply_time_calendar_minutes", "description": "The number of calendar minutes between when the ticket was created and when the first public agent response occurred", "meta": {}, "data_type": null, "quote": null, "tags": []}, "first_reply_time_business_minutes": {"name": "first_reply_time_business_minutes", "description": "The number of business minutes between when the ticket was created and when the first public agent response occurred", "meta": {}, "data_type": null, "quote": null, "tags": []}, "total_reply_time_calendar_minutes": {"name": "total_reply_time_calendar_minutes", "description": "The combined calendar time between all end-user comments and the next public agent response", "meta": {}, "data_type": null, "quote": null, "tags": []}, "first_solved_at": {"name": "first_solved_at", "description": "The time the ticket was first in 'solved' status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "last_solved_at": {"name": "last_solved_at", "description": "The time the ticket was last in 'solved' status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "first_resolution_calendar_minutes": {"name": "first_resolution_calendar_minutes", "description": "The number of calendar minutes between the ticket created time and the time the ticket was first set to solved status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "final_resolution_calendar_minutes": {"name": "final_resolution_calendar_minutes", "description": "The number of calendar minutes between the ticket created time and the time the ticket was last set to solved status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_one_touch_resolution": {"name": "is_one_touch_resolution", "description": "A boolean field indicating that the ticket has one public agent response and is in solved status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "first_resolution_business_minutes": {"name": "first_resolution_business_minutes", "description": "The number of business minutes between the ticket created time and the time the ticket was first set to solved status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "full_resolution_business_minutes": {"name": "full_resolution_business_minutes", "description": "The number of business minutes between the ticket created time and the time the ticket was last set to solved status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "agent_wait_time_in_business_minutes": {"name": "agent_wait_time_in_business_minutes", "description": "The combined number of business minutes the ticket was in 'pending' status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_wait_time_in_business_minutes": {"name": "requester_wait_time_in_business_minutes", "description": "The combined number of business minutes the ticket was in 'new', 'open', or 'hold' status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "agent_work_time_in_business_minutes": {"name": "agent_work_time_in_business_minutes", "description": "The combined number of business minutes the ticket was in 'new' or 'open' status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "on_hold_time_in_business_minutes": {"name": "on_hold_time_in_business_minutes", "description": "The combined number of business minutes the ticket was on 'hold' status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "agent_wait_time_in_calendar_minutes": {"name": "agent_wait_time_in_calendar_minutes", "description": "The combined number of calendar minutes the ticket was in 'pending' status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_wait_time_in_calendar_minutes": {"name": "requester_wait_time_in_calendar_minutes", "description": "The combined number of calendar minutes the ticket was in 'new', 'open', or 'hold' status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "agent_work_time_in_calendar_minutes": {"name": "agent_work_time_in_calendar_minutes", "description": "The combined number of calendar minutes the ticket was in 'new' or 'open' status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "on_hold_time_in_calendar_minutes": {"name": "on_hold_time_in_calendar_minutes", "description": "The combined number of calendar minutes the ticket was on 'hold' status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_id": {"name": "ticket_id", "description": "Automatically assigned when the ticket is created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url": {"name": "url", "description": "The API url of this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_id": {"name": "assignee_id", "description": "The agent currently assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_role": {"name": "assignee_role", "description": "The role of the agent currently assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_email": {"name": "assignee_email", "description": "The email of the agent currently assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_name": {"name": "assignee_name", "description": "The name of the agent currently assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "brand_id": {"name": "brand_id", "description": "Enterprise only. The id of the brand this ticket is associated with", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "When this record was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "type": {"name": "type", "description": "The type of this ticket, possible values are problem, incident, question or task", "meta": {}, "data_type": null, "quote": null, "tags": []}, "subject": {"name": "subject", "description": "The value of the subject field for this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "description": {"name": "description", "description": "Read-only first comment on the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "priority": {"name": "priority", "description": "The urgency with which the ticket should be addressed, possible values are urgent, high, normal and low", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "The state of the ticket, possible values are new, open, pending, hold, solved and closed", "meta": {}, "data_type": null, "quote": null, "tags": []}, "recipient": {"name": "recipient", "description": "The original recipient e-mail address of the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_id": {"name": "requester_id", "description": "The user who requested this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_role": {"name": "requester_role", "description": "The role of the user who requested this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_email": {"name": "requester_email", "description": "The email of the user who requested this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_name": {"name": "requester_name", "description": "The name of the user who requested this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_id": {"name": "submitter_id", "description": "The user who submitted the ticket. The submitter always becomes the author of the first comment on the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_role": {"name": "submitter_role", "description": "The role of the user who submitted the ticket.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_email": {"name": "submitter_email", "description": "The email of the user who submitted the ticket.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_name": {"name": "submitter_name", "description": "The name of the user who submitted the ticket.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "organization_id": {"name": "organization_id", "description": "The organization of the requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "organization_name": {"name": "organization_name", "description": "The name of the organization of the requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "external_id": {"name": "external_id", "description": "The external id of the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "group_id": {"name": "group_id", "description": "The group this ticket is assigned to", "meta": {}, "data_type": null, "quote": null, "tags": []}, "group_name": {"name": "group_name", "description": "The name of the group this ticket is assigned to", "meta": {}, "data_type": null, "quote": null, "tags": []}, "due_at": {"name": "due_at", "description": "If this is a ticket of type \"task\" it has a due date. Due date format uses ISO 8601 format.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_form_id": {"name": "ticket_form_id", "description": "Enterprise only. The id of the ticket form to render for the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_public": {"name": "is_public", "description": "Is true if any comments are public, false otherwise", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "When this record last got updated", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_channel": {"name": "created_channel", "description": "The channel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_from_id": {"name": "source_from_id", "description": "The channel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_from_title": {"name": "source_from_title", "description": "The channel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_rel": {"name": "source_rel", "description": "The rel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_to_address": {"name": "source_to_address", "description": "The address of the source the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_to_name": {"name": "source_to_name", "description": "The name of the source the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_tags": {"name": "ticket_tags", "description": "A list of all tags assigned to this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "problem_id": {"name": "problem_id", "description": "The reference to the problem if the ticket is listed as a problem", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_incident": {"name": "is_incident", "description": "Boolean indicating whether the ticket is listed as an incident", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_brand_name": {"name": "ticket_brand_name", "description": "The brand name of with the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_form_name": {"name": "ticket_form_name", "description": "The form name of the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_satisfaction_rating": {"name": "ticket_satisfaction_rating", "description": "The ticket satisfaction rating", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_satisfaction_comment": {"name": "ticket_satisfaction_comment", "description": "The ticket satisfaction comment", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_satisfaction_reason": {"name": "ticket_satisfaction_reason", "description": "The ticket satisfaction reason", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_organization_domain_names": {"name": "ticket_organization_domain_names", "description": "The organization associated with the ticket domain names", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_organization_domain_names": {"name": "requester_organization_domain_names", "description": "The ticket requesters organization domain names", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_external_id": {"name": "requester_external_id", "description": "The ticket requester external id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_created_at": {"name": "requester_created_at", "description": "The date the ticket requester was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_updated_at": {"name": "requester_updated_at", "description": "The date the ticket requester was last updated", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_requester_active": {"name": "is_requester_active", "description": "Boolean indicating whether the requester is currently active", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_locale": {"name": "requester_locale", "description": "The locale of the ticket requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_time_zone": {"name": "requester_time_zone", "description": "The timezone of the ticket requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_ticket_update_count": {"name": "requester_ticket_update_count", "description": "The number of times the requester has updated the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_ticket_last_update_at": {"name": "requester_ticket_last_update_at", "description": "The last date the requester updated the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_last_login_at": {"name": "requester_last_login_at", "description": "The last login of the ticket requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_organization_id": {"name": "requester_organization_id", "description": "The organization id of the ticket requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_organization_name": {"name": "requester_organization_name", "description": "The organization name of the ticket requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_organization_tags": {"name": "requester_organization_tags", "description": "The organization tags of the ticket requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_organization_external_id": {"name": "requester_organization_external_id", "description": "The organization external id of the ticket requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_organization_created_at": {"name": "requester_organization_created_at", "description": "The date the ticket requesters organization was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_organization_updated_at": {"name": "requester_organization_updated_at", "description": "The date the ticket requesters organization was last updated", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_external_id": {"name": "submitter_external_id", "description": "The ticket submitter external id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_agent_submitted": {"name": "is_agent_submitted", "description": "Boolean indicating if the submitter has an agent role", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_submitter_active": {"name": "is_submitter_active", "description": "Boolean indicating if the ticket submitter is active", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_locale": {"name": "submitter_locale", "description": "The locale of the ticket submitter", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_time_zone": {"name": "submitter_time_zone", "description": "The time zone of the ticket submitter", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_external_id": {"name": "assignee_external_id", "description": "The external id of the ticket assignee", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_assignee_active": {"name": "is_assignee_active", "description": "Boolean indicating if the ticket assignee is active", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_locale": {"name": "assignee_locale", "description": "The locale of the ticket assignee", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_time_zone": {"name": "assignee_time_zone", "description": "The time zone of the ticket assignee", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_ticket_update_count": {"name": "assignee_ticket_update_count", "description": "The number of times the ticket assignee has updated the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_ticket_last_update_at": {"name": "assignee_ticket_last_update_at", "description": "The last date the ticket assignee updated the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_last_login_at": {"name": "assignee_last_login_at", "description": "The date the ticket assignee last logged in", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_tag": {"name": "requester_tag", "description": "The tags associated with the ticket requester.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_tag": {"name": "submitter_tag", "description": "The tags associated with the ticket submitter.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_tag": {"name": "assignee_tag", "description": "The tags associated with the ticket assignee.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_total_satisfaction_scores": {"name": "ticket_total_satisfaction_scores", "description": "The total number of satisfaction scores the ticket received.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_first_satisfaction_score": {"name": "ticket_first_satisfaction_score", "description": "The first satisfaction score the ticket received.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_satisfaction_score": {"name": "ticket_satisfaction_score", "description": "The latest satisfaction score the ticket received.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_good_to_bad_satisfaction_score": {"name": "is_good_to_bad_satisfaction_score", "description": "Boolean indicating if the ticket had a satisfaction score went from good to bad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_bad_to_good_satisfaction_score": {"name": "is_bad_to_good_satisfaction_score", "description": "Boolean indicating if the ticket had a satisfaction score went from bad to good.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "count_agent_comments": {"name": "count_agent_comments", "description": "Count of agent comments within the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "count_end_user_comments": {"name": "count_end_user_comments", "description": "Count of end user comments within the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "count_internal_comments": {"name": "count_internal_comments", "description": "Count of internal comments within the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "count_public_comments": {"name": "count_public_comments", "description": "Count of public comments within the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "total_comments": {"name": "total_comments", "description": "Total count of all comments within the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "unique_assignee_count": {"name": "unique_assignee_count", "description": "The count of unique assignees that were assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_stations_count": {"name": "assignee_stations_count", "description": "The total number of assignees that were assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "group_stations_count": {"name": "group_stations_count", "description": "The total count of group stations within the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "first_assignee_id": {"name": "first_assignee_id", "description": "Assignee id of the first agent assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "last_assignee_id": {"name": "last_assignee_id", "description": "Assignee id of the last agent assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "first_agent_assignment_date": {"name": "first_agent_assignment_date", "description": "The date the first agent was assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "last_agent_assignment_date": {"name": "last_agent_assignment_date", "description": "The date the last agent was assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "first_assignment_to_resolution_calendar_minutes": {"name": "first_assignment_to_resolution_calendar_minutes", "description": "The time in calendar minutes between the first assignment and resolution of the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "last_assignment_to_resolution_calendar_minutes": {"name": "last_assignment_to_resolution_calendar_minutes", "description": "The time in calendar minutes between the last assignment and resolution of the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "count_resolutions": {"name": "count_resolutions", "description": "The count of ticket resolutions", "meta": {}, "data_type": null, "quote": null, "tags": []}, "count_reopens": {"name": "count_reopens", "description": "The count of ticket reopen events", "meta": {}, "data_type": null, "quote": null, "tags": []}, "new_status_duration_in_calendar_minutes": {"name": "new_status_duration_in_calendar_minutes", "description": "The duration in calendar minutes the ticket was in the \"new\" status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "open_status_duration_in_calendar_minutes": {"name": "open_status_duration_in_calendar_minutes", "description": "The duration in calendar minutes the ticket was in the \"open\" status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "total_agent_replies": {"name": "total_agent_replies", "description": "The total number of agent replies within the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_last_login_age_minutes": {"name": "requester_last_login_age_minutes", "description": "The time in minutes since the ticket requester was last logged in", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_last_login_age_minutes": {"name": "assignee_last_login_age_minutes", "description": "The time in minutes since the ticket assignee was last logged in", "meta": {}, "data_type": null, "quote": null, "tags": []}, "unsolved_ticket_age_minutes": {"name": "unsolved_ticket_age_minutes", "description": "The time in minutes the ticket has been in an unsolved state", "meta": {}, "data_type": null, "quote": null, "tags": []}, "unsolved_ticket_age_since_update_minutes": {"name": "unsolved_ticket_age_since_update_minutes", "description": "The time in minutes the ticket has been unsolved since the last update", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_two_touch_resolution": {"name": "is_two_touch_resolution", "description": "Boolean indicating if the ticket was resolved in two comments", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_multi_touch_resolution": {"name": "is_multi_touch_resolution", "description": "Boolean indicating if the ticket was resolved in more than two comments", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_last_comment_date": {"name": "ticket_last_comment_date", "description": "The time the last comment was applied to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_unassigned_duration_calendar_minutes": {"name": "ticket_unassigned_duration_calendar_minutes", "description": "The time in minutes the ticket was in an unassigned state", "meta": {}, "data_type": null, "quote": null, "tags": []}, "last_status_assignment_date": {"name": "last_status_assignment_date", "description": "The time the status was last changed on the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/zendesk.yml", "build_path": "target/compiled/zendesk/models/zendesk__ticket_metrics.sql", "deferred": false, "unrendered_config": {"materialized": "table"}, "compiled_sql": "with __dbt__CTE__int_zendesk__ticket_resolution_times_calendar as (\nwith historical_solved_status as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_historical_status`\n where status = 'solved'\n\n), ticket as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket`\n\n), ticket_historical_assignee as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_historical_assignee`\n\n), ticket_historical_group as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_historical_group`\n\n), solved_times as (\n \n select\n \n ticket_id,\n min(valid_starting_at) as first_solved_at,\n max(valid_starting_at) as last_solved_at,\n count(status) as solved_count \n\n from historical_solved_status\n group by 1\n\n)\n\n select\n\n ticket.ticket_id,\n ticket.created_at,\n solved_times.first_solved_at,\n solved_times.last_solved_at,\n ticket_historical_assignee.unique_assignee_count,\n ticket_historical_assignee.assignee_stations_count,\n ticket_historical_group.group_stations_count,\n ticket_historical_assignee.first_assignee_id,\n ticket_historical_assignee.last_assignee_id,\n ticket_historical_assignee.first_agent_assignment_date,\n ticket_historical_assignee.last_agent_assignment_date,\n ticket_historical_assignee.ticket_unassigned_duration_calendar_minutes,\n solved_times.solved_count as total_resolutions,\n case when solved_times.solved_count <= 1\n then 0\n else solved_times.solved_count - 1 --subtracting one as the first solve is not a reopen.\n end as count_reopens,\n\n \n \n\n datetime_diff(\n cast(solved_times.first_solved_at as datetime),\n cast(ticket_historical_assignee.first_agent_assignment_date as datetime),\n minute\n )\n\n\n as first_assignment_to_resolution_calendar_minutes,\n \n \n\n datetime_diff(\n cast(solved_times.first_solved_at as datetime),\n cast(ticket_historical_assignee.last_agent_assignment_date as datetime),\n minute\n )\n\n\n as last_assignment_to_resolution_calendar_minutes,\n \n \n\n datetime_diff(\n cast(solved_times.first_solved_at as datetime),\n cast(ticket.created_at as datetime),\n minute\n )\n\n\n as first_resolution_calendar_minutes,\n \n \n\n datetime_diff(\n cast(solved_times.last_solved_at as datetime),\n cast(ticket.created_at as datetime),\n minute\n )\n\n\n as final_resolution_calendar_minutes\n\n from ticket\n\n left join ticket_historical_assignee\n using(ticket_id)\n\n left join ticket_historical_group\n using(ticket_id)\n\n left join solved_times\n using(ticket_id)\n), __dbt__CTE__int_zendesk__comments_enriched as (\nwith ticket_comment as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__updates`\n where field_name = 'comment'\n\n), users as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__user`\n\n), joined as (\n\n select \n\n ticket_comment.*,\n case when commenter.role = 'end-user' then 'external_comment'\n when commenter.role in ('agent','admin') then 'internal_comment'\n else 'unknown' end as commenter_role\n \n from ticket_comment\n \n join users as commenter\n on commenter.user_id = ticket_comment.user_id\n\n), add_previous_commenter_role as (\n\n select\n *,\n coalesce(\n lag(commenter_role) over (partition by ticket_id order by valid_starting_at)\n , 'first_comment') \n as previous_commenter_role,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_comment_added_at\n\n from joined\n)\n\nselect * \nfrom add_previous_commenter_role\n), __dbt__CTE__int_zendesk__ticket_reply_times as (\nwith ticket_public_comments as (\n\n select *\n from __dbt__CTE__int_zendesk__comments_enriched\n where is_public\n\n), end_user_comments as (\n \n select \n ticket_id,\n valid_starting_at as end_user_comment_created_at,\n previous_commenter_role = 'first_comment' as is_first_comment\n from ticket_public_comments \n where commenter_role = 'external_comment'\n and ticket_public_comments.previous_commenter_role != 'external_comment' -- we only care about net new end user comments\n\n), reply_timestamps as ( \n\n select\n end_user_comments.*,\n min(agent_comments.valid_starting_at) as agent_responded_at\n from end_user_comments\n left join ticket_public_comments as agent_comments\n on agent_comments.ticket_id = end_user_comments.ticket_id\n and agent_comments.commenter_role = 'internal_comment'\n and agent_comments.previous_commenter_role != 'internal_comment' -- we only care about net new agent comments\n and agent_comments.valid_starting_at > end_user_comments.end_user_comment_created_at\n group by 1,2,3\n\n)\n\n select\n *,\n \n \n\n datetime_diff(\n cast(agent_responded_at as datetime),\n cast(end_user_comment_created_at as datetime),\n minute\n )\n\n\n as reply_time_calendar_minutes\n from reply_timestamps\n order by 1,2\n), __dbt__CTE__int_zendesk__ticket_reply_times_calendar as (\nwith ticket as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket`\n\n), ticket_reply_times as (\n\n select *\n from __dbt__CTE__int_zendesk__ticket_reply_times\n\n)\n\nselect\n\n ticket.ticket_id,\n sum(case when is_first_comment then reply_time_calendar_minutes\n else null end) as first_reply_time_calendar_minutes,\n sum(reply_time_calendar_minutes) as total_reply_time_calendar_minutes --total combined time the customer waits for internal response\n \nfrom ticket\nleft join ticket_reply_times\n using (ticket_id)\n\ngroup by 1\n), __dbt__CTE__int_zendesk__ticket_work_time_calendar as (\nwith ticket_historical_status as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_historical_status`\n\n), calendar_minutes as (\n \n select \n ticket_id,\n status,\n case when status in ('pending') then status_duration_calendar_minutes\n else 0 end as agent_wait_time_in_minutes,\n case when status in ('new', 'open', 'hold') then status_duration_calendar_minutes\n else 0 end as requester_wait_time_in_minutes,\n case when status in ('new', 'open') then status_duration_calendar_minutes\n else 0 end as agent_work_time_in_minutes,\n case when status in ('hold') then status_duration_calendar_minutes\n else 0 end as on_hold_time_in_minutes,\n case when status = 'new' then status_duration_calendar_minutes\n else 0 end as new_status_duration_minutes,\n case when status = 'open' then status_duration_calendar_minutes\n else 0 end as open_status_duration_minutes,\n case when status = 'deleted' then 1\n else 0 end as ticket_deleted,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_status_assignment_date,\n case when lag(status) over (partition by ticket_id order by valid_starting_at) = 'deleted' and status != 'deleted'\n then 1\n else 0\n end as ticket_recoveries\n\n from ticket_historical_status\n\n)\n\nselect \n ticket_id,\n last_status_assignment_date,\n sum(ticket_deleted) as ticket_deleted_count,\n sum(agent_wait_time_in_minutes) as agent_wait_time_in_calendar_minutes,\n sum(requester_wait_time_in_minutes) as requester_wait_time_in_calendar_minutes,\n sum(agent_work_time_in_minutes) as agent_work_time_in_calendar_minutes,\n sum(on_hold_time_in_minutes) as on_hold_time_in_calendar_minutes,\n sum(new_status_duration_minutes) as new_status_duration_in_calendar_minutes,\n sum(open_status_duration_minutes) as open_status_duration_in_calendar_minutes,\n sum(ticket_recoveries) as total_ticket_recoveries\nfrom calendar_minutes\ngroup by 1, 2\n), __dbt__CTE__int_zendesk__ticket_first_resolution_time_business as (\n\n\nwith ticket_resolution_times_calendar as (\n\n select *\n from __dbt__CTE__int_zendesk__ticket_resolution_times_calendar\n\n), ticket_schedules as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_schedules`\n\n), schedule as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__schedule`\n\n), ticket_first_resolution_time as (\n\n select \n ticket_resolution_times_calendar.ticket_id,\n ticket_schedules.schedule_created_at,\n ticket_schedules.schedule_invalidated_at,\n ticket_schedules.schedule_id,\n round(\n \n\n datetime_diff(\n cast(ticket_schedules.schedule_created_at as datetime),\n cast(\n timestamp_trunc(\n cast(ticket_schedules.schedule_created_at as timestamp),\n week\n )\n\n as datetime),\n second\n )\n\n\n /60,\n 0) as start_time_in_minutes_from_week,\n greatest(0,\n round(\n \n \n\n datetime_diff(\n cast(least(ticket_schedules.schedule_invalidated_at, min(ticket_resolution_times_calendar.first_solved_at)) as datetime),\n cast(ticket_schedules.schedule_created_at as datetime),\n second\n )\n\n\n/60\n , 0)) as raw_delta_in_minutes\n \n from ticket_resolution_times_calendar\n join ticket_schedules on ticket_resolution_times_calendar.ticket_id = ticket_schedules.ticket_id\n group by 1, 2, 3, 4\n\n), weeks as (\n\n \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * pow(2, 0)\n + \n \n p1.generated_number * pow(2, 1)\n + \n \n p2.generated_number * pow(2, 2)\n + \n \n p3.generated_number * pow(2, 3)\n + \n \n p4.generated_number * pow(2, 4)\n + \n \n p5.generated_number * pow(2, 5)\n + \n \n p6.generated_number * pow(2, 6)\n + \n \n p7.generated_number * pow(2, 7)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 208\n order by generated_number\n\n\n\n), weeks_cross_ticket_first_resolution_time as (\n\n select \n\n ticket_first_resolution_time.*,\n generated_number - 1 as week_number\n\n from ticket_first_resolution_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number - 1\n\n\n), weekly_periods as (\n \n select \n\n weeks_cross_ticket_first_resolution_time.*,\n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n \n from weeks_cross_ticket_first_resolution_time\n\n), intercepted_periods as (\n\n select ticket_id,\n week_number,\n weekly_periods.schedule_id,\n ticket_week_start_time,\n ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n\n)\n\n select \n ticket_id,\n sum(scheduled_minutes) as first_resolution_business_minutes\n from intercepted_periods\n group by 1\n), __dbt__CTE__int_zendesk__ticket_full_resolution_time_business as (\n\n\nwith ticket_resolution_times_calendar as (\n\n select *\n from __dbt__CTE__int_zendesk__ticket_resolution_times_calendar\n\n), ticket_schedules as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_schedules`\n\n), schedule as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__schedule`\n\n), ticket_full_resolution_time as (\n\n select \n ticket_resolution_times_calendar.ticket_id,\n ticket_schedules.schedule_created_at,\n ticket_schedules.schedule_invalidated_at,\n ticket_schedules.schedule_id,\n round(\n \n\n datetime_diff(\n cast(ticket_schedules.schedule_created_at as datetime),\n cast(\n timestamp_trunc(\n cast(ticket_schedules.schedule_created_at as timestamp),\n week\n )\n\n as datetime),\n second\n )\n\n\n /60,\n 0) as start_time_in_minutes_from_week,\n greatest(0,\n round(\n \n \n\n datetime_diff(\n cast(least(ticket_schedules.schedule_invalidated_at, min(ticket_resolution_times_calendar.last_solved_at)) as datetime),\n cast(ticket_schedules.schedule_created_at as datetime),\n second\n )\n\n\n/60\n , 0)) as raw_delta_in_minutes\n \n from ticket_resolution_times_calendar\n join ticket_schedules on ticket_resolution_times_calendar.ticket_id = ticket_schedules.ticket_id\n group by 1, 2, 3, 4\n\n), weeks as (\n\n \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * pow(2, 0)\n + \n \n p1.generated_number * pow(2, 1)\n + \n \n p2.generated_number * pow(2, 2)\n + \n \n p3.generated_number * pow(2, 3)\n + \n \n p4.generated_number * pow(2, 4)\n + \n \n p5.generated_number * pow(2, 5)\n + \n \n p6.generated_number * pow(2, 6)\n + \n \n p7.generated_number * pow(2, 7)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 208\n order by generated_number\n\n\n\n), weeks_cross_ticket_full_resolution_time as (\n\n select \n\n ticket_full_resolution_time.*,\n generated_number - 1 as week_number\n\n from ticket_full_resolution_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number - 1\n\n), weekly_periods as (\n \n select \n\n weeks_cross_ticket_full_resolution_time.*,\n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n \n from weeks_cross_ticket_full_resolution_time\n\n), intercepted_periods as (\n\n select \n ticket_id,\n week_number,\n weekly_periods.schedule_id,\n ticket_week_start_time,\n ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n\n)\n\n select \n ticket_id,\n sum(scheduled_minutes) as full_resolution_business_minutes\n from intercepted_periods\n group by 1\n), __dbt__CTE__int_zendesk__ticket_work_time_business as (\n\n\nwith ticket_historical_status as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_historical_status`\n\n), ticket_schedules as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_schedules`\n\n), schedule as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__schedule`\n\n), ticket_status_crossed_with_schedule as (\n \n select\n ticket_historical_status.ticket_id,\n ticket_historical_status.status as ticket_status,\n ticket_schedules.schedule_id,\n greatest(valid_starting_at, schedule_created_at) as status_schedule_start,\n least(valid_ending_at, schedule_invalidated_at) as status_schedule_end\n from ticket_historical_status\n left join ticket_schedules\n on ticket_historical_status.ticket_id = ticket_schedules.ticket_id\n where \n \n\n datetime_diff(\n cast(least(valid_ending_at, schedule_invalidated_at) as datetime),\n cast(greatest(valid_starting_at, schedule_created_at) as datetime),\n second\n )\n\n\n > 0\n\n), ticket_full_solved_time as (\n\n select \n ticket_status_crossed_with_schedule.*,\n round(\n \n\n datetime_diff(\n cast(ticket_status_crossed_with_schedule.status_schedule_start as datetime),\n cast(\n timestamp_trunc(\n cast(ticket_status_crossed_with_schedule.status_schedule_start as timestamp),\n week\n )\n\n as datetime),\n second\n )\n\n\n /60,\n 0) as start_time_in_minutes_from_week,\n round(\n \n\n datetime_diff(\n cast(ticket_status_crossed_with_schedule.status_schedule_end as datetime),\n cast(ticket_status_crossed_with_schedule.status_schedule_start as datetime),\n second\n )\n\n\n /60,\n 0) as raw_delta_in_minutes\n from ticket_status_crossed_with_schedule\n group by 1, 2, 3, 4, 5\n\n), weeks as (\n\n \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * pow(2, 0)\n + \n \n p1.generated_number * pow(2, 1)\n + \n \n p2.generated_number * pow(2, 2)\n + \n \n p3.generated_number * pow(2, 3)\n + \n \n p4.generated_number * pow(2, 4)\n + \n \n p5.generated_number * pow(2, 5)\n + \n \n p6.generated_number * pow(2, 6)\n + \n \n p7.generated_number * pow(2, 7)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 208\n order by generated_number\n\n\n\n), weeks_cross_ticket_full_solved_time as (\n \n select \n ticket_full_solved_time.*,\n generated_number - 1 as week_number\n from ticket_full_solved_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number -1\n\n), weekly_periods as (\n\n select\n\n weeks_cross_ticket_full_solved_time.*,\n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n \n from weeks_cross_ticket_full_solved_time\n\n), intercepted_periods as (\n \n select \n weekly_periods.ticket_id,\n weekly_periods.week_number,\n weekly_periods.schedule_id,\n weekly_periods.ticket_status,\n weekly_periods.ticket_week_start_time,\n weekly_periods.ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(weekly_periods.ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n\n), business_minutes as (\n \n select \n ticket_id,\n ticket_status,\n case when ticket_status in ('pending') then scheduled_minutes\n else 0 end as agent_wait_time_in_minutes,\n case when ticket_status in ('new', 'open', 'hold') then scheduled_minutes\n else 0 end as requester_wait_time_in_minutes,\n case when ticket_status in ('new', 'open') then scheduled_minutes\n else 0 end as agent_work_time_in_minutes,\n case when ticket_status in ('hold') then scheduled_minutes\n else 0 end as on_hold_time_in_minutes\n from intercepted_periods\n\n)\n \n select \n ticket_id,\n sum(agent_wait_time_in_minutes) as agent_wait_time_in_business_minutes,\n sum(requester_wait_time_in_minutes) as requester_wait_time_in_business_minutes,\n sum(agent_work_time_in_minutes) as agent_work_time_in_business_minutes,\n sum(on_hold_time_in_minutes) as on_hold_time_in_business_minutes\n from business_minutes\n group by 1\n), __dbt__CTE__int_zendesk__ticket_first_reply_time_business as (\n\n\nwith ticket_reply_times as (\n\n select *\n from __dbt__CTE__int_zendesk__ticket_reply_times\n\n), ticket_schedules as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_schedules`\n\n), schedule as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__schedule`\n\n), first_reply_time as (\n\n select\n ticket_id,\n end_user_comment_created_at,\n agent_responded_at\n\n from ticket_reply_times\n where is_first_comment\n\n), ticket_first_reply_time as (\n\n select \n first_reply_time.ticket_id,\n ticket_schedules.schedule_created_at,\n ticket_schedules.schedule_invalidated_at,\n ticket_schedules.schedule_id,\n round(\n \n\n datetime_diff(\n cast(ticket_schedules.schedule_created_at as datetime),\n cast(\n timestamp_trunc(\n cast(ticket_schedules.schedule_created_at as timestamp),\n week\n )\n\n as datetime),\n second\n )\n\n\n /60,\n 0) as start_time_in_minutes_from_week,\n greatest(0,\n round(\n \n \n\n datetime_diff(\n cast(least(ticket_schedules.schedule_invalidated_at, min(first_reply_time.agent_responded_at)) as datetime),\n cast(ticket_schedules.schedule_created_at as datetime),\n second\n )\n\n\n/60\n , 0)) as raw_delta_in_minutes\n \n from first_reply_time\n join ticket_schedules on first_reply_time.ticket_id = ticket_schedules.ticket_id\n group by 1, 2, 3, 4\n\n), weeks as (\n\n \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * pow(2, 0)\n + \n \n p1.generated_number * pow(2, 1)\n + \n \n p2.generated_number * pow(2, 2)\n + \n \n p3.generated_number * pow(2, 3)\n + \n \n p4.generated_number * pow(2, 4)\n + \n \n p5.generated_number * pow(2, 5)\n + \n \n p6.generated_number * pow(2, 6)\n + \n \n p7.generated_number * pow(2, 7)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 208\n order by generated_number\n\n\n\n), weeks_cross_ticket_first_reply as (\n\n select \n\n ticket_first_reply_time.*,\n generated_number - 1 as week_number\n\n from ticket_first_reply_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number - 1\n\n), weekly_periods as (\n \n select \n weeks_cross_ticket_first_reply.*, \n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n from weeks_cross_ticket_first_reply\n\n), intercepted_periods as (\n\n select ticket_id,\n week_number,\n weekly_periods.schedule_id,\n ticket_week_start_time,\n ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n\n)\n\n select ticket_id,\n sum(scheduled_minutes) as first_reply_time_business_minutes\n from intercepted_periods\n group by 1\n),ticket_enriched as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests`.`zendesk__ticket_enriched`\n\n), ticket_resolution_times_calendar as (\n\n select *\n from __dbt__CTE__int_zendesk__ticket_resolution_times_calendar\n\n), ticket_reply_times_calendar as (\n\n select *\n from __dbt__CTE__int_zendesk__ticket_reply_times_calendar\n\n), ticket_comments as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__comment_metrics`\n\n), ticket_work_time_calendar as (\n\n select *\n from __dbt__CTE__int_zendesk__ticket_work_time_calendar\n\n-- business hour CTEs\n\n\n), ticket_first_resolution_time_business as (\n\n select *\n from __dbt__CTE__int_zendesk__ticket_first_resolution_time_business\n\n), ticket_full_resolution_time_business as (\n\n select *\n from __dbt__CTE__int_zendesk__ticket_full_resolution_time_business\n\n), ticket_work_time_business as (\n\n select *\n from __dbt__CTE__int_zendesk__ticket_work_time_business\n\n), ticket_first_reply_time_business as (\n\n select *\n from __dbt__CTE__int_zendesk__ticket_first_reply_time_business\n\n\n-- end business hour CTEs\n\n), calendar_hour_metrics as (\n\nselect\n ticket_enriched.*,\n ticket_reply_times_calendar.first_reply_time_calendar_minutes,\n ticket_reply_times_calendar.total_reply_time_calendar_minutes,\n coalesce(ticket_comments.count_agent_comments, 0) as count_agent_comments,\n coalesce(ticket_comments.count_end_user_comments, 0) as count_end_user_comments,\n coalesce(ticket_comments.count_internal_comments, 0) as count_internal_comments,\n coalesce(ticket_comments.count_public_comments, 0) as count_public_comments,\n coalesce(ticket_comments.total_comments, 0) as total_comments,\n ticket_comments.last_comment_added_at as ticket_last_comment_date,\n ticket_resolution_times_calendar.unique_assignee_count,\n ticket_resolution_times_calendar.assignee_stations_count,\n ticket_resolution_times_calendar.group_stations_count,\n ticket_resolution_times_calendar.first_assignee_id,\n ticket_resolution_times_calendar.last_assignee_id,\n ticket_resolution_times_calendar.first_agent_assignment_date,\n ticket_resolution_times_calendar.last_agent_assignment_date,\n ticket_resolution_times_calendar.first_solved_at,\n ticket_resolution_times_calendar.last_solved_at,\n ticket_resolution_times_calendar.first_assignment_to_resolution_calendar_minutes,\n ticket_resolution_times_calendar.last_assignment_to_resolution_calendar_minutes,\n ticket_resolution_times_calendar.ticket_unassigned_duration_calendar_minutes,\n ticket_resolution_times_calendar.first_resolution_calendar_minutes,\n ticket_resolution_times_calendar.final_resolution_calendar_minutes,\n ticket_resolution_times_calendar.total_resolutions as count_resolutions,\n ticket_resolution_times_calendar.count_reopens,\n ticket_work_time_calendar.ticket_deleted_count,\n ticket_work_time_calendar.total_ticket_recoveries,\n ticket_work_time_calendar.last_status_assignment_date,\n ticket_work_time_calendar.new_status_duration_in_calendar_minutes,\n ticket_work_time_calendar.open_status_duration_in_calendar_minutes,\n ticket_work_time_calendar.agent_wait_time_in_calendar_minutes,\n ticket_work_time_calendar.requester_wait_time_in_calendar_minutes,\n ticket_work_time_calendar.agent_work_time_in_calendar_minutes,\n ticket_work_time_calendar.on_hold_time_in_calendar_minutes,\n ticket_comments.count_internal_comments as total_agent_replies,\n \n case when ticket_enriched.is_requester_active = true and ticket_enriched.requester_last_login_at is not null\n then round((\n\n datetime_diff(\n cast(\n current_timestamp\n as datetime),\n cast(ticket_enriched.requester_last_login_at as datetime),\n second\n )\n\n /60),2)\n end as requester_last_login_age_minutes,\n case when ticket_enriched.is_assignee_active = true and ticket_enriched.assignee_last_login_at is not null\n then round((\n\n datetime_diff(\n cast(\n current_timestamp\n as datetime),\n cast(ticket_enriched.assignee_last_login_at as datetime),\n second\n )\n\n /60),2)\n end as assignee_last_login_age_minutes,\n case when lower(ticket_enriched.status) not in ('solved','closed')\n then round((\n\n datetime_diff(\n cast(\n current_timestamp\n as datetime),\n cast(ticket_enriched.created_at as datetime),\n second\n )\n\n /60),2)\n end as unsolved_ticket_age_minutes,\n case when lower(ticket_enriched.status) not in ('solved','closed')\n then round((\n\n datetime_diff(\n cast(\n current_timestamp\n as datetime),\n cast(ticket_enriched.updated_at as datetime),\n second\n )\n\n /60),2)\n end as unsolved_ticket_age_since_update_minutes,\n case when lower(ticket_enriched.status) in ('solved','closed') and ticket_comments.is_one_touch_resolution \n then true\n else false\n end as is_one_touch_resolution,\n case when lower(ticket_enriched.status) in ('solved','closed') and ticket_comments.is_two_touch_resolution \n then true\n else false \n end as is_two_touch_resolution,\n case when lower(ticket_enriched.status) in ('solved','closed') and not ticket_comments.is_one_touch_resolution \n then true\n else false \n end as is_multi_touch_resolution\n\n\nfrom ticket_enriched\n\nleft join ticket_reply_times_calendar\n using (ticket_id)\n\nleft join ticket_resolution_times_calendar\n using (ticket_id)\n\nleft join ticket_work_time_calendar\n using (ticket_id)\n\nleft join ticket_comments\n using(ticket_id)\n\n\n\n), business_hour_metrics as (\n\n select \n ticket_enriched.ticket_id,\n ticket_first_resolution_time_business.first_resolution_business_minutes,\n ticket_full_resolution_time_business.full_resolution_business_minutes,\n ticket_first_reply_time_business.first_reply_time_business_minutes,\n ticket_work_time_business.agent_wait_time_in_business_minutes,\n ticket_work_time_business.requester_wait_time_in_business_minutes,\n ticket_work_time_business.agent_work_time_in_business_minutes,\n ticket_work_time_business.on_hold_time_in_business_minutes\n\n from ticket_enriched\n\n left join ticket_first_resolution_time_business\n using (ticket_id)\n\n left join ticket_full_resolution_time_business\n using (ticket_id)\n \n left join ticket_first_reply_time_business\n using (ticket_id) \n \n left join ticket_work_time_business\n using (ticket_id)\n\n)\n\nselect\n calendar_hour_metrics.*,\n business_hour_metrics.first_resolution_business_minutes,\n business_hour_metrics.full_resolution_business_minutes,\n business_hour_metrics.first_reply_time_business_minutes,\n business_hour_metrics.agent_wait_time_in_business_minutes,\n business_hour_metrics.requester_wait_time_in_business_minutes,\n business_hour_metrics.agent_work_time_in_business_minutes,\n business_hour_metrics.on_hold_time_in_business_minutes\n\nfrom calendar_hour_metrics\n\nleft join business_hour_metrics \n using (ticket_id)\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.zendesk.int_zendesk__ticket_resolution_times_calendar", "sql": " __dbt__CTE__int_zendesk__ticket_resolution_times_calendar as (\nwith historical_solved_status as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_historical_status`\n where status = 'solved'\n\n), ticket as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket`\n\n), ticket_historical_assignee as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_historical_assignee`\n\n), ticket_historical_group as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_historical_group`\n\n), solved_times as (\n \n select\n \n ticket_id,\n min(valid_starting_at) as first_solved_at,\n max(valid_starting_at) as last_solved_at,\n count(status) as solved_count \n\n from historical_solved_status\n group by 1\n\n)\n\n select\n\n ticket.ticket_id,\n ticket.created_at,\n solved_times.first_solved_at,\n solved_times.last_solved_at,\n ticket_historical_assignee.unique_assignee_count,\n ticket_historical_assignee.assignee_stations_count,\n ticket_historical_group.group_stations_count,\n ticket_historical_assignee.first_assignee_id,\n ticket_historical_assignee.last_assignee_id,\n ticket_historical_assignee.first_agent_assignment_date,\n ticket_historical_assignee.last_agent_assignment_date,\n ticket_historical_assignee.ticket_unassigned_duration_calendar_minutes,\n solved_times.solved_count as total_resolutions,\n case when solved_times.solved_count <= 1\n then 0\n else solved_times.solved_count - 1 --subtracting one as the first solve is not a reopen.\n end as count_reopens,\n\n \n \n\n datetime_diff(\n cast(solved_times.first_solved_at as datetime),\n cast(ticket_historical_assignee.first_agent_assignment_date as datetime),\n minute\n )\n\n\n as first_assignment_to_resolution_calendar_minutes,\n \n \n\n datetime_diff(\n cast(solved_times.first_solved_at as datetime),\n cast(ticket_historical_assignee.last_agent_assignment_date as datetime),\n minute\n )\n\n\n as last_assignment_to_resolution_calendar_minutes,\n \n \n\n datetime_diff(\n cast(solved_times.first_solved_at as datetime),\n cast(ticket.created_at as datetime),\n minute\n )\n\n\n as first_resolution_calendar_minutes,\n \n \n\n datetime_diff(\n cast(solved_times.last_solved_at as datetime),\n cast(ticket.created_at as datetime),\n minute\n )\n\n\n as final_resolution_calendar_minutes\n\n from ticket\n\n left join ticket_historical_assignee\n using(ticket_id)\n\n left join ticket_historical_group\n using(ticket_id)\n\n left join solved_times\n using(ticket_id)\n)"}, {"id": "model.zendesk.int_zendesk__comments_enriched", "sql": " __dbt__CTE__int_zendesk__comments_enriched as (\nwith ticket_comment as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__updates`\n where field_name = 'comment'\n\n), users as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__user`\n\n), joined as (\n\n select \n\n ticket_comment.*,\n case when commenter.role = 'end-user' then 'external_comment'\n when commenter.role in ('agent','admin') then 'internal_comment'\n else 'unknown' end as commenter_role\n \n from ticket_comment\n \n join users as commenter\n on commenter.user_id = ticket_comment.user_id\n\n), add_previous_commenter_role as (\n\n select\n *,\n coalesce(\n lag(commenter_role) over (partition by ticket_id order by valid_starting_at)\n , 'first_comment') \n as previous_commenter_role,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_comment_added_at\n\n from joined\n)\n\nselect * \nfrom add_previous_commenter_role\n)"}, {"id": "model.zendesk.int_zendesk__ticket_reply_times", "sql": " __dbt__CTE__int_zendesk__ticket_reply_times as (\nwith ticket_public_comments as (\n\n select *\n from __dbt__CTE__int_zendesk__comments_enriched\n where is_public\n\n), end_user_comments as (\n \n select \n ticket_id,\n valid_starting_at as end_user_comment_created_at,\n previous_commenter_role = 'first_comment' as is_first_comment\n from ticket_public_comments \n where commenter_role = 'external_comment'\n and ticket_public_comments.previous_commenter_role != 'external_comment' -- we only care about net new end user comments\n\n), reply_timestamps as ( \n\n select\n end_user_comments.*,\n min(agent_comments.valid_starting_at) as agent_responded_at\n from end_user_comments\n left join ticket_public_comments as agent_comments\n on agent_comments.ticket_id = end_user_comments.ticket_id\n and agent_comments.commenter_role = 'internal_comment'\n and agent_comments.previous_commenter_role != 'internal_comment' -- we only care about net new agent comments\n and agent_comments.valid_starting_at > end_user_comments.end_user_comment_created_at\n group by 1,2,3\n\n)\n\n select\n *,\n \n \n\n datetime_diff(\n cast(agent_responded_at as datetime),\n cast(end_user_comment_created_at as datetime),\n minute\n )\n\n\n as reply_time_calendar_minutes\n from reply_timestamps\n order by 1,2\n)"}, {"id": "model.zendesk.int_zendesk__ticket_reply_times_calendar", "sql": " __dbt__CTE__int_zendesk__ticket_reply_times_calendar as (\nwith ticket as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket`\n\n), ticket_reply_times as (\n\n select *\n from __dbt__CTE__int_zendesk__ticket_reply_times\n\n)\n\nselect\n\n ticket.ticket_id,\n sum(case when is_first_comment then reply_time_calendar_minutes\n else null end) as first_reply_time_calendar_minutes,\n sum(reply_time_calendar_minutes) as total_reply_time_calendar_minutes --total combined time the customer waits for internal response\n \nfrom ticket\nleft join ticket_reply_times\n using (ticket_id)\n\ngroup by 1\n)"}, {"id": "model.zendesk.int_zendesk__ticket_work_time_calendar", "sql": " __dbt__CTE__int_zendesk__ticket_work_time_calendar as (\nwith ticket_historical_status as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_historical_status`\n\n), calendar_minutes as (\n \n select \n ticket_id,\n status,\n case when status in ('pending') then status_duration_calendar_minutes\n else 0 end as agent_wait_time_in_minutes,\n case when status in ('new', 'open', 'hold') then status_duration_calendar_minutes\n else 0 end as requester_wait_time_in_minutes,\n case when status in ('new', 'open') then status_duration_calendar_minutes\n else 0 end as agent_work_time_in_minutes,\n case when status in ('hold') then status_duration_calendar_minutes\n else 0 end as on_hold_time_in_minutes,\n case when status = 'new' then status_duration_calendar_minutes\n else 0 end as new_status_duration_minutes,\n case when status = 'open' then status_duration_calendar_minutes\n else 0 end as open_status_duration_minutes,\n case when status = 'deleted' then 1\n else 0 end as ticket_deleted,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_status_assignment_date,\n case when lag(status) over (partition by ticket_id order by valid_starting_at) = 'deleted' and status != 'deleted'\n then 1\n else 0\n end as ticket_recoveries\n\n from ticket_historical_status\n\n)\n\nselect \n ticket_id,\n last_status_assignment_date,\n sum(ticket_deleted) as ticket_deleted_count,\n sum(agent_wait_time_in_minutes) as agent_wait_time_in_calendar_minutes,\n sum(requester_wait_time_in_minutes) as requester_wait_time_in_calendar_minutes,\n sum(agent_work_time_in_minutes) as agent_work_time_in_calendar_minutes,\n sum(on_hold_time_in_minutes) as on_hold_time_in_calendar_minutes,\n sum(new_status_duration_minutes) as new_status_duration_in_calendar_minutes,\n sum(open_status_duration_minutes) as open_status_duration_in_calendar_minutes,\n sum(ticket_recoveries) as total_ticket_recoveries\nfrom calendar_minutes\ngroup by 1, 2\n)"}, {"id": "model.zendesk.int_zendesk__ticket_first_resolution_time_business", "sql": " __dbt__CTE__int_zendesk__ticket_first_resolution_time_business as (\n\n\nwith ticket_resolution_times_calendar as (\n\n select *\n from __dbt__CTE__int_zendesk__ticket_resolution_times_calendar\n\n), ticket_schedules as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_schedules`\n\n), schedule as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__schedule`\n\n), ticket_first_resolution_time as (\n\n select \n ticket_resolution_times_calendar.ticket_id,\n ticket_schedules.schedule_created_at,\n ticket_schedules.schedule_invalidated_at,\n ticket_schedules.schedule_id,\n round(\n \n\n datetime_diff(\n cast(ticket_schedules.schedule_created_at as datetime),\n cast(\n timestamp_trunc(\n cast(ticket_schedules.schedule_created_at as timestamp),\n week\n )\n\n as datetime),\n second\n )\n\n\n /60,\n 0) as start_time_in_minutes_from_week,\n greatest(0,\n round(\n \n \n\n datetime_diff(\n cast(least(ticket_schedules.schedule_invalidated_at, min(ticket_resolution_times_calendar.first_solved_at)) as datetime),\n cast(ticket_schedules.schedule_created_at as datetime),\n second\n )\n\n\n/60\n , 0)) as raw_delta_in_minutes\n \n from ticket_resolution_times_calendar\n join ticket_schedules on ticket_resolution_times_calendar.ticket_id = ticket_schedules.ticket_id\n group by 1, 2, 3, 4\n\n), weeks as (\n\n \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * pow(2, 0)\n + \n \n p1.generated_number * pow(2, 1)\n + \n \n p2.generated_number * pow(2, 2)\n + \n \n p3.generated_number * pow(2, 3)\n + \n \n p4.generated_number * pow(2, 4)\n + \n \n p5.generated_number * pow(2, 5)\n + \n \n p6.generated_number * pow(2, 6)\n + \n \n p7.generated_number * pow(2, 7)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 208\n order by generated_number\n\n\n\n), weeks_cross_ticket_first_resolution_time as (\n\n select \n\n ticket_first_resolution_time.*,\n generated_number - 1 as week_number\n\n from ticket_first_resolution_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number - 1\n\n\n), weekly_periods as (\n \n select \n\n weeks_cross_ticket_first_resolution_time.*,\n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n \n from weeks_cross_ticket_first_resolution_time\n\n), intercepted_periods as (\n\n select ticket_id,\n week_number,\n weekly_periods.schedule_id,\n ticket_week_start_time,\n ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n\n)\n\n select \n ticket_id,\n sum(scheduled_minutes) as first_resolution_business_minutes\n from intercepted_periods\n group by 1\n)"}, {"id": "model.zendesk.int_zendesk__ticket_full_resolution_time_business", "sql": " __dbt__CTE__int_zendesk__ticket_full_resolution_time_business as (\n\n\nwith ticket_resolution_times_calendar as (\n\n select *\n from __dbt__CTE__int_zendesk__ticket_resolution_times_calendar\n\n), ticket_schedules as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_schedules`\n\n), schedule as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__schedule`\n\n), ticket_full_resolution_time as (\n\n select \n ticket_resolution_times_calendar.ticket_id,\n ticket_schedules.schedule_created_at,\n ticket_schedules.schedule_invalidated_at,\n ticket_schedules.schedule_id,\n round(\n \n\n datetime_diff(\n cast(ticket_schedules.schedule_created_at as datetime),\n cast(\n timestamp_trunc(\n cast(ticket_schedules.schedule_created_at as timestamp),\n week\n )\n\n as datetime),\n second\n )\n\n\n /60,\n 0) as start_time_in_minutes_from_week,\n greatest(0,\n round(\n \n \n\n datetime_diff(\n cast(least(ticket_schedules.schedule_invalidated_at, min(ticket_resolution_times_calendar.last_solved_at)) as datetime),\n cast(ticket_schedules.schedule_created_at as datetime),\n second\n )\n\n\n/60\n , 0)) as raw_delta_in_minutes\n \n from ticket_resolution_times_calendar\n join ticket_schedules on ticket_resolution_times_calendar.ticket_id = ticket_schedules.ticket_id\n group by 1, 2, 3, 4\n\n), weeks as (\n\n \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * pow(2, 0)\n + \n \n p1.generated_number * pow(2, 1)\n + \n \n p2.generated_number * pow(2, 2)\n + \n \n p3.generated_number * pow(2, 3)\n + \n \n p4.generated_number * pow(2, 4)\n + \n \n p5.generated_number * pow(2, 5)\n + \n \n p6.generated_number * pow(2, 6)\n + \n \n p7.generated_number * pow(2, 7)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 208\n order by generated_number\n\n\n\n), weeks_cross_ticket_full_resolution_time as (\n\n select \n\n ticket_full_resolution_time.*,\n generated_number - 1 as week_number\n\n from ticket_full_resolution_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number - 1\n\n), weekly_periods as (\n \n select \n\n weeks_cross_ticket_full_resolution_time.*,\n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n \n from weeks_cross_ticket_full_resolution_time\n\n), intercepted_periods as (\n\n select \n ticket_id,\n week_number,\n weekly_periods.schedule_id,\n ticket_week_start_time,\n ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n\n)\n\n select \n ticket_id,\n sum(scheduled_minutes) as full_resolution_business_minutes\n from intercepted_periods\n group by 1\n)"}, {"id": "model.zendesk.int_zendesk__ticket_work_time_business", "sql": " __dbt__CTE__int_zendesk__ticket_work_time_business as (\n\n\nwith ticket_historical_status as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_historical_status`\n\n), ticket_schedules as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_schedules`\n\n), schedule as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__schedule`\n\n), ticket_status_crossed_with_schedule as (\n \n select\n ticket_historical_status.ticket_id,\n ticket_historical_status.status as ticket_status,\n ticket_schedules.schedule_id,\n greatest(valid_starting_at, schedule_created_at) as status_schedule_start,\n least(valid_ending_at, schedule_invalidated_at) as status_schedule_end\n from ticket_historical_status\n left join ticket_schedules\n on ticket_historical_status.ticket_id = ticket_schedules.ticket_id\n where \n \n\n datetime_diff(\n cast(least(valid_ending_at, schedule_invalidated_at) as datetime),\n cast(greatest(valid_starting_at, schedule_created_at) as datetime),\n second\n )\n\n\n > 0\n\n), ticket_full_solved_time as (\n\n select \n ticket_status_crossed_with_schedule.*,\n round(\n \n\n datetime_diff(\n cast(ticket_status_crossed_with_schedule.status_schedule_start as datetime),\n cast(\n timestamp_trunc(\n cast(ticket_status_crossed_with_schedule.status_schedule_start as timestamp),\n week\n )\n\n as datetime),\n second\n )\n\n\n /60,\n 0) as start_time_in_minutes_from_week,\n round(\n \n\n datetime_diff(\n cast(ticket_status_crossed_with_schedule.status_schedule_end as datetime),\n cast(ticket_status_crossed_with_schedule.status_schedule_start as datetime),\n second\n )\n\n\n /60,\n 0) as raw_delta_in_minutes\n from ticket_status_crossed_with_schedule\n group by 1, 2, 3, 4, 5\n\n), weeks as (\n\n \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * pow(2, 0)\n + \n \n p1.generated_number * pow(2, 1)\n + \n \n p2.generated_number * pow(2, 2)\n + \n \n p3.generated_number * pow(2, 3)\n + \n \n p4.generated_number * pow(2, 4)\n + \n \n p5.generated_number * pow(2, 5)\n + \n \n p6.generated_number * pow(2, 6)\n + \n \n p7.generated_number * pow(2, 7)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 208\n order by generated_number\n\n\n\n), weeks_cross_ticket_full_solved_time as (\n \n select \n ticket_full_solved_time.*,\n generated_number - 1 as week_number\n from ticket_full_solved_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number -1\n\n), weekly_periods as (\n\n select\n\n weeks_cross_ticket_full_solved_time.*,\n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n \n from weeks_cross_ticket_full_solved_time\n\n), intercepted_periods as (\n \n select \n weekly_periods.ticket_id,\n weekly_periods.week_number,\n weekly_periods.schedule_id,\n weekly_periods.ticket_status,\n weekly_periods.ticket_week_start_time,\n weekly_periods.ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(weekly_periods.ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n\n), business_minutes as (\n \n select \n ticket_id,\n ticket_status,\n case when ticket_status in ('pending') then scheduled_minutes\n else 0 end as agent_wait_time_in_minutes,\n case when ticket_status in ('new', 'open', 'hold') then scheduled_minutes\n else 0 end as requester_wait_time_in_minutes,\n case when ticket_status in ('new', 'open') then scheduled_minutes\n else 0 end as agent_work_time_in_minutes,\n case when ticket_status in ('hold') then scheduled_minutes\n else 0 end as on_hold_time_in_minutes\n from intercepted_periods\n\n)\n \n select \n ticket_id,\n sum(agent_wait_time_in_minutes) as agent_wait_time_in_business_minutes,\n sum(requester_wait_time_in_minutes) as requester_wait_time_in_business_minutes,\n sum(agent_work_time_in_minutes) as agent_work_time_in_business_minutes,\n sum(on_hold_time_in_minutes) as on_hold_time_in_business_minutes\n from business_minutes\n group by 1\n)"}, {"id": "model.zendesk.int_zendesk__ticket_first_reply_time_business", "sql": " __dbt__CTE__int_zendesk__ticket_first_reply_time_business as (\n\n\nwith ticket_reply_times as (\n\n select *\n from __dbt__CTE__int_zendesk__ticket_reply_times\n\n), ticket_schedules as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_schedules`\n\n), schedule as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__schedule`\n\n), first_reply_time as (\n\n select\n ticket_id,\n end_user_comment_created_at,\n agent_responded_at\n\n from ticket_reply_times\n where is_first_comment\n\n), ticket_first_reply_time as (\n\n select \n first_reply_time.ticket_id,\n ticket_schedules.schedule_created_at,\n ticket_schedules.schedule_invalidated_at,\n ticket_schedules.schedule_id,\n round(\n \n\n datetime_diff(\n cast(ticket_schedules.schedule_created_at as datetime),\n cast(\n timestamp_trunc(\n cast(ticket_schedules.schedule_created_at as timestamp),\n week\n )\n\n as datetime),\n second\n )\n\n\n /60,\n 0) as start_time_in_minutes_from_week,\n greatest(0,\n round(\n \n \n\n datetime_diff(\n cast(least(ticket_schedules.schedule_invalidated_at, min(first_reply_time.agent_responded_at)) as datetime),\n cast(ticket_schedules.schedule_created_at as datetime),\n second\n )\n\n\n/60\n , 0)) as raw_delta_in_minutes\n \n from first_reply_time\n join ticket_schedules on first_reply_time.ticket_id = ticket_schedules.ticket_id\n group by 1, 2, 3, 4\n\n), weeks as (\n\n \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * pow(2, 0)\n + \n \n p1.generated_number * pow(2, 1)\n + \n \n p2.generated_number * pow(2, 2)\n + \n \n p3.generated_number * pow(2, 3)\n + \n \n p4.generated_number * pow(2, 4)\n + \n \n p5.generated_number * pow(2, 5)\n + \n \n p6.generated_number * pow(2, 6)\n + \n \n p7.generated_number * pow(2, 7)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 208\n order by generated_number\n\n\n\n), weeks_cross_ticket_first_reply as (\n\n select \n\n ticket_first_reply_time.*,\n generated_number - 1 as week_number\n\n from ticket_first_reply_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number - 1\n\n), weekly_periods as (\n \n select \n weeks_cross_ticket_first_reply.*, \n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n from weeks_cross_ticket_first_reply\n\n), intercepted_periods as (\n\n select ticket_id,\n week_number,\n weekly_periods.schedule_id,\n ticket_week_start_time,\n ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n\n)\n\n select ticket_id,\n sum(scheduled_minutes) as first_reply_time_business_minutes\n from intercepted_periods\n group by 1\n)"}], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`zendesk__ticket_metrics`"}, "model.zendesk.zendesk__ticket_summary": {"raw_sql": "with ticket_metrics as (\n select *\n from {{ ref('zendesk__ticket_metrics') }}\n\n), user_table as (\n select *\n from {{ ref('stg_zendesk__user') }}\n\n), user_sum as (\n select\n cast(1 as {{ dbt_utils.type_int() }}) as summary_helper,\n sum(case when is_active = true\n then 1\n else 0\n end) as user_count,\n sum(case when lower(role) != 'end-user' and is_active = true\n then 1\n else 0\n end) as active_agent_count,\n sum(case when is_active = false\n then 1\n else 0\n end) as deleted_user_count,\n sum(case when lower(role) = 'end-user' and is_active = true\n then 1\n else 0\n end) as end_user_count,\n sum(case when is_suspended = true\n then 1\n else 0\n end) as suspended_user_count\n from user_table\n\n group by 1\n\n), ticket_metric_sum as (\n select \n cast(1 as {{ dbt_utils.type_int() }}) as summary_helper,\n sum(case when lower(status) = 'new'\n then 1\n else 0\n end) as new_ticket_count,\n sum(case when lower(status) = 'hold'\n then 1\n else 0\n end) as on_hold_ticket_count,\n sum(case when lower(status) = 'open'\n then 1\n else 0\n end) as open_ticket_count,\n sum(case when lower(status) = 'pending'\n then 1\n else 0\n end) as pending_ticket_count,\n sum(case when lower(type) = 'problem'\n then 1\n else 0\n end) as problem_ticket_count,\n sum(case when first_assignee_id != last_assignee_id\n then 1\n else 0\n end) as reassigned_ticket_count,\n sum(case when count_reopens > 0\n then 1\n else 0\n end) as reopened_ticket_count,\n\n sum(case when lower(ticket_satisfaction_score) in ('offered', 'good', 'bad')\n then 1\n else 0\n end) as surveyed_satisfaction_ticket_count,\n\n sum(case when assignee_id is null and lower(status) not in ('solved', 'closed')\n then 1\n else 0\n end) as unassigned_unsolved_ticket_count,\n sum(case when total_agent_replies < 0\n then 1\n else 0\n end) as unreplied_ticket_count,\n sum(case when total_agent_replies < 0 and lower(status) not in ('solved', 'closed')\n then 1\n else 0\n end) as unreplied_unsolved_ticket_count,\n sum(case when lower(status) not in ('solved', 'closed')\n then 1\n else 0\n end) as unsolved_ticket_count,\n sum(case when lower(status) in ('solved', 'closed')\n then 1\n else 0\n end) as solved_ticket_count,\n sum(case when lower(status) in ('deleted')\n then 1\n else 0\n end) as deleted_ticket_count,\n sum(case when total_ticket_recoveries > 0\n then 1\n else 0\n end) as recovered_ticket_count,\n sum(case when assignee_stations_count > 0\n then 1\n else 0\n end) as assigned_ticket_count,\n count(count_internal_comments) as total_internal_comments,\n count(count_public_comments) as total_public_comments,\n count(total_comments)\n from ticket_metrics\n \n group by 1\n\n\n), final as (\n select\n user_sum.user_count,\n user_sum.active_agent_count,\n user_sum.deleted_user_count,\n user_sum.end_user_count,\n user_sum.suspended_user_count,\n ticket_metric_sum.new_ticket_count,\n ticket_metric_sum.on_hold_ticket_count,\n ticket_metric_sum.open_ticket_count,\n ticket_metric_sum.pending_ticket_count,\n ticket_metric_sum.solved_ticket_count,\n ticket_metric_sum.problem_ticket_count,\n ticket_metric_sum.assigned_ticket_count,\n ticket_metric_sum.reassigned_ticket_count,\n ticket_metric_sum.reopened_ticket_count,\n ticket_metric_sum.surveyed_satisfaction_ticket_count,\n ticket_metric_sum.unassigned_unsolved_ticket_count,\n ticket_metric_sum.unreplied_ticket_count,\n ticket_metric_sum.unreplied_unsolved_ticket_count,\n ticket_metric_sum.unsolved_ticket_count,\n ticket_metric_sum.recovered_ticket_count,\n ticket_metric_sum.deleted_ticket_count\n from user_sum\n\n left join ticket_metric_sum\n using(summary_helper)\n)\n\nselect *\nfrom final", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk", "zendesk__ticket_summary"], "unique_id": "model.zendesk.zendesk__ticket_summary", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "zendesk__ticket_summary.sql", "original_file_path": "models/zendesk__ticket_summary.sql", "name": "zendesk__ticket_summary", "resource_type": "model", "alias": "zendesk__ticket_summary", "checksum": {"name": "sha256", "checksum": "9430b74382989b212a68d21d168d54b0faba32a56434d583b7c58d58e64e9d9f"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["zendesk__ticket_metrics"], ["stg_zendesk__user"]], "sources": [], "depends_on": {"macros": ["macro.dbt_utils.type_int"], "nodes": ["model.zendesk.zendesk__ticket_metrics", "model.zendesk_source.stg_zendesk__user"]}, "description": "A single record table containing Zendesk ticket and user summary metrics. These metrics are updated for the current day the model is run.", "columns": {"user_count": {"name": "user_count", "description": "Total count of users created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "active_agent_count": {"name": "active_agent_count", "description": "Total count of agents", "meta": {}, "data_type": null, "quote": null, "tags": []}, "deleted_user_count": {"name": "deleted_user_count", "description": "Total deleted user count", "meta": {}, "data_type": null, "quote": null, "tags": []}, "end_user_count": {"name": "end_user_count", "description": "Total end user count", "meta": {}, "data_type": null, "quote": null, "tags": []}, "suspended_user_count": {"name": "suspended_user_count", "description": "Total count of users in a suspended state", "meta": {}, "data_type": null, "quote": null, "tags": []}, "new_ticket_count": {"name": "new_ticket_count", "description": "Total count of tickets in the \"new\" status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "on_hold_ticket_count": {"name": "on_hold_ticket_count", "description": "Total count of tickets in the \"hold\" status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "open_ticket_count": {"name": "open_ticket_count", "description": "Total count of tickets in the \"open\" status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "pending_ticket_count": {"name": "pending_ticket_count", "description": "Total count of tickets in the \"pending\" status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "solved_ticket_count": {"name": "solved_ticket_count", "description": "Total count of solved tickets", "meta": {}, "data_type": null, "quote": null, "tags": []}, "problem_ticket_count": {"name": "problem_ticket_count", "description": "Total count of tickets labeled as problems", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reassigned_ticket_count": {"name": "reassigned_ticket_count", "description": "Total count of tickets that have been reassigned", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reopened_ticket_count": {"name": "reopened_ticket_count", "description": "Total count of tickets that have been reopened", "meta": {}, "data_type": null, "quote": null, "tags": []}, "surveyed_satisfaction_ticket_count": {"name": "surveyed_satisfaction_ticket_count", "description": "Total count of tickets that have been surveyed for a satisfaction response", "meta": {}, "data_type": null, "quote": null, "tags": []}, "unassigned_unsolved_ticket_count": {"name": "unassigned_unsolved_ticket_count", "description": "Total count of tickets that are unassigned and unsolved", "meta": {}, "data_type": null, "quote": null, "tags": []}, "unreplied_ticket_count": {"name": "unreplied_ticket_count", "description": "Total count of tickets that have not had a reply", "meta": {}, "data_type": null, "quote": null, "tags": []}, "unreplied_unsolved_ticket_count": {"name": "unreplied_unsolved_ticket_count", "description": "Total count of tickets that have not had a reply and are unsolved", "meta": {}, "data_type": null, "quote": null, "tags": []}, "unsolved_ticket_count": {"name": "unsolved_ticket_count", "description": "Total count of unsolved tickets", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assigned_ticket_count": {"name": "assigned_ticket_count", "description": "Total count of assigned tickets", "meta": {}, "data_type": null, "quote": null, "tags": []}, "deleted_ticket_count": {"name": "deleted_ticket_count", "description": "Total count of deleted tickets", "meta": {}, "data_type": null, "quote": null, "tags": []}, "recovered_ticket_count": {"name": "recovered_ticket_count", "description": "Total count of tickets that were deleted then reopened", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/zendesk.yml", "build_path": "target/compiled/zendesk/models/zendesk__ticket_summary.sql", "deferred": false, "unrendered_config": {"materialized": "table"}, "compiled_sql": "with ticket_metrics as (\n select *\n from `dbt-package-testing`.`zendesk_integration_tests`.`zendesk__ticket_metrics`\n\n), user_table as (\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__user`\n\n), user_sum as (\n select\n cast(1 as \n int64\n) as summary_helper,\n sum(case when is_active = true\n then 1\n else 0\n end) as user_count,\n sum(case when lower(role) != 'end-user' and is_active = true\n then 1\n else 0\n end) as active_agent_count,\n sum(case when is_active = false\n then 1\n else 0\n end) as deleted_user_count,\n sum(case when lower(role) = 'end-user' and is_active = true\n then 1\n else 0\n end) as end_user_count,\n sum(case when is_suspended = true\n then 1\n else 0\n end) as suspended_user_count\n from user_table\n\n group by 1\n\n), ticket_metric_sum as (\n select \n cast(1 as \n int64\n) as summary_helper,\n sum(case when lower(status) = 'new'\n then 1\n else 0\n end) as new_ticket_count,\n sum(case when lower(status) = 'hold'\n then 1\n else 0\n end) as on_hold_ticket_count,\n sum(case when lower(status) = 'open'\n then 1\n else 0\n end) as open_ticket_count,\n sum(case when lower(status) = 'pending'\n then 1\n else 0\n end) as pending_ticket_count,\n sum(case when lower(type) = 'problem'\n then 1\n else 0\n end) as problem_ticket_count,\n sum(case when first_assignee_id != last_assignee_id\n then 1\n else 0\n end) as reassigned_ticket_count,\n sum(case when count_reopens > 0\n then 1\n else 0\n end) as reopened_ticket_count,\n\n sum(case when lower(ticket_satisfaction_score) in ('offered', 'good', 'bad')\n then 1\n else 0\n end) as surveyed_satisfaction_ticket_count,\n\n sum(case when assignee_id is null and lower(status) not in ('solved', 'closed')\n then 1\n else 0\n end) as unassigned_unsolved_ticket_count,\n sum(case when total_agent_replies < 0\n then 1\n else 0\n end) as unreplied_ticket_count,\n sum(case when total_agent_replies < 0 and lower(status) not in ('solved', 'closed')\n then 1\n else 0\n end) as unreplied_unsolved_ticket_count,\n sum(case when lower(status) not in ('solved', 'closed')\n then 1\n else 0\n end) as unsolved_ticket_count,\n sum(case when lower(status) in ('solved', 'closed')\n then 1\n else 0\n end) as solved_ticket_count,\n sum(case when lower(status) in ('deleted')\n then 1\n else 0\n end) as deleted_ticket_count,\n sum(case when total_ticket_recoveries > 0\n then 1\n else 0\n end) as recovered_ticket_count,\n sum(case when assignee_stations_count > 0\n then 1\n else 0\n end) as assigned_ticket_count,\n count(count_internal_comments) as total_internal_comments,\n count(count_public_comments) as total_public_comments,\n count(total_comments)\n from ticket_metrics\n \n group by 1\n\n\n), final as (\n select\n user_sum.user_count,\n user_sum.active_agent_count,\n user_sum.deleted_user_count,\n user_sum.end_user_count,\n user_sum.suspended_user_count,\n ticket_metric_sum.new_ticket_count,\n ticket_metric_sum.on_hold_ticket_count,\n ticket_metric_sum.open_ticket_count,\n ticket_metric_sum.pending_ticket_count,\n ticket_metric_sum.solved_ticket_count,\n ticket_metric_sum.problem_ticket_count,\n ticket_metric_sum.assigned_ticket_count,\n ticket_metric_sum.reassigned_ticket_count,\n ticket_metric_sum.reopened_ticket_count,\n ticket_metric_sum.surveyed_satisfaction_ticket_count,\n ticket_metric_sum.unassigned_unsolved_ticket_count,\n ticket_metric_sum.unreplied_ticket_count,\n ticket_metric_sum.unreplied_unsolved_ticket_count,\n ticket_metric_sum.unsolved_ticket_count,\n ticket_metric_sum.recovered_ticket_count,\n ticket_metric_sum.deleted_ticket_count\n from user_sum\n\n left join ticket_metric_sum\n using(summary_helper)\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`zendesk__ticket_summary`"}, "model.zendesk.zendesk__ticket_field_history": {"raw_sql": "{{ \n config(\n materialized='incremental',\n partition_by = {'field': 'date_day', 'data_type': 'date'},\n unique_key='ticket_day_id'\n ) \n}}\n\n{%- set change_data_columns = adapter.get_columns_in_relation(ref('int_zendesk__field_history_scd')) -%}\n\nwith change_data as (\n\n select *\n from {{ ref('int_zendesk__field_history_scd') }}\n \n {% if is_incremental() %}\n where valid_from >= (select max(date_day) from {{ this }})\n\n-- If no issue fields have been updated since the last incremental run, the pivoted_daily_history CTE will return no record/rows.\n-- When this is the case, we need to grab the most recent day's records from the previously built table so that we can persist \n-- those values into the future.\n\n), most_recent_data as ( \n\n select \n *\n from {{ this }}\n where date_day = (select max(date_day) from {{ this }} )\n\n{% endif %}\n\n), calendar as (\n\n select *\n from {{ ref('int_zendesk__field_calendar_spine') }}\n where date_day <= current_date\n {% if is_incremental() %}\n and date_day >= (select max(date_day) from {{ this }})\n {% endif %}\n\n), joined as (\n\n select \n calendar.date_day,\n calendar.ticket_id\n\n {% if is_incremental() %} \n {% for col in change_data_columns if col.name|lower not in ['ticket_id','valid_from','ticket_day_id'] %} \n , coalesce(change_data.{{ col.name }}, most_recent_data.{{ col.name }}) as {{ col.name }}\n {% endfor %}\n \n {% else %}\n {% for col in change_data_columns if col.name|lower not in ['ticket_id','valid_from','ticket_day_id'] %} \n , {{ col.name }}\n {% endfor %}\n {% endif %}\n\n from calendar\n left join change_data\n on calendar.ticket_id = change_data.ticket_id\n and calendar.date_day = change_data.valid_from\n \n {% if is_incremental() %}\n left join most_recent_data\n on calendar.ticket_id = most_recent_data.ticket_id\n and calendar.date_day = most_recent_data.date_day\n {% endif %}\n\n), fill_values as (\n\n select\n date_day,\n ticket_id \n -- For each ticket on each day, find the state of each column from the last record where a change occurred,\n -- identified by the presence of a record from the SCD table on that day\n {% for col in change_data_columns if col.name|lower not in ['ticket_id','valid_from','ticket_day_id'] %} \n \n ,last_value({{ col.name }} ignore nulls) over \n (partition by ticket_id order by date_day asc rows between unbounded preceding and current row) as {{ col.name }}\n\n {% endfor %}\n\n from joined\n\n), fix_null_values as (\n\n select \n date_day,\n ticket_id\n {% for col in change_data_columns if col.name|lower not in ['ticket_id','valid_from','ticket_day_id'] %} \n\n -- we de-nulled the true null values earlier in order to differentiate them from nulls that just needed to be backfilled\n , case when cast( {{ col.name }} as {{ dbt_utils.type_string() }} ) = 'is_null' then null else {{ col.name }} end as {{ col.name }}\n {% endfor %}\n\n from fill_values\n\n), surrogate_key as (\n\n select\n *,\n {{ dbt_utils.surrogate_key(['date_day','ticket_id']) }} as ticket_day_id\n\n from fix_null_values\n)\n\nselect *\nfrom surrogate_key", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk", "zendesk__ticket_field_history"], "unique_id": "model.zendesk.zendesk__ticket_field_history", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "zendesk__ticket_field_history.sql", "original_file_path": "models/zendesk__ticket_field_history.sql", "name": "zendesk__ticket_field_history", "resource_type": "model", "alias": "zendesk__ticket_field_history", "checksum": {"name": "sha256", "checksum": "c13c28357457c2750b444078a209c4ddb8164f9f3af0a6e3cdfec14f08d681cd"}, "config": {"enabled": true, "materialized": "incremental", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "partition_by": {"field": "date_day", "data_type": "date"}, "unique_key": "ticket_day_id"}, "tags": [], "refs": [["int_zendesk__field_history_scd"], ["int_zendesk__field_history_scd"], ["int_zendesk__field_calendar_spine"]], "sources": [], "depends_on": {"macros": ["macro.dbt.is_incremental", "macro.dbt_utils.surrogate_key", "macro.dbt_utils.type_string"], "nodes": ["model.zendesk.int_zendesk__field_history_scd", "model.zendesk.int_zendesk__field_history_scd", "model.zendesk.int_zendesk__field_calendar_spine"]}, "description": "A daily historical view of the ticket field values defined in the `ticket_field_history_columns` variable and the corresponding updater fields defined in the `ticket_field_history_updater_columns` variable.\n", "columns": {"date_day": {"name": "date_day", "description": "The date of the day associated with the field values.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_id": {"name": "ticket_id", "description": "A ticket's unique identifier, it is automatically assigned when the ticket is created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_day_id": {"name": "ticket_day_id", "description": "The unique key of the table, a surrogate key of date_day and ticket_id.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_id": {"name": "assignee_id", "description": "The assignee id assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "The status of the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "priority": {"name": "priority", "description": "The tickets priority ranking", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/zendesk.yml", "build_path": "target/compiled/zendesk/models/zendesk__ticket_field_history.sql", "deferred": false, "unrendered_config": {"materialized": "incremental", "partition_by": {"field": "date_day", "data_type": "date"}, "unique_key": "ticket_day_id"}, "compiled_sql": "with change_data as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__field_history_scd`\n \n \n where valid_from >= (select max(date_day) from `dbt-package-testing`.`zendesk_integration_tests`.`zendesk__ticket_field_history`)\n\n-- If no issue fields have been updated since the last incremental run, the pivoted_daily_history CTE will return no record/rows.\n-- When this is the case, we need to grab the most recent day's records from the previously built table so that we can persist \n-- those values into the future.\n\n), most_recent_data as ( \n\n select \n *\n from `dbt-package-testing`.`zendesk_integration_tests`.`zendesk__ticket_field_history`\n where date_day = (select max(date_day) from `dbt-package-testing`.`zendesk_integration_tests`.`zendesk__ticket_field_history` )\n\n\n\n), calendar as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__field_calendar_spine`\n where date_day <= current_date\n \n and date_day >= (select max(date_day) from `dbt-package-testing`.`zendesk_integration_tests`.`zendesk__ticket_field_history`)\n \n\n), joined as (\n\n select \n calendar.date_day,\n calendar.ticket_id\n\n \n \n , coalesce(change_data.status, most_recent_data.status) as status\n \n , coalesce(change_data.priority, most_recent_data.priority) as priority\n \n , coalesce(change_data.assignee_id, most_recent_data.assignee_id) as assignee_id\n \n \n \n\n from calendar\n left join change_data\n on calendar.ticket_id = change_data.ticket_id\n and calendar.date_day = change_data.valid_from\n \n \n left join most_recent_data\n on calendar.ticket_id = most_recent_data.ticket_id\n and calendar.date_day = most_recent_data.date_day\n \n\n), fill_values as (\n\n select\n date_day,\n ticket_id \n -- For each ticket on each day, find the state of each column from the last record where a change occurred,\n -- identified by the presence of a record from the SCD table on that day\n \n \n ,last_value(status ignore nulls) over \n (partition by ticket_id order by date_day asc rows between unbounded preceding and current row) as status\n\n \n \n ,last_value(priority ignore nulls) over \n (partition by ticket_id order by date_day asc rows between unbounded preceding and current row) as priority\n\n \n \n ,last_value(assignee_id ignore nulls) over \n (partition by ticket_id order by date_day asc rows between unbounded preceding and current row) as assignee_id\n\n \n\n from joined\n\n), fix_null_values as (\n\n select \n date_day,\n ticket_id\n \n\n -- we de-nulled the true null values earlier in order to differentiate them from nulls that just needed to be backfilled\n , case when cast( status as \n string\n ) = 'is_null' then null else status end as status\n \n\n -- we de-nulled the true null values earlier in order to differentiate them from nulls that just needed to be backfilled\n , case when cast( priority as \n string\n ) = 'is_null' then null else priority end as priority\n \n\n -- we de-nulled the true null values earlier in order to differentiate them from nulls that just needed to be backfilled\n , case when cast( assignee_id as \n string\n ) = 'is_null' then null else assignee_id end as assignee_id\n \n\n from fill_values\n\n), surrogate_key as (\n\n select\n *,\n to_hex(md5(cast(concat(coalesce(cast(date_day as \n string\n), ''), '-', coalesce(cast(ticket_id as \n string\n), '')) as \n string\n))) as ticket_day_id\n\n from fix_null_values\n)\n\nselect *\nfrom surrogate_key", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`zendesk__ticket_field_history`"}, "model.zendesk.zendesk__sla_policies": {"raw_sql": "--final step where we union together all of the reply time and agent work time breaches\n\nwith reply_time_sla as (\n\n select * \n from {{ ref('int_zendesk__reply_time_combined') }}\n\n), agent_work_calendar_sla as (\n\n select *\n from {{ ref('int_zendesk__agent_work_time_calendar_hours') }}\n\n), requester_wait_calendar_sla as (\n\n select *\n from {{ ref('int_zendesk__requester_wait_time_calendar_hours') }}\n\n{% if var('using_schedules', True) %}\n\n), agent_work_business_sla as (\n\n select *\n from {{ ref('int_zendesk__agent_work_time_business_hours') }}\n\n), requester_wait_business_sla as (\n select *\n from {{ ref('int_zendesk__requester_wait_time_business_hours') }}\n\n{% endif %}\n\n), all_slas_unioned as (\n select\n ticket_id,\n sla_policy_name,\n metric,\n sla_applied_at,\n target,\n in_business_hours,\n sla_breach_at,\n sla_elapsed_time,\n is_sla_breached\n from reply_time_sla\n\nunion all\n\n select\n ticket_id,\n sla_policy_name,\n 'agent_work_time' as metric,\n sla_applied_at,\n target,\n 'false' as in_business_hours,\n max(sla_breach_at) as sla_breach_at,\n sum(running_total_calendar_minutes) as sla_elapsed_time,\n {{ fivetran_utils.max_bool(\"is_breached_during_schedule\") }}\n from agent_work_calendar_sla\n\n group by 1, 2, 3, 4, 5, 6\n\nunion all\n\n select\n ticket_id,\n sla_policy_name,\n 'requester_wait_time' as metric,\n sla_applied_at,\n target,\n 'false' as in_business_hours,\n max(sla_breach_at) as sla_breach_at,\n sum(running_total_calendar_minutes) as sla_elapsed_time,\n {{ fivetran_utils.max_bool(\"is_breached_during_schedule\") }}\n from requester_wait_calendar_sla\n\n group by 1, 2, 3, 4, 5, 6\n\n\n{% if var('using_schedules', True) %}\n\nunion all \n\n select \n ticket_id,\n sla_policy_name,\n 'agent_work_time' as metric,\n sla_applied_at,\n target,\n 'true' as in_business_hours,\n max(sla_breach_at) as sla_breach_at,\n sum(running_total_scheduled_minutes) as sla_elapsed_time,\n {{ fivetran_utils.max_bool(\"is_breached_during_schedule\") }}\n from agent_work_business_sla\n \n group by 1, 2, 3, 4, 5, 6\n\nunion all \n\n select \n ticket_id,\n sla_policy_name,\n 'requester_wait_time' as metric,\n sla_applied_at,\n target,\n 'true' as in_business_hours,\n max(sla_breach_at) as sla_breach_at,\n sum(running_total_scheduled_minutes) as sla_elapsed_time,\n {{ fivetran_utils.max_bool(\"is_breached_during_schedule\") }}\n \n from requester_wait_business_sla\n \n group by 1, 2, 3, 4, 5, 6\n\n{% endif %}\n\n)\n\nselect \n {{ dbt_utils.surrogate_key(['ticket_id', 'metric', 'sla_applied_at']) }} as sla_event_id,\n ticket_id,\n sla_policy_name,\n metric,\n sla_applied_at,\n target,\n in_business_hours,\n sla_breach_at,\n case when sla_elapsed_time is null\n then {{ dbt_utils.datediff(\"sla_applied_at\", dbt_utils.current_timestamp(), 'minute') }} --This will create an entry for active sla's\n else sla_elapsed_time\n end as sla_elapsed_time,\n sla_breach_at > current_timestamp as is_active_sla,\n case when (sla_breach_at > {{ dbt_utils.current_timestamp() }})\n then null\n else is_sla_breached\n end as is_sla_breach\nfrom all_slas_unioned", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk", "zendesk__sla_policies"], "unique_id": "model.zendesk.zendesk__sla_policies", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "zendesk__sla_policies.sql", "original_file_path": "models/zendesk__sla_policies.sql", "name": "zendesk__sla_policies", "resource_type": "model", "alias": "zendesk__sla_policies", "checksum": {"name": "sha256", "checksum": "482e4564f8882538de4abe742243b41ff0d1fa00165c39094eb210671f3797d8"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["int_zendesk__reply_time_combined"], ["int_zendesk__agent_work_time_calendar_hours"], ["int_zendesk__requester_wait_time_calendar_hours"], ["int_zendesk__agent_work_time_business_hours"], ["int_zendesk__requester_wait_time_business_hours"]], "sources": [], "depends_on": {"macros": ["macro.fivetran_utils.max_bool", "macro.dbt_utils.surrogate_key", "macro.dbt_utils.current_timestamp", "macro.dbt_utils.datediff"], "nodes": ["model.zendesk.int_zendesk__reply_time_combined", "model.zendesk.int_zendesk__agent_work_time_calendar_hours", "model.zendesk.int_zendesk__requester_wait_time_calendar_hours", "model.zendesk.int_zendesk__agent_work_time_business_hours", "model.zendesk.int_zendesk__requester_wait_time_business_hours"]}, "description": "Each record represents an SLA policy event and additional sla breach and achievement metrics. Calendar and business hour SLA breaches are supported.", "columns": {"sla_event_id": {"name": "sla_event_id", "description": "A surrogate key generated from the combination of ticket_id, metric, and sla_applied_at fields", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_id": {"name": "ticket_id", "description": "A ticket's unique identifier, it is automatically assigned when the ticket is created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "sla_policy_name": {"name": "sla_policy_name", "description": "The name of the SLA policy associated with the SLA metric", "meta": {}, "data_type": null, "quote": null, "tags": []}, "metric": {"name": "metric", "description": "The SLA metric, either agent_work_time, requester_wait_time, first_reply_time or next_reply_time", "meta": {}, "data_type": null, "quote": null, "tags": []}, "sla_applied_at": {"name": "sla_applied_at", "description": "When the SLA target was triggered. This is the starting time", "meta": {}, "data_type": null, "quote": null, "tags": []}, "target": {"name": "target", "description": "The SLA target, in minutes", "meta": {}, "data_type": null, "quote": null, "tags": []}, "in_business_hours": {"name": "in_business_hours", "description": "Boolean field indicating if the SLA target is in business hours (true) or calendar hours (false)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "sla_breach_at": {"name": "sla_breach_at", "description": "The time or expected time of the SLA breach event", "meta": {}, "data_type": null, "quote": null, "tags": []}, "sla_elapsed_time": {"name": "sla_elapsed_time", "description": "The total elapsed time to achieve the SLA metric whether breached or achieved", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_active_sla": {"name": "is_active_sla", "description": "Boolean field indicating that the SLA event is currently active and not breached (true) or past (false)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_sla_breach": {"name": "is_sla_breach", "description": "Boolean field indicating if the SLA has been breached (true) or was achieved (false)", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/zendesk.yml", "build_path": "target/compiled/zendesk/models/zendesk__sla_policies.sql", "deferred": false, "unrendered_config": {"materialized": "table"}, "compiled_sql": "--final step where we union together all of the reply time and agent work time breaches\n\nwith reply_time_sla as (\n\n select * \n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__reply_time_combined`\n\n), agent_work_calendar_sla as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__agent_work_time_calendar_hours`\n\n), requester_wait_calendar_sla as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__requester_wait_time_calendar_hours`\n\n\n\n), agent_work_business_sla as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__agent_work_time_business_hours`\n\n), requester_wait_business_sla as (\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__requester_wait_time_business_hours`\n\n\n\n), all_slas_unioned as (\n select\n ticket_id,\n sla_policy_name,\n metric,\n sla_applied_at,\n target,\n in_business_hours,\n sla_breach_at,\n sla_elapsed_time,\n is_sla_breached\n from reply_time_sla\n\nunion all\n\n select\n ticket_id,\n sla_policy_name,\n 'agent_work_time' as metric,\n sla_applied_at,\n target,\n 'false' as in_business_hours,\n max(sla_breach_at) as sla_breach_at,\n sum(running_total_calendar_minutes) as sla_elapsed_time,\n \n\n max( is_breached_during_schedule )\n\n\n from agent_work_calendar_sla\n\n group by 1, 2, 3, 4, 5, 6\n\nunion all\n\n select\n ticket_id,\n sla_policy_name,\n 'requester_wait_time' as metric,\n sla_applied_at,\n target,\n 'false' as in_business_hours,\n max(sla_breach_at) as sla_breach_at,\n sum(running_total_calendar_minutes) as sla_elapsed_time,\n \n\n max( is_breached_during_schedule )\n\n\n from requester_wait_calendar_sla\n\n group by 1, 2, 3, 4, 5, 6\n\n\n\n\nunion all \n\n select \n ticket_id,\n sla_policy_name,\n 'agent_work_time' as metric,\n sla_applied_at,\n target,\n 'true' as in_business_hours,\n max(sla_breach_at) as sla_breach_at,\n sum(running_total_scheduled_minutes) as sla_elapsed_time,\n \n\n max( is_breached_during_schedule )\n\n\n from agent_work_business_sla\n \n group by 1, 2, 3, 4, 5, 6\n\nunion all \n\n select \n ticket_id,\n sla_policy_name,\n 'requester_wait_time' as metric,\n sla_applied_at,\n target,\n 'true' as in_business_hours,\n max(sla_breach_at) as sla_breach_at,\n sum(running_total_scheduled_minutes) as sla_elapsed_time,\n \n\n max( is_breached_during_schedule )\n\n\n \n from requester_wait_business_sla\n \n group by 1, 2, 3, 4, 5, 6\n\n\n\n)\n\nselect \n to_hex(md5(cast(concat(coalesce(cast(ticket_id as \n string\n), ''), '-', coalesce(cast(metric as \n string\n), ''), '-', coalesce(cast(sla_applied_at as \n string\n), '')) as \n string\n))) as sla_event_id,\n ticket_id,\n sla_policy_name,\n metric,\n sla_applied_at,\n target,\n in_business_hours,\n sla_breach_at,\n case when sla_elapsed_time is null\n then \n\n datetime_diff(\n cast(\n current_timestamp\n as datetime),\n cast(sla_applied_at as datetime),\n minute\n )\n\n --This will create an entry for active sla's\n else sla_elapsed_time\n end as sla_elapsed_time,\n sla_breach_at > current_timestamp as is_active_sla,\n case when (sla_breach_at > \n current_timestamp\n)\n then null\n else is_sla_breached\n end as is_sla_breach\nfrom all_slas_unioned", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`zendesk__sla_policies`"}, "model.zendesk.zendesk__ticket_backlog": {"raw_sql": "--This model will only run if 'status' is included within the `ticket_field_history_columns` variable.\n{{ config(enabled = 'status' in var('ticket_field_history_columns')) }}\n\nwith ticket_field_history as (\n select *\n from {{ ref('zendesk__ticket_field_history') }}\n\n), tickets as (\n select *\n from {{ ref('stg_zendesk__ticket') }}\n\n), group_names as (\n select *\n from {{ ref('stg_zendesk__group') }}\n\n), users as (\n select *\n from {{ ref('stg_zendesk__user') }}\n\n), brands as (\n select *\n from {{ ref('stg_zendesk__brand') }}\n\n--The below model is excluded if the user does not include ticket_form_id in the variable as a low percentage of accounts use ticket forms.\n{% if 'ticket_form_id' in var('ticket_field_history_columns') %}\n), ticket_forms as (\n select *\n from {{ ref('int_zendesk__latest_ticket_form') }}\n{% endif %}\n\n), organizations as (\n select *\n from {{ ref('stg_zendesk__organization') }}\n\n), backlog as (\n select\n ticket_field_history.date_day\n ,ticket_field_history.ticket_id\n ,ticket_field_history.status\n ,tickets.created_channel\n {% for col in var('ticket_field_history_columns') if col != 'status' %} --Looking at all history fields the users passed through in their dbt_project.yml file\n {% if col in ['assignee_id'] %} --Standard ID field where the name can easily be joined from stg model.\n ,assignee.name as assignee_name\n\n {% elif col in ['requester_id'] %} --Standard ID field where the name can easily be joined from stg model.\n ,requester.name as requester_name\n\n {% elif col in ['ticket_form_id'] %} --Standard ID field where the name can easily be joined from stg model.\n ,ticket_forms.name as ticket_form_name\n\n {% elif col in ['organization_id'] %} --Standard ID field where the name can easily be joined from stg model.\n ,organizations.name as organization_name\n\n {% elif col in ['brand_id'] %} --Standard ID field where the name can easily be joined from stg model.\n ,brands.name as brand_name\n\n {% elif col in ['group_id'] %} --Standard ID field where the name can easily be joined from stg model.\n ,group_names.name as group_name\n\n {% elif col in ['locale_id'] %} --Standard ID field where the name can easily be joined from stg model.\n ,assignee.locale as local_name\n\n {% else %} --All other fields are not ID's and can simply be included in the query.\n ,ticket_field_history.{{ col }}\n {% endif %}\n {% endfor %}\n\n from ticket_field_history\n\n left join tickets\n on tickets.ticket_id = ticket_field_history.ticket_id\n\n {% if 'ticket_form_id' in var('ticket_field_history_columns') %} --Join not needed if field is not located in variable, otherwise it is included.\n left join ticket_forms\n on ticket_forms.ticket_form_id = cast(ticket_field_history.ticket_form_id as {{ dbt_utils.type_int() }})\n {% endif %}\n\n {% if 'group_id' in var('ticket_field_history_columns') %}--Join not needed if field is not located in variable, otherwise it is included.\n left join group_names\n on group_names.group_id = cast(ticket_field_history.group_id as {{ dbt_utils.type_int() }})\n {% endif %}\n\n {% if 'assignee_id' in var('ticket_field_history_columns') or 'requester_id' in var('ticket_field_history_columns') or 'locale_id' in var('ticket_field_history_columns')%} --Join not needed if fields is not located in variable, otherwise it is included.\n left join users as assignee\n on assignee.user_id = cast(ticket_field_history.assignee_id as {{ dbt_utils.type_int() }})\n {% endif %}\n\n {% if 'requester_id' in var('ticket_field_history_columns') %} --Join not needed if field is not located in variable, otherwise it is included.\n left join users as requester\n on requester.user_id = cast(ticket_field_history.requester_id as {{ dbt_utils.type_int() }})\n {% endif %}\n\n {% if 'brand_id' in var('ticket_field_history_columns') %} --Join not needed if field is not located in variable, otherwise it is included.\n left join brands\n on brands.brand_id = cast(ticket_field_history.brand_id as {{ dbt_utils.type_int() }})\n {% endif %}\n\n {% if 'organization_id' in var('ticket_field_history_columns') %} --Join not needed if field is not located in variable, otherwise it is included.\n left join organizations\n on organizations.organization_id = cast(ticket_field_history.organization_id as {{ dbt_utils.type_int() }})\n {% endif %}\n\n where ticket_field_history.status not in ('closed', 'solved', 'deleted')\n)\n\nselect *\nfrom backlog", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk", "zendesk__ticket_backlog"], "unique_id": "model.zendesk.zendesk__ticket_backlog", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "zendesk__ticket_backlog.sql", "original_file_path": "models/zendesk__ticket_backlog.sql", "name": "zendesk__ticket_backlog", "resource_type": "model", "alias": "zendesk__ticket_backlog", "checksum": {"name": "sha256", "checksum": "984b3088b0c007353da55ca3fafda037fc8834fbf9087bb48448799502c9c046"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["zendesk__ticket_field_history"], ["stg_zendesk__ticket"], ["stg_zendesk__group"], ["stg_zendesk__user"], ["stg_zendesk__brand"], ["stg_zendesk__organization"]], "sources": [], "depends_on": {"macros": ["macro.dbt_utils.type_int"], "nodes": ["model.zendesk.zendesk__ticket_field_history", "model.zendesk_source.stg_zendesk__ticket", "model.zendesk_source.stg_zendesk__group", "model.zendesk_source.stg_zendesk__user", "model.zendesk_source.stg_zendesk__brand", "model.zendesk_source.stg_zendesk__organization"]}, "description": "A daily historical view of the ticket field values defined in the `ticket_field_history_columns` variable for all backlog tickets. Backlog tickets being defined as any ticket not a 'closed', 'deleted', or 'solved' status.\n", "columns": {"date_day": {"name": "date_day", "description": "The date of the day associated with the field values", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_id": {"name": "ticket_id", "description": "A ticket's unique identifier, it is automatically assigned when the ticket is created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "The status of the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_channel": {"name": "created_channel", "description": "The channel where the ticket was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_name": {"name": "assignee_name", "description": "The assignee name assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "priority": {"name": "priority", "description": "The tickets priority ranking", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/zendesk.yml", "build_path": "target/compiled/zendesk/models/zendesk__ticket_backlog.sql", "deferred": false, "unrendered_config": {"materialized": "table", "enabled": true}, "compiled_sql": "--This model will only run if 'status' is included within the `ticket_field_history_columns` variable.\n\n\nwith ticket_field_history as (\n select *\n from `dbt-package-testing`.`zendesk_integration_tests`.`zendesk__ticket_field_history`\n\n), tickets as (\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket`\n\n), group_names as (\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__group`\n\n), users as (\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__user`\n\n), brands as (\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__brand`\n\n--The below model is excluded if the user does not include ticket_form_id in the variable as a low percentage of accounts use ticket forms.\n\n\n), organizations as (\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__organization`\n\n), backlog as (\n select\n ticket_field_history.date_day\n ,ticket_field_history.ticket_id\n ,ticket_field_history.status\n ,tickets.created_channel\n --Looking at all history fields the users passed through in their dbt_project.yml file\n --Standard ID field where the name can easily be joined from stg model.\n ,assignee.name as assignee_name\n\n \n --Looking at all history fields the users passed through in their dbt_project.yml file\n --All other fields are not ID's and can simply be included in the query.\n ,ticket_field_history.priority\n \n \n\n from ticket_field_history\n\n left join tickets\n on tickets.ticket_id = ticket_field_history.ticket_id\n\n \n\n \n\n --Join not needed if fields is not located in variable, otherwise it is included.\n left join users as assignee\n on assignee.user_id = cast(ticket_field_history.assignee_id as \n int64\n)\n \n\n \n\n \n\n \n\n where ticket_field_history.status not in ('closed', 'solved', 'deleted')\n)\n\nselect *\nfrom backlog", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`zendesk__ticket_backlog`"}, "model.zendesk.int_zendesk__sla_policy_applied": {"raw_sql": "-- step 1, figure out when sla was applied to tickets\n\n-- more on SLA policies here: https://support.zendesk.com/hc/en-us/articles/204770038-Defining-and-using-SLA-policies-Professional-and-Enterprise-\n-- SLA policies are calculated for next_reply_time, first_reply_time, agent_work_time, requester_wait_time. If you're company uses other SLA metrics, and would like this\n-- package to support those, please reach out to the Fivetran team on Slack.\n\nwith ticket_field_history as (\n\n select *\n from {{ ref('int_zendesk__updates') }}\n\n), sla_policy_name as (\n\n select *\n from {{ ref('int_zendesk__updates') }}\n where field_name = ('sla_policy')\n\n), ticket as (\n\n select *\n from {{ ref('int_zendesk__ticket_aggregates') }}\n\n), sla_policy_applied as (\n\n select\n ticket_field_history.ticket_id,\n ticket.created_at as ticket_created_at,\n ticket.status as ticket_current_status,\n ticket_field_history.field_name as metric,\n ticket_field_history.valid_starting_at as sla_applied_at,\n cast({{ fivetran_utils.json_extract('ticket_field_history.value', 'minutes') }} as {{ dbt_utils.type_int() }} ) as target,\n {{ fivetran_utils.json_extract('ticket_field_history.value', 'in_business_hours') }} as in_business_hours\n from ticket_field_history\n join ticket\n on ticket.ticket_id = ticket_field_history.ticket_id\n where ticket_field_history.value is not null\n and ticket_field_history.field_name in ('next_reply_time', 'first_reply_time', 'agent_work_time', 'requester_wait_time') --('periodic_update_time')\n\n), final as (\n select\n sla_policy_applied.*,\n sla_policy_name.value as sla_policy_name\n from sla_policy_applied\n left join sla_policy_name\n on sla_policy_name.ticket_id = sla_policy_applied.ticket_id\n and sla_policy_applied.sla_applied_at >= sla_policy_name.valid_starting_at\n and sla_policy_applied.sla_applied_at < coalesce(sla_policy_name.valid_ending_at, {{ dbt_utils.current_timestamp() }}) \n)\n\nselect *\nfrom final", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "fqn": ["zendesk", "sla_policy", "int_zendesk__sla_policy_applied"], "unique_id": "model.zendesk.int_zendesk__sla_policy_applied", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "sla_policy/int_zendesk__sla_policy_applied.sql", "original_file_path": "models/sla_policy/int_zendesk__sla_policy_applied.sql", "name": "int_zendesk__sla_policy_applied", "resource_type": "model", "alias": "int_zendesk__sla_policy_applied", "checksum": {"name": "sha256", "checksum": "25bd1ba197780d365fae748aa87d0e93d06862b3f7dea1dad766b1fa2383b3e2"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["int_zendesk__updates"], ["int_zendesk__updates"], ["int_zendesk__ticket_aggregates"]], "sources": [], "depends_on": {"macros": ["macro.fivetran_utils.json_extract", "macro.dbt_utils.type_int", "macro.dbt_utils.current_timestamp"], "nodes": ["model.zendesk.int_zendesk__updates", "model.zendesk.int_zendesk__updates", "model.zendesk.int_zendesk__ticket_aggregates"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/sla_policy/int_zendesk__sla_policy_applied.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_intermediate"}, "compiled_sql": "-- step 1, figure out when sla was applied to tickets\n\n-- more on SLA policies here: https://support.zendesk.com/hc/en-us/articles/204770038-Defining-and-using-SLA-policies-Professional-and-Enterprise-\n-- SLA policies are calculated for next_reply_time, first_reply_time, agent_work_time, requester_wait_time. If you're company uses other SLA metrics, and would like this\n-- package to support those, please reach out to the Fivetran team on Slack.\n\nwith ticket_field_history as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__updates`\n\n), sla_policy_name as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__updates`\n where field_name = ('sla_policy')\n\n), ticket as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_aggregates`\n\n), sla_policy_applied as (\n\n select\n ticket_field_history.ticket_id,\n ticket.created_at as ticket_created_at,\n ticket.status as ticket_current_status,\n ticket_field_history.field_name as metric,\n ticket_field_history.valid_starting_at as sla_applied_at,\n cast(\n\n json_extract(ticket_field_history.value, '$.minutes' )\n\n as \n int64\n ) as target,\n \n\n json_extract(ticket_field_history.value, '$.in_business_hours' )\n\n as in_business_hours\n from ticket_field_history\n join ticket\n on ticket.ticket_id = ticket_field_history.ticket_id\n where ticket_field_history.value is not null\n and ticket_field_history.field_name in ('next_reply_time', 'first_reply_time', 'agent_work_time', 'requester_wait_time') --('periodic_update_time')\n\n), final as (\n select\n sla_policy_applied.*,\n sla_policy_name.value as sla_policy_name\n from sla_policy_applied\n left join sla_policy_name\n on sla_policy_name.ticket_id = sla_policy_applied.ticket_id\n and sla_policy_applied.sla_applied_at >= sla_policy_name.valid_starting_at\n and sla_policy_applied.sla_applied_at < coalesce(sla_policy_name.valid_ending_at, \n current_timestamp\n) \n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__sla_policy_applied`"}, "model.zendesk.int_zendesk__agent_work_time_business_hours": {"raw_sql": "{{ config(enabled=var('using_schedules', True)) }}\n\n-- AGENT WORK TIME\n-- This is complicated, as SLAs minutes are only counted while the ticket is in 'new' or 'open' status.\n\n-- Additionally, for business hours, only 'new' or 'open' status hours are counted if they are also during business hours\nwith agent_work_time_filtered_statuses as (\n\n select *\n from {{ ref('int_zendesk__agent_work_time_filtered_statuses') }}\n where in_business_hours = 'true'\n\n), schedule as (\n\n select * \n from {{ ref('stg_zendesk__schedule') }}\n\n), ticket_schedules as (\n\n select * \n from {{ ref('int_zendesk__ticket_schedules') }}\n \n-- cross schedules with work time\n), ticket_status_crossed_with_schedule as (\n \n select\n agent_work_time_filtered_statuses.ticket_id,\n agent_work_time_filtered_statuses.sla_applied_at,\n agent_work_time_filtered_statuses.target, \n agent_work_time_filtered_statuses.sla_policy_name, \n ticket_schedules.schedule_id,\n greatest(valid_starting_at, schedule_created_at) as valid_starting_at,\n least(valid_ending_at, schedule_invalidated_at) as valid_ending_at\n from agent_work_time_filtered_statuses\n left join ticket_schedules\n on agent_work_time_filtered_statuses.ticket_id = ticket_schedules.ticket_id\n where {{ fivetran_utils.timestamp_diff(\n 'greatest(valid_starting_at, schedule_created_at)', \n 'least(valid_ending_at, schedule_invalidated_at)', \n 'second') }} > 0\n\n), ticket_full_solved_time as (\n\n select \n ticket_status_crossed_with_schedule.*,\n round({{ fivetran_utils.timestamp_diff(\n \"\" ~ dbt_utils.date_trunc(\n 'week',\n 'ticket_status_crossed_with_schedule.valid_starting_at') ~ \"\", \n 'ticket_status_crossed_with_schedule.valid_starting_at', \n 'second') }} /60,\n 0) as valid_starting_at_in_minutes_from_week,\n round({{ fivetran_utils.timestamp_diff(\n 'ticket_status_crossed_with_schedule.valid_starting_at', \n 'ticket_status_crossed_with_schedule.valid_ending_at',\n 'second') }} /60,\n 0) as raw_delta_in_minutes\n from ticket_status_crossed_with_schedule\n group by 1, 2, 3, 4, 5, 6, 7, 8\n\n), weeks as (\n\n {{ dbt_utils.generate_series(208) }}\n\n), weeks_cross_ticket_full_solved_time as (\n \n select \n ticket_full_solved_time.*,\n generated_number - 1 as week_number\n from ticket_full_solved_time\n cross join weeks\n where floor((valid_starting_at_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number -1\n\n), weekly_period_agent_work_time as (\n\n select \n\n ticket_id,\n sla_applied_at,\n valid_starting_at,\n valid_ending_at,\n target,\n sla_policy_name,\n valid_starting_at_in_minutes_from_week,\n raw_delta_in_minutes,\n week_number,\n schedule_id,\n greatest(0, valid_starting_at_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time_minute,\n least(valid_starting_at_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time_minute\n \n from weeks_cross_ticket_full_solved_time\n\n), intercepted_periods_agent as (\n \n select \n weekly_period_agent_work_time.ticket_id,\n weekly_period_agent_work_time.sla_applied_at,\n weekly_period_agent_work_time.target,\n weekly_period_agent_work_time.sla_policy_name,\n weekly_period_agent_work_time.valid_starting_at,\n weekly_period_agent_work_time.valid_ending_at,\n weekly_period_agent_work_time.week_number,\n weekly_period_agent_work_time.ticket_week_start_time_minute,\n weekly_period_agent_work_time.ticket_week_end_time_minute,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time_minute, schedule.end_time_utc) - greatest(weekly_period_agent_work_time.ticket_week_start_time_minute, schedule.start_time_utc) as scheduled_minutes\n from weekly_period_agent_work_time\n join schedule on ticket_week_start_time_minute <= schedule.end_time_utc \n and ticket_week_end_time_minute >= schedule.start_time_utc\n and weekly_period_agent_work_time.schedule_id = schedule.schedule_id\n\n), intercepted_periods_with_running_total as (\n \n select \n *,\n sum(scheduled_minutes) over \n (partition by ticket_id, sla_applied_at \n order by valid_starting_at, week_number, schedule_end_time\n rows between unbounded preceding and current row)\n as running_total_scheduled_minutes\n\n from intercepted_periods_agent\n\n\n), intercepted_periods_agent_with_breach_flag as (\n select \n intercepted_periods_with_running_total.*,\n target - running_total_scheduled_minutes as remaining_target_minutes,\n lag(target - running_total_scheduled_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at, week_number, schedule_end_time) as lag_check,\n case when (target - running_total_scheduled_minutes) = 0 then true\n when (target - running_total_scheduled_minutes) < 0 \n and \n (lag(target - running_total_scheduled_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at, week_number, schedule_end_time) > 0 \n or \n lag(target - running_total_scheduled_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at, week_number, schedule_end_time) is null) \n then true else false end as is_breached_during_schedule\n \n from intercepted_periods_with_running_total\n\n), intercepted_periods_agent_filtered as (\n\n select\n *,\n (remaining_target_minutes + scheduled_minutes) as breach_minutes,\n greatest(ticket_week_start_time_minute, schedule_start_time) + (remaining_target_minutes + scheduled_minutes) as breach_minutes_from_week\n from intercepted_periods_agent_with_breach_flag\n \n), agent_work_business_breach as (\n \n select \n *,\n {{ fivetran_utils.timestamp_add(\n \"minute\",\n \"cast(((7*24*60) * week_number) + breach_minutes_from_week as \" ~ dbt_utils.type_int() ~ \" )\",\n \"\" ~ dbt_utils.date_trunc('week', 'valid_starting_at') ~ \"\",\n ) }} as sla_breach_at\n from intercepted_periods_agent_filtered\n\n)\n\nselect * \nfrom agent_work_business_breach", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "fqn": ["zendesk", "sla_policy", "agent_work_time", "int_zendesk__agent_work_time_business_hours"], "unique_id": "model.zendesk.int_zendesk__agent_work_time_business_hours", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "sla_policy/agent_work_time/int_zendesk__agent_work_time_business_hours.sql", "original_file_path": "models/sla_policy/agent_work_time/int_zendesk__agent_work_time_business_hours.sql", "name": "int_zendesk__agent_work_time_business_hours", "resource_type": "model", "alias": "int_zendesk__agent_work_time_business_hours", "checksum": {"name": "sha256", "checksum": "2a1423af998b263ec61c9c04be8a8329c2e28d922770885671e54b291d74beac"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["int_zendesk__agent_work_time_filtered_statuses"], ["stg_zendesk__schedule"], ["int_zendesk__ticket_schedules"]], "sources": [], "depends_on": {"macros": ["macro.fivetran_utils.timestamp_diff", "macro.dbt_utils.date_trunc", "macro.dbt_utils.generate_series", "macro.dbt_utils.type_int", "macro.fivetran_utils.timestamp_add"], "nodes": ["model.zendesk.int_zendesk__agent_work_time_filtered_statuses", "model.zendesk_source.stg_zendesk__schedule", "model.zendesk.int_zendesk__ticket_schedules"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/sla_policy/agent_work_time/int_zendesk__agent_work_time_business_hours.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_intermediate", "enabled": true}, "compiled_sql": "\n\n-- AGENT WORK TIME\n-- This is complicated, as SLAs minutes are only counted while the ticket is in 'new' or 'open' status.\n\n-- Additionally, for business hours, only 'new' or 'open' status hours are counted if they are also during business hours\nwith agent_work_time_filtered_statuses as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__agent_work_time_filtered_statuses`\n where in_business_hours = 'true'\n\n), schedule as (\n\n select * \n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__schedule`\n\n), ticket_schedules as (\n\n select * \n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_schedules`\n \n-- cross schedules with work time\n), ticket_status_crossed_with_schedule as (\n \n select\n agent_work_time_filtered_statuses.ticket_id,\n agent_work_time_filtered_statuses.sla_applied_at,\n agent_work_time_filtered_statuses.target, \n agent_work_time_filtered_statuses.sla_policy_name, \n ticket_schedules.schedule_id,\n greatest(valid_starting_at, schedule_created_at) as valid_starting_at,\n least(valid_ending_at, schedule_invalidated_at) as valid_ending_at\n from agent_work_time_filtered_statuses\n left join ticket_schedules\n on agent_work_time_filtered_statuses.ticket_id = ticket_schedules.ticket_id\n where \n \n\n datetime_diff(\n cast(least(valid_ending_at, schedule_invalidated_at) as datetime),\n cast(greatest(valid_starting_at, schedule_created_at) as datetime),\n second\n )\n\n\n > 0\n\n), ticket_full_solved_time as (\n\n select \n ticket_status_crossed_with_schedule.*,\n round(\n \n\n datetime_diff(\n cast(ticket_status_crossed_with_schedule.valid_starting_at as datetime),\n cast(\n timestamp_trunc(\n cast(ticket_status_crossed_with_schedule.valid_starting_at as timestamp),\n week\n )\n\n as datetime),\n second\n )\n\n\n /60,\n 0) as valid_starting_at_in_minutes_from_week,\n round(\n \n\n datetime_diff(\n cast(ticket_status_crossed_with_schedule.valid_ending_at as datetime),\n cast(ticket_status_crossed_with_schedule.valid_starting_at as datetime),\n second\n )\n\n\n /60,\n 0) as raw_delta_in_minutes\n from ticket_status_crossed_with_schedule\n group by 1, 2, 3, 4, 5, 6, 7, 8\n\n), weeks as (\n\n \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * pow(2, 0)\n + \n \n p1.generated_number * pow(2, 1)\n + \n \n p2.generated_number * pow(2, 2)\n + \n \n p3.generated_number * pow(2, 3)\n + \n \n p4.generated_number * pow(2, 4)\n + \n \n p5.generated_number * pow(2, 5)\n + \n \n p6.generated_number * pow(2, 6)\n + \n \n p7.generated_number * pow(2, 7)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 208\n order by generated_number\n\n\n\n), weeks_cross_ticket_full_solved_time as (\n \n select \n ticket_full_solved_time.*,\n generated_number - 1 as week_number\n from ticket_full_solved_time\n cross join weeks\n where floor((valid_starting_at_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number -1\n\n), weekly_period_agent_work_time as (\n\n select \n\n ticket_id,\n sla_applied_at,\n valid_starting_at,\n valid_ending_at,\n target,\n sla_policy_name,\n valid_starting_at_in_minutes_from_week,\n raw_delta_in_minutes,\n week_number,\n schedule_id,\n greatest(0, valid_starting_at_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time_minute,\n least(valid_starting_at_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time_minute\n \n from weeks_cross_ticket_full_solved_time\n\n), intercepted_periods_agent as (\n \n select \n weekly_period_agent_work_time.ticket_id,\n weekly_period_agent_work_time.sla_applied_at,\n weekly_period_agent_work_time.target,\n weekly_period_agent_work_time.sla_policy_name,\n weekly_period_agent_work_time.valid_starting_at,\n weekly_period_agent_work_time.valid_ending_at,\n weekly_period_agent_work_time.week_number,\n weekly_period_agent_work_time.ticket_week_start_time_minute,\n weekly_period_agent_work_time.ticket_week_end_time_minute,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time_minute, schedule.end_time_utc) - greatest(weekly_period_agent_work_time.ticket_week_start_time_minute, schedule.start_time_utc) as scheduled_minutes\n from weekly_period_agent_work_time\n join schedule on ticket_week_start_time_minute <= schedule.end_time_utc \n and ticket_week_end_time_minute >= schedule.start_time_utc\n and weekly_period_agent_work_time.schedule_id = schedule.schedule_id\n\n), intercepted_periods_with_running_total as (\n \n select \n *,\n sum(scheduled_minutes) over \n (partition by ticket_id, sla_applied_at \n order by valid_starting_at, week_number, schedule_end_time\n rows between unbounded preceding and current row)\n as running_total_scheduled_minutes\n\n from intercepted_periods_agent\n\n\n), intercepted_periods_agent_with_breach_flag as (\n select \n intercepted_periods_with_running_total.*,\n target - running_total_scheduled_minutes as remaining_target_minutes,\n lag(target - running_total_scheduled_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at, week_number, schedule_end_time) as lag_check,\n case when (target - running_total_scheduled_minutes) = 0 then true\n when (target - running_total_scheduled_minutes) < 0 \n and \n (lag(target - running_total_scheduled_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at, week_number, schedule_end_time) > 0 \n or \n lag(target - running_total_scheduled_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at, week_number, schedule_end_time) is null) \n then true else false end as is_breached_during_schedule\n \n from intercepted_periods_with_running_total\n\n), intercepted_periods_agent_filtered as (\n\n select\n *,\n (remaining_target_minutes + scheduled_minutes) as breach_minutes,\n greatest(ticket_week_start_time_minute, schedule_start_time) + (remaining_target_minutes + scheduled_minutes) as breach_minutes_from_week\n from intercepted_periods_agent_with_breach_flag\n \n), agent_work_business_breach as (\n \n select \n *,\n \n\n timestamp_add(\n timestamp_trunc(\n cast(valid_starting_at as timestamp),\n week\n )\n\n, interval cast(((7*24*60) * week_number) + breach_minutes_from_week as \n int64\n ) minute)\n\n as sla_breach_at\n from intercepted_periods_agent_filtered\n\n)\n\nselect * \nfrom agent_work_business_breach", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__agent_work_time_business_hours`"}, "model.zendesk.int_zendesk__agent_work_time_calendar_hours": {"raw_sql": "-- Calculate breach time for agent work time, calendar hours\nwith agent_work_time_filtered_statuses as (\n\n select *\n from {{ ref('int_zendesk__agent_work_time_filtered_statuses') }}\n where in_business_hours = 'false'\n\n), agent_work_time_calendar_minutes as (\n\n select \n *,\n {{ fivetran_utils.timestamp_diff(\n 'valid_starting_at',\n 'valid_ending_at',\n 'minute' )}} as calendar_minutes,\n sum({{ fivetran_utils.timestamp_diff(\n 'valid_starting_at', \n 'valid_ending_at', \n 'minute') }} ) \n over (partition by ticket_id, sla_applied_at order by valid_starting_at rows between unbounded preceding and current row) as running_total_calendar_minutes\n from agent_work_time_filtered_statuses\n\n), agent_work_time_calendar_minutes_flagged as (\n\nselect \n agent_work_time_calendar_minutes.*,\n target - running_total_calendar_minutes as remaining_target_minutes,\n case when (target - running_total_calendar_minutes) < 0 \n and \n (lag(target - running_total_calendar_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at) >= 0 \n or \n lag(target - running_total_calendar_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at) is null) \n then true else false end as is_breached_during_schedule\n \nfrom agent_work_time_calendar_minutes\n\n), final as (\n select\n *,\n (remaining_target_minutes + calendar_minutes) as breach_minutes,\n {{ fivetran_utils.timestamp_add(\n 'minute',\n '(remaining_target_minutes + calendar_minutes)',\n 'valid_starting_at', \n ) }} as sla_breach_at\n from agent_work_time_calendar_minutes_flagged\n\n)\n\nselect *\nfrom final", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "fqn": ["zendesk", "sla_policy", "agent_work_time", "int_zendesk__agent_work_time_calendar_hours"], "unique_id": "model.zendesk.int_zendesk__agent_work_time_calendar_hours", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "sla_policy/agent_work_time/int_zendesk__agent_work_time_calendar_hours.sql", "original_file_path": "models/sla_policy/agent_work_time/int_zendesk__agent_work_time_calendar_hours.sql", "name": "int_zendesk__agent_work_time_calendar_hours", "resource_type": "model", "alias": "int_zendesk__agent_work_time_calendar_hours", "checksum": {"name": "sha256", "checksum": "b6586a7bfbbb477559da191299256d673c31f4865322c2522ba6f2598af48257"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["int_zendesk__agent_work_time_filtered_statuses"]], "sources": [], "depends_on": {"macros": ["macro.fivetran_utils.timestamp_diff", "macro.fivetran_utils.timestamp_add"], "nodes": ["model.zendesk.int_zendesk__agent_work_time_filtered_statuses"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/sla_policy/agent_work_time/int_zendesk__agent_work_time_calendar_hours.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_intermediate"}, "compiled_sql": "-- Calculate breach time for agent work time, calendar hours\nwith agent_work_time_filtered_statuses as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__agent_work_time_filtered_statuses`\n where in_business_hours = 'false'\n\n), agent_work_time_calendar_minutes as (\n\n select \n *,\n \n \n\n datetime_diff(\n cast(valid_ending_at as datetime),\n cast(valid_starting_at as datetime),\n minute\n )\n\n\n as calendar_minutes,\n sum(\n \n\n datetime_diff(\n cast(valid_ending_at as datetime),\n cast(valid_starting_at as datetime),\n minute\n )\n\n\n ) \n over (partition by ticket_id, sla_applied_at order by valid_starting_at rows between unbounded preceding and current row) as running_total_calendar_minutes\n from agent_work_time_filtered_statuses\n\n), agent_work_time_calendar_minutes_flagged as (\n\nselect \n agent_work_time_calendar_minutes.*,\n target - running_total_calendar_minutes as remaining_target_minutes,\n case when (target - running_total_calendar_minutes) < 0 \n and \n (lag(target - running_total_calendar_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at) >= 0 \n or \n lag(target - running_total_calendar_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at) is null) \n then true else false end as is_breached_during_schedule\n \nfrom agent_work_time_calendar_minutes\n\n), final as (\n select\n *,\n (remaining_target_minutes + calendar_minutes) as breach_minutes,\n \n\n timestamp_add(valid_starting_at, interval (remaining_target_minutes + calendar_minutes) minute)\n\n as sla_breach_at\n from agent_work_time_calendar_minutes_flagged\n\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__agent_work_time_calendar_hours`"}, "model.zendesk.int_zendesk__agent_work_time_filtered_statuses": {"raw_sql": "with agent_work_time_sla as (\n\n select *\n from {{ ref('int_zendesk__sla_policy_applied') }}\n where metric = 'agent_work_time'\n\n), ticket_historical_status as (\n\n select *\n from {{ ref('int_zendesk__ticket_historical_status') }}\n \n--This captures the statuses of the ticket while the agent work time sla was active for the ticket.\n), agent_work_time_filtered_statuses as (\n\n select \n ticket_historical_status.ticket_id,\n greatest(ticket_historical_status.valid_starting_at, agent_work_time_sla.sla_applied_at) as valid_starting_at,\n coalesce(\n ticket_historical_status.valid_ending_at, \n {{ fivetran_utils.timestamp_add('day', 30, \"\" ~ dbt_utils.current_timestamp() ~ \"\") }} ) as valid_ending_at, --assumes current status continues into the future. This is necessary to predict future SLA breaches (not just past).\n ticket_historical_status.status as ticket_status,\n agent_work_time_sla.sla_applied_at,\n agent_work_time_sla.target, \n agent_work_time_sla.sla_policy_name,\n agent_work_time_sla.ticket_created_at,\n agent_work_time_sla.in_business_hours\n from ticket_historical_status\n join agent_work_time_sla\n on ticket_historical_status.ticket_id = agent_work_time_sla.ticket_id\n where ticket_historical_status.status in ('new', 'open') -- these are the only statuses that count as \"agent work time\"\n and sla_applied_at < valid_ending_at\n\n)\nselect *\nfrom agent_work_time_filtered_statuses", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "fqn": ["zendesk", "sla_policy", "agent_work_time", "int_zendesk__agent_work_time_filtered_statuses"], "unique_id": "model.zendesk.int_zendesk__agent_work_time_filtered_statuses", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "sla_policy/agent_work_time/int_zendesk__agent_work_time_filtered_statuses.sql", "original_file_path": "models/sla_policy/agent_work_time/int_zendesk__agent_work_time_filtered_statuses.sql", "name": "int_zendesk__agent_work_time_filtered_statuses", "resource_type": "model", "alias": "int_zendesk__agent_work_time_filtered_statuses", "checksum": {"name": "sha256", "checksum": "8516523042e9dedfb12a9f5c5a240c79b03a01eab0a98d1e901b450bf331a0a0"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["int_zendesk__sla_policy_applied"], ["int_zendesk__ticket_historical_status"]], "sources": [], "depends_on": {"macros": ["macro.dbt_utils.current_timestamp", "macro.fivetran_utils.timestamp_add"], "nodes": ["model.zendesk.int_zendesk__sla_policy_applied", "model.zendesk.int_zendesk__ticket_historical_status"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/sla_policy/agent_work_time/int_zendesk__agent_work_time_filtered_statuses.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_intermediate"}, "compiled_sql": "with agent_work_time_sla as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__sla_policy_applied`\n where metric = 'agent_work_time'\n\n), ticket_historical_status as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_historical_status`\n \n--This captures the statuses of the ticket while the agent work time sla was active for the ticket.\n), agent_work_time_filtered_statuses as (\n\n select \n ticket_historical_status.ticket_id,\n greatest(ticket_historical_status.valid_starting_at, agent_work_time_sla.sla_applied_at) as valid_starting_at,\n coalesce(\n ticket_historical_status.valid_ending_at, \n \n\n timestamp_add(\n current_timestamp\n, interval 30 day)\n\n ) as valid_ending_at, --assumes current status continues into the future. This is necessary to predict future SLA breaches (not just past).\n ticket_historical_status.status as ticket_status,\n agent_work_time_sla.sla_applied_at,\n agent_work_time_sla.target, \n agent_work_time_sla.sla_policy_name,\n agent_work_time_sla.ticket_created_at,\n agent_work_time_sla.in_business_hours\n from ticket_historical_status\n join agent_work_time_sla\n on ticket_historical_status.ticket_id = agent_work_time_sla.ticket_id\n where ticket_historical_status.status in ('new', 'open') -- these are the only statuses that count as \"agent work time\"\n and sla_applied_at < valid_ending_at\n\n)\nselect *\nfrom agent_work_time_filtered_statuses", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__agent_work_time_filtered_statuses`"}, "model.zendesk.int_zendesk__reply_time_business_hours": {"raw_sql": "{{ config(enabled=var('using_schedules', True)) }}\n\n-- step 3, determine when an SLA will breach for SLAs that are in business hours\n\nwith ticket_schedules as (\n \n select *\n from {{ ref('int_zendesk__ticket_schedules') }}\n\n), schedule as (\n \n select *\n from {{ ref('stg_zendesk__schedule') }}\n\n), sla_policy_applied as (\n \n select *\n from {{ ref('int_zendesk__sla_policy_applied') }}\n\n\n), schedule_business_hours as (\n \n select \n schedule_id,\n sum(end_time_utc - start_time_utc) as total_schedule_weekly_business_minutes\n from schedule\n group by 1\n\n), ticket_sla_applied_with_schedules as (\n\n select \n sla_policy_applied.*,\n ticket_schedules.schedule_id,\n round(\n {{ fivetran_utils.timestamp_diff(\n \"\" ~ dbt_utils.date_trunc('week', 'sla_policy_applied.sla_applied_at') ~ \"\",\n 'sla_policy_applied.sla_applied_at', \n 'second') }}/60\n , 0) as start_time_in_minutes_from_week,\n schedule_business_hours.total_schedule_weekly_business_minutes\n from sla_policy_applied\n left join ticket_schedules on sla_policy_applied.ticket_id = ticket_schedules.ticket_id\n and {{ fivetran_utils.timestamp_add('second', -1, 'ticket_schedules.schedule_created_at') }} <= sla_policy_applied.sla_applied_at\n and {{ fivetran_utils.timestamp_add('second', -1, 'ticket_schedules.schedule_invalidated_at') }} > sla_policy_applied.sla_applied_at\n left join schedule_business_hours \n on ticket_schedules.schedule_id = schedule_business_hours.schedule_id\n where sla_policy_applied.in_business_hours = 'true'\n and metric in ('next_reply_time', 'first_reply_time')\n \n), weeks as (\n\n {{ dbt_utils.generate_series(208) }}\n\n), weeks_cross_ticket_sla_applied as (\n\n select \n\n ticket_sla_applied_with_schedules.*,\n generated_number - 1 as week_number\n\n from ticket_sla_applied_with_schedules\n cross join weeks\n where {{ fivetran_utils.ceiling('target/total_schedule_weekly_business_minutes') }} >= generated_number - 1\n\n), weekly_periods as (\n \n select \n weeks_cross_ticket_sla_applied.*,\n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n (7*24*60) as ticket_week_end_time\n from weeks_cross_ticket_sla_applied\n\n), intercepted_periods as (\n\n select \n weekly_periods.*,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n (schedule.end_time_utc - greatest(ticket_week_start_time,schedule.start_time_utc)) as lapsed_business_minutes,\n sum(schedule.end_time_utc - greatest(ticket_week_start_time,schedule.start_time_utc)) over \n (partition by ticket_id, metric, sla_applied_at \n order by week_number, schedule.start_time_utc\n rows between unbounded preceding and current row) as sum_lapsed_business_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n \n), intercepted_periods_with_breach_flag as (\n \n select \n *,\n target - sum_lapsed_business_minutes as remaining_minutes,\n case when (target - sum_lapsed_business_minutes) < 0 \n and \n (lag(target - sum_lapsed_business_minutes) over\n (partition by ticket_id, metric, sla_applied_at order by week_number, schedule_start_time) >= 0 \n or \n lag(target - sum_lapsed_business_minutes) over\n (partition by ticket_id, metric, sla_applied_at order by week_number, schedule_start_time) is null) \n then true else false end as is_breached_during_schedule -- this flags the scheduled period on which the breach took place\n from intercepted_periods\n\n), intercepted_periods_with_breach_flag_calculated as (\n\n select\n *,\n schedule_end_time + remaining_minutes as breached_at_minutes,\n {{ dbt_utils.date_trunc('week', 'sla_applied_at') }} as starting_point,\n {{ fivetran_utils.timestamp_add(\n \"minute\",\n \"cast(((7*24*60) * week_number) + (schedule_end_time + remaining_minutes) as \" ~ dbt_utils.type_int() ~ \" )\",\n \"\" ~ dbt_utils.date_trunc('week', 'sla_applied_at') ~ \"\" ) }} as sla_breach_at\n from intercepted_periods_with_breach_flag\n\n), reply_time_business_hours_sla as (\n\n select\n ticket_id,\n sla_policy_name,\n metric,\n sla_applied_at,\n target,\n in_business_hours,\n sla_breach_at,\n is_breached_during_schedule\n from intercepted_periods_with_breach_flag_calculated\n\n) \n\nselect * \nfrom reply_time_business_hours_sla", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "fqn": ["zendesk", "sla_policy", "reply_time", "int_zendesk__reply_time_business_hours"], "unique_id": "model.zendesk.int_zendesk__reply_time_business_hours", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "sla_policy/reply_time/int_zendesk__reply_time_business_hours.sql", "original_file_path": "models/sla_policy/reply_time/int_zendesk__reply_time_business_hours.sql", "name": "int_zendesk__reply_time_business_hours", "resource_type": "model", "alias": "int_zendesk__reply_time_business_hours", "checksum": {"name": "sha256", "checksum": "1a0883782ab48a44e57c7fe880813687b77c986daa27544b778b281bec8ef117"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["int_zendesk__ticket_schedules"], ["stg_zendesk__schedule"], ["int_zendesk__sla_policy_applied"]], "sources": [], "depends_on": {"macros": ["macro.dbt_utils.date_trunc", "macro.fivetran_utils.timestamp_diff", "macro.fivetran_utils.timestamp_add", "macro.dbt_utils.generate_series", "macro.fivetran_utils.ceiling", "macro.dbt_utils.type_int"], "nodes": ["model.zendesk.int_zendesk__ticket_schedules", "model.zendesk_source.stg_zendesk__schedule", "model.zendesk.int_zendesk__sla_policy_applied"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/sla_policy/reply_time/int_zendesk__reply_time_business_hours.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_intermediate", "enabled": true}, "compiled_sql": "\n\n-- step 3, determine when an SLA will breach for SLAs that are in business hours\n\nwith ticket_schedules as (\n \n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_schedules`\n\n), schedule as (\n \n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__schedule`\n\n), sla_policy_applied as (\n \n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__sla_policy_applied`\n\n\n), schedule_business_hours as (\n \n select \n schedule_id,\n sum(end_time_utc - start_time_utc) as total_schedule_weekly_business_minutes\n from schedule\n group by 1\n\n), ticket_sla_applied_with_schedules as (\n\n select \n sla_policy_applied.*,\n ticket_schedules.schedule_id,\n round(\n \n \n\n datetime_diff(\n cast(sla_policy_applied.sla_applied_at as datetime),\n cast(\n timestamp_trunc(\n cast(sla_policy_applied.sla_applied_at as timestamp),\n week\n )\n\n as datetime),\n second\n )\n\n\n/60\n , 0) as start_time_in_minutes_from_week,\n schedule_business_hours.total_schedule_weekly_business_minutes\n from sla_policy_applied\n left join ticket_schedules on sla_policy_applied.ticket_id = ticket_schedules.ticket_id\n and \n\n timestamp_add(ticket_schedules.schedule_created_at, interval -1 second)\n\n <= sla_policy_applied.sla_applied_at\n and \n\n timestamp_add(ticket_schedules.schedule_invalidated_at, interval -1 second)\n\n > sla_policy_applied.sla_applied_at\n left join schedule_business_hours \n on ticket_schedules.schedule_id = schedule_business_hours.schedule_id\n where sla_policy_applied.in_business_hours = 'true'\n and metric in ('next_reply_time', 'first_reply_time')\n \n), weeks as (\n\n \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * pow(2, 0)\n + \n \n p1.generated_number * pow(2, 1)\n + \n \n p2.generated_number * pow(2, 2)\n + \n \n p3.generated_number * pow(2, 3)\n + \n \n p4.generated_number * pow(2, 4)\n + \n \n p5.generated_number * pow(2, 5)\n + \n \n p6.generated_number * pow(2, 6)\n + \n \n p7.generated_number * pow(2, 7)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 208\n order by generated_number\n\n\n\n), weeks_cross_ticket_sla_applied as (\n\n select \n\n ticket_sla_applied_with_schedules.*,\n generated_number - 1 as week_number\n\n from ticket_sla_applied_with_schedules\n cross join weeks\n where \n ceiling(target/total_schedule_weekly_business_minutes)\n\n >= generated_number - 1\n\n), weekly_periods as (\n \n select \n weeks_cross_ticket_sla_applied.*,\n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n (7*24*60) as ticket_week_end_time\n from weeks_cross_ticket_sla_applied\n\n), intercepted_periods as (\n\n select \n weekly_periods.*,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n (schedule.end_time_utc - greatest(ticket_week_start_time,schedule.start_time_utc)) as lapsed_business_minutes,\n sum(schedule.end_time_utc - greatest(ticket_week_start_time,schedule.start_time_utc)) over \n (partition by ticket_id, metric, sla_applied_at \n order by week_number, schedule.start_time_utc\n rows between unbounded preceding and current row) as sum_lapsed_business_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n \n), intercepted_periods_with_breach_flag as (\n \n select \n *,\n target - sum_lapsed_business_minutes as remaining_minutes,\n case when (target - sum_lapsed_business_minutes) < 0 \n and \n (lag(target - sum_lapsed_business_minutes) over\n (partition by ticket_id, metric, sla_applied_at order by week_number, schedule_start_time) >= 0 \n or \n lag(target - sum_lapsed_business_minutes) over\n (partition by ticket_id, metric, sla_applied_at order by week_number, schedule_start_time) is null) \n then true else false end as is_breached_during_schedule -- this flags the scheduled period on which the breach took place\n from intercepted_periods\n\n), intercepted_periods_with_breach_flag_calculated as (\n\n select\n *,\n schedule_end_time + remaining_minutes as breached_at_minutes,\n \n timestamp_trunc(\n cast(sla_applied_at as timestamp),\n week\n )\n\n as starting_point,\n \n\n timestamp_add(\n timestamp_trunc(\n cast(sla_applied_at as timestamp),\n week\n )\n\n, interval cast(((7*24*60) * week_number) + (schedule_end_time + remaining_minutes) as \n int64\n ) minute)\n\n as sla_breach_at\n from intercepted_periods_with_breach_flag\n\n), reply_time_business_hours_sla as (\n\n select\n ticket_id,\n sla_policy_name,\n metric,\n sla_applied_at,\n target,\n in_business_hours,\n sla_breach_at,\n is_breached_during_schedule\n from intercepted_periods_with_breach_flag_calculated\n\n) \n\nselect * \nfrom reply_time_business_hours_sla", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__reply_time_business_hours`"}, "model.zendesk.int_zendesk__reply_time_calendar_hours": {"raw_sql": "--REPLY TIME SLA\n-- step 2, figure out when the sla will breach for sla's in calendar hours. The calculation is relatively straightforward.\n\nwith sla_policy_applied as (\n\n select *\n from {{ ref('int_zendesk__sla_policy_applied') }}\n\n), final as (\n select\n *,\n {{ fivetran_utils.timestamp_add(\n \"minute\",\n \"cast(target as \" ~ dbt_utils.type_int() ~ \" )\",\n \"sla_applied_at\" ) }} as sla_breach_at\n from sla_policy_applied\n where in_business_hours = 'false'\n and metric in ('next_reply_time', 'first_reply_time')\n\n)\n\nselect *\nfrom final", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "fqn": ["zendesk", "sla_policy", "reply_time", "int_zendesk__reply_time_calendar_hours"], "unique_id": "model.zendesk.int_zendesk__reply_time_calendar_hours", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "sla_policy/reply_time/int_zendesk__reply_time_calendar_hours.sql", "original_file_path": "models/sla_policy/reply_time/int_zendesk__reply_time_calendar_hours.sql", "name": "int_zendesk__reply_time_calendar_hours", "resource_type": "model", "alias": "int_zendesk__reply_time_calendar_hours", "checksum": {"name": "sha256", "checksum": "1a62be5614fbaf500ce2ca0f29f4e61cdcd5e45da1fe1669a549bc11bfb702f8"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["int_zendesk__sla_policy_applied"]], "sources": [], "depends_on": {"macros": ["macro.dbt_utils.type_int", "macro.fivetran_utils.timestamp_add"], "nodes": ["model.zendesk.int_zendesk__sla_policy_applied"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/sla_policy/reply_time/int_zendesk__reply_time_calendar_hours.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_intermediate"}, "compiled_sql": "--REPLY TIME SLA\n-- step 2, figure out when the sla will breach for sla's in calendar hours. The calculation is relatively straightforward.\n\nwith sla_policy_applied as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__sla_policy_applied`\n\n), final as (\n select\n *,\n \n\n timestamp_add(sla_applied_at, interval cast(target as \n int64\n ) minute)\n\n as sla_breach_at\n from sla_policy_applied\n where in_business_hours = 'false'\n and metric in ('next_reply_time', 'first_reply_time')\n\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__reply_time_calendar_hours`"}, "model.zendesk.int_zendesk__reply_time_combined": {"raw_sql": "with reply_time_calendar_hours_sla as (\n \n select *\n from {{ ref('int_zendesk__reply_time_calendar_hours') }}\n\n{% if var('using_schedules', True) %}\n\n), reply_time_business_hours_sla as (\n \n select *\n from {{ ref('int_zendesk__reply_time_business_hours') }}\n\n{% endif %}\n\n), ticket_updates as (\n select *\n from {{ ref('int_zendesk__updates') }}\n\n), users as (\n \n select *\n from {{ ref('int_zendesk__user_aggregates') }}\n\n), reply_time_breached_at as (\n\n select \n ticket_id,\n sla_policy_name,\n metric,\n sla_applied_at,\n target,\n in_business_hours,\n sla_breach_at\n from reply_time_calendar_hours_sla\n\n{% if var('using_schedules', True) %}\n\n union all\n\n select \n ticket_id,\n sla_policy_name,\n metric,\n sla_applied_at,\n target,\n in_business_hours,\n sla_breach_at\n from reply_time_business_hours_sla\n{% endif %}\n\n-- Now that we have the breach time, see when the first reply after the sla policy was applied took place.\n), ticket_solved_times as (\n select\n ticket_id,\n valid_starting_at as solved_at\n from ticket_updates\n where field_name = 'status'\n and value in ('solved','closed')\n\n), reply_time as (\n select \n ticket_comment.ticket_id,\n ticket_comment.valid_starting_at as reply_at,\n commenter.role\n from ticket_updates as ticket_comment\n join users as commenter\n on commenter.user_id = ticket_comment.user_id\n where field_name = 'comment' \n and ticket_comment.is_public\n and commenter.role in ('agent','admin')\n\n), reply_time_breached_at_with_next_reply_timestamp as (\n\n select \n reply_time_breached_at.ticket_id,\n reply_time_breached_at.sla_policy_name,\n reply_time_breached_at.metric,\n reply_time_breached_at.sla_applied_at,\n reply_time_breached_at.target,\n reply_time_breached_at.in_business_hours,\n min(sla_breach_at) as sla_breach_at,\n min(reply_at) as agent_reply_at,\n min(solved_at) as next_solved_at\n from reply_time_breached_at\n left join reply_time\n on reply_time.ticket_id = reply_time_breached_at.ticket_id\n and reply_time.reply_at > reply_time_breached_at.sla_applied_at\n left join ticket_solved_times\n on reply_time_breached_at.ticket_id = ticket_solved_times.ticket_id\n and ticket_solved_times.solved_at > reply_time_breached_at.sla_applied_at\n group by 1, 2, 3, 4, 5, 6\n\n), reply_time_breached_at_remove_old_sla as (\n select \n *,\n lead(sla_applied_at) over (partition by ticket_id, metric, in_business_hours order by sla_applied_at) as updated_sla_policy_starts_at,\n case when \n lead(sla_applied_at) over (partition by ticket_id, metric, in_business_hours order by sla_applied_at) --updated sla policy start at time\n < sla_breach_at then true else false end as is_stale_sla_policy,\n case when (sla_breach_at < agent_reply_at and sla_breach_at < next_solved_at)\n or (sla_breach_at < agent_reply_at and next_solved_at is null)\n or (agent_reply_at is null and sla_breach_at < next_solved_at)\n or (agent_reply_at is null and next_solved_at is null)\n then true\n else false\n end as is_sla_breached\n from reply_time_breached_at_with_next_reply_timestamp\n \n), reply_time_breach as (\n select \n *,\n {{ dbt_utils.datediff(\"sla_applied_at\", \"agent_reply_at\", 'minute') }} as sla_elapsed_time\n from reply_time_breached_at_remove_old_sla\n)\n\nselect *\nfrom reply_time_breach", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "fqn": ["zendesk", "sla_policy", "reply_time", "int_zendesk__reply_time_combined"], "unique_id": "model.zendesk.int_zendesk__reply_time_combined", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "sla_policy/reply_time/int_zendesk__reply_time_combined.sql", "original_file_path": "models/sla_policy/reply_time/int_zendesk__reply_time_combined.sql", "name": "int_zendesk__reply_time_combined", "resource_type": "model", "alias": "int_zendesk__reply_time_combined", "checksum": {"name": "sha256", "checksum": "daceb65b9a84cc5486e56333223e9ea5912d8ac92ce17635404118579b0ca974"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["int_zendesk__reply_time_calendar_hours"], ["int_zendesk__reply_time_business_hours"], ["int_zendesk__updates"], ["int_zendesk__user_aggregates"]], "sources": [], "depends_on": {"macros": ["macro.dbt_utils.datediff"], "nodes": ["model.zendesk.int_zendesk__reply_time_calendar_hours", "model.zendesk.int_zendesk__reply_time_business_hours", "model.zendesk.int_zendesk__updates", "model.zendesk.int_zendesk__user_aggregates"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/sla_policy/reply_time/int_zendesk__reply_time_combined.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_intermediate"}, "compiled_sql": "with reply_time_calendar_hours_sla as (\n \n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__reply_time_calendar_hours`\n\n\n\n), reply_time_business_hours_sla as (\n \n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__reply_time_business_hours`\n\n\n\n), ticket_updates as (\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__updates`\n\n), users as (\n \n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__user_aggregates`\n\n), reply_time_breached_at as (\n\n select \n ticket_id,\n sla_policy_name,\n metric,\n sla_applied_at,\n target,\n in_business_hours,\n sla_breach_at\n from reply_time_calendar_hours_sla\n\n\n\n union all\n\n select \n ticket_id,\n sla_policy_name,\n metric,\n sla_applied_at,\n target,\n in_business_hours,\n sla_breach_at\n from reply_time_business_hours_sla\n\n\n-- Now that we have the breach time, see when the first reply after the sla policy was applied took place.\n), ticket_solved_times as (\n select\n ticket_id,\n valid_starting_at as solved_at\n from ticket_updates\n where field_name = 'status'\n and value in ('solved','closed')\n\n), reply_time as (\n select \n ticket_comment.ticket_id,\n ticket_comment.valid_starting_at as reply_at,\n commenter.role\n from ticket_updates as ticket_comment\n join users as commenter\n on commenter.user_id = ticket_comment.user_id\n where field_name = 'comment' \n and ticket_comment.is_public\n and commenter.role in ('agent','admin')\n\n), reply_time_breached_at_with_next_reply_timestamp as (\n\n select \n reply_time_breached_at.ticket_id,\n reply_time_breached_at.sla_policy_name,\n reply_time_breached_at.metric,\n reply_time_breached_at.sla_applied_at,\n reply_time_breached_at.target,\n reply_time_breached_at.in_business_hours,\n min(sla_breach_at) as sla_breach_at,\n min(reply_at) as agent_reply_at,\n min(solved_at) as next_solved_at\n from reply_time_breached_at\n left join reply_time\n on reply_time.ticket_id = reply_time_breached_at.ticket_id\n and reply_time.reply_at > reply_time_breached_at.sla_applied_at\n left join ticket_solved_times\n on reply_time_breached_at.ticket_id = ticket_solved_times.ticket_id\n and ticket_solved_times.solved_at > reply_time_breached_at.sla_applied_at\n group by 1, 2, 3, 4, 5, 6\n\n), reply_time_breached_at_remove_old_sla as (\n select \n *,\n lead(sla_applied_at) over (partition by ticket_id, metric, in_business_hours order by sla_applied_at) as updated_sla_policy_starts_at,\n case when \n lead(sla_applied_at) over (partition by ticket_id, metric, in_business_hours order by sla_applied_at) --updated sla policy start at time\n < sla_breach_at then true else false end as is_stale_sla_policy,\n case when (sla_breach_at < agent_reply_at and sla_breach_at < next_solved_at)\n or (sla_breach_at < agent_reply_at and next_solved_at is null)\n or (agent_reply_at is null and sla_breach_at < next_solved_at)\n or (agent_reply_at is null and next_solved_at is null)\n then true\n else false\n end as is_sla_breached\n from reply_time_breached_at_with_next_reply_timestamp\n \n), reply_time_breach as (\n select \n *,\n \n\n datetime_diff(\n cast(agent_reply_at as datetime),\n cast(sla_applied_at as datetime),\n minute\n )\n\n as sla_elapsed_time\n from reply_time_breached_at_remove_old_sla\n)\n\nselect *\nfrom reply_time_breach", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__reply_time_combined`"}, "model.zendesk.int_zendesk__requester_wait_time_calendar_hours": {"raw_sql": "-- Calculate breach time for requester wait time, calendar hours\nwith requester_wait_time_filtered_statuses as (\n\n select *\n from {{ ref('int_zendesk__requester_wait_time_filtered_statuses') }}\n where in_business_hours = 'false'\n\n), requester_wait_time_calendar_minutes as (\n\n select \n *,\n {{ fivetran_utils.timestamp_diff(\n 'valid_starting_at',\n 'valid_ending_at',\n 'minute' )}} as calendar_minutes,\n sum({{ fivetran_utils.timestamp_diff(\n 'valid_starting_at', \n 'valid_ending_at', \n 'minute') }} ) \n over (partition by ticket_id, sla_applied_at order by valid_starting_at rows between unbounded preceding and current row) as running_total_calendar_minutes\n from requester_wait_time_filtered_statuses\n\n), requester_wait_time_calendar_minutes_flagged as (\n\nselect \n requester_wait_time_calendar_minutes.*,\n target - running_total_calendar_minutes as remaining_target_minutes,\n case when (target - running_total_calendar_minutes) < 0 \n and \n (lag(target - running_total_calendar_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at) >= 0 \n or \n lag(target - running_total_calendar_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at) is null) \n then true else false end as is_breached_during_schedule\n \nfrom requester_wait_time_calendar_minutes\n\n), final as (\n select\n *,\n (remaining_target_minutes + calendar_minutes) as breach_minutes,\n {{ fivetran_utils.timestamp_add(\n 'minute',\n '(remaining_target_minutes + calendar_minutes)',\n 'valid_starting_at', \n ) }} as sla_breach_at\n from requester_wait_time_calendar_minutes_flagged\n\n)\n\nselect *\nfrom final", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "fqn": ["zendesk", "sla_policy", "requester_wait_time", "int_zendesk__requester_wait_time_calendar_hours"], "unique_id": "model.zendesk.int_zendesk__requester_wait_time_calendar_hours", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "sla_policy/requester_wait_time/int_zendesk__requester_wait_time_calendar_hours.sql", "original_file_path": "models/sla_policy/requester_wait_time/int_zendesk__requester_wait_time_calendar_hours.sql", "name": "int_zendesk__requester_wait_time_calendar_hours", "resource_type": "model", "alias": "int_zendesk__requester_wait_time_calendar_hours", "checksum": {"name": "sha256", "checksum": "03f9ecbd71d1e31731c0c7f3bd8dd7d391e5b4d7f6d166fa236dd5e5799e1b85"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["int_zendesk__requester_wait_time_filtered_statuses"]], "sources": [], "depends_on": {"macros": ["macro.fivetran_utils.timestamp_diff", "macro.fivetran_utils.timestamp_add"], "nodes": ["model.zendesk.int_zendesk__requester_wait_time_filtered_statuses"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/sla_policy/requester_wait_time/int_zendesk__requester_wait_time_calendar_hours.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_intermediate"}, "compiled_sql": "-- Calculate breach time for requester wait time, calendar hours\nwith requester_wait_time_filtered_statuses as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__requester_wait_time_filtered_statuses`\n where in_business_hours = 'false'\n\n), requester_wait_time_calendar_minutes as (\n\n select \n *,\n \n \n\n datetime_diff(\n cast(valid_ending_at as datetime),\n cast(valid_starting_at as datetime),\n minute\n )\n\n\n as calendar_minutes,\n sum(\n \n\n datetime_diff(\n cast(valid_ending_at as datetime),\n cast(valid_starting_at as datetime),\n minute\n )\n\n\n ) \n over (partition by ticket_id, sla_applied_at order by valid_starting_at rows between unbounded preceding and current row) as running_total_calendar_minutes\n from requester_wait_time_filtered_statuses\n\n), requester_wait_time_calendar_minutes_flagged as (\n\nselect \n requester_wait_time_calendar_minutes.*,\n target - running_total_calendar_minutes as remaining_target_minutes,\n case when (target - running_total_calendar_minutes) < 0 \n and \n (lag(target - running_total_calendar_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at) >= 0 \n or \n lag(target - running_total_calendar_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at) is null) \n then true else false end as is_breached_during_schedule\n \nfrom requester_wait_time_calendar_minutes\n\n), final as (\n select\n *,\n (remaining_target_minutes + calendar_minutes) as breach_minutes,\n \n\n timestamp_add(valid_starting_at, interval (remaining_target_minutes + calendar_minutes) minute)\n\n as sla_breach_at\n from requester_wait_time_calendar_minutes_flagged\n\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__requester_wait_time_calendar_hours`"}, "model.zendesk.int_zendesk__requester_wait_time_business_hours": {"raw_sql": "{{ config(enabled=var('using_schedules', True)) }}\n\n-- REQUESTER WAIT TIME\n-- This is complicated, as SLAs minutes are only counted while the ticket is in 'new', 'open', and 'on-hold' status.\n\n-- Additionally, for business hours, only 'new', 'open', and 'on-hold' status hours are counted if they are also during business hours\nwith requester_wait_time_filtered_statuses as (\n\n select *\n from {{ ref('int_zendesk__requester_wait_time_filtered_statuses') }}\n where in_business_hours = 'true'\n\n), schedule as (\n\n select * \n from {{ ref('stg_zendesk__schedule') }}\n\n), ticket_schedules as (\n\n select * \n from {{ ref('int_zendesk__ticket_schedules') }}\n \n-- cross schedules with work time\n), ticket_status_crossed_with_schedule as (\n \n select\n requester_wait_time_filtered_statuses.ticket_id,\n requester_wait_time_filtered_statuses.sla_applied_at,\n requester_wait_time_filtered_statuses.target,\n requester_wait_time_filtered_statuses.sla_policy_name,\n ticket_schedules.schedule_id,\n greatest(valid_starting_at, schedule_created_at) as valid_starting_at,\n least(valid_ending_at, schedule_invalidated_at) as valid_ending_at\n from requester_wait_time_filtered_statuses\n left join ticket_schedules\n on requester_wait_time_filtered_statuses.ticket_id = ticket_schedules.ticket_id\n where {{ fivetran_utils.timestamp_diff(\n 'greatest(valid_starting_at, schedule_created_at)', \n 'least(valid_ending_at, schedule_invalidated_at)', \n 'second') }} > 0\n\n), ticket_full_solved_time as (\n\n select \n ticket_status_crossed_with_schedule.*,\n round({{ fivetran_utils.timestamp_diff(\n \"\" ~ dbt_utils.date_trunc(\n 'week',\n 'ticket_status_crossed_with_schedule.valid_starting_at') ~ \"\", \n 'ticket_status_crossed_with_schedule.valid_starting_at', \n 'second') }} /60,\n 0) as valid_starting_at_in_minutes_from_week,\n round({{ fivetran_utils.timestamp_diff(\n 'ticket_status_crossed_with_schedule.valid_starting_at', \n 'ticket_status_crossed_with_schedule.valid_ending_at',\n 'second') }} /60,\n 0) as raw_delta_in_minutes\n from ticket_status_crossed_with_schedule\n group by 1, 2, 3, 4, 5, 6, 7, 8\n\n), weeks as (\n\n {{ dbt_utils.generate_series(208) }}\n\n), weeks_cross_ticket_full_solved_time as (\n \n select \n ticket_full_solved_time.*,\n generated_number - 1 as week_number\n from ticket_full_solved_time\n cross join weeks\n where floor((valid_starting_at_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number -1\n\n), weekly_period_requester_wait_time as (\n\n select \n\n ticket_id,\n sla_applied_at,\n valid_starting_at,\n valid_ending_at,\n target,\n sla_policy_name,\n valid_starting_at_in_minutes_from_week,\n raw_delta_in_minutes,\n week_number,\n schedule_id,\n greatest(0, valid_starting_at_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time_minute,\n least(valid_starting_at_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time_minute\n \n from weeks_cross_ticket_full_solved_time\n\n), intercepted_periods_agent as (\n \n select \n weekly_period_requester_wait_time.ticket_id,\n weekly_period_requester_wait_time.sla_applied_at,\n weekly_period_requester_wait_time.target,\n weekly_period_requester_wait_time.sla_policy_name,\n weekly_period_requester_wait_time.valid_starting_at,\n weekly_period_requester_wait_time.valid_ending_at,\n weekly_period_requester_wait_time.week_number,\n weekly_period_requester_wait_time.ticket_week_start_time_minute,\n weekly_period_requester_wait_time.ticket_week_end_time_minute,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time_minute, schedule.end_time_utc) - greatest(weekly_period_requester_wait_time.ticket_week_start_time_minute, schedule.start_time_utc) as scheduled_minutes\n from weekly_period_requester_wait_time\n join schedule on ticket_week_start_time_minute <= schedule.end_time_utc \n and ticket_week_end_time_minute >= schedule.start_time_utc\n and weekly_period_requester_wait_time.schedule_id = schedule.schedule_id\n\n), intercepted_periods_with_running_total as (\n \n select \n *,\n sum(scheduled_minutes) over \n (partition by ticket_id, sla_applied_at \n order by valid_starting_at, week_number, schedule_end_time\n rows between unbounded preceding and current row)\n as running_total_scheduled_minutes\n\n from intercepted_periods_agent\n\n\n), intercepted_periods_agent_with_breach_flag as (\n select \n intercepted_periods_with_running_total.*,\n target - running_total_scheduled_minutes as remaining_target_minutes,\n lag(target - running_total_scheduled_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at, week_number, schedule_end_time) as lag_check,\n case when (target - running_total_scheduled_minutes) = 0 then true\n when (target - running_total_scheduled_minutes) < 0 \n and \n (lag(target - running_total_scheduled_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at, week_number, schedule_end_time) > 0 \n or \n lag(target - running_total_scheduled_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at, week_number, schedule_end_time) is null) \n then true else false end as is_breached_during_schedule\n \n from intercepted_periods_with_running_total\n\n), intercepted_periods_agent_filtered as (\n\n select\n *,\n (remaining_target_minutes + scheduled_minutes) as breach_minutes,\n greatest(ticket_week_start_time_minute, schedule_start_time) + (remaining_target_minutes + scheduled_minutes) as breach_minutes_from_week\n from intercepted_periods_agent_with_breach_flag\n\n), requester_wait_business_breach as (\n \n select \n *,\n {{ fivetran_utils.timestamp_add(\n \"minute\",\n \"cast(((7*24*60) * week_number) + breach_minutes_from_week as \" ~ dbt_utils.type_int() ~ \" )\",\n \"\" ~ dbt_utils.date_trunc('week', 'valid_starting_at') ~ \"\",\n ) }} as sla_breach_at\n from intercepted_periods_agent_filtered\n\n)\n\nselect * \nfrom requester_wait_business_breach", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "fqn": ["zendesk", "sla_policy", "requester_wait_time", "int_zendesk__requester_wait_time_business_hours"], "unique_id": "model.zendesk.int_zendesk__requester_wait_time_business_hours", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "sla_policy/requester_wait_time/int_zendesk__requester_wait_time_business_hours.sql", "original_file_path": "models/sla_policy/requester_wait_time/int_zendesk__requester_wait_time_business_hours.sql", "name": "int_zendesk__requester_wait_time_business_hours", "resource_type": "model", "alias": "int_zendesk__requester_wait_time_business_hours", "checksum": {"name": "sha256", "checksum": "8e952f5eaa1ac8a0a55162f5a1e8c8e3bd33294868b676e150528570353a1742"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["int_zendesk__requester_wait_time_filtered_statuses"], ["stg_zendesk__schedule"], ["int_zendesk__ticket_schedules"]], "sources": [], "depends_on": {"macros": ["macro.fivetran_utils.timestamp_diff", "macro.dbt_utils.date_trunc", "macro.dbt_utils.generate_series", "macro.dbt_utils.type_int", "macro.fivetran_utils.timestamp_add"], "nodes": ["model.zendesk.int_zendesk__requester_wait_time_filtered_statuses", "model.zendesk_source.stg_zendesk__schedule", "model.zendesk.int_zendesk__ticket_schedules"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/sla_policy/requester_wait_time/int_zendesk__requester_wait_time_business_hours.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_intermediate", "enabled": true}, "compiled_sql": "\n\n-- REQUESTER WAIT TIME\n-- This is complicated, as SLAs minutes are only counted while the ticket is in 'new', 'open', and 'on-hold' status.\n\n-- Additionally, for business hours, only 'new', 'open', and 'on-hold' status hours are counted if they are also during business hours\nwith requester_wait_time_filtered_statuses as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__requester_wait_time_filtered_statuses`\n where in_business_hours = 'true'\n\n), schedule as (\n\n select * \n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__schedule`\n\n), ticket_schedules as (\n\n select * \n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_schedules`\n \n-- cross schedules with work time\n), ticket_status_crossed_with_schedule as (\n \n select\n requester_wait_time_filtered_statuses.ticket_id,\n requester_wait_time_filtered_statuses.sla_applied_at,\n requester_wait_time_filtered_statuses.target,\n requester_wait_time_filtered_statuses.sla_policy_name,\n ticket_schedules.schedule_id,\n greatest(valid_starting_at, schedule_created_at) as valid_starting_at,\n least(valid_ending_at, schedule_invalidated_at) as valid_ending_at\n from requester_wait_time_filtered_statuses\n left join ticket_schedules\n on requester_wait_time_filtered_statuses.ticket_id = ticket_schedules.ticket_id\n where \n \n\n datetime_diff(\n cast(least(valid_ending_at, schedule_invalidated_at) as datetime),\n cast(greatest(valid_starting_at, schedule_created_at) as datetime),\n second\n )\n\n\n > 0\n\n), ticket_full_solved_time as (\n\n select \n ticket_status_crossed_with_schedule.*,\n round(\n \n\n datetime_diff(\n cast(ticket_status_crossed_with_schedule.valid_starting_at as datetime),\n cast(\n timestamp_trunc(\n cast(ticket_status_crossed_with_schedule.valid_starting_at as timestamp),\n week\n )\n\n as datetime),\n second\n )\n\n\n /60,\n 0) as valid_starting_at_in_minutes_from_week,\n round(\n \n\n datetime_diff(\n cast(ticket_status_crossed_with_schedule.valid_ending_at as datetime),\n cast(ticket_status_crossed_with_schedule.valid_starting_at as datetime),\n second\n )\n\n\n /60,\n 0) as raw_delta_in_minutes\n from ticket_status_crossed_with_schedule\n group by 1, 2, 3, 4, 5, 6, 7, 8\n\n), weeks as (\n\n \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * pow(2, 0)\n + \n \n p1.generated_number * pow(2, 1)\n + \n \n p2.generated_number * pow(2, 2)\n + \n \n p3.generated_number * pow(2, 3)\n + \n \n p4.generated_number * pow(2, 4)\n + \n \n p5.generated_number * pow(2, 5)\n + \n \n p6.generated_number * pow(2, 6)\n + \n \n p7.generated_number * pow(2, 7)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 208\n order by generated_number\n\n\n\n), weeks_cross_ticket_full_solved_time as (\n \n select \n ticket_full_solved_time.*,\n generated_number - 1 as week_number\n from ticket_full_solved_time\n cross join weeks\n where floor((valid_starting_at_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number -1\n\n), weekly_period_requester_wait_time as (\n\n select \n\n ticket_id,\n sla_applied_at,\n valid_starting_at,\n valid_ending_at,\n target,\n sla_policy_name,\n valid_starting_at_in_minutes_from_week,\n raw_delta_in_minutes,\n week_number,\n schedule_id,\n greatest(0, valid_starting_at_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time_minute,\n least(valid_starting_at_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time_minute\n \n from weeks_cross_ticket_full_solved_time\n\n), intercepted_periods_agent as (\n \n select \n weekly_period_requester_wait_time.ticket_id,\n weekly_period_requester_wait_time.sla_applied_at,\n weekly_period_requester_wait_time.target,\n weekly_period_requester_wait_time.sla_policy_name,\n weekly_period_requester_wait_time.valid_starting_at,\n weekly_period_requester_wait_time.valid_ending_at,\n weekly_period_requester_wait_time.week_number,\n weekly_period_requester_wait_time.ticket_week_start_time_minute,\n weekly_period_requester_wait_time.ticket_week_end_time_minute,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time_minute, schedule.end_time_utc) - greatest(weekly_period_requester_wait_time.ticket_week_start_time_minute, schedule.start_time_utc) as scheduled_minutes\n from weekly_period_requester_wait_time\n join schedule on ticket_week_start_time_minute <= schedule.end_time_utc \n and ticket_week_end_time_minute >= schedule.start_time_utc\n and weekly_period_requester_wait_time.schedule_id = schedule.schedule_id\n\n), intercepted_periods_with_running_total as (\n \n select \n *,\n sum(scheduled_minutes) over \n (partition by ticket_id, sla_applied_at \n order by valid_starting_at, week_number, schedule_end_time\n rows between unbounded preceding and current row)\n as running_total_scheduled_minutes\n\n from intercepted_periods_agent\n\n\n), intercepted_periods_agent_with_breach_flag as (\n select \n intercepted_periods_with_running_total.*,\n target - running_total_scheduled_minutes as remaining_target_minutes,\n lag(target - running_total_scheduled_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at, week_number, schedule_end_time) as lag_check,\n case when (target - running_total_scheduled_minutes) = 0 then true\n when (target - running_total_scheduled_minutes) < 0 \n and \n (lag(target - running_total_scheduled_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at, week_number, schedule_end_time) > 0 \n or \n lag(target - running_total_scheduled_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at, week_number, schedule_end_time) is null) \n then true else false end as is_breached_during_schedule\n \n from intercepted_periods_with_running_total\n\n), intercepted_periods_agent_filtered as (\n\n select\n *,\n (remaining_target_minutes + scheduled_minutes) as breach_minutes,\n greatest(ticket_week_start_time_minute, schedule_start_time) + (remaining_target_minutes + scheduled_minutes) as breach_minutes_from_week\n from intercepted_periods_agent_with_breach_flag\n\n), requester_wait_business_breach as (\n \n select \n *,\n \n\n timestamp_add(\n timestamp_trunc(\n cast(valid_starting_at as timestamp),\n week\n )\n\n, interval cast(((7*24*60) * week_number) + breach_minutes_from_week as \n int64\n ) minute)\n\n as sla_breach_at\n from intercepted_periods_agent_filtered\n\n)\n\nselect * \nfrom requester_wait_business_breach", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__requester_wait_time_business_hours`"}, "model.zendesk.int_zendesk__requester_wait_time_filtered_statuses": {"raw_sql": "with requester_wait_time_sla as (\n\n select *\n from {{ ref('int_zendesk__sla_policy_applied') }}\n where metric = 'requester_wait_time'\n\n), ticket_historical_status as (\n\n select *\n from {{ ref('int_zendesk__ticket_historical_status') }}\n \n--This captures the statuses of the ticket while the requester wait time sla was active for the ticket.\n), requester_wait_time_filtered_statuses as (\n\n select \n ticket_historical_status.ticket_id,\n greatest(ticket_historical_status.valid_starting_at, requester_wait_time_sla.sla_applied_at) as valid_starting_at,\n coalesce(\n ticket_historical_status.valid_ending_at, \n {{ fivetran_utils.timestamp_add('day', 30, \"\" ~ dbt_utils.current_timestamp() ~ \"\") }} ) as valid_ending_at, --assumes current status continues into the future. This is necessary to predict future SLA breaches (not just past).\n ticket_historical_status.status as ticket_status,\n requester_wait_time_sla.sla_applied_at,\n requester_wait_time_sla.target,\n requester_wait_time_sla.sla_policy_name,\n requester_wait_time_sla.ticket_created_at,\n requester_wait_time_sla.in_business_hours\n from ticket_historical_status\n join requester_wait_time_sla\n on ticket_historical_status.ticket_id = requester_wait_time_sla.ticket_id\n where ticket_historical_status.status in ('new', 'open', 'on-hold') -- these are the only statuses that count as \"requester wait time\"\n and sla_applied_at < valid_ending_at\n\n)\nselect *\nfrom requester_wait_time_filtered_statuses", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "fqn": ["zendesk", "sla_policy", "requester_wait_time", "int_zendesk__requester_wait_time_filtered_statuses"], "unique_id": "model.zendesk.int_zendesk__requester_wait_time_filtered_statuses", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "sla_policy/requester_wait_time/int_zendesk__requester_wait_time_filtered_statuses.sql", "original_file_path": "models/sla_policy/requester_wait_time/int_zendesk__requester_wait_time_filtered_statuses.sql", "name": "int_zendesk__requester_wait_time_filtered_statuses", "resource_type": "model", "alias": "int_zendesk__requester_wait_time_filtered_statuses", "checksum": {"name": "sha256", "checksum": "7304fc3acc9d562799a1c4799a0a30e013c58f4fe2f8305c95d18abd6d603a18"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["int_zendesk__sla_policy_applied"], ["int_zendesk__ticket_historical_status"]], "sources": [], "depends_on": {"macros": ["macro.dbt_utils.current_timestamp", "macro.fivetran_utils.timestamp_add"], "nodes": ["model.zendesk.int_zendesk__sla_policy_applied", "model.zendesk.int_zendesk__ticket_historical_status"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/sla_policy/requester_wait_time/int_zendesk__requester_wait_time_filtered_statuses.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_intermediate"}, "compiled_sql": "with requester_wait_time_sla as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__sla_policy_applied`\n where metric = 'requester_wait_time'\n\n), ticket_historical_status as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_historical_status`\n \n--This captures the statuses of the ticket while the requester wait time sla was active for the ticket.\n), requester_wait_time_filtered_statuses as (\n\n select \n ticket_historical_status.ticket_id,\n greatest(ticket_historical_status.valid_starting_at, requester_wait_time_sla.sla_applied_at) as valid_starting_at,\n coalesce(\n ticket_historical_status.valid_ending_at, \n \n\n timestamp_add(\n current_timestamp\n, interval 30 day)\n\n ) as valid_ending_at, --assumes current status continues into the future. This is necessary to predict future SLA breaches (not just past).\n ticket_historical_status.status as ticket_status,\n requester_wait_time_sla.sla_applied_at,\n requester_wait_time_sla.target,\n requester_wait_time_sla.sla_policy_name,\n requester_wait_time_sla.ticket_created_at,\n requester_wait_time_sla.in_business_hours\n from ticket_historical_status\n join requester_wait_time_sla\n on ticket_historical_status.ticket_id = requester_wait_time_sla.ticket_id\n where ticket_historical_status.status in ('new', 'open', 'on-hold') -- these are the only statuses that count as \"requester wait time\"\n and sla_applied_at < valid_ending_at\n\n)\nselect *\nfrom requester_wait_time_filtered_statuses", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__requester_wait_time_filtered_statuses`"}, "model.zendesk.int_zendesk__ticket_reply_times": {"raw_sql": "with ticket_public_comments as (\n\n select *\n from {{ ref('int_zendesk__comments_enriched') }}\n where is_public\n\n), end_user_comments as (\n \n select \n ticket_id,\n valid_starting_at as end_user_comment_created_at,\n previous_commenter_role = 'first_comment' as is_first_comment\n from ticket_public_comments \n where commenter_role = 'external_comment'\n and ticket_public_comments.previous_commenter_role != 'external_comment' -- we only care about net new end user comments\n\n), reply_timestamps as ( \n\n select\n end_user_comments.*,\n min(agent_comments.valid_starting_at) as agent_responded_at\n from end_user_comments\n left join ticket_public_comments as agent_comments\n on agent_comments.ticket_id = end_user_comments.ticket_id\n and agent_comments.commenter_role = 'internal_comment'\n and agent_comments.previous_commenter_role != 'internal_comment' -- we only care about net new agent comments\n and agent_comments.valid_starting_at > end_user_comments.end_user_comment_created_at\n group by 1,2,3\n\n)\n\n select\n *,\n {{ fivetran_utils.timestamp_diff(\n 'end_user_comment_created_at',\n 'agent_responded_at',\n 'minute') }} as reply_time_calendar_minutes\n from reply_timestamps\n order by 1,2", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk", "reply_times", "int_zendesk__ticket_reply_times"], "unique_id": "model.zendesk.int_zendesk__ticket_reply_times", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "reply_times/int_zendesk__ticket_reply_times.sql", "original_file_path": "models/reply_times/int_zendesk__ticket_reply_times.sql", "name": "int_zendesk__ticket_reply_times", "resource_type": "model", "alias": "int_zendesk__ticket_reply_times", "checksum": {"name": "sha256", "checksum": "0736fb8f22916269ffff051c7a7baedb809dd85093a8df1bb0251d2a47b116cc"}, "config": {"enabled": true, "materialized": "ephemeral", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["int_zendesk__comments_enriched"]], "sources": [], "depends_on": {"macros": ["macro.fivetran_utils.timestamp_diff"], "nodes": ["model.zendesk.int_zendesk__comments_enriched"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/reply_times/int_zendesk__ticket_reply_times.sql", "deferred": false, "unrendered_config": {"materialized": "ephemeral"}, "compiled_sql": "with ticket_public_comments as (\n\n select *\n from __dbt__CTE__int_zendesk__comments_enriched\n where is_public\n\n), end_user_comments as (\n \n select \n ticket_id,\n valid_starting_at as end_user_comment_created_at,\n previous_commenter_role = 'first_comment' as is_first_comment\n from ticket_public_comments \n where commenter_role = 'external_comment'\n and ticket_public_comments.previous_commenter_role != 'external_comment' -- we only care about net new end user comments\n\n), reply_timestamps as ( \n\n select\n end_user_comments.*,\n min(agent_comments.valid_starting_at) as agent_responded_at\n from end_user_comments\n left join ticket_public_comments as agent_comments\n on agent_comments.ticket_id = end_user_comments.ticket_id\n and agent_comments.commenter_role = 'internal_comment'\n and agent_comments.previous_commenter_role != 'internal_comment' -- we only care about net new agent comments\n and agent_comments.valid_starting_at > end_user_comments.end_user_comment_created_at\n group by 1,2,3\n\n)\n\n select\n *,\n \n \n\n datetime_diff(\n cast(agent_responded_at as datetime),\n cast(end_user_comment_created_at as datetime),\n minute\n )\n\n\n as reply_time_calendar_minutes\n from reply_timestamps\n order by 1,2", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.zendesk.int_zendesk__comments_enriched", "sql": " __dbt__CTE__int_zendesk__comments_enriched as (\nwith ticket_comment as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__updates`\n where field_name = 'comment'\n\n), users as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__user`\n\n), joined as (\n\n select \n\n ticket_comment.*,\n case when commenter.role = 'end-user' then 'external_comment'\n when commenter.role in ('agent','admin') then 'internal_comment'\n else 'unknown' end as commenter_role\n \n from ticket_comment\n \n join users as commenter\n on commenter.user_id = ticket_comment.user_id\n\n), add_previous_commenter_role as (\n\n select\n *,\n coalesce(\n lag(commenter_role) over (partition by ticket_id order by valid_starting_at)\n , 'first_comment') \n as previous_commenter_role,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_comment_added_at\n\n from joined\n)\n\nselect * \nfrom add_previous_commenter_role\n)"}], "relation_name": null}, "model.zendesk.int_zendesk__ticket_reply_times_calendar": {"raw_sql": "with ticket as (\n\n select *\n from {{ ref('stg_zendesk__ticket') }}\n\n), ticket_reply_times as (\n\n select *\n from {{ ref('int_zendesk__ticket_reply_times') }}\n\n)\n\nselect\n\n ticket.ticket_id,\n sum(case when is_first_comment then reply_time_calendar_minutes\n else null end) as first_reply_time_calendar_minutes,\n sum(reply_time_calendar_minutes) as total_reply_time_calendar_minutes --total combined time the customer waits for internal response\n \nfrom ticket\nleft join ticket_reply_times\n using (ticket_id)\n\ngroup by 1", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk", "reply_times", "int_zendesk__ticket_reply_times_calendar"], "unique_id": "model.zendesk.int_zendesk__ticket_reply_times_calendar", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "reply_times/int_zendesk__ticket_reply_times_calendar.sql", "original_file_path": "models/reply_times/int_zendesk__ticket_reply_times_calendar.sql", "name": "int_zendesk__ticket_reply_times_calendar", "resource_type": "model", "alias": "int_zendesk__ticket_reply_times_calendar", "checksum": {"name": "sha256", "checksum": "6fb6a60134019d78fcfc8c135b4a7887b3ce52ec53d8db463194f7824d2c71c2"}, "config": {"enabled": true, "materialized": "ephemeral", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["stg_zendesk__ticket"], ["int_zendesk__ticket_reply_times"]], "sources": [], "depends_on": {"macros": [], "nodes": ["model.zendesk_source.stg_zendesk__ticket", "model.zendesk.int_zendesk__ticket_reply_times"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/reply_times/int_zendesk__ticket_reply_times_calendar.sql", "deferred": false, "unrendered_config": {"materialized": "ephemeral"}, "compiled_sql": "with ticket as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket`\n\n), ticket_reply_times as (\n\n select *\n from __dbt__CTE__int_zendesk__ticket_reply_times\n\n)\n\nselect\n\n ticket.ticket_id,\n sum(case when is_first_comment then reply_time_calendar_minutes\n else null end) as first_reply_time_calendar_minutes,\n sum(reply_time_calendar_minutes) as total_reply_time_calendar_minutes --total combined time the customer waits for internal response\n \nfrom ticket\nleft join ticket_reply_times\n using (ticket_id)\n\ngroup by 1", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.zendesk.int_zendesk__comments_enriched", "sql": " __dbt__CTE__int_zendesk__comments_enriched as (\nwith ticket_comment as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__updates`\n where field_name = 'comment'\n\n), users as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__user`\n\n), joined as (\n\n select \n\n ticket_comment.*,\n case when commenter.role = 'end-user' then 'external_comment'\n when commenter.role in ('agent','admin') then 'internal_comment'\n else 'unknown' end as commenter_role\n \n from ticket_comment\n \n join users as commenter\n on commenter.user_id = ticket_comment.user_id\n\n), add_previous_commenter_role as (\n\n select\n *,\n coalesce(\n lag(commenter_role) over (partition by ticket_id order by valid_starting_at)\n , 'first_comment') \n as previous_commenter_role,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_comment_added_at\n\n from joined\n)\n\nselect * \nfrom add_previous_commenter_role\n)"}, {"id": "model.zendesk.int_zendesk__ticket_reply_times", "sql": " __dbt__CTE__int_zendesk__ticket_reply_times as (\nwith ticket_public_comments as (\n\n select *\n from __dbt__CTE__int_zendesk__comments_enriched\n where is_public\n\n), end_user_comments as (\n \n select \n ticket_id,\n valid_starting_at as end_user_comment_created_at,\n previous_commenter_role = 'first_comment' as is_first_comment\n from ticket_public_comments \n where commenter_role = 'external_comment'\n and ticket_public_comments.previous_commenter_role != 'external_comment' -- we only care about net new end user comments\n\n), reply_timestamps as ( \n\n select\n end_user_comments.*,\n min(agent_comments.valid_starting_at) as agent_responded_at\n from end_user_comments\n left join ticket_public_comments as agent_comments\n on agent_comments.ticket_id = end_user_comments.ticket_id\n and agent_comments.commenter_role = 'internal_comment'\n and agent_comments.previous_commenter_role != 'internal_comment' -- we only care about net new agent comments\n and agent_comments.valid_starting_at > end_user_comments.end_user_comment_created_at\n group by 1,2,3\n\n)\n\n select\n *,\n \n \n\n datetime_diff(\n cast(agent_responded_at as datetime),\n cast(end_user_comment_created_at as datetime),\n minute\n )\n\n\n as reply_time_calendar_minutes\n from reply_timestamps\n order by 1,2\n)"}], "relation_name": null}, "model.zendesk.int_zendesk__comments_enriched": {"raw_sql": "with ticket_comment as (\n\n select *\n from {{ ref('int_zendesk__updates') }}\n where field_name = 'comment'\n\n), users as (\n\n select *\n from {{ ref('stg_zendesk__user') }}\n\n), joined as (\n\n select \n\n ticket_comment.*,\n case when commenter.role = 'end-user' then 'external_comment'\n when commenter.role in ('agent','admin') then 'internal_comment'\n else 'unknown' end as commenter_role\n \n from ticket_comment\n \n join users as commenter\n on commenter.user_id = ticket_comment.user_id\n\n), add_previous_commenter_role as (\n\n select\n *,\n coalesce(\n lag(commenter_role) over (partition by ticket_id order by valid_starting_at)\n , 'first_comment') \n as previous_commenter_role,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_comment_added_at\n\n from joined\n)\n\nselect * \nfrom add_previous_commenter_role", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk", "reply_times", "int_zendesk__comments_enriched"], "unique_id": "model.zendesk.int_zendesk__comments_enriched", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "reply_times/int_zendesk__comments_enriched.sql", "original_file_path": "models/reply_times/int_zendesk__comments_enriched.sql", "name": "int_zendesk__comments_enriched", "resource_type": "model", "alias": "int_zendesk__comments_enriched", "checksum": {"name": "sha256", "checksum": "32be4ad9780dddf5950d5b11742109d031a548030b2d94e9afa6f498d8cdf718"}, "config": {"enabled": true, "materialized": "ephemeral", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["int_zendesk__updates"], ["stg_zendesk__user"]], "sources": [], "depends_on": {"macros": [], "nodes": ["model.zendesk.int_zendesk__updates", "model.zendesk_source.stg_zendesk__user"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/reply_times/int_zendesk__comments_enriched.sql", "deferred": false, "unrendered_config": {"materialized": "ephemeral"}, "compiled_sql": "with ticket_comment as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__updates`\n where field_name = 'comment'\n\n), users as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__user`\n\n), joined as (\n\n select \n\n ticket_comment.*,\n case when commenter.role = 'end-user' then 'external_comment'\n when commenter.role in ('agent','admin') then 'internal_comment'\n else 'unknown' end as commenter_role\n \n from ticket_comment\n \n join users as commenter\n on commenter.user_id = ticket_comment.user_id\n\n), add_previous_commenter_role as (\n\n select\n *,\n coalesce(\n lag(commenter_role) over (partition by ticket_id order by valid_starting_at)\n , 'first_comment') \n as previous_commenter_role,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_comment_added_at\n\n from joined\n)\n\nselect * \nfrom add_previous_commenter_role", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null}, "model.zendesk.int_zendesk__ticket_first_reply_time_business": {"raw_sql": "{{ config(enabled=var('using_schedules', True)) }}\n\nwith ticket_reply_times as (\n\n select *\n from {{ ref('int_zendesk__ticket_reply_times') }}\n\n), ticket_schedules as (\n\n select *\n from {{ ref('int_zendesk__ticket_schedules') }}\n\n), schedule as (\n\n select *\n from {{ ref('stg_zendesk__schedule') }}\n\n), first_reply_time as (\n\n select\n ticket_id,\n end_user_comment_created_at,\n agent_responded_at\n\n from ticket_reply_times\n where is_first_comment\n\n), ticket_first_reply_time as (\n\n select \n first_reply_time.ticket_id,\n ticket_schedules.schedule_created_at,\n ticket_schedules.schedule_invalidated_at,\n ticket_schedules.schedule_id,\n round({{ fivetran_utils.timestamp_diff(\n \"\" ~ dbt_utils.date_trunc('week', 'ticket_schedules.schedule_created_at') ~ \"\", \n 'ticket_schedules.schedule_created_at',\n 'second') }} /60,\n 0) as start_time_in_minutes_from_week,\n greatest(0,\n round(\n {{ fivetran_utils.timestamp_diff(\n 'ticket_schedules.schedule_created_at',\n 'least(ticket_schedules.schedule_invalidated_at, min(first_reply_time.agent_responded_at))',\n 'second') }}/60\n , 0)) as raw_delta_in_minutes\n \n from first_reply_time\n join ticket_schedules on first_reply_time.ticket_id = ticket_schedules.ticket_id\n group by 1, 2, 3, 4\n\n), weeks as (\n\n {{ dbt_utils.generate_series(208) }}\n\n), weeks_cross_ticket_first_reply as (\n\n select \n\n ticket_first_reply_time.*,\n generated_number - 1 as week_number\n\n from ticket_first_reply_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number - 1\n\n), weekly_periods as (\n \n select \n weeks_cross_ticket_first_reply.*, \n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n from weeks_cross_ticket_first_reply\n\n), intercepted_periods as (\n\n select ticket_id,\n week_number,\n weekly_periods.schedule_id,\n ticket_week_start_time,\n ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n\n)\n\n select ticket_id,\n sum(scheduled_minutes) as first_reply_time_business_minutes\n from intercepted_periods\n group by 1", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk", "reply_times", "int_zendesk__ticket_first_reply_time_business"], "unique_id": "model.zendesk.int_zendesk__ticket_first_reply_time_business", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "reply_times/int_zendesk__ticket_first_reply_time_business.sql", "original_file_path": "models/reply_times/int_zendesk__ticket_first_reply_time_business.sql", "name": "int_zendesk__ticket_first_reply_time_business", "resource_type": "model", "alias": "int_zendesk__ticket_first_reply_time_business", "checksum": {"name": "sha256", "checksum": "350cb72fa39be1e400adbaa26d0529c86c5afcbbd643d07491b8ba7382609267"}, "config": {"enabled": true, "materialized": "ephemeral", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["int_zendesk__ticket_reply_times"], ["int_zendesk__ticket_schedules"], ["stg_zendesk__schedule"]], "sources": [], "depends_on": {"macros": ["macro.dbt_utils.date_trunc", "macro.fivetran_utils.timestamp_diff", "macro.dbt_utils.generate_series"], "nodes": ["model.zendesk.int_zendesk__ticket_reply_times", "model.zendesk.int_zendesk__ticket_schedules", "model.zendesk_source.stg_zendesk__schedule"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/reply_times/int_zendesk__ticket_first_reply_time_business.sql", "deferred": false, "unrendered_config": {"materialized": "ephemeral", "enabled": true}, "compiled_sql": "\n\nwith ticket_reply_times as (\n\n select *\n from __dbt__CTE__int_zendesk__ticket_reply_times\n\n), ticket_schedules as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_schedules`\n\n), schedule as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__schedule`\n\n), first_reply_time as (\n\n select\n ticket_id,\n end_user_comment_created_at,\n agent_responded_at\n\n from ticket_reply_times\n where is_first_comment\n\n), ticket_first_reply_time as (\n\n select \n first_reply_time.ticket_id,\n ticket_schedules.schedule_created_at,\n ticket_schedules.schedule_invalidated_at,\n ticket_schedules.schedule_id,\n round(\n \n\n datetime_diff(\n cast(ticket_schedules.schedule_created_at as datetime),\n cast(\n timestamp_trunc(\n cast(ticket_schedules.schedule_created_at as timestamp),\n week\n )\n\n as datetime),\n second\n )\n\n\n /60,\n 0) as start_time_in_minutes_from_week,\n greatest(0,\n round(\n \n \n\n datetime_diff(\n cast(least(ticket_schedules.schedule_invalidated_at, min(first_reply_time.agent_responded_at)) as datetime),\n cast(ticket_schedules.schedule_created_at as datetime),\n second\n )\n\n\n/60\n , 0)) as raw_delta_in_minutes\n \n from first_reply_time\n join ticket_schedules on first_reply_time.ticket_id = ticket_schedules.ticket_id\n group by 1, 2, 3, 4\n\n), weeks as (\n\n \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * pow(2, 0)\n + \n \n p1.generated_number * pow(2, 1)\n + \n \n p2.generated_number * pow(2, 2)\n + \n \n p3.generated_number * pow(2, 3)\n + \n \n p4.generated_number * pow(2, 4)\n + \n \n p5.generated_number * pow(2, 5)\n + \n \n p6.generated_number * pow(2, 6)\n + \n \n p7.generated_number * pow(2, 7)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 208\n order by generated_number\n\n\n\n), weeks_cross_ticket_first_reply as (\n\n select \n\n ticket_first_reply_time.*,\n generated_number - 1 as week_number\n\n from ticket_first_reply_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number - 1\n\n), weekly_periods as (\n \n select \n weeks_cross_ticket_first_reply.*, \n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n from weeks_cross_ticket_first_reply\n\n), intercepted_periods as (\n\n select ticket_id,\n week_number,\n weekly_periods.schedule_id,\n ticket_week_start_time,\n ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n\n)\n\n select ticket_id,\n sum(scheduled_minutes) as first_reply_time_business_minutes\n from intercepted_periods\n group by 1", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.zendesk.int_zendesk__comments_enriched", "sql": " __dbt__CTE__int_zendesk__comments_enriched as (\nwith ticket_comment as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__updates`\n where field_name = 'comment'\n\n), users as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__user`\n\n), joined as (\n\n select \n\n ticket_comment.*,\n case when commenter.role = 'end-user' then 'external_comment'\n when commenter.role in ('agent','admin') then 'internal_comment'\n else 'unknown' end as commenter_role\n \n from ticket_comment\n \n join users as commenter\n on commenter.user_id = ticket_comment.user_id\n\n), add_previous_commenter_role as (\n\n select\n *,\n coalesce(\n lag(commenter_role) over (partition by ticket_id order by valid_starting_at)\n , 'first_comment') \n as previous_commenter_role,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_comment_added_at\n\n from joined\n)\n\nselect * \nfrom add_previous_commenter_role\n)"}, {"id": "model.zendesk.int_zendesk__ticket_reply_times", "sql": " __dbt__CTE__int_zendesk__ticket_reply_times as (\nwith ticket_public_comments as (\n\n select *\n from __dbt__CTE__int_zendesk__comments_enriched\n where is_public\n\n), end_user_comments as (\n \n select \n ticket_id,\n valid_starting_at as end_user_comment_created_at,\n previous_commenter_role = 'first_comment' as is_first_comment\n from ticket_public_comments \n where commenter_role = 'external_comment'\n and ticket_public_comments.previous_commenter_role != 'external_comment' -- we only care about net new end user comments\n\n), reply_timestamps as ( \n\n select\n end_user_comments.*,\n min(agent_comments.valid_starting_at) as agent_responded_at\n from end_user_comments\n left join ticket_public_comments as agent_comments\n on agent_comments.ticket_id = end_user_comments.ticket_id\n and agent_comments.commenter_role = 'internal_comment'\n and agent_comments.previous_commenter_role != 'internal_comment' -- we only care about net new agent comments\n and agent_comments.valid_starting_at > end_user_comments.end_user_comment_created_at\n group by 1,2,3\n\n)\n\n select\n *,\n \n \n\n datetime_diff(\n cast(agent_responded_at as datetime),\n cast(end_user_comment_created_at as datetime),\n minute\n )\n\n\n as reply_time_calendar_minutes\n from reply_timestamps\n order by 1,2\n)"}], "relation_name": null}, "model.zendesk.int_zendesk__field_history_enriched": {"raw_sql": "with ticket_field_history as (\n\n select *\n from {{ ref('stg_zendesk__ticket_field_history') }}\n\n), updater_info as (\n select *\n from {{ ref('int_zendesk__updater_information') }}\n\n), final as (\n select\n ticket_field_history.*\n\n {% if var('ticket_field_history_updater_columns')%} --The below will be run if any fields are included in the variable within the dbt_project.yml.\n {% for col in var('ticket_field_history_updater_columns') %} --Iterating through the updater fields included in the variable.\n\n --The below statements are needed to populate Zendesk automated fields for when the zendesk triggers automatically change fields based on user defined triggers.\n {% if col in ['updater_is_active'] %}\n ,coalesce(updater_info.{{ col|lower }}, true) as {{ col }}\n\n {% elif col in ['updater_user_id','updater_organization_id'] %}\n ,coalesce(updater_info.{{ col|lower }}, -1) as {{ col }}\n \n {% elif col in ['updater_last_login_at'] %}\n ,coalesce(updater_info.{{ col|lower }}, current_timestamp) as {{ col }}\n \n {% else %}\n ,coalesce(updater_info.{{ col|lower }}, concat('zendesk_trigger_change_', '{{ col }}' )) as {{ col }}\n \n {% endif %}\n {% endfor %}\n {% endif %} \n\n from ticket_field_history\n\n left join updater_info\n on ticket_field_history.user_id = updater_info.updater_user_id\n)\nselect *\nfrom final", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "fqn": ["zendesk", "ticket_history", "int_zendesk__field_history_enriched"], "unique_id": "model.zendesk.int_zendesk__field_history_enriched", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "ticket_history/int_zendesk__field_history_enriched.sql", "original_file_path": "models/ticket_history/int_zendesk__field_history_enriched.sql", "name": "int_zendesk__field_history_enriched", "resource_type": "model", "alias": "int_zendesk__field_history_enriched", "checksum": {"name": "sha256", "checksum": "ed29d2cf5bae22db49bfe045b4d8de74d14621182514e1fb8c47c28733c74b14"}, "config": {"enabled": true, "materialized": "ephemeral", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["stg_zendesk__ticket_field_history"], ["int_zendesk__updater_information"]], "sources": [], "depends_on": {"macros": [], "nodes": ["model.zendesk_source.stg_zendesk__ticket_field_history", "model.zendesk.int_zendesk__updater_information"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/ticket_history/int_zendesk__field_history_enriched.sql", "deferred": false, "unrendered_config": {"materialized": "ephemeral", "schema": "zendesk_intermediate"}, "compiled_sql": "with ticket_field_history as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket_field_history`\n\n), updater_info as (\n select *\n from __dbt__CTE__int_zendesk__updater_information\n\n), final as (\n select\n ticket_field_history.*\n\n \n\n from ticket_field_history\n\n left join updater_info\n on ticket_field_history.user_id = updater_info.updater_user_id\n)\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.zendesk.int_zendesk__updater_information", "sql": " __dbt__CTE__int_zendesk__updater_information as (\nwith users as (\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__user_aggregates`\n\n), organizations as (\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__organization_aggregates`\n\n), final as (\n select\n users.user_id as updater_user_id\n ,users.name as updater_name\n ,users.role as updater_role\n ,users.email as updater_email\n ,users.external_id as updater_external_id\n ,users.locale as updater_locale\n ,users.is_active as updater_is_active\n\n --If you use user tags this will be included, if not it will be ignored.\n \n ,users.user_tags as updater_user_tags\n \n\n ,users.last_login_at as updater_last_login_at\n ,users.time_zone as updater_time_zone\n ,organizations.organization_id as updater_organization_id\n\n --If you use using_domain_names tags this will be included, if not it will be ignored.\n \n ,organizations.domain_names as updater_organization_domain_names\n \n\n --If you use organization tags this will be included, if not it will be ignored.\n \n ,organizations.organization_tags as updater_organization_organization_tags\n \n from users\n\n left join organizations\n using(organization_id)\n)\n\nselect * \nfrom final\n)"}], "relation_name": null}, "model.zendesk.int_zendesk__field_history_pivot": {"raw_sql": "-- depends_on: {{ ref('stg_zendesk__ticket_field_history') }}\n\n{{ \n config(\n materialized='incremental',\n partition_by = {'field': 'date_day', 'data_type': 'date'},\n unique_key='ticket_day_id'\n ) \n}}\n\n{% if execute -%}\n {% set results = run_query('select distinct field_name from ' ~ var('field_history')) %}\n {% set results_list = results.columns[0].values() %}\n{% endif -%}\n\nwith field_history as (\n\n select\n ticket_id,\n field_name,\n valid_ending_at,\n valid_starting_at\n\n --Only runs if the user passes updater fields through the final ticket field history model\n {% if var('ticket_field_history_updater_columns') %}\n ,\n {{ var('ticket_field_history_updater_columns') | join (\", \")}}\n\n {% endif %}\n\n -- doing this to figure out what values are actually null and what needs to be backfilled in zendesk__ticket_field_history\n ,case when value is null then 'is_null' else value end as value\n\n from {{ ref('int_zendesk__field_history_enriched') }}\n {% if is_incremental() %}\n where cast( {{ dbt_utils.date_trunc('day', 'valid_starting_at') }} as date) >= (select max(date_day) from {{ this }})\n {% endif %}\n\n), event_order as (\n\n select \n *,\n row_number() over (\n partition by cast(valid_starting_at as date), ticket_id, field_name\n order by valid_starting_at desc\n ) as row_num\n from field_history\n\n), filtered as (\n\n -- Find the last event that occurs on each day for each ticket\n\n select *\n from event_order\n where row_num = 1\n\n), pivot as (\n\n -- For each column that is in both the ticket_field_history_columns variable and the field_history table,\n -- pivot out the value into it's own column. This will feed the daily slowly changing dimension model.\n\n select \n ticket_id,\n cast({{ dbt_utils.date_trunc('day', 'valid_starting_at') }} as date) as date_day\n\n {% for col in results_list if col in var('ticket_field_history_columns') %}\n {% set col_xf = col|lower %}\n ,min(case when lower(field_name) = '{{ col|lower }}' then filtered.value end) as {{ col_xf }}\n\n --Only runs if the user passes updater fields through the final ticket field history model\n {% if var('ticket_field_history_updater_columns') %}\n {% for upd in var('ticket_field_history_updater_columns') %}\n {% set upd_xf = (col|lower + '_' + upd ) %} --Creating the appropriate column name based on the history field + update field names.\n ,min(case when lower(field_name) = '{{ col|lower }}' then filtered.{{ upd }} end) as {{ upd_xf }}\n {% endfor %}\n {% endif %}\n {% endfor %}\n \n from filtered\n group by 1,2\n\n), surrogate_key as (\n\n select \n *,\n {{ dbt_utils.surrogate_key(['ticket_id','date_day'])}} as ticket_day_id\n from pivot\n\n)\n\nselect *\nfrom surrogate_key", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "fqn": ["zendesk", "ticket_history", "int_zendesk__field_history_pivot"], "unique_id": "model.zendesk.int_zendesk__field_history_pivot", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "ticket_history/int_zendesk__field_history_pivot.sql", "original_file_path": "models/ticket_history/int_zendesk__field_history_pivot.sql", "name": "int_zendesk__field_history_pivot", "resource_type": "model", "alias": "int_zendesk__field_history_pivot", "checksum": {"name": "sha256", "checksum": "a8f11f567d588805d71ef4dad5c38c8bb475460a3895e6c5d7e1aee6a238dd97"}, "config": {"enabled": true, "materialized": "incremental", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "full_refresh": null, "partition_by": {"field": "date_day", "data_type": "date"}, "unique_key": "ticket_day_id"}, "tags": [], "refs": [["stg_zendesk__ticket_field_history"], ["int_zendesk__field_history_enriched"]], "sources": [], "depends_on": {"macros": ["macro.dbt.is_incremental", "macro.dbt_utils.date_trunc", "macro.dbt_utils.surrogate_key", "macro.dbt.run_query"], "nodes": ["model.zendesk_source.stg_zendesk__ticket_field_history", "model.zendesk.int_zendesk__field_history_enriched"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/ticket_history/int_zendesk__field_history_pivot.sql", "deferred": false, "unrendered_config": {"materialized": "incremental", "schema": "zendesk_intermediate", "partition_by": {"field": "date_day", "data_type": "date"}, "unique_key": "ticket_day_id"}, "compiled_sql": "-- depends_on: `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket_field_history`\n\n\n\n\n \nwith __dbt__CTE__int_zendesk__updater_information as (\nwith users as (\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__user_aggregates`\n\n), organizations as (\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__organization_aggregates`\n\n), final as (\n select\n users.user_id as updater_user_id\n ,users.name as updater_name\n ,users.role as updater_role\n ,users.email as updater_email\n ,users.external_id as updater_external_id\n ,users.locale as updater_locale\n ,users.is_active as updater_is_active\n\n --If you use user tags this will be included, if not it will be ignored.\n \n ,users.user_tags as updater_user_tags\n \n\n ,users.last_login_at as updater_last_login_at\n ,users.time_zone as updater_time_zone\n ,organizations.organization_id as updater_organization_id\n\n --If you use using_domain_names tags this will be included, if not it will be ignored.\n \n ,organizations.domain_names as updater_organization_domain_names\n \n\n --If you use organization tags this will be included, if not it will be ignored.\n \n ,organizations.organization_tags as updater_organization_organization_tags\n \n from users\n\n left join organizations\n using(organization_id)\n)\n\nselect * \nfrom final\n), __dbt__CTE__int_zendesk__field_history_enriched as (\nwith ticket_field_history as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket_field_history`\n\n), updater_info as (\n select *\n from __dbt__CTE__int_zendesk__updater_information\n\n), final as (\n select\n ticket_field_history.*\n\n \n\n from ticket_field_history\n\n left join updater_info\n on ticket_field_history.user_id = updater_info.updater_user_id\n)\nselect *\nfrom final\n),field_history as (\n\n select\n ticket_id,\n field_name,\n valid_ending_at,\n valid_starting_at\n\n --Only runs if the user passes updater fields through the final ticket field history model\n \n\n -- doing this to figure out what values are actually null and what needs to be backfilled in zendesk__ticket_field_history\n ,case when value is null then 'is_null' else value end as value\n\n from __dbt__CTE__int_zendesk__field_history_enriched\n \n where cast( \n timestamp_trunc(\n cast(valid_starting_at as timestamp),\n day\n )\n\n as date) >= (select max(date_day) from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__field_history_pivot`)\n \n\n), event_order as (\n\n select \n *,\n row_number() over (\n partition by cast(valid_starting_at as date), ticket_id, field_name\n order by valid_starting_at desc\n ) as row_num\n from field_history\n\n), filtered as (\n\n -- Find the last event that occurs on each day for each ticket\n\n select *\n from event_order\n where row_num = 1\n\n), pivot as (\n\n -- For each column that is in both the ticket_field_history_columns variable and the field_history table,\n -- pivot out the value into it's own column. This will feed the daily slowly changing dimension model.\n\n select \n ticket_id,\n cast(\n timestamp_trunc(\n cast(valid_starting_at as timestamp),\n day\n )\n\n as date) as date_day\n\n \n \n ,min(case when lower(field_name) = 'status' then filtered.value end) as status\n\n --Only runs if the user passes updater fields through the final ticket field history model\n \n \n \n ,min(case when lower(field_name) = 'priority' then filtered.value end) as priority\n\n --Only runs if the user passes updater fields through the final ticket field history model\n \n \n \n ,min(case when lower(field_name) = 'assignee_id' then filtered.value end) as assignee_id\n\n --Only runs if the user passes updater fields through the final ticket field history model\n \n \n \n from filtered\n group by 1,2\n\n), surrogate_key as (\n\n select \n *,\n to_hex(md5(cast(concat(coalesce(cast(ticket_id as \n string\n), ''), '-', coalesce(cast(date_day as \n string\n), '')) as \n string\n))) as ticket_day_id\n from pivot\n\n)\n\nselect *\nfrom surrogate_key", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.zendesk.int_zendesk__updater_information", "sql": " __dbt__CTE__int_zendesk__updater_information as (\nwith users as (\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__user_aggregates`\n\n), organizations as (\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__organization_aggregates`\n\n), final as (\n select\n users.user_id as updater_user_id\n ,users.name as updater_name\n ,users.role as updater_role\n ,users.email as updater_email\n ,users.external_id as updater_external_id\n ,users.locale as updater_locale\n ,users.is_active as updater_is_active\n\n --If you use user tags this will be included, if not it will be ignored.\n \n ,users.user_tags as updater_user_tags\n \n\n ,users.last_login_at as updater_last_login_at\n ,users.time_zone as updater_time_zone\n ,organizations.organization_id as updater_organization_id\n\n --If you use using_domain_names tags this will be included, if not it will be ignored.\n \n ,organizations.domain_names as updater_organization_domain_names\n \n\n --If you use organization tags this will be included, if not it will be ignored.\n \n ,organizations.organization_tags as updater_organization_organization_tags\n \n from users\n\n left join organizations\n using(organization_id)\n)\n\nselect * \nfrom final\n)"}, {"id": "model.zendesk.int_zendesk__field_history_enriched", "sql": " __dbt__CTE__int_zendesk__field_history_enriched as (\nwith ticket_field_history as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket_field_history`\n\n), updater_info as (\n select *\n from __dbt__CTE__int_zendesk__updater_information\n\n), final as (\n select\n ticket_field_history.*\n\n \n\n from ticket_field_history\n\n left join updater_info\n on ticket_field_history.user_id = updater_info.updater_user_id\n)\nselect *\nfrom final\n)"}], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__field_history_pivot`"}, "model.zendesk.int_zendesk__updater_information": {"raw_sql": "with users as (\n select *\n from {{ ref('int_zendesk__user_aggregates') }}\n\n), organizations as (\n select *\n from {{ ref('int_zendesk__organization_aggregates') }}\n\n), final as (\n select\n users.user_id as updater_user_id\n ,users.name as updater_name\n ,users.role as updater_role\n ,users.email as updater_email\n ,users.external_id as updater_external_id\n ,users.locale as updater_locale\n ,users.is_active as updater_is_active\n\n --If you use user tags this will be included, if not it will be ignored.\n {% if var('using_user_tags', True) %}\n ,users.user_tags as updater_user_tags\n {% endif %}\n\n ,users.last_login_at as updater_last_login_at\n ,users.time_zone as updater_time_zone\n ,organizations.organization_id as updater_organization_id\n\n --If you use using_domain_names tags this will be included, if not it will be ignored.\n {% if var('using_domain_names', True) %}\n ,organizations.domain_names as updater_organization_domain_names\n {% endif %}\n\n --If you use organization tags this will be included, if not it will be ignored.\n {% if var('using_organization_tags', True) %}\n ,organizations.organization_tags as updater_organization_organization_tags\n {% endif %}\n from users\n\n left join organizations\n using(organization_id)\n)\n\nselect * \nfrom final", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "fqn": ["zendesk", "ticket_history", "int_zendesk__updater_information"], "unique_id": "model.zendesk.int_zendesk__updater_information", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "ticket_history/int_zendesk__updater_information.sql", "original_file_path": "models/ticket_history/int_zendesk__updater_information.sql", "name": "int_zendesk__updater_information", "resource_type": "model", "alias": "int_zendesk__updater_information", "checksum": {"name": "sha256", "checksum": "62a690646cff991c0e0b6e205440a070bb44aab8d4d9286714710c52a4c6677a"}, "config": {"enabled": true, "materialized": "ephemeral", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["int_zendesk__user_aggregates"], ["int_zendesk__organization_aggregates"]], "sources": [], "depends_on": {"macros": [], "nodes": ["model.zendesk.int_zendesk__user_aggregates", "model.zendesk.int_zendesk__organization_aggregates"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/ticket_history/int_zendesk__updater_information.sql", "deferred": false, "unrendered_config": {"materialized": "ephemeral", "schema": "zendesk_intermediate"}, "compiled_sql": "with users as (\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__user_aggregates`\n\n), organizations as (\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__organization_aggregates`\n\n), final as (\n select\n users.user_id as updater_user_id\n ,users.name as updater_name\n ,users.role as updater_role\n ,users.email as updater_email\n ,users.external_id as updater_external_id\n ,users.locale as updater_locale\n ,users.is_active as updater_is_active\n\n --If you use user tags this will be included, if not it will be ignored.\n \n ,users.user_tags as updater_user_tags\n \n\n ,users.last_login_at as updater_last_login_at\n ,users.time_zone as updater_time_zone\n ,organizations.organization_id as updater_organization_id\n\n --If you use using_domain_names tags this will be included, if not it will be ignored.\n \n ,organizations.domain_names as updater_organization_domain_names\n \n\n --If you use organization tags this will be included, if not it will be ignored.\n \n ,organizations.organization_tags as updater_organization_organization_tags\n \n from users\n\n left join organizations\n using(organization_id)\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null}, "model.zendesk.int_zendesk__field_history_scd": {"raw_sql": "-- model needs to materialize as a table to avoid erroneous null values\n{{ config( materialized='table') }} \n\n{%- set ticket_columns = adapter.get_columns_in_relation(ref('int_zendesk__field_history_pivot')) -%}\n\nwith change_data as (\n\n select *\n from {{ ref('int_zendesk__field_history_pivot') }}\n\n), fill_values as (\n\n-- each row of the pivoted table includes field values if that field was updated on that day\n-- we need to backfill to persist values that have been previously updated and are still valid \n select \n date_day as valid_from, \n ticket_id,\n ticket_day_id\n\n {% for col in ticket_columns if col.name|lower not in ['date_day','ticket_id','ticket_day_id'] %} \n\n ,last_value({{ col.name }} ignore nulls) over \n (partition by ticket_id order by date_day asc rows between unbounded preceding and current row) as {{ col.name }}\n\n {% endfor %}\n\n from change_data\n\n)\n\nselect *\nfrom fill_values", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "fqn": ["zendesk", "ticket_history", "int_zendesk__field_history_scd"], "unique_id": "model.zendesk.int_zendesk__field_history_scd", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "ticket_history/int_zendesk__field_history_scd.sql", "original_file_path": "models/ticket_history/int_zendesk__field_history_scd.sql", "name": "int_zendesk__field_history_scd", "resource_type": "model", "alias": "int_zendesk__field_history_scd", "checksum": {"name": "sha256", "checksum": "6c9698b1d5c18df9c6fd7e96c789960f9d7ecc44be1d2d2897db2765f16ed536"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["int_zendesk__field_history_pivot"], ["int_zendesk__field_history_pivot"]], "sources": [], "depends_on": {"macros": [], "nodes": ["model.zendesk.int_zendesk__field_history_pivot", "model.zendesk.int_zendesk__field_history_pivot"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/ticket_history/int_zendesk__field_history_scd.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_intermediate"}, "compiled_sql": "-- model needs to materialize as a table to avoid erroneous null values\nwith change_data as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__field_history_pivot`\n\n), fill_values as (\n\n-- each row of the pivoted table includes field values if that field was updated on that day\n-- we need to backfill to persist values that have been previously updated and are still valid \n select \n date_day as valid_from, \n ticket_id,\n ticket_day_id\n\n \n\n ,last_value(status ignore nulls) over \n (partition by ticket_id order by date_day asc rows between unbounded preceding and current row) as status\n\n \n\n ,last_value(priority ignore nulls) over \n (partition by ticket_id order by date_day asc rows between unbounded preceding and current row) as priority\n\n \n\n ,last_value(assignee_id ignore nulls) over \n (partition by ticket_id order by date_day asc rows between unbounded preceding and current row) as assignee_id\n\n \n\n from change_data\n\n)\n\nselect *\nfrom fill_values", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__field_history_scd`"}, "model.zendesk.int_zendesk__field_calendar_spine": {"raw_sql": "{{\n config(\n materialized='incremental',\n partition_by = {'field': 'date_day', 'data_type': 'date'},\n unique_key='ticket_day_id'\n )\n}}\n\nwith calendar as (\n\n select *\n from {{ ref('int_zendesk__calendar_spine') }}\n {% if is_incremental() %}\n where date_day >= (select max(date_day) from {{ this }})\n {% endif %}\n\n), ticket as (\n\n select *\n from {{ var('ticket') }}\n \n), joined as (\n\n select \n calendar.date_day,\n ticket.ticket_id\n from calendar\n inner join ticket\n on calendar.date_day >= cast(ticket.created_at as date)\n\n), surrogate_key as (\n\n select\n *,\n {{ dbt_utils.surrogate_key(['date_day','ticket_id']) }} as ticket_day_id\n from joined\n\n)\n\nselect *\nfrom surrogate_key", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "fqn": ["zendesk", "ticket_history", "int_zendesk__field_calendar_spine"], "unique_id": "model.zendesk.int_zendesk__field_calendar_spine", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "ticket_history/int_zendesk__field_calendar_spine.sql", "original_file_path": "models/ticket_history/int_zendesk__field_calendar_spine.sql", "name": "int_zendesk__field_calendar_spine", "resource_type": "model", "alias": "int_zendesk__field_calendar_spine", "checksum": {"name": "sha256", "checksum": "d318e2b20b32991a75f255046ab6f36c1573e9eb3864563b71e3a6c66f1b4674"}, "config": {"enabled": true, "materialized": "incremental", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "full_refresh": null, "partition_by": {"field": "date_day", "data_type": "date"}, "unique_key": "ticket_day_id"}, "tags": [], "refs": [["int_zendesk__calendar_spine"], ["stg_zendesk__ticket"]], "sources": [], "depends_on": {"macros": ["macro.dbt.is_incremental", "macro.dbt_utils.surrogate_key"], "nodes": ["model.zendesk.int_zendesk__calendar_spine", "model.zendesk_source.stg_zendesk__ticket"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/ticket_history/int_zendesk__field_calendar_spine.sql", "deferred": false, "unrendered_config": {"materialized": "incremental", "schema": "zendesk_intermediate", "partition_by": {"field": "date_day", "data_type": "date"}, "unique_key": "ticket_day_id"}, "compiled_sql": "\n\nwith __dbt__CTE__int_zendesk__calendar_spine as (\n-- depends_on: `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket`\n\nwith spine as (\n\n \n \n \n \n \n\n\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 \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * pow(2, 0)\n + \n \n p1.generated_number * pow(2, 1)\n + \n \n p2.generated_number * pow(2, 2)\n + \n \n p3.generated_number * pow(2, 3)\n + \n \n p4.generated_number * pow(2, 4)\n + \n \n p5.generated_number * pow(2, 5)\n + \n \n p6.generated_number * pow(2, 6)\n + \n \n p7.generated_number * pow(2, 7)\n + \n \n p8.generated_number * pow(2, 8)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n cross join \n \n p as p8\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 399\n order by generated_number\n\n\n\n),\n\nall_periods as (\n\n select (\n \n\n datetime_add(\n cast( '2020-02-13' as datetime),\n interval row_number() over (order by 1) - 1 day\n )\n\n\n ) as date_day\n from rawdata\n\n),\n\nfiltered as (\n\n select *\n from all_periods\n where date_day <= \n\n datetime_add(\n cast( current_date as datetime),\n interval 1 week\n )\n\n\n\n)\n\nselect * from filtered\n\n\n\n), recast as (\n\n select cast(date_day as date) as date_day\n from spine\n\n)\n\nselect *\nfrom recast\n),calendar as (\n\n select *\n from __dbt__CTE__int_zendesk__calendar_spine\n \n where date_day >= (select max(date_day) from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__field_calendar_spine`)\n \n\n), ticket as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket`\n \n), joined as (\n\n select \n calendar.date_day,\n ticket.ticket_id\n from calendar\n inner join ticket\n on calendar.date_day >= cast(ticket.created_at as date)\n\n), surrogate_key as (\n\n select\n *,\n to_hex(md5(cast(concat(coalesce(cast(date_day as \n string\n), ''), '-', coalesce(cast(ticket_id as \n string\n), '')) as \n string\n))) as ticket_day_id\n from joined\n\n)\n\nselect *\nfrom surrogate_key", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.zendesk.int_zendesk__calendar_spine", "sql": " __dbt__CTE__int_zendesk__calendar_spine as (\n-- depends_on: `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket`\n\nwith spine as (\n\n \n \n \n \n \n\n\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 \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * pow(2, 0)\n + \n \n p1.generated_number * pow(2, 1)\n + \n \n p2.generated_number * pow(2, 2)\n + \n \n p3.generated_number * pow(2, 3)\n + \n \n p4.generated_number * pow(2, 4)\n + \n \n p5.generated_number * pow(2, 5)\n + \n \n p6.generated_number * pow(2, 6)\n + \n \n p7.generated_number * pow(2, 7)\n + \n \n p8.generated_number * pow(2, 8)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n cross join \n \n p as p8\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 399\n order by generated_number\n\n\n\n),\n\nall_periods as (\n\n select (\n \n\n datetime_add(\n cast( '2020-02-13' as datetime),\n interval row_number() over (order by 1) - 1 day\n )\n\n\n ) as date_day\n from rawdata\n\n),\n\nfiltered as (\n\n select *\n from all_periods\n where date_day <= \n\n datetime_add(\n cast( current_date as datetime),\n interval 1 week\n )\n\n\n\n)\n\nselect * from filtered\n\n\n\n), recast as (\n\n select cast(date_day as date) as date_day\n from spine\n\n)\n\nselect *\nfrom recast\n)"}], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__field_calendar_spine`"}, "model.zendesk.int_zendesk__ticket_work_time_calendar": {"raw_sql": "with ticket_historical_status as (\n\n select *\n from {{ ref('int_zendesk__ticket_historical_status') }}\n\n), calendar_minutes as (\n \n select \n ticket_id,\n status,\n case when status in ('pending') then status_duration_calendar_minutes\n else 0 end as agent_wait_time_in_minutes,\n case when status in ('new', 'open', 'hold') then status_duration_calendar_minutes\n else 0 end as requester_wait_time_in_minutes,\n case when status in ('new', 'open') then status_duration_calendar_minutes\n else 0 end as agent_work_time_in_minutes,\n case when status in ('hold') then status_duration_calendar_minutes\n else 0 end as on_hold_time_in_minutes,\n case when status = 'new' then status_duration_calendar_minutes\n else 0 end as new_status_duration_minutes,\n case when status = 'open' then status_duration_calendar_minutes\n else 0 end as open_status_duration_minutes,\n case when status = 'deleted' then 1\n else 0 end as ticket_deleted,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_status_assignment_date,\n case when lag(status) over (partition by ticket_id order by valid_starting_at) = 'deleted' and status != 'deleted'\n then 1\n else 0\n end as ticket_recoveries\n\n from ticket_historical_status\n\n)\n\nselect \n ticket_id,\n last_status_assignment_date,\n sum(ticket_deleted) as ticket_deleted_count,\n sum(agent_wait_time_in_minutes) as agent_wait_time_in_calendar_minutes,\n sum(requester_wait_time_in_minutes) as requester_wait_time_in_calendar_minutes,\n sum(agent_work_time_in_minutes) as agent_work_time_in_calendar_minutes,\n sum(on_hold_time_in_minutes) as on_hold_time_in_calendar_minutes,\n sum(new_status_duration_minutes) as new_status_duration_in_calendar_minutes,\n sum(open_status_duration_minutes) as open_status_duration_in_calendar_minutes,\n sum(ticket_recoveries) as total_ticket_recoveries\nfrom calendar_minutes\ngroup by 1, 2", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk", "agent_work_time", "int_zendesk__ticket_work_time_calendar"], "unique_id": "model.zendesk.int_zendesk__ticket_work_time_calendar", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "agent_work_time/int_zendesk__ticket_work_time_calendar.sql", "original_file_path": "models/agent_work_time/int_zendesk__ticket_work_time_calendar.sql", "name": "int_zendesk__ticket_work_time_calendar", "resource_type": "model", "alias": "int_zendesk__ticket_work_time_calendar", "checksum": {"name": "sha256", "checksum": "cf3556742d3de31832862939ef3e9ef76e09762949db514b4a8e125953460c10"}, "config": {"enabled": true, "materialized": "ephemeral", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["int_zendesk__ticket_historical_status"]], "sources": [], "depends_on": {"macros": [], "nodes": ["model.zendesk.int_zendesk__ticket_historical_status"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/agent_work_time/int_zendesk__ticket_work_time_calendar.sql", "deferred": false, "unrendered_config": {"materialized": "ephemeral"}, "compiled_sql": "with ticket_historical_status as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_historical_status`\n\n), calendar_minutes as (\n \n select \n ticket_id,\n status,\n case when status in ('pending') then status_duration_calendar_minutes\n else 0 end as agent_wait_time_in_minutes,\n case when status in ('new', 'open', 'hold') then status_duration_calendar_minutes\n else 0 end as requester_wait_time_in_minutes,\n case when status in ('new', 'open') then status_duration_calendar_minutes\n else 0 end as agent_work_time_in_minutes,\n case when status in ('hold') then status_duration_calendar_minutes\n else 0 end as on_hold_time_in_minutes,\n case when status = 'new' then status_duration_calendar_minutes\n else 0 end as new_status_duration_minutes,\n case when status = 'open' then status_duration_calendar_minutes\n else 0 end as open_status_duration_minutes,\n case when status = 'deleted' then 1\n else 0 end as ticket_deleted,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_status_assignment_date,\n case when lag(status) over (partition by ticket_id order by valid_starting_at) = 'deleted' and status != 'deleted'\n then 1\n else 0\n end as ticket_recoveries\n\n from ticket_historical_status\n\n)\n\nselect \n ticket_id,\n last_status_assignment_date,\n sum(ticket_deleted) as ticket_deleted_count,\n sum(agent_wait_time_in_minutes) as agent_wait_time_in_calendar_minutes,\n sum(requester_wait_time_in_minutes) as requester_wait_time_in_calendar_minutes,\n sum(agent_work_time_in_minutes) as agent_work_time_in_calendar_minutes,\n sum(on_hold_time_in_minutes) as on_hold_time_in_calendar_minutes,\n sum(new_status_duration_minutes) as new_status_duration_in_calendar_minutes,\n sum(open_status_duration_minutes) as open_status_duration_in_calendar_minutes,\n sum(ticket_recoveries) as total_ticket_recoveries\nfrom calendar_minutes\ngroup by 1, 2", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null}, "model.zendesk.int_zendesk__ticket_work_time_business": {"raw_sql": "{{ config(enabled=var('using_schedules', True)) }}\n\nwith ticket_historical_status as (\n\n select *\n from {{ ref('int_zendesk__ticket_historical_status') }}\n\n), ticket_schedules as (\n\n select *\n from {{ ref('int_zendesk__ticket_schedules') }}\n\n), schedule as (\n\n select *\n from {{ ref('stg_zendesk__schedule') }}\n\n), ticket_status_crossed_with_schedule as (\n \n select\n ticket_historical_status.ticket_id,\n ticket_historical_status.status as ticket_status,\n ticket_schedules.schedule_id,\n greatest(valid_starting_at, schedule_created_at) as status_schedule_start,\n least(valid_ending_at, schedule_invalidated_at) as status_schedule_end\n from ticket_historical_status\n left join ticket_schedules\n on ticket_historical_status.ticket_id = ticket_schedules.ticket_id\n where {{ fivetran_utils.timestamp_diff('greatest(valid_starting_at, schedule_created_at)', 'least(valid_ending_at, schedule_invalidated_at)', 'second') }} > 0\n\n), ticket_full_solved_time as (\n\n select \n ticket_status_crossed_with_schedule.*,\n round({{ fivetran_utils.timestamp_diff(\n \"\" ~ dbt_utils.date_trunc('week', 'ticket_status_crossed_with_schedule.status_schedule_start') ~ \"\", \n 'ticket_status_crossed_with_schedule.status_schedule_start',\n 'second') }} /60,\n 0) as start_time_in_minutes_from_week,\n round({{ fivetran_utils.timestamp_diff(\n 'ticket_status_crossed_with_schedule.status_schedule_start',\n 'ticket_status_crossed_with_schedule.status_schedule_end',\n 'second') }} /60,\n 0) as raw_delta_in_minutes\n from ticket_status_crossed_with_schedule\n group by 1, 2, 3, 4, 5\n\n), weeks as (\n\n {{ dbt_utils.generate_series(208) }}\n\n), weeks_cross_ticket_full_solved_time as (\n \n select \n ticket_full_solved_time.*,\n generated_number - 1 as week_number\n from ticket_full_solved_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number -1\n\n), weekly_periods as (\n\n select\n\n weeks_cross_ticket_full_solved_time.*,\n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n \n from weeks_cross_ticket_full_solved_time\n\n), intercepted_periods as (\n \n select \n weekly_periods.ticket_id,\n weekly_periods.week_number,\n weekly_periods.schedule_id,\n weekly_periods.ticket_status,\n weekly_periods.ticket_week_start_time,\n weekly_periods.ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(weekly_periods.ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n\n), business_minutes as (\n \n select \n ticket_id,\n ticket_status,\n case when ticket_status in ('pending') then scheduled_minutes\n else 0 end as agent_wait_time_in_minutes,\n case when ticket_status in ('new', 'open', 'hold') then scheduled_minutes\n else 0 end as requester_wait_time_in_minutes,\n case when ticket_status in ('new', 'open') then scheduled_minutes\n else 0 end as agent_work_time_in_minutes,\n case when ticket_status in ('hold') then scheduled_minutes\n else 0 end as on_hold_time_in_minutes\n from intercepted_periods\n\n)\n \n select \n ticket_id,\n sum(agent_wait_time_in_minutes) as agent_wait_time_in_business_minutes,\n sum(requester_wait_time_in_minutes) as requester_wait_time_in_business_minutes,\n sum(agent_work_time_in_minutes) as agent_work_time_in_business_minutes,\n sum(on_hold_time_in_minutes) as on_hold_time_in_business_minutes\n from business_minutes\n group by 1", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk", "agent_work_time", "int_zendesk__ticket_work_time_business"], "unique_id": "model.zendesk.int_zendesk__ticket_work_time_business", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "agent_work_time/int_zendesk__ticket_work_time_business.sql", "original_file_path": "models/agent_work_time/int_zendesk__ticket_work_time_business.sql", "name": "int_zendesk__ticket_work_time_business", "resource_type": "model", "alias": "int_zendesk__ticket_work_time_business", "checksum": {"name": "sha256", "checksum": "ff053a45f53e78105c94b1759dd089a30ad42c996ca7ef0803d747c52abf493b"}, "config": {"enabled": true, "materialized": "ephemeral", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["int_zendesk__ticket_historical_status"], ["int_zendesk__ticket_schedules"], ["stg_zendesk__schedule"]], "sources": [], "depends_on": {"macros": ["macro.fivetran_utils.timestamp_diff", "macro.dbt_utils.date_trunc", "macro.dbt_utils.generate_series"], "nodes": ["model.zendesk.int_zendesk__ticket_historical_status", "model.zendesk.int_zendesk__ticket_schedules", "model.zendesk_source.stg_zendesk__schedule"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/agent_work_time/int_zendesk__ticket_work_time_business.sql", "deferred": false, "unrendered_config": {"materialized": "ephemeral", "enabled": true}, "compiled_sql": "\n\nwith ticket_historical_status as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_historical_status`\n\n), ticket_schedules as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_schedules`\n\n), schedule as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__schedule`\n\n), ticket_status_crossed_with_schedule as (\n \n select\n ticket_historical_status.ticket_id,\n ticket_historical_status.status as ticket_status,\n ticket_schedules.schedule_id,\n greatest(valid_starting_at, schedule_created_at) as status_schedule_start,\n least(valid_ending_at, schedule_invalidated_at) as status_schedule_end\n from ticket_historical_status\n left join ticket_schedules\n on ticket_historical_status.ticket_id = ticket_schedules.ticket_id\n where \n \n\n datetime_diff(\n cast(least(valid_ending_at, schedule_invalidated_at) as datetime),\n cast(greatest(valid_starting_at, schedule_created_at) as datetime),\n second\n )\n\n\n > 0\n\n), ticket_full_solved_time as (\n\n select \n ticket_status_crossed_with_schedule.*,\n round(\n \n\n datetime_diff(\n cast(ticket_status_crossed_with_schedule.status_schedule_start as datetime),\n cast(\n timestamp_trunc(\n cast(ticket_status_crossed_with_schedule.status_schedule_start as timestamp),\n week\n )\n\n as datetime),\n second\n )\n\n\n /60,\n 0) as start_time_in_minutes_from_week,\n round(\n \n\n datetime_diff(\n cast(ticket_status_crossed_with_schedule.status_schedule_end as datetime),\n cast(ticket_status_crossed_with_schedule.status_schedule_start as datetime),\n second\n )\n\n\n /60,\n 0) as raw_delta_in_minutes\n from ticket_status_crossed_with_schedule\n group by 1, 2, 3, 4, 5\n\n), weeks as (\n\n \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * pow(2, 0)\n + \n \n p1.generated_number * pow(2, 1)\n + \n \n p2.generated_number * pow(2, 2)\n + \n \n p3.generated_number * pow(2, 3)\n + \n \n p4.generated_number * pow(2, 4)\n + \n \n p5.generated_number * pow(2, 5)\n + \n \n p6.generated_number * pow(2, 6)\n + \n \n p7.generated_number * pow(2, 7)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 208\n order by generated_number\n\n\n\n), weeks_cross_ticket_full_solved_time as (\n \n select \n ticket_full_solved_time.*,\n generated_number - 1 as week_number\n from ticket_full_solved_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number -1\n\n), weekly_periods as (\n\n select\n\n weeks_cross_ticket_full_solved_time.*,\n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n \n from weeks_cross_ticket_full_solved_time\n\n), intercepted_periods as (\n \n select \n weekly_periods.ticket_id,\n weekly_periods.week_number,\n weekly_periods.schedule_id,\n weekly_periods.ticket_status,\n weekly_periods.ticket_week_start_time,\n weekly_periods.ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(weekly_periods.ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n\n), business_minutes as (\n \n select \n ticket_id,\n ticket_status,\n case when ticket_status in ('pending') then scheduled_minutes\n else 0 end as agent_wait_time_in_minutes,\n case when ticket_status in ('new', 'open', 'hold') then scheduled_minutes\n else 0 end as requester_wait_time_in_minutes,\n case when ticket_status in ('new', 'open') then scheduled_minutes\n else 0 end as agent_work_time_in_minutes,\n case when ticket_status in ('hold') then scheduled_minutes\n else 0 end as on_hold_time_in_minutes\n from intercepted_periods\n\n)\n \n select \n ticket_id,\n sum(agent_wait_time_in_minutes) as agent_wait_time_in_business_minutes,\n sum(requester_wait_time_in_minutes) as requester_wait_time_in_business_minutes,\n sum(agent_work_time_in_minutes) as agent_work_time_in_business_minutes,\n sum(on_hold_time_in_minutes) as on_hold_time_in_business_minutes\n from business_minutes\n group by 1", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null}, "model.zendesk.int_zendesk__calendar_spine": {"raw_sql": "-- depends_on: {{ ref('stg_zendesk__ticket') }}\n\nwith spine as (\n\n {% if execute %}\n {% set first_date_query %}\n select min( created_at ) as min_date from {{ ref('stg_zendesk__ticket') }}\n {% endset %}\n {% set first_date = run_query(first_date_query).columns[0][0]|string %}\n \n {% else %} {% set first_date = \"'2016-01-01'\" %}\n {% endif %}\n\n{{\n dbt_utils.date_spine(\n datepart = \"day\", \n start_date = \"'\" ~ first_date[0:10] ~ \"'\", \n end_date = dbt_utils.dateadd(\"week\", 1, \"current_date\")\n ) \n}}\n\n), recast as (\n\n select cast(date_day as date) as date_day\n from spine\n\n)\n\nselect *\nfrom recast", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk", "utils", "int_zendesk__calendar_spine"], "unique_id": "model.zendesk.int_zendesk__calendar_spine", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "utils/int_zendesk__calendar_spine.sql", "original_file_path": "models/utils/int_zendesk__calendar_spine.sql", "name": "int_zendesk__calendar_spine", "resource_type": "model", "alias": "int_zendesk__calendar_spine", "checksum": {"name": "sha256", "checksum": "258e31d992aea65ae8bb2acb80c2dba3c75f2c1c2b87d8c61c1fb14b6c96696d"}, "config": {"enabled": true, "materialized": "ephemeral", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["stg_zendesk__ticket"]], "sources": [], "depends_on": {"macros": ["macro.dbt_utils.dateadd", "macro.dbt_utils.date_spine", "macro.dbt.run_query"], "nodes": ["model.zendesk_source.stg_zendesk__ticket"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/utils/int_zendesk__calendar_spine.sql", "deferred": false, "unrendered_config": {"materialized": "ephemeral"}, "compiled_sql": "-- depends_on: `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket`\n\nwith spine as (\n\n \n \n \n \n \n\n\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 \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * pow(2, 0)\n + \n \n p1.generated_number * pow(2, 1)\n + \n \n p2.generated_number * pow(2, 2)\n + \n \n p3.generated_number * pow(2, 3)\n + \n \n p4.generated_number * pow(2, 4)\n + \n \n p5.generated_number * pow(2, 5)\n + \n \n p6.generated_number * pow(2, 6)\n + \n \n p7.generated_number * pow(2, 7)\n + \n \n p8.generated_number * pow(2, 8)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n cross join \n \n p as p8\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 399\n order by generated_number\n\n\n\n),\n\nall_periods as (\n\n select (\n \n\n datetime_add(\n cast( '2020-02-13' as datetime),\n interval row_number() over (order by 1) - 1 day\n )\n\n\n ) as date_day\n from rawdata\n\n),\n\nfiltered as (\n\n select *\n from all_periods\n where date_day <= \n\n datetime_add(\n cast( current_date as datetime),\n interval 1 week\n )\n\n\n\n)\n\nselect * from filtered\n\n\n\n), recast as (\n\n select cast(date_day as date) as date_day\n from spine\n\n)\n\nselect *\nfrom recast", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null}, "model.zendesk.int_zendesk__ticket_resolution_times_calendar": {"raw_sql": "with historical_solved_status as (\n\n select *\n from {{ ref('int_zendesk__ticket_historical_status') }}\n where status = 'solved'\n\n), ticket as (\n\n select *\n from {{ ref('stg_zendesk__ticket') }}\n\n), ticket_historical_assignee as (\n\n select *\n from {{ ref('int_zendesk__ticket_historical_assignee') }}\n\n), ticket_historical_group as (\n\n select *\n from {{ ref('int_zendesk__ticket_historical_group') }}\n\n), solved_times as (\n \n select\n \n ticket_id,\n min(valid_starting_at) as first_solved_at,\n max(valid_starting_at) as last_solved_at,\n count(status) as solved_count \n\n from historical_solved_status\n group by 1\n\n)\n\n select\n\n ticket.ticket_id,\n ticket.created_at,\n solved_times.first_solved_at,\n solved_times.last_solved_at,\n ticket_historical_assignee.unique_assignee_count,\n ticket_historical_assignee.assignee_stations_count,\n ticket_historical_group.group_stations_count,\n ticket_historical_assignee.first_assignee_id,\n ticket_historical_assignee.last_assignee_id,\n ticket_historical_assignee.first_agent_assignment_date,\n ticket_historical_assignee.last_agent_assignment_date,\n ticket_historical_assignee.ticket_unassigned_duration_calendar_minutes,\n solved_times.solved_count as total_resolutions,\n case when solved_times.solved_count <= 1\n then 0\n else solved_times.solved_count - 1 --subtracting one as the first solve is not a reopen.\n end as count_reopens,\n\n {{ fivetran_utils.timestamp_diff(\n 'ticket_historical_assignee.first_agent_assignment_date', \n 'solved_times.first_solved_at',\n 'minute' ) }} as first_assignment_to_resolution_calendar_minutes,\n {{ fivetran_utils.timestamp_diff(\n 'ticket_historical_assignee.last_agent_assignment_date', \n 'solved_times.first_solved_at',\n 'minute' ) }} as last_assignment_to_resolution_calendar_minutes,\n {{ fivetran_utils.timestamp_diff(\n 'ticket.created_at', \n 'solved_times.first_solved_at',\n 'minute' ) }} as first_resolution_calendar_minutes,\n {{ fivetran_utils.timestamp_diff(\n 'ticket.created_at', \n 'solved_times.last_solved_at',\n 'minute') }} as final_resolution_calendar_minutes\n\n from ticket\n\n left join ticket_historical_assignee\n using(ticket_id)\n\n left join ticket_historical_group\n using(ticket_id)\n\n left join solved_times\n using(ticket_id)", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk", "resolution_times", "int_zendesk__ticket_resolution_times_calendar"], "unique_id": "model.zendesk.int_zendesk__ticket_resolution_times_calendar", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "resolution_times/int_zendesk__ticket_resolution_times_calendar.sql", "original_file_path": "models/resolution_times/int_zendesk__ticket_resolution_times_calendar.sql", "name": "int_zendesk__ticket_resolution_times_calendar", "resource_type": "model", "alias": "int_zendesk__ticket_resolution_times_calendar", "checksum": {"name": "sha256", "checksum": "61390b1d96c1db1742bb77b425cce5d15bd89b87b881f725c810fc3136599311"}, "config": {"enabled": true, "materialized": "ephemeral", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["int_zendesk__ticket_historical_status"], ["stg_zendesk__ticket"], ["int_zendesk__ticket_historical_assignee"], ["int_zendesk__ticket_historical_group"]], "sources": [], "depends_on": {"macros": ["macro.fivetran_utils.timestamp_diff"], "nodes": ["model.zendesk.int_zendesk__ticket_historical_status", "model.zendesk_source.stg_zendesk__ticket", "model.zendesk.int_zendesk__ticket_historical_assignee", "model.zendesk.int_zendesk__ticket_historical_group"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/resolution_times/int_zendesk__ticket_resolution_times_calendar.sql", "deferred": false, "unrendered_config": {"materialized": "ephemeral"}, "compiled_sql": "with historical_solved_status as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_historical_status`\n where status = 'solved'\n\n), ticket as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket`\n\n), ticket_historical_assignee as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_historical_assignee`\n\n), ticket_historical_group as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_historical_group`\n\n), solved_times as (\n \n select\n \n ticket_id,\n min(valid_starting_at) as first_solved_at,\n max(valid_starting_at) as last_solved_at,\n count(status) as solved_count \n\n from historical_solved_status\n group by 1\n\n)\n\n select\n\n ticket.ticket_id,\n ticket.created_at,\n solved_times.first_solved_at,\n solved_times.last_solved_at,\n ticket_historical_assignee.unique_assignee_count,\n ticket_historical_assignee.assignee_stations_count,\n ticket_historical_group.group_stations_count,\n ticket_historical_assignee.first_assignee_id,\n ticket_historical_assignee.last_assignee_id,\n ticket_historical_assignee.first_agent_assignment_date,\n ticket_historical_assignee.last_agent_assignment_date,\n ticket_historical_assignee.ticket_unassigned_duration_calendar_minutes,\n solved_times.solved_count as total_resolutions,\n case when solved_times.solved_count <= 1\n then 0\n else solved_times.solved_count - 1 --subtracting one as the first solve is not a reopen.\n end as count_reopens,\n\n \n \n\n datetime_diff(\n cast(solved_times.first_solved_at as datetime),\n cast(ticket_historical_assignee.first_agent_assignment_date as datetime),\n minute\n )\n\n\n as first_assignment_to_resolution_calendar_minutes,\n \n \n\n datetime_diff(\n cast(solved_times.first_solved_at as datetime),\n cast(ticket_historical_assignee.last_agent_assignment_date as datetime),\n minute\n )\n\n\n as last_assignment_to_resolution_calendar_minutes,\n \n \n\n datetime_diff(\n cast(solved_times.first_solved_at as datetime),\n cast(ticket.created_at as datetime),\n minute\n )\n\n\n as first_resolution_calendar_minutes,\n \n \n\n datetime_diff(\n cast(solved_times.last_solved_at as datetime),\n cast(ticket.created_at as datetime),\n minute\n )\n\n\n as final_resolution_calendar_minutes\n\n from ticket\n\n left join ticket_historical_assignee\n using(ticket_id)\n\n left join ticket_historical_group\n using(ticket_id)\n\n left join solved_times\n using(ticket_id)", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null}, "model.zendesk.int_zendesk__ticket_first_resolution_time_business": {"raw_sql": "{{ config(enabled=var('using_schedules', True)) }}\n\nwith ticket_resolution_times_calendar as (\n\n select *\n from {{ ref('int_zendesk__ticket_resolution_times_calendar') }}\n\n), ticket_schedules as (\n\n select *\n from {{ ref('int_zendesk__ticket_schedules') }}\n\n), schedule as (\n\n select *\n from {{ ref('stg_zendesk__schedule') }}\n\n), ticket_first_resolution_time as (\n\n select \n ticket_resolution_times_calendar.ticket_id,\n ticket_schedules.schedule_created_at,\n ticket_schedules.schedule_invalidated_at,\n ticket_schedules.schedule_id,\n round({{ fivetran_utils.timestamp_diff(\n \"\" ~ dbt_utils.date_trunc('week', 'ticket_schedules.schedule_created_at') ~ \"\", \n 'ticket_schedules.schedule_created_at',\n 'second') }} /60,\n 0) as start_time_in_minutes_from_week,\n greatest(0,\n round(\n {{ fivetran_utils.timestamp_diff(\n 'ticket_schedules.schedule_created_at',\n 'least(ticket_schedules.schedule_invalidated_at, min(ticket_resolution_times_calendar.first_solved_at))',\n 'second') }}/60\n , 0)) as raw_delta_in_minutes\n \n from ticket_resolution_times_calendar\n join ticket_schedules on ticket_resolution_times_calendar.ticket_id = ticket_schedules.ticket_id\n group by 1, 2, 3, 4\n\n), weeks as (\n\n {{ dbt_utils.generate_series(208) }}\n\n), weeks_cross_ticket_first_resolution_time as (\n\n select \n\n ticket_first_resolution_time.*,\n generated_number - 1 as week_number\n\n from ticket_first_resolution_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number - 1\n\n\n), weekly_periods as (\n \n select \n\n weeks_cross_ticket_first_resolution_time.*,\n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n \n from weeks_cross_ticket_first_resolution_time\n\n), intercepted_periods as (\n\n select ticket_id,\n week_number,\n weekly_periods.schedule_id,\n ticket_week_start_time,\n ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n\n)\n\n select \n ticket_id,\n sum(scheduled_minutes) as first_resolution_business_minutes\n from intercepted_periods\n group by 1", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk", "resolution_times", "int_zendesk__ticket_first_resolution_time_business"], "unique_id": "model.zendesk.int_zendesk__ticket_first_resolution_time_business", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "resolution_times/int_zendesk__ticket_first_resolution_time_business.sql", "original_file_path": "models/resolution_times/int_zendesk__ticket_first_resolution_time_business.sql", "name": "int_zendesk__ticket_first_resolution_time_business", "resource_type": "model", "alias": "int_zendesk__ticket_first_resolution_time_business", "checksum": {"name": "sha256", "checksum": "ed7fed8c87f22cc3858cff0c48970febef5cbdacca7e2b7b58f7e62d444fe92e"}, "config": {"enabled": true, "materialized": "ephemeral", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["int_zendesk__ticket_resolution_times_calendar"], ["int_zendesk__ticket_schedules"], ["stg_zendesk__schedule"]], "sources": [], "depends_on": {"macros": ["macro.dbt_utils.date_trunc", "macro.fivetran_utils.timestamp_diff", "macro.dbt_utils.generate_series"], "nodes": ["model.zendesk.int_zendesk__ticket_resolution_times_calendar", "model.zendesk.int_zendesk__ticket_schedules", "model.zendesk_source.stg_zendesk__schedule"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/resolution_times/int_zendesk__ticket_first_resolution_time_business.sql", "deferred": false, "unrendered_config": {"materialized": "ephemeral", "enabled": true}, "compiled_sql": "\n\nwith ticket_resolution_times_calendar as (\n\n select *\n from __dbt__CTE__int_zendesk__ticket_resolution_times_calendar\n\n), ticket_schedules as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_schedules`\n\n), schedule as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__schedule`\n\n), ticket_first_resolution_time as (\n\n select \n ticket_resolution_times_calendar.ticket_id,\n ticket_schedules.schedule_created_at,\n ticket_schedules.schedule_invalidated_at,\n ticket_schedules.schedule_id,\n round(\n \n\n datetime_diff(\n cast(ticket_schedules.schedule_created_at as datetime),\n cast(\n timestamp_trunc(\n cast(ticket_schedules.schedule_created_at as timestamp),\n week\n )\n\n as datetime),\n second\n )\n\n\n /60,\n 0) as start_time_in_minutes_from_week,\n greatest(0,\n round(\n \n \n\n datetime_diff(\n cast(least(ticket_schedules.schedule_invalidated_at, min(ticket_resolution_times_calendar.first_solved_at)) as datetime),\n cast(ticket_schedules.schedule_created_at as datetime),\n second\n )\n\n\n/60\n , 0)) as raw_delta_in_minutes\n \n from ticket_resolution_times_calendar\n join ticket_schedules on ticket_resolution_times_calendar.ticket_id = ticket_schedules.ticket_id\n group by 1, 2, 3, 4\n\n), weeks as (\n\n \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * pow(2, 0)\n + \n \n p1.generated_number * pow(2, 1)\n + \n \n p2.generated_number * pow(2, 2)\n + \n \n p3.generated_number * pow(2, 3)\n + \n \n p4.generated_number * pow(2, 4)\n + \n \n p5.generated_number * pow(2, 5)\n + \n \n p6.generated_number * pow(2, 6)\n + \n \n p7.generated_number * pow(2, 7)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 208\n order by generated_number\n\n\n\n), weeks_cross_ticket_first_resolution_time as (\n\n select \n\n ticket_first_resolution_time.*,\n generated_number - 1 as week_number\n\n from ticket_first_resolution_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number - 1\n\n\n), weekly_periods as (\n \n select \n\n weeks_cross_ticket_first_resolution_time.*,\n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n \n from weeks_cross_ticket_first_resolution_time\n\n), intercepted_periods as (\n\n select ticket_id,\n week_number,\n weekly_periods.schedule_id,\n ticket_week_start_time,\n ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n\n)\n\n select \n ticket_id,\n sum(scheduled_minutes) as first_resolution_business_minutes\n from intercepted_periods\n group by 1", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.zendesk.int_zendesk__ticket_resolution_times_calendar", "sql": " __dbt__CTE__int_zendesk__ticket_resolution_times_calendar as (\nwith historical_solved_status as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_historical_status`\n where status = 'solved'\n\n), ticket as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket`\n\n), ticket_historical_assignee as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_historical_assignee`\n\n), ticket_historical_group as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_historical_group`\n\n), solved_times as (\n \n select\n \n ticket_id,\n min(valid_starting_at) as first_solved_at,\n max(valid_starting_at) as last_solved_at,\n count(status) as solved_count \n\n from historical_solved_status\n group by 1\n\n)\n\n select\n\n ticket.ticket_id,\n ticket.created_at,\n solved_times.first_solved_at,\n solved_times.last_solved_at,\n ticket_historical_assignee.unique_assignee_count,\n ticket_historical_assignee.assignee_stations_count,\n ticket_historical_group.group_stations_count,\n ticket_historical_assignee.first_assignee_id,\n ticket_historical_assignee.last_assignee_id,\n ticket_historical_assignee.first_agent_assignment_date,\n ticket_historical_assignee.last_agent_assignment_date,\n ticket_historical_assignee.ticket_unassigned_duration_calendar_minutes,\n solved_times.solved_count as total_resolutions,\n case when solved_times.solved_count <= 1\n then 0\n else solved_times.solved_count - 1 --subtracting one as the first solve is not a reopen.\n end as count_reopens,\n\n \n \n\n datetime_diff(\n cast(solved_times.first_solved_at as datetime),\n cast(ticket_historical_assignee.first_agent_assignment_date as datetime),\n minute\n )\n\n\n as first_assignment_to_resolution_calendar_minutes,\n \n \n\n datetime_diff(\n cast(solved_times.first_solved_at as datetime),\n cast(ticket_historical_assignee.last_agent_assignment_date as datetime),\n minute\n )\n\n\n as last_assignment_to_resolution_calendar_minutes,\n \n \n\n datetime_diff(\n cast(solved_times.first_solved_at as datetime),\n cast(ticket.created_at as datetime),\n minute\n )\n\n\n as first_resolution_calendar_minutes,\n \n \n\n datetime_diff(\n cast(solved_times.last_solved_at as datetime),\n cast(ticket.created_at as datetime),\n minute\n )\n\n\n as final_resolution_calendar_minutes\n\n from ticket\n\n left join ticket_historical_assignee\n using(ticket_id)\n\n left join ticket_historical_group\n using(ticket_id)\n\n left join solved_times\n using(ticket_id)\n)"}], "relation_name": null}, "model.zendesk.int_zendesk__ticket_full_resolution_time_business": {"raw_sql": "{{ config(enabled=var('using_schedules', True)) }}\n\nwith ticket_resolution_times_calendar as (\n\n select *\n from {{ ref('int_zendesk__ticket_resolution_times_calendar') }}\n\n), ticket_schedules as (\n\n select *\n from {{ ref('int_zendesk__ticket_schedules') }}\n\n), schedule as (\n\n select *\n from {{ ref('stg_zendesk__schedule') }}\n\n), ticket_full_resolution_time as (\n\n select \n ticket_resolution_times_calendar.ticket_id,\n ticket_schedules.schedule_created_at,\n ticket_schedules.schedule_invalidated_at,\n ticket_schedules.schedule_id,\n round({{ fivetran_utils.timestamp_diff(\n \"\" ~ dbt_utils.date_trunc('week', 'ticket_schedules.schedule_created_at') ~ \"\", \n 'ticket_schedules.schedule_created_at',\n 'second') }} /60,\n 0) as start_time_in_minutes_from_week,\n greatest(0,\n round(\n {{ fivetran_utils.timestamp_diff(\n 'ticket_schedules.schedule_created_at',\n 'least(ticket_schedules.schedule_invalidated_at, min(ticket_resolution_times_calendar.last_solved_at))',\n 'second') }}/60\n , 0)) as raw_delta_in_minutes\n \n from ticket_resolution_times_calendar\n join ticket_schedules on ticket_resolution_times_calendar.ticket_id = ticket_schedules.ticket_id\n group by 1, 2, 3, 4\n\n), weeks as (\n\n {{ dbt_utils.generate_series(208) }}\n\n), weeks_cross_ticket_full_resolution_time as (\n\n select \n\n ticket_full_resolution_time.*,\n generated_number - 1 as week_number\n\n from ticket_full_resolution_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number - 1\n\n), weekly_periods as (\n \n select \n\n weeks_cross_ticket_full_resolution_time.*,\n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n \n from weeks_cross_ticket_full_resolution_time\n\n), intercepted_periods as (\n\n select \n ticket_id,\n week_number,\n weekly_periods.schedule_id,\n ticket_week_start_time,\n ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n\n)\n\n select \n ticket_id,\n sum(scheduled_minutes) as full_resolution_business_minutes\n from intercepted_periods\n group by 1", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk", "resolution_times", "int_zendesk__ticket_full_resolution_time_business"], "unique_id": "model.zendesk.int_zendesk__ticket_full_resolution_time_business", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "resolution_times/int_zendesk__ticket_full_resolution_time_business.sql", "original_file_path": "models/resolution_times/int_zendesk__ticket_full_resolution_time_business.sql", "name": "int_zendesk__ticket_full_resolution_time_business", "resource_type": "model", "alias": "int_zendesk__ticket_full_resolution_time_business", "checksum": {"name": "sha256", "checksum": "6235dc703e2c43461a0d1850d50a03e72a20a5f0535926c9378621962ccc05b3"}, "config": {"enabled": true, "materialized": "ephemeral", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["int_zendesk__ticket_resolution_times_calendar"], ["int_zendesk__ticket_schedules"], ["stg_zendesk__schedule"]], "sources": [], "depends_on": {"macros": ["macro.dbt_utils.date_trunc", "macro.fivetran_utils.timestamp_diff", "macro.dbt_utils.generate_series"], "nodes": ["model.zendesk.int_zendesk__ticket_resolution_times_calendar", "model.zendesk.int_zendesk__ticket_schedules", "model.zendesk_source.stg_zendesk__schedule"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/resolution_times/int_zendesk__ticket_full_resolution_time_business.sql", "deferred": false, "unrendered_config": {"materialized": "ephemeral", "enabled": true}, "compiled_sql": "\n\nwith ticket_resolution_times_calendar as (\n\n select *\n from __dbt__CTE__int_zendesk__ticket_resolution_times_calendar\n\n), ticket_schedules as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_schedules`\n\n), schedule as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__schedule`\n\n), ticket_full_resolution_time as (\n\n select \n ticket_resolution_times_calendar.ticket_id,\n ticket_schedules.schedule_created_at,\n ticket_schedules.schedule_invalidated_at,\n ticket_schedules.schedule_id,\n round(\n \n\n datetime_diff(\n cast(ticket_schedules.schedule_created_at as datetime),\n cast(\n timestamp_trunc(\n cast(ticket_schedules.schedule_created_at as timestamp),\n week\n )\n\n as datetime),\n second\n )\n\n\n /60,\n 0) as start_time_in_minutes_from_week,\n greatest(0,\n round(\n \n \n\n datetime_diff(\n cast(least(ticket_schedules.schedule_invalidated_at, min(ticket_resolution_times_calendar.last_solved_at)) as datetime),\n cast(ticket_schedules.schedule_created_at as datetime),\n second\n )\n\n\n/60\n , 0)) as raw_delta_in_minutes\n \n from ticket_resolution_times_calendar\n join ticket_schedules on ticket_resolution_times_calendar.ticket_id = ticket_schedules.ticket_id\n group by 1, 2, 3, 4\n\n), weeks as (\n\n \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * pow(2, 0)\n + \n \n p1.generated_number * pow(2, 1)\n + \n \n p2.generated_number * pow(2, 2)\n + \n \n p3.generated_number * pow(2, 3)\n + \n \n p4.generated_number * pow(2, 4)\n + \n \n p5.generated_number * pow(2, 5)\n + \n \n p6.generated_number * pow(2, 6)\n + \n \n p7.generated_number * pow(2, 7)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 208\n order by generated_number\n\n\n\n), weeks_cross_ticket_full_resolution_time as (\n\n select \n\n ticket_full_resolution_time.*,\n generated_number - 1 as week_number\n\n from ticket_full_resolution_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number - 1\n\n), weekly_periods as (\n \n select \n\n weeks_cross_ticket_full_resolution_time.*,\n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n \n from weeks_cross_ticket_full_resolution_time\n\n), intercepted_periods as (\n\n select \n ticket_id,\n week_number,\n weekly_periods.schedule_id,\n ticket_week_start_time,\n ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n\n)\n\n select \n ticket_id,\n sum(scheduled_minutes) as full_resolution_business_minutes\n from intercepted_periods\n group by 1", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.zendesk.int_zendesk__ticket_resolution_times_calendar", "sql": " __dbt__CTE__int_zendesk__ticket_resolution_times_calendar as (\nwith historical_solved_status as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_historical_status`\n where status = 'solved'\n\n), ticket as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket`\n\n), ticket_historical_assignee as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_historical_assignee`\n\n), ticket_historical_group as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_historical_group`\n\n), solved_times as (\n \n select\n \n ticket_id,\n min(valid_starting_at) as first_solved_at,\n max(valid_starting_at) as last_solved_at,\n count(status) as solved_count \n\n from historical_solved_status\n group by 1\n\n)\n\n select\n\n ticket.ticket_id,\n ticket.created_at,\n solved_times.first_solved_at,\n solved_times.last_solved_at,\n ticket_historical_assignee.unique_assignee_count,\n ticket_historical_assignee.assignee_stations_count,\n ticket_historical_group.group_stations_count,\n ticket_historical_assignee.first_assignee_id,\n ticket_historical_assignee.last_assignee_id,\n ticket_historical_assignee.first_agent_assignment_date,\n ticket_historical_assignee.last_agent_assignment_date,\n ticket_historical_assignee.ticket_unassigned_duration_calendar_minutes,\n solved_times.solved_count as total_resolutions,\n case when solved_times.solved_count <= 1\n then 0\n else solved_times.solved_count - 1 --subtracting one as the first solve is not a reopen.\n end as count_reopens,\n\n \n \n\n datetime_diff(\n cast(solved_times.first_solved_at as datetime),\n cast(ticket_historical_assignee.first_agent_assignment_date as datetime),\n minute\n )\n\n\n as first_assignment_to_resolution_calendar_minutes,\n \n \n\n datetime_diff(\n cast(solved_times.first_solved_at as datetime),\n cast(ticket_historical_assignee.last_agent_assignment_date as datetime),\n minute\n )\n\n\n as last_assignment_to_resolution_calendar_minutes,\n \n \n\n datetime_diff(\n cast(solved_times.first_solved_at as datetime),\n cast(ticket.created_at as datetime),\n minute\n )\n\n\n as first_resolution_calendar_minutes,\n \n \n\n datetime_diff(\n cast(solved_times.last_solved_at as datetime),\n cast(ticket.created_at as datetime),\n minute\n )\n\n\n as final_resolution_calendar_minutes\n\n from ticket\n\n left join ticket_historical_assignee\n using(ticket_id)\n\n left join ticket_historical_group\n using(ticket_id)\n\n left join solved_times\n using(ticket_id)\n)"}], "relation_name": null}, "model.zendesk.int_zendesk__updates": {"raw_sql": "with ticket_history as (\n select *\n from {{ ref('stg_zendesk__ticket_field_history') }}\n\n), ticket_comment as (\n select *\n from {{ ref('stg_zendesk__ticket_comment') }}\n\n), updates_union as (\n select \n ticket_id,\n field_name,\n value,\n null as is_public,\n user_id,\n valid_starting_at,\n valid_ending_at\n from ticket_history\n\n union all\n\n select\n ticket_id,\n cast('comment' as {{ dbt_utils.type_string() }}) as field_name,\n body as value,\n is_public,\n user_id,\n created_at as valid_starting_at,\n lead(created_at) over (partition by ticket_id order by created_at) as valid_ending_at\n from ticket_comment\n)\n\nselect *\nfrom updates_union", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "fqn": ["zendesk", "intermediate", "int_zendesk__updates"], "unique_id": "model.zendesk.int_zendesk__updates", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "intermediate/int_zendesk__updates.sql", "original_file_path": "models/intermediate/int_zendesk__updates.sql", "name": "int_zendesk__updates", "resource_type": "model", "alias": "int_zendesk__updates", "checksum": {"name": "sha256", "checksum": "0870ff17c46c2dbaaed99f845a7861e4d78bd60d25cefe439032711c4af17396"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["stg_zendesk__ticket_field_history"], ["stg_zendesk__ticket_comment"]], "sources": [], "depends_on": {"macros": ["macro.dbt_utils.type_string"], "nodes": ["model.zendesk_source.stg_zendesk__ticket_field_history", "model.zendesk_source.stg_zendesk__ticket_comment"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/intermediate/int_zendesk__updates.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_intermediate"}, "compiled_sql": "with ticket_history as (\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket_field_history`\n\n), ticket_comment as (\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket_comment`\n\n), updates_union as (\n select \n ticket_id,\n field_name,\n value,\n null as is_public,\n user_id,\n valid_starting_at,\n valid_ending_at\n from ticket_history\n\n union all\n\n select\n ticket_id,\n cast('comment' as \n string\n) as field_name,\n body as value,\n is_public,\n user_id,\n created_at as valid_starting_at,\n lead(created_at) over (partition by ticket_id order by created_at) as valid_ending_at\n from ticket_comment\n)\n\nselect *\nfrom updates_union", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__updates`"}, "model.zendesk.int_zendesk__ticket_historical_assignee": {"raw_sql": "with assignee_updates as (\n\n select *\n from {{ ref('int_zendesk__updates') }}\n where field_name = 'assignee_id'\n\n), calculate_metrics as (\n select\n ticket_id,\n field_name as assignee_id,\n value,\n valid_starting_at,\n lag(valid_starting_at) over (partition by ticket_id order by valid_starting_at) as previous_update,\n lag(value) over (partition by ticket_id order by valid_starting_at) as previous_assignee,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at, ticket_id rows unbounded preceding) as first_agent_assignment_date,\n first_value(value) over (partition by ticket_id order by valid_starting_at, ticket_id rows unbounded preceding) as first_assignee_id,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_agent_assignment_date,\n first_value(value) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_assignee_id,\n count(value) over (partition by ticket_id) as assignee_stations_count\n from assignee_updates\n\n), unassigned_time as (\n select\n ticket_id,\n sum(case when assignee_id is not null and previous_assignee is null \n then round(({{ dbt_utils.datediff(\"previous_update\", \"valid_starting_at\", 'second') }} /60),2)\n else 0\n end) as ticket_unassigned_duration_calendar_minutes,\n count(distinct value) as unique_assignee_count\n from calculate_metrics\n\n group by 1\n\n), window_group as (\n select\n calculate_metrics.ticket_id,\n calculate_metrics.first_agent_assignment_date,\n calculate_metrics.first_assignee_id,\n calculate_metrics.last_agent_assignment_date,\n calculate_metrics.last_assignee_id,\n calculate_metrics.assignee_stations_count\n from calculate_metrics\n\n group by 1, 2, 3, 4, 5, 6\n\n), final as (\n select\n window_group.*,\n unassigned_time.unique_assignee_count,\n unassigned_time.ticket_unassigned_duration_calendar_minutes\n from window_group\n\n left join unassigned_time\n using(ticket_id)\n)\n\nselect *\nfrom final", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "fqn": ["zendesk", "intermediate", "int_zendesk__ticket_historical_assignee"], "unique_id": "model.zendesk.int_zendesk__ticket_historical_assignee", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "intermediate/int_zendesk__ticket_historical_assignee.sql", "original_file_path": "models/intermediate/int_zendesk__ticket_historical_assignee.sql", "name": "int_zendesk__ticket_historical_assignee", "resource_type": "model", "alias": "int_zendesk__ticket_historical_assignee", "checksum": {"name": "sha256", "checksum": "5a8466ba2007c97187785a0e716c78272d1669ffab809d67ef9e063f9f2e0ddb"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["int_zendesk__updates"]], "sources": [], "depends_on": {"macros": ["macro.dbt_utils.datediff"], "nodes": ["model.zendesk.int_zendesk__updates"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/intermediate/int_zendesk__ticket_historical_assignee.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_intermediate"}, "compiled_sql": "with assignee_updates as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__updates`\n where field_name = 'assignee_id'\n\n), calculate_metrics as (\n select\n ticket_id,\n field_name as assignee_id,\n value,\n valid_starting_at,\n lag(valid_starting_at) over (partition by ticket_id order by valid_starting_at) as previous_update,\n lag(value) over (partition by ticket_id order by valid_starting_at) as previous_assignee,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at, ticket_id rows unbounded preceding) as first_agent_assignment_date,\n first_value(value) over (partition by ticket_id order by valid_starting_at, ticket_id rows unbounded preceding) as first_assignee_id,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_agent_assignment_date,\n first_value(value) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_assignee_id,\n count(value) over (partition by ticket_id) as assignee_stations_count\n from assignee_updates\n\n), unassigned_time as (\n select\n ticket_id,\n sum(case when assignee_id is not null and previous_assignee is null \n then round((\n\n datetime_diff(\n cast(valid_starting_at as datetime),\n cast(previous_update as datetime),\n second\n )\n\n /60),2)\n else 0\n end) as ticket_unassigned_duration_calendar_minutes,\n count(distinct value) as unique_assignee_count\n from calculate_metrics\n\n group by 1\n\n), window_group as (\n select\n calculate_metrics.ticket_id,\n calculate_metrics.first_agent_assignment_date,\n calculate_metrics.first_assignee_id,\n calculate_metrics.last_agent_assignment_date,\n calculate_metrics.last_assignee_id,\n calculate_metrics.assignee_stations_count\n from calculate_metrics\n\n group by 1, 2, 3, 4, 5, 6\n\n), final as (\n select\n window_group.*,\n unassigned_time.unique_assignee_count,\n unassigned_time.ticket_unassigned_duration_calendar_minutes\n from window_group\n\n left join unassigned_time\n using(ticket_id)\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_historical_assignee`"}, "model.zendesk.int_zendesk__ticket_historical_status": {"raw_sql": "-- To do -- can we delete ticket_status_counter and unique_status_counter?\n\nwith ticket_status_history as (\n\n select *\n from {{ ref('int_zendesk__updates') }}\n where field_name = 'status'\n\n)\n\n select\n \n ticket_id,\n valid_starting_at,\n valid_ending_at,\n {{ fivetran_utils.timestamp_diff(\n 'valid_starting_at',\n \"coalesce(valid_ending_at, \" ~ dbt_utils.current_timestamp() ~ \")\",\n 'minute') }} as status_duration_calendar_minutes,\n value as status,\n -- MIGHT BE ABLE TO DELETE ROWS BELOW\n row_number() over (partition by ticket_id order by valid_starting_at) as ticket_status_counter,\n row_number() over (partition by ticket_id, value order by valid_starting_at) as unique_status_counter\n\n from ticket_status_history", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "fqn": ["zendesk", "intermediate", "int_zendesk__ticket_historical_status"], "unique_id": "model.zendesk.int_zendesk__ticket_historical_status", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "intermediate/int_zendesk__ticket_historical_status.sql", "original_file_path": "models/intermediate/int_zendesk__ticket_historical_status.sql", "name": "int_zendesk__ticket_historical_status", "resource_type": "model", "alias": "int_zendesk__ticket_historical_status", "checksum": {"name": "sha256", "checksum": "bcf2649d98ed04b05faa03779cab67203f4fa62c95cf78759e75d2f6183320be"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["int_zendesk__updates"]], "sources": [], "depends_on": {"macros": ["macro.dbt_utils.current_timestamp", "macro.fivetran_utils.timestamp_diff"], "nodes": ["model.zendesk.int_zendesk__updates"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/intermediate/int_zendesk__ticket_historical_status.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_intermediate"}, "compiled_sql": "-- To do -- can we delete ticket_status_counter and unique_status_counter?\n\nwith ticket_status_history as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__updates`\n where field_name = 'status'\n\n)\n\n select\n \n ticket_id,\n valid_starting_at,\n valid_ending_at,\n \n \n\n datetime_diff(\n cast(coalesce(valid_ending_at, \n current_timestamp\n) as datetime),\n cast(valid_starting_at as datetime),\n minute\n )\n\n\n as status_duration_calendar_minutes,\n value as status,\n -- MIGHT BE ABLE TO DELETE ROWS BELOW\n row_number() over (partition by ticket_id order by valid_starting_at) as ticket_status_counter,\n row_number() over (partition by ticket_id, value order by valid_starting_at) as unique_status_counter\n\n from ticket_status_history", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_historical_status`"}, "model.zendesk.int_zendesk__user_aggregates": {"raw_sql": "with users as (\n select *\n from {{ ref('stg_zendesk__user') }}\n\n--If you use user tags this will be included, if not it will be ignored.\n{% if var('using_user_tags', True) %}\n), user_tags as (\n\n select *\n from {{ ref('stg_zendesk__user_tag') }}\n \n), user_tag_aggregate as (\n select\n user_tags.user_id,\n {{ fivetran_utils.string_agg( 'user_tags.tags', \"', '\" )}} as user_tags\n from user_tags\n group by 1\n\n{% endif %}\n\n), final as (\n select \n users.*\n\n --If you use user tags this will be included, if not it will be ignored.\n {% if var('using_user_tags', True) %}\n ,user_tag_aggregate.user_tags\n {% endif %}\n from users\n\n --If you use user tags this will be included, if not it will be ignored.\n {% if var('using_user_tags', True) %}\n left join user_tag_aggregate\n using(user_id)\n {% endif %}\n)\n\nselect *\nfrom final", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "fqn": ["zendesk", "intermediate", "int_zendesk__user_aggregates"], "unique_id": "model.zendesk.int_zendesk__user_aggregates", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "intermediate/int_zendesk__user_aggregates.sql", "original_file_path": "models/intermediate/int_zendesk__user_aggregates.sql", "name": "int_zendesk__user_aggregates", "resource_type": "model", "alias": "int_zendesk__user_aggregates", "checksum": {"name": "sha256", "checksum": "ae23565fdc62d13c33ddb03f3b25a5e288ec6e6ffe6b57cb01496be6ecd2b73f"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["stg_zendesk__user"], ["stg_zendesk__user_tag"]], "sources": [], "depends_on": {"macros": ["macro.fivetran_utils.string_agg"], "nodes": ["model.zendesk_source.stg_zendesk__user", "model.zendesk_source.stg_zendesk__user_tag"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/intermediate/int_zendesk__user_aggregates.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_intermediate"}, "compiled_sql": "with users as (\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__user`\n\n--If you use user tags this will be included, if not it will be ignored.\n\n), user_tags as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__user_tag`\n \n), user_tag_aggregate as (\n select\n user_tags.user_id,\n \n string_agg(user_tags.tags, ', ')\n\n as user_tags\n from user_tags\n group by 1\n\n\n\n), final as (\n select \n users.*\n\n --If you use user tags this will be included, if not it will be ignored.\n \n ,user_tag_aggregate.user_tags\n \n from users\n\n --If you use user tags this will be included, if not it will be ignored.\n \n left join user_tag_aggregate\n using(user_id)\n \n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__user_aggregates`"}, "model.zendesk.int_zendesk__ticket_schedules": {"raw_sql": "{{ config(enabled=var('using_schedules', True)) }}\n\nwith ticket as (\n \n select *\n from {{ ref('stg_zendesk__ticket') }}\n\n), ticket_schedule as (\n \n select *\n from {{ ref('stg_zendesk__ticket_schedule') }}\n\n), schedule as (\n \n select *\n from {{ ref('stg_zendesk__schedule') }}\n\n\n), default_schedule_events as (\n-- Goal: understand the working schedules applied to tickets, so that we can then determine the applicable business hours/schedule.\n-- Your default schedule is used for all tickets, unless you set up a trigger to apply a specific schedule to specific tickets.\n\n-- This portion of the query creates ticket_schedules for these \"default\" schedules, as the ticket_schedule table only includes\n-- trigger schedules\n\n{% if execute %}\n\n {% set default_schedule_id_query %}\n with set_default_schedule_flag as (\n select \n row_number() over (order by created_at) = 1 as is_default_schedule,\n schedule_id\n from {{ ref('stg_zendesk__schedule') }}\n )\n select \n schedule_id\n from set_default_schedule_flag\n where is_default_schedule\n\n {% endset %}\n\n {% set default_schedule_id = run_query(default_schedule_id_query).columns[0][0]|string %}\n\n {% endif %}\n\n select\n ticket.ticket_id,\n ticket.created_at as schedule_created_at,\n '{{default_schedule_id}}' as schedule_id\n from ticket\n left join ticket_schedule as first_schedule\n on first_schedule.ticket_id = ticket.ticket_id\n and {{ fivetran_utils.timestamp_add('second', -5, 'first_schedule.created_at') }} <= ticket.created_at\n and first_schedule.created_at >= ticket.created_at \n where first_schedule.ticket_id is null\n\n), schedule_events as (\n \n select\n *\n from default_schedule_events\n \n union all\n \n select \n ticket_id,\n created_at as schedule_created_at,\n schedule_id\n from ticket_schedule\n\n), ticket_schedules as (\n \n select \n ticket_id,\n schedule_id,\n schedule_created_at,\n coalesce(lead(schedule_created_at) over (partition by ticket_id order by schedule_created_at)\n , {{ fivetran_utils.timestamp_add(\"hour\", 1000, \"\" ~ dbt_utils.current_timestamp() ~ \"\") }} ) as schedule_invalidated_at\n from schedule_events\n\n)\n\nselect *\nfrom ticket_schedules", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "fqn": ["zendesk", "intermediate", "int_zendesk__ticket_schedules"], "unique_id": "model.zendesk.int_zendesk__ticket_schedules", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "intermediate/int_zendesk__ticket_schedules.sql", "original_file_path": "models/intermediate/int_zendesk__ticket_schedules.sql", "name": "int_zendesk__ticket_schedules", "resource_type": "model", "alias": "int_zendesk__ticket_schedules", "checksum": {"name": "sha256", "checksum": "8f3c648f3f5ba8de9387499ad4f9ddb2382fcec13b93e05255b18d2f81f83e94"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["stg_zendesk__ticket"], ["stg_zendesk__ticket_schedule"], ["stg_zendesk__schedule"]], "sources": [], "depends_on": {"macros": ["macro.fivetran_utils.timestamp_add", "macro.dbt_utils.current_timestamp", "macro.dbt.run_query"], "nodes": ["model.zendesk_source.stg_zendesk__ticket", "model.zendesk_source.stg_zendesk__ticket_schedule", "model.zendesk_source.stg_zendesk__schedule"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/intermediate/int_zendesk__ticket_schedules.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_intermediate", "enabled": true}, "compiled_sql": "\n\nwith ticket as (\n \n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket`\n\n), ticket_schedule as (\n \n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket_schedule`\n\n), schedule as (\n \n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__schedule`\n\n\n), default_schedule_events as (\n-- Goal: understand the working schedules applied to tickets, so that we can then determine the applicable business hours/schedule.\n-- Your default schedule is used for all tickets, unless you set up a trigger to apply a specific schedule to specific tickets.\n\n-- This portion of the query creates ticket_schedules for these \"default\" schedules, as the ticket_schedule table only includes\n-- trigger schedules\n\n\n\n \n\n \n\n \n\n select\n ticket.ticket_id,\n ticket.created_at as schedule_created_at,\n '360000310393' as schedule_id\n from ticket\n left join ticket_schedule as first_schedule\n on first_schedule.ticket_id = ticket.ticket_id\n and \n\n timestamp_add(first_schedule.created_at, interval -5 second)\n\n <= ticket.created_at\n and first_schedule.created_at >= ticket.created_at \n where first_schedule.ticket_id is null\n\n), schedule_events as (\n \n select\n *\n from default_schedule_events\n \n union all\n \n select \n ticket_id,\n created_at as schedule_created_at,\n schedule_id\n from ticket_schedule\n\n), ticket_schedules as (\n \n select \n ticket_id,\n schedule_id,\n schedule_created_at,\n coalesce(lead(schedule_created_at) over (partition by ticket_id order by schedule_created_at)\n , \n\n timestamp_add(\n current_timestamp\n, interval 1000 hour)\n\n ) as schedule_invalidated_at\n from schedule_events\n\n)\n\nselect *\nfrom ticket_schedules", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_schedules`"}, "model.zendesk.int_zendesk__assignee_updates": {"raw_sql": "with ticket_updates as (\n select *\n from {{ ref('int_zendesk__updates') }}\n\n), ticket as (\n select *\n from {{ ref('stg_zendesk__ticket') }}\n\n), ticket_requester as (\n select\n ticket.ticket_id,\n ticket.assignee_id,\n ticket_updates.valid_starting_at\n\n from ticket\n\n left join ticket_updates\n on ticket_updates.ticket_id = ticket.ticket_id\n and ticket_updates.user_id = ticket.assignee_id\n\n), final as (\n select \n ticket_id,\n assignee_id,\n max(valid_starting_at) as last_updated,\n count(*) as total_updates\n from ticket_requester\n\n group by 1, 2\n)\n\nselect * \nfrom final", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "fqn": ["zendesk", "intermediate", "int_zendesk__assignee_updates"], "unique_id": "model.zendesk.int_zendesk__assignee_updates", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "intermediate/int_zendesk__assignee_updates.sql", "original_file_path": "models/intermediate/int_zendesk__assignee_updates.sql", "name": "int_zendesk__assignee_updates", "resource_type": "model", "alias": "int_zendesk__assignee_updates", "checksum": {"name": "sha256", "checksum": "951ec2d4f8c9a7470a50cfc6e01838a090472a9f18fccd2dd65097d309d43aed"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["int_zendesk__updates"], ["stg_zendesk__ticket"]], "sources": [], "depends_on": {"macros": [], "nodes": ["model.zendesk.int_zendesk__updates", "model.zendesk_source.stg_zendesk__ticket"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/intermediate/int_zendesk__assignee_updates.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_intermediate"}, "compiled_sql": "with ticket_updates as (\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__updates`\n\n), ticket as (\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket`\n\n), ticket_requester as (\n select\n ticket.ticket_id,\n ticket.assignee_id,\n ticket_updates.valid_starting_at\n\n from ticket\n\n left join ticket_updates\n on ticket_updates.ticket_id = ticket.ticket_id\n and ticket_updates.user_id = ticket.assignee_id\n\n), final as (\n select \n ticket_id,\n assignee_id,\n max(valid_starting_at) as last_updated,\n count(*) as total_updates\n from ticket_requester\n\n group by 1, 2\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__assignee_updates`"}, "model.zendesk.int_zendesk__comment_metrics": {"raw_sql": "with ticket_comments as (\n\n select *\n from {{ ref('int_zendesk__comments_enriched') }}\n),\n\ncomment_counts as (\n select\n ticket_id,\n last_comment_added_at,\n sum(case when commenter_role = 'internal_comment'\n then 1\n else 0\n end) as count_agent_comments,\n sum(case when commenter_role = 'external_comment'\n then 1\n else 0\n end) as count_end_user_comments,\n sum(case when is_public = true\n then 1\n else 0\n end) as count_public_comments,\n sum(case when is_public = false\n then 1\n else 0\n end) as count_internal_comments,\n count(*) as total_comments\n from ticket_comments\n\n group by 1, 2\n),\n\nfinal as (\n select\n *,\n count_internal_comments = 1 as is_one_touch_resolution,\n count_internal_comments = 2 as is_two_touch_resolution\n from comment_counts\n)\n\nselect * \nfrom final", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "fqn": ["zendesk", "intermediate", "int_zendesk__comment_metrics"], "unique_id": "model.zendesk.int_zendesk__comment_metrics", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "intermediate/int_zendesk__comment_metrics.sql", "original_file_path": "models/intermediate/int_zendesk__comment_metrics.sql", "name": "int_zendesk__comment_metrics", "resource_type": "model", "alias": "int_zendesk__comment_metrics", "checksum": {"name": "sha256", "checksum": "e028e573b76ce2f1135d2a7f7f70c8c07411f1baeb0ae808a132e9feae07cbb2"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["int_zendesk__comments_enriched"]], "sources": [], "depends_on": {"macros": [], "nodes": ["model.zendesk.int_zendesk__comments_enriched"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/intermediate/int_zendesk__comment_metrics.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_intermediate"}, "compiled_sql": "with __dbt__CTE__int_zendesk__comments_enriched as (\nwith ticket_comment as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__updates`\n where field_name = 'comment'\n\n), users as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__user`\n\n), joined as (\n\n select \n\n ticket_comment.*,\n case when commenter.role = 'end-user' then 'external_comment'\n when commenter.role in ('agent','admin') then 'internal_comment'\n else 'unknown' end as commenter_role\n \n from ticket_comment\n \n join users as commenter\n on commenter.user_id = ticket_comment.user_id\n\n), add_previous_commenter_role as (\n\n select\n *,\n coalesce(\n lag(commenter_role) over (partition by ticket_id order by valid_starting_at)\n , 'first_comment') \n as previous_commenter_role,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_comment_added_at\n\n from joined\n)\n\nselect * \nfrom add_previous_commenter_role\n),ticket_comments as (\n\n select *\n from __dbt__CTE__int_zendesk__comments_enriched\n),\n\ncomment_counts as (\n select\n ticket_id,\n last_comment_added_at,\n sum(case when commenter_role = 'internal_comment'\n then 1\n else 0\n end) as count_agent_comments,\n sum(case when commenter_role = 'external_comment'\n then 1\n else 0\n end) as count_end_user_comments,\n sum(case when is_public = true\n then 1\n else 0\n end) as count_public_comments,\n sum(case when is_public = false\n then 1\n else 0\n end) as count_internal_comments,\n count(*) as total_comments\n from ticket_comments\n\n group by 1, 2\n),\n\nfinal as (\n select\n *,\n count_internal_comments = 1 as is_one_touch_resolution,\n count_internal_comments = 2 as is_two_touch_resolution\n from comment_counts\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.zendesk.int_zendesk__comments_enriched", "sql": " __dbt__CTE__int_zendesk__comments_enriched as (\nwith ticket_comment as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__updates`\n where field_name = 'comment'\n\n), users as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__user`\n\n), joined as (\n\n select \n\n ticket_comment.*,\n case when commenter.role = 'end-user' then 'external_comment'\n when commenter.role in ('agent','admin') then 'internal_comment'\n else 'unknown' end as commenter_role\n \n from ticket_comment\n \n join users as commenter\n on commenter.user_id = ticket_comment.user_id\n\n), add_previous_commenter_role as (\n\n select\n *,\n coalesce(\n lag(commenter_role) over (partition by ticket_id order by valid_starting_at)\n , 'first_comment') \n as previous_commenter_role,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_comment_added_at\n\n from joined\n)\n\nselect * \nfrom add_previous_commenter_role\n)"}], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__comment_metrics`"}, "model.zendesk.int_zendesk__ticket_historical_group": {"raw_sql": "with ticket_group_history as (\n\n select *\n from {{ ref('int_zendesk__updates') }}\n where field_name = 'group_id'\n\n), group_breakdown as (\n select\n \n ticket_id,\n valid_starting_at,\n valid_ending_at,\n value as group_id\n from ticket_group_history\n\n), final as (\n select\n ticket_id,\n count(group_id) as group_stations_count\n from group_breakdown\n\n group by 1\n)\n\nselect *\nfrom final", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "fqn": ["zendesk", "intermediate", "int_zendesk__ticket_historical_group"], "unique_id": "model.zendesk.int_zendesk__ticket_historical_group", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "intermediate/int_zendesk__ticket_historical_group.sql", "original_file_path": "models/intermediate/int_zendesk__ticket_historical_group.sql", "name": "int_zendesk__ticket_historical_group", "resource_type": "model", "alias": "int_zendesk__ticket_historical_group", "checksum": {"name": "sha256", "checksum": "7d4d72f5d6a7ef73a23ad4be966b00683532fe2a11c9729a8d640752ebee1adc"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["int_zendesk__updates"]], "sources": [], "depends_on": {"macros": [], "nodes": ["model.zendesk.int_zendesk__updates"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/intermediate/int_zendesk__ticket_historical_group.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_intermediate"}, "compiled_sql": "with ticket_group_history as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__updates`\n where field_name = 'group_id'\n\n), group_breakdown as (\n select\n \n ticket_id,\n valid_starting_at,\n valid_ending_at,\n value as group_id\n from ticket_group_history\n\n), final as (\n select\n ticket_id,\n count(group_id) as group_stations_count\n from group_breakdown\n\n group by 1\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_historical_group`"}, "model.zendesk.int_zendesk__requester_updates": {"raw_sql": "with ticket_updates as (\n select *\n from {{ ref('int_zendesk__updates') }}\n\n), ticket as (\n select *\n from {{ ref('stg_zendesk__ticket') }}\n\n), ticket_requester as (\n select\n ticket.ticket_id,\n ticket.requester_id,\n ticket_updates.valid_starting_at\n\n from ticket\n\n left join ticket_updates\n on ticket_updates.ticket_id = ticket.ticket_id\n and ticket_updates.user_id = ticket.requester_id\n\n), final as (\n select \n ticket_id,\n requester_id,\n max(valid_starting_at) as last_updated,\n count(*) as total_updates\n from ticket_requester\n\n group by 1, 2\n)\n\nselect * \nfrom final", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "fqn": ["zendesk", "intermediate", "int_zendesk__requester_updates"], "unique_id": "model.zendesk.int_zendesk__requester_updates", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "intermediate/int_zendesk__requester_updates.sql", "original_file_path": "models/intermediate/int_zendesk__requester_updates.sql", "name": "int_zendesk__requester_updates", "resource_type": "model", "alias": "int_zendesk__requester_updates", "checksum": {"name": "sha256", "checksum": "b2d14b09db3cadfb56e4b3dcb55c4f9000e670e3c7c29ef89b249e626e8ba103"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["int_zendesk__updates"], ["stg_zendesk__ticket"]], "sources": [], "depends_on": {"macros": [], "nodes": ["model.zendesk.int_zendesk__updates", "model.zendesk_source.stg_zendesk__ticket"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/intermediate/int_zendesk__requester_updates.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_intermediate"}, "compiled_sql": "with ticket_updates as (\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__updates`\n\n), ticket as (\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket`\n\n), ticket_requester as (\n select\n ticket.ticket_id,\n ticket.requester_id,\n ticket_updates.valid_starting_at\n\n from ticket\n\n left join ticket_updates\n on ticket_updates.ticket_id = ticket.ticket_id\n and ticket_updates.user_id = ticket.requester_id\n\n), final as (\n select \n ticket_id,\n requester_id,\n max(valid_starting_at) as last_updated,\n count(*) as total_updates\n from ticket_requester\n\n group by 1, 2\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__requester_updates`"}, "model.zendesk.int_zendesk__ticket_historical_satisfaction": {"raw_sql": "with satisfaction_updates as (\n\n select *\n from {{ ref('int_zendesk__updates') }}\n where field_name in ('satisfaction_score', 'satisfaction_comment', 'satisfaction_reason_code') \n\n), latest_reason as (\n select\n ticket_id,\n first_value(value) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as latest_satisfaction_reason\n from satisfaction_updates\n\n where field_name = 'satisfaction_reason_code'\n\n), latest_comment as (\n select\n ticket_id,\n first_value(value) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as latest_satisfaction_comment\n from satisfaction_updates\n\n where field_name = 'satisfaction_comment'\n\n), first_and_latest_score as (\n select\n ticket_id,\n first_value(value) over (partition by ticket_id order by valid_starting_at, ticket_id rows unbounded preceding) as first_satisfaction_score,\n first_value(value) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as latest_satisfaction_score\n from satisfaction_updates\n\n where field_name = 'satisfaction_score' and value != 'offered'\n\n), satisfaction_scores as (\n select\n ticket_id,\n count(value) over (partition by ticket_id) as count_satisfaction_scores,\n case when lag(value) over (partition by ticket_id order by valid_starting_at desc) = 'good' and value = 'bad'\n then 1\n else 0\n end as good_to_bad_score,\n case when lag(value) over (partition by ticket_id order by valid_starting_at desc) = 'bad' and value = 'good'\n then 1\n else 0\n end as bad_to_good_score\n from satisfaction_updates\n where field_name = 'satisfaction_score'\n\n), score_group as (\n select\n ticket_id,\n count_satisfaction_scores,\n sum(good_to_bad_score) as total_good_to_bad_score,\n sum(bad_to_good_score) as total_bad_to_good_score\n from satisfaction_scores\n\n group by 1, 2\n\n), window_group as (\n select\n satisfaction_updates.ticket_id,\n latest_reason.latest_satisfaction_reason,\n latest_comment.latest_satisfaction_comment,\n first_and_latest_score.first_satisfaction_score,\n first_and_latest_score.latest_satisfaction_score,\n score_group.count_satisfaction_scores,\n score_group.total_good_to_bad_score,\n score_group.total_bad_to_good_score\n\n from satisfaction_updates\n\n left join latest_reason\n on satisfaction_updates.ticket_id = latest_reason.ticket_id\n\n left join latest_comment\n on satisfaction_updates.ticket_id = latest_comment.ticket_id\n\n left join first_and_latest_score\n on satisfaction_updates.ticket_id = first_and_latest_score.ticket_id\n\n left join score_group\n on satisfaction_updates.ticket_id = score_group.ticket_id\n\n group by 1, 2, 3, 4, 5, 6, 7, 8\n\n), final as (\n select\n ticket_id,\n latest_satisfaction_reason,\n latest_satisfaction_comment,\n first_satisfaction_score,\n latest_satisfaction_score,\n case when count_satisfaction_scores > 0\n then (count_satisfaction_scores - 1) --Subtracting one as the first score is always \"offered\".\n else count_satisfaction_scores\n end as count_satisfaction_scores,\n case when total_good_to_bad_score > 0\n then true\n else false\n end as is_good_to_bad_satisfaction_score,\n case when total_bad_to_good_score > 0\n then true\n else false\n end as is_bad_to_good_satisfaction_score\n from window_group\n)\n\nselect *\nfrom final", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "fqn": ["zendesk", "intermediate", "int_zendesk__ticket_historical_satisfaction"], "unique_id": "model.zendesk.int_zendesk__ticket_historical_satisfaction", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "intermediate/int_zendesk__ticket_historical_satisfaction.sql", "original_file_path": "models/intermediate/int_zendesk__ticket_historical_satisfaction.sql", "name": "int_zendesk__ticket_historical_satisfaction", "resource_type": "model", "alias": "int_zendesk__ticket_historical_satisfaction", "checksum": {"name": "sha256", "checksum": "dce9b5b8705d72688802f99250a8f8a34b8791c3cb440f85efa11f09ebfe3e1d"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["int_zendesk__updates"]], "sources": [], "depends_on": {"macros": [], "nodes": ["model.zendesk.int_zendesk__updates"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/intermediate/int_zendesk__ticket_historical_satisfaction.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_intermediate"}, "compiled_sql": "with satisfaction_updates as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__updates`\n where field_name in ('satisfaction_score', 'satisfaction_comment', 'satisfaction_reason_code') \n\n), latest_reason as (\n select\n ticket_id,\n first_value(value) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as latest_satisfaction_reason\n from satisfaction_updates\n\n where field_name = 'satisfaction_reason_code'\n\n), latest_comment as (\n select\n ticket_id,\n first_value(value) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as latest_satisfaction_comment\n from satisfaction_updates\n\n where field_name = 'satisfaction_comment'\n\n), first_and_latest_score as (\n select\n ticket_id,\n first_value(value) over (partition by ticket_id order by valid_starting_at, ticket_id rows unbounded preceding) as first_satisfaction_score,\n first_value(value) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as latest_satisfaction_score\n from satisfaction_updates\n\n where field_name = 'satisfaction_score' and value != 'offered'\n\n), satisfaction_scores as (\n select\n ticket_id,\n count(value) over (partition by ticket_id) as count_satisfaction_scores,\n case when lag(value) over (partition by ticket_id order by valid_starting_at desc) = 'good' and value = 'bad'\n then 1\n else 0\n end as good_to_bad_score,\n case when lag(value) over (partition by ticket_id order by valid_starting_at desc) = 'bad' and value = 'good'\n then 1\n else 0\n end as bad_to_good_score\n from satisfaction_updates\n where field_name = 'satisfaction_score'\n\n), score_group as (\n select\n ticket_id,\n count_satisfaction_scores,\n sum(good_to_bad_score) as total_good_to_bad_score,\n sum(bad_to_good_score) as total_bad_to_good_score\n from satisfaction_scores\n\n group by 1, 2\n\n), window_group as (\n select\n satisfaction_updates.ticket_id,\n latest_reason.latest_satisfaction_reason,\n latest_comment.latest_satisfaction_comment,\n first_and_latest_score.first_satisfaction_score,\n first_and_latest_score.latest_satisfaction_score,\n score_group.count_satisfaction_scores,\n score_group.total_good_to_bad_score,\n score_group.total_bad_to_good_score\n\n from satisfaction_updates\n\n left join latest_reason\n on satisfaction_updates.ticket_id = latest_reason.ticket_id\n\n left join latest_comment\n on satisfaction_updates.ticket_id = latest_comment.ticket_id\n\n left join first_and_latest_score\n on satisfaction_updates.ticket_id = first_and_latest_score.ticket_id\n\n left join score_group\n on satisfaction_updates.ticket_id = score_group.ticket_id\n\n group by 1, 2, 3, 4, 5, 6, 7, 8\n\n), final as (\n select\n ticket_id,\n latest_satisfaction_reason,\n latest_satisfaction_comment,\n first_satisfaction_score,\n latest_satisfaction_score,\n case when count_satisfaction_scores > 0\n then (count_satisfaction_scores - 1) --Subtracting one as the first score is always \"offered\".\n else count_satisfaction_scores\n end as count_satisfaction_scores,\n case when total_good_to_bad_score > 0\n then true\n else false\n end as is_good_to_bad_satisfaction_score,\n case when total_bad_to_good_score > 0\n then true\n else false\n end as is_bad_to_good_satisfaction_score\n from window_group\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_historical_satisfaction`"}, "model.zendesk.int_zendesk__latest_ticket_form": {"raw_sql": "--To disable this model, set the using_ticket_form_history variable within your dbt_project.yml file to False.\n{{ config(enabled=var('using_ticket_form_history', True)) }}\n\nwith ticket_form_history as (\n select *\n from {{ ref('stg_zendesk__ticket_form_history') }}\n),\n\nlatest_ticket_form as (\n select\n *,\n row_number() over(partition by ticket_form_id order by updated_at desc) as latest_form_index\n from ticket_form_history\n),\n\nfinal as (\n select \n ticket_form_id,\n created_at,\n updated_at,\n display_name,\n is_active,\n name,\n latest_form_index\n from latest_ticket_form\n\n where latest_form_index = 1\n)\n\nselect *\nfrom final", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "fqn": ["zendesk", "intermediate", "int_zendesk__latest_ticket_form"], "unique_id": "model.zendesk.int_zendesk__latest_ticket_form", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "intermediate/int_zendesk__latest_ticket_form.sql", "original_file_path": "models/intermediate/int_zendesk__latest_ticket_form.sql", "name": "int_zendesk__latest_ticket_form", "resource_type": "model", "alias": "int_zendesk__latest_ticket_form", "checksum": {"name": "sha256", "checksum": "906a97576bff9f4fead3b0ed4632aa8a04b94f523e62b0e05425770213f78ea5"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["stg_zendesk__ticket_form_history"]], "sources": [], "depends_on": {"macros": [], "nodes": ["model.zendesk_source.stg_zendesk__ticket_form_history"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/intermediate/int_zendesk__latest_ticket_form.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_intermediate", "enabled": true}, "compiled_sql": "--To disable this model, set the using_ticket_form_history variable within your dbt_project.yml file to False.\n\n\nwith ticket_form_history as (\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket_form_history`\n),\n\nlatest_ticket_form as (\n select\n *,\n row_number() over(partition by ticket_form_id order by updated_at desc) as latest_form_index\n from ticket_form_history\n),\n\nfinal as (\n select \n ticket_form_id,\n created_at,\n updated_at,\n display_name,\n is_active,\n name,\n latest_form_index\n from latest_ticket_form\n\n where latest_form_index = 1\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__latest_ticket_form`"}, "model.zendesk.int_zendesk__ticket_aggregates": {"raw_sql": "with tickets as (\n select *\n from {{ ref('stg_zendesk__ticket') }}\n\n), ticket_tags as (\n\n select *\n from {{ ref('stg_zendesk__ticket_tag') }}\n\n), brands as (\n\n select *\n from {{ ref('stg_zendesk__brand') }}\n \n), ticket_tag_aggregate as (\n select\n ticket_tags.ticket_id,\n {{ fivetran_utils.string_agg( 'ticket_tags.tags', \"', '\" )}} as ticket_tags\n from ticket_tags\n group by 1\n\n), final as (\n select \n tickets.*,\n case when lower(tickets.type) = 'incident'\n then true\n else false\n end as is_incident,\n brands.name as ticket_brand_name,\n ticket_tag_aggregate.ticket_tags\n from tickets\n\n left join ticket_tag_aggregate\n using(ticket_id)\n\n left join brands\n on brands.brand_id = tickets.brand_id\n)\n\nselect *\nfrom final", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "fqn": ["zendesk", "intermediate", "int_zendesk__ticket_aggregates"], "unique_id": "model.zendesk.int_zendesk__ticket_aggregates", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "intermediate/int_zendesk__ticket_aggregates.sql", "original_file_path": "models/intermediate/int_zendesk__ticket_aggregates.sql", "name": "int_zendesk__ticket_aggregates", "resource_type": "model", "alias": "int_zendesk__ticket_aggregates", "checksum": {"name": "sha256", "checksum": "cef0c080fae7a2b361b077473aa1ccfd4bfa472469b9006038aa3866a5bf8b50"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["stg_zendesk__ticket"], ["stg_zendesk__ticket_tag"], ["stg_zendesk__brand"]], "sources": [], "depends_on": {"macros": ["macro.fivetran_utils.string_agg"], "nodes": ["model.zendesk_source.stg_zendesk__ticket", "model.zendesk_source.stg_zendesk__ticket_tag", "model.zendesk_source.stg_zendesk__brand"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/intermediate/int_zendesk__ticket_aggregates.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_intermediate"}, "compiled_sql": "with tickets as (\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket`\n\n), ticket_tags as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket_tag`\n\n), brands as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__brand`\n \n), ticket_tag_aggregate as (\n select\n ticket_tags.ticket_id,\n \n string_agg(ticket_tags.tags, ', ')\n\n as ticket_tags\n from ticket_tags\n group by 1\n\n), final as (\n select \n tickets.*,\n case when lower(tickets.type) = 'incident'\n then true\n else false\n end as is_incident,\n brands.name as ticket_brand_name,\n ticket_tag_aggregate.ticket_tags\n from tickets\n\n left join ticket_tag_aggregate\n using(ticket_id)\n\n left join brands\n on brands.brand_id = tickets.brand_id\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__ticket_aggregates`"}, "model.zendesk.int_zendesk__organization_aggregates": {"raw_sql": "with organizations as (\n select * \n from {{ ref('stg_zendesk__organization') }}\n\n--If you use organization tags this will be included, if not it will be ignored.\n{% if var('using_organization_tags', True) %}\n), organization_tags as (\n select * \n from {{ ref('stg_zendesk__organization_tag') }}\n\n), tag_aggregates as (\n select\n organizations.organization_id,\n {{ fivetran_utils.string_agg('organization_tags.tags', \"', '\" ) }} as organization_tags\n from organizations\n\n left join organization_tags\n using (organization_id)\n\n group by 1\n{% endif %}\n\n--If you use using_domain_names tags this will be included, if not it will be ignored.\n{% if var('using_domain_names', True) %}\n), domain_names as (\n\n select *\n from {{ ref('stg_zendesk__domain_name') }}\n\n), domain_aggregates as (\n select\n organizations.organization_id,\n {{ fivetran_utils.string_agg('domain_names.domain_name', \"', '\" ) }} as domain_names\n from organizations\n\n left join domain_names\n using(organization_id)\n \n group by 1\n{% endif %}\n\n\n), final as (\n select\n organizations.*\n\n --If you use organization tags this will be included, if not it will be ignored.\n {% if var('using_organization_tags', True) %}\n ,tag_aggregates.organization_tags\n {% endif %}\n\n --If you use using_domain_names tags this will be included, if not it will be ignored.\n {% if var('using_domain_names', True) %}\n ,domain_aggregates.domain_names\n {% endif %}\n\n from organizations\n\n --If you use using_domain_names tags this will be included, if not it will be ignored.\n {% if var('using_domain_names', True) %}\n left join domain_aggregates\n using(organization_id)\n {% endif %}\n\n --If you use organization tags this will be included, if not it will be ignored.\n {% if var('using_organization_tags', True) %}\n left join tag_aggregates\n using(organization_id)\n {% endif %}\n)\n\nselect *\nfrom final", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_intermediate", "fqn": ["zendesk", "intermediate", "int_zendesk__organization_aggregates"], "unique_id": "model.zendesk.int_zendesk__organization_aggregates", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "intermediate/int_zendesk__organization_aggregates.sql", "original_file_path": "models/intermediate/int_zendesk__organization_aggregates.sql", "name": "int_zendesk__organization_aggregates", "resource_type": "model", "alias": "int_zendesk__organization_aggregates", "checksum": {"name": "sha256", "checksum": "a16300f45d2cb0bd1c26dfec62e967a047095b92f340974bfef56178bfff6cf9"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["stg_zendesk__organization"], ["stg_zendesk__organization_tag"], ["stg_zendesk__domain_name"]], "sources": [], "depends_on": {"macros": ["macro.fivetran_utils.string_agg"], "nodes": ["model.zendesk_source.stg_zendesk__organization", "model.zendesk_source.stg_zendesk__organization_tag", "model.zendesk_source.stg_zendesk__domain_name"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/intermediate/int_zendesk__organization_aggregates.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_intermediate"}, "compiled_sql": "with organizations as (\n select * \n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__organization`\n\n--If you use organization tags this will be included, if not it will be ignored.\n\n), organization_tags as (\n select * \n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__organization_tag`\n\n), tag_aggregates as (\n select\n organizations.organization_id,\n \n string_agg(organization_tags.tags, ', ')\n\n as organization_tags\n from organizations\n\n left join organization_tags\n using (organization_id)\n\n group by 1\n\n\n--If you use using_domain_names tags this will be included, if not it will be ignored.\n\n), domain_names as (\n\n select *\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__domain_name`\n\n), domain_aggregates as (\n select\n organizations.organization_id,\n \n string_agg(domain_names.domain_name, ', ')\n\n as domain_names\n from organizations\n\n left join domain_names\n using(organization_id)\n \n group by 1\n\n\n\n), final as (\n select\n organizations.*\n\n --If you use organization tags this will be included, if not it will be ignored.\n \n ,tag_aggregates.organization_tags\n \n\n --If you use using_domain_names tags this will be included, if not it will be ignored.\n \n ,domain_aggregates.domain_names\n \n\n from organizations\n\n --If you use using_domain_names tags this will be included, if not it will be ignored.\n \n left join domain_aggregates\n using(organization_id)\n \n\n --If you use organization tags this will be included, if not it will be ignored.\n \n left join tag_aggregates\n using(organization_id)\n \n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_intermediate`.`int_zendesk__organization_aggregates`"}, "operation.zendesk.zendesk-on-run-start-0": {"raw_sql": "{{ fivetran_utils.empty_variable_warning(\"ticket_field_history_columns\", \"zendesk_ticket_field_history\") }}", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk", "hooks", "zendesk-on-run-start-0"], "unique_id": "operation.zendesk.zendesk-on-run-start-0", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "hooks/zendesk-on-run-start-0.sql", "original_file_path": "./dbt_project.yml", "name": "zendesk-on-run-start-0", "resource_type": "operation", "alias": "zendesk-on-run-start-0", "checksum": {"name": "sha256", "checksum": "dc12f400ed0ec5380fa7b5de113b0df5859f7e42b20a0a4826fbad1f6306dee0"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null}, "tags": ["on-run-start"], "refs": [], "sources": [], "depends_on": {"macros": ["macro.fivetran_utils.empty_variable_warning"], "nodes": []}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/./dbt_project.yml/hooks/zendesk-on-run-start-0.sql", "deferred": false, "unrendered_config": {"materialized": "table"}, "compiled_sql": "\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "index": 0}, "test.zendesk.unique_zendesk__ticket_enriched_ticket_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_unique(**_dbt_schema_test_kwargs) }}", "test_metadata": {"namespace": null, "name": "unique", "kwargs": {"column_name": "ticket_id", "model": "{{ ref('zendesk__ticket_enriched') }}"}}, "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk", "schema_test", "unique_zendesk__ticket_enriched_ticket_id"], "unique_id": "test.zendesk.unique_zendesk__ticket_enriched_ticket_id", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "schema_test/unique_zendesk__ticket_enriched_ticket_id.sql", "original_file_path": "models/zendesk.yml", "name": "unique_zendesk__ticket_enriched_ticket_id", "resource_type": "test", "alias": "unique_zendesk__ticket_enriched_ticket_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "severity": "ERROR"}, "tags": ["schema"], "refs": [["zendesk__ticket_enriched"]], "sources": [], "depends_on": {"macros": ["macro.dbt.test_unique"], "nodes": ["model.zendesk.zendesk__ticket_enriched"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/zendesk.yml/schema_test/unique_zendesk__ticket_enriched_ticket_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom (\n\n select\n ticket_id\n\n from `dbt-package-testing`.`zendesk_integration_tests`.`zendesk__ticket_enriched`\n where ticket_id is not null\n group by ticket_id\n having count(*) > 1\n\n) validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ticket_id"}, "test.zendesk.not_null_zendesk__ticket_enriched_ticket_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"namespace": null, "name": "not_null", "kwargs": {"column_name": "ticket_id", "model": "{{ ref('zendesk__ticket_enriched') }}"}}, "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk", "schema_test", "not_null_zendesk__ticket_enriched_ticket_id"], "unique_id": "test.zendesk.not_null_zendesk__ticket_enriched_ticket_id", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "schema_test/not_null_zendesk__ticket_enriched_ticket_id.sql", "original_file_path": "models/zendesk.yml", "name": "not_null_zendesk__ticket_enriched_ticket_id", "resource_type": "test", "alias": "not_null_zendesk__ticket_enriched_ticket_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "severity": "ERROR"}, "tags": ["schema"], "refs": [["zendesk__ticket_enriched"]], "sources": [], "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.zendesk.zendesk__ticket_enriched"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/zendesk.yml/schema_test/not_null_zendesk__ticket_enriched_ticket_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom `dbt-package-testing`.`zendesk_integration_tests`.`zendesk__ticket_enriched`\nwhere ticket_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ticket_id"}, "test.zendesk.unique_zendesk__sla_policies_sla_event_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_unique(**_dbt_schema_test_kwargs) }}", "test_metadata": {"namespace": null, "name": "unique", "kwargs": {"column_name": "sla_event_id", "model": "{{ ref('zendesk__sla_policies') }}"}}, "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk", "schema_test", "unique_zendesk__sla_policies_sla_event_id"], "unique_id": "test.zendesk.unique_zendesk__sla_policies_sla_event_id", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "schema_test/unique_zendesk__sla_policies_sla_event_id.sql", "original_file_path": "models/zendesk.yml", "name": "unique_zendesk__sla_policies_sla_event_id", "resource_type": "test", "alias": "unique_zendesk__sla_policies_sla_event_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "severity": "ERROR"}, "tags": ["schema"], "refs": [["zendesk__sla_policies"]], "sources": [], "depends_on": {"macros": ["macro.dbt.test_unique"], "nodes": ["model.zendesk.zendesk__sla_policies"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/zendesk.yml/schema_test/unique_zendesk__sla_policies_sla_event_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom (\n\n select\n sla_event_id\n\n from `dbt-package-testing`.`zendesk_integration_tests`.`zendesk__sla_policies`\n where sla_event_id is not null\n group by sla_event_id\n having count(*) > 1\n\n) validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "sla_event_id"}, "test.zendesk.unique_zendesk__ticket_metrics_ticket_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_unique(**_dbt_schema_test_kwargs) }}", "test_metadata": {"namespace": null, "name": "unique", "kwargs": {"column_name": "ticket_id", "model": "{{ ref('zendesk__ticket_metrics') }}"}}, "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk", "schema_test", "unique_zendesk__ticket_metrics_ticket_id"], "unique_id": "test.zendesk.unique_zendesk__ticket_metrics_ticket_id", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "schema_test/unique_zendesk__ticket_metrics_ticket_id.sql", "original_file_path": "models/zendesk.yml", "name": "unique_zendesk__ticket_metrics_ticket_id", "resource_type": "test", "alias": "unique_zendesk__ticket_metrics_ticket_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "severity": "ERROR"}, "tags": ["schema"], "refs": [["zendesk__ticket_metrics"]], "sources": [], "depends_on": {"macros": ["macro.dbt.test_unique"], "nodes": ["model.zendesk.zendesk__ticket_metrics"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/zendesk.yml/schema_test/unique_zendesk__ticket_metrics_ticket_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom (\n\n select\n ticket_id\n\n from `dbt-package-testing`.`zendesk_integration_tests`.`zendesk__ticket_metrics`\n where ticket_id is not null\n group by ticket_id\n having count(*) > 1\n\n) validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ticket_id"}, "test.zendesk.not_null_zendesk__ticket_metrics_ticket_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"namespace": null, "name": "not_null", "kwargs": {"column_name": "ticket_id", "model": "{{ ref('zendesk__ticket_metrics') }}"}}, "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk", "schema_test", "not_null_zendesk__ticket_metrics_ticket_id"], "unique_id": "test.zendesk.not_null_zendesk__ticket_metrics_ticket_id", "package_name": "zendesk", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk", "path": "schema_test/not_null_zendesk__ticket_metrics_ticket_id.sql", "original_file_path": "models/zendesk.yml", "name": "not_null_zendesk__ticket_metrics_ticket_id", "resource_type": "test", "alias": "not_null_zendesk__ticket_metrics_ticket_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "severity": "ERROR"}, "tags": ["schema"], "refs": [["zendesk__ticket_metrics"]], "sources": [], "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.zendesk.zendesk__ticket_metrics"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk/models/zendesk.yml/schema_test/not_null_zendesk__ticket_metrics_ticket_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom `dbt-package-testing`.`zendesk_integration_tests`.`zendesk__ticket_metrics`\nwhere ticket_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ticket_id"}, "model.zendesk_source.stg_zendesk__user_tag": {"raw_sql": "--To disable this model, set the using_user_tags variable within your dbt_project.yml file to False.\n{{ config(enabled=var('using_user_tags', True)) }}\n\nwith base as (\n\n select * \n from {{ ref('stg_zendesk__user_tag_tmp') }}\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_zendesk__user_tag_tmp')),\n staging_columns=get_user_tag_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n user_id,\n {% if target.type == 'redshift' %}\n 'tag'\n {% else %}\n tag\n {% endif %}\n as tags\n from fields\n)\n\nselect * \nfrom final", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "stg_zendesk__user_tag"], "unique_id": "model.zendesk_source.stg_zendesk__user_tag", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "stg_zendesk__user_tag.sql", "original_file_path": "models/stg_zendesk__user_tag.sql", "name": "stg_zendesk__user_tag", "resource_type": "model", "alias": "stg_zendesk__user_tag", "checksum": {"name": "sha256", "checksum": "ea77c976e7ee820ea7cc353ea3d30231f262f834d75e4cb251e1a72c92a93462"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["stg_zendesk__user_tag_tmp"], ["stg_zendesk__user_tag_tmp"]], "sources": [], "depends_on": {"macros": ["macro.zendesk_source.get_user_tag_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.zendesk_source.stg_zendesk__user_tag_tmp", "model.zendesk_source.stg_zendesk__user_tag_tmp"]}, "description": "Table containing all tags associated with a user. Only present if your account has user tagging enabled.", "columns": {"user_id": {"name": "user_id", "description": "Reference to the user", "meta": {}, "data_type": null, "quote": null, "tags": []}, "tag": {"name": "tag", "description": "Tag associated with the user", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/stg_zendesk.yml", "build_path": "target/compiled/zendesk_source/models/stg_zendesk__user_tag.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging", "enabled": true}, "compiled_sql": "--To disable this model, set the using_user_tags variable within your dbt_project.yml file to False.\n\n\nwith base as (\n\n select * \n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__user_tag_tmp`\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n user_id\n \n as \n \n user_id\n \n, \n \n \n tag\n \n as \n \n tag\n \n\n\n\n \n from base\n),\n\nfinal as (\n \n select \n user_id,\n \n tag\n \n as tags\n from fields\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__user_tag`"}, "model.zendesk_source.stg_zendesk__ticket_tag": {"raw_sql": "with base as (\n\n select * \n from {{ ref('stg_zendesk__ticket_tag_tmp') }}\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_zendesk__ticket_tag_tmp')),\n staging_columns=get_ticket_tag_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n ticket_id,\n {% if target.type == 'redshift' %}\n \"tag\" as tags\n {% else %}\n tag as tags\n {% endif %}\n from fields\n)\n\nselect * \nfrom final", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "stg_zendesk__ticket_tag"], "unique_id": "model.zendesk_source.stg_zendesk__ticket_tag", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "stg_zendesk__ticket_tag.sql", "original_file_path": "models/stg_zendesk__ticket_tag.sql", "name": "stg_zendesk__ticket_tag", "resource_type": "model", "alias": "stg_zendesk__ticket_tag", "checksum": {"name": "sha256", "checksum": "3428fceccfd804f2317fe4404a74ea365549910b484a567ccf5c10556597037a"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["stg_zendesk__ticket_tag_tmp"], ["stg_zendesk__ticket_tag_tmp"]], "sources": [], "depends_on": {"macros": ["macro.zendesk_source.get_ticket_tag_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.zendesk_source.stg_zendesk__ticket_tag_tmp", "model.zendesk_source.stg_zendesk__ticket_tag_tmp"]}, "description": "Tags are words, or combinations of words, you can use to add more context to tickets. The table lists all tags currently associated with a ticket.\n", "columns": {"ticket_id": {"name": "ticket_id", "description": "The ID of the ticket associated with the tag", "meta": {}, "data_type": null, "quote": null, "tags": []}, "tags": {"name": "tags", "description": "The tag, or word(s), associated with the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/stg_zendesk.yml", "build_path": "target/compiled/zendesk_source/models/stg_zendesk__ticket_tag.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging"}, "compiled_sql": "with base as (\n\n select * \n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket_tag_tmp`\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n ticket_id\n \n as \n \n ticket_id\n \n, \n \n \n tag\n \n as \n \n tag\n \n\n\n\n \n from base\n),\n\nfinal as (\n \n select \n ticket_id,\n \n tag as tags\n \n from fields\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket_tag`"}, "model.zendesk_source.stg_zendesk__ticket_field_history": {"raw_sql": "with base as (\n\n select * \n from {{ ref('stg_zendesk__ticket_field_history_tmp') }}\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_zendesk__ticket_field_history_tmp')),\n staging_columns=get_ticket_field_history_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n ticket_id,\n field_name,\n updated as valid_starting_at,\n lead(updated) over (partition by ticket_id, field_name order by updated) as valid_ending_at,\n value,\n user_id\n from fields\n \n order by 1,2,3\n)\n\nselect * \nfrom final", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "stg_zendesk__ticket_field_history"], "unique_id": "model.zendesk_source.stg_zendesk__ticket_field_history", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "stg_zendesk__ticket_field_history.sql", "original_file_path": "models/stg_zendesk__ticket_field_history.sql", "name": "stg_zendesk__ticket_field_history", "resource_type": "model", "alias": "stg_zendesk__ticket_field_history", "checksum": {"name": "sha256", "checksum": "73de14dacad570d290a85527a0ca62b72d95ad9306ef5b541a785f6316c68c3c"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["stg_zendesk__ticket_field_history_tmp"], ["stg_zendesk__ticket_field_history_tmp"]], "sources": [], "depends_on": {"macros": ["macro.zendesk_source.get_ticket_field_history_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.zendesk_source.stg_zendesk__ticket_field_history_tmp", "model.zendesk_source.stg_zendesk__ticket_field_history_tmp"]}, "description": "All fields and field values associated with tickets.", "columns": {"ticket_id": {"name": "ticket_id", "description": "The ID of the ticket associated with the field", "meta": {}, "data_type": null, "quote": null, "tags": []}, "field_name": {"name": "field_name", "description": "The name of the ticket field", "meta": {}, "data_type": null, "quote": null, "tags": []}, "valid_starting_at": {"name": "valid_starting_at", "description": "The time the ticket field value became valid", "meta": {}, "data_type": null, "quote": null, "tags": []}, "valid_ending_at": {"name": "valid_ending_at", "description": "The time the ticket field value became invalidated", "meta": {}, "data_type": null, "quote": null, "tags": []}, "value": {"name": "value", "description": "The value of the field", "meta": {}, "data_type": null, "quote": null, "tags": []}, "user_id": {"name": "user_id", "description": "The id of the user who made the update", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/stg_zendesk.yml", "build_path": "target/compiled/zendesk_source/models/stg_zendesk__ticket_field_history.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging"}, "compiled_sql": "with base as (\n\n select * \n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket_field_history_tmp`\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n field_name\n \n as \n \n field_name\n \n, \n \n \n ticket_id\n \n as \n \n ticket_id\n \n, \n \n \n updated\n \n as \n \n updated\n \n, \n \n \n user_id\n \n as \n \n user_id\n \n, \n \n \n value\n \n as \n \n value\n \n\n\n\n \n from base\n),\n\nfinal as (\n \n select \n ticket_id,\n field_name,\n updated as valid_starting_at,\n lead(updated) over (partition by ticket_id, field_name order by updated) as valid_ending_at,\n value,\n user_id\n from fields\n \n order by 1,2,3\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket_field_history`"}, "model.zendesk_source.stg_zendesk__organization": {"raw_sql": "with base as (\n\n select * \n from {{ ref('stg_zendesk__organization_tmp') }}\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_zendesk__organization_tmp')),\n staging_columns=get_organization_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n id as organization_id,\n created_at,\n updated_at,\n details,\n name,\n external_id\n\n from fields\n)\n\nselect * \nfrom final", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "stg_zendesk__organization"], "unique_id": "model.zendesk_source.stg_zendesk__organization", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "stg_zendesk__organization.sql", "original_file_path": "models/stg_zendesk__organization.sql", "name": "stg_zendesk__organization", "resource_type": "model", "alias": "stg_zendesk__organization", "checksum": {"name": "sha256", "checksum": "5527f691054dd7a01158ae65c9c44881a8f0d6eaa1a9124a912f262b6f4f024c"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["stg_zendesk__organization_tmp"], ["stg_zendesk__organization_tmp"]], "sources": [], "depends_on": {"macros": ["macro.zendesk_source.get_organization_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.zendesk_source.stg_zendesk__organization_tmp", "model.zendesk_source.stg_zendesk__organization_tmp"]}, "description": "Just as agents can be segmented into groups in Zendesk Support, your customers (end-users) can be segmented into organizations. You can manually assign customers to an organization or automatically assign them to an organization by their email address domain. Organizations can be used in business rules to route tickets to groups of agents or to send email notifications.\n", "columns": {"organization_id": {"name": "organization_id", "description": "Automatically assigned when the organization is created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "A unique name for the organization", "meta": {}, "data_type": null, "quote": null, "tags": []}, "details": {"name": "details", "description": "Any details obout the organization, such as the address", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/stg_zendesk.yml", "build_path": "target/compiled/zendesk_source/models/stg_zendesk__organization.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging"}, "compiled_sql": "with base as (\n\n select * \n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__organization_tmp`\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n created_at\n \n as \n \n created_at\n \n, \n \n \n details\n \n as \n \n details\n \n, \n \n \n external_id\n \n as \n \n external_id\n \n, \n \n \n group_id\n \n as \n \n group_id\n \n, \n \n \n id\n \n as \n \n id\n \n, \n \n \n name\n \n as \n \n name\n \n, \n \n \n notes\n \n as \n \n notes\n \n, \n \n \n shared_comments\n \n as \n \n shared_comments\n \n, \n \n \n shared_tickets\n \n as \n \n shared_tickets\n \n, \n \n \n updated_at\n \n as \n \n updated_at\n \n, \n \n \n url\n \n as \n \n url\n \n\n\n\n \n from base\n),\n\nfinal as (\n \n select \n id as organization_id,\n created_at,\n updated_at,\n details,\n name,\n external_id\n\n from fields\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__organization`"}, "model.zendesk_source.stg_zendesk__group": {"raw_sql": "with base as (\n\n select * \n from {{ ref('stg_zendesk__group_tmp') }}\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_zendesk__group_tmp')),\n staging_columns=get_group_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n id as group_id,\n name\n from fields\n \n where not coalesce(_fivetran_deleted, false)\n)\n\nselect * \nfrom final", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "stg_zendesk__group"], "unique_id": "model.zendesk_source.stg_zendesk__group", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "stg_zendesk__group.sql", "original_file_path": "models/stg_zendesk__group.sql", "name": "stg_zendesk__group", "resource_type": "model", "alias": "stg_zendesk__group", "checksum": {"name": "sha256", "checksum": "a867fd2d0bab21a736d6ae6bc5306a2f800e2d36518eea6c957736821ffcf099"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["stg_zendesk__group_tmp"], ["stg_zendesk__group_tmp"]], "sources": [], "depends_on": {"macros": ["macro.zendesk_source.get_group_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.zendesk_source.stg_zendesk__group_tmp", "model.zendesk_source.stg_zendesk__group_tmp"]}, "description": "When support requests arrive in Zendesk Support, they can be assigned to a Group. Groups serve as the core element of ticket workflow; support agents are organized into Groups and tickets can be assigned to a Group only, or to an assigned agent within a Group. A ticket can never be assigned to an agent without also being assigned to a Group.\n", "columns": {"group_id": {"name": "group_id", "description": "Automatically assigned when creating groups", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "The name of the group", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/stg_zendesk.yml", "build_path": "target/compiled/zendesk_source/models/stg_zendesk__group.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging"}, "compiled_sql": "with base as (\n\n select * \n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__group_tmp`\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n \n \n \n _fivetran_deleted\n \n as \n \n _fivetran_deleted\n \n, \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n created_at\n \n as \n \n created_at\n \n, \n \n \n id\n \n as \n \n id\n \n, \n \n \n name\n \n as \n \n name\n \n, \n \n \n updated_at\n \n as \n \n updated_at\n \n, \n \n \n url\n \n as \n \n url\n \n\n\n\n \n from base\n),\n\nfinal as (\n \n select \n id as group_id,\n name\n from fields\n \n where not coalesce(_fivetran_deleted, false)\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__group`"}, "model.zendesk_source.stg_zendesk__ticket_comment": {"raw_sql": "with base as (\n\n select * \n from {{ ref('stg_zendesk__ticket_comment_tmp') }}\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_zendesk__ticket_comment_tmp')),\n staging_columns=get_ticket_comment_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n id as ticket_comment_id,\n _fivetran_synced,\n body,\n created as created_at,\n public as is_public,\n ticket_id,\n user_id,\n facebook_comment as is_facebook_comment,\n tweet as is_tweet,\n voice_comment as is_voice_comment\n from fields\n)\n\nselect * \nfrom final", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "stg_zendesk__ticket_comment"], "unique_id": "model.zendesk_source.stg_zendesk__ticket_comment", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "stg_zendesk__ticket_comment.sql", "original_file_path": "models/stg_zendesk__ticket_comment.sql", "name": "stg_zendesk__ticket_comment", "resource_type": "model", "alias": "stg_zendesk__ticket_comment", "checksum": {"name": "sha256", "checksum": "7d36a2cee6d0798c29b98d172a7ab34e531a954f7d2e3ce24ee2a0f1ecdf3e08"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["stg_zendesk__ticket_comment_tmp"], ["stg_zendesk__ticket_comment_tmp"]], "sources": [], "depends_on": {"macros": ["macro.zendesk_source.get_ticket_comment_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.zendesk_source.stg_zendesk__ticket_comment_tmp", "model.zendesk_source.stg_zendesk__ticket_comment_tmp"]}, "description": "Ticket comments represent the conversation between requesters, collaborators, and agents. Comments can be public or private.", "columns": {"ticket_comment_id": {"name": "ticket_comment_id", "description": "Automatically assigned when the comment is created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "body": {"name": "body", "description": "The comment string", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "The time the comment was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_public": {"name": "is_public", "description": "Boolean field indicating if the comment is public (true), or if it is an internal note (false)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_id": {"name": "ticket_id", "description": "The ticket id associated with this comment", "meta": {}, "data_type": null, "quote": null, "tags": []}, "user_id": {"name": "user_id", "description": "The id of the comment author", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_facebook_comment": {"name": "is_facebook_comment", "description": "Boolean field indicating if the comment is a facebook comment", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_tweet": {"name": "is_tweet", "description": "Boolean field indicating if the comment is a twitter tweet", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_voice_comment": {"name": "is_voice_comment", "description": "Boolean field indicating if the comment is a voice comment", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/stg_zendesk.yml", "build_path": "target/compiled/zendesk_source/models/stg_zendesk__ticket_comment.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging"}, "compiled_sql": "with base as (\n\n select * \n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket_comment_tmp`\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n body\n \n as \n \n body\n \n, \n cast(null as \n int64\n) as \n \n call_duration\n \n , \n cast(null as \n int64\n) as \n \n call_id\n \n , \n \n \n created\n \n as \n \n created\n \n, \n \n \n facebook_comment\n \n as \n \n facebook_comment\n \n, \n \n \n id\n \n as \n \n id\n \n, \n cast(null as \n int64\n) as \n \n location\n \n , \n \n \n public\n \n as \n \n public\n \n, \n cast(null as \n int64\n) as \n \n recording_url\n \n , \n cast(null as \n timestamp\n) as \n \n started_at\n \n , \n \n \n ticket_id\n \n as \n \n ticket_id\n \n, \n cast(null as \n int64\n) as \n \n transcription_status\n \n , \n cast(null as \n int64\n) as \n \n transcription_text\n \n , \n cast(null as \n int64\n) as \n \n trusted\n \n , \n \n \n tweet\n \n as \n \n tweet\n \n, \n \n \n user_id\n \n as \n \n user_id\n \n, \n \n \n voice_comment\n \n as \n \n voice_comment\n \n, \n cast(null as \n int64\n) as \n \n voice_comment_transcription_visible\n \n \n\n\n \n from base\n),\n\nfinal as (\n \n select \n id as ticket_comment_id,\n _fivetran_synced,\n body,\n created as created_at,\n public as is_public,\n ticket_id,\n user_id,\n facebook_comment as is_facebook_comment,\n tweet as is_tweet,\n voice_comment as is_voice_comment\n from fields\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket_comment`"}, "model.zendesk_source.stg_zendesk__ticket_schedule": {"raw_sql": "--To disable this model, set the using_schedules variable within your dbt_project.yml file to False.\n{{ config(enabled=var('using_schedules', True)) }}\n\nwith base as (\n\n select * \n from {{ ref('stg_zendesk__ticket_schedule_tmp') }}\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_zendesk__ticket_schedule_tmp')),\n staging_columns=get_ticket_schedule_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n ticket_id,\n created_at,\n cast(schedule_id as {{ dbt_utils.type_string() }}) as schedule_id --need to convert from numeric to string for downstream models to work properly\n from fields\n)\n\nselect * \nfrom final", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "stg_zendesk__ticket_schedule"], "unique_id": "model.zendesk_source.stg_zendesk__ticket_schedule", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "stg_zendesk__ticket_schedule.sql", "original_file_path": "models/stg_zendesk__ticket_schedule.sql", "name": "stg_zendesk__ticket_schedule", "resource_type": "model", "alias": "stg_zendesk__ticket_schedule", "checksum": {"name": "sha256", "checksum": "96d74a46e81e0be645ab77e027570d25c3828b070ccd0a897bc5366863637711"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["stg_zendesk__ticket_schedule_tmp"], ["stg_zendesk__ticket_schedule_tmp"]], "sources": [], "depends_on": {"macros": ["macro.zendesk_source.get_ticket_schedule_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_string"], "nodes": ["model.zendesk_source.stg_zendesk__ticket_schedule_tmp", "model.zendesk_source.stg_zendesk__ticket_schedule_tmp"]}, "description": "The schedules applied to tickets through a trigger.", "columns": {"ticket_id": {"name": "ticket_id", "description": "The ID of the ticket assigned to the schedule", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "The time the schedule was assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "schedule_id": {"name": "schedule_id", "description": "The ID of the schedule applied to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/stg_zendesk.yml", "build_path": "target/compiled/zendesk_source/models/stg_zendesk__ticket_schedule.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging", "enabled": true}, "compiled_sql": "--To disable this model, set the using_schedules variable within your dbt_project.yml file to False.\n\n\nwith base as (\n\n select * \n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket_schedule_tmp`\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n created_at\n \n as \n \n created_at\n \n, \n \n \n schedule_id\n \n as \n \n schedule_id\n \n, \n \n \n ticket_id\n \n as \n \n ticket_id\n \n\n\n\n \n from base\n),\n\nfinal as (\n \n select \n ticket_id,\n created_at,\n cast(schedule_id as \n string\n) as schedule_id --need to convert from numeric to string for downstream models to work properly\n from fields\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket_schedule`"}, "model.zendesk_source.stg_zendesk__schedule": {"raw_sql": "--To disable this model, set the using_schedules variable within your dbt_project.yml file to False.\n{{ config(enabled=var('using_schedules', True)) }}\n\nwith base as (\n\n select * \n from {{ ref('stg_zendesk__schedule_tmp') }}\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_zendesk__schedule_tmp')),\n staging_columns=get_schedule_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n cast(id as {{ dbt_utils.type_string() }}) as schedule_id, --need to convert from numeric to string for downstream models to work properly\n end_time_utc,\n start_time_utc,\n name as schedule_name,\n created_at\n from fields\n where not coalesce(_fivetran_deleted, false)\n)\n\nselect * \nfrom final", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "stg_zendesk__schedule"], "unique_id": "model.zendesk_source.stg_zendesk__schedule", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "stg_zendesk__schedule.sql", "original_file_path": "models/stg_zendesk__schedule.sql", "name": "stg_zendesk__schedule", "resource_type": "model", "alias": "stg_zendesk__schedule", "checksum": {"name": "sha256", "checksum": "9a3abc9ac06cff355080a143b6414351f06e2e5de72931986e5ef0f84d3b3265"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["stg_zendesk__schedule_tmp"], ["stg_zendesk__schedule_tmp"]], "sources": [], "depends_on": {"macros": ["macro.zendesk_source.get_schedule_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_string"], "nodes": ["model.zendesk_source.stg_zendesk__schedule_tmp", "model.zendesk_source.stg_zendesk__schedule_tmp"]}, "description": "The support schedules created with different business hours and holidays.", "columns": {"schedule_id": {"name": "schedule_id", "description": "ID automatically assigned to the schedule upon creation", "meta": {}, "data_type": null, "quote": null, "tags": []}, "schedule_name": {"name": "schedule_name", "description": "Name of the schedule", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Time the schedule was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "start_time_utc": {"name": "start_time_utc", "description": "Start time of the schedule, in UTC", "meta": {}, "data_type": null, "quote": null, "tags": []}, "end_time_utc": {"name": "end_time_utc", "description": "End time of the schedule, in UTC", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/stg_zendesk.yml", "build_path": "target/compiled/zendesk_source/models/stg_zendesk__schedule.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging", "enabled": true}, "compiled_sql": "--To disable this model, set the using_schedules variable within your dbt_project.yml file to False.\n\n\nwith base as (\n\n select * \n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__schedule_tmp`\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n \n \n \n _fivetran_deleted\n \n as \n \n _fivetran_deleted\n \n, \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n created_at\n \n as \n \n created_at\n \n, \n \n \n end_time\n \n as \n \n end_time\n \n, \n \n \n end_time_utc\n \n as \n \n end_time_utc\n \n, \n \n \n id\n \n as \n \n id\n \n, \n \n \n name\n \n as \n \n name\n \n, \n \n \n start_time\n \n as \n \n start_time\n \n, \n \n \n start_time_utc\n \n as \n \n start_time_utc\n \n, \n \n \n time_zone\n \n as \n \n time_zone\n \n\n\n\n \n from base\n),\n\nfinal as (\n \n select \n cast(id as \n string\n) as schedule_id, --need to convert from numeric to string for downstream models to work properly\n end_time_utc,\n start_time_utc,\n name as schedule_name,\n created_at\n from fields\n where not coalesce(_fivetran_deleted, false)\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__schedule`"}, "model.zendesk_source.stg_zendesk__user": {"raw_sql": "with base as (\n\n select * \n from {{ ref('stg_zendesk__user_tmp') }}\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_zendesk__user_tmp')),\n staging_columns=get_user_columns()\n )\n }}\n \n from base\n),\n\nfinal as ( \n \n select \n id as user_id,\n external_id,\n _fivetran_synced,\n created_at,\n updated_at,\n email,\n name,\n organization_id,\n role,\n ticket_restriction,\n time_zone,\n locale,\n active as is_active,\n suspended as is_suspended,\n last_login_at\n from fields\n)\n\nselect * \nfrom final", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "stg_zendesk__user"], "unique_id": "model.zendesk_source.stg_zendesk__user", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "stg_zendesk__user.sql", "original_file_path": "models/stg_zendesk__user.sql", "name": "stg_zendesk__user", "resource_type": "model", "alias": "stg_zendesk__user", "checksum": {"name": "sha256", "checksum": "246b9cd11b305941112ab3738a27d8ca6a6039be378378d15a6821ad10a0477d"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["stg_zendesk__user_tmp"], ["stg_zendesk__user_tmp"]], "sources": [], "depends_on": {"macros": ["macro.zendesk_source.get_user_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.zendesk_source.stg_zendesk__user_tmp", "model.zendesk_source.stg_zendesk__user_tmp"]}, "description": "Zendesk has three types of users, end-users (your customers), agents, and administrators.", "columns": {"user_id": {"name": "user_id", "description": "Automatically assigned when the user is created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "email": {"name": "email", "description": "The user's primary email address. *Writeable on create only. On update, a secondary email is added. See Email Address", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "The user's name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_active": {"name": "is_active", "description": "false if the user has been deleted", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "The time the user was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "organization_id": {"name": "organization_id", "description": "The id of the user's organization. If the user has more than one organization memberships, the id of the user's default organization", "meta": {}, "data_type": null, "quote": null, "tags": []}, "role": {"name": "role", "description": "The user's role. Possible values are \"end-user\", \"agent\", or \"admin\"", "meta": {}, "data_type": null, "quote": null, "tags": []}, "time_zone": {"name": "time_zone", "description": "The user's time zone. See Time Zone", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_restriction": {"name": "ticket_restriction", "description": "Specifies which tickets the user has access to. Possible values are organization, groups, assigned, requested and null", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/stg_zendesk.yml", "build_path": "target/compiled/zendesk_source/models/stg_zendesk__user.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging"}, "compiled_sql": "with base as (\n\n select * \n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__user_tmp`\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n active\n \n as \n \n active\n \n, \n \n \n alias\n \n as \n \n alias\n \n, \n \n \n authenticity_token\n \n as \n \n authenticity_token\n \n, \n \n \n chat_only\n \n as \n \n chat_only\n \n, \n \n \n created_at\n \n as \n \n created_at\n \n, \n \n \n details\n \n as \n \n details\n \n, \n \n \n email\n \n as \n \n email\n \n, \n \n \n external_id\n \n as \n \n external_id\n \n, \n \n \n id\n \n as \n \n id\n \n, \n \n \n last_login_at\n \n as \n \n last_login_at\n \n, \n \n \n locale\n \n as \n \n locale\n \n, \n \n \n locale_id\n \n as \n \n locale_id\n \n, \n \n \n moderator\n \n as \n \n moderator\n \n, \n \n \n name\n \n as \n \n name\n \n, \n \n \n notes\n \n as \n \n notes\n \n, \n \n \n only_private_comments\n \n as \n \n only_private_comments\n \n, \n \n \n organization_id\n \n as \n \n organization_id\n \n, \n \n \n phone\n \n as \n \n phone\n \n, \n \n \n remote_photo_url\n \n as \n \n remote_photo_url\n \n, \n \n \n restricted_agent\n \n as \n \n restricted_agent\n \n, \n \n \n role\n \n as \n \n role\n \n, \n \n \n shared\n \n as \n \n shared\n \n, \n \n \n shared_agent\n \n as \n \n shared_agent\n \n, \n \n \n signature\n \n as \n \n signature\n \n, \n \n \n suspended\n \n as \n \n suspended\n \n, \n \n \n ticket_restriction\n \n as \n \n ticket_restriction\n \n, \n \n \n time_zone\n \n as \n \n time_zone\n \n, \n \n \n two_factor_auth_enabled\n \n as \n \n two_factor_auth_enabled\n \n, \n \n \n updated_at\n \n as \n \n updated_at\n \n, \n \n \n url\n \n as \n \n url\n \n, \n \n \n verified\n \n as \n \n verified\n \n\n\n\n \n from base\n),\n\nfinal as ( \n \n select \n id as user_id,\n external_id,\n _fivetran_synced,\n created_at,\n updated_at,\n email,\n name,\n organization_id,\n role,\n ticket_restriction,\n time_zone,\n locale,\n active as is_active,\n suspended as is_suspended,\n last_login_at\n from fields\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__user`"}, "model.zendesk_source.stg_zendesk__brand": {"raw_sql": "with base as (\n\n select * \n from {{ ref('stg_zendesk__brand_tmp') }}\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_zendesk__brand_tmp')),\n staging_columns=get_brand_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n id as brand_id,\n brand_url,\n name,\n subdomain,\n active as is_active\n from fields\n where not coalesce(_fivetran_deleted, false)\n)\n\nselect * \nfrom final", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "stg_zendesk__brand"], "unique_id": "model.zendesk_source.stg_zendesk__brand", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "stg_zendesk__brand.sql", "original_file_path": "models/stg_zendesk__brand.sql", "name": "stg_zendesk__brand", "resource_type": "model", "alias": "stg_zendesk__brand", "checksum": {"name": "sha256", "checksum": "eaf8b6e645dccfcee1bd72d80f1fd5c14fc86df2c084a843dc221c5ecab20fb0"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["stg_zendesk__brand_tmp"], ["stg_zendesk__brand_tmp"]], "sources": [], "depends_on": {"macros": ["macro.zendesk_source.get_brand_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.zendesk_source.stg_zendesk__brand_tmp", "model.zendesk_source.stg_zendesk__brand_tmp"]}, "description": "Brands are your customer-facing identities. They might represent multiple products or services, or they might literally be multiple brands owned and represented by your company.\n", "columns": {"brand_id": {"name": "brand_id", "description": "The ID automatically assigned when the brand is created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "brand_url": {"name": "brand_url", "description": "The url of the brand", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "The name of the brand", "meta": {}, "data_type": null, "quote": null, "tags": []}, "subdomain": {"name": "subdomain", "description": "The subdomain of the brand", "meta": {}, "data_type": null, "quote": null, "tags": []}, "active": {"name": "active", "description": "If the brand is set as active", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/stg_zendesk.yml", "build_path": "target/compiled/zendesk_source/models/stg_zendesk__brand.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging"}, "compiled_sql": "with base as (\n\n select * \n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__brand_tmp`\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n \n \n \n _fivetran_deleted\n \n as \n \n _fivetran_deleted\n \n, \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n active\n \n as \n \n active\n \n, \n \n \n brand_url\n \n as \n \n brand_url\n \n, \n \n \n has_help_center\n \n as \n \n has_help_center\n \n, \n \n \n help_center_state\n \n as \n \n help_center_state\n \n, \n \n \n id\n \n as \n \n id\n \n, \n \n \n logo_content_type\n \n as \n \n logo_content_type\n \n, \n \n \n logo_content_url\n \n as \n \n logo_content_url\n \n, \n \n \n logo_deleted\n \n as \n \n logo_deleted\n \n, \n \n \n logo_file_name\n \n as \n \n logo_file_name\n \n, \n \n \n logo_height\n \n as \n \n logo_height\n \n, \n \n \n logo_id\n \n as \n \n logo_id\n \n, \n \n \n logo_inline\n \n as \n \n logo_inline\n \n, \n \n \n logo_mapped_content_url\n \n as \n \n logo_mapped_content_url\n \n, \n \n \n logo_size\n \n as \n \n logo_size\n \n, \n \n \n logo_url\n \n as \n \n logo_url\n \n, \n \n \n logo_width\n \n as \n \n logo_width\n \n, \n \n \n name\n \n as \n \n name\n \n, \n \n \n subdomain\n \n as \n \n subdomain\n \n, \n \n \n url\n \n as \n \n url\n \n\n\n\n \n from base\n),\n\nfinal as (\n \n select \n id as brand_id,\n brand_url,\n name,\n subdomain,\n active as is_active\n from fields\n where not coalesce(_fivetran_deleted, false)\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__brand`"}, "model.zendesk_source.stg_zendesk__ticket_form_history": {"raw_sql": "--To disable this model, set the using_ticket_form_history variable within your dbt_project.yml file to False.\n{{ config(enabled=var('using_ticket_form_history', True)) }}\n\nwith base as (\n\n select * \n from {{ ref('stg_zendesk__ticket_form_history_tmp') }}\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_zendesk__ticket_form_history_tmp')),\n staging_columns=get_ticket_form_history_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n id as ticket_form_id,\n created_at,\n updated_at,\n display_name,\n active as is_active,\n name\n from fields\n where not coalesce(_fivetran_deleted, false)\n \n)\n\nselect * \nfrom final", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "stg_zendesk__ticket_form_history"], "unique_id": "model.zendesk_source.stg_zendesk__ticket_form_history", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "stg_zendesk__ticket_form_history.sql", "original_file_path": "models/stg_zendesk__ticket_form_history.sql", "name": "stg_zendesk__ticket_form_history", "resource_type": "model", "alias": "stg_zendesk__ticket_form_history", "checksum": {"name": "sha256", "checksum": "8297442248b1f3e4077d225d435fc55a0c0694bfb8d5527314d264cec8f34dcf"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["stg_zendesk__ticket_form_history_tmp"], ["stg_zendesk__ticket_form_history_tmp"]], "sources": [], "depends_on": {"macros": ["macro.zendesk_source.get_ticket_form_history_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.zendesk_source.stg_zendesk__ticket_form_history_tmp", "model.zendesk_source.stg_zendesk__ticket_form_history_tmp"]}, "description": "Ticket forms allow an admin to define a subset of ticket fields for display to both agents and end users.", "columns": {"ticket_form_id": {"name": "ticket_form_id", "description": "Automatically assigned when creating ticket form", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "The time the ticket form was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "The time of the last update of the ticket form", "meta": {}, "data_type": null, "quote": null, "tags": []}, "display_name": {"name": "display_name", "description": "The name of the form that is displayed to an end user", "meta": {}, "data_type": null, "quote": null, "tags": []}, "active": {"name": "active", "description": "If the form is set as active", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "The name of the form", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/stg_zendesk.yml", "build_path": "target/compiled/zendesk_source/models/stg_zendesk__ticket_form_history.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging", "enabled": true}, "compiled_sql": "--To disable this model, set the using_ticket_form_history variable within your dbt_project.yml file to False.\n\n\nwith base as (\n\n select * \n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket_form_history_tmp`\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n \n \n \n _fivetran_deleted\n \n as \n \n _fivetran_deleted\n \n, \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n active\n \n as \n \n active\n \n, \n \n \n created_at\n \n as \n \n created_at\n \n, \n \n \n display_name\n \n as \n \n display_name\n \n, \n \n \n end_user_visible\n \n as \n \n end_user_visible\n \n, \n \n \n id\n \n as \n \n id\n \n, \n \n \n name\n \n as \n \n name\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 id as ticket_form_id,\n created_at,\n updated_at,\n display_name,\n active as is_active,\n name\n from fields\n where not coalesce(_fivetran_deleted, false)\n \n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket_form_history`"}, "model.zendesk_source.stg_zendesk__domain_name": {"raw_sql": "--To disable this model, set the using_domain_names variable within your dbt_project.yml file to False.\n{{ config(enabled=var('using_domain_names', True)) }}\n\nwith base as (\n\n select * \n from {{ ref('stg_zendesk__domain_name_tmp') }}\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_zendesk__domain_name_tmp')),\n staging_columns=get_domain_name_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n organization_id,\n domain_name,\n index\n from fields\n)\n\nselect * \nfrom final", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "stg_zendesk__domain_name"], "unique_id": "model.zendesk_source.stg_zendesk__domain_name", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "stg_zendesk__domain_name.sql", "original_file_path": "models/stg_zendesk__domain_name.sql", "name": "stg_zendesk__domain_name", "resource_type": "model", "alias": "stg_zendesk__domain_name", "checksum": {"name": "sha256", "checksum": "356988d2b8fc14f75da81db2a0c8bef9531c7224ff0b3d6efac425ea5175a1b6"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["stg_zendesk__domain_name_tmp"], ["stg_zendesk__domain_name_tmp"]], "sources": [], "depends_on": {"macros": ["macro.zendesk_source.get_domain_name_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.zendesk_source.stg_zendesk__domain_name_tmp", "model.zendesk_source.stg_zendesk__domain_name_tmp"]}, "description": "Domain names associated with an organization. An organization may have multiple domain names.", "columns": {"organization_id": {"name": "organization_id", "description": "Reference to the organization", "meta": {}, "data_type": null, "quote": null, "tags": []}, "domain_name": {"name": "domain_name", "description": "The name of the domain associated with the organization", "meta": {}, "data_type": null, "quote": null, "tags": []}, "index": {"name": "index", "description": "Index number of the domain name associated with the organization", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/stg_zendesk.yml", "build_path": "target/compiled/zendesk_source/models/stg_zendesk__domain_name.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging", "enabled": true}, "compiled_sql": "--To disable this model, set the using_domain_names variable within your dbt_project.yml file to False.\n\n\nwith base as (\n\n select * \n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__domain_name_tmp`\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n domain_name\n \n as \n \n domain_name\n \n, \n \n \n index\n \n as \n \n index\n \n, \n \n \n organization_id\n \n as \n \n organization_id\n \n\n\n\n \n from base\n),\n\nfinal as (\n \n select \n organization_id,\n domain_name,\n index\n from fields\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__domain_name`"}, "model.zendesk_source.stg_zendesk__organization_tag": {"raw_sql": "--To disable this model, set the using_organization_tags variable within your dbt_project.yml file to False.\n{{ config(enabled=var('using_organization_tags', True)) }}\n\nwith base as (\n\n select * \n from {{ ref('stg_zendesk__organization_tag_tmp') }}\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_zendesk__organization_tag_tmp')),\n staging_columns=get_organization_tag_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n organization_id,\n {% if target.type == 'redshift' %}\n 'tag'\n {% else %}\n tag\n {% endif %}\n as tags\n from fields\n)\n\nselect * \nfrom final", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "stg_zendesk__organization_tag"], "unique_id": "model.zendesk_source.stg_zendesk__organization_tag", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "stg_zendesk__organization_tag.sql", "original_file_path": "models/stg_zendesk__organization_tag.sql", "name": "stg_zendesk__organization_tag", "resource_type": "model", "alias": "stg_zendesk__organization_tag", "checksum": {"name": "sha256", "checksum": "f52a16a097e2baeeaa61469f2ae266294958f1c50c98c42444f2262f2fd48a29"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["stg_zendesk__organization_tag_tmp"], ["stg_zendesk__organization_tag_tmp"]], "sources": [], "depends_on": {"macros": ["macro.zendesk_source.get_organization_tag_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.zendesk_source.stg_zendesk__organization_tag_tmp", "model.zendesk_source.stg_zendesk__organization_tag_tmp"]}, "description": "The tags associated with an organization. An organization may have multiple tags.", "columns": {"organization_id": {"name": "organization_id", "description": "Reference to the organization", "meta": {}, "data_type": null, "quote": null, "tags": []}, "tag": {"name": "tag", "description": "Tag associated with the organization", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/stg_zendesk.yml", "build_path": "target/compiled/zendesk_source/models/stg_zendesk__organization_tag.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging", "enabled": true}, "compiled_sql": "--To disable this model, set the using_organization_tags variable within your dbt_project.yml file to False.\n\n\nwith base as (\n\n select * \n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__organization_tag_tmp`\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n organization_id\n \n as \n \n organization_id\n \n, \n \n \n tag\n \n as \n \n tag\n \n\n\n\n \n from base\n),\n\nfinal as (\n \n select \n organization_id,\n \n tag\n \n as tags\n from fields\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__organization_tag`"}, "model.zendesk_source.stg_zendesk__ticket": {"raw_sql": "with base as (\n\n select * \n from {{ ref('stg_zendesk__ticket_tmp') }}\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_zendesk__ticket_tmp')),\n staging_columns=get_ticket_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n id as ticket_id,\n _fivetran_synced,\n assignee_id,\n brand_id,\n created_at,\n description,\n due_at,\n group_id,\n external_id,\n is_public,\n organization_id,\n priority,\n recipient,\n requester_id,\n status,\n subject,\n problem_id,\n submitter_id,\n ticket_form_id,\n type,\n updated_at,\n url,\n via_channel as created_channel,\n via_source_from_id as source_from_id,\n via_source_from_title as source_from_title,\n via_source_rel as source_rel,\n via_source_to_address as source_to_address,\n via_source_to_name as source_to_name\n from fields\n)\n\nselect * \nfrom final", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "stg_zendesk__ticket"], "unique_id": "model.zendesk_source.stg_zendesk__ticket", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "stg_zendesk__ticket.sql", "original_file_path": "models/stg_zendesk__ticket.sql", "name": "stg_zendesk__ticket", "resource_type": "model", "alias": "stg_zendesk__ticket", "checksum": {"name": "sha256", "checksum": "0dd31f8c704e8a80785c205105ff2878110b3451b4bf61b97118b5816facfe81"}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["stg_zendesk__ticket_tmp"], ["stg_zendesk__ticket_tmp"]], "sources": [], "depends_on": {"macros": ["macro.zendesk_source.get_ticket_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.zendesk_source.stg_zendesk__ticket_tmp", "model.zendesk_source.stg_zendesk__ticket_tmp"]}, "description": "Tickets are the means through which your end users (customers) communicate with agents in Zendesk Support. Tickets can originate from a number of channels, including email, Help Center, chat, phone call, Twitter, Facebook, or the API.\n", "columns": {"ticket_id": {"name": "ticket_id", "description": "Automatically assigned when the ticket is created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url": {"name": "url", "description": "The API url of this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_id": {"name": "assignee_id", "description": "The agent currently assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "brand_id": {"name": "brand_id", "description": "Enterprise only. The id of the brand this ticket is associated with", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "When this record was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "type": {"name": "type", "description": "The type of this ticket, possible values are problem, incident, question or task", "meta": {}, "data_type": null, "quote": null, "tags": []}, "subject": {"name": "subject", "description": "The value of the subject field for this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "description": {"name": "description", "description": "Read-only first comment on the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "priority": {"name": "priority", "description": "The urgency with which the ticket should be addressed, possible values are urgent, high, normal and low", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "The state of the ticket, possible values are new, open, pending, hold, solved and closed", "meta": {}, "data_type": null, "quote": null, "tags": []}, "recipient": {"name": "recipient", "description": "The original recipient e-mail address of the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_id": {"name": "requester_id", "description": "The user who requested this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_id": {"name": "submitter_id", "description": "The user who submitted the ticket. The submitter always becomes the author of the first comment on the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "organization_id": {"name": "organization_id", "description": "The organization of the requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "group_id": {"name": "group_id", "description": "The group this ticket is assigned to", "meta": {}, "data_type": null, "quote": null, "tags": []}, "due_at": {"name": "due_at", "description": "If this is a ticket of type \"task\" it has a due date. Due date format uses ISO 8601 format.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_form_id": {"name": "ticket_form_id", "description": "Enterprise only. The id of the ticket form to render for the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_public": {"name": "is_public", "description": "Is true if any comments are public, false otherwise", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "When this record last got updated", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_channel": {"name": "created_channel", "description": "The channel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_from_id": {"name": "source_from_id", "description": "The channel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_from_title": {"name": "source_from_title", "description": "The channel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_rel": {"name": "source_rel", "description": "The rel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_to_address": {"name": "source_to_address", "description": "The address of the source the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_to_name": {"name": "source_to_name", "description": "The name of the source the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "models/stg_zendesk.yml", "build_path": "target/compiled/zendesk_source/models/stg_zendesk__ticket.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging"}, "compiled_sql": "with base as (\n\n select * \n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket_tmp`\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n allow_channelback\n \n as \n \n allow_channelback\n \n, \n \n \n assignee_id\n \n as \n \n assignee_id\n \n, \n \n \n brand_id\n \n as \n \n brand_id\n \n, \n \n \n created_at\n \n as \n \n created_at\n \n, \n \n \n description\n \n as \n \n description\n \n, \n \n \n due_at\n \n as \n \n due_at\n \n, \n \n \n external_id\n \n as \n \n external_id\n \n, \n \n \n forum_topic_id\n \n as \n \n forum_topic_id\n \n, \n \n \n group_id\n \n as \n \n group_id\n \n, \n \n \n has_incidents\n \n as \n \n has_incidents\n \n, \n \n \n id\n \n as \n \n id\n \n, \n \n \n is_public\n \n as \n \n is_public\n \n, \n \n \n merged_ticket_ids\n \n as \n \n merged_ticket_ids\n \n, \n \n \n organization_id\n \n as \n \n organization_id\n \n, \n \n \n priority\n \n as \n \n priority\n \n, \n \n \n problem_id\n \n as \n \n problem_id\n \n, \n \n \n recipient\n \n as \n \n recipient\n \n, \n \n \n requester_id\n \n as \n \n requester_id\n \n, \n \n \n status\n \n as \n \n status\n \n, \n \n \n subject\n \n as \n \n subject\n \n, \n \n \n submitter_id\n \n as \n \n submitter_id\n \n, \n cast(null as \n int64\n) as \n \n system_ccs\n \n , \n \n \n system_client\n \n as \n \n system_client\n \n, \n cast(null as \n string\n) as \n \n system_ip_address\n \n , \n cast(null as \n int64\n) as \n \n system_json_email_identifier\n \n , \n cast(null as \n float64\n) as \n \n system_latitude\n \n , \n cast(null as \n string\n) as \n \n system_location\n \n , \n cast(null as \n float64\n) as \n \n system_longitude\n \n , \n cast(null as \n int64\n) as \n \n system_machine_generated\n \n , \n cast(null as \n int64\n) as \n \n system_message_id\n \n , \n cast(null as \n int64\n) as \n \n system_raw_email_identifier\n \n , \n \n \n ticket_form_id\n \n as \n \n ticket_form_id\n \n, \n \n \n type\n \n as \n \n type\n \n, \n \n \n updated_at\n \n as \n \n updated_at\n \n, \n \n \n url\n \n as \n \n url\n \n, \n \n \n via_channel\n \n as \n \n via_channel\n \n, \n \n \n via_source_from_address\n \n as \n \n via_source_from_address\n \n, \n \n \n via_source_from_id\n \n as \n \n via_source_from_id\n \n, \n \n \n via_source_from_title\n \n as \n \n via_source_from_title\n \n, \n \n \n via_source_rel\n \n as \n \n via_source_rel\n \n, \n \n \n via_source_to_address\n \n as \n \n via_source_to_address\n \n, \n \n \n via_source_to_name\n \n as \n \n via_source_to_name\n \n\n\n\n \n from base\n),\n\nfinal as (\n \n select \n id as ticket_id,\n _fivetran_synced,\n assignee_id,\n brand_id,\n created_at,\n description,\n due_at,\n group_id,\n external_id,\n is_public,\n organization_id,\n priority,\n recipient,\n requester_id,\n status,\n subject,\n problem_id,\n submitter_id,\n ticket_form_id,\n type,\n updated_at,\n url,\n via_channel as created_channel,\n via_source_from_id as source_from_id,\n via_source_from_title as source_from_title,\n via_source_rel as source_rel,\n via_source_to_address as source_to_address,\n via_source_to_name as source_to_name\n from fields\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket`"}, "model.zendesk_source.stg_zendesk__user_tmp": {"raw_sql": "select * \nfrom {{ var('user') }}", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "tmp", "stg_zendesk__user_tmp"], "unique_id": "model.zendesk_source.stg_zendesk__user_tmp", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "tmp/stg_zendesk__user_tmp.sql", "original_file_path": "models/tmp/stg_zendesk__user_tmp.sql", "name": "stg_zendesk__user_tmp", "resource_type": "model", "alias": "stg_zendesk__user_tmp", "checksum": {"name": "sha256", "checksum": "6a45d1112d3ae79f22784f5fd5723a27b7894d57aea5795a37921842affc0085"}, "config": {"enabled": true, "materialized": "view", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["user_data"]], "sources": [], "depends_on": {"macros": ["macro.fivetran_utils.snowflake_seed_data"], "nodes": ["seed.zendesk_integration_tests.user_data"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk_source/models/tmp/stg_zendesk__user_tmp.sql", "deferred": false, "unrendered_config": {"materialized": "view", "schema": "zendesk_staging"}, "compiled_sql": "select * \nfrom `dbt-package-testing`.`zendesk_integration_tests`.`user_data`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__user_tmp`"}, "model.zendesk_source.stg_zendesk__group_tmp": {"raw_sql": "select * \nfrom {{ var('group') }}", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "tmp", "stg_zendesk__group_tmp"], "unique_id": "model.zendesk_source.stg_zendesk__group_tmp", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "tmp/stg_zendesk__group_tmp.sql", "original_file_path": "models/tmp/stg_zendesk__group_tmp.sql", "name": "stg_zendesk__group_tmp", "resource_type": "model", "alias": "stg_zendesk__group_tmp", "checksum": {"name": "sha256", "checksum": "f8e6c8c86b8fd6cea489c85641677a5ec978e5fa5d7ecd73cdf89eb25a533905"}, "config": {"enabled": true, "materialized": "view", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["group_data"]], "sources": [], "depends_on": {"macros": [], "nodes": ["seed.zendesk_integration_tests.group_data"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk_source/models/tmp/stg_zendesk__group_tmp.sql", "deferred": false, "unrendered_config": {"materialized": "view", "schema": "zendesk_staging"}, "compiled_sql": "select * \nfrom `dbt-package-testing`.`zendesk_integration_tests`.`group_data`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__group_tmp`"}, "model.zendesk_source.stg_zendesk__ticket_tmp": {"raw_sql": "select * \nfrom {{ var('ticket') }}", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "tmp", "stg_zendesk__ticket_tmp"], "unique_id": "model.zendesk_source.stg_zendesk__ticket_tmp", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "tmp/stg_zendesk__ticket_tmp.sql", "original_file_path": "models/tmp/stg_zendesk__ticket_tmp.sql", "name": "stg_zendesk__ticket_tmp", "resource_type": "model", "alias": "stg_zendesk__ticket_tmp", "checksum": {"name": "sha256", "checksum": "19b2466ae73fd66df0348a3b03e757b40fc5f85bd6d99c893626f55e8c69d2ca"}, "config": {"enabled": true, "materialized": "view", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["ticket_data"]], "sources": [], "depends_on": {"macros": [], "nodes": ["seed.zendesk_integration_tests.ticket_data"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk_source/models/tmp/stg_zendesk__ticket_tmp.sql", "deferred": false, "unrendered_config": {"materialized": "view", "schema": "zendesk_staging"}, "compiled_sql": "select * \nfrom `dbt-package-testing`.`zendesk_integration_tests`.`ticket_data`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket_tmp`"}, "model.zendesk_source.stg_zendesk__brand_tmp": {"raw_sql": "select * \nfrom {{ var('brand') }}", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "tmp", "stg_zendesk__brand_tmp"], "unique_id": "model.zendesk_source.stg_zendesk__brand_tmp", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "tmp/stg_zendesk__brand_tmp.sql", "original_file_path": "models/tmp/stg_zendesk__brand_tmp.sql", "name": "stg_zendesk__brand_tmp", "resource_type": "model", "alias": "stg_zendesk__brand_tmp", "checksum": {"name": "sha256", "checksum": "58555c5a87cdf4ff202901b74ac2e6dbf7e01dd675aa86e8f8937f74685ca8a2"}, "config": {"enabled": true, "materialized": "view", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["brand_data"]], "sources": [], "depends_on": {"macros": [], "nodes": ["seed.zendesk_integration_tests.brand_data"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk_source/models/tmp/stg_zendesk__brand_tmp.sql", "deferred": false, "unrendered_config": {"materialized": "view", "schema": "zendesk_staging"}, "compiled_sql": "select * \nfrom `dbt-package-testing`.`zendesk_integration_tests`.`brand_data`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__brand_tmp`"}, "model.zendesk_source.stg_zendesk__ticket_tag_tmp": {"raw_sql": "select * \nfrom {{ var('ticket_tag') }}", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "tmp", "stg_zendesk__ticket_tag_tmp"], "unique_id": "model.zendesk_source.stg_zendesk__ticket_tag_tmp", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "tmp/stg_zendesk__ticket_tag_tmp.sql", "original_file_path": "models/tmp/stg_zendesk__ticket_tag_tmp.sql", "name": "stg_zendesk__ticket_tag_tmp", "resource_type": "model", "alias": "stg_zendesk__ticket_tag_tmp", "checksum": {"name": "sha256", "checksum": "bd1c6e36c872436d5b0225cc21df29fa2f97864083d67175a6fed09d8b79d5ef"}, "config": {"enabled": true, "materialized": "view", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["ticket_tag_data"]], "sources": [], "depends_on": {"macros": [], "nodes": ["seed.zendesk_integration_tests.ticket_tag_data"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk_source/models/tmp/stg_zendesk__ticket_tag_tmp.sql", "deferred": false, "unrendered_config": {"materialized": "view", "schema": "zendesk_staging"}, "compiled_sql": "select * \nfrom `dbt-package-testing`.`zendesk_integration_tests`.`ticket_tag_data`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket_tag_tmp`"}, "model.zendesk_source.stg_zendesk__user_tag_tmp": {"raw_sql": "--To disable this model, set the using_user_tags variable within your dbt_project.yml file to False.\n{{ config(enabled=var('using_user_tags', True)) }}\n\nselect * \nfrom {{ var('user_tag') }}", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "tmp", "stg_zendesk__user_tag_tmp"], "unique_id": "model.zendesk_source.stg_zendesk__user_tag_tmp", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "tmp/stg_zendesk__user_tag_tmp.sql", "original_file_path": "models/tmp/stg_zendesk__user_tag_tmp.sql", "name": "stg_zendesk__user_tag_tmp", "resource_type": "model", "alias": "stg_zendesk__user_tag_tmp", "checksum": {"name": "sha256", "checksum": "b852c972b7d1dbdf738108c7d5b1b6aff4f2215a1bb6afbb6bb1696c2be0f0c9"}, "config": {"enabled": true, "materialized": "view", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["user_tag_data"]], "sources": [], "depends_on": {"macros": ["macro.fivetran_utils.snowflake_seed_data"], "nodes": ["seed.zendesk_integration_tests.user_tag_data"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk_source/models/tmp/stg_zendesk__user_tag_tmp.sql", "deferred": false, "unrendered_config": {"materialized": "view", "schema": "zendesk_staging", "enabled": true}, "compiled_sql": "--To disable this model, set the using_user_tags variable within your dbt_project.yml file to False.\n\n\nselect * \nfrom `dbt-package-testing`.`zendesk_integration_tests`.`user_tag_data`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__user_tag_tmp`"}, "model.zendesk_source.stg_zendesk__ticket_field_history_tmp": {"raw_sql": "select * \nfrom {{ var('ticket_field_history') }}", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "tmp", "stg_zendesk__ticket_field_history_tmp"], "unique_id": "model.zendesk_source.stg_zendesk__ticket_field_history_tmp", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "tmp/stg_zendesk__ticket_field_history_tmp.sql", "original_file_path": "models/tmp/stg_zendesk__ticket_field_history_tmp.sql", "name": "stg_zendesk__ticket_field_history_tmp", "resource_type": "model", "alias": "stg_zendesk__ticket_field_history_tmp", "checksum": {"name": "sha256", "checksum": "6f06e6d418e0f6f8b8c02256c24e75add9a1b33d8e0c2515bad04dc6db404ff1"}, "config": {"enabled": true, "materialized": "view", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["ticket_field_history_data"]], "sources": [], "depends_on": {"macros": [], "nodes": ["seed.zendesk_integration_tests.ticket_field_history_data"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk_source/models/tmp/stg_zendesk__ticket_field_history_tmp.sql", "deferred": false, "unrendered_config": {"materialized": "view", "schema": "zendesk_staging"}, "compiled_sql": "select * \nfrom `dbt-package-testing`.`zendesk_integration_tests`.`ticket_field_history_data`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket_field_history_tmp`"}, "model.zendesk_source.stg_zendesk__ticket_form_history_tmp": {"raw_sql": "--To disable this model, set the using_ticket_form_history variable within your dbt_project.yml file to False.\n{{ config(enabled=var('using_ticket_form_history', True)) }}\n\nselect * \nfrom {{ var('ticket_form_history') }}", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "tmp", "stg_zendesk__ticket_form_history_tmp"], "unique_id": "model.zendesk_source.stg_zendesk__ticket_form_history_tmp", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "tmp/stg_zendesk__ticket_form_history_tmp.sql", "original_file_path": "models/tmp/stg_zendesk__ticket_form_history_tmp.sql", "name": "stg_zendesk__ticket_form_history_tmp", "resource_type": "model", "alias": "stg_zendesk__ticket_form_history_tmp", "checksum": {"name": "sha256", "checksum": "c982594d09e47ffcf3513e6b8443d208baf26f2df376bfa2e2f9fb95e1a05ec5"}, "config": {"enabled": true, "materialized": "view", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["ticket_form_history_data"]], "sources": [], "depends_on": {"macros": [], "nodes": ["seed.zendesk_integration_tests.ticket_form_history_data"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk_source/models/tmp/stg_zendesk__ticket_form_history_tmp.sql", "deferred": false, "unrendered_config": {"materialized": "view", "schema": "zendesk_staging", "enabled": true}, "compiled_sql": "--To disable this model, set the using_ticket_form_history variable within your dbt_project.yml file to False.\n\n\nselect * \nfrom `dbt-package-testing`.`zendesk_integration_tests`.`ticket_form_history_data`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket_form_history_tmp`"}, "model.zendesk_source.stg_zendesk__ticket_comment_tmp": {"raw_sql": "select * \nfrom {{ var('ticket_comment') }}", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "tmp", "stg_zendesk__ticket_comment_tmp"], "unique_id": "model.zendesk_source.stg_zendesk__ticket_comment_tmp", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "tmp/stg_zendesk__ticket_comment_tmp.sql", "original_file_path": "models/tmp/stg_zendesk__ticket_comment_tmp.sql", "name": "stg_zendesk__ticket_comment_tmp", "resource_type": "model", "alias": "stg_zendesk__ticket_comment_tmp", "checksum": {"name": "sha256", "checksum": "0f14f6e0dc38eac86f58cec21d12d25fcdd916e7f31bceff35cc0766da2ab560"}, "config": {"enabled": true, "materialized": "view", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["ticket_comment_data"]], "sources": [], "depends_on": {"macros": [], "nodes": ["seed.zendesk_integration_tests.ticket_comment_data"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk_source/models/tmp/stg_zendesk__ticket_comment_tmp.sql", "deferred": false, "unrendered_config": {"materialized": "view", "schema": "zendesk_staging"}, "compiled_sql": "select * \nfrom `dbt-package-testing`.`zendesk_integration_tests`.`ticket_comment_data`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket_comment_tmp`"}, "model.zendesk_source.stg_zendesk__organization_tag_tmp": {"raw_sql": "--To disable this model, set the using_organization_tags variable within your dbt_project.yml file to False.\n{{ config(enabled=var('using_organization_tags', True)) }}\n\nselect * \nfrom {{ var('organization_tag') }}", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "tmp", "stg_zendesk__organization_tag_tmp"], "unique_id": "model.zendesk_source.stg_zendesk__organization_tag_tmp", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "tmp/stg_zendesk__organization_tag_tmp.sql", "original_file_path": "models/tmp/stg_zendesk__organization_tag_tmp.sql", "name": "stg_zendesk__organization_tag_tmp", "resource_type": "model", "alias": "stg_zendesk__organization_tag_tmp", "checksum": {"name": "sha256", "checksum": "371025f2faaebbcaa7b7d612cad719c47e7bb7ec0adb2d514be59dd154000924"}, "config": {"enabled": true, "materialized": "view", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["organization_tag_data"]], "sources": [], "depends_on": {"macros": ["macro.fivetran_utils.snowflake_seed_data"], "nodes": ["seed.zendesk_integration_tests.organization_tag_data"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk_source/models/tmp/stg_zendesk__organization_tag_tmp.sql", "deferred": false, "unrendered_config": {"materialized": "view", "schema": "zendesk_staging", "enabled": true}, "compiled_sql": "--To disable this model, set the using_organization_tags variable within your dbt_project.yml file to False.\n\n\nselect * \nfrom `dbt-package-testing`.`zendesk_integration_tests`.`organization_tag_data`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__organization_tag_tmp`"}, "model.zendesk_source.stg_zendesk__schedule_tmp": {"raw_sql": "--To disable this model, set the using_schedules variable within your dbt_project.yml file to False.\n{{ config(enabled=var('using_schedules', True)) }}\n\nselect * \nfrom {{ var('schedule') }}", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "tmp", "stg_zendesk__schedule_tmp"], "unique_id": "model.zendesk_source.stg_zendesk__schedule_tmp", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "tmp/stg_zendesk__schedule_tmp.sql", "original_file_path": "models/tmp/stg_zendesk__schedule_tmp.sql", "name": "stg_zendesk__schedule_tmp", "resource_type": "model", "alias": "stg_zendesk__schedule_tmp", "checksum": {"name": "sha256", "checksum": "e14f77042a8f64d285a76897176d96cae381a464cc944a5af7e3ec0c91122947"}, "config": {"enabled": true, "materialized": "view", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["schedule_data"]], "sources": [], "depends_on": {"macros": [], "nodes": ["seed.zendesk_integration_tests.schedule_data"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk_source/models/tmp/stg_zendesk__schedule_tmp.sql", "deferred": false, "unrendered_config": {"materialized": "view", "schema": "zendesk_staging", "enabled": true}, "compiled_sql": "--To disable this model, set the using_schedules variable within your dbt_project.yml file to False.\n\n\nselect * \nfrom `dbt-package-testing`.`zendesk_integration_tests`.`schedule_data`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__schedule_tmp`"}, "model.zendesk_source.stg_zendesk__organization_tmp": {"raw_sql": "select * \nfrom {{ var('organization') }}", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "tmp", "stg_zendesk__organization_tmp"], "unique_id": "model.zendesk_source.stg_zendesk__organization_tmp", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "tmp/stg_zendesk__organization_tmp.sql", "original_file_path": "models/tmp/stg_zendesk__organization_tmp.sql", "name": "stg_zendesk__organization_tmp", "resource_type": "model", "alias": "stg_zendesk__organization_tmp", "checksum": {"name": "sha256", "checksum": "2f3e00296ea52db703431b38d4d3f523f83a2a4a2e87607c8c79378b169835f8"}, "config": {"enabled": true, "materialized": "view", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["organization_data"]], "sources": [], "depends_on": {"macros": [], "nodes": ["seed.zendesk_integration_tests.organization_data"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk_source/models/tmp/stg_zendesk__organization_tmp.sql", "deferred": false, "unrendered_config": {"materialized": "view", "schema": "zendesk_staging"}, "compiled_sql": "select * \nfrom `dbt-package-testing`.`zendesk_integration_tests`.`organization_data`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__organization_tmp`"}, "model.zendesk_source.stg_zendesk__ticket_schedule_tmp": {"raw_sql": "--To disable this model, set the using_schedules variable within your dbt_project.yml file to False.\n{{ config(enabled=var('using_schedules', True)) }}\n\n{%- set source_relation = adapter.get_relation(\n database=source('zendesk', 'ticket_schedule').database,\n schema=source('zendesk', 'ticket_schedule').schema,\n identifier=source('zendesk', 'ticket_schedule').name) -%}\n\n{% set table_exists=source_relation is not none %}\n\n{% if table_exists %}\n\nselect *\nfrom {{ source('zendesk', 'ticket_schedule') }}\n\n{% else %}\n\nselect\n cast(null as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced,\n cast(null as {{ dbt_utils.type_timestamp() }}) as created_at,\n cast(null as {{ dbt_utils.type_int() }}) as schedule_id,\n cast(null as {{ dbt_utils.type_int() }}) as ticket_id\n\n{% endif %}", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "tmp", "stg_zendesk__ticket_schedule_tmp"], "unique_id": "model.zendesk_source.stg_zendesk__ticket_schedule_tmp", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "tmp/stg_zendesk__ticket_schedule_tmp.sql", "original_file_path": "models/tmp/stg_zendesk__ticket_schedule_tmp.sql", "name": "stg_zendesk__ticket_schedule_tmp", "resource_type": "model", "alias": "stg_zendesk__ticket_schedule_tmp", "checksum": {"name": "sha256", "checksum": "15e5b270de6a25bf52311df259a5969b24cb1ce513eaa4a11af74c4d6b854ad0"}, "config": {"enabled": true, "materialized": "view", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [], "sources": [["zendesk", "ticket_schedule"], ["zendesk", "ticket_schedule"], ["zendesk", "ticket_schedule"]], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_int"], "nodes": ["source.zendesk_source.zendesk.ticket_schedule", "source.zendesk_source.zendesk.ticket_schedule", "source.zendesk_source.zendesk.ticket_schedule"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk_source/models/tmp/stg_zendesk__ticket_schedule_tmp.sql", "deferred": false, "unrendered_config": {"materialized": "view", "schema": "zendesk_staging", "enabled": true}, "compiled_sql": "--To disable this model, set the using_schedules variable within your dbt_project.yml file to False.\n\n\n\n\nselect\n cast(null as \n timestamp\n) as _fivetran_synced,\n cast(null as \n timestamp\n) as created_at,\n cast(null as \n int64\n) as schedule_id,\n cast(null as \n int64\n) as ticket_id\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket_schedule_tmp`"}, "model.zendesk_source.stg_zendesk__domain_name_tmp": {"raw_sql": "--To disable this model, set the using_domain_names variable within your dbt_project.yml file to False.\n{{ config(enabled=var('using_domain_names', True)) }}\n\nselect * \nfrom {{ var('domain_name') }}", "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "tmp", "stg_zendesk__domain_name_tmp"], "unique_id": "model.zendesk_source.stg_zendesk__domain_name_tmp", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "tmp/stg_zendesk__domain_name_tmp.sql", "original_file_path": "models/tmp/stg_zendesk__domain_name_tmp.sql", "name": "stg_zendesk__domain_name_tmp", "resource_type": "model", "alias": "stg_zendesk__domain_name_tmp", "checksum": {"name": "sha256", "checksum": "0146a0dae63eb5aec2a78e50244874689f5ad1db8135f68c9f2806314e22d477"}, "config": {"enabled": true, "materialized": "view", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null}, "tags": [], "refs": [["domain_name_data"]], "sources": [], "depends_on": {"macros": [], "nodes": ["seed.zendesk_integration_tests.domain_name_data"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk_source/models/tmp/stg_zendesk__domain_name_tmp.sql", "deferred": false, "unrendered_config": {"materialized": "view", "schema": "zendesk_staging", "enabled": true}, "compiled_sql": "--To disable this model, set the using_domain_names variable within your dbt_project.yml file to False.\n\n\nselect * \nfrom `dbt-package-testing`.`zendesk_integration_tests`.`domain_name_data`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__domain_name_tmp`"}, "test.zendesk_source.unique_stg_zendesk__ticket_ticket_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_unique(**_dbt_schema_test_kwargs) }}", "test_metadata": {"namespace": null, "name": "unique", "kwargs": {"column_name": "ticket_id", "model": "{{ ref('stg_zendesk__ticket') }}"}}, "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "schema_test", "unique_stg_zendesk__ticket_ticket_id"], "unique_id": "test.zendesk_source.unique_stg_zendesk__ticket_ticket_id", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "schema_test/unique_stg_zendesk__ticket_ticket_id.sql", "original_file_path": "models/stg_zendesk.yml", "name": "unique_stg_zendesk__ticket_ticket_id", "resource_type": "test", "alias": "unique_stg_zendesk__ticket_ticket_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR"}, "tags": ["schema"], "refs": [["stg_zendesk__ticket"]], "sources": [], "depends_on": {"macros": ["macro.dbt.test_unique"], "nodes": ["model.zendesk_source.stg_zendesk__ticket"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk_source/models/stg_zendesk.yml/schema_test/unique_stg_zendesk__ticket_ticket_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom (\n\n select\n ticket_id\n\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket`\n where ticket_id is not null\n group by ticket_id\n having count(*) > 1\n\n) validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ticket_id"}, "test.zendesk_source.not_null_stg_zendesk__ticket_ticket_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"namespace": null, "name": "not_null", "kwargs": {"column_name": "ticket_id", "model": "{{ ref('stg_zendesk__ticket') }}"}}, "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "schema_test", "not_null_stg_zendesk__ticket_ticket_id"], "unique_id": "test.zendesk_source.not_null_stg_zendesk__ticket_ticket_id", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "schema_test/not_null_stg_zendesk__ticket_ticket_id.sql", "original_file_path": "models/stg_zendesk.yml", "name": "not_null_stg_zendesk__ticket_ticket_id", "resource_type": "test", "alias": "not_null_stg_zendesk__ticket_ticket_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR"}, "tags": ["schema"], "refs": [["stg_zendesk__ticket"]], "sources": [], "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.zendesk_source.stg_zendesk__ticket"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk_source/models/stg_zendesk.yml/schema_test/not_null_stg_zendesk__ticket_ticket_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket`\nwhere ticket_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ticket_id"}, "test.zendesk_source.unique_stg_zendesk__brand_brand_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_unique(**_dbt_schema_test_kwargs) }}", "test_metadata": {"namespace": null, "name": "unique", "kwargs": {"column_name": "brand_id", "model": "{{ ref('stg_zendesk__brand') }}"}}, "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "schema_test", "unique_stg_zendesk__brand_brand_id"], "unique_id": "test.zendesk_source.unique_stg_zendesk__brand_brand_id", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "schema_test/unique_stg_zendesk__brand_brand_id.sql", "original_file_path": "models/stg_zendesk.yml", "name": "unique_stg_zendesk__brand_brand_id", "resource_type": "test", "alias": "unique_stg_zendesk__brand_brand_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR"}, "tags": ["schema"], "refs": [["stg_zendesk__brand"]], "sources": [], "depends_on": {"macros": ["macro.dbt.test_unique"], "nodes": ["model.zendesk_source.stg_zendesk__brand"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk_source/models/stg_zendesk.yml/schema_test/unique_stg_zendesk__brand_brand_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom (\n\n select\n brand_id\n\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__brand`\n where brand_id is not null\n group by brand_id\n having count(*) > 1\n\n) validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "brand_id"}, "test.zendesk_source.not_null_stg_zendesk__brand_brand_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"namespace": null, "name": "not_null", "kwargs": {"column_name": "brand_id", "model": "{{ ref('stg_zendesk__brand') }}"}}, "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "schema_test", "not_null_stg_zendesk__brand_brand_id"], "unique_id": "test.zendesk_source.not_null_stg_zendesk__brand_brand_id", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "schema_test/not_null_stg_zendesk__brand_brand_id.sql", "original_file_path": "models/stg_zendesk.yml", "name": "not_null_stg_zendesk__brand_brand_id", "resource_type": "test", "alias": "not_null_stg_zendesk__brand_brand_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR"}, "tags": ["schema"], "refs": [["stg_zendesk__brand"]], "sources": [], "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.zendesk_source.stg_zendesk__brand"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk_source/models/stg_zendesk.yml/schema_test/not_null_stg_zendesk__brand_brand_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__brand`\nwhere brand_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "brand_id"}, "test.zendesk_source.not_null_stg_zendesk__domain_name_organization_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"namespace": null, "name": "not_null", "kwargs": {"column_name": "organization_id", "model": "{{ ref('stg_zendesk__domain_name') }}"}}, "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "schema_test", "not_null_stg_zendesk__domain_name_organization_id"], "unique_id": "test.zendesk_source.not_null_stg_zendesk__domain_name_organization_id", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "schema_test/not_null_stg_zendesk__domain_name_organization_id.sql", "original_file_path": "models/stg_zendesk.yml", "name": "not_null_stg_zendesk__domain_name_organization_id", "resource_type": "test", "alias": "not_null_stg_zendesk__domain_name_organization_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR"}, "tags": ["schema"], "refs": [["stg_zendesk__domain_name"]], "sources": [], "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.zendesk_source.stg_zendesk__domain_name"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk_source/models/stg_zendesk.yml/schema_test/not_null_stg_zendesk__domain_name_organization_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__domain_name`\nwhere organization_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "organization_id"}, "test.zendesk_source.unique_stg_zendesk__group_group_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_unique(**_dbt_schema_test_kwargs) }}", "test_metadata": {"namespace": null, "name": "unique", "kwargs": {"column_name": "group_id", "model": "{{ ref('stg_zendesk__group') }}"}}, "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "schema_test", "unique_stg_zendesk__group_group_id"], "unique_id": "test.zendesk_source.unique_stg_zendesk__group_group_id", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "schema_test/unique_stg_zendesk__group_group_id.sql", "original_file_path": "models/stg_zendesk.yml", "name": "unique_stg_zendesk__group_group_id", "resource_type": "test", "alias": "unique_stg_zendesk__group_group_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR"}, "tags": ["schema"], "refs": [["stg_zendesk__group"]], "sources": [], "depends_on": {"macros": ["macro.dbt.test_unique"], "nodes": ["model.zendesk_source.stg_zendesk__group"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk_source/models/stg_zendesk.yml/schema_test/unique_stg_zendesk__group_group_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom (\n\n select\n group_id\n\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__group`\n where group_id is not null\n group by group_id\n having count(*) > 1\n\n) validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "group_id"}, "test.zendesk_source.not_null_stg_zendesk__group_group_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"namespace": null, "name": "not_null", "kwargs": {"column_name": "group_id", "model": "{{ ref('stg_zendesk__group') }}"}}, "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "schema_test", "not_null_stg_zendesk__group_group_id"], "unique_id": "test.zendesk_source.not_null_stg_zendesk__group_group_id", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "schema_test/not_null_stg_zendesk__group_group_id.sql", "original_file_path": "models/stg_zendesk.yml", "name": "not_null_stg_zendesk__group_group_id", "resource_type": "test", "alias": "not_null_stg_zendesk__group_group_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR"}, "tags": ["schema"], "refs": [["stg_zendesk__group"]], "sources": [], "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.zendesk_source.stg_zendesk__group"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk_source/models/stg_zendesk.yml/schema_test/not_null_stg_zendesk__group_group_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__group`\nwhere group_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "group_id"}, "test.zendesk_source.unique_stg_zendesk__organization_organization_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_unique(**_dbt_schema_test_kwargs) }}", "test_metadata": {"namespace": null, "name": "unique", "kwargs": {"column_name": "organization_id", "model": "{{ ref('stg_zendesk__organization') }}"}}, "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "schema_test", "unique_stg_zendesk__organization_organization_id"], "unique_id": "test.zendesk_source.unique_stg_zendesk__organization_organization_id", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "schema_test/unique_stg_zendesk__organization_organization_id.sql", "original_file_path": "models/stg_zendesk.yml", "name": "unique_stg_zendesk__organization_organization_id", "resource_type": "test", "alias": "unique_stg_zendesk__organization_organization_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR"}, "tags": ["schema"], "refs": [["stg_zendesk__organization"]], "sources": [], "depends_on": {"macros": ["macro.dbt.test_unique"], "nodes": ["model.zendesk_source.stg_zendesk__organization"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk_source/models/stg_zendesk.yml/schema_test/unique_stg_zendesk__organization_organization_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom (\n\n select\n organization_id\n\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__organization`\n where organization_id is not null\n group by organization_id\n having count(*) > 1\n\n) validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "organization_id"}, "test.zendesk_source.not_null_stg_zendesk__organization_organization_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"namespace": null, "name": "not_null", "kwargs": {"column_name": "organization_id", "model": "{{ ref('stg_zendesk__organization') }}"}}, "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "schema_test", "not_null_stg_zendesk__organization_organization_id"], "unique_id": "test.zendesk_source.not_null_stg_zendesk__organization_organization_id", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "schema_test/not_null_stg_zendesk__organization_organization_id.sql", "original_file_path": "models/stg_zendesk.yml", "name": "not_null_stg_zendesk__organization_organization_id", "resource_type": "test", "alias": "not_null_stg_zendesk__organization_organization_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR"}, "tags": ["schema"], "refs": [["stg_zendesk__organization"]], "sources": [], "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.zendesk_source.stg_zendesk__organization"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk_source/models/stg_zendesk.yml/schema_test/not_null_stg_zendesk__organization_organization_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__organization`\nwhere organization_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "organization_id"}, "test.zendesk_source.unique_stg_zendesk__ticket_comment_ticket_comment_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_unique(**_dbt_schema_test_kwargs) }}", "test_metadata": {"namespace": null, "name": "unique", "kwargs": {"column_name": "ticket_comment_id", "model": "{{ ref('stg_zendesk__ticket_comment') }}"}}, "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "schema_test", "unique_stg_zendesk__ticket_comment_ticket_comment_id"], "unique_id": "test.zendesk_source.unique_stg_zendesk__ticket_comment_ticket_comment_id", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "schema_test/unique_stg_zendesk__ticket_comment_ticket_comment_id.sql", "original_file_path": "models/stg_zendesk.yml", "name": "unique_stg_zendesk__ticket_comment_ticket_comment_id", "resource_type": "test", "alias": "unique_stg_zendesk__ticket_comment_ticket_comment_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR"}, "tags": ["schema"], "refs": [["stg_zendesk__ticket_comment"]], "sources": [], "depends_on": {"macros": ["macro.dbt.test_unique"], "nodes": ["model.zendesk_source.stg_zendesk__ticket_comment"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk_source/models/stg_zendesk.yml/schema_test/unique_stg_zendesk__ticket_comment_ticket_comment_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom (\n\n select\n ticket_comment_id\n\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket_comment`\n where ticket_comment_id is not null\n group by ticket_comment_id\n having count(*) > 1\n\n) validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ticket_comment_id"}, "test.zendesk_source.not_null_stg_zendesk__ticket_comment_ticket_comment_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"namespace": null, "name": "not_null", "kwargs": {"column_name": "ticket_comment_id", "model": "{{ ref('stg_zendesk__ticket_comment') }}"}}, "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "schema_test", "not_null_stg_zendesk__ticket_comment_ticket_comment_id"], "unique_id": "test.zendesk_source.not_null_stg_zendesk__ticket_comment_ticket_comment_id", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "schema_test/not_null_stg_zendesk__ticket_comment_ticket_comment_id.sql", "original_file_path": "models/stg_zendesk.yml", "name": "not_null_stg_zendesk__ticket_comment_ticket_comment_id", "resource_type": "test", "alias": "not_null_stg_zendesk__ticket_comment_ticket_comment_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR"}, "tags": ["schema"], "refs": [["stg_zendesk__ticket_comment"]], "sources": [], "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.zendesk_source.stg_zendesk__ticket_comment"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk_source/models/stg_zendesk.yml/schema_test/not_null_stg_zendesk__ticket_comment_ticket_comment_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket_comment`\nwhere ticket_comment_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ticket_comment_id"}, "test.zendesk_source.unique_stg_zendesk__user_user_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_unique(**_dbt_schema_test_kwargs) }}", "test_metadata": {"namespace": null, "name": "unique", "kwargs": {"column_name": "user_id", "model": "{{ ref('stg_zendesk__user') }}"}}, "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "schema_test", "unique_stg_zendesk__user_user_id"], "unique_id": "test.zendesk_source.unique_stg_zendesk__user_user_id", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "schema_test/unique_stg_zendesk__user_user_id.sql", "original_file_path": "models/stg_zendesk.yml", "name": "unique_stg_zendesk__user_user_id", "resource_type": "test", "alias": "unique_stg_zendesk__user_user_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR"}, "tags": ["schema"], "refs": [["stg_zendesk__user"]], "sources": [], "depends_on": {"macros": ["macro.dbt.test_unique"], "nodes": ["model.zendesk_source.stg_zendesk__user"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk_source/models/stg_zendesk.yml/schema_test/unique_stg_zendesk__user_user_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom (\n\n select\n user_id\n\n from `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__user`\n where user_id is not null\n group by user_id\n having count(*) > 1\n\n) validation_errors\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "user_id"}, "test.zendesk_source.not_null_stg_zendesk__user_user_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"namespace": null, "name": "not_null", "kwargs": {"column_name": "user_id", "model": "{{ ref('stg_zendesk__user') }}"}}, "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "schema_test", "not_null_stg_zendesk__user_user_id"], "unique_id": "test.zendesk_source.not_null_stg_zendesk__user_user_id", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "schema_test/not_null_stg_zendesk__user_user_id.sql", "original_file_path": "models/stg_zendesk.yml", "name": "not_null_stg_zendesk__user_user_id", "resource_type": "test", "alias": "not_null_stg_zendesk__user_user_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR"}, "tags": ["schema"], "refs": [["stg_zendesk__user"]], "sources": [], "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.zendesk_source.stg_zendesk__user"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk_source/models/stg_zendesk.yml/schema_test/not_null_stg_zendesk__user_user_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__user`\nwhere user_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "user_id"}, "test.zendesk_source.not_null_stg_zendesk__ticket_form_history_ticket_form_id": {"raw_sql": "{{ config(severity='ERROR') }}{{ test_not_null(**_dbt_schema_test_kwargs) }}", "test_metadata": {"namespace": null, "name": "not_null", "kwargs": {"column_name": "ticket_form_id", "model": "{{ ref('stg_zendesk__ticket_form_history') }}"}}, "compiled": true, "database": "dbt-package-testing", "schema": "zendesk_integration_tests_zendesk_staging", "fqn": ["zendesk_source", "schema_test", "not_null_stg_zendesk__ticket_form_history_ticket_form_id"], "unique_id": "test.zendesk_source.not_null_stg_zendesk__ticket_form_history_ticket_form_id", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "schema_test/not_null_stg_zendesk__ticket_form_history_ticket_form_id.sql", "original_file_path": "models/stg_zendesk.yml", "name": "not_null_stg_zendesk__ticket_form_history_ticket_form_id", "resource_type": "test", "alias": "not_null_stg_zendesk__ticket_form_history_ticket_form_id", "checksum": {"name": "none", "checksum": ""}, "config": {"enabled": true, "materialized": "table", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {}, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "full_refresh": null, "severity": "ERROR"}, "tags": ["schema"], "refs": [["stg_zendesk__ticket_form_history"]], "sources": [], "depends_on": {"macros": ["macro.dbt.test_not_null"], "nodes": ["model.zendesk_source.stg_zendesk__ticket_form_history"]}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": "target/compiled/zendesk_source/models/stg_zendesk.yml/schema_test/not_null_stg_zendesk__ticket_form_history_ticket_form_id.sql", "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging", "severity": "ERROR"}, "compiled_sql": "\n \n \n\n\n\nselect count(*) as validation_errors\nfrom `dbt-package-testing`.`zendesk_integration_tests_zendesk_staging`.`stg_zendesk__ticket_form_history`\nwhere ticket_form_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ticket_form_id"}}, "sources": {"source.zendesk_source.zendesk.ticket": {"fqn": ["zendesk_source", "zendesk", "ticket"], "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "unique_id": "source.zendesk_source.zendesk.ticket", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "models/src_zendesk.yml", "original_file_path": "models/src_zendesk.yml", "name": "ticket", "source_name": "zendesk", "source_description": "", "loader": "fivetran", "identifier": "ticket", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 72, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Tickets are the means through which your end users (customers) communicate with agents in Zendesk Support. Tickets can originate from a number of channels, including email, Help Center, chat, phone call, Twitter, Facebook, or the API.\n", "columns": {"id": {"name": "id", "description": "Automatically assigned when the ticket is created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url": {"name": "url", "description": "The API url of this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_id": {"name": "assignee_id", "description": "The agent currently assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "brand_id": {"name": "brand_id", "description": "Enterprise only. The id of the brand this ticket is associated with", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "When this record was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "type": {"name": "type", "description": "The type of this ticket, possible values are problem, incident, question or task", "meta": {}, "data_type": null, "quote": null, "tags": []}, "subject": {"name": "subject", "description": "The value of the subject field for this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "description": {"name": "description", "description": "Read-only first comment on the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "priority": {"name": "priority", "description": "The urgency with which the ticket should be addressed, possible values are urgent, high, normal and low", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "The state of the ticket, possible values are new, open, pending, hold, solved and closed", "meta": {}, "data_type": null, "quote": null, "tags": []}, "recipient": {"name": "recipient", "description": "The original recipient e-mail address of the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_id": {"name": "requester_id", "description": "The user who requested this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_id": {"name": "submitter_id", "description": "The user who submitted the ticket. The submitter always becomes the author of the first comment on the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "organization_id": {"name": "organization_id", "description": "The organization of the requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "group_id": {"name": "group_id", "description": "The group this ticket is assigned to", "meta": {}, "data_type": null, "quote": null, "tags": []}, "due_at": {"name": "due_at", "description": "If this is a ticket of type \"task\" it has a due date. Due date format uses ISO 8601 format.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_form_id": {"name": "ticket_form_id", "description": "Enterprise only. The id of the ticket form to render for the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_public": {"name": "is_public", "description": "Is true if any comments are public, false otherwise", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "When this record last got updated", "meta": {}, "data_type": null, "quote": null, "tags": []}, "via_channel": {"name": "via_channel", "description": "The channel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "via_source_from_id": {"name": "via_source_from_id", "description": "The channel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "via_source_from_title": {"name": "via_source_from_title", "description": "The channel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "via_source_rel": {"name": "via_source_rel", "description": "The rel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "via_source_to_address": {"name": "via_source_to_address", "description": "The address of the source the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "via_source_to_name": {"name": "via_source_to_name", "description": "The name of the source the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`ticket`"}, "source.zendesk_source.zendesk.brand": {"fqn": ["zendesk_source", "zendesk", "brand"], "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "unique_id": "source.zendesk_source.zendesk.brand", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "models/src_zendesk.yml", "original_file_path": "models/src_zendesk.yml", "name": "brand", "source_name": "zendesk", "source_description": "", "loader": "fivetran", "identifier": "brand", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 72, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Brands are your customer-facing identities. They might represent multiple products or services, or they might literally be multiple brands owned and represented by your company.\n", "columns": {"id": {"name": "id", "description": "The ID automatically assigned when the brand is created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "brand_url": {"name": "brand_url", "description": "The url of the brand", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "The name of the brand", "meta": {}, "data_type": null, "quote": null, "tags": []}, "subdomain": {"name": "subdomain", "description": "The subdomain of the brand", "meta": {}, "data_type": null, "quote": null, "tags": []}, "active": {"name": "active", "description": "If the brand is set as active", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`brand`"}, "source.zendesk_source.zendesk.domain_name": {"fqn": ["zendesk_source", "zendesk", "domain_name"], "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "unique_id": "source.zendesk_source.zendesk.domain_name", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "models/src_zendesk.yml", "original_file_path": "models/src_zendesk.yml", "name": "domain_name", "source_name": "zendesk", "source_description": "", "loader": "fivetran", "identifier": "domain_name", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 72, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Domain names associated with an organization. An organization may have multiple domain names.", "columns": {"organization_id": {"name": "organization_id", "description": "Reference to the organization", "meta": {}, "data_type": null, "quote": null, "tags": []}, "domain_name": {"name": "domain_name", "description": "The name of the domain associated with the organization", "meta": {}, "data_type": null, "quote": null, "tags": []}, "index": {"name": "index", "description": "Index number of the domain name associated with the organization", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`domain_name`"}, "source.zendesk_source.zendesk.group": {"fqn": ["zendesk_source", "zendesk", "group"], "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "unique_id": "source.zendesk_source.zendesk.group", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "models/src_zendesk.yml", "original_file_path": "models/src_zendesk.yml", "name": "group", "source_name": "zendesk", "source_description": "", "loader": "fivetran", "identifier": "group", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": true, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "When support requests arrive in Zendesk Support, they can be assigned to a Group. Groups serve as the core element of ticket workflow; support agents are organized into Groups and tickets can be assigned to a Group only, or to an assigned agent within a Group. A ticket can never be assigned to an agent without also being assigned to a Group.\n", "columns": {"id": {"name": "id", "description": "Automatically assigned when creating groups", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "The name of the group", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`group`"}, "source.zendesk_source.zendesk.organization_tag": {"fqn": ["zendesk_source", "zendesk", "organization_tag"], "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "unique_id": "source.zendesk_source.zendesk.organization_tag", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "models/src_zendesk.yml", "original_file_path": "models/src_zendesk.yml", "name": "organization_tag", "source_name": "zendesk", "source_description": "", "loader": "fivetran", "identifier": "organization_tag", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 72, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "The tags associated with an organization. An organization may have multiple tags.", "columns": {"organization_id": {"name": "organization_id", "description": "Reference to the organization", "meta": {}, "data_type": null, "quote": null, "tags": []}, "tag": {"name": "tag", "description": "Tag associated with the organization", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`organization_tag`"}, "source.zendesk_source.zendesk.organization": {"fqn": ["zendesk_source", "zendesk", "organization"], "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "unique_id": "source.zendesk_source.zendesk.organization", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "models/src_zendesk.yml", "original_file_path": "models/src_zendesk.yml", "name": "organization", "source_name": "zendesk", "source_description": "", "loader": "fivetran", "identifier": "organization", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Just as agents can be segmented into groups in Zendesk Support, your customers (end-users) can be segmented into organizations. You can manually assign customers to an organization or automatically assign them to an organization by their email address domain. Organizations can be used in business rules to route tickets to groups of agents or to send email notifications.\n", "columns": {"id": {"name": "id", "description": "Automatically assigned when the organization is created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "A unique name for the organization", "meta": {}, "data_type": null, "quote": null, "tags": []}, "details": {"name": "details", "description": "Any details obout the organization, such as the address", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url": {"name": "url", "description": "The API url of this organization", "meta": {}, "data_type": null, "quote": null, "tags": []}, "external_id": {"name": "external_id", "description": "A unique external id to associate organizations to an external record", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "The time the organization was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "The time of the last update of the organization", "meta": {}, "data_type": null, "quote": null, "tags": []}, "domain_names": {"name": "domain_names", "description": "An array of domain names associated with this organization", "meta": {}, "data_type": null, "quote": null, "tags": []}, "notes": {"name": "notes", "description": "Any notes you have about the organization", "meta": {}, "data_type": null, "quote": null, "tags": []}, "group_id": {"name": "group_id", "description": "New tickets from users in this organization are automatically put in this group", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shared_tickets": {"name": "shared_tickets", "description": "End users in this organization are able to see each other's tickets", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shared_comments": {"name": "shared_comments", "description": "End users in this organization are able to see each other's comments on tickets", "meta": {}, "data_type": null, "quote": null, "tags": []}, "tags": {"name": "tags", "description": "The tags of the organization", "meta": {}, "data_type": null, "quote": null, "tags": []}, "organization_fields": {"name": "organization_fields", "description": "Custom fields for this organization", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`organization`"}, "source.zendesk_source.zendesk.ticket_comment": {"fqn": ["zendesk_source", "zendesk", "ticket_comment"], "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "unique_id": "source.zendesk_source.zendesk.ticket_comment", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "models/src_zendesk.yml", "original_file_path": "models/src_zendesk.yml", "name": "ticket_comment", "source_name": "zendesk", "source_description": "", "loader": "fivetran", "identifier": "ticket_comment", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 72, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Ticket comments represent the conversation between requesters, collaborators, and agents. Comments can be public or private.", "columns": {"id": {"name": "id", "description": "Automatically assigned when the comment is created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "body": {"name": "body", "description": "The comment string", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created": {"name": "created", "description": "The time the comment was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "public": {"name": "public", "description": "Boolean field indicating if the comment is public (true), or if it is an internal note (false)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_id": {"name": "ticket_id", "description": "The ticket id associated with this comment", "meta": {}, "data_type": null, "quote": null, "tags": []}, "user_id": {"name": "user_id", "description": "The id of the comment author", "meta": {}, "data_type": null, "quote": null, "tags": []}, "facebook_comment": {"name": "facebook_comment", "description": "Boolean field indicating if the comment is a facebook comment", "meta": {}, "data_type": null, "quote": null, "tags": []}, "tweet": {"name": "tweet", "description": "Boolean field indicating if the comment is a twitter tweet", "meta": {}, "data_type": null, "quote": null, "tags": []}, "voice_comment": {"name": "voice_comment", "description": "Boolean field indicating if the comment is a voice comment", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`ticket_comment`"}, "source.zendesk_source.zendesk.user_tag": {"fqn": ["zendesk_source", "zendesk", "user_tag"], "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "unique_id": "source.zendesk_source.zendesk.user_tag", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "models/src_zendesk.yml", "original_file_path": "models/src_zendesk.yml", "name": "user_tag", "source_name": "zendesk", "source_description": "", "loader": "fivetran", "identifier": "user_tag", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 72, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Table containing all tags associated with a user. Only present if your account has user tagging enabled.", "columns": {"user_id": {"name": "user_id", "description": "Reference to the user", "meta": {}, "data_type": null, "quote": null, "tags": []}, "tag": {"name": "tag", "description": "Tag associated with the user", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`user_tag`"}, "source.zendesk_source.zendesk.user": {"fqn": ["zendesk_source", "zendesk", "user"], "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "unique_id": "source.zendesk_source.zendesk.user", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "models/src_zendesk.yml", "original_file_path": "models/src_zendesk.yml", "name": "user", "source_name": "zendesk", "source_description": "", "loader": "fivetran", "identifier": "user", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Zendesk has three types of users, end-users (your customers), agents, and administrators.", "columns": {"id": {"name": "id", "description": "Automatically assigned when the user is created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "email": {"name": "email", "description": "The user's primary email address. *Writeable on create only. On update, a secondary email is added. See Email Address", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "The user's name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "active": {"name": "active", "description": "false if the user has been deleted", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "The time the user was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "organization_id": {"name": "organization_id", "description": "The id of the user's organization. If the user has more than one organization memberships, the id of the user's default organization", "meta": {}, "data_type": null, "quote": null, "tags": []}, "role": {"name": "role", "description": "The user's role. Possible values are \"end-user\", \"agent\", or \"admin\"", "meta": {}, "data_type": null, "quote": null, "tags": []}, "time_zone": {"name": "time_zone", "description": "The user's time zone. See Time Zone", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_restriction": {"name": "ticket_restriction", "description": "Specifies which tickets the user has access to. Possible values are organization, groups, assigned, requested and null", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`user`"}, "source.zendesk_source.zendesk.schedule": {"fqn": ["zendesk_source", "zendesk", "schedule"], "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "unique_id": "source.zendesk_source.zendesk.schedule", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "models/src_zendesk.yml", "original_file_path": "models/src_zendesk.yml", "name": "schedule", "source_name": "zendesk", "source_description": "", "loader": "fivetran", "identifier": "schedule", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "The support schedules created with different business hours and holidays.", "columns": {"id": {"name": "id", "description": "ID automatically assigned to the schedule upon creation", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "Name of the schedule", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Time the schedule was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "start_time_utc": {"name": "start_time_utc", "description": "Start time of the schedule, in UTC", "meta": {}, "data_type": null, "quote": null, "tags": []}, "end_time_utc": {"name": "end_time_utc", "description": "End time of the schedule, in UTC", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`schedule`"}, "source.zendesk_source.zendesk.ticket_schedule": {"fqn": ["zendesk_source", "zendesk", "ticket_schedule"], "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "unique_id": "source.zendesk_source.zendesk.ticket_schedule", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "models/src_zendesk.yml", "original_file_path": "models/src_zendesk.yml", "name": "ticket_schedule", "source_name": "zendesk", "source_description": "", "loader": "fivetran", "identifier": "ticket_schedule", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "The schedules applied to tickets through a trigger.", "columns": {"ticket_id": {"name": "ticket_id", "description": "The ID of the ticket assigned to the schedule", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "The time the schedule was assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "schedule_id": {"name": "schedule_id", "description": "The ID of the schedule applied to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`ticket_schedule`"}, "source.zendesk_source.zendesk.ticket_form_history": {"fqn": ["zendesk_source", "zendesk", "ticket_form_history"], "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "unique_id": "source.zendesk_source.zendesk.ticket_form_history", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "models/src_zendesk.yml", "original_file_path": "models/src_zendesk.yml", "name": "ticket_form_history", "source_name": "zendesk", "source_description": "", "loader": "fivetran", "identifier": "ticket_form_history", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 72, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Ticket forms allow an admin to define a subset of ticket fields for display to both agents and end users.", "columns": {"id": {"name": "id", "description": "Automatically assigned when creating ticket form", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "The time the ticket form was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "The time of the last update of the ticket form", "meta": {}, "data_type": null, "quote": null, "tags": []}, "display_name": {"name": "display_name", "description": "The name of the form that is displayed to an end user", "meta": {}, "data_type": null, "quote": null, "tags": []}, "active": {"name": "active", "description": "If the form is set as active", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "The name of the form", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`ticket_form_history`"}, "source.zendesk_source.zendesk.ticket_tag": {"fqn": ["zendesk_source", "zendesk", "ticket_tag"], "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "unique_id": "source.zendesk_source.zendesk.ticket_tag", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "models/src_zendesk.yml", "original_file_path": "models/src_zendesk.yml", "name": "ticket_tag", "source_name": "zendesk", "source_description": "", "loader": "fivetran", "identifier": "ticket_tag", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Tags are words, or combinations of words, you can use to add more context to tickets. The table lists all tags currently associated with a ticket.\n", "columns": {"ticket_id": {"name": "ticket_id", "description": "The ID of the ticket associated with the tag", "meta": {}, "data_type": null, "quote": null, "tags": []}, "tags": {"name": "tags", "description": "The tag, or word(s), associated with the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`ticket_tag`"}, "source.zendesk_source.zendesk.ticket_field_history": {"fqn": ["zendesk_source", "zendesk", "ticket_field_history"], "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "unique_id": "source.zendesk_source.zendesk.ticket_field_history", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "models/src_zendesk.yml", "original_file_path": "models/src_zendesk.yml", "name": "ticket_field_history", "source_name": "zendesk", "source_description": "", "loader": "fivetran", "identifier": "ticket_field_history", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "All fields and field values associated with tickets.", "columns": {"ticket_id": {"name": "ticket_id", "description": "The ID of the ticket associated with the field", "meta": {}, "data_type": null, "quote": null, "tags": []}, "field_name": {"name": "field_name", "description": "The name of the ticket field", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated": {"name": "updated", "description": "The time the ticket field value was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "value": {"name": "value", "description": "The value of the field", "meta": {}, "data_type": null, "quote": null, "tags": []}, "user_id": {"name": "user_id", "description": "The id of the user who made the update", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`dbt-package-testing`.`zendesk_integration_tests`.`ticket_field_history`"}}, "macros": {"macro.zendesk_integration_tests.snowflake_seed_data": {"unique_id": "macro.zendesk_integration_tests.snowflake_seed_data", "package_name": "zendesk_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests", "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": []}, "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.7/lib/python3.7/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": []}, "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.7/lib/python3.7/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": []}, "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.7/lib/python3.7/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": []}, "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.7/lib/python3.7/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_bigquery.partition_by": {"unique_id": "macro.dbt_bigquery.partition_by", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": []}, "macro.dbt_bigquery.cluster_by": {"unique_id": "macro.dbt_bigquery.cluster_by", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/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\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": []}, "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.7/lib/python3.7/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/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_table_options(config, model, temporary=false) }}\n as {{ sql }};\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/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": []}, "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.7/lib/python3.7/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": []}, "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.7/lib/python3.7/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/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": []}, "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.7/lib/python3.7/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": []}, "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.7/lib/python3.7/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": []}, "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.7/lib/python3.7/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": []}, "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.7/lib/python3.7/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": []}, "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.7/lib/python3.7/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": []}, "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.7/lib/python3.7/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/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": []}, "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.7/lib/python3.7/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": []}, "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.7/lib/python3.7/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 {#\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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/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": []}, "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.7/lib/python3.7/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": []}, "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.7/lib/python3.7/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": []}, "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.7/lib/python3.7/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": []}, "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.7/lib/python3.7/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(run_outside_transaction_hooks=False) %}\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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_bigquery.make_date_partitioned_table": {"unique_id": "macro.dbt_bigquery.make_date_partitioned_table", "package_name": "dbt_bigquery", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/bigquery", "path": "macros/materializations/table.sql", "original_file_path": "macros/materializations/table.sql", "name": "make_date_partitioned_table", "macro_sql": "{% macro make_date_partitioned_table(model, relation, dates, should_create, verbose=False) %}\n\n {% if should_create %}\n {{ adapter.make_date_partitioned_table(relation) }}\n {% endif %}\n\n {% for date in dates %}\n {% set date = (date | string) %}\n {% if verbose %}\n {% set table_start_time = modules.datetime.datetime.now().strftime(\"%H:%M:%S\") %}\n {{ log(table_start_time ~ ' | -> Running for day ' ~ date, info=True) }}\n {% endif %}\n\n {% set fixed_sql = model['compiled_sql'] | replace('[DBT__PARTITION_DATE]', date) %}\n {% set _ = adapter.execute_model(model, 'table', fixed_sql, decorator=date) %}\n {% endfor %}\n\n {% set num_days = dates | length %}\n {% if num_days == 1 %}\n {% set result_str = 'CREATED 1 PARTITION' %}\n {% else %}\n {% set result_str = 'CREATED ' ~ num_days ~ ' PARTITIONS' %}\n {% endif %}\n\n {{ store_result('main', response=result_str) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/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 {%- set verbose = config.get('verbose', False) -%}\n\n {# partitions: iterate over each partition, running a separate query in a for-loop #}\n {%- set partitions = config.get('partitions') -%}\n\n {% if partitions %}\n {% if partitions is number or partitions is string %}\n {% set partitions = [(partitions | string)] %}\n {% endif %}\n\n {% if partitions is not iterable %}\n {{ exceptions.raise_compiler_error(\"Provided `partitions` configuration is not a list. Got: \" ~ partitions, model) }}\n {% endif %}\n {% endif %}\n\n {{ run_hooks(pre_hooks) }}\n\n {#\n Since dbt uses WRITE_TRUNCATE mode for tables, we only need to drop this thing\n if it is not a table. If it _is_ already a table, then we can overwrite it without downtime\n #}\n {%- if exists_not_as_table -%}\n {{ adapter.drop_relation(old_relation) }}\n {%- endif -%}\n\n -- build model\n {% if partitions %}\n {# Create the dp-table if 1. it does not exist or 2. it existed, but we just dropped it #}\n {%- set should_create = (old_relation is none or exists_not_as_table) -%}\n {{ make_date_partitioned_table(model, target_relation, partitions, should_create, verbose) }}\n {% else %}\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 {% endif %}\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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/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 {# there should be exactly one ref or exactly one source #}\n {% set destination = this.incorporate(type='table') %}\n\n {% set dependency_type = none %}\n {% if (model.refs | length) == 1 and (model.sources | length) == 0 %}\n {% set dependency_type = 'ref' %}\n {% elif (model.refs | length) == 0 and (model.sources | length) == 1 %}\n {% set dependency_type = 'source' %}\n {% else %}\n {% set msg %}\n Expected exactly one ref or exactly one source, instead got {{ model.refs | length }} models and {{ model.sources | length }} sources.\n {% endset %}\n {% do exceptions.raise_compiler_error(msg) %}\n {% endif %}\n\n {% if dependency_type == 'ref' %}\n {% set src = ref(*model.refs[0]) %}\n {% else %}\n {% set src = source(*model.sources[0]) %}\n {% endif %}\n\n {%- set result_str = adapter.copy_table(\n src,\n destination,\n config.get('copy_materialization', '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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/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": []}, "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.7/lib/python3.7/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(tmp_relation, target_relation, sql, unique_key, partition_by, partitions, dest_columns) %}\n {%- set partition_type =\n 'date' if partition_by.data_type in ('timestamp, datetime')\n else partition_by.data_type -%}\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_type }}>;\n declare _dbt_max_partition {{ partition_by.data_type }};\n\n set _dbt_max_partition = (\n select max({{ partition_by.field }}) from {{ this }}\n );\n\n -- 1. create a temp table\n {{ create_table_as(True, tmp_relation, sql) }}\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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/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 {{ run_hooks(pre_hooks) }}\n\n {% if existing_relation is none %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\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 {% 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 {% else %}\n {% set dest_columns = adapter.get_columns_in_relation(existing_relation) %}\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,\n target_relation,\n sql,\n unique_key,\n partition_by,\n partitions,\n dest_columns) %}\n\n {% else %}\n {#-- wrap sql in parens to make it a subquery --#}\n {%- set source_sql -%}\n (\n {{sql}}\n )\n {%- endset -%}\n\n {% set build_sql = get_merge_sql(target_relation, source_sql, unique_key, dest_columns) %}\n\n {% endif %}\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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/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": []}, "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.7/lib/python3.7/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": []}, "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.7/lib/python3.7/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.statement": {"unique_id": "macro.dbt.statement", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/core.sql", "original_file_path": "macros/core.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": []}, "macro.dbt.noop_statement": {"unique_id": "macro.dbt.noop_statement", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/core.sql", "original_file_path": "macros/core.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": []}, "macro.dbt.run_hooks": {"unique_id": "macro.dbt.run_hooks", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.column_list": {"unique_id": "macro.dbt.column_list", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "column_list", "macro_sql": "{% macro column_list(columns) %}\n {%- for col in columns %}\n {{ col.name }} {% 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": []}, "macro.dbt.column_list_for_create_table": {"unique_id": "macro.dbt.column_list_for_create_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.sql", "name": "column_list_for_create_table", "macro_sql": "{% macro column_list_for_create_table(columns) %}\n {%- for col in columns %}\n {{ col.name }} {{ col.data_type }} {%- 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": []}, "macro.dbt.make_hook_config": {"unique_id": "macro.dbt.make_hook_config", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.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": []}, "macro.dbt.before_begin": {"unique_id": "macro.dbt.before_begin", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.in_transaction": {"unique_id": "macro.dbt.in_transaction", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.after_commit": {"unique_id": "macro.dbt.after_commit", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.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": []}, "macro.dbt.load_relation": {"unique_id": "macro.dbt.load_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.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": []}, "macro.dbt.should_full_refresh": {"unique_id": "macro.dbt.should_full_refresh", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/helpers.sql", "original_file_path": "macros/materializations/helpers.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": []}, "macro.dbt.snapshot_merge_sql": {"unique_id": "macro.dbt.snapshot_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshot/snapshot_merge.sql", "name": "snapshot_merge_sql", "macro_sql": "{% macro snapshot_merge_sql(target, source, insert_cols) -%}\n {{ adapter.dispatch('snapshot_merge_sql')(target, source, insert_cols) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot_merge.sql", "original_file_path": "macros/materializations/snapshot/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": []}, "macro.dbt.strategy_dispatch": {"unique_id": "macro.dbt.strategy_dispatch", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/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": []}, "macro.dbt.snapshot_hash_arguments": {"unique_id": "macro.dbt.snapshot_hash_arguments", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "snapshot_hash_arguments", "macro_sql": "{% macro snapshot_hash_arguments(args) -%}\n {{ adapter.dispatch('snapshot_hash_arguments')(args) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/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": []}, "macro.dbt.snapshot_get_time": {"unique_id": "macro.dbt.snapshot_get_time", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "snapshot_get_time", "macro_sql": "{% macro snapshot_get_time() -%}\n {{ adapter.dispatch('snapshot_get_time')() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.snapshot_timestamp_strategy": {"unique_id": "macro.dbt.snapshot_timestamp_strategy", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/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/fishtown-analytics/dbt/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/strategies.sql", "name": "snapshot_string_as_time", "macro_sql": "{% macro snapshot_string_as_time(timestamp) -%}\n {{ adapter.dispatch('snapshot_string_as_time')(timestamp) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/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": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.snapshot_check_strategy": {"unique_id": "macro.dbt.snapshot_check_strategy", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/strategies.sql", "original_file_path": "macros/materializations/snapshot/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 = 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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.create_columns": {"unique_id": "macro.dbt.create_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "create_columns", "macro_sql": "{% macro create_columns(relation, columns) %}\n {{ adapter.dispatch('create_columns')(relation, columns) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__create_columns": {"unique_id": "macro.dbt.default__create_columns", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.post_snapshot": {"unique_id": "macro.dbt.post_snapshot", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "post_snapshot", "macro_sql": "{% macro post_snapshot(staging_relation) %}\n {{ adapter.dispatch('post_snapshot')(staging_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__post_snapshot": {"unique_id": "macro.dbt.default__post_snapshot", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.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": []}, "macro.dbt.snapshot_staging_table": {"unique_id": "macro.dbt.snapshot_staging_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "snapshot_staging_table", "macro_sql": "{% macro 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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.build_snapshot_table": {"unique_id": "macro.dbt.build_snapshot_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "build_snapshot_table", "macro_sql": "{% macro 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": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.sql", "name": "get_or_create_relation", "macro_sql": "{% macro 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": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/snapshot.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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.materialization_snapshot_default": {"unique_id": "macro.dbt.materialization_snapshot_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/snapshot/snapshot.sql", "original_file_path": "macros/materializations/snapshot/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 {{ 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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.create_csv_table": {"unique_id": "macro.dbt.create_csv_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "create_csv_table", "macro_sql": "{% macro create_csv_table(model, agate_table) -%}\n {{ adapter.dispatch('create_csv_table')(model, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.reset_csv_table": {"unique_id": "macro.dbt.reset_csv_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "reset_csv_table", "macro_sql": "{% macro reset_csv_table(model, full_refresh, old_relation, agate_table) -%}\n {{ adapter.dispatch('reset_csv_table')(model, full_refresh, old_relation, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.load_csv_rows": {"unique_id": "macro.dbt.load_csv_rows", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "load_csv_rows", "macro_sql": "{% macro load_csv_rows(model, agate_table) -%}\n {{ adapter.dispatch('load_csv_rows')(model, agate_table) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.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": []}, "macro.dbt.basic_load_csv_rows": {"unique_id": "macro.dbt.basic_load_csv_rows", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "basic_load_csv_rows", "macro_sql": "{% macro basic_load_csv_rows(model, batch_size, agate_table) %}\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(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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/seed.sql", "name": "default__load_csv_rows", "macro_sql": "{% macro default__load_csv_rows(model, agate_table) %}\n {{ return(basic_load_csv_rows(model, 10000, agate_table) )}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.materialization_seed_default": {"unique_id": "macro.dbt.materialization_seed_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/seed/seed.sql", "original_file_path": "macros/materializations/seed/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 {{ 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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.incremental_upsert": {"unique_id": "macro.dbt.incremental_upsert", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/incremental/helpers.sql", "original_file_path": "macros/materializations/incremental/helpers.sql", "name": "incremental_upsert", "macro_sql": "{% macro incremental_upsert(tmp_relation, target_relation, unique_key=none, statement_name=\"main\") %}\n {%- set dest_columns = adapter.get_columns_in_relation(target_relation) -%}\n {%- set dest_cols_csv = dest_columns | map(attribute='quoted') | join(', ') -%}\n\n {%- if unique_key is not none -%}\n delete\n from {{ target_relation }}\n where ({{ unique_key }}) in (\n select ({{ unique_key }})\n from {{ tmp_relation }}\n );\n {%- endif %}\n\n insert into {{ target_relation }} ({{ dest_cols_csv }})\n (\n select {{ dest_cols_csv }}\n from {{ tmp_relation }}\n );\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.materialization_incremental_default": {"unique_id": "macro.dbt.materialization_incremental_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/incremental/incremental.sql", "original_file_path": "macros/materializations/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(this) %}\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 {% if existing_relation is none %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n {% elif existing_relation.is_view or should_full_refresh() %}\n {#-- Make sure the backup doesn't exist so we don't encounter issues with the rename below #}\n {% set backup_identifier = existing_relation.identifier ~ \"__dbt_backup\" %}\n {% set backup_relation = existing_relation.incorporate(path={\"identifier\": backup_identifier}) %}\n {% do adapter.drop_relation(backup_relation) %}\n\n {% do adapter.rename_relation(target_relation, backup_relation) %}\n {% set build_sql = create_table_as(False, target_relation, sql) %}\n {% do to_drop.append(backup_relation) %}\n {% else %}\n {% set tmp_relation = make_temp_relation(target_relation) %}\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 {% set build_sql = incremental_upsert(tmp_relation, target_relation, unique_key=unique_key) %}\n {% endif %}\n\n {% call statement(\"main\") %}\n {{ build_sql }}\n {% endcall %}\n\n {% do persist_docs(target_relation, model) %}\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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.get_merge_sql": {"unique_id": "macro.dbt.get_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/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')(target, source, unique_key, dest_columns, predicates) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/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')(target, source, unique_key, dest_columns) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/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')(target, source, dest_columns, predicates, include_sql_header) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/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 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 in dest_columns -%}\n {{ adapter.quote(column.name) }} = DBT_INTERNAL_SOURCE.{{ adapter.quote(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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.get_quoted_csv": {"unique_id": "macro.dbt.get_quoted_csv", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/merge.sql", "name": "get_quoted_csv", "macro_sql": "{% macro get_quoted_csv(column_names) %}\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{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.common_get_delete_insert_merge_sql": {"unique_id": "macro.dbt.common_get_delete_insert_merge_sql", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/merge.sql", "name": "common_get_delete_insert_merge_sql", "macro_sql": "{% macro common_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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/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 {{ common_get_delete_insert_merge_sql(target, source, unique_key, dest_columns) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/common/merge.sql", "original_file_path": "macros/materializations/common/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.materialization_table_default": {"unique_id": "macro.dbt.materialization_table_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/table/table.sql", "original_file_path": "macros/materializations/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\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\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\n -- drop the temp relations if they exists for some reason\n {{ adapter.drop_relation(intermediate_relation) }}\n {{ adapter.drop_relation(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 {{ create_table_as(False, intermediate_relation, sql) }}\n {%- endcall %}\n\n -- cleanup\n {% if old_relation is not none %}\n {{ adapter.rename_relation(target_relation, backup_relation) }}\n {% endif %}\n\n {{ adapter.rename_relation(intermediate_relation, 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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.materialization_view_default": {"unique_id": "macro.dbt.materialization_view_default", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/view/view.sql", "original_file_path": "macros/materializations/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\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\n {%- set exists_as_view = (old_relation is not none and old_relation.is_view) -%}\n\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n\n -- drop the temp relations if they exists for some reason\n {{ adapter.drop_relation(intermediate_relation) }}\n {{ adapter.drop_relation(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(target_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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.handle_existing_table": {"unique_id": "macro.dbt.handle_existing_table", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/view/create_or_replace_view.sql", "original_file_path": "macros/materializations/view/create_or_replace_view.sql", "name": "handle_existing_table", "macro_sql": "{% macro handle_existing_table(full_refresh, old_relation) %}\n {{ adapter.dispatch(\"handle_existing_table\", packages=['dbt'])(full_refresh, old_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/view/create_or_replace_view.sql", "original_file_path": "macros/materializations/view/create_or_replace_view.sql", "name": "default__handle_existing_table", "macro_sql": "{% macro default__handle_existing_table(full_refresh, old_relation) %}\n {{ adapter.drop_relation(old_relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/materializations/view/create_or_replace_view.sql", "original_file_path": "macros/materializations/view/create_or_replace_view.sql", "name": "create_or_replace_view", "macro_sql": "{% macro create_or_replace_view(run_outside_transaction_hooks=True) %}\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 {% if run_outside_transaction_hooks %}\n -- no transactions on BigQuery\n {{ run_hooks(pre_hooks, inside_transaction=False) }}\n {% endif %}\n\n -- `BEGIN` happens here on Snowflake\n {{ run_hooks(pre_hooks, inside_transaction=True) }}\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 {{ create_view_as(target_relation, sql) }}\n {%- endcall %}\n\n {{ run_hooks(post_hooks, inside_transaction=True) }}\n\n {{ adapter.commit() }}\n\n {% if run_outside_transaction_hooks %}\n -- No transactions on BigQuery\n {{ run_hooks(post_hooks, inside_transaction=False) }}\n {% endif %}\n\n {{ return({'relations': [target_relation]}) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.generate_alias_name": {"unique_id": "macro.dbt.generate_alias_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/etc/get_custom_alias.sql", "original_file_path": "macros/etc/get_custom_alias.sql", "name": "generate_alias_name", "macro_sql": "{% macro 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": []}, "macro.dbt.run_query": {"unique_id": "macro.dbt.run_query", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/etc/query.sql", "original_file_path": "macros/etc/query.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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.is_incremental": {"unique_id": "macro.dbt.is_incremental", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/etc/is_incremental.sql", "original_file_path": "macros/etc/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.convert_datetime": {"unique_id": "macro.dbt.convert_datetime", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": []}, "macro.dbt.dates_in_range": {"unique_id": "macro.dbt.dates_in_range", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.partition_range": {"unique_id": "macro.dbt.partition_range", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.py_current_timestring": {"unique_id": "macro.dbt.py_current_timestring", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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": []}, "macro.dbt.generate_schema_name": {"unique_id": "macro.dbt.generate_schema_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/etc/get_custom_schema.sql", "original_file_path": "macros/etc/get_custom_schema.sql", "name": "generate_schema_name", "macro_sql": "{% macro 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": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/etc/get_custom_schema.sql", "original_file_path": "macros/etc/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": []}, "macro.dbt.generate_database_name": {"unique_id": "macro.dbt.generate_database_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/etc/get_custom_database.sql", "original_file_path": "macros/etc/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')(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": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/etc/get_custom_database.sql", "original_file_path": "macros/etc/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": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "get_columns_in_query", "macro_sql": "{% macro get_columns_in_query(select_sql) -%}\n {{ return(adapter.dispatch('get_columns_in_query')(select_sql)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.create_schema": {"unique_id": "macro.dbt.create_schema", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "create_schema", "macro_sql": "{% macro create_schema(relation) -%}\n {{ adapter.dispatch('create_schema')(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__create_schema": {"unique_id": "macro.dbt.default__create_schema", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.drop_schema": {"unique_id": "macro.dbt.drop_schema", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "drop_schema", "macro_sql": "{% macro drop_schema(relation) -%}\n {{ adapter.dispatch('drop_schema')(relation) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__drop_schema": {"unique_id": "macro.dbt.default__drop_schema", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.create_table_as": {"unique_id": "macro.dbt.create_table_as", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "create_table_as", "macro_sql": "{% macro create_table_as(temporary, relation, sql) -%}\n {{ adapter.dispatch('create_table_as')(temporary, relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.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\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.create_view_as": {"unique_id": "macro.dbt.create_view_as", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "create_view_as", "macro_sql": "{% macro create_view_as(relation, sql) -%}\n {{ adapter.dispatch('create_view_as')(relation, sql) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.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": []}, "macro.dbt.get_catalog": {"unique_id": "macro.dbt.get_catalog", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "get_catalog", "macro_sql": "{% macro get_catalog(information_schema, schemas) -%}\n {{ return(adapter.dispatch('get_catalog')(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": []}, "macro.dbt.default__get_catalog": {"unique_id": "macro.dbt.default__get_catalog", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.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": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "get_columns_in_relation", "macro_sql": "{% macro get_columns_in_relation(relation) -%}\n {{ return(adapter.dispatch('get_columns_in_relation')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.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": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.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": []}, "macro.dbt.alter_column_type": {"unique_id": "macro.dbt.alter_column_type", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "alter_column_type", "macro_sql": "{% macro alter_column_type(relation, column_name, new_column_type) -%}\n {{ return(adapter.dispatch('alter_column_type')(relation, column_name, new_column_type)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.alter_column_comment": {"unique_id": "macro.dbt.alter_column_comment", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "alter_column_comment", "macro_sql": "{% macro alter_column_comment(relation, column_dict) -%}\n {{ return(adapter.dispatch('alter_column_comment')(relation, column_dict)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.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": []}, "macro.dbt.alter_relation_comment": {"unique_id": "macro.dbt.alter_relation_comment", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "alter_relation_comment", "macro_sql": "{% macro alter_relation_comment(relation, relation_comment) -%}\n {{ return(adapter.dispatch('alter_relation_comment')(relation, relation_comment)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.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": []}, "macro.dbt.persist_docs": {"unique_id": "macro.dbt.persist_docs", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "persist_docs", "macro_sql": "{% macro persist_docs(relation, model, for_relation=true, for_columns=true) -%}\n {{ return(adapter.dispatch('persist_docs')(relation, model, for_relation, for_columns)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__persist_docs": {"unique_id": "macro.dbt.default__persist_docs", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.drop_relation": {"unique_id": "macro.dbt.drop_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "drop_relation", "macro_sql": "{% macro drop_relation(relation) -%}\n {{ return(adapter.dispatch('drop_relation')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__drop_relation": {"unique_id": "macro.dbt.default__drop_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.truncate_relation": {"unique_id": "macro.dbt.truncate_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "truncate_relation", "macro_sql": "{% macro truncate_relation(relation) -%}\n {{ return(adapter.dispatch('truncate_relation')(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__truncate_relation": {"unique_id": "macro.dbt.default__truncate_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.rename_relation": {"unique_id": "macro.dbt.rename_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "rename_relation", "macro_sql": "{% macro rename_relation(from_relation, to_relation) -%}\n {{ return(adapter.dispatch('rename_relation')(from_relation, to_relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__rename_relation": {"unique_id": "macro.dbt.default__rename_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.information_schema_name": {"unique_id": "macro.dbt.information_schema_name", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "information_schema_name", "macro_sql": "{% macro information_schema_name(database) %}\n {{ return(adapter.dispatch('information_schema_name')(database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.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": []}, "macro.dbt.list_schemas": {"unique_id": "macro.dbt.list_schemas", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "list_schemas", "macro_sql": "{% macro list_schemas(database) -%}\n {{ return(adapter.dispatch('list_schemas')(database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__list_schemas": {"unique_id": "macro.dbt.default__list_schemas", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.check_schema_exists": {"unique_id": "macro.dbt.check_schema_exists", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "check_schema_exists", "macro_sql": "{% macro check_schema_exists(information_schema, schema) -%}\n {{ return(adapter.dispatch('check_schema_exists')(information_schema, schema)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "list_relations_without_caching", "macro_sql": "{% macro list_relations_without_caching(schema_relation) %}\n {{ return(adapter.dispatch('list_relations_without_caching')(schema_relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.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": []}, "macro.dbt.current_timestamp": {"unique_id": "macro.dbt.current_timestamp", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "current_timestamp", "macro_sql": "{% macro current_timestamp() -%}\n {{ adapter.dispatch('current_timestamp')() }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__current_timestamp": {"unique_id": "macro.dbt.default__current_timestamp", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.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": []}, "macro.dbt.collect_freshness": {"unique_id": "macro.dbt.collect_freshness", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__collect_freshness": {"unique_id": "macro.dbt.default__collect_freshness", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.make_temp_relation": {"unique_id": "macro.dbt.make_temp_relation", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.sql", "name": "make_temp_relation", "macro_sql": "{% macro make_temp_relation(base_relation, suffix='__dbt_tmp') %}\n {{ return(adapter.dispatch('make_temp_relation')(base_relation, suffix))}}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.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": []}, "macro.dbt.set_sql_header": {"unique_id": "macro.dbt.set_sql_header", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/adapters/common.sql", "original_file_path": "macros/adapters/common.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": []}, "macro.dbt.default__test_relationships": {"unique_id": "macro.dbt.default__test_relationships", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/schema_tests/relationships.sql", "original_file_path": "macros/schema_tests/relationships.sql", "name": "default__test_relationships", "macro_sql": "{% macro default__test_relationships(model, to, field) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('from')) %}\n\n\nselect count(*) as validation_errors\nfrom (\n select {{ column_name }} as id from {{ model }}\n) as child\nleft join (\n select {{ field }} as id from {{ to }}\n) as parent on parent.id = child.id\nwhere child.id is not null\n and parent.id is null\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.test_relationships": {"unique_id": "macro.dbt.test_relationships", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/schema_tests/relationships.sql", "original_file_path": "macros/schema_tests/relationships.sql", "name": "test_relationships", "macro_sql": "{% macro test_relationships(model, to, field) %}\n {% set macro = adapter.dispatch('test_relationships') %}\n {{ macro(model, to, field, **kwargs) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/schema_tests/not_null.sql", "original_file_path": "macros/schema_tests/not_null.sql", "name": "default__test_not_null", "macro_sql": "{% macro default__test_not_null(model) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}\n\nselect count(*) as validation_errors\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": []}, "macro.dbt.test_not_null": {"unique_id": "macro.dbt.test_not_null", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/schema_tests/not_null.sql", "original_file_path": "macros/schema_tests/not_null.sql", "name": "test_not_null", "macro_sql": "{% macro test_not_null(model) %}\n {% set macro = adapter.dispatch('test_not_null') %}\n {{ macro(model, **kwargs) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.default__test_unique": {"unique_id": "macro.dbt.default__test_unique", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/schema_tests/unique.sql", "original_file_path": "macros/schema_tests/unique.sql", "name": "default__test_unique", "macro_sql": "{% macro default__test_unique(model) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}\n\nselect count(*) as validation_errors\nfrom (\n\n select\n {{ column_name }}\n\n from {{ model }}\n where {{ column_name }} is not null\n group by {{ column_name }}\n having count(*) > 1\n\n) validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.test_unique": {"unique_id": "macro.dbt.test_unique", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/schema_tests/unique.sql", "original_file_path": "macros/schema_tests/unique.sql", "name": "test_unique", "macro_sql": "{% macro test_unique(model) %}\n {% set macro = adapter.dispatch('test_unique') %}\n {{ macro(model, **kwargs) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/schema_tests/accepted_values.sql", "original_file_path": "macros/schema_tests/accepted_values.sql", "name": "default__test_accepted_values", "macro_sql": "{% macro default__test_accepted_values(model, values) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('field')) %}\n{% set quote_values = kwargs.get('quote', True) %}\n\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 not in (\n {% for value in values -%}\n {% if quote_values -%}\n '{{ value }}'\n {%- else -%}\n {{ value }}\n {%- endif -%}\n {%- if not loop.last -%},{%- endif %}\n {%- endfor %}\n )\n)\n\nselect count(*) as validation_errors\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt.test_accepted_values": {"unique_id": "macro.dbt.test_accepted_values", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dbt/include/global_project", "path": "macros/schema_tests/accepted_values.sql", "original_file_path": "macros/schema_tests/accepted_values.sql", "name": "test_accepted_values", "macro_sql": "{% macro test_accepted_values(model, values) %}\n {% set macro = adapter.dispatch('test_accepted_values') %}\n {{ macro(model, values, **kwargs) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.except": {"unique_id": "macro.dbt_utils.except", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__except": {"unique_id": "macro.dbt_utils.default__except", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils.bigquery__except": {"unique_id": "macro.dbt_utils.bigquery__except", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils.replace": {"unique_id": "macro.dbt_utils.replace", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces()) (field, old_chars, new_chars)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__replace": {"unique_id": "macro.dbt_utils.default__replace", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils.concat": {"unique_id": "macro.dbt_utils.concat", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())(fields)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__concat": {"unique_id": "macro.dbt_utils.default__concat", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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 concat({{ fields|join(', ') }})\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.alternative_concat": {"unique_id": "macro.dbt_utils.alternative_concat", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/concat.sql", "original_file_path": "macros/cross_db_utils/concat.sql", "name": "alternative_concat", "macro_sql": "{% macro alternative_concat(fields) %}\n {{ fields|join(' || ') }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.redshift__concat": {"unique_id": "macro.dbt_utils.redshift__concat", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/concat.sql", "original_file_path": "macros/cross_db_utils/concat.sql", "name": "redshift__concat", "macro_sql": "{% macro redshift__concat(fields) %}\n {{ dbt_utils.alternative_concat(fields) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.snowflake__concat": {"unique_id": "macro.dbt_utils.snowflake__concat", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/concat.sql", "original_file_path": "macros/cross_db_utils/concat.sql", "name": "snowflake__concat", "macro_sql": "{% macro snowflake__concat(fields) %}\n {{ dbt_utils.alternative_concat(fields) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.type_string": {"unique_id": "macro.dbt_utils.type_string", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils.type_timestamp": {"unique_id": "macro.dbt_utils.type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils.type_float": {"unique_id": "macro.dbt_utils.type_float", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils.type_numeric": {"unique_id": "macro.dbt_utils.type_numeric", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils.type_bigint": {"unique_id": "macro.dbt_utils.type_bigint", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils.type_int": {"unique_id": "macro.dbt_utils.type_int", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())()) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils._is_relation": {"unique_id": "macro.dbt_utils._is_relation", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils.length": {"unique_id": "macro.dbt_utils.length", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces()) (expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__length": {"unique_id": "macro.dbt_utils.default__length", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils.redshift__length": {"unique_id": "macro.dbt_utils.redshift__length", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils.dateadd": {"unique_id": "macro.dbt_utils.dateadd", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())(datepart, interval, from_date_or_timestamp)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__dateadd": {"unique_id": "macro.dbt_utils.default__dateadd", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils.bigquery__dateadd": {"unique_id": "macro.dbt_utils.bigquery__dateadd", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils.postgres__dateadd": {"unique_id": "macro.dbt_utils.postgres__dateadd", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils.intersect": {"unique_id": "macro.dbt_utils.intersect", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())()) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__intersect": {"unique_id": "macro.dbt_utils.default__intersect", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils.bigquery__intersect": {"unique_id": "macro.dbt_utils.bigquery__intersect", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils.right": {"unique_id": "macro.dbt_utils.right", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces()) (string_text, length_expression)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__right": {"unique_id": "macro.dbt_utils.default__right", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils.bigquery__right": {"unique_id": "macro.dbt_utils.bigquery__right", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils.snowflake__right": {"unique_id": "macro.dbt_utils.snowflake__right", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils.datediff": {"unique_id": "macro.dbt_utils.datediff", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())(first_date, second_date, datepart)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__datediff": {"unique_id": "macro.dbt_utils.default__datediff", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils.bigquery__datediff": {"unique_id": "macro.dbt_utils.bigquery__datediff", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils.postgres__datediff": {"unique_id": "macro.dbt_utils.postgres__datediff", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.safe_cast": {"unique_id": "macro.dbt_utils.safe_cast", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces()) (field, type)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils.hash": {"unique_id": "macro.dbt_utils.hash", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces()) (field)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__hash": {"unique_id": "macro.dbt_utils.default__hash", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.bigquery__hash": {"unique_id": "macro.dbt_utils.bigquery__hash", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.identifier": {"unique_id": "macro.dbt_utils.identifier", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces()) (value)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__identifier": {"unique_id": "macro.dbt_utils.default__identifier", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils.bigquery__identifier": {"unique_id": "macro.dbt_utils.bigquery__identifier", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils.position": {"unique_id": "macro.dbt_utils.position", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces()) (substring_text, string_text)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__position": {"unique_id": "macro.dbt_utils.default__position", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils.bigquery__position": {"unique_id": "macro.dbt_utils.bigquery__position", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils.string_literal": {"unique_id": "macro.dbt_utils.string_literal", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces()) (value)) }}\n{%- endmacro -%}\n\n", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils.current_timestamp": {"unique_id": "macro.dbt_utils.current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())()) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.width_bucket": {"unique_id": "macro.dbt_utils.width_bucket", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces()) (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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils._get_utils_namespaces": {"unique_id": "macro.dbt_utils._get_utils_namespaces", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/dbt_utils", "path": "macros/cross_db_utils/_get_utils_namespaces.sql", "original_file_path": "macros/cross_db_utils/_get_utils_namespaces.sql", "name": "_get_utils_namespaces", "macro_sql": "{% macro _get_utils_namespaces() %}\n {% set override_namespaces = var('dbt_utils_dispatch_list', []) %}\n {% do return(override_namespaces + ['dbt_utils']) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.last_day": {"unique_id": "macro.dbt_utils.last_day", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces()) (date, datepart)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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 {{ exceptions.raise_compiler_error(\n \"dbt_utils.last_day is not supported for datepart 'quarter' on this adapter\") }}\n {%- else -%}\n {{dbt_utils.default_last_day(date, datepart)}}\n {%- endif -%}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.split_part": {"unique_id": "macro.dbt_utils.split_part", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces()) (string_text, delimiter_text, part_number)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils.date_trunc": {"unique_id": "macro.dbt_utils.date_trunc", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces()) (datepart, date)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils._is_ephemeral": {"unique_id": "macro.dbt_utils._is_ephemeral", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())(target_schema, target_table, timestamp_field, start_date, stop_date, period)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())(target_cols_csv, sql, timestamp_field, period, start_timestamp, stop_timestamp, offset)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/dbt_utils", "path": "macros/logger/pretty_log_format.sql", "original_file_path": "macros/logger/pretty_log_format.sql", "name": "pretty_log_format", "macro_sql": "{% macro pretty_log_format(message) %}\n {{ return(adapter.dispatch('pretty_log_format', packages = dbt_utils._get_utils_namespaces())(message)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/dbt_utils", "path": "macros/logger/pretty_log_format.sql", "original_file_path": "macros/logger/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.pretty_time": {"unique_id": "macro.dbt_utils.pretty_time", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/dbt_utils", "path": "macros/logger/pretty_time.sql", "original_file_path": "macros/logger/pretty_time.sql", "name": "pretty_time", "macro_sql": "{% macro pretty_time(format='%H:%M:%S') %}\n {{ return(adapter.dispatch('pretty_time', packages = dbt_utils._get_utils_namespaces())(format)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/dbt_utils", "path": "macros/logger/pretty_time.sql", "original_file_path": "macros/logger/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": []}, "macro.dbt_utils.log_info": {"unique_id": "macro.dbt_utils.log_info", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/dbt_utils", "path": "macros/logger/log_info.sql", "original_file_path": "macros/logger/log_info.sql", "name": "log_info", "macro_sql": "{% macro log_info(message) %}\n {{ return(adapter.dispatch('log_info', packages = dbt_utils._get_utils_namespaces())(message)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/dbt_utils", "path": "macros/logger/log_info.sql", "original_file_path": "macros/logger/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/dbt_utils", "path": "macros/datetime/date_spine.sql", "original_file_path": "macros/datetime/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', packages = dbt_utils._get_utils_namespaces())(start_date, end_date, datepart)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/dbt_utils", "path": "macros/datetime/date_spine.sql", "original_file_path": "macros/datetime/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.date_spine": {"unique_id": "macro.dbt_utils.date_spine", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/dbt_utils", "path": "macros/datetime/date_spine.sql", "original_file_path": "macros/datetime/date_spine.sql", "name": "date_spine", "macro_sql": "{% macro date_spine(datepart, start_date, end_date) %}\n {{ return(adapter.dispatch('date_spine', packages = dbt_utils._get_utils_namespaces())(datepart, start_date, end_date)) }}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/dbt_utils", "path": "macros/datetime/date_spine.sql", "original_file_path": "macros/datetime/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())(field)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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(field, \"'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\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())(field)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())(field, url_parameter)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.haversine_distance": {"unique_id": "macro.dbt_utils.haversine_distance", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/dbt_utils", "path": "macros/geo/haversine_distance.sql", "original_file_path": "macros/geo/haversine_distance.sql", "name": "haversine_distance", "macro_sql": "{% macro haversine_distance(lat1,lon1,lat2,lon2) -%}\n {{ return(adapter.dispatch('haversine_distance', packages = dbt_utils._get_utils_namespaces())(lat1,lon1,lat2,lon2)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/dbt_utils", "path": "macros/geo/haversine_distance.sql", "original_file_path": "macros/geo/haversine_distance.sql", "name": "default__haversine_distance", "macro_sql": "{% macro default__haversine_distance(lat1,lon1,lat2,lon2) -%}\n\n 2 * 3961 * asin(sqrt((sin(radians(({{lat2}} - {{lat1}}) / 2))) ^ 2 +\n cos(radians({{lat1}})) * cos(radians({{lat2}})) *\n (sin(radians(({{lon2}} - {{lon1}}) / 2))) ^ 2))\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/dbt_utils", "path": "macros/schema_tests/equal_rowcount.sql", "original_file_path": "macros/schema_tests/equal_rowcount.sql", "name": "test_equal_rowcount", "macro_sql": "{% macro test_equal_rowcount(model) %}\n {{ return(adapter.dispatch('test_equal_rowcount', packages = dbt_utils._get_utils_namespaces())(model, **kwargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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) %}\n\n{% set compare_model = kwargs.get('compare_model', kwargs.get('arg')) %}\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 abs(\n (select count_a from a) -\n (select count_b from b)\n )\n as diff_count\n\n)\n\nselect diff_count from final\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/dbt_utils", "path": "macros/schema_tests/relationships_where.sql", "original_file_path": "macros/schema_tests/relationships_where.sql", "name": "test_relationships_where", "macro_sql": "{% macro test_relationships_where(model, to, field) %}\n {{ return(adapter.dispatch('test_relationships_where', packages = dbt_utils._get_utils_namespaces())(model, to, field, **kwargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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, to, field) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('from')) %}\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{% set from_condition = kwargs.get('from_condition', \"1=1\") %}\n{% set to_condition = kwargs.get('to_condition', \"1=1\") %}\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 count(*) from exceptions\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.test_recency": {"unique_id": "macro.dbt_utils.test_recency", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/dbt_utils", "path": "macros/schema_tests/recency.sql", "original_file_path": "macros/schema_tests/recency.sql", "name": "test_recency", "macro_sql": "{% macro test_recency(model, datepart, interval) %}\n {{ return(adapter.dispatch('test_recency', packages = dbt_utils._get_utils_namespaces())(model, datepart, interval, **kwargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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, datepart, interval) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('field')) %}\n\nselect\n case when count(*) > 0 then 0\n else 1\n end as error_result\nfrom {{model}}\nwhere {{column_name}} >=\n {{dbt_utils.dateadd(datepart, interval * -1, dbt_utils.current_timestamp())}}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/dbt_utils", "path": "macros/schema_tests/not_constant.sql", "original_file_path": "macros/schema_tests/not_constant.sql", "name": "test_not_constant", "macro_sql": "{% macro test_not_constant(model) %}\n {{ return(adapter.dispatch('test_not_constant', packages = dbt_utils._get_utils_namespaces())(model, **kwargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}\n\nselect count(*)\n\nfrom (\n\n select\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\n from {{ model }}\n\n having count(distinct {{ column_name }}) = 1\n\n ) validation_errors\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": "{% macro test_unique_where(model) %}\r\n {{ return(adapter.dispatch('test_unique_where', packages = dbt_utils._get_utils_namespaces())(model, **kwargs)) }}\r\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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) %}\r\n\r\n{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}\r\n{% set where = kwargs.get('where', kwargs.get('arg')) %}\r\n\r\nselect count(*)\r\nfrom (\r\n\r\n select\r\n {{ column_name }}\r\n\r\n from {{ model }}\r\n where {{ column_name }} is not null\r\n {% if where %} and {{ where }} {% endif %}\r\n group by {{ column_name }}\r\n having count(*) > 1\r\n\r\n) validation_errors\r\n\r\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": "{% macro test_at_least_one(model) %}\n {{ return(adapter.dispatch('test_at_least_one', packages = dbt_utils._get_utils_namespaces())(model, **kwargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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) %}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}\n\nselect count(*)\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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": "{% macro test_unique_combination_of_columns(model, quote_columns = false) %}\n {{ return(adapter.dispatch('test_unique_combination_of_columns', packages = dbt_utils._get_utils_namespaces())(model, quote_columns, **kwargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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, quote_columns = false) %}\n\n{%- set columns = kwargs.get('combination_of_columns', kwargs.get('arg')) %}\n\n{% if not quote_columns %}\n {%- set column_list=columns %}\n{% elif quote_columns %}\n {%- set column_list=[] %}\n {% for column in 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\n group by {{ columns_csv }}\n having count(*) > 1\n\n)\n\nselect count(*)\nfrom validation_errors\n\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/dbt_utils", "path": "macros/schema_tests/cardinality_equality.sql", "original_file_path": "macros/schema_tests/cardinality_equality.sql", "name": "test_cardinality_equality", "macro_sql": "{% macro test_cardinality_equality(model, to, field) %}\n\n {{ return(adapter.dispatch('test_cardinality_equality', packages = dbt_utils._get_utils_namespaces())(model, to, field, **kwargs)) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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, to, field) %}\n\n{# T-SQL doesn't let you use numbers as aliases for columns #}\n{# Thus, no \"GROUP BY 1\" #}\n\n{% set column_name = kwargs.get('column_name', kwargs.get('from')) %}\n\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 {{ column_name }}\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 count(*)\nfrom unioned\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": "{% macro test_expression_is_true(model, 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', packages = dbt_utils._get_utils_namespaces())(model, condition, **kwargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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, condition) %}\n\n{% set expression = kwargs.get('expression', kwargs.get('arg')) %}\n\nwith meet_condition as (\n\n select * from {{ model }} where {{ condition }}\n\n),\nvalidation_errors as (\n\n select\n *\n from meet_condition\n where not({{expression}})\n\n)\n\nselect count(*)\nfrom validation_errors\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": "{% macro test_not_null_where(model) %}\r\n {{ return(adapter.dispatch('test_not_null_where', packages = dbt_utils._get_utils_namespaces())(model, **kwargs)) }}\r\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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) %}\r\n\r\n{% set column_name = kwargs.get('column_name', kwargs.get('arg')) %}\r\n{% set where = kwargs.get('where', kwargs.get('arg')) %}\r\n\r\nselect count(*)\r\nfrom {{ model }}\r\nwhere {{ column_name }} is null\r\n{% if where %} and {{ where }} {% endif %}\r\n\r\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.test_equality": {"unique_id": "macro.dbt_utils.test_equality", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/dbt_utils", "path": "macros/schema_tests/equality.sql", "original_file_path": "macros/schema_tests/equality.sql", "name": "test_equality", "macro_sql": "{% macro test_equality(model) %}\n {{ return(adapter.dispatch('test_equality', packages = dbt_utils._get_utils_namespaces())(model, **kwargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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) %}\n\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{%- set compare_columns = kwargs.get('compare_columns', None) -%}\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_model = kwargs.get('compare_model', kwargs.get('arg')) %}\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 * from a_minus_b\n union all\n select * from b_minus_a\n\n),\n\nfinal as (\n\n select (select count(*) from unioned) +\n (select abs(\n (select count(*) from a_minus_b) -\n (select count(*) from b_minus_a)\n ))\n as count\n\n)\n\nselect count from final\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": "{% macro test_mutually_exclusive_ranges(model, lower_bound_column, upper_bound_column, partition_by=None, gaps='allowed') %}\n {{ return(adapter.dispatch('test_mutually_exclusive_ranges', packages = dbt_utils._get_utils_namespaces())(model, lower_bound_column, upper_bound_column, partition_by, gaps)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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') %}\n\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\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 }},\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 < upper_bound,\n false\n ) as lower_bound_less_than_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_less_than_upper_bound\n and upper_bound_{{ allow_gaps_operator_in_words }}_next_lower_bound\n )\n)\n\nselect count(*) from validation_errors\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.nullcheck_table": {"unique_id": "macro.dbt_utils.nullcheck_table", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())(relation)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())(schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())(upper_bound)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils.generate_series": {"unique_id": "macro.dbt_utils.generate_series", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())(upper_bound)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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 * pow(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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())(schema, prefix, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())(schema, prefix, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.star": {"unique_id": "macro.dbt_utils.star", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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=[]) -%}\n {{ return(adapter.dispatch('star', packages = dbt_utils._get_utils_namespaces())(from, relation_alias, except)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__star": {"unique_id": "macro.dbt_utils.default__star", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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=[]) -%}\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\n {%- for col in cols -%}\n\n {%- if col.column 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 }}\n {%- if not loop.last %},{{ '\\n ' }}{% endif %}\n\n {%- endfor -%}\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.unpivot": {"unique_id": "macro.dbt_utils.unpivot", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())(relation, cast_to, exclude, remove, field_name, value_name, table)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__unpivot": {"unique_id": "macro.dbt_utils.default__unpivot", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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({{ col.column }} 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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.union_relations": {"unique_id": "macro.dbt_utils.union_relations", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())(relations, column_override, include, exclude, source_column_name)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.group_by": {"unique_id": "macro.dbt_utils.group_by", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())(n)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils.surrogate_key": {"unique_id": "macro.dbt_utils.surrogate_key", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())(field_list, *varargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.safe_add": {"unique_id": "macro.dbt_utils.safe_add", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())(*varargs)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.dbt_utils.nullcheck": {"unique_id": "macro.dbt_utils.nullcheck", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())(cols)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__nullcheck": {"unique_id": "macro.dbt_utils.default__nullcheck", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())\n (schema_pattern, table_pattern, exclude, database)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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 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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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, max_records=none, default=none) -%}\n {{ return(adapter.dispatch('get_column_values', packages = dbt_utils._get_utils_namespaces())(table, column, max_records, default)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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, max_records=none, default=none) -%}\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\n {%- set target_relation = adapter.get_relation(database=table.database,\n schema=table.schema,\n identifier=table.identifier) -%}\n\n {%- call statement('get_column_values', fetch_result=true) %}\n\n {%- if not target_relation and default is none -%}\n\n {{ exceptions.raise_compiler_error(\"In get_column_values(): relation \" ~ table ~ \" does not exist and no default value was provided.\") }}\n\n {%- elif not target_relation and default is not none -%}\n\n {{ log(\"Relation \" ~ table ~ \" does not exist. Returning the default value: \" ~ default) }}\n\n {{ return(default) }}\n\n {%- else -%}\n\n select\n {{ column }} as value\n\n from {{ target_relation }}\n group by 1\n order by count(*) desc\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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.pivot": {"unique_id": "macro.dbt_utils.pivot", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())(column, values, alias, agg, cmp, prefix, suffix, then_value, else_value, quote_identifiers, distinct)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.dbt_utils.default__pivot": {"unique_id": "macro.dbt_utils.default__pivot", "package_name": "dbt_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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 {{prefix ~ v ~ suffix }}\n {% endif %}\n {% endif %}\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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = dbt_utils._get_utils_namespaces())(query)) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.fivetran_utils.enabled_vars": {"unique_id": "macro.fivetran_utils.enabled_vars", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.fivetran_utils.percentile": {"unique_id": "macro.fivetran_utils.percentile", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = fivetran_utils._get_utils_namespaces()) (percentile_field, partition_field, percent) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.fivetran_utils.default__percentile": {"unique_id": "macro.fivetran_utils.default__percentile", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.fivetran_utils.bigquery__percentile": {"unique_id": "macro.fivetran_utils.bigquery__percentile", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.fivetran_utils.max_bool": {"unique_id": "macro.fivetran_utils.max_bool", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = fivetran_utils._get_utils_namespaces()) (boolean_field) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.fivetran_utils.string_agg": {"unique_id": "macro.fivetran_utils.string_agg", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = fivetran_utils._get_utils_namespaces()) (field_to_agg, delimiter) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.fivetran_utils.timestamp_diff": {"unique_id": "macro.fivetran_utils.timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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('datediff', packages = fivetran_utils._get_utils_namespaces())(first_date, second_date, datepart) }}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.fivetran_utils.postgres__datediff": {"unique_id": "macro.fivetran_utils.postgres__datediff", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/fivetran_utils", "path": "macros/timestamp_diff.sql", "original_file_path": "macros/timestamp_diff.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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.fivetran_utils.generate_columns_macro": {"unique_id": "macro.fivetran_utils.generate_columns_macro", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.fivetran_utils.first_value": {"unique_id": "macro.fivetran_utils.first_value", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = fivetran_utils._get_utils_namespaces()) (first_value_field, partition_field, order_by_field, order) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.fivetran_utils.union_relations": {"unique_id": "macro.fivetran_utils.union_relations", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.fivetran_utils.union_tables": {"unique_id": "macro.fivetran_utils.union_tables", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.fivetran_utils.snowflake__get_columns_for_macro": {"unique_id": "macro.fivetran_utils.snowflake__get_columns_for_macro", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/fivetran_utils", "path": "macros/get_columns_for_macro.sql", "original_file_path": "macros/get_columns_for_macro.sql", "name": "snowflake__get_columns_for_macro", "macro_sql": "{% macro snowflake__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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.fivetran_utils.get_columns_for_macro": {"unique_id": "macro.fivetran_utils.get_columns_for_macro", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.fivetran_utils.quote_column": {"unique_id": "macro.fivetran_utils.quote_column", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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 == 'bigquery' %}\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": []}, "macro.fivetran_utils.json_extract": {"unique_id": "macro.fivetran_utils.json_extract", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = fivetran_utils._get_utils_namespaces()) (string, string_path) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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({{string}}, {{ \"'$.\" ~ string_path ~ \"'\" }} )\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.fivetran_utils.timestamp_add": {"unique_id": "macro.fivetran_utils.timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = fivetran_utils._get_utils_namespaces()) (datepart, interval, from_timestamp) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.fivetran_utils.ceiling": {"unique_id": "macro.fivetran_utils.ceiling", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/fivetran_utils", "path": "macros/ceiling.sql", "original_file_path": "macros/ceiling.sql", "name": "ceiling", "macro_sql": "{% macro ceiling(num) -%}\n\n{{ adapter.dispatch('ceiling', packages = fivetran_utils._get_utils_namespaces()) (num) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.fivetran_utils.default__ceiling": {"unique_id": "macro.fivetran_utils.default__ceiling", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.fivetran_utils.snowflake__ceiling": {"unique_id": "macro.fivetran_utils.snowflake__ceiling", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.fivetran_utils._get_utils_namespaces": {"unique_id": "macro.fivetran_utils._get_utils_namespaces", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/fivetran_utils", "path": "macros/_get_utils_namespaces.sql", "original_file_path": "macros/_get_utils_namespaces.sql", "name": "_get_utils_namespaces", "macro_sql": "{% macro _get_utils_namespaces() %}\n {% set override_namespaces = var('dbt_utils_dispatch_list', []) %}\n {% do return(override_namespaces + ['dbt_utils', 'fivetran_utils']) %}\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.fivetran_utils.array_agg": {"unique_id": "macro.fivetran_utils.array_agg", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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', packages = fivetran_utils._get_utils_namespaces()) (field_to_agg) }}\n\n{%- endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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 listagg({{ field_to_agg }}, ',')\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.fivetran_utils.snowflake__array_agg": {"unique_id": "macro.fivetran_utils.snowflake__array_agg", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "name": "snowflake__array_agg", "macro_sql": "{% macro snowflake__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": []}, "macro.fivetran_utils.bigquery__array_agg": {"unique_id": "macro.fivetran_utils.bigquery__array_agg", "package_name": "fivetran_utils", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/fivetran_utils", "path": "macros/array_agg.sql", "original_file_path": "macros/array_agg.sql", "name": "bigquery__array_agg", "macro_sql": "{% macro bigquery__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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "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/Zendesk/dbt_zendesk/integration_tests/dbt_modules/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": []}, "macro.zendesk_source.get_domain_name_columns": {"unique_id": "macro.zendesk_source.get_domain_name_columns", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "macros/get_domain_name_columns.sql", "original_file_path": "macros/get_domain_name_columns.sql", "name": "get_domain_name_columns", "macro_sql": "{% macro get_domain_name_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"domain_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"index\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"organization_id\", \"datatype\": dbt_utils.type_int()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.zendesk_source.get_user_tag_columns": {"unique_id": "macro.zendesk_source.get_user_tag_columns", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "macros/get_user_tag_columns.sql", "original_file_path": "macros/get_user_tag_columns.sql", "name": "get_user_tag_columns", "macro_sql": "{% macro get_user_tag_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"user_id\", \"datatype\": dbt_utils.type_int()}\n] %}\n\n{% if target.type == 'redshift' %}\n {{ columns.append( {\"name\": \"tag\", \"datatype\": dbt_utils.type_string(), \"quote\": True } ) }}\n\n{% elif target.type == 'snowflake' %}\n {{ columns.append( {\"name\": \"TAG\", \"datatype\": dbt_utils.type_string(), \"quote\": True } ) }}\n\n{% else %}\n {{ columns.append( {\"name\": \"tag\", \"datatype\": dbt_utils.type_string()} ) }}\n\n{% endif %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.zendesk_source.get_ticket_form_history_columns": {"unique_id": "macro.zendesk_source.get_ticket_form_history_columns", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "macros/get_ticket_form_history_columns.sql", "original_file_path": "macros/get_ticket_form_history_columns.sql", "name": "get_ticket_form_history_columns", "macro_sql": "{% macro get_ticket_form_history_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_deleted\", \"datatype\": \"boolean\"},\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"active\", \"datatype\": \"boolean\"},\n {\"name\": \"created_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"display_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"end_user_visible\", \"datatype\": \"boolean\"},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"name\", \"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": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.zendesk_source.get_schedule_columns": {"unique_id": "macro.zendesk_source.get_schedule_columns", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "macros/get_schedule_columns.sql", "original_file_path": "macros/get_schedule_columns.sql", "name": "get_schedule_columns", "macro_sql": "{% macro get_schedule_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_deleted\", \"datatype\": \"boolean\"},\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"created_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"end_time\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"end_time_utc\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"start_time\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"start_time_utc\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"time_zone\", \"datatype\": dbt_utils.type_string()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.zendesk_source.get_ticket_tag_columns": {"unique_id": "macro.zendesk_source.get_ticket_tag_columns", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "macros/get_ticket_tag_columns.sql", "original_file_path": "macros/get_ticket_tag_columns.sql", "name": "get_ticket_tag_columns", "macro_sql": "{% macro get_ticket_tag_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"ticket_id\", \"datatype\": dbt_utils.type_int()}\n] %}\n\n{% if target.type == 'redshift' %}\n {{ columns.append( {\"name\": \"tag\", \"datatype\": dbt_utils.type_string(), \"quote\": True } ) }}\n\n{% elif target.type == 'snowflake' %}\n {{ columns.append( {\"name\": \"TAG\", \"datatype\": dbt_utils.type_string(), \"quote\": True } ) }}\n\n{% else %}\n {{ columns.append( {\"name\": \"tag\", \"datatype\": dbt_utils.type_string()} ) }}\n\n{% endif %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.zendesk_source.get_organization_tag_columns": {"unique_id": "macro.zendesk_source.get_organization_tag_columns", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "macros/get_organization_tag_columns.sql", "original_file_path": "macros/get_organization_tag_columns.sql", "name": "get_organization_tag_columns", "macro_sql": "{% macro get_organization_tag_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"organization_id\", \"datatype\": dbt_utils.type_int()}\n] %}\n\n{% if target.type == 'redshift' %}\n {{ columns.append( {\"name\": \"tag\", \"datatype\": dbt_utils.type_string(), \"quote\": True } ) }}\n\n{% elif target.type == 'snowflake' %}\n {{ columns.append( {\"name\": \"TAG\", \"datatype\": dbt_utils.type_string(), \"quote\": True } ) }}\n\n{% else %}\n {{ columns.append( {\"name\": \"tag\", \"datatype\": dbt_utils.type_string()} ) }}\n\n{% endif %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.zendesk_source.get_group_columns": {"unique_id": "macro.zendesk_source.get_group_columns", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "macros/get_group_columns.sql", "original_file_path": "macros/get_group_columns.sql", "name": "get_group_columns", "macro_sql": "{% macro get_group_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_deleted\", \"datatype\": \"boolean\"},\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"created_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"updated_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"url\", \"datatype\": dbt_utils.type_string()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.zendesk_source.get_user_columns": {"unique_id": "macro.zendesk_source.get_user_columns", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "macros/get_user_columns.sql", "original_file_path": "macros/get_user_columns.sql", "name": "get_user_columns", "macro_sql": "{% macro get_user_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"active\", \"datatype\": \"boolean\"},\n {\"name\": \"alias\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"authenticity_token\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"chat_only\", \"datatype\": \"boolean\"},\n {\"name\": \"created_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"details\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"email\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"external_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"last_login_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"locale\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"locale_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"moderator\", \"datatype\": \"boolean\"},\n {\"name\": \"name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"notes\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"only_private_comments\", \"datatype\": \"boolean\"},\n {\"name\": \"organization_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"phone\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"remote_photo_url\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"restricted_agent\", \"datatype\": \"boolean\"},\n {\"name\": \"role\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"shared\", \"datatype\": \"boolean\"},\n {\"name\": \"shared_agent\", \"datatype\": \"boolean\"},\n {\"name\": \"signature\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"suspended\", \"datatype\": \"boolean\"},\n {\"name\": \"ticket_restriction\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"time_zone\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"two_factor_auth_enabled\", \"datatype\": \"boolean\"},\n {\"name\": \"updated_at\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"verified\", \"datatype\": \"boolean\"}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.zendesk_source.get_ticket_columns": {"unique_id": "macro.zendesk_source.get_ticket_columns", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "macros/get_ticket_columns.sql", "original_file_path": "macros/get_ticket_columns.sql", "name": "get_ticket_columns", "macro_sql": "{% macro get_ticket_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"allow_channelback\", \"datatype\": \"boolean\"},\n {\"name\": \"assignee_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"brand_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"created_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"description\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"due_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"external_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"forum_topic_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"group_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"has_incidents\", \"datatype\": \"boolean\"},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"is_public\", \"datatype\": \"boolean\"},\n {\"name\": \"merged_ticket_ids\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"organization_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"priority\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"problem_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"recipient\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"requester_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"subject\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"submitter_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"system_ccs\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"system_client\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"system_ip_address\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"system_json_email_identifier\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"system_latitude\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"system_location\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"system_longitude\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"system_machine_generated\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"system_message_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"system_raw_email_identifier\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"ticket_form_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"updated_at\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"via_channel\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"via_source_from_address\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"via_source_from_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"via_source_from_title\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"via_source_rel\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"via_source_to_address\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"via_source_to_name\", \"datatype\": dbt_utils.type_int()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.zendesk_source.get_ticket_field_history_columns": {"unique_id": "macro.zendesk_source.get_ticket_field_history_columns", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "macros/get_ticket_field_history_columns.sql", "original_file_path": "macros/get_ticket_field_history_columns.sql", "name": "get_ticket_field_history_columns", "macro_sql": "{% macro get_ticket_field_history_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"field_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"ticket_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"updated\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"user_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"value\", \"datatype\": dbt_utils.type_string()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.zendesk_source.get_ticket_schedule_columns": {"unique_id": "macro.zendesk_source.get_ticket_schedule_columns", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "macros/get_ticket_schedule_columns.sql", "original_file_path": "macros/get_ticket_schedule_columns.sql", "name": "get_ticket_schedule_columns", "macro_sql": "{% macro get_ticket_schedule_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"created_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"schedule_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"ticket_id\", \"datatype\": dbt_utils.type_int()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.zendesk_source.get_organization_columns": {"unique_id": "macro.zendesk_source.get_organization_columns", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "macros/get_organization_columns.sql", "original_file_path": "macros/get_organization_columns.sql", "name": "get_organization_columns", "macro_sql": "{% macro get_organization_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"created_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"details\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"external_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"group_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"notes\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"shared_comments\", \"datatype\": \"boolean\"},\n {\"name\": \"shared_tickets\", \"datatype\": \"boolean\"},\n {\"name\": \"updated_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"url\", \"datatype\": dbt_utils.type_string()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.zendesk_source.get_ticket_comment_columns": {"unique_id": "macro.zendesk_source.get_ticket_comment_columns", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "macros/get_ticket_comment_columns.sql", "original_file_path": "macros/get_ticket_comment_columns.sql", "name": "get_ticket_comment_columns", "macro_sql": "{% macro get_ticket_comment_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"body\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"call_duration\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"call_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"created\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"facebook_comment\", \"datatype\": \"boolean\"},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"location\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"public\", \"datatype\": \"boolean\"},\n {\"name\": \"recording_url\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"started_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"ticket_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"transcription_status\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"transcription_text\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"trusted\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"tweet\", \"datatype\": \"boolean\"},\n {\"name\": \"user_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"voice_comment\", \"datatype\": \"boolean\"},\n {\"name\": \"voice_comment_transcription_visible\", \"datatype\": dbt_utils.type_int()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}, "macro.zendesk_source.get_brand_columns": {"unique_id": "macro.zendesk_source.get_brand_columns", "package_name": "zendesk_source", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests/dbt_modules/zendesk_source", "path": "macros/get_brand_columns.sql", "original_file_path": "macros/get_brand_columns.sql", "name": "get_brand_columns", "macro_sql": "{% macro get_brand_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_deleted\", \"datatype\": \"boolean\"},\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"active\", \"datatype\": \"boolean\"},\n {\"name\": \"brand_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"has_help_center\", \"datatype\": \"boolean\"},\n {\"name\": \"help_center_state\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"logo_content_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"logo_content_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"logo_deleted\", \"datatype\": \"boolean\"},\n {\"name\": \"logo_file_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"logo_height\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"logo_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"logo_inline\", \"datatype\": \"boolean\"},\n {\"name\": \"logo_mapped_content_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"logo_size\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"logo_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"logo_width\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"subdomain\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"url\", \"datatype\": dbt_utils.type_string()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": []}}, "docs": {"dbt.__overview__": {"unique_id": "dbt.__overview__", "package_name": "dbt", "root_path": "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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 `--models` 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 [chat](https://community.getdbt.com/) on Slack for live questions and support."}}, "exposures": {}, "selectors": {}, "disabled": [{"raw_sql": "", "database": "dbt-package-testing", "schema": "zendesk_integration_tests", "fqn": ["zendesk_integration_tests", "user_data_snowflake"], "unique_id": "seed.zendesk_integration_tests.user_data_snowflake", "package_name": "zendesk_integration_tests", "root_path": "/Users/joseph.markiewicz/Documents/dbt_packages/Zendesk/dbt_zendesk/integration_tests", "path": "user_data_snowflake.csv", "original_file_path": "data/user_data_snowflake.csv", "name": "user_data_snowflake", "resource_type": "seed", "alias": "user_data_snowflake", "checksum": {"name": "sha256", "checksum": "4b09e0c6eb7b22c55f7ac4920183b9b1379517c5c854b94b0153831ab84a383c"}, "config": {"enabled": false, "materialized": "seed", "persist_docs": {}, "post-hook": [], "pre-hook": [], "vars": {}, "quoting": {}, "column_types": {"_fivetran_synced": "timestamp", "id": "int64", "external_id": "string", "locale_id": "int64", "organization_id": "int64", "created_at": "timestamp", "last_login_at": "timestamp"}, "alias": null, "schema": null, "database": null, "tags": [], "full_refresh": null, "quote_columns": false}, "tags": [], "refs": [], "sources": [], "depends_on": {"macros": [], "nodes": []}, "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "build_path": null, "deferred": false, "unrendered_config": {"quote_columns": "{{ true if target.type == 'redshift' else false }}", "column_types": {"id": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "external_id": "{{ 'varchar(100)' if target.type == 'redshift' else 'string'}}", "locale_id": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "organization_id": "{{ 'int64' if target.type == 'bigquery' else 'bigint' }}", "created_at": "timestamp", "last_login_at": "timestamp"}, "enabled": "{{ true if target.type == 'snowflake' else false }}"}}], "parent_map": {"seed.zendesk_integration_tests.organization_tag_data_snowflake": [], "seed.zendesk_integration_tests.organization_tag_data": [], "seed.zendesk_integration_tests.ticket_comment_data": [], "seed.zendesk_integration_tests.brand_data": [], "seed.zendesk_integration_tests.domain_name_data": [], "seed.zendesk_integration_tests.user_tag_data_snowflake": [], "seed.zendesk_integration_tests.ticket_field_history_data": [], "seed.zendesk_integration_tests.ticket_data": [], "seed.zendesk_integration_tests.ticket_schedule_data": [], "seed.zendesk_integration_tests.user_data": [], "seed.zendesk_integration_tests.schedule_data": [], "seed.zendesk_integration_tests.ticket_tag_data": [], "seed.zendesk_integration_tests.organization_data": [], "seed.zendesk_integration_tests.ticket_form_history_data": [], "seed.zendesk_integration_tests.group_data": [], "seed.zendesk_integration_tests.user_tag_data": [], "model.zendesk.zendesk__ticket_enriched": ["model.zendesk.int_zendesk__assignee_updates", "model.zendesk.int_zendesk__latest_ticket_form", "model.zendesk.int_zendesk__organization_aggregates", "model.zendesk.int_zendesk__requester_updates", "model.zendesk.int_zendesk__ticket_aggregates", "model.zendesk.int_zendesk__ticket_historical_satisfaction", "model.zendesk.int_zendesk__user_aggregates", "model.zendesk_source.stg_zendesk__group"], "model.zendesk.zendesk__ticket_metrics": ["model.zendesk.int_zendesk__comment_metrics", "model.zendesk.int_zendesk__ticket_first_reply_time_business", "model.zendesk.int_zendesk__ticket_first_resolution_time_business", "model.zendesk.int_zendesk__ticket_full_resolution_time_business", "model.zendesk.int_zendesk__ticket_reply_times_calendar", "model.zendesk.int_zendesk__ticket_resolution_times_calendar", "model.zendesk.int_zendesk__ticket_work_time_business", "model.zendesk.int_zendesk__ticket_work_time_calendar", "model.zendesk.zendesk__ticket_enriched"], "model.zendesk.zendesk__ticket_summary": ["model.zendesk.zendesk__ticket_metrics", "model.zendesk_source.stg_zendesk__user"], "model.zendesk.zendesk__ticket_field_history": ["model.zendesk.int_zendesk__field_calendar_spine", "model.zendesk.int_zendesk__field_history_scd", "model.zendesk.int_zendesk__field_history_scd"], "model.zendesk.zendesk__sla_policies": ["model.zendesk.int_zendesk__agent_work_time_business_hours", "model.zendesk.int_zendesk__agent_work_time_calendar_hours", "model.zendesk.int_zendesk__reply_time_combined", "model.zendesk.int_zendesk__requester_wait_time_business_hours", "model.zendesk.int_zendesk__requester_wait_time_calendar_hours"], "model.zendesk.zendesk__ticket_backlog": ["model.zendesk.zendesk__ticket_field_history", "model.zendesk_source.stg_zendesk__brand", "model.zendesk_source.stg_zendesk__group", "model.zendesk_source.stg_zendesk__organization", "model.zendesk_source.stg_zendesk__ticket", "model.zendesk_source.stg_zendesk__user"], "model.zendesk.int_zendesk__sla_policy_applied": ["model.zendesk.int_zendesk__ticket_aggregates", "model.zendesk.int_zendesk__updates", "model.zendesk.int_zendesk__updates"], "model.zendesk.int_zendesk__agent_work_time_business_hours": ["model.zendesk.int_zendesk__agent_work_time_filtered_statuses", "model.zendesk.int_zendesk__ticket_schedules", "model.zendesk_source.stg_zendesk__schedule"], "model.zendesk.int_zendesk__agent_work_time_calendar_hours": ["model.zendesk.int_zendesk__agent_work_time_filtered_statuses"], "model.zendesk.int_zendesk__agent_work_time_filtered_statuses": ["model.zendesk.int_zendesk__sla_policy_applied", "model.zendesk.int_zendesk__ticket_historical_status"], "model.zendesk.int_zendesk__reply_time_business_hours": ["model.zendesk.int_zendesk__sla_policy_applied", "model.zendesk.int_zendesk__ticket_schedules", "model.zendesk_source.stg_zendesk__schedule"], "model.zendesk.int_zendesk__reply_time_calendar_hours": ["model.zendesk.int_zendesk__sla_policy_applied"], "model.zendesk.int_zendesk__reply_time_combined": ["model.zendesk.int_zendesk__reply_time_business_hours", "model.zendesk.int_zendesk__reply_time_calendar_hours", "model.zendesk.int_zendesk__updates", "model.zendesk.int_zendesk__user_aggregates"], "model.zendesk.int_zendesk__requester_wait_time_calendar_hours": ["model.zendesk.int_zendesk__requester_wait_time_filtered_statuses"], "model.zendesk.int_zendesk__requester_wait_time_business_hours": ["model.zendesk.int_zendesk__requester_wait_time_filtered_statuses", "model.zendesk.int_zendesk__ticket_schedules", "model.zendesk_source.stg_zendesk__schedule"], "model.zendesk.int_zendesk__requester_wait_time_filtered_statuses": ["model.zendesk.int_zendesk__sla_policy_applied", "model.zendesk.int_zendesk__ticket_historical_status"], "model.zendesk.int_zendesk__ticket_reply_times": ["model.zendesk.int_zendesk__comments_enriched"], "model.zendesk.int_zendesk__ticket_reply_times_calendar": ["model.zendesk.int_zendesk__ticket_reply_times", "model.zendesk_source.stg_zendesk__ticket"], "model.zendesk.int_zendesk__comments_enriched": ["model.zendesk.int_zendesk__updates", "model.zendesk_source.stg_zendesk__user"], "model.zendesk.int_zendesk__ticket_first_reply_time_business": ["model.zendesk.int_zendesk__ticket_reply_times", "model.zendesk.int_zendesk__ticket_schedules", "model.zendesk_source.stg_zendesk__schedule"], "model.zendesk.int_zendesk__field_history_enriched": ["model.zendesk.int_zendesk__updater_information", "model.zendesk_source.stg_zendesk__ticket_field_history"], "model.zendesk.int_zendesk__field_history_pivot": ["model.zendesk.int_zendesk__field_history_enriched", "model.zendesk_source.stg_zendesk__ticket_field_history"], "model.zendesk.int_zendesk__updater_information": ["model.zendesk.int_zendesk__organization_aggregates", "model.zendesk.int_zendesk__user_aggregates"], "model.zendesk.int_zendesk__field_history_scd": ["model.zendesk.int_zendesk__field_history_pivot", "model.zendesk.int_zendesk__field_history_pivot"], "model.zendesk.int_zendesk__field_calendar_spine": ["model.zendesk.int_zendesk__calendar_spine", "model.zendesk_source.stg_zendesk__ticket"], "model.zendesk.int_zendesk__ticket_work_time_calendar": ["model.zendesk.int_zendesk__ticket_historical_status"], "model.zendesk.int_zendesk__ticket_work_time_business": ["model.zendesk.int_zendesk__ticket_historical_status", "model.zendesk.int_zendesk__ticket_schedules", "model.zendesk_source.stg_zendesk__schedule"], "model.zendesk.int_zendesk__calendar_spine": ["model.zendesk_source.stg_zendesk__ticket"], "model.zendesk.int_zendesk__ticket_resolution_times_calendar": ["model.zendesk.int_zendesk__ticket_historical_assignee", "model.zendesk.int_zendesk__ticket_historical_group", "model.zendesk.int_zendesk__ticket_historical_status", "model.zendesk_source.stg_zendesk__ticket"], "model.zendesk.int_zendesk__ticket_first_resolution_time_business": ["model.zendesk.int_zendesk__ticket_resolution_times_calendar", "model.zendesk.int_zendesk__ticket_schedules", "model.zendesk_source.stg_zendesk__schedule"], "model.zendesk.int_zendesk__ticket_full_resolution_time_business": ["model.zendesk.int_zendesk__ticket_resolution_times_calendar", "model.zendesk.int_zendesk__ticket_schedules", "model.zendesk_source.stg_zendesk__schedule"], "model.zendesk.int_zendesk__updates": ["model.zendesk_source.stg_zendesk__ticket_comment", "model.zendesk_source.stg_zendesk__ticket_field_history"], "model.zendesk.int_zendesk__ticket_historical_assignee": ["model.zendesk.int_zendesk__updates"], "model.zendesk.int_zendesk__ticket_historical_status": ["model.zendesk.int_zendesk__updates"], "model.zendesk.int_zendesk__user_aggregates": ["model.zendesk_source.stg_zendesk__user", "model.zendesk_source.stg_zendesk__user_tag"], "model.zendesk.int_zendesk__ticket_schedules": ["model.zendesk_source.stg_zendesk__schedule", "model.zendesk_source.stg_zendesk__ticket", "model.zendesk_source.stg_zendesk__ticket_schedule"], "model.zendesk.int_zendesk__assignee_updates": ["model.zendesk.int_zendesk__updates", "model.zendesk_source.stg_zendesk__ticket"], "model.zendesk.int_zendesk__comment_metrics": ["model.zendesk.int_zendesk__comments_enriched"], "model.zendesk.int_zendesk__ticket_historical_group": ["model.zendesk.int_zendesk__updates"], "model.zendesk.int_zendesk__requester_updates": ["model.zendesk.int_zendesk__updates", "model.zendesk_source.stg_zendesk__ticket"], "model.zendesk.int_zendesk__ticket_historical_satisfaction": ["model.zendesk.int_zendesk__updates"], "model.zendesk.int_zendesk__latest_ticket_form": ["model.zendesk_source.stg_zendesk__ticket_form_history"], "model.zendesk.int_zendesk__ticket_aggregates": ["model.zendesk_source.stg_zendesk__brand", "model.zendesk_source.stg_zendesk__ticket", "model.zendesk_source.stg_zendesk__ticket_tag"], "model.zendesk.int_zendesk__organization_aggregates": ["model.zendesk_source.stg_zendesk__domain_name", "model.zendesk_source.stg_zendesk__organization", "model.zendesk_source.stg_zendesk__organization_tag"], "operation.zendesk.zendesk-on-run-start-0": [], "test.zendesk.unique_zendesk__ticket_enriched_ticket_id": ["model.zendesk.zendesk__ticket_enriched"], "test.zendesk.not_null_zendesk__ticket_enriched_ticket_id": ["model.zendesk.zendesk__ticket_enriched"], "test.zendesk.unique_zendesk__sla_policies_sla_event_id": ["model.zendesk.zendesk__sla_policies"], "test.zendesk.unique_zendesk__ticket_metrics_ticket_id": ["model.zendesk.zendesk__ticket_metrics"], "test.zendesk.not_null_zendesk__ticket_metrics_ticket_id": ["model.zendesk.zendesk__ticket_metrics"], "model.zendesk_source.stg_zendesk__user_tag": ["model.zendesk_source.stg_zendesk__user_tag_tmp", "model.zendesk_source.stg_zendesk__user_tag_tmp"], "model.zendesk_source.stg_zendesk__ticket_tag": ["model.zendesk_source.stg_zendesk__ticket_tag_tmp", "model.zendesk_source.stg_zendesk__ticket_tag_tmp"], "model.zendesk_source.stg_zendesk__ticket_field_history": ["model.zendesk_source.stg_zendesk__ticket_field_history_tmp", "model.zendesk_source.stg_zendesk__ticket_field_history_tmp"], "model.zendesk_source.stg_zendesk__organization": ["model.zendesk_source.stg_zendesk__organization_tmp", "model.zendesk_source.stg_zendesk__organization_tmp"], "model.zendesk_source.stg_zendesk__group": ["model.zendesk_source.stg_zendesk__group_tmp", "model.zendesk_source.stg_zendesk__group_tmp"], "model.zendesk_source.stg_zendesk__ticket_comment": ["model.zendesk_source.stg_zendesk__ticket_comment_tmp", "model.zendesk_source.stg_zendesk__ticket_comment_tmp"], "model.zendesk_source.stg_zendesk__ticket_schedule": ["model.zendesk_source.stg_zendesk__ticket_schedule_tmp", "model.zendesk_source.stg_zendesk__ticket_schedule_tmp"], "model.zendesk_source.stg_zendesk__schedule": ["model.zendesk_source.stg_zendesk__schedule_tmp", "model.zendesk_source.stg_zendesk__schedule_tmp"], "model.zendesk_source.stg_zendesk__user": ["model.zendesk_source.stg_zendesk__user_tmp", "model.zendesk_source.stg_zendesk__user_tmp"], "model.zendesk_source.stg_zendesk__brand": ["model.zendesk_source.stg_zendesk__brand_tmp", "model.zendesk_source.stg_zendesk__brand_tmp"], "model.zendesk_source.stg_zendesk__ticket_form_history": ["model.zendesk_source.stg_zendesk__ticket_form_history_tmp", "model.zendesk_source.stg_zendesk__ticket_form_history_tmp"], "model.zendesk_source.stg_zendesk__domain_name": ["model.zendesk_source.stg_zendesk__domain_name_tmp", "model.zendesk_source.stg_zendesk__domain_name_tmp"], "model.zendesk_source.stg_zendesk__organization_tag": ["model.zendesk_source.stg_zendesk__organization_tag_tmp", "model.zendesk_source.stg_zendesk__organization_tag_tmp"], "model.zendesk_source.stg_zendesk__ticket": ["model.zendesk_source.stg_zendesk__ticket_tmp", "model.zendesk_source.stg_zendesk__ticket_tmp"], "model.zendesk_source.stg_zendesk__user_tmp": ["seed.zendesk_integration_tests.user_data"], "model.zendesk_source.stg_zendesk__group_tmp": ["seed.zendesk_integration_tests.group_data"], "model.zendesk_source.stg_zendesk__ticket_tmp": ["seed.zendesk_integration_tests.ticket_data"], "model.zendesk_source.stg_zendesk__brand_tmp": ["seed.zendesk_integration_tests.brand_data"], "model.zendesk_source.stg_zendesk__ticket_tag_tmp": ["seed.zendesk_integration_tests.ticket_tag_data"], "model.zendesk_source.stg_zendesk__user_tag_tmp": ["seed.zendesk_integration_tests.user_tag_data"], "model.zendesk_source.stg_zendesk__ticket_field_history_tmp": ["seed.zendesk_integration_tests.ticket_field_history_data"], "model.zendesk_source.stg_zendesk__ticket_form_history_tmp": ["seed.zendesk_integration_tests.ticket_form_history_data"], "model.zendesk_source.stg_zendesk__ticket_comment_tmp": ["seed.zendesk_integration_tests.ticket_comment_data"], "model.zendesk_source.stg_zendesk__organization_tag_tmp": ["seed.zendesk_integration_tests.organization_tag_data"], "model.zendesk_source.stg_zendesk__schedule_tmp": ["seed.zendesk_integration_tests.schedule_data"], "model.zendesk_source.stg_zendesk__organization_tmp": ["seed.zendesk_integration_tests.organization_data"], "model.zendesk_source.stg_zendesk__ticket_schedule_tmp": ["source.zendesk_source.zendesk.ticket_schedule", "source.zendesk_source.zendesk.ticket_schedule", "source.zendesk_source.zendesk.ticket_schedule"], "model.zendesk_source.stg_zendesk__domain_name_tmp": ["seed.zendesk_integration_tests.domain_name_data"], "test.zendesk_source.unique_stg_zendesk__ticket_ticket_id": ["model.zendesk_source.stg_zendesk__ticket"], "test.zendesk_source.not_null_stg_zendesk__ticket_ticket_id": ["model.zendesk_source.stg_zendesk__ticket"], "test.zendesk_source.unique_stg_zendesk__brand_brand_id": ["model.zendesk_source.stg_zendesk__brand"], "test.zendesk_source.not_null_stg_zendesk__brand_brand_id": ["model.zendesk_source.stg_zendesk__brand"], "test.zendesk_source.not_null_stg_zendesk__domain_name_organization_id": ["model.zendesk_source.stg_zendesk__domain_name"], "test.zendesk_source.unique_stg_zendesk__group_group_id": ["model.zendesk_source.stg_zendesk__group"], "test.zendesk_source.not_null_stg_zendesk__group_group_id": ["model.zendesk_source.stg_zendesk__group"], "test.zendesk_source.unique_stg_zendesk__organization_organization_id": ["model.zendesk_source.stg_zendesk__organization"], "test.zendesk_source.not_null_stg_zendesk__organization_organization_id": ["model.zendesk_source.stg_zendesk__organization"], "test.zendesk_source.unique_stg_zendesk__ticket_comment_ticket_comment_id": ["model.zendesk_source.stg_zendesk__ticket_comment"], "test.zendesk_source.not_null_stg_zendesk__ticket_comment_ticket_comment_id": ["model.zendesk_source.stg_zendesk__ticket_comment"], "test.zendesk_source.unique_stg_zendesk__user_user_id": ["model.zendesk_source.stg_zendesk__user"], "test.zendesk_source.not_null_stg_zendesk__user_user_id": ["model.zendesk_source.stg_zendesk__user"], "test.zendesk_source.not_null_stg_zendesk__ticket_form_history_ticket_form_id": ["model.zendesk_source.stg_zendesk__ticket_form_history"], "source.zendesk_source.zendesk.ticket": [], "source.zendesk_source.zendesk.brand": [], "source.zendesk_source.zendesk.domain_name": [], "source.zendesk_source.zendesk.group": [], "source.zendesk_source.zendesk.organization_tag": [], "source.zendesk_source.zendesk.organization": [], "source.zendesk_source.zendesk.ticket_comment": [], "source.zendesk_source.zendesk.user_tag": [], "source.zendesk_source.zendesk.user": [], "source.zendesk_source.zendesk.schedule": [], "source.zendesk_source.zendesk.ticket_schedule": [], "source.zendesk_source.zendesk.ticket_form_history": [], "source.zendesk_source.zendesk.ticket_tag": [], "source.zendesk_source.zendesk.ticket_field_history": []}, "child_map": {"seed.zendesk_integration_tests.organization_tag_data_snowflake": [], "seed.zendesk_integration_tests.organization_tag_data": ["model.zendesk_source.stg_zendesk__organization_tag_tmp"], "seed.zendesk_integration_tests.ticket_comment_data": ["model.zendesk_source.stg_zendesk__ticket_comment_tmp"], "seed.zendesk_integration_tests.brand_data": ["model.zendesk_source.stg_zendesk__brand_tmp"], "seed.zendesk_integration_tests.domain_name_data": ["model.zendesk_source.stg_zendesk__domain_name_tmp"], "seed.zendesk_integration_tests.user_tag_data_snowflake": [], "seed.zendesk_integration_tests.ticket_field_history_data": ["model.zendesk_source.stg_zendesk__ticket_field_history_tmp"], "seed.zendesk_integration_tests.ticket_data": ["model.zendesk_source.stg_zendesk__ticket_tmp"], "seed.zendesk_integration_tests.ticket_schedule_data": [], "seed.zendesk_integration_tests.user_data": ["model.zendesk_source.stg_zendesk__user_tmp"], "seed.zendesk_integration_tests.schedule_data": ["model.zendesk_source.stg_zendesk__schedule_tmp"], "seed.zendesk_integration_tests.ticket_tag_data": ["model.zendesk_source.stg_zendesk__ticket_tag_tmp"], "seed.zendesk_integration_tests.organization_data": ["model.zendesk_source.stg_zendesk__organization_tmp"], "seed.zendesk_integration_tests.ticket_form_history_data": ["model.zendesk_source.stg_zendesk__ticket_form_history_tmp"], "seed.zendesk_integration_tests.group_data": ["model.zendesk_source.stg_zendesk__group_tmp"], "seed.zendesk_integration_tests.user_tag_data": ["model.zendesk_source.stg_zendesk__user_tag_tmp"], "model.zendesk.zendesk__ticket_enriched": ["model.zendesk.zendesk__ticket_metrics", "test.zendesk.not_null_zendesk__ticket_enriched_ticket_id", "test.zendesk.unique_zendesk__ticket_enriched_ticket_id"], "model.zendesk.zendesk__ticket_metrics": ["model.zendesk.zendesk__ticket_summary", "test.zendesk.not_null_zendesk__ticket_metrics_ticket_id", "test.zendesk.unique_zendesk__ticket_metrics_ticket_id"], "model.zendesk.zendesk__ticket_summary": [], "model.zendesk.zendesk__ticket_field_history": ["model.zendesk.zendesk__ticket_backlog"], "model.zendesk.zendesk__sla_policies": ["test.zendesk.unique_zendesk__sla_policies_sla_event_id"], "model.zendesk.zendesk__ticket_backlog": [], "model.zendesk.int_zendesk__sla_policy_applied": ["model.zendesk.int_zendesk__agent_work_time_filtered_statuses", "model.zendesk.int_zendesk__reply_time_business_hours", "model.zendesk.int_zendesk__reply_time_calendar_hours", "model.zendesk.int_zendesk__requester_wait_time_filtered_statuses"], "model.zendesk.int_zendesk__agent_work_time_business_hours": ["model.zendesk.zendesk__sla_policies"], "model.zendesk.int_zendesk__agent_work_time_calendar_hours": ["model.zendesk.zendesk__sla_policies"], "model.zendesk.int_zendesk__agent_work_time_filtered_statuses": ["model.zendesk.int_zendesk__agent_work_time_business_hours", "model.zendesk.int_zendesk__agent_work_time_calendar_hours"], "model.zendesk.int_zendesk__reply_time_business_hours": ["model.zendesk.int_zendesk__reply_time_combined"], "model.zendesk.int_zendesk__reply_time_calendar_hours": ["model.zendesk.int_zendesk__reply_time_combined"], "model.zendesk.int_zendesk__reply_time_combined": ["model.zendesk.zendesk__sla_policies"], "model.zendesk.int_zendesk__requester_wait_time_calendar_hours": ["model.zendesk.zendesk__sla_policies"], "model.zendesk.int_zendesk__requester_wait_time_business_hours": ["model.zendesk.zendesk__sla_policies"], "model.zendesk.int_zendesk__requester_wait_time_filtered_statuses": ["model.zendesk.int_zendesk__requester_wait_time_business_hours", "model.zendesk.int_zendesk__requester_wait_time_calendar_hours"], "model.zendesk.int_zendesk__ticket_reply_times": ["model.zendesk.int_zendesk__ticket_first_reply_time_business", "model.zendesk.int_zendesk__ticket_reply_times_calendar"], "model.zendesk.int_zendesk__ticket_reply_times_calendar": ["model.zendesk.zendesk__ticket_metrics"], "model.zendesk.int_zendesk__comments_enriched": ["model.zendesk.int_zendesk__comment_metrics", "model.zendesk.int_zendesk__ticket_reply_times"], "model.zendesk.int_zendesk__ticket_first_reply_time_business": ["model.zendesk.zendesk__ticket_metrics"], "model.zendesk.int_zendesk__field_history_enriched": ["model.zendesk.int_zendesk__field_history_pivot"], "model.zendesk.int_zendesk__field_history_pivot": ["model.zendesk.int_zendesk__field_history_scd", "model.zendesk.int_zendesk__field_history_scd"], "model.zendesk.int_zendesk__updater_information": ["model.zendesk.int_zendesk__field_history_enriched"], "model.zendesk.int_zendesk__field_history_scd": ["model.zendesk.zendesk__ticket_field_history", "model.zendesk.zendesk__ticket_field_history"], "model.zendesk.int_zendesk__field_calendar_spine": ["model.zendesk.zendesk__ticket_field_history"], "model.zendesk.int_zendesk__ticket_work_time_calendar": ["model.zendesk.zendesk__ticket_metrics"], "model.zendesk.int_zendesk__ticket_work_time_business": ["model.zendesk.zendesk__ticket_metrics"], "model.zendesk.int_zendesk__calendar_spine": ["model.zendesk.int_zendesk__field_calendar_spine"], "model.zendesk.int_zendesk__ticket_resolution_times_calendar": ["model.zendesk.int_zendesk__ticket_first_resolution_time_business", "model.zendesk.int_zendesk__ticket_full_resolution_time_business", "model.zendesk.zendesk__ticket_metrics"], "model.zendesk.int_zendesk__ticket_first_resolution_time_business": ["model.zendesk.zendesk__ticket_metrics"], "model.zendesk.int_zendesk__ticket_full_resolution_time_business": ["model.zendesk.zendesk__ticket_metrics"], "model.zendesk.int_zendesk__updates": ["model.zendesk.int_zendesk__assignee_updates", "model.zendesk.int_zendesk__comments_enriched", "model.zendesk.int_zendesk__reply_time_combined", "model.zendesk.int_zendesk__requester_updates", "model.zendesk.int_zendesk__sla_policy_applied", "model.zendesk.int_zendesk__sla_policy_applied", "model.zendesk.int_zendesk__ticket_historical_assignee", "model.zendesk.int_zendesk__ticket_historical_group", "model.zendesk.int_zendesk__ticket_historical_satisfaction", "model.zendesk.int_zendesk__ticket_historical_status"], "model.zendesk.int_zendesk__ticket_historical_assignee": ["model.zendesk.int_zendesk__ticket_resolution_times_calendar"], "model.zendesk.int_zendesk__ticket_historical_status": ["model.zendesk.int_zendesk__agent_work_time_filtered_statuses", "model.zendesk.int_zendesk__requester_wait_time_filtered_statuses", "model.zendesk.int_zendesk__ticket_resolution_times_calendar", "model.zendesk.int_zendesk__ticket_work_time_business", "model.zendesk.int_zendesk__ticket_work_time_calendar"], "model.zendesk.int_zendesk__user_aggregates": ["model.zendesk.int_zendesk__reply_time_combined", "model.zendesk.int_zendesk__updater_information", "model.zendesk.zendesk__ticket_enriched"], "model.zendesk.int_zendesk__ticket_schedules": ["model.zendesk.int_zendesk__agent_work_time_business_hours", "model.zendesk.int_zendesk__reply_time_business_hours", "model.zendesk.int_zendesk__requester_wait_time_business_hours", "model.zendesk.int_zendesk__ticket_first_reply_time_business", "model.zendesk.int_zendesk__ticket_first_resolution_time_business", "model.zendesk.int_zendesk__ticket_full_resolution_time_business", "model.zendesk.int_zendesk__ticket_work_time_business"], "model.zendesk.int_zendesk__assignee_updates": ["model.zendesk.zendesk__ticket_enriched"], "model.zendesk.int_zendesk__comment_metrics": ["model.zendesk.zendesk__ticket_metrics"], "model.zendesk.int_zendesk__ticket_historical_group": ["model.zendesk.int_zendesk__ticket_resolution_times_calendar"], "model.zendesk.int_zendesk__requester_updates": ["model.zendesk.zendesk__ticket_enriched"], "model.zendesk.int_zendesk__ticket_historical_satisfaction": ["model.zendesk.zendesk__ticket_enriched"], "model.zendesk.int_zendesk__latest_ticket_form": ["model.zendesk.zendesk__ticket_enriched"], "model.zendesk.int_zendesk__ticket_aggregates": ["model.zendesk.int_zendesk__sla_policy_applied", "model.zendesk.zendesk__ticket_enriched"], "model.zendesk.int_zendesk__organization_aggregates": ["model.zendesk.int_zendesk__updater_information", "model.zendesk.zendesk__ticket_enriched"], "operation.zendesk.zendesk-on-run-start-0": [], "test.zendesk.unique_zendesk__ticket_enriched_ticket_id": [], "test.zendesk.not_null_zendesk__ticket_enriched_ticket_id": [], "test.zendesk.unique_zendesk__sla_policies_sla_event_id": [], "test.zendesk.unique_zendesk__ticket_metrics_ticket_id": [], "test.zendesk.not_null_zendesk__ticket_metrics_ticket_id": [], "model.zendesk_source.stg_zendesk__user_tag": ["model.zendesk.int_zendesk__user_aggregates"], "model.zendesk_source.stg_zendesk__ticket_tag": ["model.zendesk.int_zendesk__ticket_aggregates"], "model.zendesk_source.stg_zendesk__ticket_field_history": ["model.zendesk.int_zendesk__field_history_enriched", "model.zendesk.int_zendesk__field_history_pivot", "model.zendesk.int_zendesk__updates"], "model.zendesk_source.stg_zendesk__organization": ["model.zendesk.int_zendesk__organization_aggregates", "model.zendesk.zendesk__ticket_backlog", "test.zendesk_source.not_null_stg_zendesk__organization_organization_id", "test.zendesk_source.unique_stg_zendesk__organization_organization_id"], "model.zendesk_source.stg_zendesk__group": ["model.zendesk.zendesk__ticket_backlog", "model.zendesk.zendesk__ticket_enriched", "test.zendesk_source.not_null_stg_zendesk__group_group_id", "test.zendesk_source.unique_stg_zendesk__group_group_id"], "model.zendesk_source.stg_zendesk__ticket_comment": ["model.zendesk.int_zendesk__updates", "test.zendesk_source.not_null_stg_zendesk__ticket_comment_ticket_comment_id", "test.zendesk_source.unique_stg_zendesk__ticket_comment_ticket_comment_id"], "model.zendesk_source.stg_zendesk__ticket_schedule": ["model.zendesk.int_zendesk__ticket_schedules"], "model.zendesk_source.stg_zendesk__schedule": ["model.zendesk.int_zendesk__agent_work_time_business_hours", "model.zendesk.int_zendesk__reply_time_business_hours", "model.zendesk.int_zendesk__requester_wait_time_business_hours", "model.zendesk.int_zendesk__ticket_first_reply_time_business", "model.zendesk.int_zendesk__ticket_first_resolution_time_business", "model.zendesk.int_zendesk__ticket_full_resolution_time_business", "model.zendesk.int_zendesk__ticket_schedules", "model.zendesk.int_zendesk__ticket_work_time_business"], "model.zendesk_source.stg_zendesk__user": ["model.zendesk.int_zendesk__comments_enriched", "model.zendesk.int_zendesk__user_aggregates", "model.zendesk.zendesk__ticket_backlog", "model.zendesk.zendesk__ticket_summary", "test.zendesk_source.not_null_stg_zendesk__user_user_id", "test.zendesk_source.unique_stg_zendesk__user_user_id"], "model.zendesk_source.stg_zendesk__brand": ["model.zendesk.int_zendesk__ticket_aggregates", "model.zendesk.zendesk__ticket_backlog", "test.zendesk_source.not_null_stg_zendesk__brand_brand_id", "test.zendesk_source.unique_stg_zendesk__brand_brand_id"], "model.zendesk_source.stg_zendesk__ticket_form_history": ["model.zendesk.int_zendesk__latest_ticket_form", "test.zendesk_source.not_null_stg_zendesk__ticket_form_history_ticket_form_id"], "model.zendesk_source.stg_zendesk__domain_name": ["model.zendesk.int_zendesk__organization_aggregates", "test.zendesk_source.not_null_stg_zendesk__domain_name_organization_id"], "model.zendesk_source.stg_zendesk__organization_tag": ["model.zendesk.int_zendesk__organization_aggregates"], "model.zendesk_source.stg_zendesk__ticket": ["model.zendesk.int_zendesk__assignee_updates", "model.zendesk.int_zendesk__calendar_spine", "model.zendesk.int_zendesk__field_calendar_spine", "model.zendesk.int_zendesk__requester_updates", "model.zendesk.int_zendesk__ticket_aggregates", "model.zendesk.int_zendesk__ticket_reply_times_calendar", "model.zendesk.int_zendesk__ticket_resolution_times_calendar", "model.zendesk.int_zendesk__ticket_schedules", "model.zendesk.zendesk__ticket_backlog", "test.zendesk_source.not_null_stg_zendesk__ticket_ticket_id", "test.zendesk_source.unique_stg_zendesk__ticket_ticket_id"], "model.zendesk_source.stg_zendesk__user_tmp": ["model.zendesk_source.stg_zendesk__user", "model.zendesk_source.stg_zendesk__user"], "model.zendesk_source.stg_zendesk__group_tmp": ["model.zendesk_source.stg_zendesk__group", "model.zendesk_source.stg_zendesk__group"], "model.zendesk_source.stg_zendesk__ticket_tmp": ["model.zendesk_source.stg_zendesk__ticket", "model.zendesk_source.stg_zendesk__ticket"], "model.zendesk_source.stg_zendesk__brand_tmp": ["model.zendesk_source.stg_zendesk__brand", "model.zendesk_source.stg_zendesk__brand"], "model.zendesk_source.stg_zendesk__ticket_tag_tmp": ["model.zendesk_source.stg_zendesk__ticket_tag", "model.zendesk_source.stg_zendesk__ticket_tag"], "model.zendesk_source.stg_zendesk__user_tag_tmp": ["model.zendesk_source.stg_zendesk__user_tag", "model.zendesk_source.stg_zendesk__user_tag"], "model.zendesk_source.stg_zendesk__ticket_field_history_tmp": ["model.zendesk_source.stg_zendesk__ticket_field_history", "model.zendesk_source.stg_zendesk__ticket_field_history"], "model.zendesk_source.stg_zendesk__ticket_form_history_tmp": ["model.zendesk_source.stg_zendesk__ticket_form_history", "model.zendesk_source.stg_zendesk__ticket_form_history"], "model.zendesk_source.stg_zendesk__ticket_comment_tmp": ["model.zendesk_source.stg_zendesk__ticket_comment", "model.zendesk_source.stg_zendesk__ticket_comment"], "model.zendesk_source.stg_zendesk__organization_tag_tmp": ["model.zendesk_source.stg_zendesk__organization_tag", "model.zendesk_source.stg_zendesk__organization_tag"], "model.zendesk_source.stg_zendesk__schedule_tmp": ["model.zendesk_source.stg_zendesk__schedule", "model.zendesk_source.stg_zendesk__schedule"], "model.zendesk_source.stg_zendesk__organization_tmp": ["model.zendesk_source.stg_zendesk__organization", "model.zendesk_source.stg_zendesk__organization"], "model.zendesk_source.stg_zendesk__ticket_schedule_tmp": ["model.zendesk_source.stg_zendesk__ticket_schedule", "model.zendesk_source.stg_zendesk__ticket_schedule"], "model.zendesk_source.stg_zendesk__domain_name_tmp": ["model.zendesk_source.stg_zendesk__domain_name", "model.zendesk_source.stg_zendesk__domain_name"], "test.zendesk_source.unique_stg_zendesk__ticket_ticket_id": [], "test.zendesk_source.not_null_stg_zendesk__ticket_ticket_id": [], "test.zendesk_source.unique_stg_zendesk__brand_brand_id": [], "test.zendesk_source.not_null_stg_zendesk__brand_brand_id": [], "test.zendesk_source.not_null_stg_zendesk__domain_name_organization_id": [], "test.zendesk_source.unique_stg_zendesk__group_group_id": [], "test.zendesk_source.not_null_stg_zendesk__group_group_id": [], "test.zendesk_source.unique_stg_zendesk__organization_organization_id": [], "test.zendesk_source.not_null_stg_zendesk__organization_organization_id": [], "test.zendesk_source.unique_stg_zendesk__ticket_comment_ticket_comment_id": [], "test.zendesk_source.not_null_stg_zendesk__ticket_comment_ticket_comment_id": [], "test.zendesk_source.unique_stg_zendesk__user_user_id": [], "test.zendesk_source.not_null_stg_zendesk__user_user_id": [], "test.zendesk_source.not_null_stg_zendesk__ticket_form_history_ticket_form_id": [], "source.zendesk_source.zendesk.ticket": [], "source.zendesk_source.zendesk.brand": [], "source.zendesk_source.zendesk.domain_name": [], "source.zendesk_source.zendesk.group": [], "source.zendesk_source.zendesk.organization_tag": [], "source.zendesk_source.zendesk.organization": [], "source.zendesk_source.zendesk.ticket_comment": [], "source.zendesk_source.zendesk.user_tag": [], "source.zendesk_source.zendesk.user": [], "source.zendesk_source.zendesk.schedule": [], "source.zendesk_source.zendesk.ticket_schedule": ["model.zendesk_source.stg_zendesk__ticket_schedule_tmp", "model.zendesk_source.stg_zendesk__ticket_schedule_tmp", "model.zendesk_source.stg_zendesk__ticket_schedule_tmp"], "source.zendesk_source.zendesk.ticket_form_history": [], "source.zendesk_source.zendesk.ticket_tag": [], "source.zendesk_source.zendesk.ticket_field_history": []}} \ No newline at end of file +{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/manifest/v4.json", "dbt_version": "1.0.1", "generated_at": "2022-02-11T22:35:39.498992Z", "invocation_id": "98c5cc93-363f-4652-bdde-d79dc6e6d77e", "env": {}, "project_id": "da210340452cd4ff359d129e821085fc", "user_id": "3ba29a2e-e6c1-4d02-90b0-62926a040844", "send_anonymous_usage_stats": true, "adapter_type": "bigquery"}, "nodes": {"model.zendesk.zendesk__ticket_enriched": {"raw_sql": "-- this model enriches the ticket table with ticket-related dimensions. This table will not include any metrics.\n-- for metrics, see ticket_metrics!\n\nwith ticket as (\n\n select *\n from {{ ref('int_zendesk__ticket_aggregates') }}\n\n--If you use using_ticket_form_history this will be included, if not it will be ignored.\n{% if var('using_ticket_form_history', True) %}\n), latest_ticket_form as (\n\n select *\n from {{ ref('int_zendesk__latest_ticket_form') }}\n{% endif %}\n\n), latest_satisfaction_ratings as (\n\n select *\n from {{ ref('int_zendesk__ticket_historical_satisfaction') }}\n\n), users as (\n\n select *\n from {{ ref('int_zendesk__user_aggregates') }}\n\n), requester_updates as (\n\n select *\n from {{ ref('int_zendesk__requester_updates') }}\n\n), assignee_updates as (\n\n select *\n from {{ ref('int_zendesk__assignee_updates') }}\n\n), ticket_group as (\n \n select *\n from {{ ref('stg_zendesk__group') }}\n\n), organization as (\n\n select *\n from {{ ref('int_zendesk__organization_aggregates') }}\n\n), joined as (\n\n select \n\n ticket.*,\n\n --If you use using_ticket_form_history this will be included, if not it will be ignored.\n {% if var('using_ticket_form_history', True) %}\n latest_ticket_form.name as ticket_form_name,\n {% endif %}\n\n latest_satisfaction_ratings.count_satisfaction_scores as ticket_total_satisfaction_scores,\n latest_satisfaction_ratings.first_satisfaction_score as ticket_first_satisfaction_score,\n latest_satisfaction_ratings.latest_satisfaction_score as ticket_satisfaction_score,\n latest_satisfaction_ratings.latest_satisfaction_comment as ticket_satisfaction_comment,\n latest_satisfaction_ratings.latest_satisfaction_reason as ticket_satisfaction_reason,\n latest_satisfaction_ratings.is_good_to_bad_satisfaction_score,\n latest_satisfaction_ratings.is_bad_to_good_satisfaction_score,\n\n --If you use using_domain_names tags this will be included, if not it will be ignored.\n {% if var('using_domain_names', True) %}\n organization.domain_names as ticket_organization_domain_names,\n requester_org.domain_names as requester_organization_domain_names,\n {% endif %}\n\n requester.external_id as requester_external_id,\n requester.created_at as requester_created_at,\n requester.updated_at as requester_updated_at,\n requester.role as requester_role,\n requester.email as requester_email,\n requester.name as requester_name,\n requester.is_active as is_requester_active,\n requester.locale as requester_locale,\n requester.time_zone as requester_time_zone,\n coalesce(requester_updates.total_updates, 0) as requester_ticket_update_count,\n requester_updates.last_updated as requester_ticket_last_update_at,\n requester.last_login_at as requester_last_login_at,\n requester.organization_id as requester_organization_id,\n requester_org.name as requester_organization_name,\n\n --If you use organization tags this will be included, if not it will be ignored.\n {% if var('using_organization_tags', True) %}\n requester_org.organization_tags as requester_organization_tags,\n {% endif %}\n requester_org.external_id as requester_organization_external_id,\n requester_org.created_at as requester_organization_created_at,\n requester_org.updated_at as requester_organization_updated_at,\n submitter.external_id as submitter_external_id,\n submitter.role as submitter_role,\n case when submitter.role in ('Agent','Admin') \n then true \n else false\n end as is_agent_submitted,\n submitter.email as submitter_email,\n submitter.name as submitter_name,\n submitter.is_active as is_submitter_active,\n submitter.locale as submitter_locale,\n submitter.time_zone as submitter_time_zone,\n assignee.external_id as assignee_external_id,\n assignee.role as assignee_role,\n assignee.email as assignee_email,\n assignee.name as assignee_name,\n assignee.is_active as is_assignee_active,\n assignee.locale as assignee_locale,\n assignee.time_zone as assignee_time_zone,\n coalesce(assignee_updates.total_updates, 0) as assignee_ticket_update_count,\n assignee_updates.last_updated as assignee_ticket_last_update_at,\n assignee.last_login_at as assignee_last_login_at,\n ticket_group.name as group_name,\n organization.name as organization_name\n\n --If you use using_user_tags this will be included, if not it will be ignored.\n {% if var('using_user_tags', True) %}\n ,requester.user_tags as requester_tag,\n submitter.user_tags as submitter_tag,\n assignee.user_tags as assignee_tag\n {% endif %}\n\n \n from ticket\n\n --Requester Joins\n join users as requester\n on requester.user_id = ticket.requester_id\n\n left join organization as requester_org\n on requester_org.organization_id = requester.organization_id\n\n left join requester_updates\n on requester_updates.ticket_id = ticket.ticket_id\n and requester_updates.requester_id = ticket.requester_id\n \n --Submitter Joins\n join users as submitter\n on submitter.user_id = ticket.submitter_id\n \n --Assignee Joins\n left join users as assignee\n on assignee.user_id = ticket.assignee_id\n\n left join assignee_updates\n on assignee_updates.ticket_id = ticket.ticket_id\n and assignee_updates.assignee_id = ticket.assignee_id\n\n --Ticket, Org, and Brand Joins\n left join ticket_group\n on ticket_group.group_id = ticket.group_id\n\n --If you use using_ticket_form_history this will be included, if not it will be ignored.\n {% if var('using_ticket_form_history', True) %}\n left join latest_ticket_form\n on latest_ticket_form.ticket_form_id = ticket.ticket_form_id\n {% endif %}\n\n left join organization\n on organization.organization_id = ticket.organization_id\n\n left join latest_satisfaction_ratings\n on latest_satisfaction_ratings.ticket_id = ticket.ticket_id\n)\n\nselect *\nfrom joined", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.zendesk.int_zendesk__ticket_aggregates", "model.zendesk.int_zendesk__latest_ticket_form", "model.zendesk.int_zendesk__ticket_historical_satisfaction", "model.zendesk.int_zendesk__user_aggregates", "model.zendesk.int_zendesk__requester_updates", "model.zendesk.int_zendesk__assignee_updates", "model.zendesk_source.stg_zendesk__group", "model.zendesk.int_zendesk__organization_aggregates"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk", "fqn": ["zendesk", "zendesk__ticket_enriched"], "unique_id": "model.zendesk.zendesk__ticket_enriched", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "zendesk__ticket_enriched.sql", "original_file_path": "models/zendesk__ticket_enriched.sql", "name": "zendesk__ticket_enriched", "alias": "zendesk__ticket_enriched", "checksum": {"name": "sha256", "checksum": "8fcc608ab898e878e9f17383218093918a9a0b5585a19a72e390898c38ad5605"}, "tags": [], "refs": [["int_zendesk__ticket_aggregates"], ["int_zendesk__latest_ticket_form"], ["int_zendesk__ticket_historical_satisfaction"], ["int_zendesk__user_aggregates"], ["int_zendesk__requester_updates"], ["int_zendesk__assignee_updates"], ["stg_zendesk__group"], ["int_zendesk__organization_aggregates"]], "sources": [], "description": "Each record represents a Zendesk ticket, enriched with data about it's tags, assignees, requester, submitter, organization and group.", "columns": {"ticket_id": {"name": "ticket_id", "description": "Automatically assigned when the ticket is created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url": {"name": "url", "description": "The API url of this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_id": {"name": "assignee_id", "description": "The agent currently assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_role": {"name": "assignee_role", "description": "The role of the agent currently assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_email": {"name": "assignee_email", "description": "The email of the agent currently assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_name": {"name": "assignee_name", "description": "The name of the agent currently assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "brand_id": {"name": "brand_id", "description": "Enterprise only. The id of the brand this ticket is associated with", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "When this record was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "type": {"name": "type", "description": "The type of this ticket, possible values are problem, incident, question or task", "meta": {}, "data_type": null, "quote": null, "tags": []}, "subject": {"name": "subject", "description": "The value of the subject field for this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "description": {"name": "description", "description": "Read-only first comment on the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "priority": {"name": "priority", "description": "The urgency with which the ticket should be addressed, possible values are urgent, high, normal and low", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "The state of the ticket, possible values are new, open, pending, hold, solved and closed", "meta": {}, "data_type": null, "quote": null, "tags": []}, "recipient": {"name": "recipient", "description": "The original recipient e-mail address of the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_id": {"name": "requester_id", "description": "The user who requested this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_role": {"name": "requester_role", "description": "The role of the user who requested this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_email": {"name": "requester_email", "description": "The email of the user who requested this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_name": {"name": "requester_name", "description": "The name of the user who requested this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_id": {"name": "submitter_id", "description": "The user who submitted the ticket. The submitter always becomes the author of the first comment on the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_role": {"name": "submitter_role", "description": "The role of the user who submitted the ticket.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_email": {"name": "submitter_email", "description": "The email of the user who submitted the ticket.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_name": {"name": "submitter_name", "description": "The name of the user who submitted the ticket.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "organization_id": {"name": "organization_id", "description": "The organization of the requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "organization_name": {"name": "organization_name", "description": "The name of the organization of the requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "external_id": {"name": "external_id", "description": "The external id of the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "group_id": {"name": "group_id", "description": "The group this ticket is assigned to", "meta": {}, "data_type": null, "quote": null, "tags": []}, "group_name": {"name": "group_name", "description": "The name of the group this ticket is assigned to", "meta": {}, "data_type": null, "quote": null, "tags": []}, "due_at": {"name": "due_at", "description": "If this is a ticket of type \"task\" it has a due date. Due date format uses ISO 8601 format.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_form_id": {"name": "ticket_form_id", "description": "Enterprise only. The id of the ticket form to render for the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_public": {"name": "is_public", "description": "Is true if any comments are public, false otherwise", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "When this record last got updated", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_channel": {"name": "created_channel", "description": "The channel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_from_id": {"name": "source_from_id", "description": "The channel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_from_title": {"name": "source_from_title", "description": "The channel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_rel": {"name": "source_rel", "description": "The rel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_to_address": {"name": "source_to_address", "description": "The address of the source the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_to_name": {"name": "source_to_name", "description": "The name of the source the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_tags": {"name": "ticket_tags", "description": "A list of all tags assigned to this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "problem_id": {"name": "problem_id", "description": "The reference to the problem if the ticket is listed as a problem", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_incident": {"name": "is_incident", "description": "Boolean indicating whether the ticket is listed as an incident", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_brand_name": {"name": "ticket_brand_name", "description": "The brand name of with the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_form_name": {"name": "ticket_form_name", "description": "The form name of the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_satisfaction_rating": {"name": "ticket_satisfaction_rating", "description": "The ticket satisfaction rating", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_satisfaction_comment": {"name": "ticket_satisfaction_comment", "description": "The ticket satisfaction comment", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_satisfaction_reason": {"name": "ticket_satisfaction_reason", "description": "The ticket satisfaction reason", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_organization_domain_names": {"name": "ticket_organization_domain_names", "description": "The organization associated with the ticket domain names", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_organization_domain_names": {"name": "requester_organization_domain_names", "description": "The ticket requesters organization domain names", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_external_id": {"name": "requester_external_id", "description": "The ticket requester external id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_created_at": {"name": "requester_created_at", "description": "The date the ticket requester was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_updated_at": {"name": "requester_updated_at", "description": "The date the ticket requester was last updated", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_requester_active": {"name": "is_requester_active", "description": "Boolean indicating whether the requester is currently active", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_locale": {"name": "requester_locale", "description": "The locale of the ticket requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_time_zone": {"name": "requester_time_zone", "description": "The timezone of the ticket requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_ticket_update_count": {"name": "requester_ticket_update_count", "description": "The number of times the requester has updated the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_ticket_last_update_at": {"name": "requester_ticket_last_update_at", "description": "The last date the requester updated the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_last_login_at": {"name": "requester_last_login_at", "description": "The last login of the ticket requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_organization_id": {"name": "requester_organization_id", "description": "The organization id of the ticket requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_organization_name": {"name": "requester_organization_name", "description": "The organization name of the ticket requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_organization_tags": {"name": "requester_organization_tags", "description": "The organization tags of the ticket requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_organization_external_id": {"name": "requester_organization_external_id", "description": "The organization external id of the ticket requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_organization_created_at": {"name": "requester_organization_created_at", "description": "The date the ticket requesters organization was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_organization_updated_at": {"name": "requester_organization_updated_at", "description": "The date the ticket requesters organization was last updated", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_external_id": {"name": "submitter_external_id", "description": "The ticket submitter external id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_agent_submitted": {"name": "is_agent_submitted", "description": "Boolean indicating if the submitter has an agent role", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_submitter_active": {"name": "is_submitter_active", "description": "Boolean indicating if the ticket submitter is active", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_locale": {"name": "submitter_locale", "description": "The locale of the ticket submitter", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_time_zone": {"name": "submitter_time_zone", "description": "The time zone of the ticket submitter", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_external_id": {"name": "assignee_external_id", "description": "The external id of the ticket assignee", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_assignee_active": {"name": "is_assignee_active", "description": "Boolean indicating if the ticket assignee is active", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_locale": {"name": "assignee_locale", "description": "The locale of the ticket assignee", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_time_zone": {"name": "assignee_time_zone", "description": "The time zone of the ticket assignee", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_ticket_update_count": {"name": "assignee_ticket_update_count", "description": "The number of times the ticket assignee has updated the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_ticket_last_update_at": {"name": "assignee_ticket_last_update_at", "description": "The last date the ticket assignee updated the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_last_login_at": {"name": "assignee_last_login_at", "description": "The date the ticket assignee last logged in", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_tag": {"name": "requester_tag", "description": "The tags associated with the ticket requester.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_tag": {"name": "submitter_tag", "description": "The tags associated with the ticket submitter.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_tag": {"name": "assignee_tag", "description": "The tags associated with the ticket assignee.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_total_satisfaction_scores": {"name": "ticket_total_satisfaction_scores", "description": "The total number of satisfaction scores the ticket received.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_first_satisfaction_score": {"name": "ticket_first_satisfaction_score", "description": "The first satisfaction score the ticket received.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_satisfaction_score": {"name": "ticket_satisfaction_score", "description": "The latest satisfaction score the ticket received.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_good_to_bad_satisfaction_score": {"name": "is_good_to_bad_satisfaction_score", "description": "Boolean indicating if the ticket had a satisfaction score went from good to bad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_bad_to_good_satisfaction_score": {"name": "is_bad_to_good_satisfaction_score", "description": "Boolean indicating if the ticket had a satisfaction score went from bad to good.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "zendesk://models/zendesk.yml", "compiled_path": "target/compiled/zendesk/models/zendesk__ticket_enriched.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk", "materialized": "table"}, "created_at": 1644618837.615173, "compiled_sql": "-- this model enriches the ticket table with ticket-related dimensions. This table will not include any metrics.\n-- for metrics, see ticket_metrics!\n\nwith ticket as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_aggregates`\n\n--If you use using_ticket_form_history this will be included, if not it will be ignored.\n\n), latest_ticket_form as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__latest_ticket_form`\n\n\n), latest_satisfaction_ratings as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_satisfaction`\n\n), users as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__user_aggregates`\n\n), requester_updates as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__requester_updates`\n\n), assignee_updates as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__assignee_updates`\n\n), ticket_group as (\n \n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__group`\n\n), organization as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__organization_aggregates`\n\n), joined as (\n\n select \n\n ticket.*,\n\n --If you use using_ticket_form_history this will be included, if not it will be ignored.\n \n latest_ticket_form.name as ticket_form_name,\n \n\n latest_satisfaction_ratings.count_satisfaction_scores as ticket_total_satisfaction_scores,\n latest_satisfaction_ratings.first_satisfaction_score as ticket_first_satisfaction_score,\n latest_satisfaction_ratings.latest_satisfaction_score as ticket_satisfaction_score,\n latest_satisfaction_ratings.latest_satisfaction_comment as ticket_satisfaction_comment,\n latest_satisfaction_ratings.latest_satisfaction_reason as ticket_satisfaction_reason,\n latest_satisfaction_ratings.is_good_to_bad_satisfaction_score,\n latest_satisfaction_ratings.is_bad_to_good_satisfaction_score,\n\n --If you use using_domain_names tags this will be included, if not it will be ignored.\n \n organization.domain_names as ticket_organization_domain_names,\n requester_org.domain_names as requester_organization_domain_names,\n \n\n requester.external_id as requester_external_id,\n requester.created_at as requester_created_at,\n requester.updated_at as requester_updated_at,\n requester.role as requester_role,\n requester.email as requester_email,\n requester.name as requester_name,\n requester.is_active as is_requester_active,\n requester.locale as requester_locale,\n requester.time_zone as requester_time_zone,\n coalesce(requester_updates.total_updates, 0) as requester_ticket_update_count,\n requester_updates.last_updated as requester_ticket_last_update_at,\n requester.last_login_at as requester_last_login_at,\n requester.organization_id as requester_organization_id,\n requester_org.name as requester_organization_name,\n\n --If you use organization tags this will be included, if not it will be ignored.\n \n requester_org.organization_tags as requester_organization_tags,\n \n requester_org.external_id as requester_organization_external_id,\n requester_org.created_at as requester_organization_created_at,\n requester_org.updated_at as requester_organization_updated_at,\n submitter.external_id as submitter_external_id,\n submitter.role as submitter_role,\n case when submitter.role in ('Agent','Admin') \n then true \n else false\n end as is_agent_submitted,\n submitter.email as submitter_email,\n submitter.name as submitter_name,\n submitter.is_active as is_submitter_active,\n submitter.locale as submitter_locale,\n submitter.time_zone as submitter_time_zone,\n assignee.external_id as assignee_external_id,\n assignee.role as assignee_role,\n assignee.email as assignee_email,\n assignee.name as assignee_name,\n assignee.is_active as is_assignee_active,\n assignee.locale as assignee_locale,\n assignee.time_zone as assignee_time_zone,\n coalesce(assignee_updates.total_updates, 0) as assignee_ticket_update_count,\n assignee_updates.last_updated as assignee_ticket_last_update_at,\n assignee.last_login_at as assignee_last_login_at,\n ticket_group.name as group_name,\n organization.name as organization_name\n\n --If you use using_user_tags this will be included, if not it will be ignored.\n \n ,requester.user_tags as requester_tag,\n submitter.user_tags as submitter_tag,\n assignee.user_tags as assignee_tag\n \n\n \n from ticket\n\n --Requester Joins\n join users as requester\n on requester.user_id = ticket.requester_id\n\n left join organization as requester_org\n on requester_org.organization_id = requester.organization_id\n\n left join requester_updates\n on requester_updates.ticket_id = ticket.ticket_id\n and requester_updates.requester_id = ticket.requester_id\n \n --Submitter Joins\n join users as submitter\n on submitter.user_id = ticket.submitter_id\n \n --Assignee Joins\n left join users as assignee\n on assignee.user_id = ticket.assignee_id\n\n left join assignee_updates\n on assignee_updates.ticket_id = ticket.ticket_id\n and assignee_updates.assignee_id = ticket.assignee_id\n\n --Ticket, Org, and Brand Joins\n left join ticket_group\n on ticket_group.group_id = ticket.group_id\n\n --If you use using_ticket_form_history this will be included, if not it will be ignored.\n \n left join latest_ticket_form\n on latest_ticket_form.ticket_form_id = ticket.ticket_form_id\n \n\n left join organization\n on organization.organization_id = ticket.organization_id\n\n left join latest_satisfaction_ratings\n on latest_satisfaction_ratings.ticket_id = ticket.ticket_id\n)\n\nselect *\nfrom joined", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk`.`zendesk__ticket_enriched`"}, "model.zendesk.zendesk__ticket_metrics": {"raw_sql": "with ticket_enriched as (\n\n select *\n from {{ ref('zendesk__ticket_enriched') }}\n\n), ticket_resolution_times_calendar as (\n\n select *\n from {{ ref('int_zendesk__ticket_resolution_times_calendar') }}\n\n), ticket_reply_times_calendar as (\n\n select *\n from {{ ref('int_zendesk__ticket_reply_times_calendar') }}\n\n), ticket_comments as (\n\n select *\n from {{ ref('int_zendesk__comment_metrics') }}\n\n), ticket_work_time_calendar as (\n\n select *\n from {{ ref('int_zendesk__ticket_work_time_calendar') }}\n\n-- business hour CTEs\n{% if var('using_schedules', True) %}\n\n), ticket_first_resolution_time_business as (\n\n select *\n from {{ ref('int_zendesk__ticket_first_resolution_time_business') }}\n\n), ticket_full_resolution_time_business as (\n\n select *\n from {{ ref('int_zendesk__ticket_full_resolution_time_business') }}\n\n), ticket_work_time_business as (\n\n select *\n from {{ ref('int_zendesk__ticket_work_time_business') }}\n\n), ticket_first_reply_time_business as (\n\n select *\n from {{ ref('int_zendesk__ticket_first_reply_time_business') }}\n\n{% endif %}\n-- end business hour CTEs\n\n), calendar_hour_metrics as (\n\nselect\n ticket_enriched.*,\n case when coalesce(ticket_comments.count_public_agent_comments, 0) = 0\n then null\n else ticket_reply_times_calendar.first_reply_time_calendar_minutes\n end as first_reply_time_calendar_minutes,\n case when coalesce(ticket_comments.count_public_agent_comments, 0) = 0\n then null\n else ticket_reply_times_calendar.total_reply_time_calendar_minutes\n end as total_reply_time_calendar_minutes,\n coalesce(ticket_comments.count_agent_comments, 0) as count_agent_comments,\n coalesce(ticket_comments.count_public_agent_comments, 0) as count_public_agent_comments,\n coalesce(ticket_comments.count_end_user_comments, 0) as count_end_user_comments,\n coalesce(ticket_comments.count_public_comments, 0) as count_public_comments,\n coalesce(ticket_comments.count_internal_comments, 0) as count_internal_comments,\n coalesce(ticket_comments.total_comments, 0) as total_comments,\n coalesce(ticket_comments.count_ticket_handoffs, 0) as count_ticket_handoffs, -- the number of distinct internal users who commented on the ticket\n ticket_comments.last_comment_added_at as ticket_last_comment_date,\n ticket_resolution_times_calendar.unique_assignee_count,\n ticket_resolution_times_calendar.assignee_stations_count,\n ticket_resolution_times_calendar.group_stations_count,\n ticket_resolution_times_calendar.first_assignee_id,\n ticket_resolution_times_calendar.last_assignee_id,\n ticket_resolution_times_calendar.first_agent_assignment_date,\n ticket_resolution_times_calendar.last_agent_assignment_date,\n ticket_resolution_times_calendar.first_solved_at,\n ticket_resolution_times_calendar.last_solved_at,\n case when ticket_enriched.status in ('solved', 'closed')\n then ticket_resolution_times_calendar.first_assignment_to_resolution_calendar_minutes\n else null\n end as first_assignment_to_resolution_calendar_minutes,\n case when ticket_enriched.status in ('solved', 'closed')\n then ticket_resolution_times_calendar.last_assignment_to_resolution_calendar_minutes\n else null\n end as last_assignment_to_resolution_calendar_minutes,\n ticket_resolution_times_calendar.ticket_unassigned_duration_calendar_minutes,\n ticket_resolution_times_calendar.first_resolution_calendar_minutes,\n ticket_resolution_times_calendar.final_resolution_calendar_minutes,\n ticket_resolution_times_calendar.total_resolutions as count_resolutions,\n ticket_resolution_times_calendar.count_reopens,\n ticket_work_time_calendar.ticket_deleted_count,\n ticket_work_time_calendar.total_ticket_recoveries,\n ticket_work_time_calendar.last_status_assignment_date,\n ticket_work_time_calendar.new_status_duration_in_calendar_minutes,\n ticket_work_time_calendar.open_status_duration_in_calendar_minutes,\n ticket_work_time_calendar.agent_wait_time_in_calendar_minutes,\n ticket_work_time_calendar.requester_wait_time_in_calendar_minutes,\n ticket_work_time_calendar.agent_work_time_in_calendar_minutes,\n ticket_work_time_calendar.on_hold_time_in_calendar_minutes,\n coalesce(ticket_comments.count_agent_comments, 0) as total_agent_replies,\n \n case when ticket_enriched.is_requester_active = true and ticket_enriched.requester_last_login_at is not null\n then ({{ dbt_utils.datediff(\"ticket_enriched.requester_last_login_at\", dbt_utils.current_timestamp(), 'second') }} /60)\n end as requester_last_login_age_minutes,\n case when ticket_enriched.is_assignee_active = true and ticket_enriched.assignee_last_login_at is not null\n then ({{ dbt_utils.datediff(\"ticket_enriched.assignee_last_login_at\", dbt_utils.current_timestamp(), 'second') }} /60)\n end as assignee_last_login_age_minutes,\n case when lower(ticket_enriched.status) not in ('solved','closed')\n then ({{ dbt_utils.datediff(\"ticket_enriched.created_at\", dbt_utils.current_timestamp(), 'second') }} /60)\n end as unsolved_ticket_age_minutes,\n case when lower(ticket_enriched.status) not in ('solved','closed')\n then ({{ dbt_utils.datediff(\"ticket_enriched.updated_at\", dbt_utils.current_timestamp(), 'second') }} /60)\n end as unsolved_ticket_age_since_update_minutes,\n case when lower(ticket_enriched.status) in ('solved','closed') and ticket_comments.is_one_touch_resolution \n then true\n else false\n end as is_one_touch_resolution,\n case when lower(ticket_enriched.status) in ('solved','closed') and ticket_comments.is_two_touch_resolution \n then true\n else false \n end as is_two_touch_resolution,\n case when lower(ticket_enriched.status) in ('solved','closed') and not ticket_comments.is_one_touch_resolution \n then true\n else false \n end as is_multi_touch_resolution\n\n\nfrom ticket_enriched\n\nleft join ticket_reply_times_calendar\n using (ticket_id)\n\nleft join ticket_resolution_times_calendar\n using (ticket_id)\n\nleft join ticket_work_time_calendar\n using (ticket_id)\n\nleft join ticket_comments\n using(ticket_id)\n\n{% if var('using_schedules', True) %}\n\n), business_hour_metrics as (\n\n select \n ticket_enriched.ticket_id,\n ticket_first_resolution_time_business.first_resolution_business_minutes,\n ticket_full_resolution_time_business.full_resolution_business_minutes,\n ticket_first_reply_time_business.first_reply_time_business_minutes,\n ticket_work_time_business.agent_wait_time_in_business_minutes,\n ticket_work_time_business.requester_wait_time_in_business_minutes,\n ticket_work_time_business.agent_work_time_in_business_minutes,\n ticket_work_time_business.on_hold_time_in_business_minutes\n\n from ticket_enriched\n\n left join ticket_first_resolution_time_business\n using (ticket_id)\n\n left join ticket_full_resolution_time_business\n using (ticket_id)\n \n left join ticket_first_reply_time_business\n using (ticket_id) \n \n left join ticket_work_time_business\n using (ticket_id)\n\n)\n\nselect\n calendar_hour_metrics.*,\n case when calendar_hour_metrics.status in ('solved', 'closed')\n then business_hour_metrics.first_resolution_business_minutes\n else null\n end as first_resolution_business_minutes,\n case when calendar_hour_metrics.status in ('solved', 'closed')\n then business_hour_metrics.full_resolution_business_minutes\n else null\n end as full_resolution_business_minutes,\n case when coalesce(calendar_hour_metrics.count_public_agent_comments, 0) = 0\n then null\n else business_hour_metrics.first_reply_time_business_minutes\n end as first_reply_time_business_minutes,\n business_hour_metrics.agent_wait_time_in_business_minutes,\n business_hour_metrics.requester_wait_time_in_business_minutes,\n business_hour_metrics.agent_work_time_in_business_minutes,\n business_hour_metrics.on_hold_time_in_business_minutes\n\nfrom calendar_hour_metrics\n\nleft join business_hour_metrics \n using (ticket_id)\n\n{% else %}\n\n) \n\nselect *\nfrom calendar_hour_metrics\n\n{% endif %}", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.current_timestamp", "macro.dbt_utils.datediff"], "nodes": ["model.zendesk.zendesk__ticket_enriched", "model.zendesk.int_zendesk__ticket_resolution_times_calendar", "model.zendesk.int_zendesk__ticket_reply_times_calendar", "model.zendesk.int_zendesk__comment_metrics", "model.zendesk.int_zendesk__ticket_work_time_calendar", "model.zendesk.int_zendesk__ticket_first_resolution_time_business", "model.zendesk.int_zendesk__ticket_full_resolution_time_business", "model.zendesk.int_zendesk__ticket_work_time_business", "model.zendesk.int_zendesk__ticket_first_reply_time_business"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk", "fqn": ["zendesk", "zendesk__ticket_metrics"], "unique_id": "model.zendesk.zendesk__ticket_metrics", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "zendesk__ticket_metrics.sql", "original_file_path": "models/zendesk__ticket_metrics.sql", "name": "zendesk__ticket_metrics", "alias": "zendesk__ticket_metrics", "checksum": {"name": "sha256", "checksum": "42389f1b04f003c1957f7a71f5f8c20b0fbd3a88d0145fb17ad97dc239983526"}, "tags": [], "refs": [["zendesk__ticket_enriched"], ["int_zendesk__ticket_resolution_times_calendar"], ["int_zendesk__ticket_reply_times_calendar"], ["int_zendesk__comment_metrics"], ["int_zendesk__ticket_work_time_calendar"], ["int_zendesk__ticket_first_resolution_time_business"], ["int_zendesk__ticket_full_resolution_time_business"], ["int_zendesk__ticket_work_time_business"], ["int_zendesk__ticket_first_reply_time_business"]], "sources": [], "description": "Each record represents a Zendesk ticket, enriched with metrics about reply times, resolution times and work times. Calendar and business hours are supported", "columns": {"first_reply_time_calendar_minutes": {"name": "first_reply_time_calendar_minutes", "description": "The number of calendar minutes between when the ticket was created and when the first public agent response occurred", "meta": {}, "data_type": null, "quote": null, "tags": []}, "first_reply_time_business_minutes": {"name": "first_reply_time_business_minutes", "description": "The number of business minutes between when the ticket was created and when the first public agent response occurred", "meta": {}, "data_type": null, "quote": null, "tags": []}, "total_reply_time_calendar_minutes": {"name": "total_reply_time_calendar_minutes", "description": "The combined calendar time between all end-user comments and the next public agent response", "meta": {}, "data_type": null, "quote": null, "tags": []}, "first_solved_at": {"name": "first_solved_at", "description": "The time the ticket was first in 'solved' status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "last_solved_at": {"name": "last_solved_at", "description": "The time the ticket was last in 'solved' status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "first_resolution_calendar_minutes": {"name": "first_resolution_calendar_minutes", "description": "The number of calendar minutes between the ticket created time and the time the ticket was first set to solved status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "final_resolution_calendar_minutes": {"name": "final_resolution_calendar_minutes", "description": "The number of calendar minutes between the ticket created time and the time the ticket was last set to solved status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_one_touch_resolution": {"name": "is_one_touch_resolution", "description": "A boolean field indicating that the ticket has one public agent response and is in solved status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "first_resolution_business_minutes": {"name": "first_resolution_business_minutes", "description": "The number of business minutes between the ticket created time and the time the ticket was first set to solved status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "full_resolution_business_minutes": {"name": "full_resolution_business_minutes", "description": "The number of business minutes between the ticket created time and the time the ticket was last set to solved status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "agent_wait_time_in_business_minutes": {"name": "agent_wait_time_in_business_minutes", "description": "The combined number of business minutes the ticket was in 'pending' status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_wait_time_in_business_minutes": {"name": "requester_wait_time_in_business_minutes", "description": "The combined number of business minutes the ticket was in 'new', 'open', or 'hold' status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "agent_work_time_in_business_minutes": {"name": "agent_work_time_in_business_minutes", "description": "The combined number of business minutes the ticket was in 'new' or 'open' status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "on_hold_time_in_business_minutes": {"name": "on_hold_time_in_business_minutes", "description": "The combined number of business minutes the ticket was on 'hold' status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "agent_wait_time_in_calendar_minutes": {"name": "agent_wait_time_in_calendar_minutes", "description": "The combined number of calendar minutes the ticket was in 'pending' status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_wait_time_in_calendar_minutes": {"name": "requester_wait_time_in_calendar_minutes", "description": "The combined number of calendar minutes the ticket was in 'new', 'open', or 'hold' status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "agent_work_time_in_calendar_minutes": {"name": "agent_work_time_in_calendar_minutes", "description": "The combined number of calendar minutes the ticket was in 'new' or 'open' status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "on_hold_time_in_calendar_minutes": {"name": "on_hold_time_in_calendar_minutes", "description": "The combined number of calendar minutes the ticket was on 'hold' status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_id": {"name": "ticket_id", "description": "Automatically assigned when the ticket is created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url": {"name": "url", "description": "The API url of this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_id": {"name": "assignee_id", "description": "The agent currently assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_role": {"name": "assignee_role", "description": "The role of the agent currently assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_email": {"name": "assignee_email", "description": "The email of the agent currently assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_name": {"name": "assignee_name", "description": "The name of the agent currently assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "brand_id": {"name": "brand_id", "description": "Enterprise only. The id of the brand this ticket is associated with", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "When this record was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "type": {"name": "type", "description": "The type of this ticket, possible values are problem, incident, question or task", "meta": {}, "data_type": null, "quote": null, "tags": []}, "subject": {"name": "subject", "description": "The value of the subject field for this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "description": {"name": "description", "description": "Read-only first comment on the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "priority": {"name": "priority", "description": "The urgency with which the ticket should be addressed, possible values are urgent, high, normal and low", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "The state of the ticket, possible values are new, open, pending, hold, solved and closed", "meta": {}, "data_type": null, "quote": null, "tags": []}, "recipient": {"name": "recipient", "description": "The original recipient e-mail address of the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_id": {"name": "requester_id", "description": "The user who requested this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_role": {"name": "requester_role", "description": "The role of the user who requested this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_email": {"name": "requester_email", "description": "The email of the user who requested this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_name": {"name": "requester_name", "description": "The name of the user who requested this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_id": {"name": "submitter_id", "description": "The user who submitted the ticket. The submitter always becomes the author of the first comment on the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_role": {"name": "submitter_role", "description": "The role of the user who submitted the ticket.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_email": {"name": "submitter_email", "description": "The email of the user who submitted the ticket.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_name": {"name": "submitter_name", "description": "The name of the user who submitted the ticket.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "organization_id": {"name": "organization_id", "description": "The organization of the requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "organization_name": {"name": "organization_name", "description": "The name of the organization of the requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "external_id": {"name": "external_id", "description": "The external id of the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "group_id": {"name": "group_id", "description": "The group this ticket is assigned to", "meta": {}, "data_type": null, "quote": null, "tags": []}, "group_name": {"name": "group_name", "description": "The name of the group this ticket is assigned to", "meta": {}, "data_type": null, "quote": null, "tags": []}, "due_at": {"name": "due_at", "description": "If this is a ticket of type \"task\" it has a due date. Due date format uses ISO 8601 format.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_form_id": {"name": "ticket_form_id", "description": "Enterprise only. The id of the ticket form to render for the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_public": {"name": "is_public", "description": "Is true if any comments are public, false otherwise", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "When this record last got updated", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_channel": {"name": "created_channel", "description": "The channel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_from_id": {"name": "source_from_id", "description": "The channel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_from_title": {"name": "source_from_title", "description": "The channel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_rel": {"name": "source_rel", "description": "The rel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_to_address": {"name": "source_to_address", "description": "The address of the source the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_to_name": {"name": "source_to_name", "description": "The name of the source the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_tags": {"name": "ticket_tags", "description": "A list of all tags assigned to this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "problem_id": {"name": "problem_id", "description": "The reference to the problem if the ticket is listed as a problem", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_incident": {"name": "is_incident", "description": "Boolean indicating whether the ticket is listed as an incident", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_brand_name": {"name": "ticket_brand_name", "description": "The brand name of with the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_form_name": {"name": "ticket_form_name", "description": "The form name of the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_satisfaction_rating": {"name": "ticket_satisfaction_rating", "description": "The ticket satisfaction rating", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_satisfaction_comment": {"name": "ticket_satisfaction_comment", "description": "The ticket satisfaction comment", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_satisfaction_reason": {"name": "ticket_satisfaction_reason", "description": "The ticket satisfaction reason", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_organization_domain_names": {"name": "ticket_organization_domain_names", "description": "The organization associated with the ticket domain names", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_organization_domain_names": {"name": "requester_organization_domain_names", "description": "The ticket requesters organization domain names", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_external_id": {"name": "requester_external_id", "description": "The ticket requester external id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_created_at": {"name": "requester_created_at", "description": "The date the ticket requester was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_updated_at": {"name": "requester_updated_at", "description": "The date the ticket requester was last updated", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_requester_active": {"name": "is_requester_active", "description": "Boolean indicating whether the requester is currently active", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_locale": {"name": "requester_locale", "description": "The locale of the ticket requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_time_zone": {"name": "requester_time_zone", "description": "The timezone of the ticket requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_ticket_update_count": {"name": "requester_ticket_update_count", "description": "The number of times the requester has updated the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_ticket_last_update_at": {"name": "requester_ticket_last_update_at", "description": "The last date the requester updated the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_last_login_at": {"name": "requester_last_login_at", "description": "The last login of the ticket requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_organization_id": {"name": "requester_organization_id", "description": "The organization id of the ticket requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_organization_name": {"name": "requester_organization_name", "description": "The organization name of the ticket requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_organization_tags": {"name": "requester_organization_tags", "description": "The organization tags of the ticket requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_organization_external_id": {"name": "requester_organization_external_id", "description": "The organization external id of the ticket requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_organization_created_at": {"name": "requester_organization_created_at", "description": "The date the ticket requesters organization was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_organization_updated_at": {"name": "requester_organization_updated_at", "description": "The date the ticket requesters organization was last updated", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_external_id": {"name": "submitter_external_id", "description": "The ticket submitter external id", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_agent_submitted": {"name": "is_agent_submitted", "description": "Boolean indicating if the submitter has an agent role", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_submitter_active": {"name": "is_submitter_active", "description": "Boolean indicating if the ticket submitter is active", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_locale": {"name": "submitter_locale", "description": "The locale of the ticket submitter", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_time_zone": {"name": "submitter_time_zone", "description": "The time zone of the ticket submitter", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_external_id": {"name": "assignee_external_id", "description": "The external id of the ticket assignee", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_assignee_active": {"name": "is_assignee_active", "description": "Boolean indicating if the ticket assignee is active", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_locale": {"name": "assignee_locale", "description": "The locale of the ticket assignee", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_time_zone": {"name": "assignee_time_zone", "description": "The time zone of the ticket assignee", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_ticket_update_count": {"name": "assignee_ticket_update_count", "description": "The number of times the ticket assignee has updated the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_ticket_last_update_at": {"name": "assignee_ticket_last_update_at", "description": "The last date the ticket assignee updated the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_last_login_at": {"name": "assignee_last_login_at", "description": "The date the ticket assignee last logged in", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_tag": {"name": "requester_tag", "description": "The tags associated with the ticket requester.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_tag": {"name": "submitter_tag", "description": "The tags associated with the ticket submitter.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_tag": {"name": "assignee_tag", "description": "The tags associated with the ticket assignee.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_total_satisfaction_scores": {"name": "ticket_total_satisfaction_scores", "description": "The total number of satisfaction scores the ticket received.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_first_satisfaction_score": {"name": "ticket_first_satisfaction_score", "description": "The first satisfaction score the ticket received.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_satisfaction_score": {"name": "ticket_satisfaction_score", "description": "The latest satisfaction score the ticket received.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_good_to_bad_satisfaction_score": {"name": "is_good_to_bad_satisfaction_score", "description": "Boolean indicating if the ticket had a satisfaction score went from good to bad.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_bad_to_good_satisfaction_score": {"name": "is_bad_to_good_satisfaction_score", "description": "Boolean indicating if the ticket had a satisfaction score went from bad to good.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "count_agent_comments": {"name": "count_agent_comments", "description": "Count of agent comments within the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "count_public_agent_comments": {"name": "count_public_agent_comments", "description": "Count of public agent comments within the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "count_end_user_comments": {"name": "count_end_user_comments", "description": "Count of end user comments within the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "count_internal_comments": {"name": "count_internal_comments", "description": "Count of internal comments within the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "count_public_comments": {"name": "count_public_comments", "description": "Count of public comments within the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "total_comments": {"name": "total_comments", "description": "Total count of all comments within the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "count_ticket_handoffs": {"name": "count_ticket_handoffs", "description": "", "meta": {}, "data_type": null, "quote": null, "tags": [], "dev_snowflake": "Count of distinct internal users who have touched/commented on the ticket."}, "unique_assignee_count": {"name": "unique_assignee_count", "description": "The count of unique assignees that were assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_stations_count": {"name": "assignee_stations_count", "description": "The total number of assignees that were assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "group_stations_count": {"name": "group_stations_count", "description": "The total count of group stations within the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "first_assignee_id": {"name": "first_assignee_id", "description": "Assignee id of the first agent assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "last_assignee_id": {"name": "last_assignee_id", "description": "Assignee id of the last agent assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "first_agent_assignment_date": {"name": "first_agent_assignment_date", "description": "The date the first agent was assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "last_agent_assignment_date": {"name": "last_agent_assignment_date", "description": "The date the last agent was assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "first_assignment_to_resolution_calendar_minutes": {"name": "first_assignment_to_resolution_calendar_minutes", "description": "The time in calendar minutes between the first assignment and resolution of the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "last_assignment_to_resolution_calendar_minutes": {"name": "last_assignment_to_resolution_calendar_minutes", "description": "The time in calendar minutes between the last assignment and resolution of the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "count_resolutions": {"name": "count_resolutions", "description": "The count of ticket resolutions", "meta": {}, "data_type": null, "quote": null, "tags": []}, "count_reopens": {"name": "count_reopens", "description": "The count of ticket reopen events", "meta": {}, "data_type": null, "quote": null, "tags": []}, "new_status_duration_in_calendar_minutes": {"name": "new_status_duration_in_calendar_minutes", "description": "The duration in calendar minutes the ticket was in the \"new\" status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "open_status_duration_in_calendar_minutes": {"name": "open_status_duration_in_calendar_minutes", "description": "The duration in calendar minutes the ticket was in the \"open\" status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "total_agent_replies": {"name": "total_agent_replies", "description": "The total number of agent replies within the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_last_login_age_minutes": {"name": "requester_last_login_age_minutes", "description": "The time in minutes since the ticket requester was last logged in", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_last_login_age_minutes": {"name": "assignee_last_login_age_minutes", "description": "The time in minutes since the ticket assignee was last logged in", "meta": {}, "data_type": null, "quote": null, "tags": []}, "unsolved_ticket_age_minutes": {"name": "unsolved_ticket_age_minutes", "description": "The time in minutes the ticket has been in an unsolved state", "meta": {}, "data_type": null, "quote": null, "tags": []}, "unsolved_ticket_age_since_update_minutes": {"name": "unsolved_ticket_age_since_update_minutes", "description": "The time in minutes the ticket has been unsolved since the last update", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_two_touch_resolution": {"name": "is_two_touch_resolution", "description": "Boolean indicating if the ticket was resolved in two public comments", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_multi_touch_resolution": {"name": "is_multi_touch_resolution", "description": "Boolean indicating if the ticket was resolved in two or more public comments", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_last_comment_date": {"name": "ticket_last_comment_date", "description": "The time the last comment was applied to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_unassigned_duration_calendar_minutes": {"name": "ticket_unassigned_duration_calendar_minutes", "description": "The time in minutes the ticket was in an unassigned state", "meta": {}, "data_type": null, "quote": null, "tags": []}, "last_status_assignment_date": {"name": "last_status_assignment_date", "description": "The time the status was last changed on the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "zendesk://models/zendesk.yml", "compiled_path": "target/compiled/zendesk/models/zendesk__ticket_metrics.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk", "materialized": "table"}, "created_at": 1644618837.670002, "compiled_sql": "with __dbt__cte__int_zendesk__ticket_resolution_times_calendar as (\nwith historical_solved_status as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_status`\n where status = 'solved'\n\n), ticket as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket`\n\n), ticket_historical_assignee as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_assignee`\n\n), ticket_historical_group as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_group`\n\n), solved_times as (\n \n select\n \n ticket_id,\n min(valid_starting_at) as first_solved_at,\n max(valid_starting_at) as last_solved_at,\n count(status) as solved_count \n\n from historical_solved_status\n group by 1\n\n)\n\n select\n\n ticket.ticket_id,\n ticket.created_at,\n solved_times.first_solved_at,\n solved_times.last_solved_at,\n ticket_historical_assignee.unique_assignee_count,\n ticket_historical_assignee.assignee_stations_count,\n ticket_historical_group.group_stations_count,\n ticket_historical_assignee.first_assignee_id,\n ticket_historical_assignee.last_assignee_id,\n ticket_historical_assignee.first_agent_assignment_date,\n ticket_historical_assignee.last_agent_assignment_date,\n ticket_historical_assignee.ticket_unassigned_duration_calendar_minutes,\n solved_times.solved_count as total_resolutions,\n case when solved_times.solved_count <= 1\n then 0\n else solved_times.solved_count - 1 --subtracting one as the first solve is not a reopen.\n end as count_reopens,\n\n \n \n\n timestamp_diff(\n solved_times.last_solved_at,\n ticket_historical_assignee.first_agent_assignment_date,\n minute\n )\n\n\n as first_assignment_to_resolution_calendar_minutes,\n \n \n\n timestamp_diff(\n solved_times.last_solved_at,\n ticket_historical_assignee.last_agent_assignment_date,\n minute\n )\n\n\n as last_assignment_to_resolution_calendar_minutes,\n \n \n\n timestamp_diff(\n solved_times.first_solved_at,\n ticket.created_at,\n minute\n )\n\n\n as first_resolution_calendar_minutes,\n \n \n\n timestamp_diff(\n solved_times.last_solved_at,\n ticket.created_at,\n minute\n )\n\n\n as final_resolution_calendar_minutes\n\n from ticket\n\n left join ticket_historical_assignee\n using(ticket_id)\n\n left join ticket_historical_group\n using(ticket_id)\n\n left join solved_times\n using(ticket_id)\n), __dbt__cte__int_zendesk__comments_enriched as (\nwith ticket_comment as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__updates`\n where field_name = 'comment'\n\n), users as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__user`\n\n), joined as (\n\n select \n\n ticket_comment.*,\n case when commenter.role = 'end-user' then 'external_comment'\n when commenter.role in ('agent','admin') then 'internal_comment'\n else 'unknown' end as commenter_role\n \n from ticket_comment\n \n join users as commenter\n on commenter.user_id = ticket_comment.user_id\n\n), add_previous_commenter_role as (\n /*\n In int_zendesk__ticket_reply_times we will only be focusing on reply times between public tickets.\n The below union explicitly identifies the previous commentor roles of public and not public comments.\n */\n select\n *,\n coalesce(\n lag(commenter_role) over (partition by ticket_id order by valid_starting_at)\n , 'first_comment') \n as previous_commenter_role\n from joined\n where is_public\n\n union all\n\n select\n *,\n 'non_public_comment' as previous_commenter_role\n from joined\n where not is_public\n)\n\nselect \n *,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_comment_added_at\nfrom add_previous_commenter_role\n), __dbt__cte__int_zendesk__ticket_reply_times as (\nwith ticket_public_comments as (\n\n select *\n from __dbt__cte__int_zendesk__comments_enriched\n where is_public\n\n), end_user_comments as (\n \n select \n ticket_id,\n valid_starting_at as end_user_comment_created_at,\n ticket_created_date,\n commenter_role,\n previous_commenter_role = 'first_comment' as is_first_comment\n from ticket_public_comments \n where (commenter_role = 'external_comment'\n and ticket_public_comments.previous_commenter_role != 'external_comment') -- we only care about net new end user comments\n or previous_commenter_role = 'first_comment' -- We also want to take into consideration internal first comment replies\n\n), reply_timestamps as ( \n\n select\n end_user_comments.ticket_id,\n -- If the commentor was internal and a first comment then we want the ticket created date to be the end user comment created date\n -- Otherwise we will want to end user comment created date\n case when end_user_comments.is_first_comment\n then end_user_comments.ticket_created_date\n else end_user_comments.end_user_comment_created_at\n end as end_user_comment_created_at,\n end_user_comments.is_first_comment,\n min(agent_comments.valid_starting_at) as agent_responded_at\n from end_user_comments\n left join ticket_public_comments as agent_comments\n on agent_comments.ticket_id = end_user_comments.ticket_id\n and agent_comments.commenter_role = 'internal_comment'\n and agent_comments.valid_starting_at > end_user_comments.end_user_comment_created_at\n group by 1,2,3\n\n)\n\n select\n *,\n (\n \n\n timestamp_diff(\n agent_responded_at,\n end_user_comment_created_at,\n second\n )\n\n\n / 60) as reply_time_calendar_minutes\n from reply_timestamps\n order by 1,2\n), __dbt__cte__int_zendesk__ticket_reply_times_calendar as (\nwith ticket as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket`\n\n), ticket_reply_times as (\n\n select *\n from __dbt__cte__int_zendesk__ticket_reply_times\n\n)\n\nselect\n\n ticket.ticket_id,\n sum(case when is_first_comment then reply_time_calendar_minutes\n else null end) as first_reply_time_calendar_minutes,\n sum(reply_time_calendar_minutes) as total_reply_time_calendar_minutes --total combined time the customer waits for internal response\n \nfrom ticket\nleft join ticket_reply_times\n using (ticket_id)\n\ngroup by 1\n), __dbt__cte__int_zendesk__ticket_work_time_calendar as (\nwith ticket_historical_status as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_status`\n\n), calendar_minutes as (\n \n select \n ticket_id,\n status,\n case when status in ('pending') then status_duration_calendar_minutes\n else 0 end as agent_wait_time_in_minutes,\n case when status in ('new', 'open', 'hold') then status_duration_calendar_minutes\n else 0 end as requester_wait_time_in_minutes,\n case when status in ('new', 'open') then status_duration_calendar_minutes\n else 0 end as agent_work_time_in_minutes,\n case when status in ('hold') then status_duration_calendar_minutes\n else 0 end as on_hold_time_in_minutes,\n case when status = 'new' then status_duration_calendar_minutes\n else 0 end as new_status_duration_minutes,\n case when status = 'open' then status_duration_calendar_minutes\n else 0 end as open_status_duration_minutes,\n case when status = 'deleted' then 1\n else 0 end as ticket_deleted,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_status_assignment_date,\n case when lag(status) over (partition by ticket_id order by valid_starting_at) = 'deleted' and status != 'deleted'\n then 1\n else 0\n end as ticket_recoveries\n\n from ticket_historical_status\n\n)\n\nselect \n ticket_id,\n last_status_assignment_date,\n sum(ticket_deleted) as ticket_deleted_count,\n sum(agent_wait_time_in_minutes) as agent_wait_time_in_calendar_minutes,\n sum(requester_wait_time_in_minutes) as requester_wait_time_in_calendar_minutes,\n sum(agent_work_time_in_minutes) as agent_work_time_in_calendar_minutes,\n sum(on_hold_time_in_minutes) as on_hold_time_in_calendar_minutes,\n sum(new_status_duration_minutes) as new_status_duration_in_calendar_minutes,\n sum(open_status_duration_minutes) as open_status_duration_in_calendar_minutes,\n sum(ticket_recoveries) as total_ticket_recoveries\nfrom calendar_minutes\ngroup by 1, 2\n), __dbt__cte__int_zendesk__ticket_first_resolution_time_business as (\n\n\nwith ticket_resolution_times_calendar as (\n\n select *\n from __dbt__cte__int_zendesk__ticket_resolution_times_calendar\n\n), ticket_schedules as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_schedules`\n\n), schedule as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__schedule_spine`\n\n), ticket_first_resolution_time as (\n\n select \n ticket_resolution_times_calendar.ticket_id,\n ticket_schedules.schedule_created_at,\n ticket_schedules.schedule_invalidated_at,\n ticket_schedules.schedule_id,\n\n -- bringing this in the determine which schedule (Daylight Savings vs Standard time) to use\n min(ticket_resolution_times_calendar.first_solved_at) as first_solved_at,\n \n (\n \n\n timestamp_diff(\n ticket_schedules.schedule_created_at,\n \n timestamp_trunc(\n cast(ticket_schedules.schedule_created_at as timestamp),\n week\n )\n\n,\n second\n )\n\n\n /60\n ) as start_time_in_minutes_from_week,\n greatest(0,\n (\n \n \n\n timestamp_diff(\n least(ticket_schedules.schedule_invalidated_at, min(ticket_resolution_times_calendar.first_solved_at)),\n ticket_schedules.schedule_created_at,\n second\n )\n\n\n/60\n )) as raw_delta_in_minutes\n \n from ticket_resolution_times_calendar\n join ticket_schedules on ticket_resolution_times_calendar.ticket_id = ticket_schedules.ticket_id\n group by 1, 2, 3, 4\n\n), weeks as (\n\n \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * power(2, 0)\n + \n \n p1.generated_number * power(2, 1)\n + \n \n p2.generated_number * power(2, 2)\n + \n \n p3.generated_number * power(2, 3)\n + \n \n p4.generated_number * power(2, 4)\n + \n \n p5.generated_number * power(2, 5)\n + \n \n p6.generated_number * power(2, 6)\n + \n \n p7.generated_number * power(2, 7)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 208\n order by generated_number\n\n\n\n), weeks_cross_ticket_first_resolution_time as (\n -- because time is reported in minutes since the beginning of the week, we have to split up time spent on the ticket into calendar weeks\n select \n\n ticket_first_resolution_time.*,\n generated_number - 1 as week_number\n\n from ticket_first_resolution_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number - 1\n\n\n), weekly_periods as (\n \n select \n\n weeks_cross_ticket_first_resolution_time.*,\n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n \n from weeks_cross_ticket_first_resolution_time\n\n), intercepted_periods as (\n\n select ticket_id,\n week_number,\n weekly_periods.schedule_id,\n ticket_week_start_time,\n ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n -- this chooses the Daylight Savings Time or Standard Time version of the schedule\n and weekly_periods.first_solved_at >= cast(schedule.valid_from as \n timestamp\n)\n and weekly_periods.first_solved_at < cast(schedule.valid_until as \n timestamp\n) \n \n)\n\n select \n ticket_id,\n sum(scheduled_minutes) as first_resolution_business_minutes\n from intercepted_periods\n group by 1\n), __dbt__cte__int_zendesk__ticket_full_resolution_time_business as (\n\n\nwith ticket_resolution_times_calendar as (\n\n select *\n from __dbt__cte__int_zendesk__ticket_resolution_times_calendar\n\n), ticket_schedules as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_schedules`\n\n), schedule as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__schedule_spine`\n\n), ticket_full_resolution_time as (\n\n select \n ticket_resolution_times_calendar.ticket_id,\n ticket_schedules.schedule_created_at,\n ticket_schedules.schedule_invalidated_at,\n ticket_schedules.schedule_id,\n\n -- bringing this in the determine which schedule (Daylight Savings vs Standard time) to use\n min(ticket_resolution_times_calendar.last_solved_at) as last_solved_at,\n \n (\n \n\n timestamp_diff(\n ticket_schedules.schedule_created_at,\n \n timestamp_trunc(\n cast(ticket_schedules.schedule_created_at as timestamp),\n week\n )\n\n,\n second\n )\n\n\n /60\n ) as start_time_in_minutes_from_week,\n greatest(0,\n (\n \n \n\n timestamp_diff(\n least(ticket_schedules.schedule_invalidated_at, min(ticket_resolution_times_calendar.last_solved_at)),\n ticket_schedules.schedule_created_at,\n second\n )\n\n\n/60\n )) as raw_delta_in_minutes\n \n from ticket_resolution_times_calendar\n join ticket_schedules on ticket_resolution_times_calendar.ticket_id = ticket_schedules.ticket_id\n group by 1, 2, 3, 4\n\n), weeks as (\n\n \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * power(2, 0)\n + \n \n p1.generated_number * power(2, 1)\n + \n \n p2.generated_number * power(2, 2)\n + \n \n p3.generated_number * power(2, 3)\n + \n \n p4.generated_number * power(2, 4)\n + \n \n p5.generated_number * power(2, 5)\n + \n \n p6.generated_number * power(2, 6)\n + \n \n p7.generated_number * power(2, 7)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 208\n order by generated_number\n\n\n\n), weeks_cross_ticket_full_resolution_time as (\n -- because time is reported in minutes since the beginning of the week, we have to split up time spent on the ticket into calendar weeks\n select \n\n ticket_full_resolution_time.*,\n generated_number - 1 as week_number\n\n from ticket_full_resolution_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number - 1\n\n), weekly_periods as (\n \n select \n\n weeks_cross_ticket_full_resolution_time.*,\n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n \n from weeks_cross_ticket_full_resolution_time\n\n), intercepted_periods as (\n\n select \n ticket_id,\n week_number,\n weekly_periods.schedule_id,\n ticket_week_start_time,\n ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n -- this chooses the Daylight Savings Time or Standard Time version of the schedule\n and weekly_periods.last_solved_at >= cast(schedule.valid_from as \n timestamp\n)\n and weekly_periods.last_solved_at < cast(schedule.valid_until as \n timestamp\n) \n \n)\n\n select \n ticket_id,\n sum(scheduled_minutes) as full_resolution_business_minutes\n from intercepted_periods\n group by 1\n), __dbt__cte__int_zendesk__ticket_work_time_business as (\n\n\nwith ticket_historical_status as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_status`\n\n), ticket_schedules as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_schedules`\n\n), schedule as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__schedule_spine`\n\n), ticket_status_crossed_with_schedule as (\n \n select\n ticket_historical_status.ticket_id,\n ticket_historical_status.status as ticket_status,\n ticket_schedules.schedule_id,\n\n -- take the intersection of the intervals in which the status and the schedule were both active, for calculating the business minutes spent working on the ticket\n greatest(valid_starting_at, schedule_created_at) as status_schedule_start,\n least(valid_ending_at, schedule_invalidated_at) as status_schedule_end,\n\n -- bringing the following in the determine which schedule (Daylight Savings vs Standard time) to use\n ticket_historical_status.valid_starting_at as status_valid_starting_at,\n ticket_historical_status.valid_ending_at as status_valid_ending_at\n\n from ticket_historical_status\n left join ticket_schedules\n on ticket_historical_status.ticket_id = ticket_schedules.ticket_id\n where \n \n\n timestamp_diff(\n least(valid_ending_at, schedule_invalidated_at),\n greatest(valid_starting_at, schedule_created_at),\n second\n )\n\n\n > 0\n\n), ticket_full_solved_time as (\n\n select \n ticket_status_crossed_with_schedule.*,\n (\n \n\n timestamp_diff(\n ticket_status_crossed_with_schedule.status_schedule_start,\n \n timestamp_trunc(\n cast(ticket_status_crossed_with_schedule.status_schedule_start as timestamp),\n week\n )\n\n,\n second\n )\n\n\n /60\n ) as start_time_in_minutes_from_week,\n (\n \n\n timestamp_diff(\n ticket_status_crossed_with_schedule.status_schedule_end,\n ticket_status_crossed_with_schedule.status_schedule_start,\n second\n )\n\n\n /60\n ) as raw_delta_in_minutes\n from ticket_status_crossed_with_schedule\n group by 1,2,3,4,5,6,7\n\n), weeks as (\n\n \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * power(2, 0)\n + \n \n p1.generated_number * power(2, 1)\n + \n \n p2.generated_number * power(2, 2)\n + \n \n p3.generated_number * power(2, 3)\n + \n \n p4.generated_number * power(2, 4)\n + \n \n p5.generated_number * power(2, 5)\n + \n \n p6.generated_number * power(2, 6)\n + \n \n p7.generated_number * power(2, 7)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 208\n order by generated_number\n\n\n\n), weeks_cross_ticket_full_solved_time as (\n -- because time is reported in minutes since the beginning of the week, we have to split up time spent on the ticket into calendar weeks\n select \n ticket_full_solved_time.*,\n generated_number - 1 as week_number\n from ticket_full_solved_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number -1\n\n), weekly_periods as (\n\n select\n\n weeks_cross_ticket_full_solved_time.*,\n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n \n from weeks_cross_ticket_full_solved_time\n\n), intercepted_periods as (\n \n select \n weekly_periods.ticket_id,\n weekly_periods.week_number,\n weekly_periods.schedule_id,\n weekly_periods.ticket_status,\n weekly_periods.ticket_week_start_time,\n weekly_periods.ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(weekly_periods.ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n -- this chooses the Daylight Savings Time or Standard Time version of the schedule\n and weekly_periods.status_valid_ending_at >= cast(schedule.valid_from as \n timestamp\n)\n and weekly_periods.status_valid_starting_at < cast(schedule.valid_until as \n timestamp\n) \n \n), business_minutes as (\n \n select \n ticket_id,\n ticket_status,\n case when ticket_status in ('pending') then scheduled_minutes\n else 0 end as agent_wait_time_in_minutes,\n case when ticket_status in ('new', 'open', 'hold') then scheduled_minutes\n else 0 end as requester_wait_time_in_minutes,\n case when ticket_status in ('new', 'open') then scheduled_minutes\n else 0 end as agent_work_time_in_minutes,\n case when ticket_status in ('hold') then scheduled_minutes\n else 0 end as on_hold_time_in_minutes\n from intercepted_periods\n\n)\n \n select \n ticket_id,\n sum(agent_wait_time_in_minutes) as agent_wait_time_in_business_minutes,\n sum(requester_wait_time_in_minutes) as requester_wait_time_in_business_minutes,\n sum(agent_work_time_in_minutes) as agent_work_time_in_business_minutes,\n sum(on_hold_time_in_minutes) as on_hold_time_in_business_minutes\n from business_minutes\n group by 1\n), __dbt__cte__int_zendesk__ticket_first_reply_time_business as (\n\n\nwith ticket_reply_times as (\n\n select *\n from __dbt__cte__int_zendesk__ticket_reply_times\n\n), ticket_schedules as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_schedules`\n\n), schedule as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__schedule_spine`\n\n), first_reply_time as (\n\n select\n ticket_id,\n end_user_comment_created_at,\n agent_responded_at\n\n from ticket_reply_times\n where is_first_comment\n\n), ticket_first_reply_time as (\n\n select \n first_reply_time.ticket_id,\n ticket_schedules.schedule_created_at,\n ticket_schedules.schedule_invalidated_at,\n ticket_schedules.schedule_id,\n\n -- bringing this in the determine which schedule (Daylight Savings vs Standard time) to use\n min(first_reply_time.agent_responded_at) as agent_responded_at,\n\n (\n \n\n timestamp_diff(\n ticket_schedules.schedule_created_at,\n \n timestamp_trunc(\n cast(ticket_schedules.schedule_created_at as timestamp),\n week\n )\n\n,\n second\n )\n\n\n /60\n ) as start_time_in_minutes_from_week,\n greatest(0,\n (\n \n \n\n timestamp_diff(\n least(ticket_schedules.schedule_invalidated_at, min(first_reply_time.agent_responded_at)),\n ticket_schedules.schedule_created_at,\n second\n )\n\n\n/60\n )) as raw_delta_in_minutes\n \n from first_reply_time\n join ticket_schedules on first_reply_time.ticket_id = ticket_schedules.ticket_id\n group by 1, 2, 3, 4\n\n), weeks as (\n\n \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * power(2, 0)\n + \n \n p1.generated_number * power(2, 1)\n + \n \n p2.generated_number * power(2, 2)\n + \n \n p3.generated_number * power(2, 3)\n + \n \n p4.generated_number * power(2, 4)\n + \n \n p5.generated_number * power(2, 5)\n + \n \n p6.generated_number * power(2, 6)\n + \n \n p7.generated_number * power(2, 7)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 208\n order by generated_number\n\n\n\n), weeks_cross_ticket_first_reply as (\n -- because time is reported in minutes since the beginning of the week, we have to split up time spent on the ticket into calendar weeks\n select \n\n ticket_first_reply_time.*,\n generated_number - 1 as week_number\n\n from ticket_first_reply_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number - 1\n\n), weekly_periods as (\n \n select \n weeks_cross_ticket_first_reply.*, \n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n from weeks_cross_ticket_first_reply\n\n), intercepted_periods as (\n\n select ticket_id,\n week_number,\n weekly_periods.schedule_id,\n ticket_week_start_time,\n ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n -- this chooses the Daylight Savings Time or Standard Time version of the schedule\n and weekly_periods.agent_responded_at >= cast(schedule.valid_from as \n timestamp\n)\n and weekly_periods.agent_responded_at < cast(schedule.valid_until as \n timestamp\n) \n\n)\n\n select ticket_id,\n sum(scheduled_minutes) as first_reply_time_business_minutes\n from intercepted_periods\n group by 1\n),ticket_enriched as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk`.`zendesk__ticket_enriched`\n\n), ticket_resolution_times_calendar as (\n\n select *\n from __dbt__cte__int_zendesk__ticket_resolution_times_calendar\n\n), ticket_reply_times_calendar as (\n\n select *\n from __dbt__cte__int_zendesk__ticket_reply_times_calendar\n\n), ticket_comments as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__comment_metrics`\n\n), ticket_work_time_calendar as (\n\n select *\n from __dbt__cte__int_zendesk__ticket_work_time_calendar\n\n-- business hour CTEs\n\n\n), ticket_first_resolution_time_business as (\n\n select *\n from __dbt__cte__int_zendesk__ticket_first_resolution_time_business\n\n), ticket_full_resolution_time_business as (\n\n select *\n from __dbt__cte__int_zendesk__ticket_full_resolution_time_business\n\n), ticket_work_time_business as (\n\n select *\n from __dbt__cte__int_zendesk__ticket_work_time_business\n\n), ticket_first_reply_time_business as (\n\n select *\n from __dbt__cte__int_zendesk__ticket_first_reply_time_business\n\n\n-- end business hour CTEs\n\n), calendar_hour_metrics as (\n\nselect\n ticket_enriched.*,\n case when coalesce(ticket_comments.count_public_agent_comments, 0) = 0\n then null\n else ticket_reply_times_calendar.first_reply_time_calendar_minutes\n end as first_reply_time_calendar_minutes,\n case when coalesce(ticket_comments.count_public_agent_comments, 0) = 0\n then null\n else ticket_reply_times_calendar.total_reply_time_calendar_minutes\n end as total_reply_time_calendar_minutes,\n coalesce(ticket_comments.count_agent_comments, 0) as count_agent_comments,\n coalesce(ticket_comments.count_public_agent_comments, 0) as count_public_agent_comments,\n coalesce(ticket_comments.count_end_user_comments, 0) as count_end_user_comments,\n coalesce(ticket_comments.count_public_comments, 0) as count_public_comments,\n coalesce(ticket_comments.count_internal_comments, 0) as count_internal_comments,\n coalesce(ticket_comments.total_comments, 0) as total_comments,\n coalesce(ticket_comments.count_ticket_handoffs, 0) as count_ticket_handoffs, -- the number of distinct internal users who commented on the ticket\n ticket_comments.last_comment_added_at as ticket_last_comment_date,\n ticket_resolution_times_calendar.unique_assignee_count,\n ticket_resolution_times_calendar.assignee_stations_count,\n ticket_resolution_times_calendar.group_stations_count,\n ticket_resolution_times_calendar.first_assignee_id,\n ticket_resolution_times_calendar.last_assignee_id,\n ticket_resolution_times_calendar.first_agent_assignment_date,\n ticket_resolution_times_calendar.last_agent_assignment_date,\n ticket_resolution_times_calendar.first_solved_at,\n ticket_resolution_times_calendar.last_solved_at,\n case when ticket_enriched.status in ('solved', 'closed')\n then ticket_resolution_times_calendar.first_assignment_to_resolution_calendar_minutes\n else null\n end as first_assignment_to_resolution_calendar_minutes,\n case when ticket_enriched.status in ('solved', 'closed')\n then ticket_resolution_times_calendar.last_assignment_to_resolution_calendar_minutes\n else null\n end as last_assignment_to_resolution_calendar_minutes,\n ticket_resolution_times_calendar.ticket_unassigned_duration_calendar_minutes,\n ticket_resolution_times_calendar.first_resolution_calendar_minutes,\n ticket_resolution_times_calendar.final_resolution_calendar_minutes,\n ticket_resolution_times_calendar.total_resolutions as count_resolutions,\n ticket_resolution_times_calendar.count_reopens,\n ticket_work_time_calendar.ticket_deleted_count,\n ticket_work_time_calendar.total_ticket_recoveries,\n ticket_work_time_calendar.last_status_assignment_date,\n ticket_work_time_calendar.new_status_duration_in_calendar_minutes,\n ticket_work_time_calendar.open_status_duration_in_calendar_minutes,\n ticket_work_time_calendar.agent_wait_time_in_calendar_minutes,\n ticket_work_time_calendar.requester_wait_time_in_calendar_minutes,\n ticket_work_time_calendar.agent_work_time_in_calendar_minutes,\n ticket_work_time_calendar.on_hold_time_in_calendar_minutes,\n coalesce(ticket_comments.count_agent_comments, 0) as total_agent_replies,\n \n case when ticket_enriched.is_requester_active = true and ticket_enriched.requester_last_login_at is not null\n then (\n\n datetime_diff(\n cast(\n current_timestamp\n as datetime),\n cast(ticket_enriched.requester_last_login_at as datetime),\n second\n )\n\n /60)\n end as requester_last_login_age_minutes,\n case when ticket_enriched.is_assignee_active = true and ticket_enriched.assignee_last_login_at is not null\n then (\n\n datetime_diff(\n cast(\n current_timestamp\n as datetime),\n cast(ticket_enriched.assignee_last_login_at as datetime),\n second\n )\n\n /60)\n end as assignee_last_login_age_minutes,\n case when lower(ticket_enriched.status) not in ('solved','closed')\n then (\n\n datetime_diff(\n cast(\n current_timestamp\n as datetime),\n cast(ticket_enriched.created_at as datetime),\n second\n )\n\n /60)\n end as unsolved_ticket_age_minutes,\n case when lower(ticket_enriched.status) not in ('solved','closed')\n then (\n\n datetime_diff(\n cast(\n current_timestamp\n as datetime),\n cast(ticket_enriched.updated_at as datetime),\n second\n )\n\n /60)\n end as unsolved_ticket_age_since_update_minutes,\n case when lower(ticket_enriched.status) in ('solved','closed') and ticket_comments.is_one_touch_resolution \n then true\n else false\n end as is_one_touch_resolution,\n case when lower(ticket_enriched.status) in ('solved','closed') and ticket_comments.is_two_touch_resolution \n then true\n else false \n end as is_two_touch_resolution,\n case when lower(ticket_enriched.status) in ('solved','closed') and not ticket_comments.is_one_touch_resolution \n then true\n else false \n end as is_multi_touch_resolution\n\n\nfrom ticket_enriched\n\nleft join ticket_reply_times_calendar\n using (ticket_id)\n\nleft join ticket_resolution_times_calendar\n using (ticket_id)\n\nleft join ticket_work_time_calendar\n using (ticket_id)\n\nleft join ticket_comments\n using(ticket_id)\n\n\n\n), business_hour_metrics as (\n\n select \n ticket_enriched.ticket_id,\n ticket_first_resolution_time_business.first_resolution_business_minutes,\n ticket_full_resolution_time_business.full_resolution_business_minutes,\n ticket_first_reply_time_business.first_reply_time_business_minutes,\n ticket_work_time_business.agent_wait_time_in_business_minutes,\n ticket_work_time_business.requester_wait_time_in_business_minutes,\n ticket_work_time_business.agent_work_time_in_business_minutes,\n ticket_work_time_business.on_hold_time_in_business_minutes\n\n from ticket_enriched\n\n left join ticket_first_resolution_time_business\n using (ticket_id)\n\n left join ticket_full_resolution_time_business\n using (ticket_id)\n \n left join ticket_first_reply_time_business\n using (ticket_id) \n \n left join ticket_work_time_business\n using (ticket_id)\n\n)\n\nselect\n calendar_hour_metrics.*,\n case when calendar_hour_metrics.status in ('solved', 'closed')\n then business_hour_metrics.first_resolution_business_minutes\n else null\n end as first_resolution_business_minutes,\n case when calendar_hour_metrics.status in ('solved', 'closed')\n then business_hour_metrics.full_resolution_business_minutes\n else null\n end as full_resolution_business_minutes,\n case when coalesce(calendar_hour_metrics.count_public_agent_comments, 0) = 0\n then null\n else business_hour_metrics.first_reply_time_business_minutes\n end as first_reply_time_business_minutes,\n business_hour_metrics.agent_wait_time_in_business_minutes,\n business_hour_metrics.requester_wait_time_in_business_minutes,\n business_hour_metrics.agent_work_time_in_business_minutes,\n business_hour_metrics.on_hold_time_in_business_minutes\n\nfrom calendar_hour_metrics\n\nleft join business_hour_metrics \n using (ticket_id)\n\n", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.zendesk.int_zendesk__ticket_resolution_times_calendar", "sql": " __dbt__cte__int_zendesk__ticket_resolution_times_calendar as (\nwith historical_solved_status as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_status`\n where status = 'solved'\n\n), ticket as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket`\n\n), ticket_historical_assignee as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_assignee`\n\n), ticket_historical_group as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_group`\n\n), solved_times as (\n \n select\n \n ticket_id,\n min(valid_starting_at) as first_solved_at,\n max(valid_starting_at) as last_solved_at,\n count(status) as solved_count \n\n from historical_solved_status\n group by 1\n\n)\n\n select\n\n ticket.ticket_id,\n ticket.created_at,\n solved_times.first_solved_at,\n solved_times.last_solved_at,\n ticket_historical_assignee.unique_assignee_count,\n ticket_historical_assignee.assignee_stations_count,\n ticket_historical_group.group_stations_count,\n ticket_historical_assignee.first_assignee_id,\n ticket_historical_assignee.last_assignee_id,\n ticket_historical_assignee.first_agent_assignment_date,\n ticket_historical_assignee.last_agent_assignment_date,\n ticket_historical_assignee.ticket_unassigned_duration_calendar_minutes,\n solved_times.solved_count as total_resolutions,\n case when solved_times.solved_count <= 1\n then 0\n else solved_times.solved_count - 1 --subtracting one as the first solve is not a reopen.\n end as count_reopens,\n\n \n \n\n timestamp_diff(\n solved_times.last_solved_at,\n ticket_historical_assignee.first_agent_assignment_date,\n minute\n )\n\n\n as first_assignment_to_resolution_calendar_minutes,\n \n \n\n timestamp_diff(\n solved_times.last_solved_at,\n ticket_historical_assignee.last_agent_assignment_date,\n minute\n )\n\n\n as last_assignment_to_resolution_calendar_minutes,\n \n \n\n timestamp_diff(\n solved_times.first_solved_at,\n ticket.created_at,\n minute\n )\n\n\n as first_resolution_calendar_minutes,\n \n \n\n timestamp_diff(\n solved_times.last_solved_at,\n ticket.created_at,\n minute\n )\n\n\n as final_resolution_calendar_minutes\n\n from ticket\n\n left join ticket_historical_assignee\n using(ticket_id)\n\n left join ticket_historical_group\n using(ticket_id)\n\n left join solved_times\n using(ticket_id)\n)"}, {"id": "model.zendesk.int_zendesk__comments_enriched", "sql": " __dbt__cte__int_zendesk__comments_enriched as (\nwith ticket_comment as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__updates`\n where field_name = 'comment'\n\n), users as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__user`\n\n), joined as (\n\n select \n\n ticket_comment.*,\n case when commenter.role = 'end-user' then 'external_comment'\n when commenter.role in ('agent','admin') then 'internal_comment'\n else 'unknown' end as commenter_role\n \n from ticket_comment\n \n join users as commenter\n on commenter.user_id = ticket_comment.user_id\n\n), add_previous_commenter_role as (\n /*\n In int_zendesk__ticket_reply_times we will only be focusing on reply times between public tickets.\n The below union explicitly identifies the previous commentor roles of public and not public comments.\n */\n select\n *,\n coalesce(\n lag(commenter_role) over (partition by ticket_id order by valid_starting_at)\n , 'first_comment') \n as previous_commenter_role\n from joined\n where is_public\n\n union all\n\n select\n *,\n 'non_public_comment' as previous_commenter_role\n from joined\n where not is_public\n)\n\nselect \n *,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_comment_added_at\nfrom add_previous_commenter_role\n)"}, {"id": "model.zendesk.int_zendesk__ticket_reply_times", "sql": " __dbt__cte__int_zendesk__ticket_reply_times as (\nwith ticket_public_comments as (\n\n select *\n from __dbt__cte__int_zendesk__comments_enriched\n where is_public\n\n), end_user_comments as (\n \n select \n ticket_id,\n valid_starting_at as end_user_comment_created_at,\n ticket_created_date,\n commenter_role,\n previous_commenter_role = 'first_comment' as is_first_comment\n from ticket_public_comments \n where (commenter_role = 'external_comment'\n and ticket_public_comments.previous_commenter_role != 'external_comment') -- we only care about net new end user comments\n or previous_commenter_role = 'first_comment' -- We also want to take into consideration internal first comment replies\n\n), reply_timestamps as ( \n\n select\n end_user_comments.ticket_id,\n -- If the commentor was internal and a first comment then we want the ticket created date to be the end user comment created date\n -- Otherwise we will want to end user comment created date\n case when end_user_comments.is_first_comment\n then end_user_comments.ticket_created_date\n else end_user_comments.end_user_comment_created_at\n end as end_user_comment_created_at,\n end_user_comments.is_first_comment,\n min(agent_comments.valid_starting_at) as agent_responded_at\n from end_user_comments\n left join ticket_public_comments as agent_comments\n on agent_comments.ticket_id = end_user_comments.ticket_id\n and agent_comments.commenter_role = 'internal_comment'\n and agent_comments.valid_starting_at > end_user_comments.end_user_comment_created_at\n group by 1,2,3\n\n)\n\n select\n *,\n (\n \n\n timestamp_diff(\n agent_responded_at,\n end_user_comment_created_at,\n second\n )\n\n\n / 60) as reply_time_calendar_minutes\n from reply_timestamps\n order by 1,2\n)"}, {"id": "model.zendesk.int_zendesk__ticket_reply_times_calendar", "sql": " __dbt__cte__int_zendesk__ticket_reply_times_calendar as (\nwith ticket as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket`\n\n), ticket_reply_times as (\n\n select *\n from __dbt__cte__int_zendesk__ticket_reply_times\n\n)\n\nselect\n\n ticket.ticket_id,\n sum(case when is_first_comment then reply_time_calendar_minutes\n else null end) as first_reply_time_calendar_minutes,\n sum(reply_time_calendar_minutes) as total_reply_time_calendar_minutes --total combined time the customer waits for internal response\n \nfrom ticket\nleft join ticket_reply_times\n using (ticket_id)\n\ngroup by 1\n)"}, {"id": "model.zendesk.int_zendesk__ticket_work_time_calendar", "sql": " __dbt__cte__int_zendesk__ticket_work_time_calendar as (\nwith ticket_historical_status as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_status`\n\n), calendar_minutes as (\n \n select \n ticket_id,\n status,\n case when status in ('pending') then status_duration_calendar_minutes\n else 0 end as agent_wait_time_in_minutes,\n case when status in ('new', 'open', 'hold') then status_duration_calendar_minutes\n else 0 end as requester_wait_time_in_minutes,\n case when status in ('new', 'open') then status_duration_calendar_minutes\n else 0 end as agent_work_time_in_minutes,\n case when status in ('hold') then status_duration_calendar_minutes\n else 0 end as on_hold_time_in_minutes,\n case when status = 'new' then status_duration_calendar_minutes\n else 0 end as new_status_duration_minutes,\n case when status = 'open' then status_duration_calendar_minutes\n else 0 end as open_status_duration_minutes,\n case when status = 'deleted' then 1\n else 0 end as ticket_deleted,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_status_assignment_date,\n case when lag(status) over (partition by ticket_id order by valid_starting_at) = 'deleted' and status != 'deleted'\n then 1\n else 0\n end as ticket_recoveries\n\n from ticket_historical_status\n\n)\n\nselect \n ticket_id,\n last_status_assignment_date,\n sum(ticket_deleted) as ticket_deleted_count,\n sum(agent_wait_time_in_minutes) as agent_wait_time_in_calendar_minutes,\n sum(requester_wait_time_in_minutes) as requester_wait_time_in_calendar_minutes,\n sum(agent_work_time_in_minutes) as agent_work_time_in_calendar_minutes,\n sum(on_hold_time_in_minutes) as on_hold_time_in_calendar_minutes,\n sum(new_status_duration_minutes) as new_status_duration_in_calendar_minutes,\n sum(open_status_duration_minutes) as open_status_duration_in_calendar_minutes,\n sum(ticket_recoveries) as total_ticket_recoveries\nfrom calendar_minutes\ngroup by 1, 2\n)"}, {"id": "model.zendesk.int_zendesk__ticket_first_resolution_time_business", "sql": " __dbt__cte__int_zendesk__ticket_first_resolution_time_business as (\n\n\nwith ticket_resolution_times_calendar as (\n\n select *\n from __dbt__cte__int_zendesk__ticket_resolution_times_calendar\n\n), ticket_schedules as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_schedules`\n\n), schedule as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__schedule_spine`\n\n), ticket_first_resolution_time as (\n\n select \n ticket_resolution_times_calendar.ticket_id,\n ticket_schedules.schedule_created_at,\n ticket_schedules.schedule_invalidated_at,\n ticket_schedules.schedule_id,\n\n -- bringing this in the determine which schedule (Daylight Savings vs Standard time) to use\n min(ticket_resolution_times_calendar.first_solved_at) as first_solved_at,\n \n (\n \n\n timestamp_diff(\n ticket_schedules.schedule_created_at,\n \n timestamp_trunc(\n cast(ticket_schedules.schedule_created_at as timestamp),\n week\n )\n\n,\n second\n )\n\n\n /60\n ) as start_time_in_minutes_from_week,\n greatest(0,\n (\n \n \n\n timestamp_diff(\n least(ticket_schedules.schedule_invalidated_at, min(ticket_resolution_times_calendar.first_solved_at)),\n ticket_schedules.schedule_created_at,\n second\n )\n\n\n/60\n )) as raw_delta_in_minutes\n \n from ticket_resolution_times_calendar\n join ticket_schedules on ticket_resolution_times_calendar.ticket_id = ticket_schedules.ticket_id\n group by 1, 2, 3, 4\n\n), weeks as (\n\n \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * power(2, 0)\n + \n \n p1.generated_number * power(2, 1)\n + \n \n p2.generated_number * power(2, 2)\n + \n \n p3.generated_number * power(2, 3)\n + \n \n p4.generated_number * power(2, 4)\n + \n \n p5.generated_number * power(2, 5)\n + \n \n p6.generated_number * power(2, 6)\n + \n \n p7.generated_number * power(2, 7)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 208\n order by generated_number\n\n\n\n), weeks_cross_ticket_first_resolution_time as (\n -- because time is reported in minutes since the beginning of the week, we have to split up time spent on the ticket into calendar weeks\n select \n\n ticket_first_resolution_time.*,\n generated_number - 1 as week_number\n\n from ticket_first_resolution_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number - 1\n\n\n), weekly_periods as (\n \n select \n\n weeks_cross_ticket_first_resolution_time.*,\n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n \n from weeks_cross_ticket_first_resolution_time\n\n), intercepted_periods as (\n\n select ticket_id,\n week_number,\n weekly_periods.schedule_id,\n ticket_week_start_time,\n ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n -- this chooses the Daylight Savings Time or Standard Time version of the schedule\n and weekly_periods.first_solved_at >= cast(schedule.valid_from as \n timestamp\n)\n and weekly_periods.first_solved_at < cast(schedule.valid_until as \n timestamp\n) \n \n)\n\n select \n ticket_id,\n sum(scheduled_minutes) as first_resolution_business_minutes\n from intercepted_periods\n group by 1\n)"}, {"id": "model.zendesk.int_zendesk__ticket_full_resolution_time_business", "sql": " __dbt__cte__int_zendesk__ticket_full_resolution_time_business as (\n\n\nwith ticket_resolution_times_calendar as (\n\n select *\n from __dbt__cte__int_zendesk__ticket_resolution_times_calendar\n\n), ticket_schedules as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_schedules`\n\n), schedule as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__schedule_spine`\n\n), ticket_full_resolution_time as (\n\n select \n ticket_resolution_times_calendar.ticket_id,\n ticket_schedules.schedule_created_at,\n ticket_schedules.schedule_invalidated_at,\n ticket_schedules.schedule_id,\n\n -- bringing this in the determine which schedule (Daylight Savings vs Standard time) to use\n min(ticket_resolution_times_calendar.last_solved_at) as last_solved_at,\n \n (\n \n\n timestamp_diff(\n ticket_schedules.schedule_created_at,\n \n timestamp_trunc(\n cast(ticket_schedules.schedule_created_at as timestamp),\n week\n )\n\n,\n second\n )\n\n\n /60\n ) as start_time_in_minutes_from_week,\n greatest(0,\n (\n \n \n\n timestamp_diff(\n least(ticket_schedules.schedule_invalidated_at, min(ticket_resolution_times_calendar.last_solved_at)),\n ticket_schedules.schedule_created_at,\n second\n )\n\n\n/60\n )) as raw_delta_in_minutes\n \n from ticket_resolution_times_calendar\n join ticket_schedules on ticket_resolution_times_calendar.ticket_id = ticket_schedules.ticket_id\n group by 1, 2, 3, 4\n\n), weeks as (\n\n \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * power(2, 0)\n + \n \n p1.generated_number * power(2, 1)\n + \n \n p2.generated_number * power(2, 2)\n + \n \n p3.generated_number * power(2, 3)\n + \n \n p4.generated_number * power(2, 4)\n + \n \n p5.generated_number * power(2, 5)\n + \n \n p6.generated_number * power(2, 6)\n + \n \n p7.generated_number * power(2, 7)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 208\n order by generated_number\n\n\n\n), weeks_cross_ticket_full_resolution_time as (\n -- because time is reported in minutes since the beginning of the week, we have to split up time spent on the ticket into calendar weeks\n select \n\n ticket_full_resolution_time.*,\n generated_number - 1 as week_number\n\n from ticket_full_resolution_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number - 1\n\n), weekly_periods as (\n \n select \n\n weeks_cross_ticket_full_resolution_time.*,\n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n \n from weeks_cross_ticket_full_resolution_time\n\n), intercepted_periods as (\n\n select \n ticket_id,\n week_number,\n weekly_periods.schedule_id,\n ticket_week_start_time,\n ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n -- this chooses the Daylight Savings Time or Standard Time version of the schedule\n and weekly_periods.last_solved_at >= cast(schedule.valid_from as \n timestamp\n)\n and weekly_periods.last_solved_at < cast(schedule.valid_until as \n timestamp\n) \n \n)\n\n select \n ticket_id,\n sum(scheduled_minutes) as full_resolution_business_minutes\n from intercepted_periods\n group by 1\n)"}, {"id": "model.zendesk.int_zendesk__ticket_work_time_business", "sql": " __dbt__cte__int_zendesk__ticket_work_time_business as (\n\n\nwith ticket_historical_status as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_status`\n\n), ticket_schedules as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_schedules`\n\n), schedule as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__schedule_spine`\n\n), ticket_status_crossed_with_schedule as (\n \n select\n ticket_historical_status.ticket_id,\n ticket_historical_status.status as ticket_status,\n ticket_schedules.schedule_id,\n\n -- take the intersection of the intervals in which the status and the schedule were both active, for calculating the business minutes spent working on the ticket\n greatest(valid_starting_at, schedule_created_at) as status_schedule_start,\n least(valid_ending_at, schedule_invalidated_at) as status_schedule_end,\n\n -- bringing the following in the determine which schedule (Daylight Savings vs Standard time) to use\n ticket_historical_status.valid_starting_at as status_valid_starting_at,\n ticket_historical_status.valid_ending_at as status_valid_ending_at\n\n from ticket_historical_status\n left join ticket_schedules\n on ticket_historical_status.ticket_id = ticket_schedules.ticket_id\n where \n \n\n timestamp_diff(\n least(valid_ending_at, schedule_invalidated_at),\n greatest(valid_starting_at, schedule_created_at),\n second\n )\n\n\n > 0\n\n), ticket_full_solved_time as (\n\n select \n ticket_status_crossed_with_schedule.*,\n (\n \n\n timestamp_diff(\n ticket_status_crossed_with_schedule.status_schedule_start,\n \n timestamp_trunc(\n cast(ticket_status_crossed_with_schedule.status_schedule_start as timestamp),\n week\n )\n\n,\n second\n )\n\n\n /60\n ) as start_time_in_minutes_from_week,\n (\n \n\n timestamp_diff(\n ticket_status_crossed_with_schedule.status_schedule_end,\n ticket_status_crossed_with_schedule.status_schedule_start,\n second\n )\n\n\n /60\n ) as raw_delta_in_minutes\n from ticket_status_crossed_with_schedule\n group by 1,2,3,4,5,6,7\n\n), weeks as (\n\n \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * power(2, 0)\n + \n \n p1.generated_number * power(2, 1)\n + \n \n p2.generated_number * power(2, 2)\n + \n \n p3.generated_number * power(2, 3)\n + \n \n p4.generated_number * power(2, 4)\n + \n \n p5.generated_number * power(2, 5)\n + \n \n p6.generated_number * power(2, 6)\n + \n \n p7.generated_number * power(2, 7)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 208\n order by generated_number\n\n\n\n), weeks_cross_ticket_full_solved_time as (\n -- because time is reported in minutes since the beginning of the week, we have to split up time spent on the ticket into calendar weeks\n select \n ticket_full_solved_time.*,\n generated_number - 1 as week_number\n from ticket_full_solved_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number -1\n\n), weekly_periods as (\n\n select\n\n weeks_cross_ticket_full_solved_time.*,\n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n \n from weeks_cross_ticket_full_solved_time\n\n), intercepted_periods as (\n \n select \n weekly_periods.ticket_id,\n weekly_periods.week_number,\n weekly_periods.schedule_id,\n weekly_periods.ticket_status,\n weekly_periods.ticket_week_start_time,\n weekly_periods.ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(weekly_periods.ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n -- this chooses the Daylight Savings Time or Standard Time version of the schedule\n and weekly_periods.status_valid_ending_at >= cast(schedule.valid_from as \n timestamp\n)\n and weekly_periods.status_valid_starting_at < cast(schedule.valid_until as \n timestamp\n) \n \n), business_minutes as (\n \n select \n ticket_id,\n ticket_status,\n case when ticket_status in ('pending') then scheduled_minutes\n else 0 end as agent_wait_time_in_minutes,\n case when ticket_status in ('new', 'open', 'hold') then scheduled_minutes\n else 0 end as requester_wait_time_in_minutes,\n case when ticket_status in ('new', 'open') then scheduled_minutes\n else 0 end as agent_work_time_in_minutes,\n case when ticket_status in ('hold') then scheduled_minutes\n else 0 end as on_hold_time_in_minutes\n from intercepted_periods\n\n)\n \n select \n ticket_id,\n sum(agent_wait_time_in_minutes) as agent_wait_time_in_business_minutes,\n sum(requester_wait_time_in_minutes) as requester_wait_time_in_business_minutes,\n sum(agent_work_time_in_minutes) as agent_work_time_in_business_minutes,\n sum(on_hold_time_in_minutes) as on_hold_time_in_business_minutes\n from business_minutes\n group by 1\n)"}, {"id": "model.zendesk.int_zendesk__ticket_first_reply_time_business", "sql": " __dbt__cte__int_zendesk__ticket_first_reply_time_business as (\n\n\nwith ticket_reply_times as (\n\n select *\n from __dbt__cte__int_zendesk__ticket_reply_times\n\n), ticket_schedules as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_schedules`\n\n), schedule as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__schedule_spine`\n\n), first_reply_time as (\n\n select\n ticket_id,\n end_user_comment_created_at,\n agent_responded_at\n\n from ticket_reply_times\n where is_first_comment\n\n), ticket_first_reply_time as (\n\n select \n first_reply_time.ticket_id,\n ticket_schedules.schedule_created_at,\n ticket_schedules.schedule_invalidated_at,\n ticket_schedules.schedule_id,\n\n -- bringing this in the determine which schedule (Daylight Savings vs Standard time) to use\n min(first_reply_time.agent_responded_at) as agent_responded_at,\n\n (\n \n\n timestamp_diff(\n ticket_schedules.schedule_created_at,\n \n timestamp_trunc(\n cast(ticket_schedules.schedule_created_at as timestamp),\n week\n )\n\n,\n second\n )\n\n\n /60\n ) as start_time_in_minutes_from_week,\n greatest(0,\n (\n \n \n\n timestamp_diff(\n least(ticket_schedules.schedule_invalidated_at, min(first_reply_time.agent_responded_at)),\n ticket_schedules.schedule_created_at,\n second\n )\n\n\n/60\n )) as raw_delta_in_minutes\n \n from first_reply_time\n join ticket_schedules on first_reply_time.ticket_id = ticket_schedules.ticket_id\n group by 1, 2, 3, 4\n\n), weeks as (\n\n \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * power(2, 0)\n + \n \n p1.generated_number * power(2, 1)\n + \n \n p2.generated_number * power(2, 2)\n + \n \n p3.generated_number * power(2, 3)\n + \n \n p4.generated_number * power(2, 4)\n + \n \n p5.generated_number * power(2, 5)\n + \n \n p6.generated_number * power(2, 6)\n + \n \n p7.generated_number * power(2, 7)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 208\n order by generated_number\n\n\n\n), weeks_cross_ticket_first_reply as (\n -- because time is reported in minutes since the beginning of the week, we have to split up time spent on the ticket into calendar weeks\n select \n\n ticket_first_reply_time.*,\n generated_number - 1 as week_number\n\n from ticket_first_reply_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number - 1\n\n), weekly_periods as (\n \n select \n weeks_cross_ticket_first_reply.*, \n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n from weeks_cross_ticket_first_reply\n\n), intercepted_periods as (\n\n select ticket_id,\n week_number,\n weekly_periods.schedule_id,\n ticket_week_start_time,\n ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n -- this chooses the Daylight Savings Time or Standard Time version of the schedule\n and weekly_periods.agent_responded_at >= cast(schedule.valid_from as \n timestamp\n)\n and weekly_periods.agent_responded_at < cast(schedule.valid_until as \n timestamp\n) \n\n)\n\n select ticket_id,\n sum(scheduled_minutes) as first_reply_time_business_minutes\n from intercepted_periods\n group by 1\n)"}], "relation_name": "`dbt-package-testing`.`dbt_zendesk`.`zendesk__ticket_metrics`"}, "model.zendesk.zendesk__ticket_summary": {"raw_sql": "with ticket_metrics as (\n select *\n from {{ ref('zendesk__ticket_metrics') }}\n\n), user_table as (\n select *\n from {{ ref('stg_zendesk__user') }}\n\n), user_sum as (\n select\n cast(1 as {{ dbt_utils.type_int() }}) as summary_helper,\n sum(case when is_active = true\n then 1\n else 0\n end) as user_count,\n sum(case when lower(role) != 'end-user' and is_active = true\n then 1\n else 0\n end) as active_agent_count,\n sum(case when is_active = false\n then 1\n else 0\n end) as deleted_user_count,\n sum(case when lower(role) = 'end-user' and is_active = true\n then 1\n else 0\n end) as end_user_count,\n sum(case when is_suspended = true\n then 1\n else 0\n end) as suspended_user_count\n from user_table\n\n group by 1\n\n), ticket_metric_sum as (\n select \n cast(1 as {{ dbt_utils.type_int() }}) as summary_helper,\n sum(case when lower(status) = 'new'\n then 1\n else 0\n end) as new_ticket_count,\n sum(case when lower(status) = 'hold'\n then 1\n else 0\n end) as on_hold_ticket_count,\n sum(case when lower(status) = 'open'\n then 1\n else 0\n end) as open_ticket_count,\n sum(case when lower(status) = 'pending'\n then 1\n else 0\n end) as pending_ticket_count,\n sum(case when lower(type) = 'problem'\n then 1\n else 0\n end) as problem_ticket_count,\n sum(case when first_assignee_id != last_assignee_id\n then 1\n else 0\n end) as reassigned_ticket_count,\n sum(case when count_reopens > 0\n then 1\n else 0\n end) as reopened_ticket_count,\n\n sum(case when lower(ticket_satisfaction_score) in ('offered', 'good', 'bad')\n then 1\n else 0\n end) as surveyed_satisfaction_ticket_count,\n\n sum(case when assignee_id is null and lower(status) not in ('solved', 'closed')\n then 1\n else 0\n end) as unassigned_unsolved_ticket_count,\n sum(case when total_agent_replies < 0\n then 1\n else 0\n end) as unreplied_ticket_count,\n sum(case when total_agent_replies < 0 and lower(status) not in ('solved', 'closed')\n then 1\n else 0\n end) as unreplied_unsolved_ticket_count,\n sum(case when lower(status) not in ('solved', 'closed')\n then 1\n else 0\n end) as unsolved_ticket_count,\n sum(case when lower(status) in ('solved', 'closed')\n then 1\n else 0\n end) as solved_ticket_count,\n sum(case when lower(status) in ('deleted')\n then 1\n else 0\n end) as deleted_ticket_count,\n sum(case when total_ticket_recoveries > 0\n then 1\n else 0\n end) as recovered_ticket_count,\n sum(case when assignee_stations_count > 0\n then 1\n else 0\n end) as assigned_ticket_count,\n count(count_internal_comments) as total_internal_comments,\n count(count_public_comments) as total_public_comments,\n count(total_comments)\n from ticket_metrics\n \n group by 1\n\n\n), final as (\n select\n user_sum.user_count,\n user_sum.active_agent_count,\n user_sum.deleted_user_count,\n user_sum.end_user_count,\n user_sum.suspended_user_count,\n ticket_metric_sum.new_ticket_count,\n ticket_metric_sum.on_hold_ticket_count,\n ticket_metric_sum.open_ticket_count,\n ticket_metric_sum.pending_ticket_count,\n ticket_metric_sum.solved_ticket_count,\n ticket_metric_sum.problem_ticket_count,\n ticket_metric_sum.assigned_ticket_count,\n ticket_metric_sum.reassigned_ticket_count,\n ticket_metric_sum.reopened_ticket_count,\n ticket_metric_sum.surveyed_satisfaction_ticket_count,\n ticket_metric_sum.unassigned_unsolved_ticket_count,\n ticket_metric_sum.unreplied_ticket_count,\n ticket_metric_sum.unreplied_unsolved_ticket_count,\n ticket_metric_sum.unsolved_ticket_count,\n ticket_metric_sum.recovered_ticket_count,\n ticket_metric_sum.deleted_ticket_count\n from user_sum\n\n left join ticket_metric_sum\n using(summary_helper)\n)\n\nselect *\nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.type_int"], "nodes": ["model.zendesk.zendesk__ticket_metrics", "model.zendesk_source.stg_zendesk__user"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk", "fqn": ["zendesk", "zendesk__ticket_summary"], "unique_id": "model.zendesk.zendesk__ticket_summary", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "zendesk__ticket_summary.sql", "original_file_path": "models/zendesk__ticket_summary.sql", "name": "zendesk__ticket_summary", "alias": "zendesk__ticket_summary", "checksum": {"name": "sha256", "checksum": "9430b74382989b212a68d21d168d54b0faba32a56434d583b7c58d58e64e9d9f"}, "tags": [], "refs": [["zendesk__ticket_metrics"], ["stg_zendesk__user"]], "sources": [], "description": "A single record table containing Zendesk ticket and user summary metrics. These metrics are updated for the current day the model is run.", "columns": {"user_count": {"name": "user_count", "description": "Total count of users created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "active_agent_count": {"name": "active_agent_count", "description": "Total count of agents", "meta": {}, "data_type": null, "quote": null, "tags": []}, "deleted_user_count": {"name": "deleted_user_count", "description": "Total deleted user count", "meta": {}, "data_type": null, "quote": null, "tags": []}, "end_user_count": {"name": "end_user_count", "description": "Total end user count", "meta": {}, "data_type": null, "quote": null, "tags": []}, "suspended_user_count": {"name": "suspended_user_count", "description": "Total count of users in a suspended state", "meta": {}, "data_type": null, "quote": null, "tags": []}, "new_ticket_count": {"name": "new_ticket_count", "description": "Total count of tickets in the \"new\" status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "on_hold_ticket_count": {"name": "on_hold_ticket_count", "description": "Total count of tickets in the \"hold\" status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "open_ticket_count": {"name": "open_ticket_count", "description": "Total count of tickets in the \"open\" status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "pending_ticket_count": {"name": "pending_ticket_count", "description": "Total count of tickets in the \"pending\" status", "meta": {}, "data_type": null, "quote": null, "tags": []}, "solved_ticket_count": {"name": "solved_ticket_count", "description": "Total count of solved tickets", "meta": {}, "data_type": null, "quote": null, "tags": []}, "problem_ticket_count": {"name": "problem_ticket_count", "description": "Total count of tickets labeled as problems", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reassigned_ticket_count": {"name": "reassigned_ticket_count", "description": "Total count of tickets that have been reassigned", "meta": {}, "data_type": null, "quote": null, "tags": []}, "reopened_ticket_count": {"name": "reopened_ticket_count", "description": "Total count of tickets that have been reopened", "meta": {}, "data_type": null, "quote": null, "tags": []}, "surveyed_satisfaction_ticket_count": {"name": "surveyed_satisfaction_ticket_count", "description": "Total count of tickets that have been surveyed for a satisfaction response", "meta": {}, "data_type": null, "quote": null, "tags": []}, "unassigned_unsolved_ticket_count": {"name": "unassigned_unsolved_ticket_count", "description": "Total count of tickets that are unassigned and unsolved", "meta": {}, "data_type": null, "quote": null, "tags": []}, "unreplied_ticket_count": {"name": "unreplied_ticket_count", "description": "Total count of tickets that have not had a reply", "meta": {}, "data_type": null, "quote": null, "tags": []}, "unreplied_unsolved_ticket_count": {"name": "unreplied_unsolved_ticket_count", "description": "Total count of tickets that have not had a reply and are unsolved", "meta": {}, "data_type": null, "quote": null, "tags": []}, "unsolved_ticket_count": {"name": "unsolved_ticket_count", "description": "Total count of unsolved tickets", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assigned_ticket_count": {"name": "assigned_ticket_count", "description": "Total count of assigned tickets", "meta": {}, "data_type": null, "quote": null, "tags": []}, "deleted_ticket_count": {"name": "deleted_ticket_count", "description": "Total count of deleted tickets", "meta": {}, "data_type": null, "quote": null, "tags": []}, "recovered_ticket_count": {"name": "recovered_ticket_count", "description": "Total count of tickets that were deleted then reopened", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "zendesk://models/zendesk.yml", "compiled_path": "target/compiled/zendesk/models/zendesk__ticket_summary.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk", "materialized": "table"}, "created_at": 1644618837.6780019, "compiled_sql": "with ticket_metrics as (\n select *\n from `dbt-package-testing`.`dbt_zendesk`.`zendesk__ticket_metrics`\n\n), user_table as (\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__user`\n\n), user_sum as (\n select\n cast(1 as \n int64\n) as summary_helper,\n sum(case when is_active = true\n then 1\n else 0\n end) as user_count,\n sum(case when lower(role) != 'end-user' and is_active = true\n then 1\n else 0\n end) as active_agent_count,\n sum(case when is_active = false\n then 1\n else 0\n end) as deleted_user_count,\n sum(case when lower(role) = 'end-user' and is_active = true\n then 1\n else 0\n end) as end_user_count,\n sum(case when is_suspended = true\n then 1\n else 0\n end) as suspended_user_count\n from user_table\n\n group by 1\n\n), ticket_metric_sum as (\n select \n cast(1 as \n int64\n) as summary_helper,\n sum(case when lower(status) = 'new'\n then 1\n else 0\n end) as new_ticket_count,\n sum(case when lower(status) = 'hold'\n then 1\n else 0\n end) as on_hold_ticket_count,\n sum(case when lower(status) = 'open'\n then 1\n else 0\n end) as open_ticket_count,\n sum(case when lower(status) = 'pending'\n then 1\n else 0\n end) as pending_ticket_count,\n sum(case when lower(type) = 'problem'\n then 1\n else 0\n end) as problem_ticket_count,\n sum(case when first_assignee_id != last_assignee_id\n then 1\n else 0\n end) as reassigned_ticket_count,\n sum(case when count_reopens > 0\n then 1\n else 0\n end) as reopened_ticket_count,\n\n sum(case when lower(ticket_satisfaction_score) in ('offered', 'good', 'bad')\n then 1\n else 0\n end) as surveyed_satisfaction_ticket_count,\n\n sum(case when assignee_id is null and lower(status) not in ('solved', 'closed')\n then 1\n else 0\n end) as unassigned_unsolved_ticket_count,\n sum(case when total_agent_replies < 0\n then 1\n else 0\n end) as unreplied_ticket_count,\n sum(case when total_agent_replies < 0 and lower(status) not in ('solved', 'closed')\n then 1\n else 0\n end) as unreplied_unsolved_ticket_count,\n sum(case when lower(status) not in ('solved', 'closed')\n then 1\n else 0\n end) as unsolved_ticket_count,\n sum(case when lower(status) in ('solved', 'closed')\n then 1\n else 0\n end) as solved_ticket_count,\n sum(case when lower(status) in ('deleted')\n then 1\n else 0\n end) as deleted_ticket_count,\n sum(case when total_ticket_recoveries > 0\n then 1\n else 0\n end) as recovered_ticket_count,\n sum(case when assignee_stations_count > 0\n then 1\n else 0\n end) as assigned_ticket_count,\n count(count_internal_comments) as total_internal_comments,\n count(count_public_comments) as total_public_comments,\n count(total_comments)\n from ticket_metrics\n \n group by 1\n\n\n), final as (\n select\n user_sum.user_count,\n user_sum.active_agent_count,\n user_sum.deleted_user_count,\n user_sum.end_user_count,\n user_sum.suspended_user_count,\n ticket_metric_sum.new_ticket_count,\n ticket_metric_sum.on_hold_ticket_count,\n ticket_metric_sum.open_ticket_count,\n ticket_metric_sum.pending_ticket_count,\n ticket_metric_sum.solved_ticket_count,\n ticket_metric_sum.problem_ticket_count,\n ticket_metric_sum.assigned_ticket_count,\n ticket_metric_sum.reassigned_ticket_count,\n ticket_metric_sum.reopened_ticket_count,\n ticket_metric_sum.surveyed_satisfaction_ticket_count,\n ticket_metric_sum.unassigned_unsolved_ticket_count,\n ticket_metric_sum.unreplied_ticket_count,\n ticket_metric_sum.unreplied_unsolved_ticket_count,\n ticket_metric_sum.unsolved_ticket_count,\n ticket_metric_sum.recovered_ticket_count,\n ticket_metric_sum.deleted_ticket_count\n from user_sum\n\n left join ticket_metric_sum\n using(summary_helper)\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk`.`zendesk__ticket_summary`"}, "model.zendesk.zendesk__ticket_field_history": {"raw_sql": "{{ \n config(\n materialized='incremental',\n partition_by = {'field': 'date_day', 'data_type': 'date'},\n unique_key='ticket_day_id'\n ) \n}}\n\n{%- set change_data_columns = adapter.get_columns_in_relation(ref('int_zendesk__field_history_scd')) -%}\n\nwith change_data as (\n\n select *\n from {{ ref('int_zendesk__field_history_scd') }}\n \n {% if is_incremental() %}\n where valid_from >= (select max(date_day) from {{ this }})\n\n-- If no issue fields have been updated since the last incremental run, the pivoted_daily_history CTE will return no record/rows.\n-- When this is the case, we need to grab the most recent day's records from the previously built table so that we can persist \n-- those values into the future.\n\n), most_recent_data as ( \n\n select \n *\n from {{ this }}\n where date_day = (select max(date_day) from {{ this }} )\n\n{% endif %}\n\n), calendar as (\n\n select *\n from {{ ref('int_zendesk__field_calendar_spine') }}\n where date_day <= current_date\n {% if is_incremental() %}\n and date_day >= (select max(date_day) from {{ this }})\n {% endif %}\n\n), joined as (\n\n select \n calendar.date_day,\n calendar.ticket_id\n {% if is_incremental() %} \n {% for col in change_data_columns if col.name|lower not in ['ticket_id','valid_from','valid_to','ticket_day_id'] %} \n , coalesce(change_data.{{ col.name }}, most_recent_data.{{ col.name }}) as {{ col.name }}\n {% endfor %}\n \n {% else %}\n {% for col in change_data_columns if col.name|lower not in ['ticket_id','valid_from','valid_to','ticket_day_id'] %} \n , {{ col.name }}\n {% endfor %}\n {% endif %}\n\n from calendar\n left join change_data\n on calendar.ticket_id = change_data.ticket_id\n and calendar.date_day = change_data.valid_from\n \n {% if is_incremental() %}\n left join most_recent_data\n on calendar.ticket_id = most_recent_data.ticket_id\n and calendar.date_day = most_recent_data.date_day\n {% endif %}\n\n), set_values as (\n\n select\n date_day,\n ticket_id\n\n {% for col in change_data_columns if col.name|lower not in ['ticket_id','valid_from','valid_to','ticket_day_id'] %}\n , {{ col.name }}\n -- create a batch/partition once a new value is provided\n , sum( case when {{ col.name }} is null then 0 else 1 end) over ( partition by ticket_id\n order by date_day rows unbounded preceding) as {{ col.name }}_field_partition\n\n {% endfor %}\n\n from joined\n),\n\nfill_values as (\n\n select \n date_day,\n ticket_id\n\n {% for col in change_data_columns if col.name|lower not in ['ticket_id','valid_from','valid_to','ticket_day_id'] %}\n -- grab the value that started this batch/partition\n , first_value( {{ col.name }} ) over (\n partition by ticket_id, {{ col.name }}_field_partition \n order by date_day asc rows between unbounded preceding and current row) as {{ col.name }}\n {% endfor %}\n\n from set_values\n\n), fix_null_values as (\n\n select \n date_day,\n ticket_id\n {% for col in change_data_columns if col.name|lower not in ['ticket_id','valid_from','valid_to','ticket_day_id'] %} \n\n -- we de-nulled the true null values earlier in order to differentiate them from nulls that just needed to be backfilled\n , case when cast( {{ col.name }} as {{ dbt_utils.type_string() }} ) = 'is_null' then null else {{ col.name }} end as {{ col.name }}\n {% endfor %}\n\n from fill_values\n\n), surrogate_key as (\n\n select\n {{ dbt_utils.surrogate_key(['date_day','ticket_id']) }} as ticket_day_id,\n *\n\n from fix_null_values\n)\n\nselect *\nfrom surrogate_key", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt.is_incremental", "macro.dbt_utils.surrogate_key", "macro.dbt_utils.type_string"], "nodes": ["model.zendesk.int_zendesk__field_history_scd", "model.zendesk.int_zendesk__field_history_scd", "model.zendesk.int_zendesk__field_calendar_spine"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk", "database": null, "tags": [], "meta": {}, "materialized": "incremental", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "partition_by": {"field": "date_day", "data_type": "date"}, "unique_key": "ticket_day_id", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk", "fqn": ["zendesk", "zendesk__ticket_field_history"], "unique_id": "model.zendesk.zendesk__ticket_field_history", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "zendesk__ticket_field_history.sql", "original_file_path": "models/zendesk__ticket_field_history.sql", "name": "zendesk__ticket_field_history", "alias": "zendesk__ticket_field_history", "checksum": {"name": "sha256", "checksum": "be59067e9a87c1231424f889849db3f69c1840553678121811f143614b84a3f0"}, "tags": [], "refs": [["int_zendesk__field_history_scd"], ["int_zendesk__field_history_scd"], ["int_zendesk__field_calendar_spine"]], "sources": [], "description": "A daily historical view of the ticket field values defined in the `ticket_field_history_columns` variable and the corresponding updater fields defined in the `ticket_field_history_updater_columns` variable.\n", "columns": {"date_day": {"name": "date_day", "description": "The date of the day associated with the field values.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_id": {"name": "ticket_id", "description": "A ticket's unique identifier, it is automatically assigned when the ticket is created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_day_id": {"name": "ticket_day_id", "description": "The unique key of the table, a surrogate key of date_day and ticket_id.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_id": {"name": "assignee_id", "description": "The assignee id assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "The status of the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "priority": {"name": "priority", "description": "The tickets priority ranking", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "zendesk://models/zendesk.yml", "compiled_path": "target/compiled/zendesk/models/zendesk__ticket_field_history.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk", "materialized": "incremental", "partition_by": {"field": "date_day", "data_type": "date"}, "unique_key": "ticket_day_id"}, "created_at": 1644618837.622443, "compiled_sql": "with change_data as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__field_history_scd`\n \n \n where valid_from >= (select max(date_day) from `dbt-package-testing`.`dbt_zendesk`.`zendesk__ticket_field_history`)\n\n-- If no issue fields have been updated since the last incremental run, the pivoted_daily_history CTE will return no record/rows.\n-- When this is the case, we need to grab the most recent day's records from the previously built table so that we can persist \n-- those values into the future.\n\n), most_recent_data as ( \n\n select \n *\n from `dbt-package-testing`.`dbt_zendesk`.`zendesk__ticket_field_history`\n where date_day = (select max(date_day) from `dbt-package-testing`.`dbt_zendesk`.`zendesk__ticket_field_history` )\n\n\n\n), calendar as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__field_calendar_spine`\n where date_day <= current_date\n \n and date_day >= (select max(date_day) from `dbt-package-testing`.`dbt_zendesk`.`zendesk__ticket_field_history`)\n \n\n), joined as (\n\n select \n calendar.date_day,\n calendar.ticket_id\n \n \n , coalesce(change_data.status, most_recent_data.status) as status\n \n , coalesce(change_data.priority, most_recent_data.priority) as priority\n \n , coalesce(change_data.assignee_id, most_recent_data.assignee_id) as assignee_id\n \n \n \n\n from calendar\n left join change_data\n on calendar.ticket_id = change_data.ticket_id\n and calendar.date_day = change_data.valid_from\n \n \n left join most_recent_data\n on calendar.ticket_id = most_recent_data.ticket_id\n and calendar.date_day = most_recent_data.date_day\n \n\n), set_values as (\n\n select\n date_day,\n ticket_id\n\n \n , status\n -- create a batch/partition once a new value is provided\n , sum( case when status is null then 0 else 1 end) over ( partition by ticket_id\n order by date_day rows unbounded preceding) as status_field_partition\n\n \n , priority\n -- create a batch/partition once a new value is provided\n , sum( case when priority is null then 0 else 1 end) over ( partition by ticket_id\n order by date_day rows unbounded preceding) as priority_field_partition\n\n \n , assignee_id\n -- create a batch/partition once a new value is provided\n , sum( case when assignee_id is null then 0 else 1 end) over ( partition by ticket_id\n order by date_day rows unbounded preceding) as assignee_id_field_partition\n\n \n\n from joined\n),\n\nfill_values as (\n\n select \n date_day,\n ticket_id\n\n \n -- grab the value that started this batch/partition\n , first_value( status ) over (\n partition by ticket_id, status_field_partition \n order by date_day asc rows between unbounded preceding and current row) as status\n \n -- grab the value that started this batch/partition\n , first_value( priority ) over (\n partition by ticket_id, priority_field_partition \n order by date_day asc rows between unbounded preceding and current row) as priority\n \n -- grab the value that started this batch/partition\n , first_value( assignee_id ) over (\n partition by ticket_id, assignee_id_field_partition \n order by date_day asc rows between unbounded preceding and current row) as assignee_id\n \n\n from set_values\n\n), fix_null_values as (\n\n select \n date_day,\n ticket_id\n \n\n -- we de-nulled the true null values earlier in order to differentiate them from nulls that just needed to be backfilled\n , case when cast( status as \n string\n ) = 'is_null' then null else status end as status\n \n\n -- we de-nulled the true null values earlier in order to differentiate them from nulls that just needed to be backfilled\n , case when cast( priority as \n string\n ) = 'is_null' then null else priority end as priority\n \n\n -- we de-nulled the true null values earlier in order to differentiate them from nulls that just needed to be backfilled\n , case when cast( assignee_id as \n string\n ) = 'is_null' then null else assignee_id end as assignee_id\n \n\n from fill_values\n\n), surrogate_key as (\n\n select\n to_hex(md5(cast(coalesce(cast(date_day as \n string\n), '') || '-' || coalesce(cast(ticket_id as \n string\n), '') as \n string\n))) as ticket_day_id,\n *\n\n from fix_null_values\n)\n\nselect *\nfrom surrogate_key", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk`.`zendesk__ticket_field_history`"}, "model.zendesk.zendesk__sla_policies": {"raw_sql": "--final step where we union together all of the reply time, agent work time, and requester wait time sla's\n\nwith reply_time_sla as (\n\n select * \n from {{ ref('int_zendesk__reply_time_combined') }}\n\n), agent_work_calendar_sla as (\n\n select *\n from {{ ref('int_zendesk__agent_work_time_calendar_hours') }}\n\n), requester_wait_calendar_sla as (\n\n select *\n from {{ ref('int_zendesk__requester_wait_time_calendar_hours') }}\n\n{% if var('using_schedules', True) %}\n\n), agent_work_business_sla as (\n\n select *\n from {{ ref('int_zendesk__agent_work_time_business_hours') }}\n\n), requester_wait_business_sla as (\n select *\n from {{ ref('int_zendesk__requester_wait_time_business_hours') }}\n\n{% endif %}\n\n), all_slas_unioned as (\n select\n ticket_id,\n sla_policy_name,\n metric,\n sla_applied_at,\n target,\n in_business_hours,\n sla_breach_at,\n sla_elapsed_time,\n is_sla_breached\n from reply_time_sla\n\nunion all\n\n select\n ticket_id,\n sla_policy_name,\n 'agent_work_time' as metric,\n sla_applied_at,\n target,\n false as in_business_hours,\n max(sla_breach_at) as sla_breach_at,\n sum(running_total_calendar_minutes) as sla_elapsed_time,\n {{ fivetran_utils.max_bool(\"is_breached_during_schedule\") }}\n from agent_work_calendar_sla\n\n group by 1, 2, 3, 4, 5, 6\n\nunion all\n\n select\n ticket_id,\n sla_policy_name,\n 'requester_wait_time' as metric,\n sla_applied_at,\n target,\n false as in_business_hours,\n max(sla_breach_at) as sla_breach_at,\n sum(running_total_calendar_minutes) as sla_elapsed_time,\n {{ fivetran_utils.max_bool(\"is_breached_during_schedule\") }}\n from requester_wait_calendar_sla\n\n group by 1, 2, 3, 4, 5, 6\n\n\n{% if var('using_schedules', True) %}\n\nunion all \n\n select \n ticket_id,\n sla_policy_name,\n 'agent_work_time' as metric,\n sla_applied_at,\n target,\n true as in_business_hours,\n max(sla_breach_at) as sla_breach_at,\n sum(running_total_scheduled_minutes) as sla_elapsed_time,\n {{ fivetran_utils.max_bool(\"is_breached_during_schedule\") }}\n from agent_work_business_sla\n \n group by 1, 2, 3, 4, 5, 6\n\nunion all \n\n select \n ticket_id,\n sla_policy_name,\n 'requester_wait_time' as metric,\n sla_applied_at,\n target,\n true as in_business_hours,\n max(sla_breach_at) as sla_breach_at,\n sum(running_total_scheduled_minutes) as sla_elapsed_time,\n {{ fivetran_utils.max_bool(\"is_breached_during_schedule\") }}\n \n from requester_wait_business_sla\n \n group by 1, 2, 3, 4, 5, 6\n\n{% endif %}\n\n)\n\nselect \n {{ dbt_utils.surrogate_key(['ticket_id', 'metric', 'sla_applied_at']) }} as sla_event_id,\n ticket_id,\n sla_policy_name,\n metric,\n sla_applied_at,\n target,\n in_business_hours,\n sla_breach_at,\n case when sla_elapsed_time is null\n then {{ dbt_utils.datediff(\"sla_applied_at\", dbt_utils.current_timestamp(), 'minute') }} --This will create an entry for active sla's\n else sla_elapsed_time\n end as sla_elapsed_time,\n sla_breach_at > current_timestamp as is_active_sla,\n case when (sla_breach_at > {{ dbt_utils.current_timestamp() }})\n then null\n else is_sla_breached\n end as is_sla_breach\nfrom all_slas_unioned", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.fivetran_utils.max_bool", "macro.dbt_utils.surrogate_key", "macro.dbt_utils.current_timestamp", "macro.dbt_utils.datediff"], "nodes": ["model.zendesk.int_zendesk__reply_time_combined", "model.zendesk.int_zendesk__agent_work_time_calendar_hours", "model.zendesk.int_zendesk__requester_wait_time_calendar_hours", "model.zendesk.int_zendesk__agent_work_time_business_hours", "model.zendesk.int_zendesk__requester_wait_time_business_hours"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk", "fqn": ["zendesk", "zendesk__sla_policies"], "unique_id": "model.zendesk.zendesk__sla_policies", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "zendesk__sla_policies.sql", "original_file_path": "models/zendesk__sla_policies.sql", "name": "zendesk__sla_policies", "alias": "zendesk__sla_policies", "checksum": {"name": "sha256", "checksum": "cea71b796170de5f20d9a0da02fa2384c5b1e8b91e8c8526d196f8f7e7d076a4"}, "tags": [], "refs": [["int_zendesk__reply_time_combined"], ["int_zendesk__agent_work_time_calendar_hours"], ["int_zendesk__requester_wait_time_calendar_hours"], ["int_zendesk__agent_work_time_business_hours"], ["int_zendesk__requester_wait_time_business_hours"]], "sources": [], "description": "Each record represents an SLA policy event and additional sla breach and achievement metrics. Calendar and business hour SLA breaches are supported.", "columns": {"sla_event_id": {"name": "sla_event_id", "description": "A surrogate key generated from the combination of ticket_id, metric, and sla_applied_at fields", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_id": {"name": "ticket_id", "description": "A ticket's unique identifier, it is automatically assigned when the ticket is created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "sla_policy_name": {"name": "sla_policy_name", "description": "The name of the SLA policy associated with the SLA metric", "meta": {}, "data_type": null, "quote": null, "tags": []}, "metric": {"name": "metric", "description": "The SLA metric, either agent_work_time, requester_wait_time, first_reply_time or next_reply_time", "meta": {}, "data_type": null, "quote": null, "tags": []}, "sla_applied_at": {"name": "sla_applied_at", "description": "When the SLA target was triggered. This is the starting time", "meta": {}, "data_type": null, "quote": null, "tags": []}, "target": {"name": "target", "description": "The SLA target, in minutes", "meta": {}, "data_type": null, "quote": null, "tags": []}, "in_business_hours": {"name": "in_business_hours", "description": "Boolean field indicating if the SLA target is in business hours (true) or calendar hours (false)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "sla_breach_at": {"name": "sla_breach_at", "description": "The time or expected time of the SLA breach event", "meta": {}, "data_type": null, "quote": null, "tags": []}, "sla_elapsed_time": {"name": "sla_elapsed_time", "description": "The total elapsed time to achieve the SLA metric whether breached or achieved", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_active_sla": {"name": "is_active_sla", "description": "Boolean field indicating that the SLA event is currently active and not breached (true) or past (false)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_sla_breach": {"name": "is_sla_breach", "description": "Boolean field indicating if the SLA has been breached (true) or was achieved (false)", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "zendesk://models/zendesk.yml", "compiled_path": "target/compiled/zendesk/models/zendesk__sla_policies.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk", "materialized": "table"}, "created_at": 1644618837.6196532, "compiled_sql": "--final step where we union together all of the reply time, agent work time, and requester wait time sla's\n\nwith reply_time_sla as (\n\n select * \n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__reply_time_combined`\n\n), agent_work_calendar_sla as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__agent_work_time_calendar_hours`\n\n), requester_wait_calendar_sla as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__requester_wait_time_calendar_hours`\n\n\n\n), agent_work_business_sla as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__agent_work_time_business_hours`\n\n), requester_wait_business_sla as (\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__requester_wait_time_business_hours`\n\n\n\n), all_slas_unioned as (\n select\n ticket_id,\n sla_policy_name,\n metric,\n sla_applied_at,\n target,\n in_business_hours,\n sla_breach_at,\n sla_elapsed_time,\n is_sla_breached\n from reply_time_sla\n\nunion all\n\n select\n ticket_id,\n sla_policy_name,\n 'agent_work_time' as metric,\n sla_applied_at,\n target,\n false as in_business_hours,\n max(sla_breach_at) as sla_breach_at,\n sum(running_total_calendar_minutes) as sla_elapsed_time,\n \n\n max( is_breached_during_schedule )\n\n\n from agent_work_calendar_sla\n\n group by 1, 2, 3, 4, 5, 6\n\nunion all\n\n select\n ticket_id,\n sla_policy_name,\n 'requester_wait_time' as metric,\n sla_applied_at,\n target,\n false as in_business_hours,\n max(sla_breach_at) as sla_breach_at,\n sum(running_total_calendar_minutes) as sla_elapsed_time,\n \n\n max( is_breached_during_schedule )\n\n\n from requester_wait_calendar_sla\n\n group by 1, 2, 3, 4, 5, 6\n\n\n\n\nunion all \n\n select \n ticket_id,\n sla_policy_name,\n 'agent_work_time' as metric,\n sla_applied_at,\n target,\n true as in_business_hours,\n max(sla_breach_at) as sla_breach_at,\n sum(running_total_scheduled_minutes) as sla_elapsed_time,\n \n\n max( is_breached_during_schedule )\n\n\n from agent_work_business_sla\n \n group by 1, 2, 3, 4, 5, 6\n\nunion all \n\n select \n ticket_id,\n sla_policy_name,\n 'requester_wait_time' as metric,\n sla_applied_at,\n target,\n true as in_business_hours,\n max(sla_breach_at) as sla_breach_at,\n sum(running_total_scheduled_minutes) as sla_elapsed_time,\n \n\n max( is_breached_during_schedule )\n\n\n \n from requester_wait_business_sla\n \n group by 1, 2, 3, 4, 5, 6\n\n\n\n)\n\nselect \n to_hex(md5(cast(coalesce(cast(ticket_id as \n string\n), '') || '-' || coalesce(cast(metric as \n string\n), '') || '-' || coalesce(cast(sla_applied_at as \n string\n), '') as \n string\n))) as sla_event_id,\n ticket_id,\n sla_policy_name,\n metric,\n sla_applied_at,\n target,\n in_business_hours,\n sla_breach_at,\n case when sla_elapsed_time is null\n then \n\n datetime_diff(\n cast(\n current_timestamp\n as datetime),\n cast(sla_applied_at as datetime),\n minute\n )\n\n --This will create an entry for active sla's\n else sla_elapsed_time\n end as sla_elapsed_time,\n sla_breach_at > current_timestamp as is_active_sla,\n case when (sla_breach_at > \n current_timestamp\n)\n then null\n else is_sla_breached\n end as is_sla_breach\nfrom all_slas_unioned", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk`.`zendesk__sla_policies`"}, "model.zendesk.zendesk__ticket_backlog": {"raw_sql": "--This model will only run if 'status' is included within the `ticket_field_history_columns` variable.\n{{ config(enabled = 'status' in var('ticket_field_history_columns')) }}\n\nwith ticket_field_history as (\n select *\n from {{ ref('zendesk__ticket_field_history') }}\n\n), tickets as (\n select *\n from {{ ref('stg_zendesk__ticket') }}\n\n), group_names as (\n select *\n from {{ ref('stg_zendesk__group') }}\n\n), users as (\n select *\n from {{ ref('stg_zendesk__user') }}\n\n), brands as (\n select *\n from {{ ref('stg_zendesk__brand') }}\n\n--The below model is excluded if the user does not include ticket_form_id in the variable as a low percentage of accounts use ticket forms.\n{% if 'ticket_form_id' in var('ticket_field_history_columns') %}\n), ticket_forms as (\n select *\n from {{ ref('int_zendesk__latest_ticket_form') }}\n{% endif %}\n\n), organizations as (\n select *\n from {{ ref('stg_zendesk__organization') }}\n\n), backlog as (\n select\n ticket_field_history.date_day\n ,ticket_field_history.ticket_id\n ,ticket_field_history.status\n ,tickets.created_channel\n {% for col in var('ticket_field_history_columns') if col != 'status' %} --Looking at all history fields the users passed through in their dbt_project.yml file\n {% if col in ['assignee_id'] %} --Standard ID field where the name can easily be joined from stg model.\n ,assignee.name as assignee_name\n\n {% elif col in ['requester_id'] %} --Standard ID field where the name can easily be joined from stg model.\n ,requester.name as requester_name\n\n {% elif col in ['ticket_form_id'] %} --Standard ID field where the name can easily be joined from stg model.\n ,ticket_forms.name as ticket_form_name\n\n {% elif col in ['organization_id'] %} --Standard ID field where the name can easily be joined from stg model.\n ,organizations.name as organization_name\n\n {% elif col in ['brand_id'] %} --Standard ID field where the name can easily be joined from stg model.\n ,brands.name as brand_name\n\n {% elif col in ['group_id'] %} --Standard ID field where the name can easily be joined from stg model.\n ,group_names.name as group_name\n\n {% elif col in ['locale_id'] %} --Standard ID field where the name can easily be joined from stg model.\n ,assignee.locale as local_name\n\n {% else %} --All other fields are not ID's and can simply be included in the query.\n ,ticket_field_history.{{ col }}\n {% endif %}\n {% endfor %}\n\n from ticket_field_history\n\n left join tickets\n on tickets.ticket_id = ticket_field_history.ticket_id\n\n {% if 'ticket_form_id' in var('ticket_field_history_columns') %} --Join not needed if field is not located in variable, otherwise it is included.\n left join ticket_forms\n on ticket_forms.ticket_form_id = cast(ticket_field_history.ticket_form_id as {{ dbt_utils.type_bigint() }})\n {% endif %}\n\n {% if 'group_id' in var('ticket_field_history_columns') %}--Join not needed if field is not located in variable, otherwise it is included.\n left join group_names\n on group_names.group_id = cast(ticket_field_history.group_id as {{ dbt_utils.type_bigint() }})\n {% endif %}\n\n {% if 'assignee_id' in var('ticket_field_history_columns') or 'requester_id' in var('ticket_field_history_columns') or 'locale_id' in var('ticket_field_history_columns')%} --Join not needed if fields is not located in variable, otherwise it is included.\n left join users as assignee\n on assignee.user_id = cast(ticket_field_history.assignee_id as {{ dbt_utils.type_bigint() }})\n {% endif %}\n\n {% if 'requester_id' in var('ticket_field_history_columns') %} --Join not needed if field is not located in variable, otherwise it is included.\n left join users as requester\n on requester.user_id = cast(ticket_field_history.requester_id as {{ dbt_utils.type_bigint() }})\n {% endif %}\n\n {% if 'brand_id' in var('ticket_field_history_columns') %} --Join not needed if field is not located in variable, otherwise it is included.\n left join brands\n on brands.brand_id = cast(ticket_field_history.brand_id as {{ dbt_utils.type_bigint() }})\n {% endif %}\n\n {% if 'organization_id' in var('ticket_field_history_columns') %} --Join not needed if field is not located in variable, otherwise it is included.\n left join organizations\n on organizations.organization_id = cast(ticket_field_history.organization_id as {{ dbt_utils.type_bigint() }})\n {% endif %}\n\n where ticket_field_history.status not in ('closed', 'solved', 'deleted')\n)\n\nselect *\nfrom backlog", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.type_bigint"], "nodes": ["model.zendesk.zendesk__ticket_field_history", "model.zendesk_source.stg_zendesk__ticket", "model.zendesk_source.stg_zendesk__group", "model.zendesk_source.stg_zendesk__user", "model.zendesk_source.stg_zendesk__brand", "model.zendesk_source.stg_zendesk__organization"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk", "fqn": ["zendesk", "zendesk__ticket_backlog"], "unique_id": "model.zendesk.zendesk__ticket_backlog", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "zendesk__ticket_backlog.sql", "original_file_path": "models/zendesk__ticket_backlog.sql", "name": "zendesk__ticket_backlog", "alias": "zendesk__ticket_backlog", "checksum": {"name": "sha256", "checksum": "60d905c450664e94cb2771d3f9d3ab0b00d583d838ec37ac4c1ebea5f84ec50d"}, "tags": [], "refs": [["zendesk__ticket_field_history"], ["stg_zendesk__ticket"], ["stg_zendesk__group"], ["stg_zendesk__user"], ["stg_zendesk__brand"], ["stg_zendesk__organization"]], "sources": [], "description": "A daily historical view of the ticket field values defined in the `ticket_field_history_columns` variable for all backlog tickets. Backlog tickets being defined as any ticket not a 'closed', 'deleted', or 'solved' status.\n", "columns": {"date_day": {"name": "date_day", "description": "The date of the day associated with the field values", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_id": {"name": "ticket_id", "description": "A ticket's unique identifier, it is automatically assigned when the ticket is created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "The status of the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_channel": {"name": "created_channel", "description": "The channel where the ticket was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_name": {"name": "assignee_name", "description": "The assignee name assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "priority": {"name": "priority", "description": "The tickets priority ranking", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "zendesk://models/zendesk.yml", "compiled_path": "target/compiled/zendesk/models/zendesk__ticket_backlog.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk", "materialized": "table", "enabled": true}, "created_at": 1644618837.680474, "compiled_sql": "--This model will only run if 'status' is included within the `ticket_field_history_columns` variable.\n\n\nwith ticket_field_history as (\n select *\n from `dbt-package-testing`.`dbt_zendesk`.`zendesk__ticket_field_history`\n\n), tickets as (\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket`\n\n), group_names as (\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__group`\n\n), users as (\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__user`\n\n), brands as (\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__brand`\n\n--The below model is excluded if the user does not include ticket_form_id in the variable as a low percentage of accounts use ticket forms.\n\n\n), organizations as (\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__organization`\n\n), backlog as (\n select\n ticket_field_history.date_day\n ,ticket_field_history.ticket_id\n ,ticket_field_history.status\n ,tickets.created_channel\n --Looking at all history fields the users passed through in their dbt_project.yml file\n --Standard ID field where the name can easily be joined from stg model.\n ,assignee.name as assignee_name\n\n \n --Looking at all history fields the users passed through in their dbt_project.yml file\n --All other fields are not ID's and can simply be included in the query.\n ,ticket_field_history.priority\n \n \n\n from ticket_field_history\n\n left join tickets\n on tickets.ticket_id = ticket_field_history.ticket_id\n\n \n\n \n\n --Join not needed if fields is not located in variable, otherwise it is included.\n left join users as assignee\n on assignee.user_id = cast(ticket_field_history.assignee_id as \n int64\n)\n \n\n \n\n \n\n \n\n where ticket_field_history.status not in ('closed', 'solved', 'deleted')\n)\n\nselect *\nfrom backlog", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk`.`zendesk__ticket_backlog`"}, "model.zendesk.int_zendesk__sla_policy_applied": {"raw_sql": "-- step 1, figure out when sla was applied to tickets\n\n-- more on SLA policies here: https://support.zendesk.com/hc/en-us/articles/204770038-Defining-and-using-SLA-policies-Professional-and-Enterprise-\n-- SLA policies are calculated for next_reply_time, first_reply_time, agent_work_time, requester_wait_time. If you're company uses other SLA metrics, and would like this\n-- package to support those, please reach out to the Fivetran team on Slack.\n\nwith ticket_field_history as (\n\n select *\n from {{ ref('int_zendesk__updates') }}\n\n), sla_policy_name as (\n\n select \n *\n from {{ ref('int_zendesk__updates') }}\n where field_name = ('sla_policy')\n\n), ticket as (\n\n select *\n from {{ ref('int_zendesk__ticket_aggregates') }}\n\n), sla_policy_applied as (\n\n select\n ticket_field_history.ticket_id,\n ticket.created_at as ticket_created_at,\n ticket.status as ticket_current_status,\n ticket_field_history.field_name as metric,\n case when ticket_field_history.field_name = 'first_reply_time' then row_number() over (partition by ticket_field_history.ticket_id, ticket_field_history.field_name order by ticket_field_history.valid_starting_at desc) else 1 end as latest_sla,\n case when ticket_field_history.field_name = 'first_reply_time' then ticket.created_at else ticket_field_history.valid_starting_at end as sla_applied_at,\n cast({{ fivetran_utils.json_extract('ticket_field_history.value', 'minutes') }} as {{ dbt_utils.type_int() }} ) as target,\n {{ fivetran_utils.json_extract('ticket_field_history.value', 'in_business_hours') }} = 'true' as in_business_hours\n from ticket_field_history\n join ticket\n on ticket.ticket_id = ticket_field_history.ticket_id\n where ticket_field_history.value is not null\n and ticket_field_history.field_name in ('next_reply_time', 'first_reply_time', 'agent_work_time', 'requester_wait_time')\n\n), final as (\n select\n sla_policy_applied.*,\n sla_policy_name.value as sla_policy_name\n from sla_policy_applied\n left join sla_policy_name\n on sla_policy_name.ticket_id = sla_policy_applied.ticket_id\n and sla_policy_applied.sla_applied_at >= {{ fivetran_utils.timestamp_add(datepart='second', interval='-5', from_timestamp='sla_policy_name.valid_starting_at') }}\n and sla_policy_applied.sla_applied_at < coalesce(sla_policy_name.valid_ending_at, {{ dbt_utils.current_timestamp() }}) \n where sla_policy_applied.latest_sla = 1\n)\n\nselect *\nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.fivetran_utils.json_extract", "macro.dbt_utils.type_int", "macro.fivetran_utils.timestamp_add", "macro.dbt_utils.current_timestamp"], "nodes": ["model.zendesk.int_zendesk__updates", "model.zendesk.int_zendesk__updates", "model.zendesk.int_zendesk__ticket_aggregates"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_intermediate", "fqn": ["zendesk", "sla_policy", "int_zendesk__sla_policy_applied"], "unique_id": "model.zendesk.int_zendesk__sla_policy_applied", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "sla_policy/int_zendesk__sla_policy_applied.sql", "original_file_path": "models/sla_policy/int_zendesk__sla_policy_applied.sql", "name": "int_zendesk__sla_policy_applied", "alias": "int_zendesk__sla_policy_applied", "checksum": {"name": "sha256", "checksum": "f23686cb533d551562057c3d7a9d924072157ee397096bce484d1705acf6162e"}, "tags": [], "refs": [["int_zendesk__updates"], ["int_zendesk__updates"], ["int_zendesk__ticket_aggregates"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/sla_policy/int_zendesk__sla_policy_applied.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk_intermediate", "materialized": "table"}, "created_at": 1644618836.721827, "compiled_sql": "-- step 1, figure out when sla was applied to tickets\n\n-- more on SLA policies here: https://support.zendesk.com/hc/en-us/articles/204770038-Defining-and-using-SLA-policies-Professional-and-Enterprise-\n-- SLA policies are calculated for next_reply_time, first_reply_time, agent_work_time, requester_wait_time. If you're company uses other SLA metrics, and would like this\n-- package to support those, please reach out to the Fivetran team on Slack.\n\nwith ticket_field_history as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__updates`\n\n), sla_policy_name as (\n\n select \n *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__updates`\n where field_name = ('sla_policy')\n\n), ticket as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_aggregates`\n\n), sla_policy_applied as (\n\n select\n ticket_field_history.ticket_id,\n ticket.created_at as ticket_created_at,\n ticket.status as ticket_current_status,\n ticket_field_history.field_name as metric,\n case when ticket_field_history.field_name = 'first_reply_time' then row_number() over (partition by ticket_field_history.ticket_id, ticket_field_history.field_name order by ticket_field_history.valid_starting_at desc) else 1 end as latest_sla,\n case when ticket_field_history.field_name = 'first_reply_time' then ticket.created_at else ticket_field_history.valid_starting_at end as sla_applied_at,\n cast(\n\n json_extract_scalar(ticket_field_history.value, '$.minutes' )\n\n as \n int64\n ) as target,\n \n\n json_extract_scalar(ticket_field_history.value, '$.in_business_hours' )\n\n = 'true' as in_business_hours\n from ticket_field_history\n join ticket\n on ticket.ticket_id = ticket_field_history.ticket_id\n where ticket_field_history.value is not null\n and ticket_field_history.field_name in ('next_reply_time', 'first_reply_time', 'agent_work_time', 'requester_wait_time')\n\n), final as (\n select\n sla_policy_applied.*,\n sla_policy_name.value as sla_policy_name\n from sla_policy_applied\n left join sla_policy_name\n on sla_policy_name.ticket_id = sla_policy_applied.ticket_id\n and sla_policy_applied.sla_applied_at >= \n\n timestamp_add(sla_policy_name.valid_starting_at, interval -5 second)\n\n\n and sla_policy_applied.sla_applied_at < coalesce(sla_policy_name.valid_ending_at, \n current_timestamp\n) \n where sla_policy_applied.latest_sla = 1\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__sla_policy_applied`"}, "model.zendesk.int_zendesk__agent_work_time_business_hours": {"raw_sql": "{{ config(enabled=var('using_schedules', True)) }}\n\n-- AGENT WORK TIME\n-- This is complicated, as SLAs minutes are only counted while the ticket is in 'new' or 'open' status.\n\n-- Additionally, for business hours, only 'new' or 'open' status hours are counted if they are also during business hours\nwith agent_work_time_filtered_statuses as (\n\n select *\n from {{ ref('int_zendesk__agent_work_time_filtered_statuses') }}\n where in_business_hours\n\n), schedule as (\n\n select * \n from {{ ref('int_zendesk__schedule_spine') }}\n\n), ticket_schedules as (\n\n select * \n from {{ ref('int_zendesk__ticket_schedules') }}\n \n-- cross schedules with work time\n), ticket_status_crossed_with_schedule as (\n \n select\n agent_work_time_filtered_statuses.ticket_id,\n agent_work_time_filtered_statuses.sla_applied_at,\n agent_work_time_filtered_statuses.target, \n agent_work_time_filtered_statuses.sla_policy_name, \n ticket_schedules.schedule_id,\n\n -- take the intersection of the intervals in which the status and the schedule were both active, for calculating the business minutes spent working on the ticket\n greatest(valid_starting_at, schedule_created_at) as valid_starting_at,\n least(valid_ending_at, schedule_invalidated_at) as valid_ending_at,\n\n -- bringing the following in the determine which schedule (Daylight Savings vs Standard time) to use\n valid_starting_at as status_valid_starting_at,\n valid_ending_at as status_valid_ending_at\n\n from agent_work_time_filtered_statuses\n left join ticket_schedules\n on agent_work_time_filtered_statuses.ticket_id = ticket_schedules.ticket_id\n where {{ fivetran_utils.timestamp_diff(\n 'greatest(valid_starting_at, schedule_created_at)', \n 'least(valid_ending_at, schedule_invalidated_at)', \n 'second') }} > 0\n\n), ticket_full_solved_time as (\n\n select \n ticket_status_crossed_with_schedule.*,\n ({{ fivetran_utils.timestamp_diff(\n \"\" ~ dbt_utils.date_trunc(\n 'week',\n 'ticket_status_crossed_with_schedule.valid_starting_at') ~ \"\", \n 'ticket_status_crossed_with_schedule.valid_starting_at', \n 'second') }} /60\n ) as valid_starting_at_in_minutes_from_week,\n ({{ fivetran_utils.timestamp_diff(\n 'ticket_status_crossed_with_schedule.valid_starting_at', \n 'ticket_status_crossed_with_schedule.valid_ending_at',\n 'second') }} /60\n ) as raw_delta_in_minutes\n from ticket_status_crossed_with_schedule\n {{ dbt_utils.group_by(n=10) }}\n\n), weeks as (\n\n {{ dbt_utils.generate_series(208) }}\n\n), weeks_cross_ticket_full_solved_time as (\n -- because time is reported in minutes since the beginning of the week, we have to split up time spent on the ticket into calendar weeks\n select \n ticket_full_solved_time.*,\n generated_number - 1 as week_number\n from ticket_full_solved_time\n cross join weeks\n where floor((valid_starting_at_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number -1\n\n), weekly_period_agent_work_time as (\n\n select \n\n ticket_id,\n sla_applied_at,\n valid_starting_at,\n valid_ending_at,\n status_valid_starting_at,\n status_valid_ending_at,\n target,\n sla_policy_name,\n valid_starting_at_in_minutes_from_week,\n raw_delta_in_minutes,\n week_number,\n schedule_id,\n greatest(0, valid_starting_at_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time_minute,\n least(valid_starting_at_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time_minute\n \n from weeks_cross_ticket_full_solved_time\n\n), intercepted_periods_agent as (\n \n select \n weekly_period_agent_work_time.ticket_id,\n weekly_period_agent_work_time.sla_applied_at,\n weekly_period_agent_work_time.target,\n weekly_period_agent_work_time.sla_policy_name,\n weekly_period_agent_work_time.valid_starting_at,\n weekly_period_agent_work_time.valid_ending_at,\n weekly_period_agent_work_time.week_number,\n weekly_period_agent_work_time.ticket_week_start_time_minute,\n weekly_period_agent_work_time.ticket_week_end_time_minute,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time_minute, schedule.end_time_utc) - greatest(weekly_period_agent_work_time.ticket_week_start_time_minute, schedule.start_time_utc) as scheduled_minutes\n from weekly_period_agent_work_time\n join schedule on ticket_week_start_time_minute <= schedule.end_time_utc \n and ticket_week_end_time_minute >= schedule.start_time_utc\n and weekly_period_agent_work_time.schedule_id = schedule.schedule_id\n -- this chooses the Daylight Savings Time or Standard Time version of the schedule\n and weekly_period_agent_work_time.status_valid_ending_at >= cast(schedule.valid_from as {{ dbt_utils.type_timestamp() }})\n and weekly_period_agent_work_time.status_valid_starting_at < cast(schedule.valid_until as {{ dbt_utils.type_timestamp() }}) \n \n), intercepted_periods_with_running_total as (\n \n select \n *,\n sum(scheduled_minutes) over \n (partition by ticket_id, sla_applied_at \n order by valid_starting_at, week_number, schedule_end_time\n rows between unbounded preceding and current row)\n as running_total_scheduled_minutes\n\n from intercepted_periods_agent\n\n\n), intercepted_periods_agent_with_breach_flag as (\n select \n intercepted_periods_with_running_total.*,\n target - running_total_scheduled_minutes as remaining_target_minutes,\n lag(target - running_total_scheduled_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at, week_number, schedule_end_time) as lag_check,\n case when (target - running_total_scheduled_minutes) = 0 then true\n when (target - running_total_scheduled_minutes) < 0 \n and \n (lag(target - running_total_scheduled_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at, week_number, schedule_end_time) > 0 \n or \n lag(target - running_total_scheduled_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at, week_number, schedule_end_time) is null) \n then true else false end as is_breached_during_schedule\n \n from intercepted_periods_with_running_total\n\n), intercepted_periods_agent_filtered as (\n\n select\n *,\n (remaining_target_minutes + scheduled_minutes) as breach_minutes,\n greatest(ticket_week_start_time_minute, schedule_start_time) + (remaining_target_minutes + scheduled_minutes) as breach_minutes_from_week\n from intercepted_periods_agent_with_breach_flag\n \n), agent_work_business_breach as (\n \n select \n *,\n {{ fivetran_utils.timestamp_add(\n \"minute\",\n \"cast(((7*24*60) * week_number) + breach_minutes_from_week as \" ~ dbt_utils.type_int() ~ \" )\",\n \"\" ~ dbt_utils.date_trunc('week', 'valid_starting_at') ~ \"\",\n ) }} as sla_breach_at\n from intercepted_periods_agent_filtered\n\n)\n\nselect * \nfrom agent_work_business_breach", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.fivetran_utils.timestamp_diff", "macro.dbt_utils.date_trunc", "macro.dbt_utils.group_by", "macro.dbt_utils.generate_series", "macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_int", "macro.fivetran_utils.timestamp_add"], "nodes": ["model.zendesk.int_zendesk__agent_work_time_filtered_statuses", "model.zendesk.int_zendesk__schedule_spine", "model.zendesk.int_zendesk__ticket_schedules"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_intermediate", "fqn": ["zendesk", "sla_policy", "agent_work_time", "int_zendesk__agent_work_time_business_hours"], "unique_id": "model.zendesk.int_zendesk__agent_work_time_business_hours", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "sla_policy/agent_work_time/int_zendesk__agent_work_time_business_hours.sql", "original_file_path": "models/sla_policy/agent_work_time/int_zendesk__agent_work_time_business_hours.sql", "name": "int_zendesk__agent_work_time_business_hours", "alias": "int_zendesk__agent_work_time_business_hours", "checksum": {"name": "sha256", "checksum": "41d7620cd91487666d0d79ed8cfe73ca2d0f3e6d90a6674b44fc35c2f4338300"}, "tags": [], "refs": [["int_zendesk__agent_work_time_filtered_statuses"], ["int_zendesk__schedule_spine"], ["int_zendesk__ticket_schedules"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/sla_policy/agent_work_time/int_zendesk__agent_work_time_business_hours.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk_intermediate", "materialized": "table", "enabled": true}, "created_at": 1644618836.735423, "compiled_sql": "\n\n-- AGENT WORK TIME\n-- This is complicated, as SLAs minutes are only counted while the ticket is in 'new' or 'open' status.\n\n-- Additionally, for business hours, only 'new' or 'open' status hours are counted if they are also during business hours\nwith agent_work_time_filtered_statuses as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__agent_work_time_filtered_statuses`\n where in_business_hours\n\n), schedule as (\n\n select * \n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__schedule_spine`\n\n), ticket_schedules as (\n\n select * \n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_schedules`\n \n-- cross schedules with work time\n), ticket_status_crossed_with_schedule as (\n \n select\n agent_work_time_filtered_statuses.ticket_id,\n agent_work_time_filtered_statuses.sla_applied_at,\n agent_work_time_filtered_statuses.target, \n agent_work_time_filtered_statuses.sla_policy_name, \n ticket_schedules.schedule_id,\n\n -- take the intersection of the intervals in which the status and the schedule were both active, for calculating the business minutes spent working on the ticket\n greatest(valid_starting_at, schedule_created_at) as valid_starting_at,\n least(valid_ending_at, schedule_invalidated_at) as valid_ending_at,\n\n -- bringing the following in the determine which schedule (Daylight Savings vs Standard time) to use\n valid_starting_at as status_valid_starting_at,\n valid_ending_at as status_valid_ending_at\n\n from agent_work_time_filtered_statuses\n left join ticket_schedules\n on agent_work_time_filtered_statuses.ticket_id = ticket_schedules.ticket_id\n where \n \n\n timestamp_diff(\n least(valid_ending_at, schedule_invalidated_at),\n greatest(valid_starting_at, schedule_created_at),\n second\n )\n\n\n > 0\n\n), ticket_full_solved_time as (\n\n select \n ticket_status_crossed_with_schedule.*,\n (\n \n\n timestamp_diff(\n ticket_status_crossed_with_schedule.valid_starting_at,\n \n timestamp_trunc(\n cast(ticket_status_crossed_with_schedule.valid_starting_at as timestamp),\n week\n )\n\n,\n second\n )\n\n\n /60\n ) as valid_starting_at_in_minutes_from_week,\n (\n \n\n timestamp_diff(\n ticket_status_crossed_with_schedule.valid_ending_at,\n ticket_status_crossed_with_schedule.valid_starting_at,\n second\n )\n\n\n /60\n ) as raw_delta_in_minutes\n from ticket_status_crossed_with_schedule\n group by 1,2,3,4,5,6,7,8,9,10\n\n), weeks as (\n\n \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * power(2, 0)\n + \n \n p1.generated_number * power(2, 1)\n + \n \n p2.generated_number * power(2, 2)\n + \n \n p3.generated_number * power(2, 3)\n + \n \n p4.generated_number * power(2, 4)\n + \n \n p5.generated_number * power(2, 5)\n + \n \n p6.generated_number * power(2, 6)\n + \n \n p7.generated_number * power(2, 7)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 208\n order by generated_number\n\n\n\n), weeks_cross_ticket_full_solved_time as (\n -- because time is reported in minutes since the beginning of the week, we have to split up time spent on the ticket into calendar weeks\n select \n ticket_full_solved_time.*,\n generated_number - 1 as week_number\n from ticket_full_solved_time\n cross join weeks\n where floor((valid_starting_at_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number -1\n\n), weekly_period_agent_work_time as (\n\n select \n\n ticket_id,\n sla_applied_at,\n valid_starting_at,\n valid_ending_at,\n status_valid_starting_at,\n status_valid_ending_at,\n target,\n sla_policy_name,\n valid_starting_at_in_minutes_from_week,\n raw_delta_in_minutes,\n week_number,\n schedule_id,\n greatest(0, valid_starting_at_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time_minute,\n least(valid_starting_at_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time_minute\n \n from weeks_cross_ticket_full_solved_time\n\n), intercepted_periods_agent as (\n \n select \n weekly_period_agent_work_time.ticket_id,\n weekly_period_agent_work_time.sla_applied_at,\n weekly_period_agent_work_time.target,\n weekly_period_agent_work_time.sla_policy_name,\n weekly_period_agent_work_time.valid_starting_at,\n weekly_period_agent_work_time.valid_ending_at,\n weekly_period_agent_work_time.week_number,\n weekly_period_agent_work_time.ticket_week_start_time_minute,\n weekly_period_agent_work_time.ticket_week_end_time_minute,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time_minute, schedule.end_time_utc) - greatest(weekly_period_agent_work_time.ticket_week_start_time_minute, schedule.start_time_utc) as scheduled_minutes\n from weekly_period_agent_work_time\n join schedule on ticket_week_start_time_minute <= schedule.end_time_utc \n and ticket_week_end_time_minute >= schedule.start_time_utc\n and weekly_period_agent_work_time.schedule_id = schedule.schedule_id\n -- this chooses the Daylight Savings Time or Standard Time version of the schedule\n and weekly_period_agent_work_time.status_valid_ending_at >= cast(schedule.valid_from as \n timestamp\n)\n and weekly_period_agent_work_time.status_valid_starting_at < cast(schedule.valid_until as \n timestamp\n) \n \n), intercepted_periods_with_running_total as (\n \n select \n *,\n sum(scheduled_minutes) over \n (partition by ticket_id, sla_applied_at \n order by valid_starting_at, week_number, schedule_end_time\n rows between unbounded preceding and current row)\n as running_total_scheduled_minutes\n\n from intercepted_periods_agent\n\n\n), intercepted_periods_agent_with_breach_flag as (\n select \n intercepted_periods_with_running_total.*,\n target - running_total_scheduled_minutes as remaining_target_minutes,\n lag(target - running_total_scheduled_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at, week_number, schedule_end_time) as lag_check,\n case when (target - running_total_scheduled_minutes) = 0 then true\n when (target - running_total_scheduled_minutes) < 0 \n and \n (lag(target - running_total_scheduled_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at, week_number, schedule_end_time) > 0 \n or \n lag(target - running_total_scheduled_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at, week_number, schedule_end_time) is null) \n then true else false end as is_breached_during_schedule\n \n from intercepted_periods_with_running_total\n\n), intercepted_periods_agent_filtered as (\n\n select\n *,\n (remaining_target_minutes + scheduled_minutes) as breach_minutes,\n greatest(ticket_week_start_time_minute, schedule_start_time) + (remaining_target_minutes + scheduled_minutes) as breach_minutes_from_week\n from intercepted_periods_agent_with_breach_flag\n \n), agent_work_business_breach as (\n \n select \n *,\n \n\n timestamp_add(\n timestamp_trunc(\n cast(valid_starting_at as timestamp),\n week\n )\n\n, interval cast(((7*24*60) * week_number) + breach_minutes_from_week as \n int64\n ) minute)\n\n as sla_breach_at\n from intercepted_periods_agent_filtered\n\n)\n\nselect * \nfrom agent_work_business_breach", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__agent_work_time_business_hours`"}, "model.zendesk.int_zendesk__agent_work_time_calendar_hours": {"raw_sql": "-- Calculate breach time for agent work time, calendar hours\nwith agent_work_time_filtered_statuses as (\n\n select *\n from {{ ref('int_zendesk__agent_work_time_filtered_statuses') }}\n where not in_business_hours\n\n), agent_work_time_calendar_minutes as (\n\n select \n *,\n {{ fivetran_utils.timestamp_diff(\n 'valid_starting_at',\n 'valid_ending_at',\n 'minute' )}} as calendar_minutes,\n sum({{ fivetran_utils.timestamp_diff(\n 'valid_starting_at', \n 'valid_ending_at', \n 'minute') }} ) \n over (partition by ticket_id, sla_applied_at order by valid_starting_at rows between unbounded preceding and current row) as running_total_calendar_minutes\n from agent_work_time_filtered_statuses\n\n), agent_work_time_calendar_minutes_flagged as (\n\nselect \n agent_work_time_calendar_minutes.*,\n target - running_total_calendar_minutes as remaining_target_minutes,\n case when (target - running_total_calendar_minutes) < 0 \n and \n (lag(target - running_total_calendar_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at) >= 0 \n or \n lag(target - running_total_calendar_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at) is null) \n then true else false end as is_breached_during_schedule\n \nfrom agent_work_time_calendar_minutes\n\n), final as (\n select\n *,\n (remaining_target_minutes + calendar_minutes) as breach_minutes,\n {{ fivetran_utils.timestamp_add(\n 'minute',\n '(remaining_target_minutes + calendar_minutes)',\n 'valid_starting_at', \n ) }} as sla_breach_at\n from agent_work_time_calendar_minutes_flagged\n\n)\n\nselect *\nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.fivetran_utils.timestamp_diff", "macro.fivetran_utils.timestamp_add"], "nodes": ["model.zendesk.int_zendesk__agent_work_time_filtered_statuses"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_intermediate", "fqn": ["zendesk", "sla_policy", "agent_work_time", "int_zendesk__agent_work_time_calendar_hours"], "unique_id": "model.zendesk.int_zendesk__agent_work_time_calendar_hours", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "sla_policy/agent_work_time/int_zendesk__agent_work_time_calendar_hours.sql", "original_file_path": "models/sla_policy/agent_work_time/int_zendesk__agent_work_time_calendar_hours.sql", "name": "int_zendesk__agent_work_time_calendar_hours", "alias": "int_zendesk__agent_work_time_calendar_hours", "checksum": {"name": "sha256", "checksum": "ca37b41feefafd32fbbc726e7bf3921affa528a2263862ef606a8ca9826d0661"}, "tags": [], "refs": [["int_zendesk__agent_work_time_filtered_statuses"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/sla_policy/agent_work_time/int_zendesk__agent_work_time_calendar_hours.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk_intermediate", "materialized": "table"}, "created_at": 1644618836.767692, "compiled_sql": "-- Calculate breach time for agent work time, calendar hours\nwith agent_work_time_filtered_statuses as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__agent_work_time_filtered_statuses`\n where not in_business_hours\n\n), agent_work_time_calendar_minutes as (\n\n select \n *,\n \n \n\n timestamp_diff(\n valid_ending_at,\n valid_starting_at,\n minute\n )\n\n\n as calendar_minutes,\n sum(\n \n\n timestamp_diff(\n valid_ending_at,\n valid_starting_at,\n minute\n )\n\n\n ) \n over (partition by ticket_id, sla_applied_at order by valid_starting_at rows between unbounded preceding and current row) as running_total_calendar_minutes\n from agent_work_time_filtered_statuses\n\n), agent_work_time_calendar_minutes_flagged as (\n\nselect \n agent_work_time_calendar_minutes.*,\n target - running_total_calendar_minutes as remaining_target_minutes,\n case when (target - running_total_calendar_minutes) < 0 \n and \n (lag(target - running_total_calendar_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at) >= 0 \n or \n lag(target - running_total_calendar_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at) is null) \n then true else false end as is_breached_during_schedule\n \nfrom agent_work_time_calendar_minutes\n\n), final as (\n select\n *,\n (remaining_target_minutes + calendar_minutes) as breach_minutes,\n \n\n timestamp_add(valid_starting_at, interval (remaining_target_minutes + calendar_minutes) minute)\n\n as sla_breach_at\n from agent_work_time_calendar_minutes_flagged\n\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__agent_work_time_calendar_hours`"}, "model.zendesk.int_zendesk__agent_work_time_filtered_statuses": {"raw_sql": "with agent_work_time_sla as (\n\n select *\n from {{ ref('int_zendesk__sla_policy_applied') }}\n where metric = 'agent_work_time'\n\n), ticket_historical_status as (\n\n select *\n from {{ ref('int_zendesk__ticket_historical_status') }}\n \n--This captures the statuses of the ticket while the agent work time sla was active for the ticket.\n), agent_work_time_filtered_statuses as (\n\n select \n ticket_historical_status.ticket_id,\n greatest(ticket_historical_status.valid_starting_at, agent_work_time_sla.sla_applied_at) as valid_starting_at,\n coalesce(\n ticket_historical_status.valid_ending_at, \n {{ fivetran_utils.timestamp_add('day', 30, \"\" ~ dbt_utils.current_timestamp() ~ \"\") }} ) as valid_ending_at, --assumes current status continues into the future. This is necessary to predict future SLA breaches (not just past).\n ticket_historical_status.status as ticket_status,\n agent_work_time_sla.sla_applied_at,\n agent_work_time_sla.target, \n agent_work_time_sla.sla_policy_name,\n agent_work_time_sla.ticket_created_at,\n agent_work_time_sla.in_business_hours\n from ticket_historical_status\n join agent_work_time_sla\n on ticket_historical_status.ticket_id = agent_work_time_sla.ticket_id\n where ticket_historical_status.status in ('new', 'open') -- these are the only statuses that count as \"agent work time\"\n and sla_applied_at < valid_ending_at\n\n)\nselect *\nfrom agent_work_time_filtered_statuses", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.current_timestamp", "macro.fivetran_utils.timestamp_add"], "nodes": ["model.zendesk.int_zendesk__sla_policy_applied", "model.zendesk.int_zendesk__ticket_historical_status"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_intermediate", "fqn": ["zendesk", "sla_policy", "agent_work_time", "int_zendesk__agent_work_time_filtered_statuses"], "unique_id": "model.zendesk.int_zendesk__agent_work_time_filtered_statuses", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "sla_policy/agent_work_time/int_zendesk__agent_work_time_filtered_statuses.sql", "original_file_path": "models/sla_policy/agent_work_time/int_zendesk__agent_work_time_filtered_statuses.sql", "name": "int_zendesk__agent_work_time_filtered_statuses", "alias": "int_zendesk__agent_work_time_filtered_statuses", "checksum": {"name": "sha256", "checksum": "8516523042e9dedfb12a9f5c5a240c79b03a01eab0a98d1e901b450bf331a0a0"}, "tags": [], "refs": [["int_zendesk__sla_policy_applied"], ["int_zendesk__ticket_historical_status"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/sla_policy/agent_work_time/int_zendesk__agent_work_time_filtered_statuses.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk_intermediate", "materialized": "table"}, "created_at": 1644618836.7758431, "compiled_sql": "with agent_work_time_sla as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__sla_policy_applied`\n where metric = 'agent_work_time'\n\n), ticket_historical_status as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_status`\n \n--This captures the statuses of the ticket while the agent work time sla was active for the ticket.\n), agent_work_time_filtered_statuses as (\n\n select \n ticket_historical_status.ticket_id,\n greatest(ticket_historical_status.valid_starting_at, agent_work_time_sla.sla_applied_at) as valid_starting_at,\n coalesce(\n ticket_historical_status.valid_ending_at, \n \n\n timestamp_add(\n current_timestamp\n, interval 30 day)\n\n ) as valid_ending_at, --assumes current status continues into the future. This is necessary to predict future SLA breaches (not just past).\n ticket_historical_status.status as ticket_status,\n agent_work_time_sla.sla_applied_at,\n agent_work_time_sla.target, \n agent_work_time_sla.sla_policy_name,\n agent_work_time_sla.ticket_created_at,\n agent_work_time_sla.in_business_hours\n from ticket_historical_status\n join agent_work_time_sla\n on ticket_historical_status.ticket_id = agent_work_time_sla.ticket_id\n where ticket_historical_status.status in ('new', 'open') -- these are the only statuses that count as \"agent work time\"\n and sla_applied_at < valid_ending_at\n\n)\nselect *\nfrom agent_work_time_filtered_statuses", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__agent_work_time_filtered_statuses`"}, "model.zendesk.int_zendesk__reply_time_business_hours": {"raw_sql": "{{ config(enabled=var('using_schedules', True)) }}\n\n-- step 3, determine when an SLA will breach for SLAs that are in business hours\n\nwith ticket_schedules as (\n \n select *\n from {{ ref('int_zendesk__ticket_schedules') }}\n\n), schedule as (\n \n select *\n from {{ ref('int_zendesk__schedule_spine') }}\n\n), sla_policy_applied as (\n \n select *\n from {{ ref('int_zendesk__sla_policy_applied') }}\n\n\n), schedule_business_hours as (\n\n select \n schedule_id,\n sum(end_time - start_time) as total_schedule_weekly_business_minutes\n -- referrinng to stg_zendesk__schedule instead of int_zendesk__schedule_spine just to calculcate total minutes\n from {{ ref('stg_zendesk__schedule') }}\n group by 1\n\n), ticket_sla_applied_with_schedules as (\n\n select \n sla_policy_applied.*,\n ticket_schedules.schedule_id,\n (\n {{ fivetran_utils.timestamp_diff(\n \"\" ~ dbt_utils.date_trunc('week', 'sla_policy_applied.sla_applied_at') ~ \"\",\n 'sla_policy_applied.sla_applied_at', \n 'second') }} /60\n ) as start_time_in_minutes_from_week,\n schedule_business_hours.total_schedule_weekly_business_minutes\n from sla_policy_applied\n left join ticket_schedules on sla_policy_applied.ticket_id = ticket_schedules.ticket_id\n and {{ fivetran_utils.timestamp_add('second', -1, 'ticket_schedules.schedule_created_at') }} <= sla_policy_applied.sla_applied_at\n and {{ fivetran_utils.timestamp_add('second', -1, 'ticket_schedules.schedule_invalidated_at') }} > sla_policy_applied.sla_applied_at\n left join schedule_business_hours \n on ticket_schedules.schedule_id = schedule_business_hours.schedule_id\n where sla_policy_applied.in_business_hours\n and metric in ('next_reply_time', 'first_reply_time')\n \n), weeks as (\n\n {{ dbt_utils.generate_series(208) }}\n\n), weeks_cross_ticket_sla_applied as (\n -- because time is reported in minutes since the beginning of the week, we have to split up time spent on the ticket into calendar weeks\n select \n\n ticket_sla_applied_with_schedules.*,\n generated_number - 1 as week_number\n\n from ticket_sla_applied_with_schedules\n cross join weeks\n where {{ fivetran_utils.ceiling('target/total_schedule_weekly_business_minutes') }} >= generated_number - 1\n\n), weekly_periods as (\n \n select \n weeks_cross_ticket_sla_applied.*,\n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n (7*24*60) as ticket_week_end_time\n from weeks_cross_ticket_sla_applied\n\n), intercepted_periods as (\n\n select \n weekly_periods.*,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n (schedule.end_time_utc - greatest(ticket_week_start_time,schedule.start_time_utc)) as lapsed_business_minutes,\n sum(schedule.end_time_utc - greatest(ticket_week_start_time,schedule.start_time_utc)) over \n (partition by ticket_id, metric, sla_applied_at \n order by week_number, schedule.start_time_utc\n rows between unbounded preceding and current row) as sum_lapsed_business_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n -- this chooses the Daylight Savings Time or Standard Time version of the schedule\n and weekly_periods.sla_applied_at >= cast(schedule.valid_from as {{ dbt_utils.type_timestamp() }})\n and weekly_periods.sla_applied_at < cast(schedule.valid_until as {{ dbt_utils.type_timestamp() }})\n \n), intercepted_periods_with_breach_flag as (\n \n select \n *,\n target - sum_lapsed_business_minutes as remaining_minutes,\n case when (target - sum_lapsed_business_minutes) < 0 \n and \n (lag(target - sum_lapsed_business_minutes) over\n (partition by ticket_id, metric, sla_applied_at order by week_number, schedule_start_time) >= 0 \n or \n lag(target - sum_lapsed_business_minutes) over\n (partition by ticket_id, metric, sla_applied_at order by week_number, schedule_start_time) is null) \n then true else false end as is_breached_during_schedule -- this flags the scheduled period on which the breach took place\n from intercepted_periods\n\n), intercepted_periods_with_breach_flag_calculated as (\n\n select\n *,\n schedule_end_time + remaining_minutes as breached_at_minutes,\n {{ dbt_utils.date_trunc('week', 'sla_applied_at') }} as starting_point,\n {{ fivetran_utils.timestamp_add(\n \"minute\",\n \"cast(((7*24*60) * week_number) + (schedule_end_time + remaining_minutes) as \" ~ dbt_utils.type_int() ~ \" )\",\n \"\" ~ dbt_utils.date_trunc('week', 'sla_applied_at') ~ \"\" ) }} as sla_breach_at\n from intercepted_periods_with_breach_flag\n\n), reply_time_business_hours_sla as (\n\n select\n ticket_id,\n sla_policy_name,\n metric,\n sla_applied_at,\n target,\n in_business_hours,\n sla_breach_at,\n is_breached_during_schedule\n from intercepted_periods_with_breach_flag_calculated\n\n) \n\nselect * \nfrom reply_time_business_hours_sla", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.date_trunc", "macro.fivetran_utils.timestamp_diff", "macro.fivetran_utils.timestamp_add", "macro.dbt_utils.generate_series", "macro.fivetran_utils.ceiling", "macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_int"], "nodes": ["model.zendesk.int_zendesk__ticket_schedules", "model.zendesk.int_zendesk__schedule_spine", "model.zendesk.int_zendesk__sla_policy_applied", "model.zendesk_source.stg_zendesk__schedule"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_intermediate", "fqn": ["zendesk", "sla_policy", "reply_time", "int_zendesk__reply_time_business_hours"], "unique_id": "model.zendesk.int_zendesk__reply_time_business_hours", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "sla_policy/reply_time/int_zendesk__reply_time_business_hours.sql", "original_file_path": "models/sla_policy/reply_time/int_zendesk__reply_time_business_hours.sql", "name": "int_zendesk__reply_time_business_hours", "alias": "int_zendesk__reply_time_business_hours", "checksum": {"name": "sha256", "checksum": "87eceff2982df3af12b5d36eb097db7f6d950c21fbf489c624b83885e65f0434"}, "tags": [], "refs": [["int_zendesk__ticket_schedules"], ["int_zendesk__schedule_spine"], ["int_zendesk__sla_policy_applied"], ["stg_zendesk__schedule"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/sla_policy/reply_time/int_zendesk__reply_time_business_hours.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk_intermediate", "materialized": "table", "enabled": true}, "created_at": 1644618836.7826188, "compiled_sql": "\n\n-- step 3, determine when an SLA will breach for SLAs that are in business hours\n\nwith ticket_schedules as (\n \n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_schedules`\n\n), schedule as (\n \n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__schedule_spine`\n\n), sla_policy_applied as (\n \n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__sla_policy_applied`\n\n\n), schedule_business_hours as (\n\n select \n schedule_id,\n sum(end_time - start_time) as total_schedule_weekly_business_minutes\n -- referrinng to stg_zendesk__schedule instead of int_zendesk__schedule_spine just to calculcate total minutes\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__schedule`\n group by 1\n\n), ticket_sla_applied_with_schedules as (\n\n select \n sla_policy_applied.*,\n ticket_schedules.schedule_id,\n (\n \n \n\n timestamp_diff(\n sla_policy_applied.sla_applied_at,\n \n timestamp_trunc(\n cast(sla_policy_applied.sla_applied_at as timestamp),\n week\n )\n\n,\n second\n )\n\n\n /60\n ) as start_time_in_minutes_from_week,\n schedule_business_hours.total_schedule_weekly_business_minutes\n from sla_policy_applied\n left join ticket_schedules on sla_policy_applied.ticket_id = ticket_schedules.ticket_id\n and \n\n timestamp_add(ticket_schedules.schedule_created_at, interval -1 second)\n\n <= sla_policy_applied.sla_applied_at\n and \n\n timestamp_add(ticket_schedules.schedule_invalidated_at, interval -1 second)\n\n > sla_policy_applied.sla_applied_at\n left join schedule_business_hours \n on ticket_schedules.schedule_id = schedule_business_hours.schedule_id\n where sla_policy_applied.in_business_hours\n and metric in ('next_reply_time', 'first_reply_time')\n \n), weeks as (\n\n \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * power(2, 0)\n + \n \n p1.generated_number * power(2, 1)\n + \n \n p2.generated_number * power(2, 2)\n + \n \n p3.generated_number * power(2, 3)\n + \n \n p4.generated_number * power(2, 4)\n + \n \n p5.generated_number * power(2, 5)\n + \n \n p6.generated_number * power(2, 6)\n + \n \n p7.generated_number * power(2, 7)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 208\n order by generated_number\n\n\n\n), weeks_cross_ticket_sla_applied as (\n -- because time is reported in minutes since the beginning of the week, we have to split up time spent on the ticket into calendar weeks\n select \n\n ticket_sla_applied_with_schedules.*,\n generated_number - 1 as week_number\n\n from ticket_sla_applied_with_schedules\n cross join weeks\n where \n ceiling(target/total_schedule_weekly_business_minutes)\n\n >= generated_number - 1\n\n), weekly_periods as (\n \n select \n weeks_cross_ticket_sla_applied.*,\n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n (7*24*60) as ticket_week_end_time\n from weeks_cross_ticket_sla_applied\n\n), intercepted_periods as (\n\n select \n weekly_periods.*,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n (schedule.end_time_utc - greatest(ticket_week_start_time,schedule.start_time_utc)) as lapsed_business_minutes,\n sum(schedule.end_time_utc - greatest(ticket_week_start_time,schedule.start_time_utc)) over \n (partition by ticket_id, metric, sla_applied_at \n order by week_number, schedule.start_time_utc\n rows between unbounded preceding and current row) as sum_lapsed_business_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n -- this chooses the Daylight Savings Time or Standard Time version of the schedule\n and weekly_periods.sla_applied_at >= cast(schedule.valid_from as \n timestamp\n)\n and weekly_periods.sla_applied_at < cast(schedule.valid_until as \n timestamp\n)\n \n), intercepted_periods_with_breach_flag as (\n \n select \n *,\n target - sum_lapsed_business_minutes as remaining_minutes,\n case when (target - sum_lapsed_business_minutes) < 0 \n and \n (lag(target - sum_lapsed_business_minutes) over\n (partition by ticket_id, metric, sla_applied_at order by week_number, schedule_start_time) >= 0 \n or \n lag(target - sum_lapsed_business_minutes) over\n (partition by ticket_id, metric, sla_applied_at order by week_number, schedule_start_time) is null) \n then true else false end as is_breached_during_schedule -- this flags the scheduled period on which the breach took place\n from intercepted_periods\n\n), intercepted_periods_with_breach_flag_calculated as (\n\n select\n *,\n schedule_end_time + remaining_minutes as breached_at_minutes,\n \n timestamp_trunc(\n cast(sla_applied_at as timestamp),\n week\n )\n\n as starting_point,\n \n\n timestamp_add(\n timestamp_trunc(\n cast(sla_applied_at as timestamp),\n week\n )\n\n, interval cast(((7*24*60) * week_number) + (schedule_end_time + remaining_minutes) as \n int64\n ) minute)\n\n as sla_breach_at\n from intercepted_periods_with_breach_flag\n\n), reply_time_business_hours_sla as (\n\n select\n ticket_id,\n sla_policy_name,\n metric,\n sla_applied_at,\n target,\n in_business_hours,\n sla_breach_at,\n is_breached_during_schedule\n from intercepted_periods_with_breach_flag_calculated\n\n) \n\nselect * \nfrom reply_time_business_hours_sla", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__reply_time_business_hours`"}, "model.zendesk.int_zendesk__reply_time_calendar_hours": {"raw_sql": "--REPLY TIME SLA\n-- step 2, figure out when the sla will breach for sla's in calendar hours. The calculation is relatively straightforward.\n\nwith sla_policy_applied as (\n\n select *\n from {{ ref('int_zendesk__sla_policy_applied') }}\n\n), final as (\n select\n *,\n {{ fivetran_utils.timestamp_add(\n \"minute\",\n \"cast(target as \" ~ dbt_utils.type_int() ~ \" )\",\n \"sla_applied_at\" ) }} as sla_breach_at\n from sla_policy_applied\n where not in_business_hours\n and metric in ('next_reply_time', 'first_reply_time')\n\n)\n\nselect *\nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.type_int", "macro.fivetran_utils.timestamp_add"], "nodes": ["model.zendesk.int_zendesk__sla_policy_applied"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_intermediate", "fqn": ["zendesk", "sla_policy", "reply_time", "int_zendesk__reply_time_calendar_hours"], "unique_id": "model.zendesk.int_zendesk__reply_time_calendar_hours", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "sla_policy/reply_time/int_zendesk__reply_time_calendar_hours.sql", "original_file_path": "models/sla_policy/reply_time/int_zendesk__reply_time_calendar_hours.sql", "name": "int_zendesk__reply_time_calendar_hours", "alias": "int_zendesk__reply_time_calendar_hours", "checksum": {"name": "sha256", "checksum": "c870f34e14c4245c2a43c5403ef7b9948d776e99dbe703e7fdcba4acc6f2f505"}, "tags": [], "refs": [["int_zendesk__sla_policy_applied"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/sla_policy/reply_time/int_zendesk__reply_time_calendar_hours.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk_intermediate", "materialized": "table"}, "created_at": 1644618836.798798, "compiled_sql": "--REPLY TIME SLA\n-- step 2, figure out when the sla will breach for sla's in calendar hours. The calculation is relatively straightforward.\n\nwith sla_policy_applied as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__sla_policy_applied`\n\n), final as (\n select\n *,\n \n\n timestamp_add(sla_applied_at, interval cast(target as \n int64\n ) minute)\n\n as sla_breach_at\n from sla_policy_applied\n where not in_business_hours\n and metric in ('next_reply_time', 'first_reply_time')\n\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__reply_time_calendar_hours`"}, "model.zendesk.int_zendesk__reply_time_combined": {"raw_sql": "with reply_time_calendar_hours_sla as (\n \n select *\n from {{ ref('int_zendesk__reply_time_calendar_hours') }}\n\n{% if var('using_schedules', True) %}\n\n), reply_time_business_hours_sla as (\n \n select *\n from {{ ref('int_zendesk__reply_time_business_hours') }}\n\n{% endif %}\n\n), ticket_updates as (\n select *\n from {{ ref('int_zendesk__updates') }}\n\n), users as (\n \n select *\n from {{ ref('int_zendesk__user_aggregates') }}\n\n), reply_time_breached_at as (\n\n select \n ticket_id,\n sla_policy_name,\n metric,\n sla_applied_at,\n target,\n in_business_hours,\n sla_breach_at\n from reply_time_calendar_hours_sla\n\n{% if var('using_schedules', True) %}\n\n union all\n\n select \n ticket_id,\n sla_policy_name,\n metric,\n sla_applied_at,\n target,\n in_business_hours,\n sla_breach_at\n from reply_time_business_hours_sla\n{% endif %}\n\n-- Now that we have the breach time, see when the first reply after the sla policy was applied took place.\n), ticket_solved_times as (\n select\n ticket_id,\n valid_starting_at as solved_at\n from ticket_updates\n where field_name = 'status'\n and value in ('solved','closed')\n\n), reply_time as (\n select \n ticket_comment.ticket_id,\n ticket_comment.valid_starting_at as reply_at,\n commenter.role\n from ticket_updates as ticket_comment\n join users as commenter\n on commenter.user_id = ticket_comment.user_id\n where field_name = 'comment' \n and ticket_comment.is_public\n and commenter.role in ('agent','admin')\n\n), reply_time_breached_at_with_next_reply_timestamp as (\n\n select \n reply_time_breached_at.ticket_id,\n reply_time_breached_at.sla_policy_name,\n reply_time_breached_at.metric,\n reply_time_breached_at.sla_applied_at,\n reply_time_breached_at.target,\n reply_time_breached_at.in_business_hours,\n min(sla_breach_at) as sla_breach_at,\n min(reply_at) as agent_reply_at,\n min(solved_at) as next_solved_at\n from reply_time_breached_at\n left join reply_time\n on reply_time.ticket_id = reply_time_breached_at.ticket_id\n and reply_time.reply_at > reply_time_breached_at.sla_applied_at\n left join ticket_solved_times\n on reply_time_breached_at.ticket_id = ticket_solved_times.ticket_id\n and ticket_solved_times.solved_at > reply_time_breached_at.sla_applied_at\n {{ dbt_utils.group_by(n=6) }}\n\n), reply_time_breached_at_remove_old_sla as (\n select \n *,\n lead(sla_applied_at) over (partition by ticket_id, metric, in_business_hours order by sla_applied_at) as updated_sla_policy_starts_at,\n case when \n lead(sla_applied_at) over (partition by ticket_id, metric, in_business_hours order by sla_applied_at) --updated sla policy start at time\n < sla_breach_at then true else false end as is_stale_sla_policy,\n case when (sla_breach_at < agent_reply_at and sla_breach_at < next_solved_at)\n or (sla_breach_at < agent_reply_at and next_solved_at is null)\n or (agent_reply_at is null and sla_breach_at < next_solved_at)\n or (agent_reply_at is null and next_solved_at is null)\n then true\n else false\n end as is_sla_breached\n from reply_time_breached_at_with_next_reply_timestamp\n \n), reply_time_breach as (\n select \n *,\n {{ dbt_utils.datediff(\"sla_applied_at\", \"agent_reply_at\", 'minute') }} as sla_elapsed_time\n from reply_time_breached_at_remove_old_sla\n)\n\nselect *\nfrom reply_time_breach", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.group_by", "macro.dbt_utils.datediff"], "nodes": ["model.zendesk.int_zendesk__reply_time_calendar_hours", "model.zendesk.int_zendesk__reply_time_business_hours", "model.zendesk.int_zendesk__updates", "model.zendesk.int_zendesk__user_aggregates"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_intermediate", "fqn": ["zendesk", "sla_policy", "reply_time", "int_zendesk__reply_time_combined"], "unique_id": "model.zendesk.int_zendesk__reply_time_combined", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "sla_policy/reply_time/int_zendesk__reply_time_combined.sql", "original_file_path": "models/sla_policy/reply_time/int_zendesk__reply_time_combined.sql", "name": "int_zendesk__reply_time_combined", "alias": "int_zendesk__reply_time_combined", "checksum": {"name": "sha256", "checksum": "18e90d37086ff809133e4c8f66c024ecb244a80fd8fdc65600a3d81272faaa0f"}, "tags": [], "refs": [["int_zendesk__reply_time_calendar_hours"], ["int_zendesk__reply_time_business_hours"], ["int_zendesk__updates"], ["int_zendesk__user_aggregates"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/sla_policy/reply_time/int_zendesk__reply_time_combined.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk_intermediate", "materialized": "table"}, "created_at": 1644618836.8057249, "compiled_sql": "with reply_time_calendar_hours_sla as (\n \n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__reply_time_calendar_hours`\n\n\n\n), reply_time_business_hours_sla as (\n \n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__reply_time_business_hours`\n\n\n\n), ticket_updates as (\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__updates`\n\n), users as (\n \n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__user_aggregates`\n\n), reply_time_breached_at as (\n\n select \n ticket_id,\n sla_policy_name,\n metric,\n sla_applied_at,\n target,\n in_business_hours,\n sla_breach_at\n from reply_time_calendar_hours_sla\n\n\n\n union all\n\n select \n ticket_id,\n sla_policy_name,\n metric,\n sla_applied_at,\n target,\n in_business_hours,\n sla_breach_at\n from reply_time_business_hours_sla\n\n\n-- Now that we have the breach time, see when the first reply after the sla policy was applied took place.\n), ticket_solved_times as (\n select\n ticket_id,\n valid_starting_at as solved_at\n from ticket_updates\n where field_name = 'status'\n and value in ('solved','closed')\n\n), reply_time as (\n select \n ticket_comment.ticket_id,\n ticket_comment.valid_starting_at as reply_at,\n commenter.role\n from ticket_updates as ticket_comment\n join users as commenter\n on commenter.user_id = ticket_comment.user_id\n where field_name = 'comment' \n and ticket_comment.is_public\n and commenter.role in ('agent','admin')\n\n), reply_time_breached_at_with_next_reply_timestamp as (\n\n select \n reply_time_breached_at.ticket_id,\n reply_time_breached_at.sla_policy_name,\n reply_time_breached_at.metric,\n reply_time_breached_at.sla_applied_at,\n reply_time_breached_at.target,\n reply_time_breached_at.in_business_hours,\n min(sla_breach_at) as sla_breach_at,\n min(reply_at) as agent_reply_at,\n min(solved_at) as next_solved_at\n from reply_time_breached_at\n left join reply_time\n on reply_time.ticket_id = reply_time_breached_at.ticket_id\n and reply_time.reply_at > reply_time_breached_at.sla_applied_at\n left join ticket_solved_times\n on reply_time_breached_at.ticket_id = ticket_solved_times.ticket_id\n and ticket_solved_times.solved_at > reply_time_breached_at.sla_applied_at\n group by 1,2,3,4,5,6\n\n), reply_time_breached_at_remove_old_sla as (\n select \n *,\n lead(sla_applied_at) over (partition by ticket_id, metric, in_business_hours order by sla_applied_at) as updated_sla_policy_starts_at,\n case when \n lead(sla_applied_at) over (partition by ticket_id, metric, in_business_hours order by sla_applied_at) --updated sla policy start at time\n < sla_breach_at then true else false end as is_stale_sla_policy,\n case when (sla_breach_at < agent_reply_at and sla_breach_at < next_solved_at)\n or (sla_breach_at < agent_reply_at and next_solved_at is null)\n or (agent_reply_at is null and sla_breach_at < next_solved_at)\n or (agent_reply_at is null and next_solved_at is null)\n then true\n else false\n end as is_sla_breached\n from reply_time_breached_at_with_next_reply_timestamp\n \n), reply_time_breach as (\n select \n *,\n \n\n datetime_diff(\n cast(agent_reply_at as datetime),\n cast(sla_applied_at as datetime),\n minute\n )\n\n as sla_elapsed_time\n from reply_time_breached_at_remove_old_sla\n)\n\nselect *\nfrom reply_time_breach", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__reply_time_combined`"}, "model.zendesk.int_zendesk__requester_wait_time_calendar_hours": {"raw_sql": "-- Calculate breach time for requester wait time, calendar hours\nwith requester_wait_time_filtered_statuses as (\n\n select *\n from {{ ref('int_zendesk__requester_wait_time_filtered_statuses') }}\n where not in_business_hours\n\n), requester_wait_time_calendar_minutes as (\n\n select \n *,\n {{ fivetran_utils.timestamp_diff(\n 'valid_starting_at',\n 'valid_ending_at',\n 'minute' )}} as calendar_minutes,\n sum({{ fivetran_utils.timestamp_diff(\n 'valid_starting_at', \n 'valid_ending_at', \n 'minute') }} ) \n over (partition by ticket_id, sla_applied_at order by valid_starting_at rows between unbounded preceding and current row) as running_total_calendar_minutes\n from requester_wait_time_filtered_statuses\n\n), requester_wait_time_calendar_minutes_flagged as (\n\nselect \n requester_wait_time_calendar_minutes.*,\n target - running_total_calendar_minutes as remaining_target_minutes,\n case when (target - running_total_calendar_minutes) < 0 \n and \n (lag(target - running_total_calendar_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at) >= 0 \n or \n lag(target - running_total_calendar_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at) is null) \n then true else false end as is_breached_during_schedule\n \nfrom requester_wait_time_calendar_minutes\n\n), final as (\n select\n *,\n (remaining_target_minutes + calendar_minutes) as breach_minutes,\n {{ fivetran_utils.timestamp_add(\n 'minute',\n '(remaining_target_minutes + calendar_minutes)',\n 'valid_starting_at', \n ) }} as sla_breach_at\n from requester_wait_time_calendar_minutes_flagged\n\n)\n\nselect *\nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.fivetran_utils.timestamp_diff", "macro.fivetran_utils.timestamp_add"], "nodes": ["model.zendesk.int_zendesk__requester_wait_time_filtered_statuses"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_intermediate", "fqn": ["zendesk", "sla_policy", "requester_wait_time", "int_zendesk__requester_wait_time_calendar_hours"], "unique_id": "model.zendesk.int_zendesk__requester_wait_time_calendar_hours", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "sla_policy/requester_wait_time/int_zendesk__requester_wait_time_calendar_hours.sql", "original_file_path": "models/sla_policy/requester_wait_time/int_zendesk__requester_wait_time_calendar_hours.sql", "name": "int_zendesk__requester_wait_time_calendar_hours", "alias": "int_zendesk__requester_wait_time_calendar_hours", "checksum": {"name": "sha256", "checksum": "d470116638c80eb24b44bb55e08f6feb8fb676924af4782e65125cac40a004dd"}, "tags": [], "refs": [["int_zendesk__requester_wait_time_filtered_statuses"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/sla_policy/requester_wait_time/int_zendesk__requester_wait_time_calendar_hours.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk_intermediate", "materialized": "table"}, "created_at": 1644618836.8141088, "compiled_sql": "-- Calculate breach time for requester wait time, calendar hours\nwith requester_wait_time_filtered_statuses as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__requester_wait_time_filtered_statuses`\n where not in_business_hours\n\n), requester_wait_time_calendar_minutes as (\n\n select \n *,\n \n \n\n timestamp_diff(\n valid_ending_at,\n valid_starting_at,\n minute\n )\n\n\n as calendar_minutes,\n sum(\n \n\n timestamp_diff(\n valid_ending_at,\n valid_starting_at,\n minute\n )\n\n\n ) \n over (partition by ticket_id, sla_applied_at order by valid_starting_at rows between unbounded preceding and current row) as running_total_calendar_minutes\n from requester_wait_time_filtered_statuses\n\n), requester_wait_time_calendar_minutes_flagged as (\n\nselect \n requester_wait_time_calendar_minutes.*,\n target - running_total_calendar_minutes as remaining_target_minutes,\n case when (target - running_total_calendar_minutes) < 0 \n and \n (lag(target - running_total_calendar_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at) >= 0 \n or \n lag(target - running_total_calendar_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at) is null) \n then true else false end as is_breached_during_schedule\n \nfrom requester_wait_time_calendar_minutes\n\n), final as (\n select\n *,\n (remaining_target_minutes + calendar_minutes) as breach_minutes,\n \n\n timestamp_add(valid_starting_at, interval (remaining_target_minutes + calendar_minutes) minute)\n\n as sla_breach_at\n from requester_wait_time_calendar_minutes_flagged\n\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__requester_wait_time_calendar_hours`"}, "model.zendesk.int_zendesk__requester_wait_time_business_hours": {"raw_sql": "{{ config(enabled=var('using_schedules', True)) }}\n\n-- REQUESTER WAIT TIME\n-- This is complicated, as SLAs minutes are only counted while the ticket is in 'new', 'open', and 'on-hold' status.\n\n-- Additionally, for business hours, only 'new', 'open', and 'on-hold' status hours are counted if they are also during business hours\nwith requester_wait_time_filtered_statuses as (\n\n select *\n from {{ ref('int_zendesk__requester_wait_time_filtered_statuses') }}\n where in_business_hours\n\n), schedule as (\n\n select * \n from {{ ref('int_zendesk__schedule_spine') }}\n\n), ticket_schedules as (\n\n select * \n from {{ ref('int_zendesk__ticket_schedules') }}\n \n-- cross schedules with work time\n), ticket_status_crossed_with_schedule as (\n \n select\n requester_wait_time_filtered_statuses.ticket_id,\n requester_wait_time_filtered_statuses.sla_applied_at,\n requester_wait_time_filtered_statuses.target,\n requester_wait_time_filtered_statuses.sla_policy_name,\n ticket_schedules.schedule_id,\n\n -- take the intersection of the intervals in which the status and the schedule were both active, for calculating the business minutes spent working on the ticket\n greatest(valid_starting_at, schedule_created_at) as valid_starting_at,\n least(valid_ending_at, schedule_invalidated_at) as valid_ending_at,\n\n -- bringing the following in the determine which schedule (Daylight Savings vs Standard time) to use\n valid_starting_at as status_valid_starting_at,\n valid_ending_at as status_valid_ending_at\n\n from requester_wait_time_filtered_statuses\n left join ticket_schedules\n on requester_wait_time_filtered_statuses.ticket_id = ticket_schedules.ticket_id\n where {{ fivetran_utils.timestamp_diff(\n 'greatest(valid_starting_at, schedule_created_at)', \n 'least(valid_ending_at, schedule_invalidated_at)', \n 'second') }} > 0\n\n), ticket_full_solved_time as (\n\n select \n ticket_status_crossed_with_schedule.*,\n ({{ fivetran_utils.timestamp_diff(\n \"\" ~ dbt_utils.date_trunc(\n 'week',\n 'ticket_status_crossed_with_schedule.valid_starting_at') ~ \"\", \n 'ticket_status_crossed_with_schedule.valid_starting_at', \n 'second') }} /60\n ) as valid_starting_at_in_minutes_from_week,\n ({{ fivetran_utils.timestamp_diff(\n 'ticket_status_crossed_with_schedule.valid_starting_at', \n 'ticket_status_crossed_with_schedule.valid_ending_at',\n 'second') }} /60\n ) as raw_delta_in_minutes\n from ticket_status_crossed_with_schedule\n {{ dbt_utils.group_by(n=10) }}\n\n), weeks as (\n\n {{ dbt_utils.generate_series(208) }}\n\n), weeks_cross_ticket_full_solved_time as (\n -- because time is reported in minutes since the beginning of the week, we have to split up time spent on the ticket into calendar weeks\n select \n ticket_full_solved_time.*,\n generated_number - 1 as week_number\n from ticket_full_solved_time\n cross join weeks\n where floor((valid_starting_at_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number -1\n\n), weekly_period_requester_wait_time as (\n\n select \n\n ticket_id,\n sla_applied_at,\n valid_starting_at,\n valid_ending_at,\n status_valid_starting_at,\n status_valid_ending_at,\n target,\n sla_policy_name,\n valid_starting_at_in_minutes_from_week,\n raw_delta_in_minutes,\n week_number,\n schedule_id,\n greatest(0, valid_starting_at_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time_minute,\n least(valid_starting_at_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time_minute\n \n from weeks_cross_ticket_full_solved_time\n\n), intercepted_periods_agent as (\n \n select \n weekly_period_requester_wait_time.ticket_id,\n weekly_period_requester_wait_time.sla_applied_at,\n weekly_period_requester_wait_time.target,\n weekly_period_requester_wait_time.sla_policy_name,\n weekly_period_requester_wait_time.valid_starting_at,\n weekly_period_requester_wait_time.valid_ending_at,\n weekly_period_requester_wait_time.week_number,\n weekly_period_requester_wait_time.ticket_week_start_time_minute,\n weekly_period_requester_wait_time.ticket_week_end_time_minute,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time_minute, schedule.end_time_utc) - greatest(weekly_period_requester_wait_time.ticket_week_start_time_minute, schedule.start_time_utc) as scheduled_minutes\n from weekly_period_requester_wait_time\n join schedule on ticket_week_start_time_minute <= schedule.end_time_utc \n and ticket_week_end_time_minute >= schedule.start_time_utc\n and weekly_period_requester_wait_time.schedule_id = schedule.schedule_id\n -- this chooses the Daylight Savings Time or Standard Time version of the schedule\n and weekly_period_requester_wait_time.status_valid_ending_at >= cast(schedule.valid_from as {{ dbt_utils.type_timestamp() }})\n and weekly_period_requester_wait_time.status_valid_starting_at < cast(schedule.valid_until as {{ dbt_utils.type_timestamp() }}) \n\n), intercepted_periods_with_running_total as (\n \n select \n *,\n sum(scheduled_minutes) over \n (partition by ticket_id, sla_applied_at \n order by valid_starting_at, week_number, schedule_end_time\n rows between unbounded preceding and current row)\n as running_total_scheduled_minutes\n\n from intercepted_periods_agent\n\n\n), intercepted_periods_agent_with_breach_flag as (\n select \n intercepted_periods_with_running_total.*,\n target - running_total_scheduled_minutes as remaining_target_minutes,\n lag(target - running_total_scheduled_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at, week_number, schedule_end_time) as lag_check,\n case when (target - running_total_scheduled_minutes) = 0 then true\n when (target - running_total_scheduled_minutes) < 0 \n and \n (lag(target - running_total_scheduled_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at, week_number, schedule_end_time) > 0 \n or \n lag(target - running_total_scheduled_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at, week_number, schedule_end_time) is null) \n then true else false end as is_breached_during_schedule\n \n from intercepted_periods_with_running_total\n\n), intercepted_periods_agent_filtered as (\n\n select\n *,\n (remaining_target_minutes + scheduled_minutes) as breach_minutes,\n greatest(ticket_week_start_time_minute, schedule_start_time) + (remaining_target_minutes + scheduled_minutes) as breach_minutes_from_week\n from intercepted_periods_agent_with_breach_flag\n\n), requester_wait_business_breach as (\n \n select \n *,\n {{ fivetran_utils.timestamp_add(\n \"minute\",\n \"cast(((7*24*60) * week_number) + breach_minutes_from_week as \" ~ dbt_utils.type_int() ~ \" )\",\n \"\" ~ dbt_utils.date_trunc('week', 'valid_starting_at') ~ \"\",\n ) }} as sla_breach_at\n from intercepted_periods_agent_filtered\n\n)\n\nselect * \nfrom requester_wait_business_breach", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.fivetran_utils.timestamp_diff", "macro.dbt_utils.date_trunc", "macro.dbt_utils.group_by", "macro.dbt_utils.generate_series", "macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_int", "macro.fivetran_utils.timestamp_add"], "nodes": ["model.zendesk.int_zendesk__requester_wait_time_filtered_statuses", "model.zendesk.int_zendesk__schedule_spine", "model.zendesk.int_zendesk__ticket_schedules"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_intermediate", "fqn": ["zendesk", "sla_policy", "requester_wait_time", "int_zendesk__requester_wait_time_business_hours"], "unique_id": "model.zendesk.int_zendesk__requester_wait_time_business_hours", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "sla_policy/requester_wait_time/int_zendesk__requester_wait_time_business_hours.sql", "original_file_path": "models/sla_policy/requester_wait_time/int_zendesk__requester_wait_time_business_hours.sql", "name": "int_zendesk__requester_wait_time_business_hours", "alias": "int_zendesk__requester_wait_time_business_hours", "checksum": {"name": "sha256", "checksum": "15a77731ce46c1a5f50006a1ec174efcda1a248182029006b9a4a117da3c38fa"}, "tags": [], "refs": [["int_zendesk__requester_wait_time_filtered_statuses"], ["int_zendesk__schedule_spine"], ["int_zendesk__ticket_schedules"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/sla_policy/requester_wait_time/int_zendesk__requester_wait_time_business_hours.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk_intermediate", "materialized": "table", "enabled": true}, "created_at": 1644618836.821326, "compiled_sql": "\n\n-- REQUESTER WAIT TIME\n-- This is complicated, as SLAs minutes are only counted while the ticket is in 'new', 'open', and 'on-hold' status.\n\n-- Additionally, for business hours, only 'new', 'open', and 'on-hold' status hours are counted if they are also during business hours\nwith requester_wait_time_filtered_statuses as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__requester_wait_time_filtered_statuses`\n where in_business_hours\n\n), schedule as (\n\n select * \n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__schedule_spine`\n\n), ticket_schedules as (\n\n select * \n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_schedules`\n \n-- cross schedules with work time\n), ticket_status_crossed_with_schedule as (\n \n select\n requester_wait_time_filtered_statuses.ticket_id,\n requester_wait_time_filtered_statuses.sla_applied_at,\n requester_wait_time_filtered_statuses.target,\n requester_wait_time_filtered_statuses.sla_policy_name,\n ticket_schedules.schedule_id,\n\n -- take the intersection of the intervals in which the status and the schedule were both active, for calculating the business minutes spent working on the ticket\n greatest(valid_starting_at, schedule_created_at) as valid_starting_at,\n least(valid_ending_at, schedule_invalidated_at) as valid_ending_at,\n\n -- bringing the following in the determine which schedule (Daylight Savings vs Standard time) to use\n valid_starting_at as status_valid_starting_at,\n valid_ending_at as status_valid_ending_at\n\n from requester_wait_time_filtered_statuses\n left join ticket_schedules\n on requester_wait_time_filtered_statuses.ticket_id = ticket_schedules.ticket_id\n where \n \n\n timestamp_diff(\n least(valid_ending_at, schedule_invalidated_at),\n greatest(valid_starting_at, schedule_created_at),\n second\n )\n\n\n > 0\n\n), ticket_full_solved_time as (\n\n select \n ticket_status_crossed_with_schedule.*,\n (\n \n\n timestamp_diff(\n ticket_status_crossed_with_schedule.valid_starting_at,\n \n timestamp_trunc(\n cast(ticket_status_crossed_with_schedule.valid_starting_at as timestamp),\n week\n )\n\n,\n second\n )\n\n\n /60\n ) as valid_starting_at_in_minutes_from_week,\n (\n \n\n timestamp_diff(\n ticket_status_crossed_with_schedule.valid_ending_at,\n ticket_status_crossed_with_schedule.valid_starting_at,\n second\n )\n\n\n /60\n ) as raw_delta_in_minutes\n from ticket_status_crossed_with_schedule\n group by 1,2,3,4,5,6,7,8,9,10\n\n), weeks as (\n\n \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * power(2, 0)\n + \n \n p1.generated_number * power(2, 1)\n + \n \n p2.generated_number * power(2, 2)\n + \n \n p3.generated_number * power(2, 3)\n + \n \n p4.generated_number * power(2, 4)\n + \n \n p5.generated_number * power(2, 5)\n + \n \n p6.generated_number * power(2, 6)\n + \n \n p7.generated_number * power(2, 7)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 208\n order by generated_number\n\n\n\n), weeks_cross_ticket_full_solved_time as (\n -- because time is reported in minutes since the beginning of the week, we have to split up time spent on the ticket into calendar weeks\n select \n ticket_full_solved_time.*,\n generated_number - 1 as week_number\n from ticket_full_solved_time\n cross join weeks\n where floor((valid_starting_at_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number -1\n\n), weekly_period_requester_wait_time as (\n\n select \n\n ticket_id,\n sla_applied_at,\n valid_starting_at,\n valid_ending_at,\n status_valid_starting_at,\n status_valid_ending_at,\n target,\n sla_policy_name,\n valid_starting_at_in_minutes_from_week,\n raw_delta_in_minutes,\n week_number,\n schedule_id,\n greatest(0, valid_starting_at_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time_minute,\n least(valid_starting_at_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time_minute\n \n from weeks_cross_ticket_full_solved_time\n\n), intercepted_periods_agent as (\n \n select \n weekly_period_requester_wait_time.ticket_id,\n weekly_period_requester_wait_time.sla_applied_at,\n weekly_period_requester_wait_time.target,\n weekly_period_requester_wait_time.sla_policy_name,\n weekly_period_requester_wait_time.valid_starting_at,\n weekly_period_requester_wait_time.valid_ending_at,\n weekly_period_requester_wait_time.week_number,\n weekly_period_requester_wait_time.ticket_week_start_time_minute,\n weekly_period_requester_wait_time.ticket_week_end_time_minute,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time_minute, schedule.end_time_utc) - greatest(weekly_period_requester_wait_time.ticket_week_start_time_minute, schedule.start_time_utc) as scheduled_minutes\n from weekly_period_requester_wait_time\n join schedule on ticket_week_start_time_minute <= schedule.end_time_utc \n and ticket_week_end_time_minute >= schedule.start_time_utc\n and weekly_period_requester_wait_time.schedule_id = schedule.schedule_id\n -- this chooses the Daylight Savings Time or Standard Time version of the schedule\n and weekly_period_requester_wait_time.status_valid_ending_at >= cast(schedule.valid_from as \n timestamp\n)\n and weekly_period_requester_wait_time.status_valid_starting_at < cast(schedule.valid_until as \n timestamp\n) \n\n), intercepted_periods_with_running_total as (\n \n select \n *,\n sum(scheduled_minutes) over \n (partition by ticket_id, sla_applied_at \n order by valid_starting_at, week_number, schedule_end_time\n rows between unbounded preceding and current row)\n as running_total_scheduled_minutes\n\n from intercepted_periods_agent\n\n\n), intercepted_periods_agent_with_breach_flag as (\n select \n intercepted_periods_with_running_total.*,\n target - running_total_scheduled_minutes as remaining_target_minutes,\n lag(target - running_total_scheduled_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at, week_number, schedule_end_time) as lag_check,\n case when (target - running_total_scheduled_minutes) = 0 then true\n when (target - running_total_scheduled_minutes) < 0 \n and \n (lag(target - running_total_scheduled_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at, week_number, schedule_end_time) > 0 \n or \n lag(target - running_total_scheduled_minutes) over\n (partition by ticket_id, sla_applied_at order by valid_starting_at, week_number, schedule_end_time) is null) \n then true else false end as is_breached_during_schedule\n \n from intercepted_periods_with_running_total\n\n), intercepted_periods_agent_filtered as (\n\n select\n *,\n (remaining_target_minutes + scheduled_minutes) as breach_minutes,\n greatest(ticket_week_start_time_minute, schedule_start_time) + (remaining_target_minutes + scheduled_minutes) as breach_minutes_from_week\n from intercepted_periods_agent_with_breach_flag\n\n), requester_wait_business_breach as (\n \n select \n *,\n \n\n timestamp_add(\n timestamp_trunc(\n cast(valid_starting_at as timestamp),\n week\n )\n\n, interval cast(((7*24*60) * week_number) + breach_minutes_from_week as \n int64\n ) minute)\n\n as sla_breach_at\n from intercepted_periods_agent_filtered\n\n)\n\nselect * \nfrom requester_wait_business_breach", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__requester_wait_time_business_hours`"}, "model.zendesk.int_zendesk__requester_wait_time_filtered_statuses": {"raw_sql": "with requester_wait_time_sla as (\n\n select *\n from {{ ref('int_zendesk__sla_policy_applied') }}\n where metric = 'requester_wait_time'\n\n), ticket_historical_status as (\n\n select *\n from {{ ref('int_zendesk__ticket_historical_status') }}\n \n--This captures the statuses of the ticket while the requester wait time sla was active for the ticket.\n), requester_wait_time_filtered_statuses as (\n\n select \n ticket_historical_status.ticket_id,\n greatest(ticket_historical_status.valid_starting_at, requester_wait_time_sla.sla_applied_at) as valid_starting_at,\n coalesce(\n ticket_historical_status.valid_ending_at, \n {{ fivetran_utils.timestamp_add('day', 30, \"\" ~ dbt_utils.current_timestamp() ~ \"\") }} ) as valid_ending_at, --assumes current status continues into the future. This is necessary to predict future SLA breaches (not just past).\n ticket_historical_status.status as ticket_status,\n requester_wait_time_sla.sla_applied_at,\n requester_wait_time_sla.target,\n requester_wait_time_sla.sla_policy_name,\n requester_wait_time_sla.ticket_created_at,\n requester_wait_time_sla.in_business_hours\n from ticket_historical_status\n join requester_wait_time_sla\n on ticket_historical_status.ticket_id = requester_wait_time_sla.ticket_id\n where ticket_historical_status.status in ('new', 'open', 'on-hold') -- these are the only statuses that count as \"requester wait time\"\n and sla_applied_at < valid_ending_at\n\n)\nselect *\nfrom requester_wait_time_filtered_statuses", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.current_timestamp", "macro.fivetran_utils.timestamp_add"], "nodes": ["model.zendesk.int_zendesk__sla_policy_applied", "model.zendesk.int_zendesk__ticket_historical_status"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_intermediate", "fqn": ["zendesk", "sla_policy", "requester_wait_time", "int_zendesk__requester_wait_time_filtered_statuses"], "unique_id": "model.zendesk.int_zendesk__requester_wait_time_filtered_statuses", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "sla_policy/requester_wait_time/int_zendesk__requester_wait_time_filtered_statuses.sql", "original_file_path": "models/sla_policy/requester_wait_time/int_zendesk__requester_wait_time_filtered_statuses.sql", "name": "int_zendesk__requester_wait_time_filtered_statuses", "alias": "int_zendesk__requester_wait_time_filtered_statuses", "checksum": {"name": "sha256", "checksum": "7304fc3acc9d562799a1c4799a0a30e013c58f4fe2f8305c95d18abd6d603a18"}, "tags": [], "refs": [["int_zendesk__sla_policy_applied"], ["int_zendesk__ticket_historical_status"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/sla_policy/requester_wait_time/int_zendesk__requester_wait_time_filtered_statuses.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk_intermediate", "materialized": "table"}, "created_at": 1644618836.83667, "compiled_sql": "with requester_wait_time_sla as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__sla_policy_applied`\n where metric = 'requester_wait_time'\n\n), ticket_historical_status as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_status`\n \n--This captures the statuses of the ticket while the requester wait time sla was active for the ticket.\n), requester_wait_time_filtered_statuses as (\n\n select \n ticket_historical_status.ticket_id,\n greatest(ticket_historical_status.valid_starting_at, requester_wait_time_sla.sla_applied_at) as valid_starting_at,\n coalesce(\n ticket_historical_status.valid_ending_at, \n \n\n timestamp_add(\n current_timestamp\n, interval 30 day)\n\n ) as valid_ending_at, --assumes current status continues into the future. This is necessary to predict future SLA breaches (not just past).\n ticket_historical_status.status as ticket_status,\n requester_wait_time_sla.sla_applied_at,\n requester_wait_time_sla.target,\n requester_wait_time_sla.sla_policy_name,\n requester_wait_time_sla.ticket_created_at,\n requester_wait_time_sla.in_business_hours\n from ticket_historical_status\n join requester_wait_time_sla\n on ticket_historical_status.ticket_id = requester_wait_time_sla.ticket_id\n where ticket_historical_status.status in ('new', 'open', 'on-hold') -- these are the only statuses that count as \"requester wait time\"\n and sla_applied_at < valid_ending_at\n\n)\nselect *\nfrom requester_wait_time_filtered_statuses", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__requester_wait_time_filtered_statuses`"}, "model.zendesk.int_zendesk__ticket_reply_times": {"raw_sql": "with ticket_public_comments as (\n\n select *\n from {{ ref('int_zendesk__comments_enriched') }}\n where is_public\n\n), end_user_comments as (\n \n select \n ticket_id,\n valid_starting_at as end_user_comment_created_at,\n ticket_created_date,\n commenter_role,\n previous_commenter_role = 'first_comment' as is_first_comment\n from ticket_public_comments \n where (commenter_role = 'external_comment'\n and ticket_public_comments.previous_commenter_role != 'external_comment') -- we only care about net new end user comments\n or previous_commenter_role = 'first_comment' -- We also want to take into consideration internal first comment replies\n\n), reply_timestamps as ( \n\n select\n end_user_comments.ticket_id,\n -- If the commentor was internal and a first comment then we want the ticket created date to be the end user comment created date\n -- Otherwise we will want to end user comment created date\n case when end_user_comments.is_first_comment\n then end_user_comments.ticket_created_date\n else end_user_comments.end_user_comment_created_at\n end as end_user_comment_created_at,\n end_user_comments.is_first_comment,\n min(agent_comments.valid_starting_at) as agent_responded_at\n from end_user_comments\n left join ticket_public_comments as agent_comments\n on agent_comments.ticket_id = end_user_comments.ticket_id\n and agent_comments.commenter_role = 'internal_comment'\n and agent_comments.valid_starting_at > end_user_comments.end_user_comment_created_at\n group by 1,2,3\n\n)\n\n select\n *,\n ({{ fivetran_utils.timestamp_diff(\n 'end_user_comment_created_at',\n 'agent_responded_at',\n 'second') }} / 60) as reply_time_calendar_minutes\n from reply_timestamps\n order by 1,2", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.fivetran_utils.timestamp_diff"], "nodes": ["model.zendesk.int_zendesk__comments_enriched"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk", "database": null, "tags": [], "meta": {}, "materialized": "ephemeral", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk", "fqn": ["zendesk", "reply_times", "int_zendesk__ticket_reply_times"], "unique_id": "model.zendesk.int_zendesk__ticket_reply_times", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "reply_times/int_zendesk__ticket_reply_times.sql", "original_file_path": "models/reply_times/int_zendesk__ticket_reply_times.sql", "name": "int_zendesk__ticket_reply_times", "alias": "int_zendesk__ticket_reply_times", "checksum": {"name": "sha256", "checksum": "a0cf63d03768d10e92f53a1fa8488a75ff5ac31bd0c7ba5b10205c2dbc75634b"}, "tags": [], "refs": [["int_zendesk__comments_enriched"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/reply_times/int_zendesk__ticket_reply_times.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk", "materialized": "ephemeral"}, "created_at": 1644618836.8433468, "compiled_sql": "with __dbt__cte__int_zendesk__comments_enriched as (\nwith ticket_comment as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__updates`\n where field_name = 'comment'\n\n), users as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__user`\n\n), joined as (\n\n select \n\n ticket_comment.*,\n case when commenter.role = 'end-user' then 'external_comment'\n when commenter.role in ('agent','admin') then 'internal_comment'\n else 'unknown' end as commenter_role\n \n from ticket_comment\n \n join users as commenter\n on commenter.user_id = ticket_comment.user_id\n\n), add_previous_commenter_role as (\n /*\n In int_zendesk__ticket_reply_times we will only be focusing on reply times between public tickets.\n The below union explicitly identifies the previous commentor roles of public and not public comments.\n */\n select\n *,\n coalesce(\n lag(commenter_role) over (partition by ticket_id order by valid_starting_at)\n , 'first_comment') \n as previous_commenter_role\n from joined\n where is_public\n\n union all\n\n select\n *,\n 'non_public_comment' as previous_commenter_role\n from joined\n where not is_public\n)\n\nselect \n *,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_comment_added_at\nfrom add_previous_commenter_role\n),ticket_public_comments as (\n\n select *\n from __dbt__cte__int_zendesk__comments_enriched\n where is_public\n\n), end_user_comments as (\n \n select \n ticket_id,\n valid_starting_at as end_user_comment_created_at,\n ticket_created_date,\n commenter_role,\n previous_commenter_role = 'first_comment' as is_first_comment\n from ticket_public_comments \n where (commenter_role = 'external_comment'\n and ticket_public_comments.previous_commenter_role != 'external_comment') -- we only care about net new end user comments\n or previous_commenter_role = 'first_comment' -- We also want to take into consideration internal first comment replies\n\n), reply_timestamps as ( \n\n select\n end_user_comments.ticket_id,\n -- If the commentor was internal and a first comment then we want the ticket created date to be the end user comment created date\n -- Otherwise we will want to end user comment created date\n case when end_user_comments.is_first_comment\n then end_user_comments.ticket_created_date\n else end_user_comments.end_user_comment_created_at\n end as end_user_comment_created_at,\n end_user_comments.is_first_comment,\n min(agent_comments.valid_starting_at) as agent_responded_at\n from end_user_comments\n left join ticket_public_comments as agent_comments\n on agent_comments.ticket_id = end_user_comments.ticket_id\n and agent_comments.commenter_role = 'internal_comment'\n and agent_comments.valid_starting_at > end_user_comments.end_user_comment_created_at\n group by 1,2,3\n\n)\n\n select\n *,\n (\n \n\n timestamp_diff(\n agent_responded_at,\n end_user_comment_created_at,\n second\n )\n\n\n / 60) as reply_time_calendar_minutes\n from reply_timestamps\n order by 1,2", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.zendesk.int_zendesk__comments_enriched", "sql": " __dbt__cte__int_zendesk__comments_enriched as (\nwith ticket_comment as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__updates`\n where field_name = 'comment'\n\n), users as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__user`\n\n), joined as (\n\n select \n\n ticket_comment.*,\n case when commenter.role = 'end-user' then 'external_comment'\n when commenter.role in ('agent','admin') then 'internal_comment'\n else 'unknown' end as commenter_role\n \n from ticket_comment\n \n join users as commenter\n on commenter.user_id = ticket_comment.user_id\n\n), add_previous_commenter_role as (\n /*\n In int_zendesk__ticket_reply_times we will only be focusing on reply times between public tickets.\n The below union explicitly identifies the previous commentor roles of public and not public comments.\n */\n select\n *,\n coalesce(\n lag(commenter_role) over (partition by ticket_id order by valid_starting_at)\n , 'first_comment') \n as previous_commenter_role\n from joined\n where is_public\n\n union all\n\n select\n *,\n 'non_public_comment' as previous_commenter_role\n from joined\n where not is_public\n)\n\nselect \n *,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_comment_added_at\nfrom add_previous_commenter_role\n)"}], "relation_name": null}, "model.zendesk.int_zendesk__ticket_reply_times_calendar": {"raw_sql": "with ticket as (\n\n select *\n from {{ ref('stg_zendesk__ticket') }}\n\n), ticket_reply_times as (\n\n select *\n from {{ ref('int_zendesk__ticket_reply_times') }}\n\n)\n\nselect\n\n ticket.ticket_id,\n sum(case when is_first_comment then reply_time_calendar_minutes\n else null end) as first_reply_time_calendar_minutes,\n sum(reply_time_calendar_minutes) as total_reply_time_calendar_minutes --total combined time the customer waits for internal response\n \nfrom ticket\nleft join ticket_reply_times\n using (ticket_id)\n\ngroup by 1", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.zendesk_source.stg_zendesk__ticket", "model.zendesk.int_zendesk__ticket_reply_times"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk", "database": null, "tags": [], "meta": {}, "materialized": "ephemeral", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk", "fqn": ["zendesk", "reply_times", "int_zendesk__ticket_reply_times_calendar"], "unique_id": "model.zendesk.int_zendesk__ticket_reply_times_calendar", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "reply_times/int_zendesk__ticket_reply_times_calendar.sql", "original_file_path": "models/reply_times/int_zendesk__ticket_reply_times_calendar.sql", "name": "int_zendesk__ticket_reply_times_calendar", "alias": "int_zendesk__ticket_reply_times_calendar", "checksum": {"name": "sha256", "checksum": "6fb6a60134019d78fcfc8c135b4a7887b3ce52ec53d8db463194f7824d2c71c2"}, "tags": [], "refs": [["stg_zendesk__ticket"], ["int_zendesk__ticket_reply_times"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/reply_times/int_zendesk__ticket_reply_times_calendar.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk", "materialized": "ephemeral"}, "created_at": 1644618836.84902, "compiled_sql": "with __dbt__cte__int_zendesk__comments_enriched as (\nwith ticket_comment as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__updates`\n where field_name = 'comment'\n\n), users as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__user`\n\n), joined as (\n\n select \n\n ticket_comment.*,\n case when commenter.role = 'end-user' then 'external_comment'\n when commenter.role in ('agent','admin') then 'internal_comment'\n else 'unknown' end as commenter_role\n \n from ticket_comment\n \n join users as commenter\n on commenter.user_id = ticket_comment.user_id\n\n), add_previous_commenter_role as (\n /*\n In int_zendesk__ticket_reply_times we will only be focusing on reply times between public tickets.\n The below union explicitly identifies the previous commentor roles of public and not public comments.\n */\n select\n *,\n coalesce(\n lag(commenter_role) over (partition by ticket_id order by valid_starting_at)\n , 'first_comment') \n as previous_commenter_role\n from joined\n where is_public\n\n union all\n\n select\n *,\n 'non_public_comment' as previous_commenter_role\n from joined\n where not is_public\n)\n\nselect \n *,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_comment_added_at\nfrom add_previous_commenter_role\n), __dbt__cte__int_zendesk__ticket_reply_times as (\nwith ticket_public_comments as (\n\n select *\n from __dbt__cte__int_zendesk__comments_enriched\n where is_public\n\n), end_user_comments as (\n \n select \n ticket_id,\n valid_starting_at as end_user_comment_created_at,\n ticket_created_date,\n commenter_role,\n previous_commenter_role = 'first_comment' as is_first_comment\n from ticket_public_comments \n where (commenter_role = 'external_comment'\n and ticket_public_comments.previous_commenter_role != 'external_comment') -- we only care about net new end user comments\n or previous_commenter_role = 'first_comment' -- We also want to take into consideration internal first comment replies\n\n), reply_timestamps as ( \n\n select\n end_user_comments.ticket_id,\n -- If the commentor was internal and a first comment then we want the ticket created date to be the end user comment created date\n -- Otherwise we will want to end user comment created date\n case when end_user_comments.is_first_comment\n then end_user_comments.ticket_created_date\n else end_user_comments.end_user_comment_created_at\n end as end_user_comment_created_at,\n end_user_comments.is_first_comment,\n min(agent_comments.valid_starting_at) as agent_responded_at\n from end_user_comments\n left join ticket_public_comments as agent_comments\n on agent_comments.ticket_id = end_user_comments.ticket_id\n and agent_comments.commenter_role = 'internal_comment'\n and agent_comments.valid_starting_at > end_user_comments.end_user_comment_created_at\n group by 1,2,3\n\n)\n\n select\n *,\n (\n \n\n timestamp_diff(\n agent_responded_at,\n end_user_comment_created_at,\n second\n )\n\n\n / 60) as reply_time_calendar_minutes\n from reply_timestamps\n order by 1,2\n),ticket as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket`\n\n), ticket_reply_times as (\n\n select *\n from __dbt__cte__int_zendesk__ticket_reply_times\n\n)\n\nselect\n\n ticket.ticket_id,\n sum(case when is_first_comment then reply_time_calendar_minutes\n else null end) as first_reply_time_calendar_minutes,\n sum(reply_time_calendar_minutes) as total_reply_time_calendar_minutes --total combined time the customer waits for internal response\n \nfrom ticket\nleft join ticket_reply_times\n using (ticket_id)\n\ngroup by 1", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.zendesk.int_zendesk__comments_enriched", "sql": " __dbt__cte__int_zendesk__comments_enriched as (\nwith ticket_comment as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__updates`\n where field_name = 'comment'\n\n), users as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__user`\n\n), joined as (\n\n select \n\n ticket_comment.*,\n case when commenter.role = 'end-user' then 'external_comment'\n when commenter.role in ('agent','admin') then 'internal_comment'\n else 'unknown' end as commenter_role\n \n from ticket_comment\n \n join users as commenter\n on commenter.user_id = ticket_comment.user_id\n\n), add_previous_commenter_role as (\n /*\n In int_zendesk__ticket_reply_times we will only be focusing on reply times between public tickets.\n The below union explicitly identifies the previous commentor roles of public and not public comments.\n */\n select\n *,\n coalesce(\n lag(commenter_role) over (partition by ticket_id order by valid_starting_at)\n , 'first_comment') \n as previous_commenter_role\n from joined\n where is_public\n\n union all\n\n select\n *,\n 'non_public_comment' as previous_commenter_role\n from joined\n where not is_public\n)\n\nselect \n *,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_comment_added_at\nfrom add_previous_commenter_role\n)"}, {"id": "model.zendesk.int_zendesk__ticket_reply_times", "sql": " __dbt__cte__int_zendesk__ticket_reply_times as (\nwith ticket_public_comments as (\n\n select *\n from __dbt__cte__int_zendesk__comments_enriched\n where is_public\n\n), end_user_comments as (\n \n select \n ticket_id,\n valid_starting_at as end_user_comment_created_at,\n ticket_created_date,\n commenter_role,\n previous_commenter_role = 'first_comment' as is_first_comment\n from ticket_public_comments \n where (commenter_role = 'external_comment'\n and ticket_public_comments.previous_commenter_role != 'external_comment') -- we only care about net new end user comments\n or previous_commenter_role = 'first_comment' -- We also want to take into consideration internal first comment replies\n\n), reply_timestamps as ( \n\n select\n end_user_comments.ticket_id,\n -- If the commentor was internal and a first comment then we want the ticket created date to be the end user comment created date\n -- Otherwise we will want to end user comment created date\n case when end_user_comments.is_first_comment\n then end_user_comments.ticket_created_date\n else end_user_comments.end_user_comment_created_at\n end as end_user_comment_created_at,\n end_user_comments.is_first_comment,\n min(agent_comments.valid_starting_at) as agent_responded_at\n from end_user_comments\n left join ticket_public_comments as agent_comments\n on agent_comments.ticket_id = end_user_comments.ticket_id\n and agent_comments.commenter_role = 'internal_comment'\n and agent_comments.valid_starting_at > end_user_comments.end_user_comment_created_at\n group by 1,2,3\n\n)\n\n select\n *,\n (\n \n\n timestamp_diff(\n agent_responded_at,\n end_user_comment_created_at,\n second\n )\n\n\n / 60) as reply_time_calendar_minutes\n from reply_timestamps\n order by 1,2\n)"}], "relation_name": null}, "model.zendesk.int_zendesk__comments_enriched": {"raw_sql": "with ticket_comment as (\n\n select *\n from {{ ref('int_zendesk__updates') }}\n where field_name = 'comment'\n\n), users as (\n\n select *\n from {{ ref('stg_zendesk__user') }}\n\n), joined as (\n\n select \n\n ticket_comment.*,\n case when commenter.role = 'end-user' then 'external_comment'\n when commenter.role in ('agent','admin') then 'internal_comment'\n else 'unknown' end as commenter_role\n \n from ticket_comment\n \n join users as commenter\n on commenter.user_id = ticket_comment.user_id\n\n), add_previous_commenter_role as (\n /*\n In int_zendesk__ticket_reply_times we will only be focusing on reply times between public tickets.\n The below union explicitly identifies the previous commentor roles of public and not public comments.\n */\n select\n *,\n coalesce(\n lag(commenter_role) over (partition by ticket_id order by valid_starting_at)\n , 'first_comment') \n as previous_commenter_role\n from joined\n where is_public\n\n union all\n\n select\n *,\n 'non_public_comment' as previous_commenter_role\n from joined\n where not is_public\n)\n\nselect \n *,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_comment_added_at\nfrom add_previous_commenter_role", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.zendesk.int_zendesk__updates", "model.zendesk_source.stg_zendesk__user"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk", "database": null, "tags": [], "meta": {}, "materialized": "ephemeral", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk", "fqn": ["zendesk", "reply_times", "int_zendesk__comments_enriched"], "unique_id": "model.zendesk.int_zendesk__comments_enriched", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "reply_times/int_zendesk__comments_enriched.sql", "original_file_path": "models/reply_times/int_zendesk__comments_enriched.sql", "name": "int_zendesk__comments_enriched", "alias": "int_zendesk__comments_enriched", "checksum": {"name": "sha256", "checksum": "1bb86ed866847adbaa8c6dae7aff24a70e8a4c5c0df9e81297f4acf36b427425"}, "tags": [], "refs": [["int_zendesk__updates"], ["stg_zendesk__user"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/reply_times/int_zendesk__comments_enriched.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk", "materialized": "ephemeral"}, "created_at": 1644618836.852053, "compiled_sql": "with ticket_comment as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__updates`\n where field_name = 'comment'\n\n), users as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__user`\n\n), joined as (\n\n select \n\n ticket_comment.*,\n case when commenter.role = 'end-user' then 'external_comment'\n when commenter.role in ('agent','admin') then 'internal_comment'\n else 'unknown' end as commenter_role\n \n from ticket_comment\n \n join users as commenter\n on commenter.user_id = ticket_comment.user_id\n\n), add_previous_commenter_role as (\n /*\n In int_zendesk__ticket_reply_times we will only be focusing on reply times between public tickets.\n The below union explicitly identifies the previous commentor roles of public and not public comments.\n */\n select\n *,\n coalesce(\n lag(commenter_role) over (partition by ticket_id order by valid_starting_at)\n , 'first_comment') \n as previous_commenter_role\n from joined\n where is_public\n\n union all\n\n select\n *,\n 'non_public_comment' as previous_commenter_role\n from joined\n where not is_public\n)\n\nselect \n *,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_comment_added_at\nfrom add_previous_commenter_role", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null}, "model.zendesk.int_zendesk__ticket_first_reply_time_business": {"raw_sql": "{{ config(enabled=var('using_schedules', True)) }}\n\nwith ticket_reply_times as (\n\n select *\n from {{ ref('int_zendesk__ticket_reply_times') }}\n\n), ticket_schedules as (\n\n select *\n from {{ ref('int_zendesk__ticket_schedules') }}\n\n), schedule as (\n\n select *\n from {{ ref('int_zendesk__schedule_spine') }}\n\n), first_reply_time as (\n\n select\n ticket_id,\n end_user_comment_created_at,\n agent_responded_at\n\n from ticket_reply_times\n where is_first_comment\n\n), ticket_first_reply_time as (\n\n select \n first_reply_time.ticket_id,\n ticket_schedules.schedule_created_at,\n ticket_schedules.schedule_invalidated_at,\n ticket_schedules.schedule_id,\n\n -- bringing this in the determine which schedule (Daylight Savings vs Standard time) to use\n min(first_reply_time.agent_responded_at) as agent_responded_at,\n\n ({{ fivetran_utils.timestamp_diff(\n \"\" ~ dbt_utils.date_trunc('week', 'ticket_schedules.schedule_created_at') ~ \"\", \n 'ticket_schedules.schedule_created_at',\n 'second') }} /60\n ) as start_time_in_minutes_from_week,\n greatest(0,\n (\n {{ fivetran_utils.timestamp_diff(\n 'ticket_schedules.schedule_created_at',\n 'least(ticket_schedules.schedule_invalidated_at, min(first_reply_time.agent_responded_at))',\n 'second') }}/60\n )) as raw_delta_in_minutes\n \n from first_reply_time\n join ticket_schedules on first_reply_time.ticket_id = ticket_schedules.ticket_id\n group by 1, 2, 3, 4\n\n), weeks as (\n\n {{ dbt_utils.generate_series(208) }}\n\n), weeks_cross_ticket_first_reply as (\n -- because time is reported in minutes since the beginning of the week, we have to split up time spent on the ticket into calendar weeks\n select \n\n ticket_first_reply_time.*,\n generated_number - 1 as week_number\n\n from ticket_first_reply_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number - 1\n\n), weekly_periods as (\n \n select \n weeks_cross_ticket_first_reply.*, \n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n from weeks_cross_ticket_first_reply\n\n), intercepted_periods as (\n\n select ticket_id,\n week_number,\n weekly_periods.schedule_id,\n ticket_week_start_time,\n ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n -- this chooses the Daylight Savings Time or Standard Time version of the schedule\n and weekly_periods.agent_responded_at >= cast(schedule.valid_from as {{ dbt_utils.type_timestamp() }})\n and weekly_periods.agent_responded_at < cast(schedule.valid_until as {{ dbt_utils.type_timestamp() }}) \n\n)\n\n select ticket_id,\n sum(scheduled_minutes) as first_reply_time_business_minutes\n from intercepted_periods\n group by 1", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.date_trunc", "macro.fivetran_utils.timestamp_diff", "macro.dbt_utils.generate_series", "macro.dbt_utils.type_timestamp"], "nodes": ["model.zendesk.int_zendesk__ticket_reply_times", "model.zendesk.int_zendesk__ticket_schedules", "model.zendesk.int_zendesk__schedule_spine"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk", "database": null, "tags": [], "meta": {}, "materialized": "ephemeral", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk", "fqn": ["zendesk", "reply_times", "int_zendesk__ticket_first_reply_time_business"], "unique_id": "model.zendesk.int_zendesk__ticket_first_reply_time_business", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "reply_times/int_zendesk__ticket_first_reply_time_business.sql", "original_file_path": "models/reply_times/int_zendesk__ticket_first_reply_time_business.sql", "name": "int_zendesk__ticket_first_reply_time_business", "alias": "int_zendesk__ticket_first_reply_time_business", "checksum": {"name": "sha256", "checksum": "36546b8ae430a9dc5cc09b5330e0d2232fa12cc7f639e42521abb68a9bb60e26"}, "tags": [], "refs": [["int_zendesk__ticket_reply_times"], ["int_zendesk__ticket_schedules"], ["int_zendesk__schedule_spine"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/reply_times/int_zendesk__ticket_first_reply_time_business.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk", "materialized": "ephemeral", "enabled": true}, "created_at": 1644618836.8550231, "compiled_sql": "\n\nwith __dbt__cte__int_zendesk__comments_enriched as (\nwith ticket_comment as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__updates`\n where field_name = 'comment'\n\n), users as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__user`\n\n), joined as (\n\n select \n\n ticket_comment.*,\n case when commenter.role = 'end-user' then 'external_comment'\n when commenter.role in ('agent','admin') then 'internal_comment'\n else 'unknown' end as commenter_role\n \n from ticket_comment\n \n join users as commenter\n on commenter.user_id = ticket_comment.user_id\n\n), add_previous_commenter_role as (\n /*\n In int_zendesk__ticket_reply_times we will only be focusing on reply times between public tickets.\n The below union explicitly identifies the previous commentor roles of public and not public comments.\n */\n select\n *,\n coalesce(\n lag(commenter_role) over (partition by ticket_id order by valid_starting_at)\n , 'first_comment') \n as previous_commenter_role\n from joined\n where is_public\n\n union all\n\n select\n *,\n 'non_public_comment' as previous_commenter_role\n from joined\n where not is_public\n)\n\nselect \n *,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_comment_added_at\nfrom add_previous_commenter_role\n), __dbt__cte__int_zendesk__ticket_reply_times as (\nwith ticket_public_comments as (\n\n select *\n from __dbt__cte__int_zendesk__comments_enriched\n where is_public\n\n), end_user_comments as (\n \n select \n ticket_id,\n valid_starting_at as end_user_comment_created_at,\n ticket_created_date,\n commenter_role,\n previous_commenter_role = 'first_comment' as is_first_comment\n from ticket_public_comments \n where (commenter_role = 'external_comment'\n and ticket_public_comments.previous_commenter_role != 'external_comment') -- we only care about net new end user comments\n or previous_commenter_role = 'first_comment' -- We also want to take into consideration internal first comment replies\n\n), reply_timestamps as ( \n\n select\n end_user_comments.ticket_id,\n -- If the commentor was internal and a first comment then we want the ticket created date to be the end user comment created date\n -- Otherwise we will want to end user comment created date\n case when end_user_comments.is_first_comment\n then end_user_comments.ticket_created_date\n else end_user_comments.end_user_comment_created_at\n end as end_user_comment_created_at,\n end_user_comments.is_first_comment,\n min(agent_comments.valid_starting_at) as agent_responded_at\n from end_user_comments\n left join ticket_public_comments as agent_comments\n on agent_comments.ticket_id = end_user_comments.ticket_id\n and agent_comments.commenter_role = 'internal_comment'\n and agent_comments.valid_starting_at > end_user_comments.end_user_comment_created_at\n group by 1,2,3\n\n)\n\n select\n *,\n (\n \n\n timestamp_diff(\n agent_responded_at,\n end_user_comment_created_at,\n second\n )\n\n\n / 60) as reply_time_calendar_minutes\n from reply_timestamps\n order by 1,2\n),ticket_reply_times as (\n\n select *\n from __dbt__cte__int_zendesk__ticket_reply_times\n\n), ticket_schedules as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_schedules`\n\n), schedule as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__schedule_spine`\n\n), first_reply_time as (\n\n select\n ticket_id,\n end_user_comment_created_at,\n agent_responded_at\n\n from ticket_reply_times\n where is_first_comment\n\n), ticket_first_reply_time as (\n\n select \n first_reply_time.ticket_id,\n ticket_schedules.schedule_created_at,\n ticket_schedules.schedule_invalidated_at,\n ticket_schedules.schedule_id,\n\n -- bringing this in the determine which schedule (Daylight Savings vs Standard time) to use\n min(first_reply_time.agent_responded_at) as agent_responded_at,\n\n (\n \n\n timestamp_diff(\n ticket_schedules.schedule_created_at,\n \n timestamp_trunc(\n cast(ticket_schedules.schedule_created_at as timestamp),\n week\n )\n\n,\n second\n )\n\n\n /60\n ) as start_time_in_minutes_from_week,\n greatest(0,\n (\n \n \n\n timestamp_diff(\n least(ticket_schedules.schedule_invalidated_at, min(first_reply_time.agent_responded_at)),\n ticket_schedules.schedule_created_at,\n second\n )\n\n\n/60\n )) as raw_delta_in_minutes\n \n from first_reply_time\n join ticket_schedules on first_reply_time.ticket_id = ticket_schedules.ticket_id\n group by 1, 2, 3, 4\n\n), weeks as (\n\n \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * power(2, 0)\n + \n \n p1.generated_number * power(2, 1)\n + \n \n p2.generated_number * power(2, 2)\n + \n \n p3.generated_number * power(2, 3)\n + \n \n p4.generated_number * power(2, 4)\n + \n \n p5.generated_number * power(2, 5)\n + \n \n p6.generated_number * power(2, 6)\n + \n \n p7.generated_number * power(2, 7)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 208\n order by generated_number\n\n\n\n), weeks_cross_ticket_first_reply as (\n -- because time is reported in minutes since the beginning of the week, we have to split up time spent on the ticket into calendar weeks\n select \n\n ticket_first_reply_time.*,\n generated_number - 1 as week_number\n\n from ticket_first_reply_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number - 1\n\n), weekly_periods as (\n \n select \n weeks_cross_ticket_first_reply.*, \n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n from weeks_cross_ticket_first_reply\n\n), intercepted_periods as (\n\n select ticket_id,\n week_number,\n weekly_periods.schedule_id,\n ticket_week_start_time,\n ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n -- this chooses the Daylight Savings Time or Standard Time version of the schedule\n and weekly_periods.agent_responded_at >= cast(schedule.valid_from as \n timestamp\n)\n and weekly_periods.agent_responded_at < cast(schedule.valid_until as \n timestamp\n) \n\n)\n\n select ticket_id,\n sum(scheduled_minutes) as first_reply_time_business_minutes\n from intercepted_periods\n group by 1", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.zendesk.int_zendesk__comments_enriched", "sql": " __dbt__cte__int_zendesk__comments_enriched as (\nwith ticket_comment as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__updates`\n where field_name = 'comment'\n\n), users as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__user`\n\n), joined as (\n\n select \n\n ticket_comment.*,\n case when commenter.role = 'end-user' then 'external_comment'\n when commenter.role in ('agent','admin') then 'internal_comment'\n else 'unknown' end as commenter_role\n \n from ticket_comment\n \n join users as commenter\n on commenter.user_id = ticket_comment.user_id\n\n), add_previous_commenter_role as (\n /*\n In int_zendesk__ticket_reply_times we will only be focusing on reply times between public tickets.\n The below union explicitly identifies the previous commentor roles of public and not public comments.\n */\n select\n *,\n coalesce(\n lag(commenter_role) over (partition by ticket_id order by valid_starting_at)\n , 'first_comment') \n as previous_commenter_role\n from joined\n where is_public\n\n union all\n\n select\n *,\n 'non_public_comment' as previous_commenter_role\n from joined\n where not is_public\n)\n\nselect \n *,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_comment_added_at\nfrom add_previous_commenter_role\n)"}, {"id": "model.zendesk.int_zendesk__ticket_reply_times", "sql": " __dbt__cte__int_zendesk__ticket_reply_times as (\nwith ticket_public_comments as (\n\n select *\n from __dbt__cte__int_zendesk__comments_enriched\n where is_public\n\n), end_user_comments as (\n \n select \n ticket_id,\n valid_starting_at as end_user_comment_created_at,\n ticket_created_date,\n commenter_role,\n previous_commenter_role = 'first_comment' as is_first_comment\n from ticket_public_comments \n where (commenter_role = 'external_comment'\n and ticket_public_comments.previous_commenter_role != 'external_comment') -- we only care about net new end user comments\n or previous_commenter_role = 'first_comment' -- We also want to take into consideration internal first comment replies\n\n), reply_timestamps as ( \n\n select\n end_user_comments.ticket_id,\n -- If the commentor was internal and a first comment then we want the ticket created date to be the end user comment created date\n -- Otherwise we will want to end user comment created date\n case when end_user_comments.is_first_comment\n then end_user_comments.ticket_created_date\n else end_user_comments.end_user_comment_created_at\n end as end_user_comment_created_at,\n end_user_comments.is_first_comment,\n min(agent_comments.valid_starting_at) as agent_responded_at\n from end_user_comments\n left join ticket_public_comments as agent_comments\n on agent_comments.ticket_id = end_user_comments.ticket_id\n and agent_comments.commenter_role = 'internal_comment'\n and agent_comments.valid_starting_at > end_user_comments.end_user_comment_created_at\n group by 1,2,3\n\n)\n\n select\n *,\n (\n \n\n timestamp_diff(\n agent_responded_at,\n end_user_comment_created_at,\n second\n )\n\n\n / 60) as reply_time_calendar_minutes\n from reply_timestamps\n order by 1,2\n)"}], "relation_name": null}, "model.zendesk.int_zendesk__field_history_enriched": {"raw_sql": "with ticket_field_history as (\n\n select *\n from {{ ref('stg_zendesk__ticket_field_history') }}\n\n), updater_info as (\n select *\n from {{ ref('int_zendesk__updater_information') }}\n\n), final as (\n select\n ticket_field_history.*\n\n {% if var('ticket_field_history_updater_columns')%} --The below will be run if any fields are included in the variable within the dbt_project.yml.\n {% for col in var('ticket_field_history_updater_columns') %} --Iterating through the updater fields included in the variable.\n\n --The below statements are needed to populate Zendesk automated fields for when the zendesk triggers automatically change fields based on user defined triggers.\n {% if col in ['updater_is_active'] %}\n ,coalesce(updater_info.{{ col|lower }}, true) as {{ col }}\n\n {% elif col in ['updater_user_id','updater_organization_id'] %}\n ,coalesce(updater_info.{{ col|lower }}, -1) as {{ col }}\n \n {% elif col in ['updater_last_login_at'] %}\n ,coalesce(updater_info.{{ col|lower }}, current_timestamp) as {{ col }}\n \n {% else %}\n ,coalesce(updater_info.{{ col|lower }}, concat('zendesk_trigger_change_', '{{ col }}' )) as {{ col }}\n \n {% endif %}\n {% endfor %}\n {% endif %} \n\n from ticket_field_history\n\n left join updater_info\n on ticket_field_history.user_id = updater_info.updater_user_id\n)\nselect *\nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.zendesk_source.stg_zendesk__ticket_field_history", "model.zendesk.int_zendesk__updater_information"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "meta": {}, "materialized": "ephemeral", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_intermediate", "fqn": ["zendesk", "ticket_history", "int_zendesk__field_history_enriched"], "unique_id": "model.zendesk.int_zendesk__field_history_enriched", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "ticket_history/int_zendesk__field_history_enriched.sql", "original_file_path": "models/ticket_history/int_zendesk__field_history_enriched.sql", "name": "int_zendesk__field_history_enriched", "alias": "int_zendesk__field_history_enriched", "checksum": {"name": "sha256", "checksum": "ed29d2cf5bae22db49bfe045b4d8de74d14621182514e1fb8c47c28733c74b14"}, "tags": [], "refs": [["stg_zendesk__ticket_field_history"], ["int_zendesk__updater_information"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/ticket_history/int_zendesk__field_history_enriched.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk_intermediate", "materialized": "ephemeral"}, "created_at": 1644618836.8653738, "compiled_sql": "with __dbt__cte__int_zendesk__updater_information as (\nwith users as (\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__user_aggregates`\n\n), organizations as (\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__organization_aggregates`\n\n), final as (\n select\n users.user_id as updater_user_id\n ,users.name as updater_name\n ,users.role as updater_role\n ,users.email as updater_email\n ,users.external_id as updater_external_id\n ,users.locale as updater_locale\n ,users.is_active as updater_is_active\n\n --If you use user tags this will be included, if not it will be ignored.\n \n ,users.user_tags as updater_user_tags\n \n\n ,users.last_login_at as updater_last_login_at\n ,users.time_zone as updater_time_zone\n ,organizations.organization_id as updater_organization_id\n\n --If you use using_domain_names tags this will be included, if not it will be ignored.\n \n ,organizations.domain_names as updater_organization_domain_names\n \n\n --If you use organization tags this will be included, if not it will be ignored.\n \n ,organizations.organization_tags as updater_organization_organization_tags\n \n from users\n\n left join organizations\n using(organization_id)\n)\n\nselect * \nfrom final\n),ticket_field_history as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket_field_history`\n\n), updater_info as (\n select *\n from __dbt__cte__int_zendesk__updater_information\n\n), final as (\n select\n ticket_field_history.*\n\n \n\n from ticket_field_history\n\n left join updater_info\n on ticket_field_history.user_id = updater_info.updater_user_id\n)\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.zendesk.int_zendesk__updater_information", "sql": " __dbt__cte__int_zendesk__updater_information as (\nwith users as (\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__user_aggregates`\n\n), organizations as (\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__organization_aggregates`\n\n), final as (\n select\n users.user_id as updater_user_id\n ,users.name as updater_name\n ,users.role as updater_role\n ,users.email as updater_email\n ,users.external_id as updater_external_id\n ,users.locale as updater_locale\n ,users.is_active as updater_is_active\n\n --If you use user tags this will be included, if not it will be ignored.\n \n ,users.user_tags as updater_user_tags\n \n\n ,users.last_login_at as updater_last_login_at\n ,users.time_zone as updater_time_zone\n ,organizations.organization_id as updater_organization_id\n\n --If you use using_domain_names tags this will be included, if not it will be ignored.\n \n ,organizations.domain_names as updater_organization_domain_names\n \n\n --If you use organization tags this will be included, if not it will be ignored.\n \n ,organizations.organization_tags as updater_organization_organization_tags\n \n from users\n\n left join organizations\n using(organization_id)\n)\n\nselect * \nfrom final\n)"}], "relation_name": null}, "model.zendesk.int_zendesk__field_history_pivot": {"raw_sql": "-- depends_on: {{ ref('stg_zendesk__ticket_field_history') }}\n\n{{ \n config(\n materialized='incremental',\n partition_by = {'field': 'date_day', 'data_type': 'date'},\n unique_key='ticket_day_id'\n ) \n}}\n\n{% if execute -%}\n {% set results = run_query('select distinct field_name from ' ~ var('field_history')) %}\n {% set results_list = results.columns[0].values() %}\n{% endif -%}\n\nwith field_history as (\n\n select\n ticket_id,\n field_name,\n valid_ending_at,\n valid_starting_at\n\n --Only runs if the user passes updater fields through the final ticket field history model\n {% if var('ticket_field_history_updater_columns') %}\n ,\n {{ var('ticket_field_history_updater_columns') | join (\", \")}}\n\n {% endif %}\n\n -- doing this to figure out what values are actually null and what needs to be backfilled in zendesk__ticket_field_history\n ,case when value is null then 'is_null' else value end as value\n\n from {{ ref('int_zendesk__field_history_enriched') }}\n {% if is_incremental() %}\n where cast( {{ dbt_utils.date_trunc('day', 'valid_starting_at') }} as date) >= (select max(date_day) from {{ this }})\n {% endif %}\n\n), event_order as (\n\n select \n *,\n row_number() over (\n partition by cast(valid_starting_at as date), ticket_id, field_name\n order by valid_starting_at desc\n ) as row_num\n from field_history\n\n), filtered as (\n\n -- Find the last event that occurs on each day for each ticket\n\n select *\n from event_order\n where row_num = 1\n\n), pivots as (\n\n -- For each column that is in both the ticket_field_history_columns variable and the field_history table,\n -- pivot out the value into it's own column. This will feed the daily slowly changing dimension model.\n\n select \n ticket_id,\n cast({{ dbt_utils.date_trunc('day', 'valid_starting_at') }} as date) as date_day\n\n {% for col in results_list if col in var('ticket_field_history_columns') %}\n {% set col_xf = col|lower %}\n ,min(case when lower(field_name) = '{{ col|lower }}' then filtered.value end) as {{ col_xf }}\n\n --Only runs if the user passes updater fields through the final ticket field history model\n {% if var('ticket_field_history_updater_columns') %}\n\n {% for upd in var('ticket_field_history_updater_columns') %}\n\n {% set upd_xf = (col|lower + '_' + upd ) %} --Creating the appropriate column name based on the history field + update field names.\n\n {% if upd == 'updater_is_active' and target.type in ('postgres', 'redshift') %}\n\n ,bool_or(case when lower(field_name) = '{{ col|lower }}' then filtered.{{ upd }} end) as {{ upd_xf }}\n\n {% else %}\n\n ,min(case when lower(field_name) = '{{ col|lower }}' then filtered.{{ upd }} end) as {{ upd_xf }}\n\n {% endif %}\n {% endfor %}\n {% endif %}\n {% endfor %}\n \n from filtered\n group by 1,2\n\n), surrogate_key as (\n\n select \n *,\n {{ dbt_utils.surrogate_key(['ticket_id','date_day'])}} as ticket_day_id\n from pivots\n\n)\n\nselect *\nfrom surrogate_key", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt.is_incremental", "macro.dbt_utils.date_trunc", "macro.dbt_utils.surrogate_key", "macro.dbt.run_query"], "nodes": ["model.zendesk_source.stg_zendesk__ticket_field_history", "model.zendesk.int_zendesk__field_history_enriched"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "meta": {}, "materialized": "incremental", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "partition_by": {"field": "date_day", "data_type": "date"}, "unique_key": "ticket_day_id", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_intermediate", "fqn": ["zendesk", "ticket_history", "int_zendesk__field_history_pivot"], "unique_id": "model.zendesk.int_zendesk__field_history_pivot", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "ticket_history/int_zendesk__field_history_pivot.sql", "original_file_path": "models/ticket_history/int_zendesk__field_history_pivot.sql", "name": "int_zendesk__field_history_pivot", "alias": "int_zendesk__field_history_pivot", "checksum": {"name": "sha256", "checksum": "640f34352b199f132f1a862410be816d881428fb40d299f0d57554ff1c431119"}, "tags": [], "refs": [["stg_zendesk__ticket_field_history"], ["int_zendesk__field_history_enriched"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/ticket_history/int_zendesk__field_history_pivot.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk_intermediate", "materialized": "incremental", "partition_by": {"field": "date_day", "data_type": "date"}, "unique_key": "ticket_day_id"}, "created_at": 1644618836.874906, "compiled_sql": "-- depends_on: `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket_field_history`\n\n\n\n\n \nwith __dbt__cte__int_zendesk__updater_information as (\nwith users as (\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__user_aggregates`\n\n), organizations as (\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__organization_aggregates`\n\n), final as (\n select\n users.user_id as updater_user_id\n ,users.name as updater_name\n ,users.role as updater_role\n ,users.email as updater_email\n ,users.external_id as updater_external_id\n ,users.locale as updater_locale\n ,users.is_active as updater_is_active\n\n --If you use user tags this will be included, if not it will be ignored.\n \n ,users.user_tags as updater_user_tags\n \n\n ,users.last_login_at as updater_last_login_at\n ,users.time_zone as updater_time_zone\n ,organizations.organization_id as updater_organization_id\n\n --If you use using_domain_names tags this will be included, if not it will be ignored.\n \n ,organizations.domain_names as updater_organization_domain_names\n \n\n --If you use organization tags this will be included, if not it will be ignored.\n \n ,organizations.organization_tags as updater_organization_organization_tags\n \n from users\n\n left join organizations\n using(organization_id)\n)\n\nselect * \nfrom final\n), __dbt__cte__int_zendesk__field_history_enriched as (\nwith ticket_field_history as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket_field_history`\n\n), updater_info as (\n select *\n from __dbt__cte__int_zendesk__updater_information\n\n), final as (\n select\n ticket_field_history.*\n\n \n\n from ticket_field_history\n\n left join updater_info\n on ticket_field_history.user_id = updater_info.updater_user_id\n)\nselect *\nfrom final\n),field_history as (\n\n select\n ticket_id,\n field_name,\n valid_ending_at,\n valid_starting_at\n\n --Only runs if the user passes updater fields through the final ticket field history model\n \n\n -- doing this to figure out what values are actually null and what needs to be backfilled in zendesk__ticket_field_history\n ,case when value is null then 'is_null' else value end as value\n\n from __dbt__cte__int_zendesk__field_history_enriched\n \n where cast( \n timestamp_trunc(\n cast(valid_starting_at as timestamp),\n day\n )\n\n as date) >= (select max(date_day) from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__field_history_pivot`)\n \n\n), event_order as (\n\n select \n *,\n row_number() over (\n partition by cast(valid_starting_at as date), ticket_id, field_name\n order by valid_starting_at desc\n ) as row_num\n from field_history\n\n), filtered as (\n\n -- Find the last event that occurs on each day for each ticket\n\n select *\n from event_order\n where row_num = 1\n\n), pivots as (\n\n -- For each column that is in both the ticket_field_history_columns variable and the field_history table,\n -- pivot out the value into it's own column. This will feed the daily slowly changing dimension model.\n\n select \n ticket_id,\n cast(\n timestamp_trunc(\n cast(valid_starting_at as timestamp),\n day\n )\n\n as date) as date_day\n\n \n \n ,min(case when lower(field_name) = 'status' then filtered.value end) as status\n\n --Only runs if the user passes updater fields through the final ticket field history model\n \n \n \n ,min(case when lower(field_name) = 'priority' then filtered.value end) as priority\n\n --Only runs if the user passes updater fields through the final ticket field history model\n \n \n \n ,min(case when lower(field_name) = 'assignee_id' then filtered.value end) as assignee_id\n\n --Only runs if the user passes updater fields through the final ticket field history model\n \n \n \n from filtered\n group by 1,2\n\n), surrogate_key as (\n\n select \n *,\n to_hex(md5(cast(coalesce(cast(ticket_id as \n string\n), '') || '-' || coalesce(cast(date_day as \n string\n), '') as \n string\n))) as ticket_day_id\n from pivots\n\n)\n\nselect *\nfrom surrogate_key", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.zendesk.int_zendesk__updater_information", "sql": " __dbt__cte__int_zendesk__updater_information as (\nwith users as (\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__user_aggregates`\n\n), organizations as (\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__organization_aggregates`\n\n), final as (\n select\n users.user_id as updater_user_id\n ,users.name as updater_name\n ,users.role as updater_role\n ,users.email as updater_email\n ,users.external_id as updater_external_id\n ,users.locale as updater_locale\n ,users.is_active as updater_is_active\n\n --If you use user tags this will be included, if not it will be ignored.\n \n ,users.user_tags as updater_user_tags\n \n\n ,users.last_login_at as updater_last_login_at\n ,users.time_zone as updater_time_zone\n ,organizations.organization_id as updater_organization_id\n\n --If you use using_domain_names tags this will be included, if not it will be ignored.\n \n ,organizations.domain_names as updater_organization_domain_names\n \n\n --If you use organization tags this will be included, if not it will be ignored.\n \n ,organizations.organization_tags as updater_organization_organization_tags\n \n from users\n\n left join organizations\n using(organization_id)\n)\n\nselect * \nfrom final\n)"}, {"id": "model.zendesk.int_zendesk__field_history_enriched", "sql": " __dbt__cte__int_zendesk__field_history_enriched as (\nwith ticket_field_history as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket_field_history`\n\n), updater_info as (\n select *\n from __dbt__cte__int_zendesk__updater_information\n\n), final as (\n select\n ticket_field_history.*\n\n \n\n from ticket_field_history\n\n left join updater_info\n on ticket_field_history.user_id = updater_info.updater_user_id\n)\nselect *\nfrom final\n)"}], "relation_name": "`dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__field_history_pivot`"}, "model.zendesk.int_zendesk__updater_information": {"raw_sql": "with users as (\n select *\n from {{ ref('int_zendesk__user_aggregates') }}\n\n), organizations as (\n select *\n from {{ ref('int_zendesk__organization_aggregates') }}\n\n), final as (\n select\n users.user_id as updater_user_id\n ,users.name as updater_name\n ,users.role as updater_role\n ,users.email as updater_email\n ,users.external_id as updater_external_id\n ,users.locale as updater_locale\n ,users.is_active as updater_is_active\n\n --If you use user tags this will be included, if not it will be ignored.\n {% if var('using_user_tags', True) %}\n ,users.user_tags as updater_user_tags\n {% endif %}\n\n ,users.last_login_at as updater_last_login_at\n ,users.time_zone as updater_time_zone\n ,organizations.organization_id as updater_organization_id\n\n --If you use using_domain_names tags this will be included, if not it will be ignored.\n {% if var('using_domain_names', True) %}\n ,organizations.domain_names as updater_organization_domain_names\n {% endif %}\n\n --If you use organization tags this will be included, if not it will be ignored.\n {% if var('using_organization_tags', True) %}\n ,organizations.organization_tags as updater_organization_organization_tags\n {% endif %}\n from users\n\n left join organizations\n using(organization_id)\n)\n\nselect * \nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.zendesk.int_zendesk__user_aggregates", "model.zendesk.int_zendesk__organization_aggregates"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "meta": {}, "materialized": "ephemeral", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_intermediate", "fqn": ["zendesk", "ticket_history", "int_zendesk__updater_information"], "unique_id": "model.zendesk.int_zendesk__updater_information", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "ticket_history/int_zendesk__updater_information.sql", "original_file_path": "models/ticket_history/int_zendesk__updater_information.sql", "name": "int_zendesk__updater_information", "alias": "int_zendesk__updater_information", "checksum": {"name": "sha256", "checksum": "62a690646cff991c0e0b6e205440a070bb44aab8d4d9286714710c52a4c6677a"}, "tags": [], "refs": [["int_zendesk__user_aggregates"], ["int_zendesk__organization_aggregates"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/ticket_history/int_zendesk__updater_information.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk_intermediate", "materialized": "ephemeral"}, "created_at": 1644618836.891498, "compiled_sql": "with users as (\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__user_aggregates`\n\n), organizations as (\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__organization_aggregates`\n\n), final as (\n select\n users.user_id as updater_user_id\n ,users.name as updater_name\n ,users.role as updater_role\n ,users.email as updater_email\n ,users.external_id as updater_external_id\n ,users.locale as updater_locale\n ,users.is_active as updater_is_active\n\n --If you use user tags this will be included, if not it will be ignored.\n \n ,users.user_tags as updater_user_tags\n \n\n ,users.last_login_at as updater_last_login_at\n ,users.time_zone as updater_time_zone\n ,organizations.organization_id as updater_organization_id\n\n --If you use using_domain_names tags this will be included, if not it will be ignored.\n \n ,organizations.domain_names as updater_organization_domain_names\n \n\n --If you use organization tags this will be included, if not it will be ignored.\n \n ,organizations.organization_tags as updater_organization_organization_tags\n \n from users\n\n left join organizations\n using(organization_id)\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null}, "model.zendesk.int_zendesk__field_history_scd": {"raw_sql": "-- model needs to materialize as a table to avoid erroneous null values\n{{ config( materialized='table') }} \n\n{%- set ticket_columns = adapter.get_columns_in_relation(ref('int_zendesk__field_history_pivot')) -%}\n\nwith change_data as (\n\n select *\n from {{ ref('int_zendesk__field_history_pivot') }}\n\n), set_values as (\n\n-- each row of the pivoted table includes field values if that field was updated on that day\n-- we need to backfill to persist values that have been previously updated and are still valid \n select \n date_day as valid_from,\n ticket_id,\n ticket_day_id\n\n {% for col in ticket_columns if col.name|lower not in ['date_day','ending_day','ticket_id','ticket_day_id'] %} \n\n ,{{ col.name }}\n ,sum(case when {{ col.name }} is null \n then 0 \n else 1 \n end) over (order by ticket_id, date_day rows unbounded preceding) as {{ col.name }}_field_patition\n {% endfor %}\n\n from change_data\n\n), fill_values as (\n select\n valid_from, \n ticket_id,\n ticket_day_id\n\n {% for col in ticket_columns if col.name|lower not in ['date_day','ending_day','ticket_id','ticket_day_id'] %} \n\n ,first_value( {{ col.name }} ) over (partition by {{ col.name }}_field_patition order by valid_from asc rows between unbounded preceding and current row) as {{ col.name }}\n \n {% endfor %}\n from set_values\n) \n\nselect *\nfrom fill_values", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.zendesk.int_zendesk__field_history_pivot", "model.zendesk.int_zendesk__field_history_pivot"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_intermediate", "fqn": ["zendesk", "ticket_history", "int_zendesk__field_history_scd"], "unique_id": "model.zendesk.int_zendesk__field_history_scd", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "ticket_history/int_zendesk__field_history_scd.sql", "original_file_path": "models/ticket_history/int_zendesk__field_history_scd.sql", "name": "int_zendesk__field_history_scd", "alias": "int_zendesk__field_history_scd", "checksum": {"name": "sha256", "checksum": "6eeb89121a9f0ae93c619df35c1ff7b997fdb77d12e465fff26e5f65a3643329"}, "tags": [], "refs": [["int_zendesk__field_history_pivot"], ["int_zendesk__field_history_pivot"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/ticket_history/int_zendesk__field_history_scd.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk_intermediate", "materialized": "table"}, "created_at": 1644618836.8992798, "compiled_sql": "-- model needs to materialize as a table to avoid erroneous null values\nwith change_data as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__field_history_pivot`\n\n), set_values as (\n\n-- each row of the pivoted table includes field values if that field was updated on that day\n-- we need to backfill to persist values that have been previously updated and are still valid \n select \n date_day as valid_from,\n ticket_id,\n ticket_day_id\n\n \n\n ,status\n ,sum(case when status is null \n then 0 \n else 1 \n end) over (order by ticket_id, date_day rows unbounded preceding) as status_field_patition\n \n\n ,priority\n ,sum(case when priority is null \n then 0 \n else 1 \n end) over (order by ticket_id, date_day rows unbounded preceding) as priority_field_patition\n \n\n ,assignee_id\n ,sum(case when assignee_id is null \n then 0 \n else 1 \n end) over (order by ticket_id, date_day rows unbounded preceding) as assignee_id_field_patition\n \n\n from change_data\n\n), fill_values as (\n select\n valid_from, \n ticket_id,\n ticket_day_id\n\n \n\n ,first_value( status ) over (partition by status_field_patition order by valid_from asc rows between unbounded preceding and current row) as status\n \n \n\n ,first_value( priority ) over (partition by priority_field_patition order by valid_from asc rows between unbounded preceding and current row) as priority\n \n \n\n ,first_value( assignee_id ) over (partition by assignee_id_field_patition order by valid_from asc rows between unbounded preceding and current row) as assignee_id\n \n \n from set_values\n) \n\nselect *\nfrom fill_values", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__field_history_scd`"}, "model.zendesk.int_zendesk__field_calendar_spine": {"raw_sql": "{{\n config(\n materialized='incremental',\n partition_by = {'field': 'date_day', 'data_type': 'date'},\n unique_key='ticket_day_id'\n )\n}}\n\nwith calendar as (\n\n select *\n from {{ ref('int_zendesk__calendar_spine') }}\n {% if is_incremental() %}\n where date_day >= (select max(date_day) from {{ this }})\n {% endif %}\n\n), ticket as (\n\n select \n *,\n -- closed tickets cannot be re-opened or updated, and solved tickets are automatically closed after a pre-defined number of days configured in your Zendesk settings\n cast( {{ dbt_utils.date_trunc('day', \"case when status != 'closed' then \" ~ dbt_utils.current_timestamp() ~ \" else updated_at end\") }} as date) as open_until\n from {{ var('ticket') }}\n \n), joined as (\n\n select \n calendar.date_day,\n ticket.ticket_id\n from calendar\n inner join ticket\n on calendar.date_day >= cast(ticket.created_at as date)\n -- use this variable to extend the ticket's history past its close date (for reporting/data viz purposes :-)\n and {{ dbt_utils.dateadd('month', var('ticket_field_history_extension_months', 0), 'ticket.open_until') }} >= calendar.date_day\n\n), surrogate_key as (\n\n select\n *,\n {{ dbt_utils.surrogate_key(['date_day','ticket_id']) }} as ticket_day_id\n from joined\n\n)\n\nselect *\nfrom surrogate_key", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt.is_incremental", "macro.dbt_utils.current_timestamp", "macro.dbt_utils.date_trunc", "macro.dbt_utils.dateadd", "macro.dbt_utils.surrogate_key"], "nodes": ["model.zendesk.int_zendesk__calendar_spine", "model.zendesk_source.stg_zendesk__ticket"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "meta": {}, "materialized": "incremental", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "partition_by": {"field": "date_day", "data_type": "date"}, "unique_key": "ticket_day_id", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_intermediate", "fqn": ["zendesk", "ticket_history", "int_zendesk__field_calendar_spine"], "unique_id": "model.zendesk.int_zendesk__field_calendar_spine", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "ticket_history/int_zendesk__field_calendar_spine.sql", "original_file_path": "models/ticket_history/int_zendesk__field_calendar_spine.sql", "name": "int_zendesk__field_calendar_spine", "alias": "int_zendesk__field_calendar_spine", "checksum": {"name": "sha256", "checksum": "b0ea1607b99a53a9e02cdeec7699a20cea85981a56d8fa8f39bed2e65dac39a5"}, "tags": [], "refs": [["int_zendesk__calendar_spine"], ["stg_zendesk__ticket"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/ticket_history/int_zendesk__field_calendar_spine.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk_intermediate", "materialized": "incremental", "partition_by": {"field": "date_day", "data_type": "date"}, "unique_key": "ticket_day_id"}, "created_at": 1644618836.908659, "compiled_sql": "\n\nwith __dbt__cte__int_zendesk__calendar_spine as (\n-- depends_on: `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket`\n\nwith spine as (\n\n \n \n\n \n \n \n \n\n \n\n \n\n \n\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 \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * power(2, 0)\n + \n \n p1.generated_number * power(2, 1)\n + \n \n p2.generated_number * power(2, 2)\n + \n \n p3.generated_number * power(2, 3)\n + \n \n p4.generated_number * power(2, 4)\n + \n \n p5.generated_number * power(2, 5)\n + \n \n p6.generated_number * power(2, 6)\n + \n \n p7.generated_number * power(2, 7)\n + \n \n p8.generated_number * power(2, 8)\n + \n \n p9.generated_number * power(2, 9)\n + \n \n p10.generated_number * power(2, 10)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n cross join \n \n p as p8\n cross join \n \n p as p9\n cross join \n \n p as p10\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 1216\n order by generated_number\n\n\n\n),\n\nall_periods as (\n\n select (\n \n\n datetime_add(\n cast( '2018-10-21' as datetime),\n interval row_number() over (order by 1) - 1 day\n )\n\n\n ) as date_day\n from rawdata\n\n),\n\nfiltered as (\n\n select *\n from all_periods\n where date_day <= \n\n datetime_add(\n cast( current_date as datetime),\n interval 1 week\n )\n\n\n\n)\n\nselect * from filtered\n\n\n\n), recast as (\n\n select cast(date_day as date) as date_day\n from spine\n\n)\n\nselect *\nfrom recast\n),calendar as (\n\n select *\n from __dbt__cte__int_zendesk__calendar_spine\n \n where date_day >= (select max(date_day) from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__field_calendar_spine`)\n \n\n), ticket as (\n\n select \n *,\n -- closed tickets cannot be re-opened or updated, and solved tickets are automatically closed after a pre-defined number of days configured in your Zendesk settings\n cast( \n timestamp_trunc(\n cast(case when status != 'closed' then \n current_timestamp\n else updated_at end as timestamp),\n day\n )\n\n as date) as open_until\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket`\n \n), joined as (\n\n select \n calendar.date_day,\n ticket.ticket_id\n from calendar\n inner join ticket\n on calendar.date_day >= cast(ticket.created_at as date)\n -- use this variable to extend the ticket's history past its close date (for reporting/data viz purposes :-)\n and \n\n datetime_add(\n cast( ticket.open_until as datetime),\n interval 0 month\n )\n\n >= calendar.date_day\n\n), surrogate_key as (\n\n select\n *,\n to_hex(md5(cast(coalesce(cast(date_day as \n string\n), '') || '-' || coalesce(cast(ticket_id as \n string\n), '') as \n string\n))) as ticket_day_id\n from joined\n\n)\n\nselect *\nfrom surrogate_key", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.zendesk.int_zendesk__calendar_spine", "sql": " __dbt__cte__int_zendesk__calendar_spine as (\n-- depends_on: `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket`\n\nwith spine as (\n\n \n \n\n \n \n \n \n\n \n\n \n\n \n\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 \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * power(2, 0)\n + \n \n p1.generated_number * power(2, 1)\n + \n \n p2.generated_number * power(2, 2)\n + \n \n p3.generated_number * power(2, 3)\n + \n \n p4.generated_number * power(2, 4)\n + \n \n p5.generated_number * power(2, 5)\n + \n \n p6.generated_number * power(2, 6)\n + \n \n p7.generated_number * power(2, 7)\n + \n \n p8.generated_number * power(2, 8)\n + \n \n p9.generated_number * power(2, 9)\n + \n \n p10.generated_number * power(2, 10)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n cross join \n \n p as p8\n cross join \n \n p as p9\n cross join \n \n p as p10\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 1216\n order by generated_number\n\n\n\n),\n\nall_periods as (\n\n select (\n \n\n datetime_add(\n cast( '2018-10-21' as datetime),\n interval row_number() over (order by 1) - 1 day\n )\n\n\n ) as date_day\n from rawdata\n\n),\n\nfiltered as (\n\n select *\n from all_periods\n where date_day <= \n\n datetime_add(\n cast( current_date as datetime),\n interval 1 week\n )\n\n\n\n)\n\nselect * from filtered\n\n\n\n), recast as (\n\n select cast(date_day as date) as date_day\n from spine\n\n)\n\nselect *\nfrom recast\n)"}], "relation_name": "`dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__field_calendar_spine`"}, "model.zendesk.int_zendesk__ticket_work_time_calendar": {"raw_sql": "with ticket_historical_status as (\n\n select *\n from {{ ref('int_zendesk__ticket_historical_status') }}\n\n), calendar_minutes as (\n \n select \n ticket_id,\n status,\n case when status in ('pending') then status_duration_calendar_minutes\n else 0 end as agent_wait_time_in_minutes,\n case when status in ('new', 'open', 'hold') then status_duration_calendar_minutes\n else 0 end as requester_wait_time_in_minutes,\n case when status in ('new', 'open') then status_duration_calendar_minutes\n else 0 end as agent_work_time_in_minutes,\n case when status in ('hold') then status_duration_calendar_minutes\n else 0 end as on_hold_time_in_minutes,\n case when status = 'new' then status_duration_calendar_minutes\n else 0 end as new_status_duration_minutes,\n case when status = 'open' then status_duration_calendar_minutes\n else 0 end as open_status_duration_minutes,\n case when status = 'deleted' then 1\n else 0 end as ticket_deleted,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_status_assignment_date,\n case when lag(status) over (partition by ticket_id order by valid_starting_at) = 'deleted' and status != 'deleted'\n then 1\n else 0\n end as ticket_recoveries\n\n from ticket_historical_status\n\n)\n\nselect \n ticket_id,\n last_status_assignment_date,\n sum(ticket_deleted) as ticket_deleted_count,\n sum(agent_wait_time_in_minutes) as agent_wait_time_in_calendar_minutes,\n sum(requester_wait_time_in_minutes) as requester_wait_time_in_calendar_minutes,\n sum(agent_work_time_in_minutes) as agent_work_time_in_calendar_minutes,\n sum(on_hold_time_in_minutes) as on_hold_time_in_calendar_minutes,\n sum(new_status_duration_minutes) as new_status_duration_in_calendar_minutes,\n sum(open_status_duration_minutes) as open_status_duration_in_calendar_minutes,\n sum(ticket_recoveries) as total_ticket_recoveries\nfrom calendar_minutes\ngroup by 1, 2", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.zendesk.int_zendesk__ticket_historical_status"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk", "database": null, "tags": [], "meta": {}, "materialized": "ephemeral", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk", "fqn": ["zendesk", "agent_work_time", "int_zendesk__ticket_work_time_calendar"], "unique_id": "model.zendesk.int_zendesk__ticket_work_time_calendar", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "agent_work_time/int_zendesk__ticket_work_time_calendar.sql", "original_file_path": "models/agent_work_time/int_zendesk__ticket_work_time_calendar.sql", "name": "int_zendesk__ticket_work_time_calendar", "alias": "int_zendesk__ticket_work_time_calendar", "checksum": {"name": "sha256", "checksum": "cf3556742d3de31832862939ef3e9ef76e09762949db514b4a8e125953460c10"}, "tags": [], "refs": [["int_zendesk__ticket_historical_status"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/agent_work_time/int_zendesk__ticket_work_time_calendar.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk", "materialized": "ephemeral"}, "created_at": 1644618836.922969, "compiled_sql": "with ticket_historical_status as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_status`\n\n), calendar_minutes as (\n \n select \n ticket_id,\n status,\n case when status in ('pending') then status_duration_calendar_minutes\n else 0 end as agent_wait_time_in_minutes,\n case when status in ('new', 'open', 'hold') then status_duration_calendar_minutes\n else 0 end as requester_wait_time_in_minutes,\n case when status in ('new', 'open') then status_duration_calendar_minutes\n else 0 end as agent_work_time_in_minutes,\n case when status in ('hold') then status_duration_calendar_minutes\n else 0 end as on_hold_time_in_minutes,\n case when status = 'new' then status_duration_calendar_minutes\n else 0 end as new_status_duration_minutes,\n case when status = 'open' then status_duration_calendar_minutes\n else 0 end as open_status_duration_minutes,\n case when status = 'deleted' then 1\n else 0 end as ticket_deleted,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_status_assignment_date,\n case when lag(status) over (partition by ticket_id order by valid_starting_at) = 'deleted' and status != 'deleted'\n then 1\n else 0\n end as ticket_recoveries\n\n from ticket_historical_status\n\n)\n\nselect \n ticket_id,\n last_status_assignment_date,\n sum(ticket_deleted) as ticket_deleted_count,\n sum(agent_wait_time_in_minutes) as agent_wait_time_in_calendar_minutes,\n sum(requester_wait_time_in_minutes) as requester_wait_time_in_calendar_minutes,\n sum(agent_work_time_in_minutes) as agent_work_time_in_calendar_minutes,\n sum(on_hold_time_in_minutes) as on_hold_time_in_calendar_minutes,\n sum(new_status_duration_minutes) as new_status_duration_in_calendar_minutes,\n sum(open_status_duration_minutes) as open_status_duration_in_calendar_minutes,\n sum(ticket_recoveries) as total_ticket_recoveries\nfrom calendar_minutes\ngroup by 1, 2", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null}, "model.zendesk.int_zendesk__ticket_work_time_business": {"raw_sql": "{{ config(enabled=var('using_schedules', True)) }}\n\nwith ticket_historical_status as (\n\n select *\n from {{ ref('int_zendesk__ticket_historical_status') }}\n\n), ticket_schedules as (\n\n select *\n from {{ ref('int_zendesk__ticket_schedules') }}\n\n), schedule as (\n\n select *\n from {{ ref('int_zendesk__schedule_spine') }}\n\n), ticket_status_crossed_with_schedule as (\n \n select\n ticket_historical_status.ticket_id,\n ticket_historical_status.status as ticket_status,\n ticket_schedules.schedule_id,\n\n -- take the intersection of the intervals in which the status and the schedule were both active, for calculating the business minutes spent working on the ticket\n greatest(valid_starting_at, schedule_created_at) as status_schedule_start,\n least(valid_ending_at, schedule_invalidated_at) as status_schedule_end,\n\n -- bringing the following in the determine which schedule (Daylight Savings vs Standard time) to use\n ticket_historical_status.valid_starting_at as status_valid_starting_at,\n ticket_historical_status.valid_ending_at as status_valid_ending_at\n\n from ticket_historical_status\n left join ticket_schedules\n on ticket_historical_status.ticket_id = ticket_schedules.ticket_id\n where {{ fivetran_utils.timestamp_diff('greatest(valid_starting_at, schedule_created_at)', 'least(valid_ending_at, schedule_invalidated_at)', 'second') }} > 0\n\n), ticket_full_solved_time as (\n\n select \n ticket_status_crossed_with_schedule.*,\n ({{ fivetran_utils.timestamp_diff(\n \"\" ~ dbt_utils.date_trunc('week', 'ticket_status_crossed_with_schedule.status_schedule_start') ~ \"\", \n 'ticket_status_crossed_with_schedule.status_schedule_start',\n 'second') }} /60\n ) as start_time_in_minutes_from_week,\n ({{ fivetran_utils.timestamp_diff(\n 'ticket_status_crossed_with_schedule.status_schedule_start',\n 'ticket_status_crossed_with_schedule.status_schedule_end',\n 'second') }} /60\n ) as raw_delta_in_minutes\n from ticket_status_crossed_with_schedule\n {{ dbt_utils.group_by(n=7) }}\n\n), weeks as (\n\n {{ dbt_utils.generate_series(208) }}\n\n), weeks_cross_ticket_full_solved_time as (\n -- because time is reported in minutes since the beginning of the week, we have to split up time spent on the ticket into calendar weeks\n select \n ticket_full_solved_time.*,\n generated_number - 1 as week_number\n from ticket_full_solved_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number -1\n\n), weekly_periods as (\n\n select\n\n weeks_cross_ticket_full_solved_time.*,\n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n \n from weeks_cross_ticket_full_solved_time\n\n), intercepted_periods as (\n \n select \n weekly_periods.ticket_id,\n weekly_periods.week_number,\n weekly_periods.schedule_id,\n weekly_periods.ticket_status,\n weekly_periods.ticket_week_start_time,\n weekly_periods.ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(weekly_periods.ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n -- this chooses the Daylight Savings Time or Standard Time version of the schedule\n and weekly_periods.status_valid_ending_at >= cast(schedule.valid_from as {{ dbt_utils.type_timestamp() }})\n and weekly_periods.status_valid_starting_at < cast(schedule.valid_until as {{ dbt_utils.type_timestamp() }}) \n \n), business_minutes as (\n \n select \n ticket_id,\n ticket_status,\n case when ticket_status in ('pending') then scheduled_minutes\n else 0 end as agent_wait_time_in_minutes,\n case when ticket_status in ('new', 'open', 'hold') then scheduled_minutes\n else 0 end as requester_wait_time_in_minutes,\n case when ticket_status in ('new', 'open') then scheduled_minutes\n else 0 end as agent_work_time_in_minutes,\n case when ticket_status in ('hold') then scheduled_minutes\n else 0 end as on_hold_time_in_minutes\n from intercepted_periods\n\n)\n \n select \n ticket_id,\n sum(agent_wait_time_in_minutes) as agent_wait_time_in_business_minutes,\n sum(requester_wait_time_in_minutes) as requester_wait_time_in_business_minutes,\n sum(agent_work_time_in_minutes) as agent_work_time_in_business_minutes,\n sum(on_hold_time_in_minutes) as on_hold_time_in_business_minutes\n from business_minutes\n group by 1", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.fivetran_utils.timestamp_diff", "macro.dbt_utils.date_trunc", "macro.dbt_utils.group_by", "macro.dbt_utils.generate_series", "macro.dbt_utils.type_timestamp"], "nodes": ["model.zendesk.int_zendesk__ticket_historical_status", "model.zendesk.int_zendesk__ticket_schedules", "model.zendesk.int_zendesk__schedule_spine"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk", "database": null, "tags": [], "meta": {}, "materialized": "ephemeral", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk", "fqn": ["zendesk", "agent_work_time", "int_zendesk__ticket_work_time_business"], "unique_id": "model.zendesk.int_zendesk__ticket_work_time_business", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "agent_work_time/int_zendesk__ticket_work_time_business.sql", "original_file_path": "models/agent_work_time/int_zendesk__ticket_work_time_business.sql", "name": "int_zendesk__ticket_work_time_business", "alias": "int_zendesk__ticket_work_time_business", "checksum": {"name": "sha256", "checksum": "935476f79b31640eed9ed45ca9fd63ab77fd683467c0268f6caa231416e9738a"}, "tags": [], "refs": [["int_zendesk__ticket_historical_status"], ["int_zendesk__ticket_schedules"], ["int_zendesk__schedule_spine"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/agent_work_time/int_zendesk__ticket_work_time_business.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk", "materialized": "ephemeral", "enabled": true}, "created_at": 1644618836.9255612, "compiled_sql": "\n\nwith ticket_historical_status as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_status`\n\n), ticket_schedules as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_schedules`\n\n), schedule as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__schedule_spine`\n\n), ticket_status_crossed_with_schedule as (\n \n select\n ticket_historical_status.ticket_id,\n ticket_historical_status.status as ticket_status,\n ticket_schedules.schedule_id,\n\n -- take the intersection of the intervals in which the status and the schedule were both active, for calculating the business minutes spent working on the ticket\n greatest(valid_starting_at, schedule_created_at) as status_schedule_start,\n least(valid_ending_at, schedule_invalidated_at) as status_schedule_end,\n\n -- bringing the following in the determine which schedule (Daylight Savings vs Standard time) to use\n ticket_historical_status.valid_starting_at as status_valid_starting_at,\n ticket_historical_status.valid_ending_at as status_valid_ending_at\n\n from ticket_historical_status\n left join ticket_schedules\n on ticket_historical_status.ticket_id = ticket_schedules.ticket_id\n where \n \n\n timestamp_diff(\n least(valid_ending_at, schedule_invalidated_at),\n greatest(valid_starting_at, schedule_created_at),\n second\n )\n\n\n > 0\n\n), ticket_full_solved_time as (\n\n select \n ticket_status_crossed_with_schedule.*,\n (\n \n\n timestamp_diff(\n ticket_status_crossed_with_schedule.status_schedule_start,\n \n timestamp_trunc(\n cast(ticket_status_crossed_with_schedule.status_schedule_start as timestamp),\n week\n )\n\n,\n second\n )\n\n\n /60\n ) as start_time_in_minutes_from_week,\n (\n \n\n timestamp_diff(\n ticket_status_crossed_with_schedule.status_schedule_end,\n ticket_status_crossed_with_schedule.status_schedule_start,\n second\n )\n\n\n /60\n ) as raw_delta_in_minutes\n from ticket_status_crossed_with_schedule\n group by 1,2,3,4,5,6,7\n\n), weeks as (\n\n \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * power(2, 0)\n + \n \n p1.generated_number * power(2, 1)\n + \n \n p2.generated_number * power(2, 2)\n + \n \n p3.generated_number * power(2, 3)\n + \n \n p4.generated_number * power(2, 4)\n + \n \n p5.generated_number * power(2, 5)\n + \n \n p6.generated_number * power(2, 6)\n + \n \n p7.generated_number * power(2, 7)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 208\n order by generated_number\n\n\n\n), weeks_cross_ticket_full_solved_time as (\n -- because time is reported in minutes since the beginning of the week, we have to split up time spent on the ticket into calendar weeks\n select \n ticket_full_solved_time.*,\n generated_number - 1 as week_number\n from ticket_full_solved_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number -1\n\n), weekly_periods as (\n\n select\n\n weeks_cross_ticket_full_solved_time.*,\n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n \n from weeks_cross_ticket_full_solved_time\n\n), intercepted_periods as (\n \n select \n weekly_periods.ticket_id,\n weekly_periods.week_number,\n weekly_periods.schedule_id,\n weekly_periods.ticket_status,\n weekly_periods.ticket_week_start_time,\n weekly_periods.ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(weekly_periods.ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n -- this chooses the Daylight Savings Time or Standard Time version of the schedule\n and weekly_periods.status_valid_ending_at >= cast(schedule.valid_from as \n timestamp\n)\n and weekly_periods.status_valid_starting_at < cast(schedule.valid_until as \n timestamp\n) \n \n), business_minutes as (\n \n select \n ticket_id,\n ticket_status,\n case when ticket_status in ('pending') then scheduled_minutes\n else 0 end as agent_wait_time_in_minutes,\n case when ticket_status in ('new', 'open', 'hold') then scheduled_minutes\n else 0 end as requester_wait_time_in_minutes,\n case when ticket_status in ('new', 'open') then scheduled_minutes\n else 0 end as agent_work_time_in_minutes,\n case when ticket_status in ('hold') then scheduled_minutes\n else 0 end as on_hold_time_in_minutes\n from intercepted_periods\n\n)\n \n select \n ticket_id,\n sum(agent_wait_time_in_minutes) as agent_wait_time_in_business_minutes,\n sum(requester_wait_time_in_minutes) as requester_wait_time_in_business_minutes,\n sum(agent_work_time_in_minutes) as agent_work_time_in_business_minutes,\n sum(on_hold_time_in_minutes) as on_hold_time_in_business_minutes\n from business_minutes\n group by 1", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null}, "model.zendesk.int_zendesk__calendar_spine": {"raw_sql": "-- depends_on: {{ ref('stg_zendesk__ticket') }}\n\nwith spine as (\n\n {% if execute %}\n {% set first_date_query %}\n select min( created_at ) as min_date from {{ ref('stg_zendesk__ticket') }}\n -- by default take all the data \n where cast(created_at as date) >= {{ dbt_utils.dateadd('year', - var('ticket_field_history_timeframe_years', 50), dbt_utils.current_timestamp() ) }}\n {% endset %}\n\n {% set first_date = run_query(first_date_query).columns[0][0]|string %}\n \n {% if target.type == 'postgres' %}\n {% set first_date_adjust = \"cast('\" ~ first_date[0:10] ~ \"' as date)\" %}\n\n {% else %}\n {% set first_date_adjust = \"'\" ~ first_date[0:10] ~ \"'\" %}\n\n {% endif %}\n\n {% else %} {% set first_date_adjust = \"2016-01-01\" %}\n {% endif %}\n\n \n{{\n dbt_utils.date_spine(\n datepart = \"day\", \n start_date = first_date_adjust,\n end_date = dbt_utils.dateadd(\"week\", 1, \"current_date\")\n ) \n}}\n\n), recast as (\n\n select cast(date_day as date) as date_day\n from spine\n\n)\n\nselect *\nfrom recast", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.dateadd", "macro.dbt_utils.date_spine", "macro.dbt_utils.current_timestamp", "macro.dbt.run_query"], "nodes": ["model.zendesk_source.stg_zendesk__ticket"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk", "database": null, "tags": [], "meta": {}, "materialized": "ephemeral", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk", "fqn": ["zendesk", "utils", "int_zendesk__calendar_spine"], "unique_id": "model.zendesk.int_zendesk__calendar_spine", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "utils/int_zendesk__calendar_spine.sql", "original_file_path": "models/utils/int_zendesk__calendar_spine.sql", "name": "int_zendesk__calendar_spine", "alias": "int_zendesk__calendar_spine", "checksum": {"name": "sha256", "checksum": "2600ddadf1743eabb6489d5d09180101c182662e7fd7e2f72807dabfae5fd546"}, "tags": [], "refs": [["stg_zendesk__ticket"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/utils/int_zendesk__calendar_spine.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk", "materialized": "ephemeral"}, "created_at": 1644618836.9376378, "compiled_sql": "-- depends_on: `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket`\n\nwith spine as (\n\n \n \n\n \n \n \n \n\n \n\n \n\n \n\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 \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * power(2, 0)\n + \n \n p1.generated_number * power(2, 1)\n + \n \n p2.generated_number * power(2, 2)\n + \n \n p3.generated_number * power(2, 3)\n + \n \n p4.generated_number * power(2, 4)\n + \n \n p5.generated_number * power(2, 5)\n + \n \n p6.generated_number * power(2, 6)\n + \n \n p7.generated_number * power(2, 7)\n + \n \n p8.generated_number * power(2, 8)\n + \n \n p9.generated_number * power(2, 9)\n + \n \n p10.generated_number * power(2, 10)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n cross join \n \n p as p8\n cross join \n \n p as p9\n cross join \n \n p as p10\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 1216\n order by generated_number\n\n\n\n),\n\nall_periods as (\n\n select (\n \n\n datetime_add(\n cast( '2018-10-21' as datetime),\n interval row_number() over (order by 1) - 1 day\n )\n\n\n ) as date_day\n from rawdata\n\n),\n\nfiltered as (\n\n select *\n from all_periods\n where date_day <= \n\n datetime_add(\n cast( current_date as datetime),\n interval 1 week\n )\n\n\n\n)\n\nselect * from filtered\n\n\n\n), recast as (\n\n select cast(date_day as date) as date_day\n from spine\n\n)\n\nselect *\nfrom recast", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null}, "model.zendesk.int_zendesk__ticket_resolution_times_calendar": {"raw_sql": "with historical_solved_status as (\n\n select *\n from {{ ref('int_zendesk__ticket_historical_status') }}\n where status = 'solved'\n\n), ticket as (\n\n select *\n from {{ ref('stg_zendesk__ticket') }}\n\n), ticket_historical_assignee as (\n\n select *\n from {{ ref('int_zendesk__ticket_historical_assignee') }}\n\n), ticket_historical_group as (\n\n select *\n from {{ ref('int_zendesk__ticket_historical_group') }}\n\n), solved_times as (\n \n select\n \n ticket_id,\n min(valid_starting_at) as first_solved_at,\n max(valid_starting_at) as last_solved_at,\n count(status) as solved_count \n\n from historical_solved_status\n group by 1\n\n)\n\n select\n\n ticket.ticket_id,\n ticket.created_at,\n solved_times.first_solved_at,\n solved_times.last_solved_at,\n ticket_historical_assignee.unique_assignee_count,\n ticket_historical_assignee.assignee_stations_count,\n ticket_historical_group.group_stations_count,\n ticket_historical_assignee.first_assignee_id,\n ticket_historical_assignee.last_assignee_id,\n ticket_historical_assignee.first_agent_assignment_date,\n ticket_historical_assignee.last_agent_assignment_date,\n ticket_historical_assignee.ticket_unassigned_duration_calendar_minutes,\n solved_times.solved_count as total_resolutions,\n case when solved_times.solved_count <= 1\n then 0\n else solved_times.solved_count - 1 --subtracting one as the first solve is not a reopen.\n end as count_reopens,\n\n {{ fivetran_utils.timestamp_diff(\n 'ticket_historical_assignee.first_agent_assignment_date', \n 'solved_times.last_solved_at',\n 'minute' ) }} as first_assignment_to_resolution_calendar_minutes,\n {{ fivetran_utils.timestamp_diff(\n 'ticket_historical_assignee.last_agent_assignment_date', \n 'solved_times.last_solved_at',\n 'minute' ) }} as last_assignment_to_resolution_calendar_minutes,\n {{ fivetran_utils.timestamp_diff(\n 'ticket.created_at', \n 'solved_times.first_solved_at',\n 'minute' ) }} as first_resolution_calendar_minutes,\n {{ fivetran_utils.timestamp_diff(\n 'ticket.created_at', \n 'solved_times.last_solved_at',\n 'minute') }} as final_resolution_calendar_minutes\n\n from ticket\n\n left join ticket_historical_assignee\n using(ticket_id)\n\n left join ticket_historical_group\n using(ticket_id)\n\n left join solved_times\n using(ticket_id)", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.fivetran_utils.timestamp_diff"], "nodes": ["model.zendesk.int_zendesk__ticket_historical_status", "model.zendesk_source.stg_zendesk__ticket", "model.zendesk.int_zendesk__ticket_historical_assignee", "model.zendesk.int_zendesk__ticket_historical_group"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk", "database": null, "tags": [], "meta": {}, "materialized": "ephemeral", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk", "fqn": ["zendesk", "resolution_times", "int_zendesk__ticket_resolution_times_calendar"], "unique_id": "model.zendesk.int_zendesk__ticket_resolution_times_calendar", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "resolution_times/int_zendesk__ticket_resolution_times_calendar.sql", "original_file_path": "models/resolution_times/int_zendesk__ticket_resolution_times_calendar.sql", "name": "int_zendesk__ticket_resolution_times_calendar", "alias": "int_zendesk__ticket_resolution_times_calendar", "checksum": {"name": "sha256", "checksum": "90d50bebce7af1d1d1967f33841dc63db404136ab9f81998f380dd53943b660c"}, "tags": [], "refs": [["int_zendesk__ticket_historical_status"], ["stg_zendesk__ticket"], ["int_zendesk__ticket_historical_assignee"], ["int_zendesk__ticket_historical_group"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/resolution_times/int_zendesk__ticket_resolution_times_calendar.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk", "materialized": "ephemeral"}, "created_at": 1644618836.963159, "compiled_sql": "with historical_solved_status as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_status`\n where status = 'solved'\n\n), ticket as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket`\n\n), ticket_historical_assignee as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_assignee`\n\n), ticket_historical_group as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_group`\n\n), solved_times as (\n \n select\n \n ticket_id,\n min(valid_starting_at) as first_solved_at,\n max(valid_starting_at) as last_solved_at,\n count(status) as solved_count \n\n from historical_solved_status\n group by 1\n\n)\n\n select\n\n ticket.ticket_id,\n ticket.created_at,\n solved_times.first_solved_at,\n solved_times.last_solved_at,\n ticket_historical_assignee.unique_assignee_count,\n ticket_historical_assignee.assignee_stations_count,\n ticket_historical_group.group_stations_count,\n ticket_historical_assignee.first_assignee_id,\n ticket_historical_assignee.last_assignee_id,\n ticket_historical_assignee.first_agent_assignment_date,\n ticket_historical_assignee.last_agent_assignment_date,\n ticket_historical_assignee.ticket_unassigned_duration_calendar_minutes,\n solved_times.solved_count as total_resolutions,\n case when solved_times.solved_count <= 1\n then 0\n else solved_times.solved_count - 1 --subtracting one as the first solve is not a reopen.\n end as count_reopens,\n\n \n \n\n timestamp_diff(\n solved_times.last_solved_at,\n ticket_historical_assignee.first_agent_assignment_date,\n minute\n )\n\n\n as first_assignment_to_resolution_calendar_minutes,\n \n \n\n timestamp_diff(\n solved_times.last_solved_at,\n ticket_historical_assignee.last_agent_assignment_date,\n minute\n )\n\n\n as last_assignment_to_resolution_calendar_minutes,\n \n \n\n timestamp_diff(\n solved_times.first_solved_at,\n ticket.created_at,\n minute\n )\n\n\n as first_resolution_calendar_minutes,\n \n \n\n timestamp_diff(\n solved_times.last_solved_at,\n ticket.created_at,\n minute\n )\n\n\n as final_resolution_calendar_minutes\n\n from ticket\n\n left join ticket_historical_assignee\n using(ticket_id)\n\n left join ticket_historical_group\n using(ticket_id)\n\n left join solved_times\n using(ticket_id)", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null}, "model.zendesk.int_zendesk__ticket_first_resolution_time_business": {"raw_sql": "{{ config(enabled=var('using_schedules', True)) }}\n\nwith ticket_resolution_times_calendar as (\n\n select *\n from {{ ref('int_zendesk__ticket_resolution_times_calendar') }}\n\n), ticket_schedules as (\n\n select *\n from {{ ref('int_zendesk__ticket_schedules') }}\n\n), schedule as (\n\n select *\n from {{ ref('int_zendesk__schedule_spine') }}\n\n), ticket_first_resolution_time as (\n\n select \n ticket_resolution_times_calendar.ticket_id,\n ticket_schedules.schedule_created_at,\n ticket_schedules.schedule_invalidated_at,\n ticket_schedules.schedule_id,\n\n -- bringing this in the determine which schedule (Daylight Savings vs Standard time) to use\n min(ticket_resolution_times_calendar.first_solved_at) as first_solved_at,\n \n ({{ fivetran_utils.timestamp_diff(\n \"\" ~ dbt_utils.date_trunc('week', 'ticket_schedules.schedule_created_at') ~ \"\", \n 'ticket_schedules.schedule_created_at',\n 'second') }} /60\n ) as start_time_in_minutes_from_week,\n greatest(0,\n (\n {{ fivetran_utils.timestamp_diff(\n 'ticket_schedules.schedule_created_at',\n 'least(ticket_schedules.schedule_invalidated_at, min(ticket_resolution_times_calendar.first_solved_at))',\n 'second') }}/60\n )) as raw_delta_in_minutes\n \n from ticket_resolution_times_calendar\n join ticket_schedules on ticket_resolution_times_calendar.ticket_id = ticket_schedules.ticket_id\n group by 1, 2, 3, 4\n\n), weeks as (\n\n {{ dbt_utils.generate_series(208) }}\n\n), weeks_cross_ticket_first_resolution_time as (\n -- because time is reported in minutes since the beginning of the week, we have to split up time spent on the ticket into calendar weeks\n select \n\n ticket_first_resolution_time.*,\n generated_number - 1 as week_number\n\n from ticket_first_resolution_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number - 1\n\n\n), weekly_periods as (\n \n select \n\n weeks_cross_ticket_first_resolution_time.*,\n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n \n from weeks_cross_ticket_first_resolution_time\n\n), intercepted_periods as (\n\n select ticket_id,\n week_number,\n weekly_periods.schedule_id,\n ticket_week_start_time,\n ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n -- this chooses the Daylight Savings Time or Standard Time version of the schedule\n and weekly_periods.first_solved_at >= cast(schedule.valid_from as {{ dbt_utils.type_timestamp() }})\n and weekly_periods.first_solved_at < cast(schedule.valid_until as {{ dbt_utils.type_timestamp() }}) \n \n)\n\n select \n ticket_id,\n sum(scheduled_minutes) as first_resolution_business_minutes\n from intercepted_periods\n group by 1", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.date_trunc", "macro.fivetran_utils.timestamp_diff", "macro.dbt_utils.generate_series", "macro.dbt_utils.type_timestamp"], "nodes": ["model.zendesk.int_zendesk__ticket_resolution_times_calendar", "model.zendesk.int_zendesk__ticket_schedules", "model.zendesk.int_zendesk__schedule_spine"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk", "database": null, "tags": [], "meta": {}, "materialized": "ephemeral", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk", "fqn": ["zendesk", "resolution_times", "int_zendesk__ticket_first_resolution_time_business"], "unique_id": "model.zendesk.int_zendesk__ticket_first_resolution_time_business", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "resolution_times/int_zendesk__ticket_first_resolution_time_business.sql", "original_file_path": "models/resolution_times/int_zendesk__ticket_first_resolution_time_business.sql", "name": "int_zendesk__ticket_first_resolution_time_business", "alias": "int_zendesk__ticket_first_resolution_time_business", "checksum": {"name": "sha256", "checksum": "24d91fed60b2d0fe813a393ed776697899a0e956d4b9db03e999d516502ef7a4"}, "tags": [], "refs": [["int_zendesk__ticket_resolution_times_calendar"], ["int_zendesk__ticket_schedules"], ["int_zendesk__schedule_spine"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/resolution_times/int_zendesk__ticket_first_resolution_time_business.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk", "materialized": "ephemeral", "enabled": true}, "created_at": 1644618836.9722712, "compiled_sql": "\n\nwith __dbt__cte__int_zendesk__ticket_resolution_times_calendar as (\nwith historical_solved_status as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_status`\n where status = 'solved'\n\n), ticket as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket`\n\n), ticket_historical_assignee as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_assignee`\n\n), ticket_historical_group as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_group`\n\n), solved_times as (\n \n select\n \n ticket_id,\n min(valid_starting_at) as first_solved_at,\n max(valid_starting_at) as last_solved_at,\n count(status) as solved_count \n\n from historical_solved_status\n group by 1\n\n)\n\n select\n\n ticket.ticket_id,\n ticket.created_at,\n solved_times.first_solved_at,\n solved_times.last_solved_at,\n ticket_historical_assignee.unique_assignee_count,\n ticket_historical_assignee.assignee_stations_count,\n ticket_historical_group.group_stations_count,\n ticket_historical_assignee.first_assignee_id,\n ticket_historical_assignee.last_assignee_id,\n ticket_historical_assignee.first_agent_assignment_date,\n ticket_historical_assignee.last_agent_assignment_date,\n ticket_historical_assignee.ticket_unassigned_duration_calendar_minutes,\n solved_times.solved_count as total_resolutions,\n case when solved_times.solved_count <= 1\n then 0\n else solved_times.solved_count - 1 --subtracting one as the first solve is not a reopen.\n end as count_reopens,\n\n \n \n\n timestamp_diff(\n solved_times.last_solved_at,\n ticket_historical_assignee.first_agent_assignment_date,\n minute\n )\n\n\n as first_assignment_to_resolution_calendar_minutes,\n \n \n\n timestamp_diff(\n solved_times.last_solved_at,\n ticket_historical_assignee.last_agent_assignment_date,\n minute\n )\n\n\n as last_assignment_to_resolution_calendar_minutes,\n \n \n\n timestamp_diff(\n solved_times.first_solved_at,\n ticket.created_at,\n minute\n )\n\n\n as first_resolution_calendar_minutes,\n \n \n\n timestamp_diff(\n solved_times.last_solved_at,\n ticket.created_at,\n minute\n )\n\n\n as final_resolution_calendar_minutes\n\n from ticket\n\n left join ticket_historical_assignee\n using(ticket_id)\n\n left join ticket_historical_group\n using(ticket_id)\n\n left join solved_times\n using(ticket_id)\n),ticket_resolution_times_calendar as (\n\n select *\n from __dbt__cte__int_zendesk__ticket_resolution_times_calendar\n\n), ticket_schedules as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_schedules`\n\n), schedule as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__schedule_spine`\n\n), ticket_first_resolution_time as (\n\n select \n ticket_resolution_times_calendar.ticket_id,\n ticket_schedules.schedule_created_at,\n ticket_schedules.schedule_invalidated_at,\n ticket_schedules.schedule_id,\n\n -- bringing this in the determine which schedule (Daylight Savings vs Standard time) to use\n min(ticket_resolution_times_calendar.first_solved_at) as first_solved_at,\n \n (\n \n\n timestamp_diff(\n ticket_schedules.schedule_created_at,\n \n timestamp_trunc(\n cast(ticket_schedules.schedule_created_at as timestamp),\n week\n )\n\n,\n second\n )\n\n\n /60\n ) as start_time_in_minutes_from_week,\n greatest(0,\n (\n \n \n\n timestamp_diff(\n least(ticket_schedules.schedule_invalidated_at, min(ticket_resolution_times_calendar.first_solved_at)),\n ticket_schedules.schedule_created_at,\n second\n )\n\n\n/60\n )) as raw_delta_in_minutes\n \n from ticket_resolution_times_calendar\n join ticket_schedules on ticket_resolution_times_calendar.ticket_id = ticket_schedules.ticket_id\n group by 1, 2, 3, 4\n\n), weeks as (\n\n \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * power(2, 0)\n + \n \n p1.generated_number * power(2, 1)\n + \n \n p2.generated_number * power(2, 2)\n + \n \n p3.generated_number * power(2, 3)\n + \n \n p4.generated_number * power(2, 4)\n + \n \n p5.generated_number * power(2, 5)\n + \n \n p6.generated_number * power(2, 6)\n + \n \n p7.generated_number * power(2, 7)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 208\n order by generated_number\n\n\n\n), weeks_cross_ticket_first_resolution_time as (\n -- because time is reported in minutes since the beginning of the week, we have to split up time spent on the ticket into calendar weeks\n select \n\n ticket_first_resolution_time.*,\n generated_number - 1 as week_number\n\n from ticket_first_resolution_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number - 1\n\n\n), weekly_periods as (\n \n select \n\n weeks_cross_ticket_first_resolution_time.*,\n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n \n from weeks_cross_ticket_first_resolution_time\n\n), intercepted_periods as (\n\n select ticket_id,\n week_number,\n weekly_periods.schedule_id,\n ticket_week_start_time,\n ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n -- this chooses the Daylight Savings Time or Standard Time version of the schedule\n and weekly_periods.first_solved_at >= cast(schedule.valid_from as \n timestamp\n)\n and weekly_periods.first_solved_at < cast(schedule.valid_until as \n timestamp\n) \n \n)\n\n select \n ticket_id,\n sum(scheduled_minutes) as first_resolution_business_minutes\n from intercepted_periods\n group by 1", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.zendesk.int_zendesk__ticket_resolution_times_calendar", "sql": " __dbt__cte__int_zendesk__ticket_resolution_times_calendar as (\nwith historical_solved_status as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_status`\n where status = 'solved'\n\n), ticket as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket`\n\n), ticket_historical_assignee as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_assignee`\n\n), ticket_historical_group as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_group`\n\n), solved_times as (\n \n select\n \n ticket_id,\n min(valid_starting_at) as first_solved_at,\n max(valid_starting_at) as last_solved_at,\n count(status) as solved_count \n\n from historical_solved_status\n group by 1\n\n)\n\n select\n\n ticket.ticket_id,\n ticket.created_at,\n solved_times.first_solved_at,\n solved_times.last_solved_at,\n ticket_historical_assignee.unique_assignee_count,\n ticket_historical_assignee.assignee_stations_count,\n ticket_historical_group.group_stations_count,\n ticket_historical_assignee.first_assignee_id,\n ticket_historical_assignee.last_assignee_id,\n ticket_historical_assignee.first_agent_assignment_date,\n ticket_historical_assignee.last_agent_assignment_date,\n ticket_historical_assignee.ticket_unassigned_duration_calendar_minutes,\n solved_times.solved_count as total_resolutions,\n case when solved_times.solved_count <= 1\n then 0\n else solved_times.solved_count - 1 --subtracting one as the first solve is not a reopen.\n end as count_reopens,\n\n \n \n\n timestamp_diff(\n solved_times.last_solved_at,\n ticket_historical_assignee.first_agent_assignment_date,\n minute\n )\n\n\n as first_assignment_to_resolution_calendar_minutes,\n \n \n\n timestamp_diff(\n solved_times.last_solved_at,\n ticket_historical_assignee.last_agent_assignment_date,\n minute\n )\n\n\n as last_assignment_to_resolution_calendar_minutes,\n \n \n\n timestamp_diff(\n solved_times.first_solved_at,\n ticket.created_at,\n minute\n )\n\n\n as first_resolution_calendar_minutes,\n \n \n\n timestamp_diff(\n solved_times.last_solved_at,\n ticket.created_at,\n minute\n )\n\n\n as final_resolution_calendar_minutes\n\n from ticket\n\n left join ticket_historical_assignee\n using(ticket_id)\n\n left join ticket_historical_group\n using(ticket_id)\n\n left join solved_times\n using(ticket_id)\n)"}], "relation_name": null}, "model.zendesk.int_zendesk__ticket_full_resolution_time_business": {"raw_sql": "{{ config(enabled=var('using_schedules', True)) }}\n\nwith ticket_resolution_times_calendar as (\n\n select *\n from {{ ref('int_zendesk__ticket_resolution_times_calendar') }}\n\n), ticket_schedules as (\n\n select *\n from {{ ref('int_zendesk__ticket_schedules') }}\n\n), schedule as (\n\n select *\n from {{ ref('int_zendesk__schedule_spine') }}\n\n), ticket_full_resolution_time as (\n\n select \n ticket_resolution_times_calendar.ticket_id,\n ticket_schedules.schedule_created_at,\n ticket_schedules.schedule_invalidated_at,\n ticket_schedules.schedule_id,\n\n -- bringing this in the determine which schedule (Daylight Savings vs Standard time) to use\n min(ticket_resolution_times_calendar.last_solved_at) as last_solved_at,\n \n ({{ fivetran_utils.timestamp_diff(\n \"\" ~ dbt_utils.date_trunc('week', 'ticket_schedules.schedule_created_at') ~ \"\", \n 'ticket_schedules.schedule_created_at',\n 'second') }} /60\n ) as start_time_in_minutes_from_week,\n greatest(0,\n (\n {{ fivetran_utils.timestamp_diff(\n 'ticket_schedules.schedule_created_at',\n 'least(ticket_schedules.schedule_invalidated_at, min(ticket_resolution_times_calendar.last_solved_at))',\n 'second') }}/60\n )) as raw_delta_in_minutes\n \n from ticket_resolution_times_calendar\n join ticket_schedules on ticket_resolution_times_calendar.ticket_id = ticket_schedules.ticket_id\n group by 1, 2, 3, 4\n\n), weeks as (\n\n {{ dbt_utils.generate_series(208) }}\n\n), weeks_cross_ticket_full_resolution_time as (\n -- because time is reported in minutes since the beginning of the week, we have to split up time spent on the ticket into calendar weeks\n select \n\n ticket_full_resolution_time.*,\n generated_number - 1 as week_number\n\n from ticket_full_resolution_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number - 1\n\n), weekly_periods as (\n \n select \n\n weeks_cross_ticket_full_resolution_time.*,\n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n \n from weeks_cross_ticket_full_resolution_time\n\n), intercepted_periods as (\n\n select \n ticket_id,\n week_number,\n weekly_periods.schedule_id,\n ticket_week_start_time,\n ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n -- this chooses the Daylight Savings Time or Standard Time version of the schedule\n and weekly_periods.last_solved_at >= cast(schedule.valid_from as {{ dbt_utils.type_timestamp() }})\n and weekly_periods.last_solved_at < cast(schedule.valid_until as {{ dbt_utils.type_timestamp() }}) \n \n)\n\n select \n ticket_id,\n sum(scheduled_minutes) as full_resolution_business_minutes\n from intercepted_periods\n group by 1", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.date_trunc", "macro.fivetran_utils.timestamp_diff", "macro.dbt_utils.generate_series", "macro.dbt_utils.type_timestamp"], "nodes": ["model.zendesk.int_zendesk__ticket_resolution_times_calendar", "model.zendesk.int_zendesk__ticket_schedules", "model.zendesk.int_zendesk__schedule_spine"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk", "database": null, "tags": [], "meta": {}, "materialized": "ephemeral", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk", "fqn": ["zendesk", "resolution_times", "int_zendesk__ticket_full_resolution_time_business"], "unique_id": "model.zendesk.int_zendesk__ticket_full_resolution_time_business", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "resolution_times/int_zendesk__ticket_full_resolution_time_business.sql", "original_file_path": "models/resolution_times/int_zendesk__ticket_full_resolution_time_business.sql", "name": "int_zendesk__ticket_full_resolution_time_business", "alias": "int_zendesk__ticket_full_resolution_time_business", "checksum": {"name": "sha256", "checksum": "a8876067e37145975bcc8b732b1174600adf32453b4fecfd51673a61acabe06a"}, "tags": [], "refs": [["int_zendesk__ticket_resolution_times_calendar"], ["int_zendesk__ticket_schedules"], ["int_zendesk__schedule_spine"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/resolution_times/int_zendesk__ticket_full_resolution_time_business.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk", "materialized": "ephemeral", "enabled": true}, "created_at": 1644618836.9839768, "compiled_sql": "\n\nwith __dbt__cte__int_zendesk__ticket_resolution_times_calendar as (\nwith historical_solved_status as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_status`\n where status = 'solved'\n\n), ticket as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket`\n\n), ticket_historical_assignee as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_assignee`\n\n), ticket_historical_group as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_group`\n\n), solved_times as (\n \n select\n \n ticket_id,\n min(valid_starting_at) as first_solved_at,\n max(valid_starting_at) as last_solved_at,\n count(status) as solved_count \n\n from historical_solved_status\n group by 1\n\n)\n\n select\n\n ticket.ticket_id,\n ticket.created_at,\n solved_times.first_solved_at,\n solved_times.last_solved_at,\n ticket_historical_assignee.unique_assignee_count,\n ticket_historical_assignee.assignee_stations_count,\n ticket_historical_group.group_stations_count,\n ticket_historical_assignee.first_assignee_id,\n ticket_historical_assignee.last_assignee_id,\n ticket_historical_assignee.first_agent_assignment_date,\n ticket_historical_assignee.last_agent_assignment_date,\n ticket_historical_assignee.ticket_unassigned_duration_calendar_minutes,\n solved_times.solved_count as total_resolutions,\n case when solved_times.solved_count <= 1\n then 0\n else solved_times.solved_count - 1 --subtracting one as the first solve is not a reopen.\n end as count_reopens,\n\n \n \n\n timestamp_diff(\n solved_times.last_solved_at,\n ticket_historical_assignee.first_agent_assignment_date,\n minute\n )\n\n\n as first_assignment_to_resolution_calendar_minutes,\n \n \n\n timestamp_diff(\n solved_times.last_solved_at,\n ticket_historical_assignee.last_agent_assignment_date,\n minute\n )\n\n\n as last_assignment_to_resolution_calendar_minutes,\n \n \n\n timestamp_diff(\n solved_times.first_solved_at,\n ticket.created_at,\n minute\n )\n\n\n as first_resolution_calendar_minutes,\n \n \n\n timestamp_diff(\n solved_times.last_solved_at,\n ticket.created_at,\n minute\n )\n\n\n as final_resolution_calendar_minutes\n\n from ticket\n\n left join ticket_historical_assignee\n using(ticket_id)\n\n left join ticket_historical_group\n using(ticket_id)\n\n left join solved_times\n using(ticket_id)\n),ticket_resolution_times_calendar as (\n\n select *\n from __dbt__cte__int_zendesk__ticket_resolution_times_calendar\n\n), ticket_schedules as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_schedules`\n\n), schedule as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__schedule_spine`\n\n), ticket_full_resolution_time as (\n\n select \n ticket_resolution_times_calendar.ticket_id,\n ticket_schedules.schedule_created_at,\n ticket_schedules.schedule_invalidated_at,\n ticket_schedules.schedule_id,\n\n -- bringing this in the determine which schedule (Daylight Savings vs Standard time) to use\n min(ticket_resolution_times_calendar.last_solved_at) as last_solved_at,\n \n (\n \n\n timestamp_diff(\n ticket_schedules.schedule_created_at,\n \n timestamp_trunc(\n cast(ticket_schedules.schedule_created_at as timestamp),\n week\n )\n\n,\n second\n )\n\n\n /60\n ) as start_time_in_minutes_from_week,\n greatest(0,\n (\n \n \n\n timestamp_diff(\n least(ticket_schedules.schedule_invalidated_at, min(ticket_resolution_times_calendar.last_solved_at)),\n ticket_schedules.schedule_created_at,\n second\n )\n\n\n/60\n )) as raw_delta_in_minutes\n \n from ticket_resolution_times_calendar\n join ticket_schedules on ticket_resolution_times_calendar.ticket_id = ticket_schedules.ticket_id\n group by 1, 2, 3, 4\n\n), weeks as (\n\n \n\n \n\n with p as (\n select 0 as generated_number union all select 1\n ), unioned as (\n\n select\n\n \n p0.generated_number * power(2, 0)\n + \n \n p1.generated_number * power(2, 1)\n + \n \n p2.generated_number * power(2, 2)\n + \n \n p3.generated_number * power(2, 3)\n + \n \n p4.generated_number * power(2, 4)\n + \n \n p5.generated_number * power(2, 5)\n + \n \n p6.generated_number * power(2, 6)\n + \n \n p7.generated_number * power(2, 7)\n \n \n + 1\n as generated_number\n\n from\n\n \n p as p0\n cross join \n \n p as p1\n cross join \n \n p as p2\n cross join \n \n p as p3\n cross join \n \n p as p4\n cross join \n \n p as p5\n cross join \n \n p as p6\n cross join \n \n p as p7\n \n \n\n )\n\n select *\n from unioned\n where generated_number <= 208\n order by generated_number\n\n\n\n), weeks_cross_ticket_full_resolution_time as (\n -- because time is reported in minutes since the beginning of the week, we have to split up time spent on the ticket into calendar weeks\n select \n\n ticket_full_resolution_time.*,\n generated_number - 1 as week_number\n\n from ticket_full_resolution_time\n cross join weeks\n where floor((start_time_in_minutes_from_week + raw_delta_in_minutes) / (7*24*60)) >= generated_number - 1\n\n), weekly_periods as (\n \n select \n\n weeks_cross_ticket_full_resolution_time.*,\n greatest(0, start_time_in_minutes_from_week - week_number * (7*24*60)) as ticket_week_start_time,\n least(start_time_in_minutes_from_week + raw_delta_in_minutes - week_number * (7*24*60), (7*24*60)) as ticket_week_end_time\n \n from weeks_cross_ticket_full_resolution_time\n\n), intercepted_periods as (\n\n select \n ticket_id,\n week_number,\n weekly_periods.schedule_id,\n ticket_week_start_time,\n ticket_week_end_time,\n schedule.start_time_utc as schedule_start_time,\n schedule.end_time_utc as schedule_end_time,\n least(ticket_week_end_time, schedule.end_time_utc) - greatest(ticket_week_start_time, schedule.start_time_utc) as scheduled_minutes\n from weekly_periods\n join schedule on ticket_week_start_time <= schedule.end_time_utc \n and ticket_week_end_time >= schedule.start_time_utc\n and weekly_periods.schedule_id = schedule.schedule_id\n -- this chooses the Daylight Savings Time or Standard Time version of the schedule\n and weekly_periods.last_solved_at >= cast(schedule.valid_from as \n timestamp\n)\n and weekly_periods.last_solved_at < cast(schedule.valid_until as \n timestamp\n) \n \n)\n\n select \n ticket_id,\n sum(scheduled_minutes) as full_resolution_business_minutes\n from intercepted_periods\n group by 1", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.zendesk.int_zendesk__ticket_resolution_times_calendar", "sql": " __dbt__cte__int_zendesk__ticket_resolution_times_calendar as (\nwith historical_solved_status as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_status`\n where status = 'solved'\n\n), ticket as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket`\n\n), ticket_historical_assignee as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_assignee`\n\n), ticket_historical_group as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_group`\n\n), solved_times as (\n \n select\n \n ticket_id,\n min(valid_starting_at) as first_solved_at,\n max(valid_starting_at) as last_solved_at,\n count(status) as solved_count \n\n from historical_solved_status\n group by 1\n\n)\n\n select\n\n ticket.ticket_id,\n ticket.created_at,\n solved_times.first_solved_at,\n solved_times.last_solved_at,\n ticket_historical_assignee.unique_assignee_count,\n ticket_historical_assignee.assignee_stations_count,\n ticket_historical_group.group_stations_count,\n ticket_historical_assignee.first_assignee_id,\n ticket_historical_assignee.last_assignee_id,\n ticket_historical_assignee.first_agent_assignment_date,\n ticket_historical_assignee.last_agent_assignment_date,\n ticket_historical_assignee.ticket_unassigned_duration_calendar_minutes,\n solved_times.solved_count as total_resolutions,\n case when solved_times.solved_count <= 1\n then 0\n else solved_times.solved_count - 1 --subtracting one as the first solve is not a reopen.\n end as count_reopens,\n\n \n \n\n timestamp_diff(\n solved_times.last_solved_at,\n ticket_historical_assignee.first_agent_assignment_date,\n minute\n )\n\n\n as first_assignment_to_resolution_calendar_minutes,\n \n \n\n timestamp_diff(\n solved_times.last_solved_at,\n ticket_historical_assignee.last_agent_assignment_date,\n minute\n )\n\n\n as last_assignment_to_resolution_calendar_minutes,\n \n \n\n timestamp_diff(\n solved_times.first_solved_at,\n ticket.created_at,\n minute\n )\n\n\n as first_resolution_calendar_minutes,\n \n \n\n timestamp_diff(\n solved_times.last_solved_at,\n ticket.created_at,\n minute\n )\n\n\n as final_resolution_calendar_minutes\n\n from ticket\n\n left join ticket_historical_assignee\n using(ticket_id)\n\n left join ticket_historical_group\n using(ticket_id)\n\n left join solved_times\n using(ticket_id)\n)"}], "relation_name": null}, "model.zendesk.int_zendesk__updates": {"raw_sql": "with ticket_history as (\n select *\n from {{ ref('stg_zendesk__ticket_field_history') }}\n\n), ticket_comment as (\n select *\n from {{ ref('stg_zendesk__ticket_comment') }}\n\n), tickets as (\n select *\n from {{ ref('stg_zendesk__ticket') }}\n\n), updates_union as (\n select \n ticket_id,\n field_name,\n value,\n null as is_public,\n user_id,\n valid_starting_at,\n valid_ending_at\n from ticket_history\n\n union all\n\n select\n ticket_id,\n cast('comment' as {{ dbt_utils.type_string() }}) as field_name,\n body as value,\n is_public,\n user_id,\n created_at as valid_starting_at,\n lead(created_at) over (partition by ticket_id order by created_at) as valid_ending_at\n from ticket_comment\n\n), final as (\n select\n updates_union.*,\n tickets.created_at as ticket_created_date\n from updates_union\n\n left join tickets\n on tickets.ticket_id = updates_union.ticket_id\n)\n\nselect *\nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.type_string"], "nodes": ["model.zendesk_source.stg_zendesk__ticket_field_history", "model.zendesk_source.stg_zendesk__ticket_comment", "model.zendesk_source.stg_zendesk__ticket"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_intermediate", "fqn": ["zendesk", "intermediate", "int_zendesk__updates"], "unique_id": "model.zendesk.int_zendesk__updates", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "intermediate/int_zendesk__updates.sql", "original_file_path": "models/intermediate/int_zendesk__updates.sql", "name": "int_zendesk__updates", "alias": "int_zendesk__updates", "checksum": {"name": "sha256", "checksum": "f5f81cb1ebdd577a17ff4985bac5f824985e9af7d5ae67cd7f20cdcb7eaf8726"}, "tags": [], "refs": [["stg_zendesk__ticket_field_history"], ["stg_zendesk__ticket_comment"], ["stg_zendesk__ticket"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/intermediate/int_zendesk__updates.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk_intermediate", "materialized": "table"}, "created_at": 1644618836.9943712, "compiled_sql": "with ticket_history as (\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket_field_history`\n\n), ticket_comment as (\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket_comment`\n\n), tickets as (\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket`\n\n), updates_union as (\n select \n ticket_id,\n field_name,\n value,\n null as is_public,\n user_id,\n valid_starting_at,\n valid_ending_at\n from ticket_history\n\n union all\n\n select\n ticket_id,\n cast('comment' as \n string\n) as field_name,\n body as value,\n is_public,\n user_id,\n created_at as valid_starting_at,\n lead(created_at) over (partition by ticket_id order by created_at) as valid_ending_at\n from ticket_comment\n\n), final as (\n select\n updates_union.*,\n tickets.created_at as ticket_created_date\n from updates_union\n\n left join tickets\n on tickets.ticket_id = updates_union.ticket_id\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__updates`"}, "model.zendesk.int_zendesk__ticket_historical_assignee": {"raw_sql": "with assignee_updates as (\n\n select *\n from {{ ref('int_zendesk__updates') }}\n where field_name = 'assignee_id'\n\n), calculate_metrics as (\n select\n ticket_id,\n field_name as assignee_id,\n value,\n ticket_created_date,\n valid_starting_at,\n lag(valid_starting_at) over (partition by ticket_id order by valid_starting_at) as previous_update,\n lag(value) over (partition by ticket_id order by valid_starting_at) as previous_assignee,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at, ticket_id rows unbounded preceding) as first_agent_assignment_date,\n first_value(value) over (partition by ticket_id order by valid_starting_at, ticket_id rows unbounded preceding) as first_assignee_id,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_agent_assignment_date,\n first_value(value) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_assignee_id,\n count(value) over (partition by ticket_id) as assignee_stations_count\n from assignee_updates\n\n), unassigned_time as (\n select\n ticket_id,\n sum(case when assignee_id is not null and previous_assignee is null \n then {{ dbt_utils.datediff(\"coalesce(previous_update, ticket_created_date)\", \"valid_starting_at\", 'second') }} / 60\n else 0\n end) as ticket_unassigned_duration_calendar_minutes,\n count(distinct value) as unique_assignee_count\n from calculate_metrics\n\n group by 1\n\n), window_group as (\n select\n calculate_metrics.ticket_id,\n calculate_metrics.first_agent_assignment_date,\n calculate_metrics.first_assignee_id,\n calculate_metrics.last_agent_assignment_date,\n calculate_metrics.last_assignee_id,\n calculate_metrics.assignee_stations_count\n from calculate_metrics\n\n {{ dbt_utils.group_by(n=6) }}\n\n), final as (\n select\n window_group.*,\n unassigned_time.unique_assignee_count,\n unassigned_time.ticket_unassigned_duration_calendar_minutes\n from window_group\n\n left join unassigned_time\n using(ticket_id)\n)\n\nselect *\nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.datediff", "macro.dbt_utils.group_by"], "nodes": ["model.zendesk.int_zendesk__updates"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_intermediate", "fqn": ["zendesk", "intermediate", "int_zendesk__ticket_historical_assignee"], "unique_id": "model.zendesk.int_zendesk__ticket_historical_assignee", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "intermediate/int_zendesk__ticket_historical_assignee.sql", "original_file_path": "models/intermediate/int_zendesk__ticket_historical_assignee.sql", "name": "int_zendesk__ticket_historical_assignee", "alias": "int_zendesk__ticket_historical_assignee", "checksum": {"name": "sha256", "checksum": "fd6ca90f7cf23ac0a680a93517897efc44534572059a953621b5b8757a0c7c9e"}, "tags": [], "refs": [["int_zendesk__updates"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/intermediate/int_zendesk__ticket_historical_assignee.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk_intermediate", "materialized": "table"}, "created_at": 1644618837.001044, "compiled_sql": "with assignee_updates as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__updates`\n where field_name = 'assignee_id'\n\n), calculate_metrics as (\n select\n ticket_id,\n field_name as assignee_id,\n value,\n ticket_created_date,\n valid_starting_at,\n lag(valid_starting_at) over (partition by ticket_id order by valid_starting_at) as previous_update,\n lag(value) over (partition by ticket_id order by valid_starting_at) as previous_assignee,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at, ticket_id rows unbounded preceding) as first_agent_assignment_date,\n first_value(value) over (partition by ticket_id order by valid_starting_at, ticket_id rows unbounded preceding) as first_assignee_id,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_agent_assignment_date,\n first_value(value) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_assignee_id,\n count(value) over (partition by ticket_id) as assignee_stations_count\n from assignee_updates\n\n), unassigned_time as (\n select\n ticket_id,\n sum(case when assignee_id is not null and previous_assignee is null \n then \n\n datetime_diff(\n cast(valid_starting_at as datetime),\n cast(coalesce(previous_update, ticket_created_date) as datetime),\n second\n )\n\n / 60\n else 0\n end) as ticket_unassigned_duration_calendar_minutes,\n count(distinct value) as unique_assignee_count\n from calculate_metrics\n\n group by 1\n\n), window_group as (\n select\n calculate_metrics.ticket_id,\n calculate_metrics.first_agent_assignment_date,\n calculate_metrics.first_assignee_id,\n calculate_metrics.last_agent_assignment_date,\n calculate_metrics.last_assignee_id,\n calculate_metrics.assignee_stations_count\n from calculate_metrics\n\n group by 1,2,3,4,5,6\n\n), final as (\n select\n window_group.*,\n unassigned_time.unique_assignee_count,\n unassigned_time.ticket_unassigned_duration_calendar_minutes\n from window_group\n\n left join unassigned_time\n using(ticket_id)\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_assignee`"}, "model.zendesk.int_zendesk__ticket_historical_status": {"raw_sql": "-- To do -- can we delete ticket_status_counter and unique_status_counter?\n\nwith ticket_status_history as (\n\n select *\n from {{ ref('int_zendesk__updates') }}\n where field_name = 'status'\n\n)\n\n select\n \n ticket_id,\n valid_starting_at,\n valid_ending_at,\n {{ fivetran_utils.timestamp_diff(\n 'valid_starting_at',\n \"coalesce(valid_ending_at, \" ~ dbt_utils.current_timestamp() ~ \")\",\n 'minute') }} as status_duration_calendar_minutes,\n value as status,\n -- MIGHT BE ABLE TO DELETE ROWS BELOW\n row_number() over (partition by ticket_id order by valid_starting_at) as ticket_status_counter,\n row_number() over (partition by ticket_id, value order by valid_starting_at) as unique_status_counter\n\n from ticket_status_history", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.current_timestamp", "macro.fivetran_utils.timestamp_diff"], "nodes": ["model.zendesk.int_zendesk__updates"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_intermediate", "fqn": ["zendesk", "intermediate", "int_zendesk__ticket_historical_status"], "unique_id": "model.zendesk.int_zendesk__ticket_historical_status", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "intermediate/int_zendesk__ticket_historical_status.sql", "original_file_path": "models/intermediate/int_zendesk__ticket_historical_status.sql", "name": "int_zendesk__ticket_historical_status", "alias": "int_zendesk__ticket_historical_status", "checksum": {"name": "sha256", "checksum": "bcf2649d98ed04b05faa03779cab67203f4fa62c95cf78759e75d2f6183320be"}, "tags": [], "refs": [["int_zendesk__updates"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/intermediate/int_zendesk__ticket_historical_status.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk_intermediate", "materialized": "table"}, "created_at": 1644618837.008659, "compiled_sql": "-- To do -- can we delete ticket_status_counter and unique_status_counter?\n\nwith ticket_status_history as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__updates`\n where field_name = 'status'\n\n)\n\n select\n \n ticket_id,\n valid_starting_at,\n valid_ending_at,\n \n \n\n timestamp_diff(\n coalesce(valid_ending_at, \n current_timestamp\n),\n valid_starting_at,\n minute\n )\n\n\n as status_duration_calendar_minutes,\n value as status,\n -- MIGHT BE ABLE TO DELETE ROWS BELOW\n row_number() over (partition by ticket_id order by valid_starting_at) as ticket_status_counter,\n row_number() over (partition by ticket_id, value order by valid_starting_at) as unique_status_counter\n\n from ticket_status_history", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_status`"}, "model.zendesk.int_zendesk__user_aggregates": {"raw_sql": "with users as (\n select *\n from {{ ref('stg_zendesk__user') }}\n\n--If you use user tags this will be included, if not it will be ignored.\n{% if var('using_user_tags', True) %}\n), user_tags as (\n\n select *\n from {{ ref('stg_zendesk__user_tag') }}\n \n), user_tag_aggregate as (\n select\n user_tags.user_id,\n {{ fivetran_utils.string_agg( 'user_tags.tags', \"', '\" )}} as user_tags\n from user_tags\n group by 1\n\n{% endif %}\n\n), final as (\n select \n users.*\n\n --If you use user tags this will be included, if not it will be ignored.\n {% if var('using_user_tags', True) %}\n ,user_tag_aggregate.user_tags\n {% endif %}\n from users\n\n --If you use user tags this will be included, if not it will be ignored.\n {% if var('using_user_tags', True) %}\n left join user_tag_aggregate\n using(user_id)\n {% endif %}\n)\n\nselect *\nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.fivetran_utils.string_agg"], "nodes": ["model.zendesk_source.stg_zendesk__user", "model.zendesk_source.stg_zendesk__user_tag"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_intermediate", "fqn": ["zendesk", "intermediate", "int_zendesk__user_aggregates"], "unique_id": "model.zendesk.int_zendesk__user_aggregates", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "intermediate/int_zendesk__user_aggregates.sql", "original_file_path": "models/intermediate/int_zendesk__user_aggregates.sql", "name": "int_zendesk__user_aggregates", "alias": "int_zendesk__user_aggregates", "checksum": {"name": "sha256", "checksum": "ae23565fdc62d13c33ddb03f3b25a5e288ec6e6ffe6b57cb01496be6ecd2b73f"}, "tags": [], "refs": [["stg_zendesk__user"], ["stg_zendesk__user_tag"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/intermediate/int_zendesk__user_aggregates.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk_intermediate", "materialized": "table"}, "created_at": 1644618837.016022, "compiled_sql": "with users as (\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__user`\n\n--If you use user tags this will be included, if not it will be ignored.\n\n), user_tags as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__user_tag`\n \n), user_tag_aggregate as (\n select\n user_tags.user_id,\n \n string_agg(user_tags.tags, ', ')\n\n as user_tags\n from user_tags\n group by 1\n\n\n\n), final as (\n select \n users.*\n\n --If you use user tags this will be included, if not it will be ignored.\n \n ,user_tag_aggregate.user_tags\n \n from users\n\n --If you use user tags this will be included, if not it will be ignored.\n \n left join user_tag_aggregate\n using(user_id)\n \n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__user_aggregates`"}, "model.zendesk.int_zendesk__schedule_spine": {"raw_sql": "{{ config(enabled=var('using_schedules', True)) }}\n\n/*\n The purpose of this model is to create a spine of appropriate timezone offsets to use for schedules, as offsets may change due to Daylight Savings.\n End result will include `valid_from` and `valid_until` columns which we will use downstream to determine which schedule-offset to associate with each ticket (ie standard time vs daylight time)\n*/\n\nwith timezone as (\n\n select *\n from {{ var('time_zone') }}\n\n), daylight_time as (\n\n select *\n from {{ var('daylight_time') }}\n\n), schedule as (\n\n select *\n from {{ var('schedule') }} \n\n), timezone_with_dt as (\n\n select \n timezone.*,\n daylight_time.daylight_start_utc,\n daylight_time.daylight_end_utc,\n daylight_time.daylight_offset_minutes\n\n from timezone \n left join daylight_time \n on timezone.time_zone = daylight_time.time_zone\n\n), order_timezone_dt as (\n\n select \n *,\n -- will be null for timezones without any daylight savings records (and the first entry)\n -- we will coalesce the first entry date with .... the X years ago\n lag(daylight_end_utc, 1) over (partition by time_zone order by daylight_end_utc asc) as last_daylight_end_utc,\n -- will be null for timezones without any daylight savings records (and the last entry)\n -- we will coalesce the last entry date with the current date \n lead(daylight_start_utc, 1) over (partition by time_zone order by daylight_start_utc asc) as next_daylight_start_utc\n\n from timezone_with_dt\n\n), split_timezones as (\n\n -- standard schedule (includes timezones without DT)\n -- starts: when the last Daylight Savings ended\n -- ends: when the next Daylight Savings starts\n select \n time_zone,\n standard_offset_minutes as offset_minutes,\n\n -- last_daylight_end_utc is null for the first record of the time_zone's daylight time, or if the TZ doesn't use DT\n coalesce(last_daylight_end_utc, cast('1970-01-01' as date)) as valid_from,\n\n -- daylight_start_utc is null for timezones that don't use DT\n coalesce(daylight_start_utc, cast( {{ dbt_utils.dateadd('year', 1, dbt_utils.current_timestamp()) }} as date)) as valid_until\n\n from order_timezone_dt\n\n union all \n\n -- DT schedule (excludes timezones without it)\n -- starts: when this Daylight Savings started\n -- ends: when this Daylight Savings ends\n select \n time_zone,\n -- Pacific Time is -8h during standard time and -7h during DT\n standard_offset_minutes + daylight_offset_minutes as offset_minutes,\n daylight_start_utc as valid_from,\n daylight_end_utc as valid_until\n\n from order_timezone_dt\n where daylight_offset_minutes is not null\n\n), calculate_schedules as (\n\n select \n schedule.schedule_id,\n schedule.time_zone,\n schedule.start_time,\n schedule.end_time,\n schedule.created_at,\n schedule.schedule_name,\n schedule.start_time - coalesce(split_timezones.offset_minutes, 0) as start_time_utc,\n schedule.end_time - coalesce(split_timezones.offset_minutes, 0) as end_time_utc,\n\n -- we'll use these to determine which schedule version to associate tickets with\n split_timezones.valid_from,\n split_timezones.valid_until\n\n from schedule\n left join split_timezones\n on split_timezones.time_zone = schedule.time_zone\n\n), final as (\n\n select \n *,\n -- might remove this but for testing this is nice to have\n {{ dbt_utils.surrogate_key(['schedule_id', 'time_zone','start_time', 'valid_from']) }} as unqiue_schedule_spine_key\n \n from calculate_schedules\n)\n\nselect *\nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.current_timestamp", "macro.dbt_utils.dateadd", "macro.dbt_utils.surrogate_key"], "nodes": ["model.zendesk_source.stg_zendesk__time_zone", "model.zendesk_source.stg_zendesk__daylight_time", "model.zendesk_source.stg_zendesk__schedule"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_intermediate", "fqn": ["zendesk", "intermediate", "int_zendesk__schedule_spine"], "unique_id": "model.zendesk.int_zendesk__schedule_spine", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "intermediate/int_zendesk__schedule_spine.sql", "original_file_path": "models/intermediate/int_zendesk__schedule_spine.sql", "name": "int_zendesk__schedule_spine", "alias": "int_zendesk__schedule_spine", "checksum": {"name": "sha256", "checksum": "78c270560181b9fb01ce7c29a21aa53cba615d293eac2cab56eacf7a7d6259bb"}, "tags": [], "refs": [["stg_zendesk__time_zone"], ["stg_zendesk__daylight_time"], ["stg_zendesk__schedule"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/intermediate/int_zendesk__schedule_spine.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk_intermediate", "materialized": "table", "enabled": true}, "created_at": 1644618837.0261729, "compiled_sql": "\n\n/*\n The purpose of this model is to create a spine of appropriate timezone offsets to use for schedules, as offsets may change due to Daylight Savings.\n End result will include `valid_from` and `valid_until` columns which we will use downstream to determine which schedule-offset to associate with each ticket (ie standard time vs daylight time)\n*/\n\nwith timezone as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__time_zone`\n\n), daylight_time as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__daylight_time`\n\n), schedule as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__schedule` \n\n), timezone_with_dt as (\n\n select \n timezone.*,\n daylight_time.daylight_start_utc,\n daylight_time.daylight_end_utc,\n daylight_time.daylight_offset_minutes\n\n from timezone \n left join daylight_time \n on timezone.time_zone = daylight_time.time_zone\n\n), order_timezone_dt as (\n\n select \n *,\n -- will be null for timezones without any daylight savings records (and the first entry)\n -- we will coalesce the first entry date with .... the X years ago\n lag(daylight_end_utc, 1) over (partition by time_zone order by daylight_end_utc asc) as last_daylight_end_utc,\n -- will be null for timezones without any daylight savings records (and the last entry)\n -- we will coalesce the last entry date with the current date \n lead(daylight_start_utc, 1) over (partition by time_zone order by daylight_start_utc asc) as next_daylight_start_utc\n\n from timezone_with_dt\n\n), split_timezones as (\n\n -- standard schedule (includes timezones without DT)\n -- starts: when the last Daylight Savings ended\n -- ends: when the next Daylight Savings starts\n select \n time_zone,\n standard_offset_minutes as offset_minutes,\n\n -- last_daylight_end_utc is null for the first record of the time_zone's daylight time, or if the TZ doesn't use DT\n coalesce(last_daylight_end_utc, cast('1970-01-01' as date)) as valid_from,\n\n -- daylight_start_utc is null for timezones that don't use DT\n coalesce(daylight_start_utc, cast( \n\n datetime_add(\n cast( \n current_timestamp\n as datetime),\n interval 1 year\n )\n\n as date)) as valid_until\n\n from order_timezone_dt\n\n union all \n\n -- DT schedule (excludes timezones without it)\n -- starts: when this Daylight Savings started\n -- ends: when this Daylight Savings ends\n select \n time_zone,\n -- Pacific Time is -8h during standard time and -7h during DT\n standard_offset_minutes + daylight_offset_minutes as offset_minutes,\n daylight_start_utc as valid_from,\n daylight_end_utc as valid_until\n\n from order_timezone_dt\n where daylight_offset_minutes is not null\n\n), calculate_schedules as (\n\n select \n schedule.schedule_id,\n schedule.time_zone,\n schedule.start_time,\n schedule.end_time,\n schedule.created_at,\n schedule.schedule_name,\n schedule.start_time - coalesce(split_timezones.offset_minutes, 0) as start_time_utc,\n schedule.end_time - coalesce(split_timezones.offset_minutes, 0) as end_time_utc,\n\n -- we'll use these to determine which schedule version to associate tickets with\n split_timezones.valid_from,\n split_timezones.valid_until\n\n from schedule\n left join split_timezones\n on split_timezones.time_zone = schedule.time_zone\n\n), final as (\n\n select \n *,\n -- might remove this but for testing this is nice to have\n to_hex(md5(cast(coalesce(cast(schedule_id as \n string\n), '') || '-' || coalesce(cast(time_zone as \n string\n), '') || '-' || coalesce(cast(start_time as \n string\n), '') || '-' || coalesce(cast(valid_from as \n string\n), '') as \n string\n))) as unqiue_schedule_spine_key\n \n from calculate_schedules\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__schedule_spine`"}, "model.zendesk.int_zendesk__ticket_schedules": {"raw_sql": "{{ config(enabled=var('using_schedules', True)) }}\n\nwith ticket as (\n \n select *\n from {{ ref('stg_zendesk__ticket') }}\n\n), ticket_schedule as (\n \n select *\n from {{ ref('stg_zendesk__ticket_schedule') }}\n\n), schedule as (\n \n select *\n from {{ ref('stg_zendesk__schedule') }}\n\n\n), default_schedule_events as (\n-- Goal: understand the working schedules applied to tickets, so that we can then determine the applicable business hours/schedule.\n-- Your default schedule is used for all tickets, unless you set up a trigger to apply a specific schedule to specific tickets.\n\n-- This portion of the query creates ticket_schedules for these \"default\" schedules, as the ticket_schedule table only includes\n-- trigger schedules\n\n{% if execute %}\n\n {% set default_schedule_id_query %}\n with set_default_schedule_flag as (\n select \n row_number() over (order by created_at) = 1 as is_default_schedule,\n schedule_id\n from {{ ref('stg_zendesk__schedule') }}\n )\n select \n schedule_id\n from set_default_schedule_flag\n where is_default_schedule\n\n {% endset %}\n\n {% set default_schedule_id = run_query(default_schedule_id_query).columns[0][0]|string %}\n\n {% endif %}\n\n select\n ticket.ticket_id,\n ticket.created_at as schedule_created_at,\n '{{default_schedule_id}}' as schedule_id\n from ticket\n left join ticket_schedule as first_schedule\n on first_schedule.ticket_id = ticket.ticket_id\n and {{ fivetran_utils.timestamp_add('second', -5, 'first_schedule.created_at') }} <= ticket.created_at\n and first_schedule.created_at >= ticket.created_at \n where first_schedule.ticket_id is null\n\n), schedule_events as (\n \n select\n *\n from default_schedule_events\n \n union all\n \n select \n ticket_id,\n created_at as schedule_created_at,\n schedule_id\n from ticket_schedule\n\n), ticket_schedules as (\n \n select \n ticket_id,\n schedule_id,\n schedule_created_at,\n coalesce(lead(schedule_created_at) over (partition by ticket_id order by schedule_created_at)\n , {{ fivetran_utils.timestamp_add(\"hour\", 1000, \"\" ~ dbt_utils.current_timestamp() ~ \"\") }} ) as schedule_invalidated_at\n from schedule_events\n\n)\n\nselect *\nfrom ticket_schedules", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.fivetran_utils.timestamp_add", "macro.dbt_utils.current_timestamp", "macro.dbt.run_query"], "nodes": ["model.zendesk_source.stg_zendesk__ticket", "model.zendesk_source.stg_zendesk__ticket_schedule", "model.zendesk_source.stg_zendesk__schedule"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_intermediate", "fqn": ["zendesk", "intermediate", "int_zendesk__ticket_schedules"], "unique_id": "model.zendesk.int_zendesk__ticket_schedules", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "intermediate/int_zendesk__ticket_schedules.sql", "original_file_path": "models/intermediate/int_zendesk__ticket_schedules.sql", "name": "int_zendesk__ticket_schedules", "alias": "int_zendesk__ticket_schedules", "checksum": {"name": "sha256", "checksum": "8f3c648f3f5ba8de9387499ad4f9ddb2382fcec13b93e05255b18d2f81f83e94"}, "tags": [], "refs": [["stg_zendesk__ticket"], ["stg_zendesk__ticket_schedule"], ["stg_zendesk__schedule"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/intermediate/int_zendesk__ticket_schedules.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk_intermediate", "materialized": "table", "enabled": true}, "created_at": 1644618837.041325, "compiled_sql": "\n\nwith ticket as (\n \n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket`\n\n), ticket_schedule as (\n \n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket_schedule`\n\n), schedule as (\n \n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__schedule`\n\n\n), default_schedule_events as (\n-- Goal: understand the working schedules applied to tickets, so that we can then determine the applicable business hours/schedule.\n-- Your default schedule is used for all tickets, unless you set up a trigger to apply a specific schedule to specific tickets.\n\n-- This portion of the query creates ticket_schedules for these \"default\" schedules, as the ticket_schedule table only includes\n-- trigger schedules\n\n\n\n \n\n \n\n \n\n select\n ticket.ticket_id,\n ticket.created_at as schedule_created_at,\n '1500001040242' as schedule_id\n from ticket\n left join ticket_schedule as first_schedule\n on first_schedule.ticket_id = ticket.ticket_id\n and \n\n timestamp_add(first_schedule.created_at, interval -5 second)\n\n <= ticket.created_at\n and first_schedule.created_at >= ticket.created_at \n where first_schedule.ticket_id is null\n\n), schedule_events as (\n \n select\n *\n from default_schedule_events\n \n union all\n \n select \n ticket_id,\n created_at as schedule_created_at,\n schedule_id\n from ticket_schedule\n\n), ticket_schedules as (\n \n select \n ticket_id,\n schedule_id,\n schedule_created_at,\n coalesce(lead(schedule_created_at) over (partition by ticket_id order by schedule_created_at)\n , \n\n timestamp_add(\n current_timestamp\n, interval 1000 hour)\n\n ) as schedule_invalidated_at\n from schedule_events\n\n)\n\nselect *\nfrom ticket_schedules", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_schedules`"}, "model.zendesk.int_zendesk__assignee_updates": {"raw_sql": "with ticket_updates as (\n select *\n from {{ ref('int_zendesk__updates') }}\n\n), ticket as (\n select *\n from {{ ref('stg_zendesk__ticket') }}\n\n), ticket_requester as (\n select\n ticket.ticket_id,\n ticket.assignee_id,\n ticket_updates.valid_starting_at\n\n from ticket\n\n left join ticket_updates\n on ticket_updates.ticket_id = ticket.ticket_id\n and ticket_updates.user_id = ticket.assignee_id\n\n), final as (\n select \n ticket_id,\n assignee_id,\n max(valid_starting_at) as last_updated,\n count(*) as total_updates\n from ticket_requester\n\n group by 1, 2\n)\n\nselect * \nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.zendesk.int_zendesk__updates", "model.zendesk_source.stg_zendesk__ticket"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_intermediate", "fqn": ["zendesk", "intermediate", "int_zendesk__assignee_updates"], "unique_id": "model.zendesk.int_zendesk__assignee_updates", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "intermediate/int_zendesk__assignee_updates.sql", "original_file_path": "models/intermediate/int_zendesk__assignee_updates.sql", "name": "int_zendesk__assignee_updates", "alias": "int_zendesk__assignee_updates", "checksum": {"name": "sha256", "checksum": "951ec2d4f8c9a7470a50cfc6e01838a090472a9f18fccd2dd65097d309d43aed"}, "tags": [], "refs": [["int_zendesk__updates"], ["stg_zendesk__ticket"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/intermediate/int_zendesk__assignee_updates.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk_intermediate", "materialized": "table"}, "created_at": 1644618837.051326, "compiled_sql": "with ticket_updates as (\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__updates`\n\n), ticket as (\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket`\n\n), ticket_requester as (\n select\n ticket.ticket_id,\n ticket.assignee_id,\n ticket_updates.valid_starting_at\n\n from ticket\n\n left join ticket_updates\n on ticket_updates.ticket_id = ticket.ticket_id\n and ticket_updates.user_id = ticket.assignee_id\n\n), final as (\n select \n ticket_id,\n assignee_id,\n max(valid_starting_at) as last_updated,\n count(*) as total_updates\n from ticket_requester\n\n group by 1, 2\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__assignee_updates`"}, "model.zendesk.int_zendesk__comment_metrics": {"raw_sql": "with ticket_comments as (\n\n select *\n from {{ ref('int_zendesk__comments_enriched') }}\n),\n\ncomment_counts as (\n select\n ticket_id,\n last_comment_added_at,\n sum(case when commenter_role = 'internal_comment' and is_public = true\n then 1\n else 0\n end) as count_public_agent_comments,\n sum(case when commenter_role = 'internal_comment'\n then 1\n else 0\n end) as count_agent_comments,\n sum(case when commenter_role = 'external_comment'\n then 1\n else 0\n end) as count_end_user_comments,\n sum(case when is_public = true\n then 1\n else 0\n end) as count_public_comments,\n sum(case when is_public = false\n then 1\n else 0\n end) as count_internal_comments,\n count(*) as total_comments,\n count(distinct case when commenter_role = 'internal_comment'\n then user_id\n end) as count_ticket_handoffs\n from ticket_comments\n\n group by 1, 2\n),\n\nfinal as (\n select\n *,\n count_public_agent_comments = 1 as is_one_touch_resolution,\n count_public_agent_comments = 2 as is_two_touch_resolution\n from comment_counts\n)\n\nselect * \nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.zendesk.int_zendesk__comments_enriched"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_intermediate", "fqn": ["zendesk", "intermediate", "int_zendesk__comment_metrics"], "unique_id": "model.zendesk.int_zendesk__comment_metrics", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "intermediate/int_zendesk__comment_metrics.sql", "original_file_path": "models/intermediate/int_zendesk__comment_metrics.sql", "name": "int_zendesk__comment_metrics", "alias": "int_zendesk__comment_metrics", "checksum": {"name": "sha256", "checksum": "55c61cb79adcf74f427896f7e3c61dc3cae6f12ef2e61736b17efd913e232e4c"}, "tags": [], "refs": [["int_zendesk__comments_enriched"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/intermediate/int_zendesk__comment_metrics.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk_intermediate", "materialized": "table"}, "created_at": 1644618837.0541482, "compiled_sql": "with __dbt__cte__int_zendesk__comments_enriched as (\nwith ticket_comment as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__updates`\n where field_name = 'comment'\n\n), users as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__user`\n\n), joined as (\n\n select \n\n ticket_comment.*,\n case when commenter.role = 'end-user' then 'external_comment'\n when commenter.role in ('agent','admin') then 'internal_comment'\n else 'unknown' end as commenter_role\n \n from ticket_comment\n \n join users as commenter\n on commenter.user_id = ticket_comment.user_id\n\n), add_previous_commenter_role as (\n /*\n In int_zendesk__ticket_reply_times we will only be focusing on reply times between public tickets.\n The below union explicitly identifies the previous commentor roles of public and not public comments.\n */\n select\n *,\n coalesce(\n lag(commenter_role) over (partition by ticket_id order by valid_starting_at)\n , 'first_comment') \n as previous_commenter_role\n from joined\n where is_public\n\n union all\n\n select\n *,\n 'non_public_comment' as previous_commenter_role\n from joined\n where not is_public\n)\n\nselect \n *,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_comment_added_at\nfrom add_previous_commenter_role\n),ticket_comments as (\n\n select *\n from __dbt__cte__int_zendesk__comments_enriched\n),\n\ncomment_counts as (\n select\n ticket_id,\n last_comment_added_at,\n sum(case when commenter_role = 'internal_comment' and is_public = true\n then 1\n else 0\n end) as count_public_agent_comments,\n sum(case when commenter_role = 'internal_comment'\n then 1\n else 0\n end) as count_agent_comments,\n sum(case when commenter_role = 'external_comment'\n then 1\n else 0\n end) as count_end_user_comments,\n sum(case when is_public = true\n then 1\n else 0\n end) as count_public_comments,\n sum(case when is_public = false\n then 1\n else 0\n end) as count_internal_comments,\n count(*) as total_comments,\n count(distinct case when commenter_role = 'internal_comment'\n then user_id\n end) as count_ticket_handoffs\n from ticket_comments\n\n group by 1, 2\n),\n\nfinal as (\n select\n *,\n count_public_agent_comments = 1 as is_one_touch_resolution,\n count_public_agent_comments = 2 as is_two_touch_resolution\n from comment_counts\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [{"id": "model.zendesk.int_zendesk__comments_enriched", "sql": " __dbt__cte__int_zendesk__comments_enriched as (\nwith ticket_comment as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__updates`\n where field_name = 'comment'\n\n), users as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__user`\n\n), joined as (\n\n select \n\n ticket_comment.*,\n case when commenter.role = 'end-user' then 'external_comment'\n when commenter.role in ('agent','admin') then 'internal_comment'\n else 'unknown' end as commenter_role\n \n from ticket_comment\n \n join users as commenter\n on commenter.user_id = ticket_comment.user_id\n\n), add_previous_commenter_role as (\n /*\n In int_zendesk__ticket_reply_times we will only be focusing on reply times between public tickets.\n The below union explicitly identifies the previous commentor roles of public and not public comments.\n */\n select\n *,\n coalesce(\n lag(commenter_role) over (partition by ticket_id order by valid_starting_at)\n , 'first_comment') \n as previous_commenter_role\n from joined\n where is_public\n\n union all\n\n select\n *,\n 'non_public_comment' as previous_commenter_role\n from joined\n where not is_public\n)\n\nselect \n *,\n first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_comment_added_at\nfrom add_previous_commenter_role\n)"}], "relation_name": "`dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__comment_metrics`"}, "model.zendesk.int_zendesk__ticket_historical_group": {"raw_sql": "with ticket_group_history as (\n\n select *\n from {{ ref('int_zendesk__updates') }}\n where field_name = 'group_id'\n\n), group_breakdown as (\n select\n \n ticket_id,\n valid_starting_at,\n valid_ending_at,\n value as group_id\n from ticket_group_history\n\n), final as (\n select\n ticket_id,\n count(group_id) as group_stations_count\n from group_breakdown\n\n group by 1\n)\n\nselect *\nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.zendesk.int_zendesk__updates"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_intermediate", "fqn": ["zendesk", "intermediate", "int_zendesk__ticket_historical_group"], "unique_id": "model.zendesk.int_zendesk__ticket_historical_group", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "intermediate/int_zendesk__ticket_historical_group.sql", "original_file_path": "models/intermediate/int_zendesk__ticket_historical_group.sql", "name": "int_zendesk__ticket_historical_group", "alias": "int_zendesk__ticket_historical_group", "checksum": {"name": "sha256", "checksum": "7d4d72f5d6a7ef73a23ad4be966b00683532fe2a11c9729a8d640752ebee1adc"}, "tags": [], "refs": [["int_zendesk__updates"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/intermediate/int_zendesk__ticket_historical_group.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk_intermediate", "materialized": "table"}, "created_at": 1644618837.057097, "compiled_sql": "with ticket_group_history as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__updates`\n where field_name = 'group_id'\n\n), group_breakdown as (\n select\n \n ticket_id,\n valid_starting_at,\n valid_ending_at,\n value as group_id\n from ticket_group_history\n\n), final as (\n select\n ticket_id,\n count(group_id) as group_stations_count\n from group_breakdown\n\n group by 1\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_group`"}, "model.zendesk.int_zendesk__requester_updates": {"raw_sql": "with ticket_updates as (\n select *\n from {{ ref('int_zendesk__updates') }}\n\n), ticket as (\n select *\n from {{ ref('stg_zendesk__ticket') }}\n\n), ticket_requester as (\n select\n ticket.ticket_id,\n ticket.requester_id,\n ticket_updates.valid_starting_at\n\n from ticket\n\n left join ticket_updates\n on ticket_updates.ticket_id = ticket.ticket_id\n and ticket_updates.user_id = ticket.requester_id\n\n), final as (\n select \n ticket_id,\n requester_id,\n max(valid_starting_at) as last_updated,\n count(*) as total_updates\n from ticket_requester\n\n group by 1, 2\n)\n\nselect * \nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.zendesk.int_zendesk__updates", "model.zendesk_source.stg_zendesk__ticket"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_intermediate", "fqn": ["zendesk", "intermediate", "int_zendesk__requester_updates"], "unique_id": "model.zendesk.int_zendesk__requester_updates", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "intermediate/int_zendesk__requester_updates.sql", "original_file_path": "models/intermediate/int_zendesk__requester_updates.sql", "name": "int_zendesk__requester_updates", "alias": "int_zendesk__requester_updates", "checksum": {"name": "sha256", "checksum": "b2d14b09db3cadfb56e4b3dcb55c4f9000e670e3c7c29ef89b249e626e8ba103"}, "tags": [], "refs": [["int_zendesk__updates"], ["stg_zendesk__ticket"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/intermediate/int_zendesk__requester_updates.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk_intermediate", "materialized": "table"}, "created_at": 1644618837.059513, "compiled_sql": "with ticket_updates as (\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__updates`\n\n), ticket as (\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket`\n\n), ticket_requester as (\n select\n ticket.ticket_id,\n ticket.requester_id,\n ticket_updates.valid_starting_at\n\n from ticket\n\n left join ticket_updates\n on ticket_updates.ticket_id = ticket.ticket_id\n and ticket_updates.user_id = ticket.requester_id\n\n), final as (\n select \n ticket_id,\n requester_id,\n max(valid_starting_at) as last_updated,\n count(*) as total_updates\n from ticket_requester\n\n group by 1, 2\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__requester_updates`"}, "model.zendesk.int_zendesk__ticket_historical_satisfaction": {"raw_sql": "with satisfaction_updates as (\n\n select *\n from {{ ref('int_zendesk__updates') }}\n where field_name in ('satisfaction_score', 'satisfaction_comment', 'satisfaction_reason_code') \n\n), latest_reason as (\n select\n ticket_id,\n first_value(value) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as latest_satisfaction_reason\n from satisfaction_updates\n\n where field_name = 'satisfaction_reason_code'\n\n), latest_comment as (\n select\n ticket_id,\n first_value(value) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as latest_satisfaction_comment\n from satisfaction_updates\n\n where field_name = 'satisfaction_comment'\n\n), first_and_latest_score as (\n select\n ticket_id,\n first_value(value) over (partition by ticket_id order by valid_starting_at, ticket_id rows unbounded preceding) as first_satisfaction_score,\n first_value(value) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as latest_satisfaction_score\n from satisfaction_updates\n\n where field_name = 'satisfaction_score' and value != 'offered'\n\n), satisfaction_scores as (\n select\n ticket_id,\n count(value) over (partition by ticket_id) as count_satisfaction_scores,\n case when lag(value) over (partition by ticket_id order by valid_starting_at desc) = 'good' and value = 'bad'\n then 1\n else 0\n end as good_to_bad_score,\n case when lag(value) over (partition by ticket_id order by valid_starting_at desc) = 'bad' and value = 'good'\n then 1\n else 0\n end as bad_to_good_score\n from satisfaction_updates\n where field_name = 'satisfaction_score'\n\n), score_group as (\n select\n ticket_id,\n count_satisfaction_scores,\n sum(good_to_bad_score) as total_good_to_bad_score,\n sum(bad_to_good_score) as total_bad_to_good_score\n from satisfaction_scores\n\n group by 1, 2\n\n), window_group as (\n select\n satisfaction_updates.ticket_id,\n latest_reason.latest_satisfaction_reason,\n latest_comment.latest_satisfaction_comment,\n first_and_latest_score.first_satisfaction_score,\n first_and_latest_score.latest_satisfaction_score,\n score_group.count_satisfaction_scores,\n score_group.total_good_to_bad_score,\n score_group.total_bad_to_good_score\n\n from satisfaction_updates\n\n left join latest_reason\n on satisfaction_updates.ticket_id = latest_reason.ticket_id\n\n left join latest_comment\n on satisfaction_updates.ticket_id = latest_comment.ticket_id\n\n left join first_and_latest_score\n on satisfaction_updates.ticket_id = first_and_latest_score.ticket_id\n\n left join score_group\n on satisfaction_updates.ticket_id = score_group.ticket_id\n\n group by 1, 2, 3, 4, 5, 6, 7, 8\n\n), final as (\n select\n ticket_id,\n latest_satisfaction_reason,\n latest_satisfaction_comment,\n first_satisfaction_score,\n latest_satisfaction_score,\n case when count_satisfaction_scores > 0\n then (count_satisfaction_scores - 1) --Subtracting one as the first score is always \"offered\".\n else count_satisfaction_scores\n end as count_satisfaction_scores,\n case when total_good_to_bad_score > 0\n then true\n else false\n end as is_good_to_bad_satisfaction_score,\n case when total_bad_to_good_score > 0\n then true\n else false\n end as is_bad_to_good_satisfaction_score\n from window_group\n)\n\nselect *\nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.zendesk.int_zendesk__updates"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_intermediate", "fqn": ["zendesk", "intermediate", "int_zendesk__ticket_historical_satisfaction"], "unique_id": "model.zendesk.int_zendesk__ticket_historical_satisfaction", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "intermediate/int_zendesk__ticket_historical_satisfaction.sql", "original_file_path": "models/intermediate/int_zendesk__ticket_historical_satisfaction.sql", "name": "int_zendesk__ticket_historical_satisfaction", "alias": "int_zendesk__ticket_historical_satisfaction", "checksum": {"name": "sha256", "checksum": "dce9b5b8705d72688802f99250a8f8a34b8791c3cb440f85efa11f09ebfe3e1d"}, "tags": [], "refs": [["int_zendesk__updates"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/intermediate/int_zendesk__ticket_historical_satisfaction.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk_intermediate", "materialized": "table"}, "created_at": 1644618837.062434, "compiled_sql": "with satisfaction_updates as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__updates`\n where field_name in ('satisfaction_score', 'satisfaction_comment', 'satisfaction_reason_code') \n\n), latest_reason as (\n select\n ticket_id,\n first_value(value) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as latest_satisfaction_reason\n from satisfaction_updates\n\n where field_name = 'satisfaction_reason_code'\n\n), latest_comment as (\n select\n ticket_id,\n first_value(value) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as latest_satisfaction_comment\n from satisfaction_updates\n\n where field_name = 'satisfaction_comment'\n\n), first_and_latest_score as (\n select\n ticket_id,\n first_value(value) over (partition by ticket_id order by valid_starting_at, ticket_id rows unbounded preceding) as first_satisfaction_score,\n first_value(value) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as latest_satisfaction_score\n from satisfaction_updates\n\n where field_name = 'satisfaction_score' and value != 'offered'\n\n), satisfaction_scores as (\n select\n ticket_id,\n count(value) over (partition by ticket_id) as count_satisfaction_scores,\n case when lag(value) over (partition by ticket_id order by valid_starting_at desc) = 'good' and value = 'bad'\n then 1\n else 0\n end as good_to_bad_score,\n case when lag(value) over (partition by ticket_id order by valid_starting_at desc) = 'bad' and value = 'good'\n then 1\n else 0\n end as bad_to_good_score\n from satisfaction_updates\n where field_name = 'satisfaction_score'\n\n), score_group as (\n select\n ticket_id,\n count_satisfaction_scores,\n sum(good_to_bad_score) as total_good_to_bad_score,\n sum(bad_to_good_score) as total_bad_to_good_score\n from satisfaction_scores\n\n group by 1, 2\n\n), window_group as (\n select\n satisfaction_updates.ticket_id,\n latest_reason.latest_satisfaction_reason,\n latest_comment.latest_satisfaction_comment,\n first_and_latest_score.first_satisfaction_score,\n first_and_latest_score.latest_satisfaction_score,\n score_group.count_satisfaction_scores,\n score_group.total_good_to_bad_score,\n score_group.total_bad_to_good_score\n\n from satisfaction_updates\n\n left join latest_reason\n on satisfaction_updates.ticket_id = latest_reason.ticket_id\n\n left join latest_comment\n on satisfaction_updates.ticket_id = latest_comment.ticket_id\n\n left join first_and_latest_score\n on satisfaction_updates.ticket_id = first_and_latest_score.ticket_id\n\n left join score_group\n on satisfaction_updates.ticket_id = score_group.ticket_id\n\n group by 1, 2, 3, 4, 5, 6, 7, 8\n\n), final as (\n select\n ticket_id,\n latest_satisfaction_reason,\n latest_satisfaction_comment,\n first_satisfaction_score,\n latest_satisfaction_score,\n case when count_satisfaction_scores > 0\n then (count_satisfaction_scores - 1) --Subtracting one as the first score is always \"offered\".\n else count_satisfaction_scores\n end as count_satisfaction_scores,\n case when total_good_to_bad_score > 0\n then true\n else false\n end as is_good_to_bad_satisfaction_score,\n case when total_bad_to_good_score > 0\n then true\n else false\n end as is_bad_to_good_satisfaction_score\n from window_group\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_historical_satisfaction`"}, "model.zendesk.int_zendesk__latest_ticket_form": {"raw_sql": "--To disable this model, set the using_ticket_form_history variable within your dbt_project.yml file to False.\n{{ config(enabled=var('using_ticket_form_history', True)) }}\n\nwith ticket_form_history as (\n select *\n from {{ ref('stg_zendesk__ticket_form_history') }}\n),\n\nlatest_ticket_form as (\n select\n *,\n row_number() over(partition by ticket_form_id order by updated_at desc) as latest_form_index\n from ticket_form_history\n),\n\nfinal as (\n select \n ticket_form_id,\n created_at,\n updated_at,\n display_name,\n is_active,\n name,\n latest_form_index\n from latest_ticket_form\n\n where latest_form_index = 1\n)\n\nselect *\nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["model.zendesk_source.stg_zendesk__ticket_form_history"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_intermediate", "fqn": ["zendesk", "intermediate", "int_zendesk__latest_ticket_form"], "unique_id": "model.zendesk.int_zendesk__latest_ticket_form", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "intermediate/int_zendesk__latest_ticket_form.sql", "original_file_path": "models/intermediate/int_zendesk__latest_ticket_form.sql", "name": "int_zendesk__latest_ticket_form", "alias": "int_zendesk__latest_ticket_form", "checksum": {"name": "sha256", "checksum": "906a97576bff9f4fead3b0ed4632aa8a04b94f523e62b0e05425770213f78ea5"}, "tags": [], "refs": [["stg_zendesk__ticket_form_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/intermediate/int_zendesk__latest_ticket_form.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk_intermediate", "materialized": "table", "enabled": true}, "created_at": 1644618837.065156, "compiled_sql": "--To disable this model, set the using_ticket_form_history variable within your dbt_project.yml file to False.\n\n\nwith ticket_form_history as (\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket_form_history`\n),\n\nlatest_ticket_form as (\n select\n *,\n row_number() over(partition by ticket_form_id order by updated_at desc) as latest_form_index\n from ticket_form_history\n),\n\nfinal as (\n select \n ticket_form_id,\n created_at,\n updated_at,\n display_name,\n is_active,\n name,\n latest_form_index\n from latest_ticket_form\n\n where latest_form_index = 1\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__latest_ticket_form`"}, "model.zendesk.int_zendesk__ticket_aggregates": {"raw_sql": "with tickets as (\n select *\n from {{ ref('stg_zendesk__ticket') }}\n\n), ticket_tags as (\n\n select *\n from {{ ref('stg_zendesk__ticket_tag') }}\n\n), brands as (\n\n select *\n from {{ ref('stg_zendesk__brand') }}\n \n), ticket_tag_aggregate as (\n select\n ticket_tags.ticket_id,\n {{ fivetran_utils.string_agg( 'ticket_tags.tags', \"', '\" )}} as ticket_tags\n from ticket_tags\n group by 1\n\n), final as (\n select \n tickets.*,\n case when lower(tickets.type) = 'incident'\n then true\n else false\n end as is_incident,\n brands.name as ticket_brand_name,\n ticket_tag_aggregate.ticket_tags\n from tickets\n\n left join ticket_tag_aggregate\n using(ticket_id)\n\n left join brands\n on brands.brand_id = tickets.brand_id\n)\n\nselect *\nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.fivetran_utils.string_agg"], "nodes": ["model.zendesk_source.stg_zendesk__ticket", "model.zendesk_source.stg_zendesk__ticket_tag", "model.zendesk_source.stg_zendesk__brand"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_intermediate", "fqn": ["zendesk", "intermediate", "int_zendesk__ticket_aggregates"], "unique_id": "model.zendesk.int_zendesk__ticket_aggregates", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "intermediate/int_zendesk__ticket_aggregates.sql", "original_file_path": "models/intermediate/int_zendesk__ticket_aggregates.sql", "name": "int_zendesk__ticket_aggregates", "alias": "int_zendesk__ticket_aggregates", "checksum": {"name": "sha256", "checksum": "cef0c080fae7a2b361b077473aa1ccfd4bfa472469b9006038aa3866a5bf8b50"}, "tags": [], "refs": [["stg_zendesk__ticket"], ["stg_zendesk__ticket_tag"], ["stg_zendesk__brand"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/intermediate/int_zendesk__ticket_aggregates.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk_intermediate", "materialized": "table"}, "created_at": 1644618837.071167, "compiled_sql": "with tickets as (\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket`\n\n), ticket_tags as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket_tag`\n\n), brands as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__brand`\n \n), ticket_tag_aggregate as (\n select\n ticket_tags.ticket_id,\n \n string_agg(ticket_tags.tags, ', ')\n\n as ticket_tags\n from ticket_tags\n group by 1\n\n), final as (\n select \n tickets.*,\n case when lower(tickets.type) = 'incident'\n then true\n else false\n end as is_incident,\n brands.name as ticket_brand_name,\n ticket_tag_aggregate.ticket_tags\n from tickets\n\n left join ticket_tag_aggregate\n using(ticket_id)\n\n left join brands\n on brands.brand_id = tickets.brand_id\n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__ticket_aggregates`"}, "model.zendesk.int_zendesk__organization_aggregates": {"raw_sql": "with organizations as (\n select * \n from {{ ref('stg_zendesk__organization') }}\n\n--If you use organization tags this will be included, if not it will be ignored.\n{% if var('using_organization_tags', True) %}\n), organization_tags as (\n select * \n from {{ ref('stg_zendesk__organization_tag') }}\n\n), tag_aggregates as (\n select\n organizations.organization_id,\n {{ fivetran_utils.string_agg('organization_tags.tags', \"', '\" ) }} as organization_tags\n from organizations\n\n left join organization_tags\n using (organization_id)\n\n group by 1\n{% endif %}\n\n--If you use using_domain_names tags this will be included, if not it will be ignored.\n{% if var('using_domain_names', True) %}\n), domain_names as (\n\n select *\n from {{ ref('stg_zendesk__domain_name') }}\n\n), domain_aggregates as (\n select\n organizations.organization_id,\n {{ fivetran_utils.string_agg('domain_names.domain_name', \"', '\" ) }} as domain_names\n from organizations\n\n left join domain_names\n using(organization_id)\n \n group by 1\n{% endif %}\n\n\n), final as (\n select\n organizations.*\n\n --If you use organization tags this will be included, if not it will be ignored.\n {% if var('using_organization_tags', True) %}\n ,tag_aggregates.organization_tags\n {% endif %}\n\n --If you use using_domain_names tags this will be included, if not it will be ignored.\n {% if var('using_domain_names', True) %}\n ,domain_aggregates.domain_names\n {% endif %}\n\n from organizations\n\n --If you use using_domain_names tags this will be included, if not it will be ignored.\n {% if var('using_domain_names', True) %}\n left join domain_aggregates\n using(organization_id)\n {% endif %}\n\n --If you use organization tags this will be included, if not it will be ignored.\n {% if var('using_organization_tags', True) %}\n left join tag_aggregates\n using(organization_id)\n {% endif %}\n)\n\nselect *\nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.fivetran_utils.string_agg"], "nodes": ["model.zendesk_source.stg_zendesk__organization", "model.zendesk_source.stg_zendesk__organization_tag", "model.zendesk_source.stg_zendesk__domain_name"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_intermediate", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_intermediate", "fqn": ["zendesk", "intermediate", "int_zendesk__organization_aggregates"], "unique_id": "model.zendesk.int_zendesk__organization_aggregates", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "intermediate/int_zendesk__organization_aggregates.sql", "original_file_path": "models/intermediate/int_zendesk__organization_aggregates.sql", "name": "int_zendesk__organization_aggregates", "alias": "int_zendesk__organization_aggregates", "checksum": {"name": "sha256", "checksum": "a16300f45d2cb0bd1c26dfec62e967a047095b92f340974bfef56178bfff6cf9"}, "tags": [], "refs": [["stg_zendesk__organization"], ["stg_zendesk__organization_tag"], ["stg_zendesk__domain_name"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/intermediate/int_zendesk__organization_aggregates.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk_intermediate", "materialized": "table"}, "created_at": 1644618837.077292, "compiled_sql": "with organizations as (\n select * \n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__organization`\n\n--If you use organization tags this will be included, if not it will be ignored.\n\n), organization_tags as (\n select * \n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__organization_tag`\n\n), tag_aggregates as (\n select\n organizations.organization_id,\n \n string_agg(organization_tags.tags, ', ')\n\n as organization_tags\n from organizations\n\n left join organization_tags\n using (organization_id)\n\n group by 1\n\n\n--If you use using_domain_names tags this will be included, if not it will be ignored.\n\n), domain_names as (\n\n select *\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__domain_name`\n\n), domain_aggregates as (\n select\n organizations.organization_id,\n \n string_agg(domain_names.domain_name, ', ')\n\n as domain_names\n from organizations\n\n left join domain_names\n using(organization_id)\n \n group by 1\n\n\n\n), final as (\n select\n organizations.*\n\n --If you use organization tags this will be included, if not it will be ignored.\n \n ,tag_aggregates.organization_tags\n \n\n --If you use using_domain_names tags this will be included, if not it will be ignored.\n \n ,domain_aggregates.domain_names\n \n\n from organizations\n\n --If you use using_domain_names tags this will be included, if not it will be ignored.\n \n left join domain_aggregates\n using(organization_id)\n \n\n --If you use organization tags this will be included, if not it will be ignored.\n \n left join tag_aggregates\n using(organization_id)\n \n)\n\nselect *\nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_intermediate`.`int_zendesk__organization_aggregates`"}, "operation.zendesk.zendesk-on-run-start-0": {"raw_sql": "{{ fivetran_utils.empty_variable_warning(\"ticket_field_history_columns\", \"zendesk_ticket_field_history\") }}", "compiled": true, "resource_type": "operation", "depends_on": {"macros": ["macro.fivetran_utils.empty_variable_warning"], "nodes": []}, "config": {"enabled": true, "alias": null, "schema": "zendesk", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk", "fqn": ["zendesk", "hooks", "zendesk-on-run-start-0"], "unique_id": "operation.zendesk.zendesk-on-run-start-0", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "hooks/zendesk-on-run-start-0.sql", "original_file_path": "./dbt_project.yml", "name": "zendesk-on-run-start-0", "alias": "zendesk-on-run-start-0", "checksum": {"name": "sha256", "checksum": "56a708e7a81804e2696f6ceec9ab3c1b50d51cdcf2afbecacceb9e3d22f03db8"}, "tags": ["on-run-start"], "refs": [], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/./dbt_project.yml/hooks/zendesk-on-run-start-0.sql", "build_path": null, "deferred": false, "unrendered_config": {"schema": "zendesk", "materialized": "table"}, "created_at": 1644618837.0953128, "compiled_sql": "\n\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "index": 0}, "model.zendesk_source.stg_zendesk__user_tag": {"raw_sql": "--To disable this model, set the using_user_tags variable within your dbt_project.yml file to False.\n{{ config(enabled=var('using_user_tags', True)) }}\n\nwith base as (\n\n select * \n from {{ ref('stg_zendesk__user_tag_tmp') }}\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_zendesk__user_tag_tmp')),\n staging_columns=get_user_tag_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n user_id,\n {% if target.type == 'redshift' %}\n 'tag'\n {% else %}\n tag\n {% endif %}\n as tags\n from fields\n)\n\nselect * \nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.zendesk_source.get_user_tag_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.zendesk_source.stg_zendesk__user_tag_tmp", "model.zendesk_source.stg_zendesk__user_tag_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "stg_zendesk__user_tag"], "unique_id": "model.zendesk_source.stg_zendesk__user_tag", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "stg_zendesk__user_tag.sql", "original_file_path": "models/stg_zendesk__user_tag.sql", "name": "stg_zendesk__user_tag", "alias": "stg_zendesk__user_tag", "checksum": {"name": "sha256", "checksum": "ea77c976e7ee820ea7cc353ea3d30231f262f834d75e4cb251e1a72c92a93462"}, "tags": [], "refs": [["stg_zendesk__user_tag_tmp"], ["stg_zendesk__user_tag_tmp"]], "sources": [], "description": "Table containing all tags associated with a user. Only present if your account has user tagging enabled.", "columns": {"user_id": {"name": "user_id", "description": "Reference to the user", "meta": {}, "data_type": null, "quote": null, "tags": []}, "tag": {"name": "tag", "description": "Tag associated with the user", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "zendesk_source://models/stg_zendesk.yml", "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk__user_tag.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging", "enabled": true}, "created_at": 1644618837.727752, "compiled_sql": "--To disable this model, set the using_user_tags variable within your dbt_project.yml file to False.\n\n\nwith base as (\n\n select * \n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__user_tag_tmp`\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n user_id\n \n as \n \n user_id\n \n, \n \n \n tag\n \n as \n \n tag\n \n\n\n\n \n from base\n),\n\nfinal as (\n \n select \n user_id,\n \n tag\n \n as tags\n from fields\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__user_tag`"}, "model.zendesk_source.stg_zendesk__ticket_tag": {"raw_sql": "with base as (\n\n select * \n from {{ ref('stg_zendesk__ticket_tag_tmp') }}\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_zendesk__ticket_tag_tmp')),\n staging_columns=get_ticket_tag_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n ticket_id,\n {% if target.type == 'redshift' %}\n \"tag\" as tags\n {% else %}\n tag as tags\n {% endif %}\n from fields\n)\n\nselect * \nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.zendesk_source.get_ticket_tag_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.zendesk_source.stg_zendesk__ticket_tag_tmp", "model.zendesk_source.stg_zendesk__ticket_tag_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "stg_zendesk__ticket_tag"], "unique_id": "model.zendesk_source.stg_zendesk__ticket_tag", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "stg_zendesk__ticket_tag.sql", "original_file_path": "models/stg_zendesk__ticket_tag.sql", "name": "stg_zendesk__ticket_tag", "alias": "stg_zendesk__ticket_tag", "checksum": {"name": "sha256", "checksum": "3428fceccfd804f2317fe4404a74ea365549910b484a567ccf5c10556597037a"}, "tags": [], "refs": [["stg_zendesk__ticket_tag_tmp"], ["stg_zendesk__ticket_tag_tmp"]], "sources": [], "description": "Tags are words, or combinations of words, you can use to add more context to tickets. The table lists all tags currently associated with a ticket.\n", "columns": {"ticket_id": {"name": "ticket_id", "description": "The ID of the ticket associated with the tag", "meta": {}, "data_type": null, "quote": null, "tags": []}, "tags": {"name": "tags", "description": "The tag, or word(s), associated with the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "zendesk_source://models/stg_zendesk.yml", "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk__ticket_tag.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging"}, "created_at": 1644618837.7399108, "compiled_sql": "with base as (\n\n select * \n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket_tag_tmp`\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n ticket_id\n \n as \n \n ticket_id\n \n, \n \n \n tag\n \n as \n \n tag\n \n\n\n\n \n from base\n),\n\nfinal as (\n \n select \n ticket_id,\n \n tag as tags\n \n from fields\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket_tag`"}, "model.zendesk_source.stg_zendesk__ticket_field_history": {"raw_sql": "with base as (\n\n select * \n from {{ ref('stg_zendesk__ticket_field_history_tmp') }}\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_zendesk__ticket_field_history_tmp')),\n staging_columns=get_ticket_field_history_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n ticket_id,\n field_name,\n {% if target.type == 'redshift' -%}\n cast(updated as timestamp without time zone) as valid_starting_at,\n cast(lead(updated) over (partition by ticket_id, field_name order by updated) as timestamp without time zone) as valid_ending_at,\n {% else -%}\n updated as valid_starting_at,\n lead(updated) over (partition by ticket_id, field_name order by updated) as valid_ending_at,\n {% endif %}\n value,\n user_id\n from fields\n)\n\nselect * \nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.zendesk_source.get_ticket_field_history_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.zendesk_source.stg_zendesk__ticket_field_history_tmp", "model.zendesk_source.stg_zendesk__ticket_field_history_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "stg_zendesk__ticket_field_history"], "unique_id": "model.zendesk_source.stg_zendesk__ticket_field_history", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "stg_zendesk__ticket_field_history.sql", "original_file_path": "models/stg_zendesk__ticket_field_history.sql", "name": "stg_zendesk__ticket_field_history", "alias": "stg_zendesk__ticket_field_history", "checksum": {"name": "sha256", "checksum": "5433bbc70d70fa389d0f5a6aaac37d1d4dbf83206978764b56e553dbc1339da2"}, "tags": [], "refs": [["stg_zendesk__ticket_field_history_tmp"], ["stg_zendesk__ticket_field_history_tmp"]], "sources": [], "description": "All fields and field values associated with tickets.", "columns": {"ticket_id": {"name": "ticket_id", "description": "The ID of the ticket associated with the field", "meta": {}, "data_type": null, "quote": null, "tags": []}, "field_name": {"name": "field_name", "description": "The name of the ticket field", "meta": {}, "data_type": null, "quote": null, "tags": []}, "valid_starting_at": {"name": "valid_starting_at", "description": "The time the ticket field value became valid", "meta": {}, "data_type": null, "quote": null, "tags": []}, "valid_ending_at": {"name": "valid_ending_at", "description": "The time the ticket field value became invalidated", "meta": {}, "data_type": null, "quote": null, "tags": []}, "value": {"name": "value", "description": "The value of the field", "meta": {}, "data_type": null, "quote": null, "tags": []}, "user_id": {"name": "user_id", "description": "The id of the user who made the update", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "zendesk_source://models/stg_zendesk.yml", "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk__ticket_field_history.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging"}, "created_at": 1644618837.742492, "compiled_sql": "with base as (\n\n select * \n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket_field_history_tmp`\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n field_name\n \n as \n \n field_name\n \n, \n \n \n ticket_id\n \n as \n \n ticket_id\n \n, \n \n \n updated\n \n as \n \n updated\n \n, \n \n \n user_id\n \n as \n \n user_id\n \n, \n \n \n value\n \n as \n \n value\n \n\n\n\n \n from base\n),\n\nfinal as (\n \n select \n ticket_id,\n field_name,\n updated as valid_starting_at,\n lead(updated) over (partition by ticket_id, field_name order by updated) as valid_ending_at,\n \n value,\n user_id\n from fields\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket_field_history`"}, "model.zendesk_source.stg_zendesk__daylight_time": {"raw_sql": "--To disable this model, set the using_schedules variable within your dbt_project.yml file to False.\n{{ config(enabled=var('using_schedules', True)) }}\n\nwith base as (\n\n select * \n from {{ ref('stg_zendesk__daylight_time_tmp') }}\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_zendesk__daylight_time_tmp')),\n staging_columns=get_daylight_time_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n daylight_end_utc,\n daylight_offset,\n daylight_start_utc,\n time_zone,\n year,\n daylight_offset * 60 as daylight_offset_minutes\n \n from fields\n)\n\nselect * from final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.zendesk_source.get_daylight_time_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.zendesk_source.stg_zendesk__daylight_time_tmp", "model.zendesk_source.stg_zendesk__daylight_time_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "stg_zendesk__daylight_time"], "unique_id": "model.zendesk_source.stg_zendesk__daylight_time", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "stg_zendesk__daylight_time.sql", "original_file_path": "models/stg_zendesk__daylight_time.sql", "name": "stg_zendesk__daylight_time", "alias": "stg_zendesk__daylight_time", "checksum": {"name": "sha256", "checksum": "6c328b1fb108b9d6dfd251f645e46fe47f819ee6a77ca58952de7ab5bba17dc7"}, "tags": [], "refs": [["stg_zendesk__daylight_time_tmp"], ["stg_zendesk__daylight_time_tmp"]], "sources": [], "description": "Appropriate offsets (from UTC) for timezones that engage or have engaged with Daylight Savings at some point since 1970.\n", "columns": {"daylight_end_utc": {"name": "daylight_end_utc", "description": "UTC timestamp of when Daylight Time ended in this year.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daylight_offset": {"name": "daylight_offset", "description": "Number of **hours** added during Daylight Savings Time.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daylight_start_utc": {"name": "daylight_start_utc", "description": "UTC timestamp of when Daylight Time began in this year.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "time_zone": {"name": "time_zone", "description": "Name of the timezone.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "year": {"name": "year", "description": "Year in which daylight savings occurred.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daylight_offset_minutes": {"name": "daylight_offset_minutes", "description": "Number of **minutes** added during Daylight Savings Time.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "zendesk_source://models/stg_zendesk.yml", "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk__daylight_time.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging", "enabled": true}, "created_at": 1644618837.745145, "compiled_sql": "--To disable this model, set the using_schedules variable within your dbt_project.yml file to False.\n\n\nwith base as (\n\n select * \n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__daylight_time_tmp`\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n daylight_end_utc\n \n as \n \n daylight_end_utc\n \n, \n \n \n daylight_offset\n \n as \n \n daylight_offset\n \n, \n \n \n daylight_start_utc\n \n as \n \n daylight_start_utc\n \n, \n \n \n time_zone\n \n as \n \n time_zone\n \n, \n \n \n year\n \n as \n \n year\n \n\n\n\n \n from base\n),\n\nfinal as (\n \n select \n daylight_end_utc,\n daylight_offset,\n daylight_start_utc,\n time_zone,\n year,\n daylight_offset * 60 as daylight_offset_minutes\n \n from fields\n)\n\nselect * from final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__daylight_time`"}, "model.zendesk_source.stg_zendesk__organization": {"raw_sql": "with base as (\n\n select * \n from {{ ref('stg_zendesk__organization_tmp') }}\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_zendesk__organization_tmp')),\n staging_columns=get_organization_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n id as organization_id,\n created_at,\n updated_at,\n details,\n name,\n external_id\n\n from fields\n)\n\nselect * \nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.zendesk_source.get_organization_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.zendesk_source.stg_zendesk__organization_tmp", "model.zendesk_source.stg_zendesk__organization_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "stg_zendesk__organization"], "unique_id": "model.zendesk_source.stg_zendesk__organization", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "stg_zendesk__organization.sql", "original_file_path": "models/stg_zendesk__organization.sql", "name": "stg_zendesk__organization", "alias": "stg_zendesk__organization", "checksum": {"name": "sha256", "checksum": "5527f691054dd7a01158ae65c9c44881a8f0d6eaa1a9124a912f262b6f4f024c"}, "tags": [], "refs": [["stg_zendesk__organization_tmp"], ["stg_zendesk__organization_tmp"]], "sources": [], "description": "Just as agents can be segmented into groups in Zendesk Support, your customers (end-users) can be segmented into organizations. You can manually assign customers to an organization or automatically assign them to an organization by their email address domain. Organizations can be used in business rules to route tickets to groups of agents or to send email notifications.\n", "columns": {"organization_id": {"name": "organization_id", "description": "Automatically assigned when the organization is created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "A unique name for the organization", "meta": {}, "data_type": null, "quote": null, "tags": []}, "details": {"name": "details", "description": "Any details obout the organization, such as the address", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "zendesk_source://models/stg_zendesk.yml", "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk__organization.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging"}, "created_at": 1644618837.72274, "compiled_sql": "with base as (\n\n select * \n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__organization_tmp`\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n created_at\n \n as \n \n created_at\n \n, \n \n \n details\n \n as \n \n details\n \n, \n \n \n external_id\n \n as \n \n external_id\n \n, \n \n \n group_id\n \n as \n \n group_id\n \n, \n \n \n id\n \n as \n \n id\n \n, \n \n \n name\n \n as \n \n name\n \n, \n \n \n notes\n \n as \n \n notes\n \n, \n \n \n shared_comments\n \n as \n \n shared_comments\n \n, \n \n \n shared_tickets\n \n as \n \n shared_tickets\n \n, \n \n \n updated_at\n \n as \n \n updated_at\n \n, \n \n \n url\n \n as \n \n url\n \n\n\n\n \n from base\n),\n\nfinal as (\n \n select \n id as organization_id,\n created_at,\n updated_at,\n details,\n name,\n external_id\n\n from fields\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__organization`"}, "model.zendesk_source.stg_zendesk__time_zone": {"raw_sql": "--To disable this model, set the using_schedules variable within your dbt_project.yml file to False.\n{{ config(enabled=var('using_schedules', True)) }}\n\nwith base as (\n\n select * \n from {{ ref('stg_zendesk__time_zone_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_zendesk__time_zone_tmp')),\n staging_columns=get_time_zone_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n standard_offset,\n time_zone,\n -- the standard_offset is a string written as [+/-]HH:MM\n -- let's convert it to an integer value of minutes\n cast( {{ dbt_utils.split_part(string_text='standard_offset', delimiter_text=\"':'\", part_number=1) }} as {{ dbt_utils.type_int() }} ) * 60 +\n (cast( {{ dbt_utils.split_part(string_text='standard_offset', delimiter_text=\"':'\", part_number=2) }} as {{ dbt_utils.type_int() }} ) *\n (case when standard_offset like '-%' then -1 else 1 end) ) as standard_offset_minutes\n \n from fields\n)\n\nselect * from final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.zendesk_source.get_time_zone_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.split_part", "macro.dbt_utils.type_int"], "nodes": ["model.zendesk_source.stg_zendesk__time_zone_tmp", "model.zendesk_source.stg_zendesk__time_zone_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "stg_zendesk__time_zone"], "unique_id": "model.zendesk_source.stg_zendesk__time_zone", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "stg_zendesk__time_zone.sql", "original_file_path": "models/stg_zendesk__time_zone.sql", "name": "stg_zendesk__time_zone", "alias": "stg_zendesk__time_zone", "checksum": {"name": "sha256", "checksum": "2e7a20dc3b8cea2cdba6cfa1eb0c7a5e183e32ee26754180477d36259d62daf3"}, "tags": [], "refs": [["stg_zendesk__time_zone_tmp"], ["stg_zendesk__time_zone_tmp"]], "sources": [], "description": "Offsets (from UTC) for each timezone.", "columns": {"time_zone": {"name": "time_zone", "description": "Name of the time zone.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "standard_offset": {"name": "standard_offset", "description": "Standard offset of the timezone (non-daylight savings hours). In `+/-hh:mm` format.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "standard_offset_minutes": {"name": "standard_offset_minutes", "description": "Standard offset of the timezone (non-daylight savings hours) in minutes.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "zendesk_source://models/stg_zendesk.yml", "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk__time_zone.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging", "enabled": true}, "created_at": 1644618837.746955, "compiled_sql": "--To disable this model, set the using_schedules variable within your dbt_project.yml file to False.\n\n\nwith base as (\n\n select * \n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__time_zone_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 standard_offset\n \n as \n \n standard_offset\n \n, \n \n \n time_zone\n \n as \n \n time_zone\n \n\n\n\n \n from base\n),\n\nfinal as (\n \n select \n standard_offset,\n time_zone,\n -- the standard_offset is a string written as [+/-]HH:MM\n -- let's convert it to an integer value of minutes\n cast( \n\n split(\n standard_offset,\n ':'\n )[safe_offset(0)]\n\n as \n int64\n ) * 60 +\n (cast( \n\n split(\n standard_offset,\n ':'\n )[safe_offset(1)]\n\n as \n int64\n ) *\n (case when standard_offset like '-%' then -1 else 1 end) ) as standard_offset_minutes\n \n from fields\n)\n\nselect * from final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__time_zone`"}, "model.zendesk_source.stg_zendesk__group": {"raw_sql": "with base as (\n\n select * \n from {{ ref('stg_zendesk__group_tmp') }}\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_zendesk__group_tmp')),\n staging_columns=get_group_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n id as group_id,\n name\n from fields\n \n where not coalesce(_fivetran_deleted, false)\n)\n\nselect * \nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.zendesk_source.get_group_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.zendesk_source.stg_zendesk__group_tmp", "model.zendesk_source.stg_zendesk__group_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "stg_zendesk__group"], "unique_id": "model.zendesk_source.stg_zendesk__group", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "stg_zendesk__group.sql", "original_file_path": "models/stg_zendesk__group.sql", "name": "stg_zendesk__group", "alias": "stg_zendesk__group", "checksum": {"name": "sha256", "checksum": "a867fd2d0bab21a736d6ae6bc5306a2f800e2d36518eea6c957736821ffcf099"}, "tags": [], "refs": [["stg_zendesk__group_tmp"], ["stg_zendesk__group_tmp"]], "sources": [], "description": "When support requests arrive in Zendesk Support, they can be assigned to a Group. Groups serve as the core element of ticket workflow; support agents are organized into Groups and tickets can be assigned to a Group only, or to an assigned agent within a Group. A ticket can never be assigned to an agent without also being assigned to a Group.\n", "columns": {"group_id": {"name": "group_id", "description": "Automatically assigned when creating groups", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "The name of the group", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "zendesk_source://models/stg_zendesk.yml", "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk__group.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging"}, "created_at": 1644618837.719934, "compiled_sql": "with base as (\n\n select * \n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__group_tmp`\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n \n \n \n _fivetran_deleted\n \n as \n \n _fivetran_deleted\n \n, \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n created_at\n \n as \n \n created_at\n \n, \n \n \n id\n \n as \n \n id\n \n, \n \n \n name\n \n as \n \n name\n \n, \n \n \n updated_at\n \n as \n \n updated_at\n \n, \n \n \n url\n \n as \n \n url\n \n\n\n\n \n from base\n),\n\nfinal as (\n \n select \n id as group_id,\n name\n from fields\n \n where not coalesce(_fivetran_deleted, false)\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__group`"}, "model.zendesk_source.stg_zendesk__ticket_comment": {"raw_sql": "with base as (\n\n select * \n from {{ ref('stg_zendesk__ticket_comment_tmp') }}\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_zendesk__ticket_comment_tmp')),\n staging_columns=get_ticket_comment_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n id as ticket_comment_id,\n _fivetran_synced,\n body,\n {% if target.type == 'redshift' -%}\n cast(created as timestamp without time zone) as created_at,\n {% else -%}\n created as created_at,\n {% endif %}\n public as is_public,\n ticket_id,\n user_id,\n facebook_comment as is_facebook_comment,\n tweet as is_tweet,\n voice_comment as is_voice_comment\n from fields\n)\n\nselect * \nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.zendesk_source.get_ticket_comment_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.zendesk_source.stg_zendesk__ticket_comment_tmp", "model.zendesk_source.stg_zendesk__ticket_comment_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "stg_zendesk__ticket_comment"], "unique_id": "model.zendesk_source.stg_zendesk__ticket_comment", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "stg_zendesk__ticket_comment.sql", "original_file_path": "models/stg_zendesk__ticket_comment.sql", "name": "stg_zendesk__ticket_comment", "alias": "stg_zendesk__ticket_comment", "checksum": {"name": "sha256", "checksum": "6f8f819c12033476ea5cabae04a88f36b51cfe956b8b514ff1e8216ee22553fe"}, "tags": [], "refs": [["stg_zendesk__ticket_comment_tmp"], ["stg_zendesk__ticket_comment_tmp"]], "sources": [], "description": "Ticket comments represent the conversation between requesters, collaborators, and agents. Comments can be public or private.", "columns": {"ticket_comment_id": {"name": "ticket_comment_id", "description": "Automatically assigned when the comment is created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "body": {"name": "body", "description": "The comment string", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "The time the comment was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_public": {"name": "is_public", "description": "Boolean field indicating if the comment is public (true), or if it is an internal note (false)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_id": {"name": "ticket_id", "description": "The ticket id associated with this comment", "meta": {}, "data_type": null, "quote": null, "tags": []}, "user_id": {"name": "user_id", "description": "The id of the comment author", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_facebook_comment": {"name": "is_facebook_comment", "description": "Boolean field indicating if the comment is a facebook comment", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_tweet": {"name": "is_tweet", "description": "Boolean field indicating if the comment is a twitter tweet", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_voice_comment": {"name": "is_voice_comment", "description": "Boolean field indicating if the comment is a voice comment", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "zendesk_source://models/stg_zendesk.yml", "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk__ticket_comment.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging"}, "created_at": 1644618837.7265952, "compiled_sql": "with base as (\n\n select * \n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket_comment_tmp`\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n body\n \n as \n \n body\n \n, \n cast(null as \n int64\n) as \n \n call_duration\n \n , \n cast(null as \n int64\n) as \n \n call_id\n \n , \n \n \n created\n \n as \n \n created\n \n, \n \n \n facebook_comment\n \n as \n \n facebook_comment\n \n, \n \n \n id\n \n as \n \n id\n \n, \n cast(null as \n int64\n) as \n \n location\n \n , \n \n \n public\n \n as \n \n public\n \n, \n cast(null as \n int64\n) as \n \n recording_url\n \n , \n cast(null as \n timestamp\n) as \n \n started_at\n \n , \n \n \n ticket_id\n \n as \n \n ticket_id\n \n, \n cast(null as \n int64\n) as \n \n transcription_status\n \n , \n cast(null as \n int64\n) as \n \n transcription_text\n \n , \n cast(null as \n int64\n) as \n \n trusted\n \n , \n \n \n tweet\n \n as \n \n tweet\n \n, \n \n \n user_id\n \n as \n \n user_id\n \n, \n \n \n voice_comment\n \n as \n \n voice_comment\n \n, \n cast(null as \n int64\n) as \n \n voice_comment_transcription_visible\n \n \n\n\n \n from base\n),\n\nfinal as (\n \n select \n id as ticket_comment_id,\n _fivetran_synced,\n body,\n created as created_at,\n \n public as is_public,\n ticket_id,\n user_id,\n facebook_comment as is_facebook_comment,\n tweet as is_tweet,\n voice_comment as is_voice_comment\n from fields\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket_comment`"}, "model.zendesk_source.stg_zendesk__ticket_schedule": {"raw_sql": "--To disable this model, set the using_schedules variable within your dbt_project.yml file to False.\n{{ config(enabled=var('using_schedules', True)) }}\n\nwith base as (\n\n select * \n from {{ ref('stg_zendesk__ticket_schedule_tmp') }}\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_zendesk__ticket_schedule_tmp')),\n staging_columns=get_ticket_schedule_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n ticket_id,\n {% if target.type == 'redshift' -%}\n cast(created_at as timestamp without time zone) as created_at,\n {% else -%}\n created_at,\n {% endif %}\n cast(schedule_id as {{ dbt_utils.type_string() }}) as schedule_id --need to convert from numeric to string for downstream models to work properly\n from fields\n)\n\nselect * \nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.zendesk_source.get_ticket_schedule_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_string"], "nodes": ["model.zendesk_source.stg_zendesk__ticket_schedule_tmp", "model.zendesk_source.stg_zendesk__ticket_schedule_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "stg_zendesk__ticket_schedule"], "unique_id": "model.zendesk_source.stg_zendesk__ticket_schedule", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "stg_zendesk__ticket_schedule.sql", "original_file_path": "models/stg_zendesk__ticket_schedule.sql", "name": "stg_zendesk__ticket_schedule", "alias": "stg_zendesk__ticket_schedule", "checksum": {"name": "sha256", "checksum": "cf8e0d6b95284bb5582258a186d465281b27d4c6a8a9bf137fa7387c404ae0ce"}, "tags": [], "refs": [["stg_zendesk__ticket_schedule_tmp"], ["stg_zendesk__ticket_schedule_tmp"]], "sources": [], "description": "The schedules applied to tickets through a trigger.", "columns": {"ticket_id": {"name": "ticket_id", "description": "The ID of the ticket assigned to the schedule", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "The time the schedule was assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "schedule_id": {"name": "schedule_id", "description": "The ID of the schedule applied to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "zendesk_source://models/stg_zendesk.yml", "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk__ticket_schedule.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging", "enabled": true}, "created_at": 1644618837.7358851, "compiled_sql": "--To disable this model, set the using_schedules variable within your dbt_project.yml file to False.\n\n\nwith base as (\n\n select * \n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket_schedule_tmp`\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n created_at\n \n as \n \n created_at\n \n, \n \n \n schedule_id\n \n as \n \n schedule_id\n \n, \n \n \n ticket_id\n \n as \n \n ticket_id\n \n\n\n\n \n from base\n),\n\nfinal as (\n \n select \n ticket_id,\n created_at,\n \n cast(schedule_id as \n string\n) as schedule_id --need to convert from numeric to string for downstream models to work properly\n from fields\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket_schedule`"}, "model.zendesk_source.stg_zendesk__schedule": {"raw_sql": "--To disable this model, set the using_schedules variable within your dbt_project.yml file to False.\n{{ config(enabled=var('using_schedules', True)) }}\n\nwith base as (\n\n select * \n from {{ ref('stg_zendesk__schedule_tmp') }}\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_zendesk__schedule_tmp')),\n staging_columns=get_schedule_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n cast(id as {{ dbt_utils.type_string() }}) as schedule_id, --need to convert from numeric to string for downstream models to work properly\n end_time,\n start_time,\n name as schedule_name,\n created_at,\n time_zone\n \n from fields\n where not coalesce(_fivetran_deleted, false)\n)\n\nselect * \nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.zendesk_source.get_schedule_columns", "macro.fivetran_utils.fill_staging_columns", "macro.dbt_utils.type_string"], "nodes": ["model.zendesk_source.stg_zendesk__schedule_tmp", "model.zendesk_source.stg_zendesk__schedule_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "stg_zendesk__schedule"], "unique_id": "model.zendesk_source.stg_zendesk__schedule", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "stg_zendesk__schedule.sql", "original_file_path": "models/stg_zendesk__schedule.sql", "name": "stg_zendesk__schedule", "alias": "stg_zendesk__schedule", "checksum": {"name": "sha256", "checksum": "72cfc5115af4c865b36d49823ac67097bd356dd1eb921226701d6204093f7ad8"}, "tags": [], "refs": [["stg_zendesk__schedule_tmp"], ["stg_zendesk__schedule_tmp"]], "sources": [], "description": "The support schedules created with different business hours and holidays.", "columns": {"schedule_id": {"name": "schedule_id", "description": "ID automatically assigned to the schedule upon creation", "meta": {}, "data_type": null, "quote": null, "tags": []}, "schedule_name": {"name": "schedule_name", "description": "Name of the schedule", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Time the schedule was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "start_time": {"name": "start_time", "description": "Start time of the schedule, in the schedule's time zone.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "end_time": {"name": "end_time", "description": "End time of the schedule, in the schedule's time zone.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "time_zone": {"name": "time_zone", "description": "Timezone in which the schedule operates.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "zendesk_source://models/stg_zendesk.yml", "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk__schedule.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging", "enabled": true}, "created_at": 1644618837.7340071, "compiled_sql": "--To disable this model, set the using_schedules variable within your dbt_project.yml file to False.\n\n\nwith base as (\n\n select * \n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__schedule_tmp`\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n \n \n \n _fivetran_deleted\n \n as \n \n _fivetran_deleted\n \n, \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n created_at\n \n as \n \n created_at\n \n, \n \n \n end_time\n \n as \n \n end_time\n \n, \n \n \n end_time_utc\n \n as \n \n end_time_utc\n \n, \n \n \n id\n \n as \n \n id\n \n, \n \n \n name\n \n as \n \n name\n \n, \n \n \n start_time\n \n as \n \n start_time\n \n, \n \n \n start_time_utc\n \n as \n \n start_time_utc\n \n, \n \n \n time_zone\n \n as \n \n time_zone\n \n\n\n\n \n from base\n),\n\nfinal as (\n \n select \n cast(id as \n string\n) as schedule_id, --need to convert from numeric to string for downstream models to work properly\n end_time,\n start_time,\n name as schedule_name,\n created_at,\n time_zone\n \n from fields\n where not coalesce(_fivetran_deleted, false)\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__schedule`"}, "model.zendesk_source.stg_zendesk__user": {"raw_sql": "with base as (\n\n select * \n from {{ ref('stg_zendesk__user_tmp') }}\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_zendesk__user_tmp')),\n staging_columns=get_user_columns()\n )\n }}\n \n from base\n),\n\nfinal as ( \n \n select \n id as user_id,\n external_id,\n _fivetran_synced,\n {% if target.type == 'redshift' -%}\n cast(last_login_at as timestamp without time zone) as last_login_at,\n cast(created_at as timestamp without time zone) as created_at,\n cast(updated_at as timestamp without time zone) as updated_at,\n {% else -%}\n last_login_at,\n created_at,\n updated_at,\n {% endif %}\n email,\n name,\n organization_id,\n role,\n ticket_restriction,\n time_zone,\n locale,\n active as is_active,\n suspended as is_suspended\n from fields\n)\n\nselect * \nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.zendesk_source.get_user_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.zendesk_source.stg_zendesk__user_tmp", "model.zendesk_source.stg_zendesk__user_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "stg_zendesk__user"], "unique_id": "model.zendesk_source.stg_zendesk__user", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "stg_zendesk__user.sql", "original_file_path": "models/stg_zendesk__user.sql", "name": "stg_zendesk__user", "alias": "stg_zendesk__user", "checksum": {"name": "sha256", "checksum": "c48fd4bfa305a6b298d08f8295598572f29e533de8d82b9382f39c03c3dc9c6e"}, "tags": [], "refs": [["stg_zendesk__user_tmp"], ["stg_zendesk__user_tmp"]], "sources": [], "description": "Zendesk has three types of users, end-users (your customers), agents, and administrators.", "columns": {"user_id": {"name": "user_id", "description": "Automatically assigned when the user is created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "email": {"name": "email", "description": "The user's primary email address. *Writeable on create only. On update, a secondary email is added. See Email Address", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "The user's name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_active": {"name": "is_active", "description": "false if the user has been deleted", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "The time the user was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "organization_id": {"name": "organization_id", "description": "The id of the user's organization. If the user has more than one organization memberships, the id of the user's default organization", "meta": {}, "data_type": null, "quote": null, "tags": []}, "role": {"name": "role", "description": "The user's role. Possible values are \"end-user\", \"agent\", or \"admin\"", "meta": {}, "data_type": null, "quote": null, "tags": []}, "time_zone": {"name": "time_zone", "description": "The user's time zone. See Time Zone", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_restriction": {"name": "ticket_restriction", "description": "Specifies which tickets the user has access to. Possible values are organization, groups, assigned, requested and null", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "zendesk_source://models/stg_zendesk.yml", "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk__user.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging"}, "created_at": 1644618837.7313018, "compiled_sql": "with base as (\n\n select * \n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__user_tmp`\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n active\n \n as \n \n active\n \n, \n \n \n alias\n \n as \n \n alias\n \n, \n \n \n authenticity_token\n \n as \n \n authenticity_token\n \n, \n \n \n chat_only\n \n as \n \n chat_only\n \n, \n \n \n created_at\n \n as \n \n created_at\n \n, \n \n \n details\n \n as \n \n details\n \n, \n \n \n email\n \n as \n \n email\n \n, \n \n \n external_id\n \n as \n \n external_id\n \n, \n \n \n id\n \n as \n \n id\n \n, \n \n \n last_login_at\n \n as \n \n last_login_at\n \n, \n \n \n locale\n \n as \n \n locale\n \n, \n \n \n locale_id\n \n as \n \n locale_id\n \n, \n \n \n moderator\n \n as \n \n moderator\n \n, \n \n \n name\n \n as \n \n name\n \n, \n \n \n notes\n \n as \n \n notes\n \n, \n \n \n only_private_comments\n \n as \n \n only_private_comments\n \n, \n \n \n organization_id\n \n as \n \n organization_id\n \n, \n \n \n phone\n \n as \n \n phone\n \n, \n \n \n remote_photo_url\n \n as \n \n remote_photo_url\n \n, \n \n \n restricted_agent\n \n as \n \n restricted_agent\n \n, \n \n \n role\n \n as \n \n role\n \n, \n \n \n shared\n \n as \n \n shared\n \n, \n \n \n shared_agent\n \n as \n \n shared_agent\n \n, \n \n \n signature\n \n as \n \n signature\n \n, \n \n \n suspended\n \n as \n \n suspended\n \n, \n \n \n ticket_restriction\n \n as \n \n ticket_restriction\n \n, \n \n \n time_zone\n \n as \n \n time_zone\n \n, \n \n \n two_factor_auth_enabled\n \n as \n \n two_factor_auth_enabled\n \n, \n \n \n updated_at\n \n as \n \n updated_at\n \n, \n \n \n url\n \n as \n \n url\n \n, \n \n \n verified\n \n as \n \n verified\n \n\n\n\n \n from base\n),\n\nfinal as ( \n \n select \n id as user_id,\n external_id,\n _fivetran_synced,\n last_login_at,\n created_at,\n updated_at,\n \n email,\n name,\n organization_id,\n role,\n ticket_restriction,\n time_zone,\n locale,\n active as is_active,\n suspended as is_suspended\n from fields\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__user`"}, "model.zendesk_source.stg_zendesk__brand": {"raw_sql": "with base as (\n\n select * \n from {{ ref('stg_zendesk__brand_tmp') }}\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_zendesk__brand_tmp')),\n staging_columns=get_brand_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n id as brand_id,\n brand_url,\n name,\n subdomain,\n active as is_active\n from fields\n where not coalesce(_fivetran_deleted, false)\n)\n\nselect * \nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.zendesk_source.get_brand_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.zendesk_source.stg_zendesk__brand_tmp", "model.zendesk_source.stg_zendesk__brand_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "stg_zendesk__brand"], "unique_id": "model.zendesk_source.stg_zendesk__brand", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "stg_zendesk__brand.sql", "original_file_path": "models/stg_zendesk__brand.sql", "name": "stg_zendesk__brand", "alias": "stg_zendesk__brand", "checksum": {"name": "sha256", "checksum": "eaf8b6e645dccfcee1bd72d80f1fd5c14fc86df2c084a843dc221c5ecab20fb0"}, "tags": [], "refs": [["stg_zendesk__brand_tmp"], ["stg_zendesk__brand_tmp"]], "sources": [], "description": "Brands are your customer-facing identities. They might represent multiple products or services, or they might literally be multiple brands owned and represented by your company.\n", "columns": {"brand_id": {"name": "brand_id", "description": "The ID automatically assigned when the brand is created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "brand_url": {"name": "brand_url", "description": "The url of the brand", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "The name of the brand", "meta": {}, "data_type": null, "quote": null, "tags": []}, "subdomain": {"name": "subdomain", "description": "The subdomain of the brand", "meta": {}, "data_type": null, "quote": null, "tags": []}, "active": {"name": "active", "description": "If the brand is set as active", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "zendesk_source://models/stg_zendesk.yml", "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk__brand.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging"}, "created_at": 1644618837.7169359, "compiled_sql": "with base as (\n\n select * \n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__brand_tmp`\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n \n \n \n _fivetran_deleted\n \n as \n \n _fivetran_deleted\n \n, \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n active\n \n as \n \n active\n \n, \n \n \n brand_url\n \n as \n \n brand_url\n \n, \n \n \n has_help_center\n \n as \n \n has_help_center\n \n, \n \n \n help_center_state\n \n as \n \n help_center_state\n \n, \n \n \n id\n \n as \n \n id\n \n, \n \n \n logo_content_type\n \n as \n \n logo_content_type\n \n, \n \n \n logo_content_url\n \n as \n \n logo_content_url\n \n, \n \n \n logo_deleted\n \n as \n \n logo_deleted\n \n, \n \n \n logo_file_name\n \n as \n \n logo_file_name\n \n, \n \n \n logo_height\n \n as \n \n logo_height\n \n, \n \n \n logo_id\n \n as \n \n logo_id\n \n, \n \n \n logo_inline\n \n as \n \n logo_inline\n \n, \n \n \n logo_mapped_content_url\n \n as \n \n logo_mapped_content_url\n \n, \n \n \n logo_size\n \n as \n \n logo_size\n \n, \n \n \n logo_url\n \n as \n \n logo_url\n \n, \n \n \n logo_width\n \n as \n \n logo_width\n \n, \n \n \n name\n \n as \n \n name\n \n, \n \n \n subdomain\n \n as \n \n subdomain\n \n, \n \n \n url\n \n as \n \n url\n \n\n\n\n \n from base\n),\n\nfinal as (\n \n select \n id as brand_id,\n brand_url,\n name,\n subdomain,\n active as is_active\n from fields\n where not coalesce(_fivetran_deleted, false)\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__brand`"}, "model.zendesk_source.stg_zendesk__ticket_form_history": {"raw_sql": "--To disable this model, set the using_ticket_form_history variable within your dbt_project.yml file to False.\n{{ config(enabled=var('using_ticket_form_history', True)) }}\n\nwith base as (\n\n select * \n from {{ ref('stg_zendesk__ticket_form_history_tmp') }}\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_zendesk__ticket_form_history_tmp')),\n staging_columns=get_ticket_form_history_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n id as ticket_form_id,\n {% if target.type == 'redshift' -%}\n cast(created_at as timestamp without time zone) as created_at,\n cast(updated_at as timestamp without time zone) as updated_at,\n {% else -%}\n created_at,\n updated_at,\n {% endif %}\n display_name,\n active as is_active,\n name\n from fields\n where not coalesce(_fivetran_deleted, false)\n \n)\n\nselect * \nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.zendesk_source.get_ticket_form_history_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.zendesk_source.stg_zendesk__ticket_form_history_tmp", "model.zendesk_source.stg_zendesk__ticket_form_history_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "stg_zendesk__ticket_form_history"], "unique_id": "model.zendesk_source.stg_zendesk__ticket_form_history", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "stg_zendesk__ticket_form_history.sql", "original_file_path": "models/stg_zendesk__ticket_form_history.sql", "name": "stg_zendesk__ticket_form_history", "alias": "stg_zendesk__ticket_form_history", "checksum": {"name": "sha256", "checksum": "ccfe41a6c79f1263c5905246c2bf4a0c22af12cb4b2181d297fa4b0dc1d0fb0c"}, "tags": [], "refs": [["stg_zendesk__ticket_form_history_tmp"], ["stg_zendesk__ticket_form_history_tmp"]], "sources": [], "description": "Ticket forms allow an admin to define a subset of ticket fields for display to both agents and end users.", "columns": {"ticket_form_id": {"name": "ticket_form_id", "description": "Automatically assigned when creating ticket form", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "The time the ticket form was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "The time of the last update of the ticket form", "meta": {}, "data_type": null, "quote": null, "tags": []}, "display_name": {"name": "display_name", "description": "The name of the form that is displayed to an end user", "meta": {}, "data_type": null, "quote": null, "tags": []}, "active": {"name": "active", "description": "If the form is set as active", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "The name of the form", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "zendesk_source://models/stg_zendesk.yml", "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk__ticket_form_history.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging", "enabled": true}, "created_at": 1644618837.738511, "compiled_sql": "--To disable this model, set the using_ticket_form_history variable within your dbt_project.yml file to False.\n\n\nwith base as (\n\n select * \n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket_form_history_tmp`\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n \n \n \n _fivetran_deleted\n \n as \n \n _fivetran_deleted\n \n, \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n active\n \n as \n \n active\n \n, \n \n \n created_at\n \n as \n \n created_at\n \n, \n \n \n display_name\n \n as \n \n display_name\n \n, \n \n \n end_user_visible\n \n as \n \n end_user_visible\n \n, \n \n \n id\n \n as \n \n id\n \n, \n \n \n name\n \n as \n \n name\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 id as ticket_form_id,\n created_at,\n updated_at,\n \n display_name,\n active as is_active,\n name\n from fields\n where not coalesce(_fivetran_deleted, false)\n \n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket_form_history`"}, "model.zendesk_source.stg_zendesk__domain_name": {"raw_sql": "--To disable this model, set the using_domain_names variable within your dbt_project.yml file to False.\n{{ config(enabled=var('using_domain_names', True)) }}\n\nwith base as (\n\n select * \n from {{ ref('stg_zendesk__domain_name_tmp') }}\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_zendesk__domain_name_tmp')),\n staging_columns=get_domain_name_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n organization_id,\n domain_name,\n index\n from fields\n)\n\nselect * \nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.zendesk_source.get_domain_name_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.zendesk_source.stg_zendesk__domain_name_tmp", "model.zendesk_source.stg_zendesk__domain_name_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "stg_zendesk__domain_name"], "unique_id": "model.zendesk_source.stg_zendesk__domain_name", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "stg_zendesk__domain_name.sql", "original_file_path": "models/stg_zendesk__domain_name.sql", "name": "stg_zendesk__domain_name", "alias": "stg_zendesk__domain_name", "checksum": {"name": "sha256", "checksum": "356988d2b8fc14f75da81db2a0c8bef9531c7224ff0b3d6efac425ea5175a1b6"}, "tags": [], "refs": [["stg_zendesk__domain_name_tmp"], ["stg_zendesk__domain_name_tmp"]], "sources": [], "description": "Domain names associated with an organization. An organization may have multiple domain names.", "columns": {"organization_id": {"name": "organization_id", "description": "Reference to the organization", "meta": {}, "data_type": null, "quote": null, "tags": []}, "domain_name": {"name": "domain_name", "description": "The name of the domain associated with the organization", "meta": {}, "data_type": null, "quote": null, "tags": []}, "index": {"name": "index", "description": "Index number of the domain name associated with the organization", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "zendesk_source://models/stg_zendesk.yml", "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk__domain_name.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging", "enabled": true}, "created_at": 1644618837.7187169, "compiled_sql": "--To disable this model, set the using_domain_names variable within your dbt_project.yml file to False.\n\n\nwith base as (\n\n select * \n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__domain_name_tmp`\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n domain_name\n \n as \n \n domain_name\n \n, \n \n \n index\n \n as \n \n index\n \n, \n \n \n organization_id\n \n as \n \n organization_id\n \n\n\n\n \n from base\n),\n\nfinal as (\n \n select \n organization_id,\n domain_name,\n index\n from fields\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__domain_name`"}, "model.zendesk_source.stg_zendesk__organization_tag": {"raw_sql": "--To disable this model, set the using_organization_tags variable within your dbt_project.yml file to False.\n{{ config(enabled=var('using_organization_tags', True)) }}\n\nwith base as (\n\n select * \n from {{ ref('stg_zendesk__organization_tag_tmp') }}\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_zendesk__organization_tag_tmp')),\n staging_columns=get_organization_tag_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n organization_id,\n {% if target.type == 'redshift' %}\n 'tag'\n {% else %}\n tag\n {% endif %}\n as tags\n from fields\n)\n\nselect * \nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.zendesk_source.get_organization_tag_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.zendesk_source.stg_zendesk__organization_tag_tmp", "model.zendesk_source.stg_zendesk__organization_tag_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "stg_zendesk__organization_tag"], "unique_id": "model.zendesk_source.stg_zendesk__organization_tag", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "stg_zendesk__organization_tag.sql", "original_file_path": "models/stg_zendesk__organization_tag.sql", "name": "stg_zendesk__organization_tag", "alias": "stg_zendesk__organization_tag", "checksum": {"name": "sha256", "checksum": "f52a16a097e2baeeaa61469f2ae266294958f1c50c98c42444f2262f2fd48a29"}, "tags": [], "refs": [["stg_zendesk__organization_tag_tmp"], ["stg_zendesk__organization_tag_tmp"]], "sources": [], "description": "The tags associated with an organization. An organization may have multiple tags.", "columns": {"organization_id": {"name": "organization_id", "description": "Reference to the organization", "meta": {}, "data_type": null, "quote": null, "tags": []}, "tag": {"name": "tag", "description": "Tag associated with the organization", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "zendesk_source://models/stg_zendesk.yml", "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk__organization_tag.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging", "enabled": true}, "created_at": 1644618837.7211561, "compiled_sql": "--To disable this model, set the using_organization_tags variable within your dbt_project.yml file to False.\n\n\nwith base as (\n\n select * \n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__organization_tag_tmp`\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n organization_id\n \n as \n \n organization_id\n \n, \n \n \n tag\n \n as \n \n tag\n \n\n\n\n \n from base\n),\n\nfinal as (\n \n select \n organization_id,\n \n tag\n \n as tags\n from fields\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__organization_tag`"}, "model.zendesk_source.stg_zendesk__ticket": {"raw_sql": "with base as (\n\n select * \n from {{ ref('stg_zendesk__ticket_tmp') }}\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n {{\n fivetran_utils.fill_staging_columns(\n source_columns=adapter.get_columns_in_relation(ref('stg_zendesk__ticket_tmp')),\n staging_columns=get_ticket_columns()\n )\n }}\n \n from base\n),\n\nfinal as (\n \n select \n id as ticket_id,\n _fivetran_synced,\n assignee_id,\n brand_id,\n {% if target.type == 'redshift' -%}\n cast(created_at as timestamp without time zone) as created_at,\n cast(updated_at as timestamp without time zone) as updated_at,\n {% else -%}\n created_at,\n updated_at,\n {% endif %}\n description,\n due_at,\n group_id,\n external_id,\n is_public,\n organization_id,\n priority,\n recipient,\n requester_id,\n status,\n subject,\n problem_id,\n submitter_id,\n ticket_form_id,\n type,\n url,\n via_channel as created_channel,\n via_source_from_id as source_from_id,\n via_source_from_title as source_from_title,\n via_source_rel as source_rel,\n via_source_to_address as source_to_address,\n via_source_to_name as source_to_name\n from fields\n)\n\nselect * \nfrom final", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.zendesk_source.get_ticket_columns", "macro.fivetran_utils.fill_staging_columns"], "nodes": ["model.zendesk_source.stg_zendesk__ticket_tmp", "model.zendesk_source.stg_zendesk__ticket_tmp"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "table", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "stg_zendesk__ticket"], "unique_id": "model.zendesk_source.stg_zendesk__ticket", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "stg_zendesk__ticket.sql", "original_file_path": "models/stg_zendesk__ticket.sql", "name": "stg_zendesk__ticket", "alias": "stg_zendesk__ticket", "checksum": {"name": "sha256", "checksum": "32baaa2d94b739338ccd39b02b5fa94adecc535c8353e73c040cd7d64c399eb2"}, "tags": [], "refs": [["stg_zendesk__ticket_tmp"], ["stg_zendesk__ticket_tmp"]], "sources": [], "description": "Tickets are the means through which your end users (customers) communicate with agents in Zendesk Support. Tickets can originate from a number of channels, including email, Help Center, chat, phone call, Twitter, Facebook, or the API.\n", "columns": {"ticket_id": {"name": "ticket_id", "description": "Automatically assigned when the ticket is created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url": {"name": "url", "description": "The API url of this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_id": {"name": "assignee_id", "description": "The agent currently assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "brand_id": {"name": "brand_id", "description": "Enterprise only. The id of the brand this ticket is associated with", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "When this record was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "type": {"name": "type", "description": "The type of this ticket, possible values are problem, incident, question or task", "meta": {}, "data_type": null, "quote": null, "tags": []}, "subject": {"name": "subject", "description": "The value of the subject field for this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "description": {"name": "description", "description": "Read-only first comment on the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "priority": {"name": "priority", "description": "The urgency with which the ticket should be addressed, possible values are urgent, high, normal and low", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "The state of the ticket, possible values are new, open, pending, hold, solved and closed", "meta": {}, "data_type": null, "quote": null, "tags": []}, "recipient": {"name": "recipient", "description": "The original recipient e-mail address of the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_id": {"name": "requester_id", "description": "The user who requested this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_id": {"name": "submitter_id", "description": "The user who submitted the ticket. The submitter always becomes the author of the first comment on the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "organization_id": {"name": "organization_id", "description": "The organization of the requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "group_id": {"name": "group_id", "description": "The group this ticket is assigned to", "meta": {}, "data_type": null, "quote": null, "tags": []}, "due_at": {"name": "due_at", "description": "If this is a ticket of type \"task\" it has a due date. Due date format uses ISO 8601 format.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_form_id": {"name": "ticket_form_id", "description": "Enterprise only. The id of the ticket form to render for the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_public": {"name": "is_public", "description": "Is true if any comments are public, false otherwise", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "When this record last got updated", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_channel": {"name": "created_channel", "description": "The channel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_from_id": {"name": "source_from_id", "description": "The channel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_from_title": {"name": "source_from_title", "description": "The channel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_rel": {"name": "source_rel", "description": "The rel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_to_address": {"name": "source_to_address", "description": "The address of the source the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "source_to_name": {"name": "source_to_name", "description": "The name of the source the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "docs": {"show": true}, "patch_path": "zendesk_source://models/stg_zendesk.yml", "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk__ticket.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "table", "schema": "zendesk_staging"}, "created_at": 1644618837.7146502, "compiled_sql": "with base as (\n\n select * \n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket_tmp`\n\n),\n\nfields as (\n\n select\n /*\n The below macro is used to generate the correct SQL for package staging models. It takes a list of columns \n that are expected/needed (staging_columns from dbt_zendesk_source/models/tmp/) and compares it with columns \n in the source (source_columns from dbt_zendesk_source/macros/).\n For more information refer to our dbt_fivetran_utils documentation (https://github.com/fivetran/dbt_fivetran_utils.git).\n */\n \n \n \n _fivetran_synced\n \n as \n \n _fivetran_synced\n \n, \n \n \n allow_channelback\n \n as \n \n allow_channelback\n \n, \n \n \n assignee_id\n \n as \n \n assignee_id\n \n, \n \n \n brand_id\n \n as \n \n brand_id\n \n, \n \n \n created_at\n \n as \n \n created_at\n \n, \n \n \n description\n \n as \n \n description\n \n, \n \n \n due_at\n \n as \n \n due_at\n \n, \n \n \n external_id\n \n as \n \n external_id\n \n, \n \n \n forum_topic_id\n \n as \n \n forum_topic_id\n \n, \n \n \n group_id\n \n as \n \n group_id\n \n, \n \n \n has_incidents\n \n as \n \n has_incidents\n \n, \n \n \n id\n \n as \n \n id\n \n, \n \n \n is_public\n \n as \n \n is_public\n \n, \n \n \n merged_ticket_ids\n \n as \n \n merged_ticket_ids\n \n, \n \n \n organization_id\n \n as \n \n organization_id\n \n, \n \n \n priority\n \n as \n \n priority\n \n, \n \n \n problem_id\n \n as \n \n problem_id\n \n, \n \n \n recipient\n \n as \n \n recipient\n \n, \n \n \n requester_id\n \n as \n \n requester_id\n \n, \n \n \n status\n \n as \n \n status\n \n, \n \n \n subject\n \n as \n \n subject\n \n, \n \n \n submitter_id\n \n as \n \n submitter_id\n \n, \n cast(null as \n int64\n) as \n \n system_ccs\n \n , \n \n \n system_client\n \n as \n \n system_client\n \n, \n \n \n system_ip_address\n \n as \n \n system_ip_address\n \n, \n \n \n system_json_email_identifier\n \n as \n \n system_json_email_identifier\n \n, \n \n \n system_latitude\n \n as \n \n system_latitude\n \n, \n \n \n system_location\n \n as \n \n system_location\n \n, \n \n \n system_longitude\n \n as \n \n system_longitude\n \n, \n \n \n system_machine_generated\n \n as \n \n system_machine_generated\n \n, \n \n \n system_message_id\n \n as \n \n system_message_id\n \n, \n \n \n system_raw_email_identifier\n \n as \n \n system_raw_email_identifier\n \n, \n \n \n ticket_form_id\n \n as \n \n ticket_form_id\n \n, \n \n \n type\n \n as \n \n type\n \n, \n \n \n updated_at\n \n as \n \n updated_at\n \n, \n \n \n url\n \n as \n \n url\n \n, \n \n \n via_channel\n \n as \n \n via_channel\n \n, \n \n \n via_source_from_address\n \n as \n \n via_source_from_address\n \n, \n \n \n via_source_from_id\n \n as \n \n via_source_from_id\n \n, \n \n \n via_source_from_title\n \n as \n \n via_source_from_title\n \n, \n \n \n via_source_rel\n \n as \n \n via_source_rel\n \n, \n \n \n via_source_to_address\n \n as \n \n via_source_to_address\n \n, \n \n \n via_source_to_name\n \n as \n \n via_source_to_name\n \n\n\n\n \n from base\n),\n\nfinal as (\n \n select \n id as ticket_id,\n _fivetran_synced,\n assignee_id,\n brand_id,\n created_at,\n updated_at,\n \n description,\n due_at,\n group_id,\n external_id,\n is_public,\n organization_id,\n priority,\n recipient,\n requester_id,\n status,\n subject,\n problem_id,\n submitter_id,\n ticket_form_id,\n type,\n url,\n via_channel as created_channel,\n via_source_from_id as source_from_id,\n via_source_from_title as source_from_title,\n via_source_rel as source_rel,\n via_source_to_address as source_to_address,\n via_source_to_name as source_to_name\n from fields\n)\n\nselect * \nfrom final", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket`"}, "model.zendesk_source.stg_zendesk__daylight_time_tmp": {"raw_sql": "--To disable this model, set the using_schedules variable within your dbt_project.yml file to False.\n{{ config(enabled=var('using_schedules', True)) }}\n\nselect * \nfrom {{ var('daylight_time') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.zendesk_source.zendesk.daylight_time"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "tmp", "stg_zendesk__daylight_time_tmp"], "unique_id": "model.zendesk_source.stg_zendesk__daylight_time_tmp", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "tmp/stg_zendesk__daylight_time_tmp.sql", "original_file_path": "models/tmp/stg_zendesk__daylight_time_tmp.sql", "name": "stg_zendesk__daylight_time_tmp", "alias": "stg_zendesk__daylight_time_tmp", "checksum": {"name": "sha256", "checksum": "1e56b01380e146e42947a9745e7239cde9b56c56744f0b8c79b5ef9a4451aa76"}, "tags": [], "refs": [], "sources": [["zendesk", "daylight_time"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/tmp/stg_zendesk__daylight_time_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "zendesk_staging", "enabled": true}, "created_at": 1644618837.424674, "compiled_sql": "--To disable this model, set the using_schedules variable within your dbt_project.yml file to False.\n\n\nselect * \nfrom `db`.`zendesk_new`.`daylight_time`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__daylight_time_tmp`"}, "model.zendesk_source.stg_zendesk__user_tmp": {"raw_sql": "select * \nfrom {{ var('user') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.zendesk_source.zendesk.user"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "tmp", "stg_zendesk__user_tmp"], "unique_id": "model.zendesk_source.stg_zendesk__user_tmp", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "tmp/stg_zendesk__user_tmp.sql", "original_file_path": "models/tmp/stg_zendesk__user_tmp.sql", "name": "stg_zendesk__user_tmp", "alias": "stg_zendesk__user_tmp", "checksum": {"name": "sha256", "checksum": "6a45d1112d3ae79f22784f5fd5723a27b7894d57aea5795a37921842affc0085"}, "tags": [], "refs": [], "sources": [["zendesk", "user"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/tmp/stg_zendesk__user_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "zendesk_staging"}, "created_at": 1644618837.431453, "compiled_sql": "select * \nfrom `db`.`zendesk_new`.`user`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__user_tmp`"}, "model.zendesk_source.stg_zendesk__group_tmp": {"raw_sql": "select * \nfrom {{ var('group') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.zendesk_source.zendesk.group"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "tmp", "stg_zendesk__group_tmp"], "unique_id": "model.zendesk_source.stg_zendesk__group_tmp", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "tmp/stg_zendesk__group_tmp.sql", "original_file_path": "models/tmp/stg_zendesk__group_tmp.sql", "name": "stg_zendesk__group_tmp", "alias": "stg_zendesk__group_tmp", "checksum": {"name": "sha256", "checksum": "f8e6c8c86b8fd6cea489c85641677a5ec978e5fa5d7ecd73cdf89eb25a533905"}, "tags": [], "refs": [], "sources": [["zendesk", "group"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/tmp/stg_zendesk__group_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "zendesk_staging"}, "created_at": 1644618837.4374661, "compiled_sql": "select * \nfrom `db`.`zendesk_new`.`group`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__group_tmp`"}, "model.zendesk_source.stg_zendesk__ticket_tmp": {"raw_sql": "select * \nfrom {{ var('ticket') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.zendesk_source.zendesk.ticket"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "tmp", "stg_zendesk__ticket_tmp"], "unique_id": "model.zendesk_source.stg_zendesk__ticket_tmp", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "tmp/stg_zendesk__ticket_tmp.sql", "original_file_path": "models/tmp/stg_zendesk__ticket_tmp.sql", "name": "stg_zendesk__ticket_tmp", "alias": "stg_zendesk__ticket_tmp", "checksum": {"name": "sha256", "checksum": "19b2466ae73fd66df0348a3b03e757b40fc5f85bd6d99c893626f55e8c69d2ca"}, "tags": [], "refs": [], "sources": [["zendesk", "ticket"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/tmp/stg_zendesk__ticket_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "zendesk_staging"}, "created_at": 1644618837.443122, "compiled_sql": "select * \nfrom `db`.`zendesk_new`.`ticket`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket_tmp`"}, "model.zendesk_source.stg_zendesk__brand_tmp": {"raw_sql": "select * \nfrom {{ var('brand') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.zendesk_source.zendesk.brand"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "tmp", "stg_zendesk__brand_tmp"], "unique_id": "model.zendesk_source.stg_zendesk__brand_tmp", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "tmp/stg_zendesk__brand_tmp.sql", "original_file_path": "models/tmp/stg_zendesk__brand_tmp.sql", "name": "stg_zendesk__brand_tmp", "alias": "stg_zendesk__brand_tmp", "checksum": {"name": "sha256", "checksum": "58555c5a87cdf4ff202901b74ac2e6dbf7e01dd675aa86e8f8937f74685ca8a2"}, "tags": [], "refs": [], "sources": [["zendesk", "brand"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/tmp/stg_zendesk__brand_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "zendesk_staging"}, "created_at": 1644618837.448609, "compiled_sql": "select * \nfrom `db`.`zendesk_new`.`brand`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__brand_tmp`"}, "model.zendesk_source.stg_zendesk__ticket_tag_tmp": {"raw_sql": "select * \nfrom {{ var('ticket_tag') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.zendesk_source.zendesk.ticket_tag"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "tmp", "stg_zendesk__ticket_tag_tmp"], "unique_id": "model.zendesk_source.stg_zendesk__ticket_tag_tmp", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "tmp/stg_zendesk__ticket_tag_tmp.sql", "original_file_path": "models/tmp/stg_zendesk__ticket_tag_tmp.sql", "name": "stg_zendesk__ticket_tag_tmp", "alias": "stg_zendesk__ticket_tag_tmp", "checksum": {"name": "sha256", "checksum": "bd1c6e36c872436d5b0225cc21df29fa2f97864083d67175a6fed09d8b79d5ef"}, "tags": [], "refs": [], "sources": [["zendesk", "ticket_tag"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/tmp/stg_zendesk__ticket_tag_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "zendesk_staging"}, "created_at": 1644618837.4541812, "compiled_sql": "select * \nfrom `db`.`zendesk_new`.`ticket_tag`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket_tag_tmp`"}, "model.zendesk_source.stg_zendesk__user_tag_tmp": {"raw_sql": "--To disable this model, set the using_user_tags variable within your dbt_project.yml file to False.\n{{ config(enabled=var('using_user_tags', True)) }}\n\nselect * \nfrom {{ var('user_tag') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.zendesk_source.zendesk.user_tag"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "tmp", "stg_zendesk__user_tag_tmp"], "unique_id": "model.zendesk_source.stg_zendesk__user_tag_tmp", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "tmp/stg_zendesk__user_tag_tmp.sql", "original_file_path": "models/tmp/stg_zendesk__user_tag_tmp.sql", "name": "stg_zendesk__user_tag_tmp", "alias": "stg_zendesk__user_tag_tmp", "checksum": {"name": "sha256", "checksum": "b852c972b7d1dbdf738108c7d5b1b6aff4f2215a1bb6afbb6bb1696c2be0f0c9"}, "tags": [], "refs": [], "sources": [["zendesk", "user_tag"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/tmp/stg_zendesk__user_tag_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "zendesk_staging", "enabled": true}, "created_at": 1644618837.460824, "compiled_sql": "--To disable this model, set the using_user_tags variable within your dbt_project.yml file to False.\n\n\nselect * \nfrom `db`.`zendesk_new`.`user_tag`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__user_tag_tmp`"}, "model.zendesk_source.stg_zendesk__ticket_field_history_tmp": {"raw_sql": "select * \nfrom {{ var('ticket_field_history') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.zendesk_source.zendesk.ticket_field_history"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "tmp", "stg_zendesk__ticket_field_history_tmp"], "unique_id": "model.zendesk_source.stg_zendesk__ticket_field_history_tmp", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "tmp/stg_zendesk__ticket_field_history_tmp.sql", "original_file_path": "models/tmp/stg_zendesk__ticket_field_history_tmp.sql", "name": "stg_zendesk__ticket_field_history_tmp", "alias": "stg_zendesk__ticket_field_history_tmp", "checksum": {"name": "sha256", "checksum": "6f06e6d418e0f6f8b8c02256c24e75add9a1b33d8e0c2515bad04dc6db404ff1"}, "tags": [], "refs": [], "sources": [["zendesk", "ticket_field_history"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/tmp/stg_zendesk__ticket_field_history_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "zendesk_staging"}, "created_at": 1644618837.467581, "compiled_sql": "select * \nfrom `db`.`zendesk_new`.`ticket_field_history`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket_field_history_tmp`"}, "model.zendesk_source.stg_zendesk__ticket_form_history_tmp": {"raw_sql": "--To disable this model, set the using_ticket_form_history variable within your dbt_project.yml file to False.\n{{ config(enabled=var('using_ticket_form_history', True)) }}\n\nselect * \nfrom {{ var('ticket_form_history') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.zendesk_source.zendesk.ticket_form_history"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "tmp", "stg_zendesk__ticket_form_history_tmp"], "unique_id": "model.zendesk_source.stg_zendesk__ticket_form_history_tmp", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "tmp/stg_zendesk__ticket_form_history_tmp.sql", "original_file_path": "models/tmp/stg_zendesk__ticket_form_history_tmp.sql", "name": "stg_zendesk__ticket_form_history_tmp", "alias": "stg_zendesk__ticket_form_history_tmp", "checksum": {"name": "sha256", "checksum": "c982594d09e47ffcf3513e6b8443d208baf26f2df376bfa2e2f9fb95e1a05ec5"}, "tags": [], "refs": [], "sources": [["zendesk", "ticket_form_history"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/tmp/stg_zendesk__ticket_form_history_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "zendesk_staging", "enabled": true}, "created_at": 1644618837.473782, "compiled_sql": "--To disable this model, set the using_ticket_form_history variable within your dbt_project.yml file to False.\n\n\nselect * \nfrom `db`.`zendesk_new`.`ticket_form_history`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket_form_history_tmp`"}, "model.zendesk_source.stg_zendesk__ticket_comment_tmp": {"raw_sql": "select * \nfrom {{ var('ticket_comment') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.zendesk_source.zendesk.ticket_comment"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "tmp", "stg_zendesk__ticket_comment_tmp"], "unique_id": "model.zendesk_source.stg_zendesk__ticket_comment_tmp", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "tmp/stg_zendesk__ticket_comment_tmp.sql", "original_file_path": "models/tmp/stg_zendesk__ticket_comment_tmp.sql", "name": "stg_zendesk__ticket_comment_tmp", "alias": "stg_zendesk__ticket_comment_tmp", "checksum": {"name": "sha256", "checksum": "0f14f6e0dc38eac86f58cec21d12d25fcdd916e7f31bceff35cc0766da2ab560"}, "tags": [], "refs": [], "sources": [["zendesk", "ticket_comment"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/tmp/stg_zendesk__ticket_comment_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "zendesk_staging"}, "created_at": 1644618837.480026, "compiled_sql": "select * \nfrom `db`.`zendesk_new`.`ticket_comment`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket_comment_tmp`"}, "model.zendesk_source.stg_zendesk__organization_tag_tmp": {"raw_sql": "--To disable this model, set the using_organization_tags variable within your dbt_project.yml file to False.\n{{ config(enabled=var('using_organization_tags', True)) }}\n\nselect * \nfrom {{ var('organization_tag') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.zendesk_source.zendesk.organization_tag"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "tmp", "stg_zendesk__organization_tag_tmp"], "unique_id": "model.zendesk_source.stg_zendesk__organization_tag_tmp", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "tmp/stg_zendesk__organization_tag_tmp.sql", "original_file_path": "models/tmp/stg_zendesk__organization_tag_tmp.sql", "name": "stg_zendesk__organization_tag_tmp", "alias": "stg_zendesk__organization_tag_tmp", "checksum": {"name": "sha256", "checksum": "371025f2faaebbcaa7b7d612cad719c47e7bb7ec0adb2d514be59dd154000924"}, "tags": [], "refs": [], "sources": [["zendesk", "organization_tag"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/tmp/stg_zendesk__organization_tag_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "zendesk_staging", "enabled": true}, "created_at": 1644618837.485665, "compiled_sql": "--To disable this model, set the using_organization_tags variable within your dbt_project.yml file to False.\n\n\nselect * \nfrom `db`.`zendesk_new`.`organization_tag`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__organization_tag_tmp`"}, "model.zendesk_source.stg_zendesk__schedule_tmp": {"raw_sql": "--To disable this model, set the using_schedules variable within your dbt_project.yml file to False.\n{{ config(enabled=var('using_schedules', True)) }}\n\nselect * \nfrom {{ var('schedule') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.zendesk_source.zendesk.schedule"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "tmp", "stg_zendesk__schedule_tmp"], "unique_id": "model.zendesk_source.stg_zendesk__schedule_tmp", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "tmp/stg_zendesk__schedule_tmp.sql", "original_file_path": "models/tmp/stg_zendesk__schedule_tmp.sql", "name": "stg_zendesk__schedule_tmp", "alias": "stg_zendesk__schedule_tmp", "checksum": {"name": "sha256", "checksum": "e14f77042a8f64d285a76897176d96cae381a464cc944a5af7e3ec0c91122947"}, "tags": [], "refs": [], "sources": [["zendesk", "schedule"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/tmp/stg_zendesk__schedule_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "zendesk_staging", "enabled": true}, "created_at": 1644618837.4921448, "compiled_sql": "--To disable this model, set the using_schedules variable within your dbt_project.yml file to False.\n\n\nselect * \nfrom `db`.`zendesk_new`.`schedule`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__schedule_tmp`"}, "model.zendesk_source.stg_zendesk__organization_tmp": {"raw_sql": "select * \nfrom {{ var('organization') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.zendesk_source.zendesk.organization"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "tmp", "stg_zendesk__organization_tmp"], "unique_id": "model.zendesk_source.stg_zendesk__organization_tmp", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "tmp/stg_zendesk__organization_tmp.sql", "original_file_path": "models/tmp/stg_zendesk__organization_tmp.sql", "name": "stg_zendesk__organization_tmp", "alias": "stg_zendesk__organization_tmp", "checksum": {"name": "sha256", "checksum": "2f3e00296ea52db703431b38d4d3f523f83a2a4a2e87607c8c79378b169835f8"}, "tags": [], "refs": [], "sources": [["zendesk", "organization"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/tmp/stg_zendesk__organization_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "zendesk_staging"}, "created_at": 1644618837.499663, "compiled_sql": "select * \nfrom `db`.`zendesk_new`.`organization`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__organization_tmp`"}, "model.zendesk_source.stg_zendesk__ticket_schedule_tmp": {"raw_sql": "--To disable this model, set the using_schedules variable within your dbt_project.yml file to False.\n{{ config(enabled=var('using_schedules', True)) }}\n\n{%- set source_relation = adapter.get_relation(\n database=source('zendesk', 'ticket_schedule').database,\n schema=source('zendesk', 'ticket_schedule').schema,\n identifier=source('zendesk', 'ticket_schedule').name) -%}\n\n{% set table_exists=source_relation is not none %}\n\n{% if table_exists %}\n\nselect *\nfrom {{ source('zendesk', 'ticket_schedule') }}\n\n{% else %}\n\nselect\n cast(null as {{ dbt_utils.type_timestamp() }}) as _fivetran_synced,\n cast(null as {{ dbt_utils.type_timestamp() }}) as created_at,\n cast(null as {{ dbt_utils.type_int() }}) as schedule_id,\n cast(null as {{ dbt_utils.type_int() }}) as ticket_id\n\n{% endif %}", "compiled": true, "resource_type": "model", "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_int"], "nodes": ["source.zendesk_source.zendesk.ticket_schedule", "source.zendesk_source.zendesk.ticket_schedule", "source.zendesk_source.zendesk.ticket_schedule"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "tmp", "stg_zendesk__ticket_schedule_tmp"], "unique_id": "model.zendesk_source.stg_zendesk__ticket_schedule_tmp", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "tmp/stg_zendesk__ticket_schedule_tmp.sql", "original_file_path": "models/tmp/stg_zendesk__ticket_schedule_tmp.sql", "name": "stg_zendesk__ticket_schedule_tmp", "alias": "stg_zendesk__ticket_schedule_tmp", "checksum": {"name": "sha256", "checksum": "15e5b270de6a25bf52311df259a5969b24cb1ce513eaa4a11af74c4d6b854ad0"}, "tags": [], "refs": [], "sources": [["zendesk", "ticket_schedule"], ["zendesk", "ticket_schedule"], ["zendesk", "ticket_schedule"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/tmp/stg_zendesk__ticket_schedule_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "zendesk_staging", "enabled": true}, "created_at": 1644618837.544481, "compiled_sql": "--To disable this model, set the using_schedules variable within your dbt_project.yml file to False.\n\n\n\n\nselect\n cast(null as \n timestamp\n) as _fivetran_synced,\n cast(null as \n timestamp\n) as created_at,\n cast(null as \n int64\n) as schedule_id,\n cast(null as \n int64\n) as ticket_id\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket_schedule_tmp`"}, "model.zendesk_source.stg_zendesk__domain_name_tmp": {"raw_sql": "--To disable this model, set the using_domain_names variable within your dbt_project.yml file to False.\n{{ config(enabled=var('using_domain_names', True)) }}\n\nselect * \nfrom {{ var('domain_name') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.zendesk_source.zendesk.domain_name"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "tmp", "stg_zendesk__domain_name_tmp"], "unique_id": "model.zendesk_source.stg_zendesk__domain_name_tmp", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "tmp/stg_zendesk__domain_name_tmp.sql", "original_file_path": "models/tmp/stg_zendesk__domain_name_tmp.sql", "name": "stg_zendesk__domain_name_tmp", "alias": "stg_zendesk__domain_name_tmp", "checksum": {"name": "sha256", "checksum": "0146a0dae63eb5aec2a78e50244874689f5ad1db8135f68c9f2806314e22d477"}, "tags": [], "refs": [], "sources": [["zendesk", "domain_name"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/tmp/stg_zendesk__domain_name_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "zendesk_staging", "enabled": true}, "created_at": 1644618837.557518, "compiled_sql": "--To disable this model, set the using_domain_names variable within your dbt_project.yml file to False.\n\n\nselect * \nfrom `db`.`zendesk_new`.`domain_name`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__domain_name_tmp`"}, "model.zendesk_source.stg_zendesk__time_zone_tmp": {"raw_sql": "--To disable this model, set the using_schedules variable within your dbt_project.yml file to False.\n{{ config(enabled=var('using_schedules', True)) }}\n\nselect * \nfrom {{ var('time_zone') }}", "compiled": true, "resource_type": "model", "depends_on": {"macros": [], "nodes": ["source.zendesk_source.zendesk.time_zone"]}, "config": {"enabled": true, "alias": null, "schema": "zendesk_staging", "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt_zendesk_staging", "fqn": ["zendesk_source", "tmp", "stg_zendesk__time_zone_tmp"], "unique_id": "model.zendesk_source.stg_zendesk__time_zone_tmp", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "tmp/stg_zendesk__time_zone_tmp.sql", "original_file_path": "models/tmp/stg_zendesk__time_zone_tmp.sql", "name": "stg_zendesk__time_zone_tmp", "alias": "stg_zendesk__time_zone_tmp", "checksum": {"name": "sha256", "checksum": "36ffaa731bbe3b27c8677eb200419585dc7416b165acbe2a1c55631e11d54f4c"}, "tags": [], "refs": [], "sources": [["zendesk", "time_zone"]], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/tmp/stg_zendesk__time_zone_tmp.sql", "build_path": null, "deferred": false, "unrendered_config": {"materialized": "view", "schema": "zendesk_staging", "enabled": true}, "created_at": 1644618837.565073, "compiled_sql": "--To disable this model, set the using_schedules variable within your dbt_project.yml file to False.\n\n\nselect * \nfrom `db`.`zendesk_new`.`time_zone`", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": "`dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__time_zone_tmp`"}, "test.zendesk.unique_zendesk__ticket_enriched_ticket_id.7c3c6ca9ef": {"raw_sql": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "unique", "kwargs": {"column_name": "ticket_id", "model": "{{ get_where_subquery(ref('zendesk__ticket_enriched')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.zendesk.zendesk__ticket_enriched"]}, "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": "dbt-package-testing", "schema": "dbt_dbt_test__audit", "fqn": ["zendesk", "unique_zendesk__ticket_enriched_ticket_id"], "unique_id": "test.zendesk.unique_zendesk__ticket_enriched_ticket_id.7c3c6ca9ef", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "unique_zendesk__ticket_enriched_ticket_id.sql", "original_file_path": "models/zendesk.yml", "name": "unique_zendesk__ticket_enriched_ticket_id", "alias": "unique_zendesk__ticket_enriched_ticket_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["zendesk__ticket_enriched"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/zendesk.yml/unique_zendesk__ticket_enriched_ticket_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1644618837.689095, "compiled_sql": "\n \n \n\nwith dbt_test__target as (\n \n select ticket_id as unique_field\n from `dbt-package-testing`.`dbt_zendesk`.`zendesk__ticket_enriched`\n where ticket_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": "ticket_id", "file_key_name": "models.zendesk__ticket_enriched"}, "test.zendesk.not_null_zendesk__ticket_enriched_ticket_id.e3efc5bf0a": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ticket_id", "model": "{{ get_where_subquery(ref('zendesk__ticket_enriched')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.zendesk.zendesk__ticket_enriched"]}, "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": "dbt-package-testing", "schema": "dbt_dbt_test__audit", "fqn": ["zendesk", "not_null_zendesk__ticket_enriched_ticket_id"], "unique_id": "test.zendesk.not_null_zendesk__ticket_enriched_ticket_id.e3efc5bf0a", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "not_null_zendesk__ticket_enriched_ticket_id.sql", "original_file_path": "models/zendesk.yml", "name": "not_null_zendesk__ticket_enriched_ticket_id", "alias": "not_null_zendesk__ticket_enriched_ticket_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["zendesk__ticket_enriched"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/zendesk.yml/not_null_zendesk__ticket_enriched_ticket_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1644618837.691339, "compiled_sql": "\n \n \n\nselect *\nfrom `dbt-package-testing`.`dbt_zendesk`.`zendesk__ticket_enriched`\nwhere ticket_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ticket_id", "file_key_name": "models.zendesk__ticket_enriched"}, "test.zendesk.unique_zendesk__sla_policies_sla_event_id.5daff4d2bd": {"raw_sql": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "unique", "kwargs": {"column_name": "sla_event_id", "model": "{{ get_where_subquery(ref('zendesk__sla_policies')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.zendesk.zendesk__sla_policies"]}, "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": "dbt-package-testing", "schema": "dbt_dbt_test__audit", "fqn": ["zendesk", "unique_zendesk__sla_policies_sla_event_id"], "unique_id": "test.zendesk.unique_zendesk__sla_policies_sla_event_id.5daff4d2bd", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "unique_zendesk__sla_policies_sla_event_id.sql", "original_file_path": "models/zendesk.yml", "name": "unique_zendesk__sla_policies_sla_event_id", "alias": "unique_zendesk__sla_policies_sla_event_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["zendesk__sla_policies"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/zendesk.yml/unique_zendesk__sla_policies_sla_event_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1644618837.6939788, "compiled_sql": "\n \n \n\nwith dbt_test__target as (\n \n select sla_event_id as unique_field\n from `dbt-package-testing`.`dbt_zendesk`.`zendesk__sla_policies`\n where sla_event_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": "sla_event_id", "file_key_name": "models.zendesk__sla_policies"}, "test.zendesk.unique_zendesk__ticket_metrics_ticket_id.f3dc8eba5c": {"raw_sql": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "unique", "kwargs": {"column_name": "ticket_id", "model": "{{ get_where_subquery(ref('zendesk__ticket_metrics')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.zendesk.zendesk__ticket_metrics"]}, "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": "dbt-package-testing", "schema": "dbt_dbt_test__audit", "fqn": ["zendesk", "unique_zendesk__ticket_metrics_ticket_id"], "unique_id": "test.zendesk.unique_zendesk__ticket_metrics_ticket_id.f3dc8eba5c", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "unique_zendesk__ticket_metrics_ticket_id.sql", "original_file_path": "models/zendesk.yml", "name": "unique_zendesk__ticket_metrics_ticket_id", "alias": "unique_zendesk__ticket_metrics_ticket_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["zendesk__ticket_metrics"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/zendesk.yml/unique_zendesk__ticket_metrics_ticket_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1644618837.696051, "compiled_sql": "\n \n \n\nwith dbt_test__target as (\n \n select ticket_id as unique_field\n from `dbt-package-testing`.`dbt_zendesk`.`zendesk__ticket_metrics`\n where ticket_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": "ticket_id", "file_key_name": "models.zendesk__ticket_metrics"}, "test.zendesk.not_null_zendesk__ticket_metrics_ticket_id.3466b76bbd": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ticket_id", "model": "{{ get_where_subquery(ref('zendesk__ticket_metrics')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.zendesk.zendesk__ticket_metrics"]}, "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": "dbt-package-testing", "schema": "dbt_dbt_test__audit", "fqn": ["zendesk", "not_null_zendesk__ticket_metrics_ticket_id"], "unique_id": "test.zendesk.not_null_zendesk__ticket_metrics_ticket_id.3466b76bbd", "package_name": "zendesk", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk", "path": "not_null_zendesk__ticket_metrics_ticket_id.sql", "original_file_path": "models/zendesk.yml", "name": "not_null_zendesk__ticket_metrics_ticket_id", "alias": "not_null_zendesk__ticket_metrics_ticket_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["zendesk__ticket_metrics"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk/models/zendesk.yml/not_null_zendesk__ticket_metrics_ticket_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1644618837.6982741, "compiled_sql": "\n \n \n\nselect *\nfrom `dbt-package-testing`.`dbt_zendesk`.`zendesk__ticket_metrics`\nwhere ticket_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ticket_id", "file_key_name": "models.zendesk__ticket_metrics"}, "test.zendesk_source.unique_stg_zendesk__ticket_ticket_id.4be7124521": {"raw_sql": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "unique", "kwargs": {"column_name": "ticket_id", "model": "{{ get_where_subquery(ref('stg_zendesk__ticket')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.zendesk_source.stg_zendesk__ticket"]}, "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": "dbt-package-testing", "schema": "dbt_dbt_test__audit", "fqn": ["zendesk_source", "unique_stg_zendesk__ticket_ticket_id"], "unique_id": "test.zendesk_source.unique_stg_zendesk__ticket_ticket_id.4be7124521", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "unique_stg_zendesk__ticket_ticket_id.sql", "original_file_path": "models/stg_zendesk.yml", "name": "unique_stg_zendesk__ticket_ticket_id", "alias": "unique_stg_zendesk__ticket_ticket_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_zendesk__ticket"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk.yml/unique_stg_zendesk__ticket_ticket_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1644618837.7479098, "compiled_sql": "\n \n \n\nwith dbt_test__target as (\n \n select ticket_id as unique_field\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket`\n where ticket_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": "ticket_id", "file_key_name": "models.stg_zendesk__ticket"}, "test.zendesk_source.not_null_stg_zendesk__ticket_ticket_id.a8229e6981": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ticket_id", "model": "{{ get_where_subquery(ref('stg_zendesk__ticket')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.zendesk_source.stg_zendesk__ticket"]}, "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": "dbt-package-testing", "schema": "dbt_dbt_test__audit", "fqn": ["zendesk_source", "not_null_stg_zendesk__ticket_ticket_id"], "unique_id": "test.zendesk_source.not_null_stg_zendesk__ticket_ticket_id.a8229e6981", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "not_null_stg_zendesk__ticket_ticket_id.sql", "original_file_path": "models/stg_zendesk.yml", "name": "not_null_stg_zendesk__ticket_ticket_id", "alias": "not_null_stg_zendesk__ticket_ticket_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_zendesk__ticket"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk.yml/not_null_stg_zendesk__ticket_ticket_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1644618837.750206, "compiled_sql": "\n \n \n\nselect *\nfrom `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket`\nwhere ticket_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ticket_id", "file_key_name": "models.stg_zendesk__ticket"}, "test.zendesk_source.unique_stg_zendesk__brand_brand_id.fdf8e23c9e": {"raw_sql": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "unique", "kwargs": {"column_name": "brand_id", "model": "{{ get_where_subquery(ref('stg_zendesk__brand')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.zendesk_source.stg_zendesk__brand"]}, "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": "dbt-package-testing", "schema": "dbt_dbt_test__audit", "fqn": ["zendesk_source", "unique_stg_zendesk__brand_brand_id"], "unique_id": "test.zendesk_source.unique_stg_zendesk__brand_brand_id.fdf8e23c9e", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "unique_stg_zendesk__brand_brand_id.sql", "original_file_path": "models/stg_zendesk.yml", "name": "unique_stg_zendesk__brand_brand_id", "alias": "unique_stg_zendesk__brand_brand_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_zendesk__brand"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk.yml/unique_stg_zendesk__brand_brand_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1644618837.752525, "compiled_sql": "\n \n \n\nwith dbt_test__target as (\n \n select brand_id as unique_field\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__brand`\n where brand_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": "brand_id", "file_key_name": "models.stg_zendesk__brand"}, "test.zendesk_source.not_null_stg_zendesk__brand_brand_id.a2419e1741": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "brand_id", "model": "{{ get_where_subquery(ref('stg_zendesk__brand')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.zendesk_source.stg_zendesk__brand"]}, "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": "dbt-package-testing", "schema": "dbt_dbt_test__audit", "fqn": ["zendesk_source", "not_null_stg_zendesk__brand_brand_id"], "unique_id": "test.zendesk_source.not_null_stg_zendesk__brand_brand_id.a2419e1741", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "not_null_stg_zendesk__brand_brand_id.sql", "original_file_path": "models/stg_zendesk.yml", "name": "not_null_stg_zendesk__brand_brand_id", "alias": "not_null_stg_zendesk__brand_brand_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_zendesk__brand"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk.yml/not_null_stg_zendesk__brand_brand_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1644618837.754965, "compiled_sql": "\n \n \n\nselect *\nfrom `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__brand`\nwhere brand_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "brand_id", "file_key_name": "models.stg_zendesk__brand"}, "test.zendesk_source.not_null_stg_zendesk__domain_name_organization_id.a2b5ff8fd3": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "organization_id", "model": "{{ get_where_subquery(ref('stg_zendesk__domain_name')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.zendesk_source.stg_zendesk__domain_name"]}, "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": "dbt-package-testing", "schema": "dbt_dbt_test__audit", "fqn": ["zendesk_source", "not_null_stg_zendesk__domain_name_organization_id"], "unique_id": "test.zendesk_source.not_null_stg_zendesk__domain_name_organization_id.a2b5ff8fd3", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "not_null_stg_zendesk__domain_name_organization_id.sql", "original_file_path": "models/stg_zendesk.yml", "name": "not_null_stg_zendesk__domain_name_organization_id", "alias": "not_null_stg_zendesk__domain_name_organization_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_zendesk__domain_name"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk.yml/not_null_stg_zendesk__domain_name_organization_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1644618837.757185, "compiled_sql": "\n \n \n\nselect *\nfrom `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__domain_name`\nwhere organization_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "organization_id", "file_key_name": "models.stg_zendesk__domain_name"}, "test.zendesk_source.unique_stg_zendesk__group_group_id.f0658dabcd": {"raw_sql": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "unique", "kwargs": {"column_name": "group_id", "model": "{{ get_where_subquery(ref('stg_zendesk__group')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.zendesk_source.stg_zendesk__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": "dbt-package-testing", "schema": "dbt_dbt_test__audit", "fqn": ["zendesk_source", "unique_stg_zendesk__group_group_id"], "unique_id": "test.zendesk_source.unique_stg_zendesk__group_group_id.f0658dabcd", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "unique_stg_zendesk__group_group_id.sql", "original_file_path": "models/stg_zendesk.yml", "name": "unique_stg_zendesk__group_group_id", "alias": "unique_stg_zendesk__group_group_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_zendesk__group"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk.yml/unique_stg_zendesk__group_group_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1644618837.759319, "compiled_sql": "\n \n \n\nwith dbt_test__target as (\n \n select group_id as unique_field\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__group`\n where group_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": "group_id", "file_key_name": "models.stg_zendesk__group"}, "test.zendesk_source.not_null_stg_zendesk__group_group_id.7659ed83ec": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "group_id", "model": "{{ get_where_subquery(ref('stg_zendesk__group')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.zendesk_source.stg_zendesk__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": "dbt-package-testing", "schema": "dbt_dbt_test__audit", "fqn": ["zendesk_source", "not_null_stg_zendesk__group_group_id"], "unique_id": "test.zendesk_source.not_null_stg_zendesk__group_group_id.7659ed83ec", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "not_null_stg_zendesk__group_group_id.sql", "original_file_path": "models/stg_zendesk.yml", "name": "not_null_stg_zendesk__group_group_id", "alias": "not_null_stg_zendesk__group_group_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_zendesk__group"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk.yml/not_null_stg_zendesk__group_group_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1644618837.761398, "compiled_sql": "\n \n \n\nselect *\nfrom `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__group`\nwhere group_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "group_id", "file_key_name": "models.stg_zendesk__group"}, "test.zendesk_source.unique_stg_zendesk__organization_organization_id.152be1ab31": {"raw_sql": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "unique", "kwargs": {"column_name": "organization_id", "model": "{{ get_where_subquery(ref('stg_zendesk__organization')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.zendesk_source.stg_zendesk__organization"]}, "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": "dbt-package-testing", "schema": "dbt_dbt_test__audit", "fqn": ["zendesk_source", "unique_stg_zendesk__organization_organization_id"], "unique_id": "test.zendesk_source.unique_stg_zendesk__organization_organization_id.152be1ab31", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "unique_stg_zendesk__organization_organization_id.sql", "original_file_path": "models/stg_zendesk.yml", "name": "unique_stg_zendesk__organization_organization_id", "alias": "unique_stg_zendesk__organization_organization_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_zendesk__organization"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk.yml/unique_stg_zendesk__organization_organization_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1644618837.763804, "compiled_sql": "\n \n \n\nwith dbt_test__target as (\n \n select organization_id as unique_field\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__organization`\n where organization_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": "organization_id", "file_key_name": "models.stg_zendesk__organization"}, "test.zendesk_source.not_null_stg_zendesk__organization_organization_id.de7b98c06a": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "organization_id", "model": "{{ get_where_subquery(ref('stg_zendesk__organization')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.zendesk_source.stg_zendesk__organization"]}, "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": "dbt-package-testing", "schema": "dbt_dbt_test__audit", "fqn": ["zendesk_source", "not_null_stg_zendesk__organization_organization_id"], "unique_id": "test.zendesk_source.not_null_stg_zendesk__organization_organization_id.de7b98c06a", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "not_null_stg_zendesk__organization_organization_id.sql", "original_file_path": "models/stg_zendesk.yml", "name": "not_null_stg_zendesk__organization_organization_id", "alias": "not_null_stg_zendesk__organization_organization_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_zendesk__organization"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk.yml/not_null_stg_zendesk__organization_organization_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1644618837.765873, "compiled_sql": "\n \n \n\nselect *\nfrom `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__organization`\nwhere organization_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "organization_id", "file_key_name": "models.stg_zendesk__organization"}, "test.zendesk_source.unique_stg_zendesk__ticket_comment_ticket_comment_id.ba353330cd": {"raw_sql": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "unique", "kwargs": {"column_name": "ticket_comment_id", "model": "{{ get_where_subquery(ref('stg_zendesk__ticket_comment')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.zendesk_source.stg_zendesk__ticket_comment"]}, "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": "dbt-package-testing", "schema": "dbt_dbt_test__audit", "fqn": ["zendesk_source", "unique_stg_zendesk__ticket_comment_ticket_comment_id"], "unique_id": "test.zendesk_source.unique_stg_zendesk__ticket_comment_ticket_comment_id.ba353330cd", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "unique_stg_zendesk__ticket_comment_ticket_comment_id.sql", "original_file_path": "models/stg_zendesk.yml", "name": "unique_stg_zendesk__ticket_comment_ticket_comment_id", "alias": "unique_stg_zendesk__ticket_comment_ticket_comment_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_zendesk__ticket_comment"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk.yml/unique_stg_zendesk__ticket_comment_ticket_comment_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1644618837.768712, "compiled_sql": "\n \n \n\nwith dbt_test__target as (\n \n select ticket_comment_id as unique_field\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket_comment`\n where ticket_comment_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": "ticket_comment_id", "file_key_name": "models.stg_zendesk__ticket_comment"}, "test.zendesk_source.not_null_stg_zendesk__ticket_comment_ticket_comment_id.b821f4a606": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ticket_comment_id", "model": "{{ get_where_subquery(ref('stg_zendesk__ticket_comment')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.zendesk_source.stg_zendesk__ticket_comment"]}, "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": "dbt-package-testing", "schema": "dbt_dbt_test__audit", "fqn": ["zendesk_source", "not_null_stg_zendesk__ticket_comment_ticket_comment_id"], "unique_id": "test.zendesk_source.not_null_stg_zendesk__ticket_comment_ticket_comment_id.b821f4a606", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "not_null_stg_zendesk__ticket_comment_ticket_comment_id.sql", "original_file_path": "models/stg_zendesk.yml", "name": "not_null_stg_zendesk__ticket_comment_ticket_comment_id", "alias": "not_null_stg_zendesk__ticket_comment_ticket_comment_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_zendesk__ticket_comment"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk.yml/not_null_stg_zendesk__ticket_comment_ticket_comment_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1644618837.771019, "compiled_sql": "\n \n \n\nselect *\nfrom `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket_comment`\nwhere ticket_comment_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ticket_comment_id", "file_key_name": "models.stg_zendesk__ticket_comment"}, "test.zendesk_source.unique_stg_zendesk__user_user_id.3d3e346b11": {"raw_sql": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "unique", "kwargs": {"column_name": "user_id", "model": "{{ get_where_subquery(ref('stg_zendesk__user')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.zendesk_source.stg_zendesk__user"]}, "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": "dbt-package-testing", "schema": "dbt_dbt_test__audit", "fqn": ["zendesk_source", "unique_stg_zendesk__user_user_id"], "unique_id": "test.zendesk_source.unique_stg_zendesk__user_user_id.3d3e346b11", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "unique_stg_zendesk__user_user_id.sql", "original_file_path": "models/stg_zendesk.yml", "name": "unique_stg_zendesk__user_user_id", "alias": "unique_stg_zendesk__user_user_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_zendesk__user"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk.yml/unique_stg_zendesk__user_user_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1644618837.7733738, "compiled_sql": "\n \n \n\nwith dbt_test__target as (\n \n select user_id as unique_field\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__user`\n where user_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": "user_id", "file_key_name": "models.stg_zendesk__user"}, "test.zendesk_source.not_null_stg_zendesk__user_user_id.102d572926": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "user_id", "model": "{{ get_where_subquery(ref('stg_zendesk__user')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.zendesk_source.stg_zendesk__user"]}, "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": "dbt-package-testing", "schema": "dbt_dbt_test__audit", "fqn": ["zendesk_source", "not_null_stg_zendesk__user_user_id"], "unique_id": "test.zendesk_source.not_null_stg_zendesk__user_user_id.102d572926", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "not_null_stg_zendesk__user_user_id.sql", "original_file_path": "models/stg_zendesk.yml", "name": "not_null_stg_zendesk__user_user_id", "alias": "not_null_stg_zendesk__user_user_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_zendesk__user"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk.yml/not_null_stg_zendesk__user_user_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1644618837.775386, "compiled_sql": "\n \n \n\nselect *\nfrom `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__user`\nwhere user_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "user_id", "file_key_name": "models.stg_zendesk__user"}, "test.zendesk_source.not_null_stg_zendesk__ticket_form_history_ticket_form_id.1afe781a17": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "ticket_form_id", "model": "{{ get_where_subquery(ref('stg_zendesk__ticket_form_history')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.zendesk_source.stg_zendesk__ticket_form_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": "dbt-package-testing", "schema": "dbt_dbt_test__audit", "fqn": ["zendesk_source", "not_null_stg_zendesk__ticket_form_history_ticket_form_id"], "unique_id": "test.zendesk_source.not_null_stg_zendesk__ticket_form_history_ticket_form_id.1afe781a17", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "not_null_stg_zendesk__ticket_form_history_ticket_form_id.sql", "original_file_path": "models/stg_zendesk.yml", "name": "not_null_stg_zendesk__ticket_form_history_ticket_form_id", "alias": "not_null_stg_zendesk__ticket_form_history_ticket_form_id", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_zendesk__ticket_form_history"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk.yml/not_null_stg_zendesk__ticket_form_history_ticket_form_id.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1644618837.7775948, "compiled_sql": "\n \n \n\nselect *\nfrom `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__ticket_form_history`\nwhere ticket_form_id is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "ticket_form_id", "file_key_name": "models.stg_zendesk__ticket_form_history"}, "test.zendesk_source.dbt_utils_unique_combination_of_columns_stg_zendesk__daylight_time_time_zone__year.88227aef3d": {"raw_sql": "{{ dbt_utils.test_unique_combination_of_columns(**_dbt_generic_test_kwargs) }}{{ config(alias=\"dbt_utils_unique_combination_o_54ab42208165c9c38d3147cec984eab9\") }}", "test_metadata": {"name": "unique_combination_of_columns", "kwargs": {"combination_of_columns": ["time_zone", "year"], "model": "{{ get_where_subquery(ref('stg_zendesk__daylight_time')) }}"}, "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.zendesk_source.stg_zendesk__daylight_time"]}, "config": {"enabled": true, "alias": "dbt_utils_unique_combination_o_54ab42208165c9c38d3147cec984eab9", "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": "dbt-package-testing", "schema": "dbt_dbt_test__audit", "fqn": ["zendesk_source", "dbt_utils_unique_combination_of_columns_stg_zendesk__daylight_time_time_zone__year"], "unique_id": "test.zendesk_source.dbt_utils_unique_combination_of_columns_stg_zendesk__daylight_time_time_zone__year.88227aef3d", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "dbt_utils_unique_combination_o_54ab42208165c9c38d3147cec984eab9.sql", "original_file_path": "models/stg_zendesk.yml", "name": "dbt_utils_unique_combination_of_columns_stg_zendesk__daylight_time_time_zone__year", "alias": "dbt_utils_unique_combination_o_54ab42208165c9c38d3147cec984eab9", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_zendesk__daylight_time"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk.yml/dbt_utils_unique_combination_o_54ab42208165c9c38d3147cec984eab9.sql", "build_path": null, "deferred": false, "unrendered_config": {"alias": "dbt_utils_unique_combination_o_54ab42208165c9c38d3147cec984eab9"}, "created_at": 1644618837.779747, "compiled_sql": "\n\n\n\n\n\nwith validation_errors as (\n\n select\n time_zone, year\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__daylight_time`\n group by time_zone, year\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_zendesk__daylight_time"}, "test.zendesk_source.unique_stg_zendesk__time_zone_time_zone.67995adbaf": {"raw_sql": "{{ test_unique(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "unique", "kwargs": {"column_name": "time_zone", "model": "{{ get_where_subquery(ref('stg_zendesk__time_zone')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.zendesk_source.stg_zendesk__time_zone"]}, "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": "dbt-package-testing", "schema": "dbt_dbt_test__audit", "fqn": ["zendesk_source", "unique_stg_zendesk__time_zone_time_zone"], "unique_id": "test.zendesk_source.unique_stg_zendesk__time_zone_time_zone.67995adbaf", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "unique_stg_zendesk__time_zone_time_zone.sql", "original_file_path": "models/stg_zendesk.yml", "name": "unique_stg_zendesk__time_zone_time_zone", "alias": "unique_stg_zendesk__time_zone_time_zone", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_zendesk__time_zone"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk.yml/unique_stg_zendesk__time_zone_time_zone.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1644618837.794411, "compiled_sql": "\n \n \n\nwith dbt_test__target as (\n \n select time_zone as unique_field\n from `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__time_zone`\n where time_zone 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": "time_zone", "file_key_name": "models.stg_zendesk__time_zone"}, "test.zendesk_source.not_null_stg_zendesk__time_zone_time_zone.b25b3452b1": {"raw_sql": "{{ test_not_null(**_dbt_generic_test_kwargs) }}", "test_metadata": {"name": "not_null", "kwargs": {"column_name": "time_zone", "model": "{{ get_where_subquery(ref('stg_zendesk__time_zone')) }}"}, "namespace": null}, "compiled": true, "resource_type": "test", "depends_on": {"macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.zendesk_source.stg_zendesk__time_zone"]}, "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": "dbt-package-testing", "schema": "dbt_dbt_test__audit", "fqn": ["zendesk_source", "not_null_stg_zendesk__time_zone_time_zone"], "unique_id": "test.zendesk_source.not_null_stg_zendesk__time_zone_time_zone.b25b3452b1", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "not_null_stg_zendesk__time_zone_time_zone.sql", "original_file_path": "models/stg_zendesk.yml", "name": "not_null_stg_zendesk__time_zone_time_zone", "alias": "not_null_stg_zendesk__time_zone_time_zone", "checksum": {"name": "none", "checksum": ""}, "tags": [], "refs": [["stg_zendesk__time_zone"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": "target/compiled/zendesk_source/models/stg_zendesk.yml/not_null_stg_zendesk__time_zone_time_zone.sql", "build_path": null, "deferred": false, "unrendered_config": {}, "created_at": 1644618837.79666, "compiled_sql": "\n \n \n\nselect *\nfrom `dbt-package-testing`.`dbt_zendesk_staging`.`stg_zendesk__time_zone`\nwhere time_zone is null\n\n\n", "extra_ctes_injected": true, "extra_ctes": [], "relation_name": null, "column_name": "time_zone", "file_key_name": "models.stg_zendesk__time_zone"}}, "sources": {"source.zendesk_source.zendesk.ticket": {"fqn": ["zendesk_source", "zendesk", "ticket"], "database": "db", "schema": "zendesk_new", "unique_id": "source.zendesk_source.zendesk.ticket", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "models/src_zendesk.yml", "original_file_path": "models/src_zendesk.yml", "name": "ticket", "source_name": "zendesk", "source_description": "", "loader": "fivetran", "identifier": "ticket", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 72, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Tickets are the means through which your end users (customers) communicate with agents in Zendesk Support. Tickets can originate from a number of channels, including email, Help Center, chat, phone call, Twitter, Facebook, or the API.\n", "columns": {"id": {"name": "id", "description": "Automatically assigned when the ticket is created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url": {"name": "url", "description": "The API url of this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "assignee_id": {"name": "assignee_id", "description": "The agent currently assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "brand_id": {"name": "brand_id", "description": "Enterprise only. The id of the brand this ticket is associated with", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "When this record was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "type": {"name": "type", "description": "The type of this ticket, possible values are problem, incident, question or task", "meta": {}, "data_type": null, "quote": null, "tags": []}, "subject": {"name": "subject", "description": "The value of the subject field for this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "description": {"name": "description", "description": "Read-only first comment on the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "priority": {"name": "priority", "description": "The urgency with which the ticket should be addressed, possible values are urgent, high, normal and low", "meta": {}, "data_type": null, "quote": null, "tags": []}, "status": {"name": "status", "description": "The state of the ticket, possible values are new, open, pending, hold, solved and closed", "meta": {}, "data_type": null, "quote": null, "tags": []}, "recipient": {"name": "recipient", "description": "The original recipient e-mail address of the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "requester_id": {"name": "requester_id", "description": "The user who requested this ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "submitter_id": {"name": "submitter_id", "description": "The user who submitted the ticket. The submitter always becomes the author of the first comment on the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "organization_id": {"name": "organization_id", "description": "The organization of the requester", "meta": {}, "data_type": null, "quote": null, "tags": []}, "group_id": {"name": "group_id", "description": "The group this ticket is assigned to", "meta": {}, "data_type": null, "quote": null, "tags": []}, "due_at": {"name": "due_at", "description": "If this is a ticket of type \"task\" it has a due date. Due date format uses ISO 8601 format.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_form_id": {"name": "ticket_form_id", "description": "Enterprise only. The id of the ticket form to render for the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "is_public": {"name": "is_public", "description": "Is true if any comments are public, false otherwise", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "When this record last got updated", "meta": {}, "data_type": null, "quote": null, "tags": []}, "via_channel": {"name": "via_channel", "description": "The channel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "via_source_from_id": {"name": "via_source_from_id", "description": "The channel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "via_source_from_title": {"name": "via_source_from_title", "description": "The channel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "via_source_rel": {"name": "via_source_rel", "description": "The rel the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "via_source_to_address": {"name": "via_source_to_address", "description": "The address of the source the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}, "via_source_to_name": {"name": "via_source_to_name", "description": "The name of the source the ticket was created from", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`db`.`zendesk_new`.`ticket`", "created_at": 1644618837.85869}, "source.zendesk_source.zendesk.brand": {"fqn": ["zendesk_source", "zendesk", "brand"], "database": "db", "schema": "zendesk_new", "unique_id": "source.zendesk_source.zendesk.brand", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "models/src_zendesk.yml", "original_file_path": "models/src_zendesk.yml", "name": "brand", "source_name": "zendesk", "source_description": "", "loader": "fivetran", "identifier": "brand", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 72, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Brands are your customer-facing identities. They might represent multiple products or services, or they might literally be multiple brands owned and represented by your company.\n", "columns": {"id": {"name": "id", "description": "The ID automatically assigned when the brand is created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "brand_url": {"name": "brand_url", "description": "The url of the brand", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "The name of the brand", "meta": {}, "data_type": null, "quote": null, "tags": []}, "subdomain": {"name": "subdomain", "description": "The subdomain of the brand", "meta": {}, "data_type": null, "quote": null, "tags": []}, "active": {"name": "active", "description": "If the brand is set as active", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`db`.`zendesk_new`.`brand`", "created_at": 1644618837.8588831}, "source.zendesk_source.zendesk.domain_name": {"fqn": ["zendesk_source", "zendesk", "domain_name"], "database": "db", "schema": "zendesk_new", "unique_id": "source.zendesk_source.zendesk.domain_name", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "models/src_zendesk.yml", "original_file_path": "models/src_zendesk.yml", "name": "domain_name", "source_name": "zendesk", "source_description": "", "loader": "fivetran", "identifier": "domain_name", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 72, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Domain names associated with an organization. An organization may have multiple domain names.", "columns": {"organization_id": {"name": "organization_id", "description": "Reference to the organization", "meta": {}, "data_type": null, "quote": null, "tags": []}, "domain_name": {"name": "domain_name", "description": "The name of the domain associated with the organization", "meta": {}, "data_type": null, "quote": null, "tags": []}, "index": {"name": "index", "description": "Index number of the domain name associated with the organization", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {"is_enabled": true}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`db`.`zendesk_new`.`domain_name`", "created_at": 1644618837.8590322}, "source.zendesk_source.zendesk.group": {"fqn": ["zendesk_source", "zendesk", "group"], "database": "db", "schema": "zendesk_new", "unique_id": "source.zendesk_source.zendesk.group", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "models/src_zendesk.yml", "original_file_path": "models/src_zendesk.yml", "name": "group", "source_name": "zendesk", "source_description": "", "loader": "fivetran", "identifier": "group", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": true, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "When support requests arrive in Zendesk Support, they can be assigned to a Group. Groups serve as the core element of ticket workflow; support agents are organized into Groups and tickets can be assigned to a Group only, or to an assigned agent within a Group. A ticket can never be assigned to an agent without also being assigned to a Group.\n", "columns": {"id": {"name": "id", "description": "Automatically assigned when creating groups", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "The name of the group", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`db`.`zendesk_new`.`group`", "created_at": 1644618837.859168}, "source.zendesk_source.zendesk.organization_tag": {"fqn": ["zendesk_source", "zendesk", "organization_tag"], "database": "db", "schema": "zendesk_new", "unique_id": "source.zendesk_source.zendesk.organization_tag", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "models/src_zendesk.yml", "original_file_path": "models/src_zendesk.yml", "name": "organization_tag", "source_name": "zendesk", "source_description": "", "loader": "fivetran", "identifier": "organization_tag", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 72, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "The tags associated with an organization. An organization may have multiple tags.", "columns": {"organization_id": {"name": "organization_id", "description": "Reference to the organization", "meta": {}, "data_type": null, "quote": null, "tags": []}, "tag": {"name": "tag", "description": "Tag associated with the organization", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {"is_enabled": true}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`db`.`zendesk_new`.`organization_tag`", "created_at": 1644618837.859312}, "source.zendesk_source.zendesk.organization": {"fqn": ["zendesk_source", "zendesk", "organization"], "database": "db", "schema": "zendesk_new", "unique_id": "source.zendesk_source.zendesk.organization", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "models/src_zendesk.yml", "original_file_path": "models/src_zendesk.yml", "name": "organization", "source_name": "zendesk", "source_description": "", "loader": "fivetran", "identifier": "organization", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Just as agents can be segmented into groups in Zendesk Support, your customers (end-users) can be segmented into organizations. You can manually assign customers to an organization or automatically assign them to an organization by their email address domain. Organizations can be used in business rules to route tickets to groups of agents or to send email notifications.\n", "columns": {"id": {"name": "id", "description": "Automatically assigned when the organization is created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "A unique name for the organization", "meta": {}, "data_type": null, "quote": null, "tags": []}, "details": {"name": "details", "description": "Any details obout the organization, such as the address", "meta": {}, "data_type": null, "quote": null, "tags": []}, "url": {"name": "url", "description": "The API url of this organization", "meta": {}, "data_type": null, "quote": null, "tags": []}, "external_id": {"name": "external_id", "description": "A unique external id to associate organizations to an external record", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "The time the organization was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "The time of the last update of the organization", "meta": {}, "data_type": null, "quote": null, "tags": []}, "domain_names": {"name": "domain_names", "description": "An array of domain names associated with this organization", "meta": {}, "data_type": null, "quote": null, "tags": []}, "notes": {"name": "notes", "description": "Any notes you have about the organization", "meta": {}, "data_type": null, "quote": null, "tags": []}, "group_id": {"name": "group_id", "description": "New tickets from users in this organization are automatically put in this group", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shared_tickets": {"name": "shared_tickets", "description": "End users in this organization are able to see each other's tickets", "meta": {}, "data_type": null, "quote": null, "tags": []}, "shared_comments": {"name": "shared_comments", "description": "End users in this organization are able to see each other's comments on tickets", "meta": {}, "data_type": null, "quote": null, "tags": []}, "tags": {"name": "tags", "description": "The tags of the organization", "meta": {}, "data_type": null, "quote": null, "tags": []}, "organization_fields": {"name": "organization_fields", "description": "Custom fields for this organization", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`db`.`zendesk_new`.`organization`", "created_at": 1644618837.859475}, "source.zendesk_source.zendesk.ticket_comment": {"fqn": ["zendesk_source", "zendesk", "ticket_comment"], "database": "db", "schema": "zendesk_new", "unique_id": "source.zendesk_source.zendesk.ticket_comment", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "models/src_zendesk.yml", "original_file_path": "models/src_zendesk.yml", "name": "ticket_comment", "source_name": "zendesk", "source_description": "", "loader": "fivetran", "identifier": "ticket_comment", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 72, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Ticket comments represent the conversation between requesters, collaborators, and agents. Comments can be public or private.", "columns": {"id": {"name": "id", "description": "Automatically assigned when the comment is created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "body": {"name": "body", "description": "The comment string", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created": {"name": "created", "description": "The time the comment was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "public": {"name": "public", "description": "Boolean field indicating if the comment is public (true), or if it is an internal note (false)", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_id": {"name": "ticket_id", "description": "The ticket id associated with this comment", "meta": {}, "data_type": null, "quote": null, "tags": []}, "user_id": {"name": "user_id", "description": "The id of the comment author", "meta": {}, "data_type": null, "quote": null, "tags": []}, "facebook_comment": {"name": "facebook_comment", "description": "Boolean field indicating if the comment is a facebook comment", "meta": {}, "data_type": null, "quote": null, "tags": []}, "tweet": {"name": "tweet", "description": "Boolean field indicating if the comment is a twitter tweet", "meta": {}, "data_type": null, "quote": null, "tags": []}, "voice_comment": {"name": "voice_comment", "description": "Boolean field indicating if the comment is a voice comment", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`db`.`zendesk_new`.`ticket_comment`", "created_at": 1644618837.859704}, "source.zendesk_source.zendesk.user_tag": {"fqn": ["zendesk_source", "zendesk", "user_tag"], "database": "db", "schema": "zendesk_new", "unique_id": "source.zendesk_source.zendesk.user_tag", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "models/src_zendesk.yml", "original_file_path": "models/src_zendesk.yml", "name": "user_tag", "source_name": "zendesk", "source_description": "", "loader": "fivetran", "identifier": "user_tag", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 72, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Table containing all tags associated with a user. Only present if your account has user tagging enabled.", "columns": {"user_id": {"name": "user_id", "description": "Reference to the user", "meta": {}, "data_type": null, "quote": null, "tags": []}, "tag": {"name": "tag", "description": "Tag associated with the user", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {"is_enabled": true}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`db`.`zendesk_new`.`user_tag`", "created_at": 1644618837.8598468}, "source.zendesk_source.zendesk.user": {"fqn": ["zendesk_source", "zendesk", "user"], "database": "db", "schema": "zendesk_new", "unique_id": "source.zendesk_source.zendesk.user", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "models/src_zendesk.yml", "original_file_path": "models/src_zendesk.yml", "name": "user", "source_name": "zendesk", "source_description": "", "loader": "fivetran", "identifier": "user", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Zendesk has three types of users, end-users (your customers), agents, and administrators.", "columns": {"id": {"name": "id", "description": "Automatically assigned when the user is created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "email": {"name": "email", "description": "The user's primary email address. *Writeable on create only. On update, a secondary email is added. See Email Address", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "The user's name", "meta": {}, "data_type": null, "quote": null, "tags": []}, "active": {"name": "active", "description": "false if the user has been deleted", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "The time the user was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "organization_id": {"name": "organization_id", "description": "The id of the user's organization. If the user has more than one organization memberships, the id of the user's default organization", "meta": {}, "data_type": null, "quote": null, "tags": []}, "role": {"name": "role", "description": "The user's role. Possible values are \"end-user\", \"agent\", or \"admin\"", "meta": {}, "data_type": null, "quote": null, "tags": []}, "time_zone": {"name": "time_zone", "description": "The user's time zone. See Time Zone", "meta": {}, "data_type": null, "quote": null, "tags": []}, "ticket_restriction": {"name": "ticket_restriction", "description": "Specifies which tickets the user has access to. Possible values are organization, groups, assigned, requested and null", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`db`.`zendesk_new`.`user`", "created_at": 1644618837.859997}, "source.zendesk_source.zendesk.schedule": {"fqn": ["zendesk_source", "zendesk", "schedule"], "database": "db", "schema": "zendesk_new", "unique_id": "source.zendesk_source.zendesk.schedule", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "models/src_zendesk.yml", "original_file_path": "models/src_zendesk.yml", "name": "schedule", "source_name": "zendesk", "source_description": "", "loader": "fivetran", "identifier": "schedule", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "The support schedules created with different business hours and holidays.", "columns": {"id": {"name": "id", "description": "ID automatically assigned to the schedule upon creation", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "Name of the schedule", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "Time the schedule was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "start_time": {"name": "start_time", "description": "Start time of the schedule, in the schedule's time zone.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "end_time": {"name": "end_time", "description": "End time of the schedule, in the schedule's time zone.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "time_zone": {"name": "time_zone", "description": "Timezone in which the schedule operates.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {"is_enabled": true}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`db`.`zendesk_new`.`schedule`", "created_at": 1644618837.860139}, "source.zendesk_source.zendesk.ticket_schedule": {"fqn": ["zendesk_source", "zendesk", "ticket_schedule"], "database": "db", "schema": "zendesk_new", "unique_id": "source.zendesk_source.zendesk.ticket_schedule", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "models/src_zendesk.yml", "original_file_path": "models/src_zendesk.yml", "name": "ticket_schedule", "source_name": "zendesk", "source_description": "", "loader": "fivetran", "identifier": "ticket_schedule", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "The schedules applied to tickets through a trigger.", "columns": {"ticket_id": {"name": "ticket_id", "description": "The ID of the ticket assigned to the schedule", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "The time the schedule was assigned to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}, "schedule_id": {"name": "schedule_id", "description": "The ID of the schedule applied to the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`db`.`zendesk_new`.`ticket_schedule`", "created_at": 1644618837.8602722}, "source.zendesk_source.zendesk.ticket_form_history": {"fqn": ["zendesk_source", "zendesk", "ticket_form_history"], "database": "db", "schema": "zendesk_new", "unique_id": "source.zendesk_source.zendesk.ticket_form_history", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "models/src_zendesk.yml", "original_file_path": "models/src_zendesk.yml", "name": "ticket_form_history", "source_name": "zendesk", "source_description": "", "loader": "fivetran", "identifier": "ticket_form_history", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": {"warn_after": {"count": 72, "period": "hour"}, "error_after": {"count": 168, "period": "hour"}, "filter": null}, "external": null, "description": "Ticket forms allow an admin to define a subset of ticket fields for display to both agents and end users.", "columns": {"id": {"name": "id", "description": "Automatically assigned when creating ticket form", "meta": {}, "data_type": null, "quote": null, "tags": []}, "created_at": {"name": "created_at", "description": "The time the ticket form was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated_at": {"name": "updated_at", "description": "The time of the last update of the ticket form", "meta": {}, "data_type": null, "quote": null, "tags": []}, "display_name": {"name": "display_name", "description": "The name of the form that is displayed to an end user", "meta": {}, "data_type": null, "quote": null, "tags": []}, "active": {"name": "active", "description": "If the form is set as active", "meta": {}, "data_type": null, "quote": null, "tags": []}, "name": {"name": "name", "description": "The name of the form", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {"is_enabled": true}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`db`.`zendesk_new`.`ticket_form_history`", "created_at": 1644618837.860422}, "source.zendesk_source.zendesk.ticket_tag": {"fqn": ["zendesk_source", "zendesk", "ticket_tag"], "database": "db", "schema": "zendesk_new", "unique_id": "source.zendesk_source.zendesk.ticket_tag", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "models/src_zendesk.yml", "original_file_path": "models/src_zendesk.yml", "name": "ticket_tag", "source_name": "zendesk", "source_description": "", "loader": "fivetran", "identifier": "ticket_tag", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Tags are words, or combinations of words, you can use to add more context to tickets. The table lists all tags currently associated with a ticket.\n", "columns": {"ticket_id": {"name": "ticket_id", "description": "The ID of the ticket associated with the tag", "meta": {}, "data_type": null, "quote": null, "tags": []}, "tags": {"name": "tags", "description": "The tag, or word(s), associated with the ticket", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`db`.`zendesk_new`.`ticket_tag`", "created_at": 1644618837.860554}, "source.zendesk_source.zendesk.ticket_field_history": {"fqn": ["zendesk_source", "zendesk", "ticket_field_history"], "database": "db", "schema": "zendesk_new", "unique_id": "source.zendesk_source.zendesk.ticket_field_history", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "models/src_zendesk.yml", "original_file_path": "models/src_zendesk.yml", "name": "ticket_field_history", "source_name": "zendesk", "source_description": "", "loader": "fivetran", "identifier": "ticket_field_history", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "All fields and field values associated with tickets.", "columns": {"ticket_id": {"name": "ticket_id", "description": "The ID of the ticket associated with the field", "meta": {}, "data_type": null, "quote": null, "tags": []}, "field_name": {"name": "field_name", "description": "The name of the ticket field", "meta": {}, "data_type": null, "quote": null, "tags": []}, "updated": {"name": "updated", "description": "The time the ticket field value was created", "meta": {}, "data_type": null, "quote": null, "tags": []}, "value": {"name": "value", "description": "The value of the field", "meta": {}, "data_type": null, "quote": null, "tags": []}, "user_id": {"name": "user_id", "description": "The id of the user who made the update", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`db`.`zendesk_new`.`ticket_field_history`", "created_at": 1644618837.8606908}, "source.zendesk_source.zendesk.daylight_time": {"fqn": ["zendesk_source", "zendesk", "daylight_time"], "database": "db", "schema": "zendesk_new", "unique_id": "source.zendesk_source.zendesk.daylight_time", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "models/src_zendesk.yml", "original_file_path": "models/src_zendesk.yml", "name": "daylight_time", "source_name": "zendesk", "source_description": "", "loader": "fivetran", "identifier": "daylight_time", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Appropriate offsets (from UTC) for timezones that engage or have engaged with Daylight Savings at some point since 1970.\n", "columns": {"daylight_end_utc": {"name": "daylight_end_utc", "description": "UTC timestamp of when Daylight Time ended in this year.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daylight_offset": {"name": "daylight_offset", "description": "Number of **hours** added during Daylight Savings Time.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "daylight_start_utc": {"name": "daylight_start_utc", "description": "UTC timestamp of when Daylight Time began in this year.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "time_zone": {"name": "time_zone", "description": "Name of the timezone.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "year": {"name": "year", "description": "Year in which daylight savings occurred.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`db`.`zendesk_new`.`daylight_time`", "created_at": 1644618837.86088}, "source.zendesk_source.zendesk.time_zone": {"fqn": ["zendesk_source", "zendesk", "time_zone"], "database": "db", "schema": "zendesk_new", "unique_id": "source.zendesk_source.zendesk.time_zone", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "models/src_zendesk.yml", "original_file_path": "models/src_zendesk.yml", "name": "time_zone", "source_name": "zendesk", "source_description": "", "loader": "fivetran", "identifier": "time_zone", "resource_type": "source", "quoting": {"database": null, "schema": null, "identifier": null, "column": null}, "loaded_at_field": "_fivetran_synced", "freshness": null, "external": null, "description": "Offsets (from UTC) for each timezone.", "columns": {"time_zone": {"name": "time_zone", "description": "Name of the time zone.", "meta": {}, "data_type": null, "quote": null, "tags": []}, "standard_offset": {"name": "standard_offset", "description": "Standard offset of the timezone (non-daylight savings hours). In `+/-hh:mm` format.", "meta": {}, "data_type": null, "quote": null, "tags": []}}, "meta": {}, "source_meta": {}, "tags": [], "config": {"enabled": true}, "patch_path": null, "unrendered_config": {}, "relation_name": "`db`.`zendesk_new`.`time_zone`", "created_at": 1644618837.861012}}, "macros": {"macro.dbt_bigquery.date_sharded_table": {"unique_id": "macro.dbt_bigquery.date_sharded_table", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.340491}, "macro.dbt_bigquery.grant_access_to": {"unique_id": "macro.dbt_bigquery.grant_access_to", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.3410938}, "macro.dbt_bigquery.get_partitions_metadata": {"unique_id": "macro.dbt_bigquery.get_partitions_metadata", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.341793}, "macro.dbt_bigquery.bigquery__get_catalog": {"unique_id": "macro.dbt_bigquery.bigquery__get_catalog", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.348234}, "macro.dbt_bigquery.partition_by": {"unique_id": "macro.dbt_bigquery.partition_by", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.358581}, "macro.dbt_bigquery.cluster_by": {"unique_id": "macro.dbt_bigquery.cluster_by", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.359478}, "macro.dbt_bigquery.bigquery_options": {"unique_id": "macro.dbt_bigquery.bigquery_options", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.360322}, "macro.dbt_bigquery.bigquery_table_options": {"unique_id": "macro.dbt_bigquery.bigquery_table_options", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.360938}, "macro.dbt_bigquery.bigquery__create_table_as": {"unique_id": "macro.dbt_bigquery.bigquery__create_table_as", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.362437}, "macro.dbt_bigquery.bigquery_view_options": {"unique_id": "macro.dbt_bigquery.bigquery_view_options", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.363081}, "macro.dbt_bigquery.bigquery__create_view_as": {"unique_id": "macro.dbt_bigquery.bigquery__create_view_as", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.3638241}, "macro.dbt_bigquery.bigquery__create_schema": {"unique_id": "macro.dbt_bigquery.bigquery__create_schema", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.3641322}, "macro.dbt_bigquery.bigquery__drop_schema": {"unique_id": "macro.dbt_bigquery.bigquery__drop_schema", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.364438}, "macro.dbt_bigquery.bigquery__drop_relation": {"unique_id": "macro.dbt_bigquery.bigquery__drop_relation", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.364901}, "macro.dbt_bigquery.bigquery__get_columns_in_relation": {"unique_id": "macro.dbt_bigquery.bigquery__get_columns_in_relation", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.365249}, "macro.dbt_bigquery.bigquery__list_relations_without_caching": {"unique_id": "macro.dbt_bigquery.bigquery__list_relations_without_caching", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.36559}, "macro.dbt_bigquery.bigquery__current_timestamp": {"unique_id": "macro.dbt_bigquery.bigquery__current_timestamp", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.36577}, "macro.dbt_bigquery.bigquery__snapshot_string_as_time": {"unique_id": "macro.dbt_bigquery.bigquery__snapshot_string_as_time", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.3661928}, "macro.dbt_bigquery.bigquery__list_schemas": {"unique_id": "macro.dbt_bigquery.bigquery__list_schemas", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.366851}, "macro.dbt_bigquery.bigquery__check_schema_exists": {"unique_id": "macro.dbt_bigquery.bigquery__check_schema_exists", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.367862}, "macro.dbt_bigquery.bigquery__persist_docs": {"unique_id": "macro.dbt_bigquery.bigquery__persist_docs", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.368633}, "macro.dbt_bigquery.bigquery__alter_column_comment": {"unique_id": "macro.dbt_bigquery.bigquery__alter_column_comment", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.369023}, "macro.dbt_bigquery.bigquery__rename_relation": {"unique_id": "macro.dbt_bigquery.bigquery__rename_relation", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.3693912}, "macro.dbt_bigquery.bigquery__alter_relation_add_columns": {"unique_id": "macro.dbt_bigquery.bigquery__alter_relation_add_columns", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.370396}, "macro.dbt_bigquery.bigquery__alter_relation_drop_columns": {"unique_id": "macro.dbt_bigquery.bigquery__alter_relation_drop_columns", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.3712971}, "macro.dbt_bigquery.bigquery__alter_column_type": {"unique_id": "macro.dbt_bigquery.bigquery__alter_column_type", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.372894}, "macro.dbt_bigquery.bigquery__test_unique": {"unique_id": "macro.dbt_bigquery.bigquery__test_unique", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.3732889}, "macro.dbt_bigquery.bigquery__create_csv_table": {"unique_id": "macro.dbt_bigquery.bigquery__create_csv_table", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.3741262}, "macro.dbt_bigquery.bigquery__reset_csv_table": {"unique_id": "macro.dbt_bigquery.bigquery__reset_csv_table", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.374502}, "macro.dbt_bigquery.bigquery__load_csv_rows": {"unique_id": "macro.dbt_bigquery.bigquery__load_csv_rows", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.3758879}, "macro.dbt_bigquery.bigquery__handle_existing_table": {"unique_id": "macro.dbt_bigquery.bigquery__handle_existing_table", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.3771882}, "macro.dbt_bigquery.materialization_view_bigquery": {"unique_id": "macro.dbt_bigquery.materialization_view_bigquery", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.3785868}, "macro.dbt_bigquery.materialization_table_bigquery": {"unique_id": "macro.dbt_bigquery.materialization_table_bigquery", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.3828428}, "macro.dbt_bigquery.materialization_copy_bigquery": {"unique_id": "macro.dbt_bigquery.materialization_copy_bigquery", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.385552}, "macro.dbt_bigquery.declare_dbt_max_partition": {"unique_id": "macro.dbt_bigquery.declare_dbt_max_partition", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.3894248}, "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": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.390542}, "macro.dbt_bigquery.bq_insert_overwrite": {"unique_id": "macro.dbt_bigquery.bq_insert_overwrite", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.393704}, "macro.dbt_bigquery.bq_generate_incremental_build_sql": {"unique_id": "macro.dbt_bigquery.bq_generate_incremental_build_sql", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.395679}, "macro.dbt_bigquery.materialization_incremental_bigquery": {"unique_id": "macro.dbt_bigquery.materialization_incremental_bigquery", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.4024699}, "macro.dbt_bigquery.bigquery__snapshot_hash_arguments": {"unique_id": "macro.dbt_bigquery.bigquery__snapshot_hash_arguments", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.40365}, "macro.dbt_bigquery.bigquery__create_columns": {"unique_id": "macro.dbt_bigquery.bigquery__create_columns", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.404021}, "macro.dbt_bigquery.bigquery__post_snapshot": {"unique_id": "macro.dbt_bigquery.bigquery__post_snapshot", "package_name": "dbt_bigquery", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.404341}, "macro.dbt.run_hooks": {"unique_id": "macro.dbt.run_hooks", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.40705}, "macro.dbt.make_hook_config": {"unique_id": "macro.dbt.make_hook_config", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.4075918}, "macro.dbt.before_begin": {"unique_id": "macro.dbt.before_begin", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.407935}, "macro.dbt.in_transaction": {"unique_id": "macro.dbt.in_transaction", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.4082718}, "macro.dbt.after_commit": {"unique_id": "macro.dbt.after_commit", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.408609}, "macro.dbt.set_sql_header": {"unique_id": "macro.dbt.set_sql_header", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.409636}, "macro.dbt.should_full_refresh": {"unique_id": "macro.dbt.should_full_refresh", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.410517}, "macro.dbt.should_store_failures": {"unique_id": "macro.dbt.should_store_failures", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.411237}, "macro.dbt.snapshot_merge_sql": {"unique_id": "macro.dbt.snapshot_merge_sql", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.412292}, "macro.dbt.default__snapshot_merge_sql": {"unique_id": "macro.dbt.default__snapshot_merge_sql", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.412919}, "macro.dbt.strategy_dispatch": {"unique_id": "macro.dbt.strategy_dispatch", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.419931}, "macro.dbt.snapshot_hash_arguments": {"unique_id": "macro.dbt.snapshot_hash_arguments", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.420346}, "macro.dbt.default__snapshot_hash_arguments": {"unique_id": "macro.dbt.default__snapshot_hash_arguments", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.4209468}, "macro.dbt.snapshot_get_time": {"unique_id": "macro.dbt.snapshot_get_time", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.4212952}, "macro.dbt.default__snapshot_get_time": {"unique_id": "macro.dbt.default__snapshot_get_time", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.421537}, "macro.dbt.snapshot_timestamp_strategy": {"unique_id": "macro.dbt.snapshot_timestamp_strategy", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.4234009}, "macro.dbt.snapshot_string_as_time": {"unique_id": "macro.dbt.snapshot_string_as_time", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.423806}, "macro.dbt.default__snapshot_string_as_time": {"unique_id": "macro.dbt.default__snapshot_string_as_time", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.424226}, "macro.dbt.snapshot_check_all_get_existing_columns": {"unique_id": "macro.dbt.snapshot_check_all_get_existing_columns", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.4268658}, "macro.dbt.snapshot_check_strategy": {"unique_id": "macro.dbt.snapshot_check_strategy", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.431906}, "macro.dbt.create_columns": {"unique_id": "macro.dbt.create_columns", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.438267}, "macro.dbt.default__create_columns": {"unique_id": "macro.dbt.default__create_columns", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.439129}, "macro.dbt.post_snapshot": {"unique_id": "macro.dbt.post_snapshot", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.439562}, "macro.dbt.default__post_snapshot": {"unique_id": "macro.dbt.default__post_snapshot", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.439786}, "macro.dbt.snapshot_staging_table": {"unique_id": "macro.dbt.snapshot_staging_table", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.44029}, "macro.dbt.default__snapshot_staging_table": {"unique_id": "macro.dbt.default__snapshot_staging_table", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.44239}, "macro.dbt.build_snapshot_table": {"unique_id": "macro.dbt.build_snapshot_table", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.442848}, "macro.dbt.default__build_snapshot_table": {"unique_id": "macro.dbt.default__build_snapshot_table", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.443467}, "macro.dbt.build_snapshot_staging_table": {"unique_id": "macro.dbt.build_snapshot_staging_table", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.4445581}, "macro.dbt.materialization_snapshot_default": {"unique_id": "macro.dbt.materialization_snapshot_default", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.4581919}, "macro.dbt.materialization_test_default": {"unique_id": "macro.dbt.materialization_test_default", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.4638238}, "macro.dbt.get_test_sql": {"unique_id": "macro.dbt.get_test_sql", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.465058}, "macro.dbt.default__get_test_sql": {"unique_id": "macro.dbt.default__get_test_sql", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.4658089}, "macro.dbt.get_where_subquery": {"unique_id": "macro.dbt.get_where_subquery", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.4669492}, "macro.dbt.default__get_where_subquery": {"unique_id": "macro.dbt.default__get_where_subquery", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.468083}, "macro.dbt.get_quoted_csv": {"unique_id": "macro.dbt.get_quoted_csv", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.470177}, "macro.dbt.diff_columns": {"unique_id": "macro.dbt.diff_columns", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.471501}, "macro.dbt.diff_column_data_types": {"unique_id": "macro.dbt.diff_column_data_types", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.473162}, "macro.dbt.get_merge_sql": {"unique_id": "macro.dbt.get_merge_sql", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.479156}, "macro.dbt.default__get_merge_sql": {"unique_id": "macro.dbt.default__get_merge_sql", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.48195}, "macro.dbt.get_delete_insert_merge_sql": {"unique_id": "macro.dbt.get_delete_insert_merge_sql", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.482517}, "macro.dbt.default__get_delete_insert_merge_sql": {"unique_id": "macro.dbt.default__get_delete_insert_merge_sql", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.4835432}, "macro.dbt.get_insert_overwrite_merge_sql": {"unique_id": "macro.dbt.get_insert_overwrite_merge_sql", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.484206}, "macro.dbt.default__get_insert_overwrite_merge_sql": {"unique_id": "macro.dbt.default__get_insert_overwrite_merge_sql", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.4857888}, "macro.dbt.is_incremental": {"unique_id": "macro.dbt.is_incremental", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.487618}, "macro.dbt.materialization_incremental_default": {"unique_id": "macro.dbt.materialization_incremental_default", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.499169}, "macro.dbt.incremental_validate_on_schema_change": {"unique_id": "macro.dbt.incremental_validate_on_schema_change", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.509278}, "macro.dbt.check_for_schema_changes": {"unique_id": "macro.dbt.check_for_schema_changes", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.512631}, "macro.dbt.sync_column_schemas": {"unique_id": "macro.dbt.sync_column_schemas", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.515759}, "macro.dbt.process_schema_changes": {"unique_id": "macro.dbt.process_schema_changes", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.517514}, "macro.dbt.materialization_table_default": {"unique_id": "macro.dbt.materialization_table_default", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.5256479}, "macro.dbt.get_create_table_as_sql": {"unique_id": "macro.dbt.get_create_table_as_sql", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.526947}, "macro.dbt.default__get_create_table_as_sql": {"unique_id": "macro.dbt.default__get_create_table_as_sql", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.527385}, "macro.dbt.create_table_as": {"unique_id": "macro.dbt.create_table_as", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.5278652}, "macro.dbt.default__create_table_as": {"unique_id": "macro.dbt.default__create_table_as", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.528817}, "macro.dbt.materialization_view_default": {"unique_id": "macro.dbt.materialization_view_default", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.536774}, "macro.dbt.handle_existing_table": {"unique_id": "macro.dbt.handle_existing_table", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.537714}, "macro.dbt.default__handle_existing_table": {"unique_id": "macro.dbt.default__handle_existing_table", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.538239}, "macro.dbt.create_or_replace_view": {"unique_id": "macro.dbt.create_or_replace_view", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.541041}, "macro.dbt.get_create_view_as_sql": {"unique_id": "macro.dbt.get_create_view_as_sql", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.5419378}, "macro.dbt.default__get_create_view_as_sql": {"unique_id": "macro.dbt.default__get_create_view_as_sql", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.542316}, "macro.dbt.create_view_as": {"unique_id": "macro.dbt.create_view_as", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.542901}, "macro.dbt.default__create_view_as": {"unique_id": "macro.dbt.default__create_view_as", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.54351}, "macro.dbt.materialization_seed_default": {"unique_id": "macro.dbt.materialization_seed_default", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.5499258}, "macro.dbt.create_csv_table": {"unique_id": "macro.dbt.create_csv_table", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.5573509}, "macro.dbt.default__create_csv_table": {"unique_id": "macro.dbt.default__create_csv_table", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.559742}, "macro.dbt.reset_csv_table": {"unique_id": "macro.dbt.reset_csv_table", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.5603268}, "macro.dbt.default__reset_csv_table": {"unique_id": "macro.dbt.default__reset_csv_table", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.561461}, "macro.dbt.get_binding_char": {"unique_id": "macro.dbt.get_binding_char", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.561853}, "macro.dbt.default__get_binding_char": {"unique_id": "macro.dbt.default__get_binding_char", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.56213}, "macro.dbt.get_batch_size": {"unique_id": "macro.dbt.get_batch_size", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.562502}, "macro.dbt.default__get_batch_size": {"unique_id": "macro.dbt.default__get_batch_size", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.562811}, "macro.dbt.get_seed_column_quoted_csv": {"unique_id": "macro.dbt.get_seed_column_quoted_csv", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.563926}, "macro.dbt.load_csv_rows": {"unique_id": "macro.dbt.load_csv_rows", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.56436}, "macro.dbt.default__load_csv_rows": {"unique_id": "macro.dbt.default__load_csv_rows", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.5675352}, "macro.dbt.generate_alias_name": {"unique_id": "macro.dbt.generate_alias_name", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.568567}, "macro.dbt.default__generate_alias_name": {"unique_id": "macro.dbt.default__generate_alias_name", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.5691211}, "macro.dbt.generate_schema_name": {"unique_id": "macro.dbt.generate_schema_name", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.5703712}, "macro.dbt.default__generate_schema_name": {"unique_id": "macro.dbt.default__generate_schema_name", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.570979}, "macro.dbt.generate_schema_name_for_env": {"unique_id": "macro.dbt.generate_schema_name_for_env", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.5716329}, "macro.dbt.generate_database_name": {"unique_id": "macro.dbt.generate_database_name", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.57264}, "macro.dbt.default__generate_database_name": {"unique_id": "macro.dbt.default__generate_database_name", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.5732312}, "macro.dbt.default__test_relationships": {"unique_id": "macro.dbt.default__test_relationships", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.574147}, "macro.dbt.default__test_not_null": {"unique_id": "macro.dbt.default__test_not_null", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.574827}, "macro.dbt.default__test_unique": {"unique_id": "macro.dbt.default__test_unique", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.5755289}, "macro.dbt.default__test_accepted_values": {"unique_id": "macro.dbt.default__test_accepted_values", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.5770319}, "macro.dbt.statement": {"unique_id": "macro.dbt.statement", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.579602}, "macro.dbt.noop_statement": {"unique_id": "macro.dbt.noop_statement", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.581007}, "macro.dbt.run_query": {"unique_id": "macro.dbt.run_query", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.581685}, "macro.dbt.convert_datetime": {"unique_id": "macro.dbt.convert_datetime", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.5851898}, "macro.dbt.dates_in_range": {"unique_id": "macro.dbt.dates_in_range", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.588026}, "macro.dbt.partition_range": {"unique_id": "macro.dbt.partition_range", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.58976}, "macro.dbt.py_current_timestring": {"unique_id": "macro.dbt.py_current_timestring", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.590297}, "macro.dbt.create_schema": {"unique_id": "macro.dbt.create_schema", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.5915148}, "macro.dbt.default__create_schema": {"unique_id": "macro.dbt.default__create_schema", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.591956}, "macro.dbt.drop_schema": {"unique_id": "macro.dbt.drop_schema", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.592331}, "macro.dbt.default__drop_schema": {"unique_id": "macro.dbt.default__drop_schema", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.592758}, "macro.dbt.get_create_index_sql": {"unique_id": "macro.dbt.get_create_index_sql", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.593871}, "macro.dbt.default__get_create_index_sql": {"unique_id": "macro.dbt.default__get_create_index_sql", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.5942001}, "macro.dbt.create_indexes": {"unique_id": "macro.dbt.create_indexes", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.594571}, "macro.dbt.default__create_indexes": {"unique_id": "macro.dbt.default__create_indexes", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.5955148}, "macro.dbt.make_temp_relation": {"unique_id": "macro.dbt.make_temp_relation", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.598805}, "macro.dbt.default__make_temp_relation": {"unique_id": "macro.dbt.default__make_temp_relation", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.599531}, "macro.dbt.drop_relation": {"unique_id": "macro.dbt.drop_relation", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.599956}, "macro.dbt.default__drop_relation": {"unique_id": "macro.dbt.default__drop_relation", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.6006908}, "macro.dbt.truncate_relation": {"unique_id": "macro.dbt.truncate_relation", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.601197}, "macro.dbt.default__truncate_relation": {"unique_id": "macro.dbt.default__truncate_relation", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.60159}, "macro.dbt.rename_relation": {"unique_id": "macro.dbt.rename_relation", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.6022}, "macro.dbt.default__rename_relation": {"unique_id": "macro.dbt.default__rename_relation", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.6028988}, "macro.dbt.get_or_create_relation": {"unique_id": "macro.dbt.get_or_create_relation", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.60348}, "macro.dbt.default__get_or_create_relation": {"unique_id": "macro.dbt.default__get_or_create_relation", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.6048598}, "macro.dbt.load_relation": {"unique_id": "macro.dbt.load_relation", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.605421}, "macro.dbt.drop_relation_if_exists": {"unique_id": "macro.dbt.drop_relation_if_exists", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.605885}, "macro.dbt.current_timestamp": {"unique_id": "macro.dbt.current_timestamp", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.6071832}, "macro.dbt.default__current_timestamp": {"unique_id": "macro.dbt.default__current_timestamp", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.607531}, "macro.dbt.collect_freshness": {"unique_id": "macro.dbt.collect_freshness", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.608068}, "macro.dbt.default__collect_freshness": {"unique_id": "macro.dbt.default__collect_freshness", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.609042}, "macro.dbt.alter_column_comment": {"unique_id": "macro.dbt.alter_column_comment", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.610581}, "macro.dbt.default__alter_column_comment": {"unique_id": "macro.dbt.default__alter_column_comment", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.610973}, "macro.dbt.alter_relation_comment": {"unique_id": "macro.dbt.alter_relation_comment", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.611449}, "macro.dbt.default__alter_relation_comment": {"unique_id": "macro.dbt.default__alter_relation_comment", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.6119082}, "macro.dbt.persist_docs": {"unique_id": "macro.dbt.persist_docs", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.6125371}, "macro.dbt.default__persist_docs": {"unique_id": "macro.dbt.default__persist_docs", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.613693}, "macro.dbt.get_catalog": {"unique_id": "macro.dbt.get_catalog", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.6166148}, "macro.dbt.default__get_catalog": {"unique_id": "macro.dbt.default__get_catalog", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.617229}, "macro.dbt.information_schema_name": {"unique_id": "macro.dbt.information_schema_name", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.6176589}, "macro.dbt.default__information_schema_name": {"unique_id": "macro.dbt.default__information_schema_name", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.6180348}, "macro.dbt.list_schemas": {"unique_id": "macro.dbt.list_schemas", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.618457}, "macro.dbt.default__list_schemas": {"unique_id": "macro.dbt.default__list_schemas", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.619036}, "macro.dbt.check_schema_exists": {"unique_id": "macro.dbt.check_schema_exists", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.619516}, "macro.dbt.default__check_schema_exists": {"unique_id": "macro.dbt.default__check_schema_exists", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.620418}, "macro.dbt.list_relations_without_caching": {"unique_id": "macro.dbt.list_relations_without_caching", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.620851}, "macro.dbt.default__list_relations_without_caching": {"unique_id": "macro.dbt.default__list_relations_without_caching", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.6212249}, "macro.dbt.get_columns_in_relation": {"unique_id": "macro.dbt.get_columns_in_relation", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.624825}, "macro.dbt.default__get_columns_in_relation": {"unique_id": "macro.dbt.default__get_columns_in_relation", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.625281}, "macro.dbt.sql_convert_columns_in_relation": {"unique_id": "macro.dbt.sql_convert_columns_in_relation", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.6260118}, "macro.dbt.get_columns_in_query": {"unique_id": "macro.dbt.get_columns_in_query", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.626445}, "macro.dbt.default__get_columns_in_query": {"unique_id": "macro.dbt.default__get_columns_in_query", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.627241}, "macro.dbt.alter_column_type": {"unique_id": "macro.dbt.alter_column_type", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.6277802}, "macro.dbt.default__alter_column_type": {"unique_id": "macro.dbt.default__alter_column_type", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.629185}, "macro.dbt.alter_relation_add_remove_columns": {"unique_id": "macro.dbt.alter_relation_add_remove_columns", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.629777}, "macro.dbt.default__alter_relation_add_remove_columns": {"unique_id": "macro.dbt.default__alter_relation_add_remove_columns", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.631685}, "macro.dbt.test_unique": {"unique_id": "macro.dbt.test_unique", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.6332538}, "macro.dbt.test_not_null": {"unique_id": "macro.dbt.test_not_null", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.633899}, "macro.dbt.test_accepted_values": {"unique_id": "macro.dbt.test_accepted_values", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.634646}, "macro.dbt.test_relationships": {"unique_id": "macro.dbt.test_relationships", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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": 1644618835.635296}, "macro.dbt_utils.except": {"unique_id": "macro.dbt_utils.except", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.636117}, "macro.dbt_utils.default__except": {"unique_id": "macro.dbt_utils.default__except", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.636301}, "macro.dbt_utils.bigquery__except": {"unique_id": "macro.dbt_utils.bigquery__except", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.636479}, "macro.dbt_utils.replace": {"unique_id": "macro.dbt_utils.replace", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.637366}, "macro.dbt_utils.default__replace": {"unique_id": "macro.dbt_utils.default__replace", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.637831}, "macro.dbt_utils.concat": {"unique_id": "macro.dbt_utils.concat", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.638636}, "macro.dbt_utils.default__concat": {"unique_id": "macro.dbt_utils.default__concat", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.638966}, "macro.dbt_utils.type_string": {"unique_id": "macro.dbt_utils.type_string", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.640575}, "macro.dbt_utils.default__type_string": {"unique_id": "macro.dbt_utils.default__type_string", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.6409018}, "macro.dbt_utils.redshift__type_string": {"unique_id": "macro.dbt_utils.redshift__type_string", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.6410828}, "macro.dbt_utils.postgres__type_string": {"unique_id": "macro.dbt_utils.postgres__type_string", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.6412559}, "macro.dbt_utils.snowflake__type_string": {"unique_id": "macro.dbt_utils.snowflake__type_string", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.6414258}, "macro.dbt_utils.type_timestamp": {"unique_id": "macro.dbt_utils.type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.6417978}, "macro.dbt_utils.default__type_timestamp": {"unique_id": "macro.dbt_utils.default__type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.641975}, "macro.dbt_utils.snowflake__type_timestamp": {"unique_id": "macro.dbt_utils.snowflake__type_timestamp", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.642147}, "macro.dbt_utils.type_float": {"unique_id": "macro.dbt_utils.type_float", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.642518}, "macro.dbt_utils.default__type_float": {"unique_id": "macro.dbt_utils.default__type_float", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.642698}, "macro.dbt_utils.bigquery__type_float": {"unique_id": "macro.dbt_utils.bigquery__type_float", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.6428711}, "macro.dbt_utils.type_numeric": {"unique_id": "macro.dbt_utils.type_numeric", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.643243}, "macro.dbt_utils.default__type_numeric": {"unique_id": "macro.dbt_utils.default__type_numeric", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.643421}, "macro.dbt_utils.bigquery__type_numeric": {"unique_id": "macro.dbt_utils.bigquery__type_numeric", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.643594}, "macro.dbt_utils.type_bigint": {"unique_id": "macro.dbt_utils.type_bigint", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.644005}, "macro.dbt_utils.default__type_bigint": {"unique_id": "macro.dbt_utils.default__type_bigint", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.644236}, "macro.dbt_utils.bigquery__type_bigint": {"unique_id": "macro.dbt_utils.bigquery__type_bigint", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.644419}, "macro.dbt_utils.type_int": {"unique_id": "macro.dbt_utils.type_int", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.644798}, "macro.dbt_utils.default__type_int": {"unique_id": "macro.dbt_utils.default__type_int", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.644982}, "macro.dbt_utils.bigquery__type_int": {"unique_id": "macro.dbt_utils.bigquery__type_int", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.6451578}, "macro.dbt_utils._is_relation": {"unique_id": "macro.dbt_utils._is_relation", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.646326}, "macro.dbt_utils.length": {"unique_id": "macro.dbt_utils.length", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.647125}, "macro.dbt_utils.default__length": {"unique_id": "macro.dbt_utils.default__length", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.6473851}, "macro.dbt_utils.redshift__length": {"unique_id": "macro.dbt_utils.redshift__length", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.6476429}, "macro.dbt_utils.dateadd": {"unique_id": "macro.dbt_utils.dateadd", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.649013}, "macro.dbt_utils.default__dateadd": {"unique_id": "macro.dbt_utils.default__dateadd", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.649531}, "macro.dbt_utils.bigquery__dateadd": {"unique_id": "macro.dbt_utils.bigquery__dateadd", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.6499221}, "macro.dbt_utils.postgres__dateadd": {"unique_id": "macro.dbt_utils.postgres__dateadd", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.650306}, "macro.dbt_utils.redshift__dateadd": {"unique_id": "macro.dbt_utils.redshift__dateadd", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.6507578}, "macro.dbt_utils.intersect": {"unique_id": "macro.dbt_utils.intersect", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.651455}, "macro.dbt_utils.default__intersect": {"unique_id": "macro.dbt_utils.default__intersect", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.651638}, "macro.dbt_utils.bigquery__intersect": {"unique_id": "macro.dbt_utils.bigquery__intersect", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.651815}, "macro.dbt_utils.right": {"unique_id": "macro.dbt_utils.right", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.653017}, "macro.dbt_utils.default__right": {"unique_id": "macro.dbt_utils.default__right", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.653343}, "macro.dbt_utils.bigquery__right": {"unique_id": "macro.dbt_utils.bigquery__right", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.6537158}, "macro.dbt_utils.snowflake__right": {"unique_id": "macro.dbt_utils.snowflake__right", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.654158}, "macro.dbt_utils.datediff": {"unique_id": "macro.dbt_utils.datediff", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.659311}, "macro.dbt_utils.default__datediff": {"unique_id": "macro.dbt_utils.default__datediff", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.65972}, "macro.dbt_utils.bigquery__datediff": {"unique_id": "macro.dbt_utils.bigquery__datediff", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.6601012}, "macro.dbt_utils.postgres__datediff": {"unique_id": "macro.dbt_utils.postgres__datediff", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.6648278}, "macro.dbt_utils.redshift__datediff": {"unique_id": "macro.dbt_utils.redshift__datediff", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.665382}, "macro.dbt_utils.safe_cast": {"unique_id": "macro.dbt_utils.safe_cast", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.666652}, "macro.dbt_utils.default__safe_cast": {"unique_id": "macro.dbt_utils.default__safe_cast", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.66699}, "macro.dbt_utils.snowflake__safe_cast": {"unique_id": "macro.dbt_utils.snowflake__safe_cast", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.6672971}, "macro.dbt_utils.bigquery__safe_cast": {"unique_id": "macro.dbt_utils.bigquery__safe_cast", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.6676}, "macro.dbt_utils.hash": {"unique_id": "macro.dbt_utils.hash", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.668401}, "macro.dbt_utils.default__hash": {"unique_id": "macro.dbt_utils.default__hash", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.668766}, "macro.dbt_utils.bigquery__hash": {"unique_id": "macro.dbt_utils.bigquery__hash", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.669068}, "macro.dbt_utils.cast_bool_to_text": {"unique_id": "macro.dbt_utils.cast_bool_to_text", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.669867}, "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/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.670203}, "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/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.670578}, "macro.dbt_utils.identifier": {"unique_id": "macro.dbt_utils.identifier", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.671772}, "macro.dbt_utils.default__identifier": {"unique_id": "macro.dbt_utils.default__identifier", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.672024}, "macro.dbt_utils.bigquery__identifier": {"unique_id": "macro.dbt_utils.bigquery__identifier", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.672265}, "macro.dbt_utils.position": {"unique_id": "macro.dbt_utils.position", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.6731699}, "macro.dbt_utils.default__position": {"unique_id": "macro.dbt_utils.default__position", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.6734972}, "macro.dbt_utils.bigquery__position": {"unique_id": "macro.dbt_utils.bigquery__position", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.673852}, "macro.dbt_utils.string_literal": {"unique_id": "macro.dbt_utils.string_literal", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.674596}, "macro.dbt_utils.default__string_literal": {"unique_id": "macro.dbt_utils.default__string_literal", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.674849}, "macro.dbt_utils.current_timestamp": {"unique_id": "macro.dbt_utils.current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.67614}, "macro.dbt_utils.default__current_timestamp": {"unique_id": "macro.dbt_utils.default__current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.676445}, "macro.dbt_utils.redshift__current_timestamp": {"unique_id": "macro.dbt_utils.redshift__current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.676629}, "macro.dbt_utils.bigquery__current_timestamp": {"unique_id": "macro.dbt_utils.bigquery__current_timestamp", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.676806}, "macro.dbt_utils.current_timestamp_in_utc": {"unique_id": "macro.dbt_utils.current_timestamp_in_utc", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.677304}, "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/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.677569}, "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/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.6779141}, "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/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.678179}, "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/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.678487}, "macro.dbt_utils.width_bucket": {"unique_id": "macro.dbt_utils.width_bucket", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.681283}, "macro.dbt_utils.default__width_bucket": {"unique_id": "macro.dbt_utils.default__width_bucket", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.682355}, "macro.dbt_utils.redshift__width_bucket": {"unique_id": "macro.dbt_utils.redshift__width_bucket", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.6835022}, "macro.dbt_utils.snowflake__width_bucket": {"unique_id": "macro.dbt_utils.snowflake__width_bucket", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.683959}, "macro.dbt_utils.last_day": {"unique_id": "macro.dbt_utils.last_day", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.68522}, "macro.dbt_utils.default_last_day": {"unique_id": "macro.dbt_utils.default_last_day", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.6858351}, "macro.dbt_utils.default__last_day": {"unique_id": "macro.dbt_utils.default__last_day", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.68618}, "macro.dbt_utils.postgres__last_day": {"unique_id": "macro.dbt_utils.postgres__last_day", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.687454}, "macro.dbt_utils.redshift__last_day": {"unique_id": "macro.dbt_utils.redshift__last_day", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.688056}, "macro.dbt_utils.split_part": {"unique_id": "macro.dbt_utils.split_part", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.689128}, "macro.dbt_utils.default__split_part": {"unique_id": "macro.dbt_utils.default__split_part", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.689527}, "macro.dbt_utils.bigquery__split_part": {"unique_id": "macro.dbt_utils.bigquery__split_part", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.6899421}, "macro.dbt_utils.date_trunc": {"unique_id": "macro.dbt_utils.date_trunc", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.690851}, "macro.dbt_utils.default__date_trunc": {"unique_id": "macro.dbt_utils.default__date_trunc", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.691164}, "macro.dbt_utils.bigquery__date_trunc": {"unique_id": "macro.dbt_utils.bigquery__date_trunc", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.691475}, "macro.dbt_utils._is_ephemeral": {"unique_id": "macro.dbt_utils._is_ephemeral", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.693534}, "macro.dbt_utils.get_period_boundaries": {"unique_id": "macro.dbt_utils.get_period_boundaries", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.704963}, "macro.dbt_utils.default__get_period_boundaries": {"unique_id": "macro.dbt_utils.default__get_period_boundaries", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.706483}, "macro.dbt_utils.get_period_sql": {"unique_id": "macro.dbt_utils.get_period_sql", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.7072608}, "macro.dbt_utils.default__get_period_sql": {"unique_id": "macro.dbt_utils.default__get_period_sql", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.708501}, "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/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.720947}, "macro.dbt_utils.get_url_host": {"unique_id": "macro.dbt_utils.get_url_host", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.7220201}, "macro.dbt_utils.default__get_url_host": {"unique_id": "macro.dbt_utils.default__get_url_host", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.723104}, "macro.dbt_utils.get_url_path": {"unique_id": "macro.dbt_utils.get_url_path", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.724273}, "macro.dbt_utils.default__get_url_path": {"unique_id": "macro.dbt_utils.default__get_url_path", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.725773}, "macro.dbt_utils.get_url_parameter": {"unique_id": "macro.dbt_utils.get_url_parameter", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.726644}, "macro.dbt_utils.default__get_url_parameter": {"unique_id": "macro.dbt_utils.default__get_url_parameter", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.7273889}, "macro.dbt_utils.pretty_log_format": {"unique_id": "macro.dbt_utils.pretty_log_format", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.7281122}, "macro.dbt_utils.default__pretty_log_format": {"unique_id": "macro.dbt_utils.default__pretty_log_format", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.7285419}, "macro.dbt_utils.pretty_time": {"unique_id": "macro.dbt_utils.pretty_time", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.729388}, "macro.dbt_utils.default__pretty_time": {"unique_id": "macro.dbt_utils.default__pretty_time", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.729845}, "macro.dbt_utils.log_info": {"unique_id": "macro.dbt_utils.log_info", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.730561}, "macro.dbt_utils.default__log_info": {"unique_id": "macro.dbt_utils.default__log_info", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.731}, "macro.dbt_utils.slugify": {"unique_id": "macro.dbt_utils.slugify", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.732189}, "macro.dbt_utils.test_fewer_rows_than": {"unique_id": "macro.dbt_utils.test_fewer_rows_than", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.733566}, "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/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.734157}, "macro.dbt_utils.test_equal_rowcount": {"unique_id": "macro.dbt_utils.test_equal_rowcount", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.735308}, "macro.dbt_utils.default__test_equal_rowcount": {"unique_id": "macro.dbt_utils.default__test_equal_rowcount", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.736023}, "macro.dbt_utils.test_relationships_where": {"unique_id": "macro.dbt_utils.test_relationships_where", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.737499}, "macro.dbt_utils.default__test_relationships_where": {"unique_id": "macro.dbt_utils.default__test_relationships_where", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.738324}, "macro.dbt_utils.test_recency": {"unique_id": "macro.dbt_utils.test_recency", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.739342}, "macro.dbt_utils.default__test_recency": {"unique_id": "macro.dbt_utils.default__test_recency", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.740509}, "macro.dbt_utils.test_not_constant": {"unique_id": "macro.dbt_utils.test_not_constant", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.741406}, "macro.dbt_utils.default__test_not_constant": {"unique_id": "macro.dbt_utils.default__test_not_constant", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.7418299}, "macro.dbt_utils.test_accepted_range": {"unique_id": "macro.dbt_utils.test_accepted_range", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.7432342}, "macro.dbt_utils.default__test_accepted_range": {"unique_id": "macro.dbt_utils.default__test_accepted_range", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.7443619}, "macro.dbt_utils.test_not_accepted_values": {"unique_id": "macro.dbt_utils.test_not_accepted_values", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.745643}, "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/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.7465641}, "macro.dbt_utils.test_unique_where": {"unique_id": "macro.dbt_utils.test_unique_where", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.747628}, "macro.dbt_utils.default__test_unique_where": {"unique_id": "macro.dbt_utils.default__test_unique_where", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.748072}, "macro.dbt_utils.test_at_least_one": {"unique_id": "macro.dbt_utils.test_at_least_one", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.748929}, "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/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.749357}, "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/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.7509198}, "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/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.752463}, "macro.dbt_utils.test_cardinality_equality": {"unique_id": "macro.dbt_utils.test_cardinality_equality", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.7537239}, "macro.dbt_utils.default__test_cardinality_equality": {"unique_id": "macro.dbt_utils.default__test_cardinality_equality", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.754594}, "macro.dbt_utils.test_expression_is_true": {"unique_id": "macro.dbt_utils.test_expression_is_true", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.75589}, "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/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.756608}, "macro.dbt_utils.test_not_null_proportion": {"unique_id": "macro.dbt_utils.test_not_null_proportion", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.7576609}, "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/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.759128}, "macro.dbt_utils.test_sequential_values": {"unique_id": "macro.dbt_utils.test_sequential_values", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.760596}, "macro.dbt_utils.default__test_sequential_values": {"unique_id": "macro.dbt_utils.default__test_sequential_values", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.762178}, "macro.dbt_utils.test_not_null_where": {"unique_id": "macro.dbt_utils.test_not_null_where", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.7632818}, "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/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.763778}, "macro.dbt_utils.test_equality": {"unique_id": "macro.dbt_utils.test_equality", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.765528}, "macro.dbt_utils.default__test_equality": {"unique_id": "macro.dbt_utils.default__test_equality", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.768245}, "macro.dbt_utils.test_mutually_exclusive_ranges": {"unique_id": "macro.dbt_utils.test_mutually_exclusive_ranges", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.774129}, "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/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.777995}, "macro.dbt_utils.get_intervals_between": {"unique_id": "macro.dbt_utils.get_intervals_between", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.780252}, "macro.dbt_utils.default__get_intervals_between": {"unique_id": "macro.dbt_utils.default__get_intervals_between", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.781665}, "macro.dbt_utils.date_spine": {"unique_id": "macro.dbt_utils.date_spine", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.7822149}, "macro.dbt_utils.default__date_spine": {"unique_id": "macro.dbt_utils.default__date_spine", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.783246}, "macro.dbt_utils.nullcheck_table": {"unique_id": "macro.dbt_utils.nullcheck_table", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.78416}, "macro.dbt_utils.default__nullcheck_table": {"unique_id": "macro.dbt_utils.default__nullcheck_table", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.784987}, "macro.dbt_utils.get_relations_by_pattern": {"unique_id": "macro.dbt_utils.get_relations_by_pattern", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.786529}, "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/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.788817}, "macro.dbt_utils.get_powers_of_two": {"unique_id": "macro.dbt_utils.get_powers_of_two", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.790891}, "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/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.7919161}, "macro.dbt_utils.generate_series": {"unique_id": "macro.dbt_utils.generate_series", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.792421}, "macro.dbt_utils.default__generate_series": {"unique_id": "macro.dbt_utils.default__generate_series", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.7937012}, "macro.dbt_utils.get_relations_by_prefix": {"unique_id": "macro.dbt_utils.get_relations_by_prefix", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.795294}, "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/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.7974432}, "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/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.798649}, "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/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.7993531}, "macro.dbt_utils.star": {"unique_id": "macro.dbt_utils.star", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.801308}, "macro.dbt_utils.default__star": {"unique_id": "macro.dbt_utils.default__star", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.8038762}, "macro.dbt_utils.unpivot": {"unique_id": "macro.dbt_utils.unpivot", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.807511}, "macro.dbt_utils.default__unpivot": {"unique_id": "macro.dbt_utils.default__unpivot", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.81235}, "macro.dbt_utils.union_relations": {"unique_id": "macro.dbt_utils.union_relations", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.8158588}, "macro.dbt_utils.default__union_relations": {"unique_id": "macro.dbt_utils.default__union_relations", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.8214269}, "macro.dbt_utils.group_by": {"unique_id": "macro.dbt_utils.group_by", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.822262}, "macro.dbt_utils.default__group_by": {"unique_id": "macro.dbt_utils.default__group_by", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.822835}, "macro.dbt_utils.surrogate_key": {"unique_id": "macro.dbt_utils.surrogate_key", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.824158}, "macro.dbt_utils.default__surrogate_key": {"unique_id": "macro.dbt_utils.default__surrogate_key", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.826505}, "macro.dbt_utils.safe_add": {"unique_id": "macro.dbt_utils.safe_add", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.827499}, "macro.dbt_utils.default__safe_add": {"unique_id": "macro.dbt_utils.default__safe_add", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.828162}, "macro.dbt_utils.nullcheck": {"unique_id": "macro.dbt_utils.nullcheck", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.8290198}, "macro.dbt_utils.default__nullcheck": {"unique_id": "macro.dbt_utils.default__nullcheck", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.829803}, "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/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.832982}, "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/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.833914}, "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/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.8356}, "macro.dbt_utils._bigquery__get_matching_schemata": {"unique_id": "macro.dbt_utils._bigquery__get_matching_schemata", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.836874}, "macro.dbt_utils.get_column_values": {"unique_id": "macro.dbt_utils.get_column_values", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.8390222}, "macro.dbt_utils.default__get_column_values": {"unique_id": "macro.dbt_utils.default__get_column_values", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.842429}, "macro.dbt_utils.pivot": {"unique_id": "macro.dbt_utils.pivot", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.844666}, "macro.dbt_utils.default__pivot": {"unique_id": "macro.dbt_utils.default__pivot", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.8467681}, "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/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.8478138}, "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/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.849185}, "macro.dbt_utils.degrees_to_radians": {"unique_id": "macro.dbt_utils.degrees_to_radians", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.851296}, "macro.dbt_utils.haversine_distance": {"unique_id": "macro.dbt_utils.haversine_distance", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.8519459}, "macro.dbt_utils.default__haversine_distance": {"unique_id": "macro.dbt_utils.default__haversine_distance", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.853291}, "macro.dbt_utils.bigquery__haversine_distance": {"unique_id": "macro.dbt_utils.bigquery__haversine_distance", "package_name": "dbt_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.85525}, "macro.fivetran_utils.enabled_vars": {"unique_id": "macro.fivetran_utils.enabled_vars", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.856305}, "macro.fivetran_utils.percentile": {"unique_id": "macro.fivetran_utils.percentile", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.8582458}, "macro.fivetran_utils.default__percentile": {"unique_id": "macro.fivetran_utils.default__percentile", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.858635}, "macro.fivetran_utils.redshift__percentile": {"unique_id": "macro.fivetran_utils.redshift__percentile", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.859021}, "macro.fivetran_utils.bigquery__percentile": {"unique_id": "macro.fivetran_utils.bigquery__percentile", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.859406}, "macro.fivetran_utils.postgres__percentile": {"unique_id": "macro.fivetran_utils.postgres__percentile", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.8598242}, "macro.fivetran_utils.spark__percentile": {"unique_id": "macro.fivetran_utils.spark__percentile", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.86021}, "macro.fivetran_utils.pivot_json_extract": {"unique_id": "macro.fivetran_utils.pivot_json_extract", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.8613288}, "macro.fivetran_utils.persist_pass_through_columns": {"unique_id": "macro.fivetran_utils.persist_pass_through_columns", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.862352}, "macro.fivetran_utils.json_parse": {"unique_id": "macro.fivetran_utils.json_parse", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.864919}, "macro.fivetran_utils.default__json_parse": {"unique_id": "macro.fivetran_utils.default__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.865522}, "macro.fivetran_utils.redshift__json_parse": {"unique_id": "macro.fivetran_utils.redshift__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.866229}, "macro.fivetran_utils.bigquery__json_parse": {"unique_id": "macro.fivetran_utils.bigquery__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.866799}, "macro.fivetran_utils.postgres__json_parse": {"unique_id": "macro.fivetran_utils.postgres__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.8676522}, "macro.fivetran_utils.snowflake__json_parse": {"unique_id": "macro.fivetran_utils.snowflake__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.868403}, "macro.fivetran_utils.spark__json_parse": {"unique_id": "macro.fivetran_utils.spark__json_parse", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.8694751}, "macro.fivetran_utils.max_bool": {"unique_id": "macro.fivetran_utils.max_bool", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.870502}, "macro.fivetran_utils.default__max_bool": {"unique_id": "macro.fivetran_utils.default__max_bool", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.8707561}, "macro.fivetran_utils.snowflake__max_bool": {"unique_id": "macro.fivetran_utils.snowflake__max_bool", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.871038}, "macro.fivetran_utils.bigquery__max_bool": {"unique_id": "macro.fivetran_utils.bigquery__max_bool", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.871383}, "macro.fivetran_utils.calculated_fields": {"unique_id": "macro.fivetran_utils.calculated_fields", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.8723981}, "macro.fivetran_utils.seed_data_helper": {"unique_id": "macro.fivetran_utils.seed_data_helper", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.873845}, "macro.fivetran_utils.fill_pass_through_columns": {"unique_id": "macro.fivetran_utils.fill_pass_through_columns", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.875436}, "macro.fivetran_utils.string_agg": {"unique_id": "macro.fivetran_utils.string_agg", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.876522}, "macro.fivetran_utils.default__string_agg": {"unique_id": "macro.fivetran_utils.default__string_agg", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.876841}, "macro.fivetran_utils.snowflake__string_agg": {"unique_id": "macro.fivetran_utils.snowflake__string_agg", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.877153}, "macro.fivetran_utils.redshift__string_agg": {"unique_id": "macro.fivetran_utils.redshift__string_agg", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.877462}, "macro.fivetran_utils.spark__string_agg": {"unique_id": "macro.fivetran_utils.spark__string_agg", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.877783}, "macro.fivetran_utils.timestamp_diff": {"unique_id": "macro.fivetran_utils.timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.883262}, "macro.fivetran_utils.default__timestamp_diff": {"unique_id": "macro.fivetran_utils.default__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.883699}, "macro.fivetran_utils.redshift__timestamp_diff": {"unique_id": "macro.fivetran_utils.redshift__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.884085}, "macro.fivetran_utils.bigquery__timestamp_diff": {"unique_id": "macro.fivetran_utils.bigquery__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.8844612}, "macro.fivetran_utils.postgres__timestamp_diff": {"unique_id": "macro.fivetran_utils.postgres__timestamp_diff", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.8888571}, "macro.fivetran_utils.generate_columns_macro": {"unique_id": "macro.fivetran_utils.generate_columns_macro", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.892195}, "macro.fivetran_utils.source_relation": {"unique_id": "macro.fivetran_utils.source_relation", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.893492}, "macro.fivetran_utils.default__source_relation": {"unique_id": "macro.fivetran_utils.default__source_relation", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.8949592}, "macro.fivetran_utils.first_value": {"unique_id": "macro.fivetran_utils.first_value", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.8962739}, "macro.fivetran_utils.default__first_value": {"unique_id": "macro.fivetran_utils.default__first_value", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.896765}, "macro.fivetran_utils.redshift__first_value": {"unique_id": "macro.fivetran_utils.redshift__first_value", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.897299}, "macro.fivetran_utils.add_dbt_source_relation": {"unique_id": "macro.fivetran_utils.add_dbt_source_relation", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.898046}, "macro.fivetran_utils.add_pass_through_columns": {"unique_id": "macro.fivetran_utils.add_pass_through_columns", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.900322}, "macro.fivetran_utils.staging_models_automation": {"unique_id": "macro.fivetran_utils.staging_models_automation", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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_columns = \"source dbt_packages/fivetran_utils/generate_columns.sh '../dbt_\"\"\"~ package ~\"\"\"_source' stg_\"\"\"~ package ~\"\"\" \"\"\"~ source_database ~\"\"\" \"\"\"~ source_schema ~\"\"\" \" %}\n{% set zsh_command_models = \"source dbt_packages/fivetran_utils/generate_models.sh '../dbt_\"\"\"~ package ~\"\"\"_source' stg_\"\"\"~ package ~\"\"\" \"\"\"~ source_database ~\"\"\" \"\"\"~ source_schema ~\"\"\" \" %}\n\n{%- set columns_array = [] -%}\n{%- set models_array = [] -%}\n\n{% for t in tables %}\n {% set help_command = zsh_command_columns + t %}\n {{ columns_array.append(help_command) }}\n\n {% set help_command = zsh_command_models + t %}\n {{ models_array.append(help_command) }}\n\n{% endfor %}\n\n{{ log(columns_array|join(' && \\n') + ' && \\n' + models_array|join(' && \\n'), info=True) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": []}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644618835.903917}, "macro.fivetran_utils.union_relations": {"unique_id": "macro.fivetran_utils.union_relations", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.913155}, "macro.fivetran_utils.union_tables": {"unique_id": "macro.fivetran_utils.union_tables", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.91404}, "macro.fivetran_utils.snowflake_seed_data": {"unique_id": "macro.fivetran_utils.snowflake_seed_data", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.915138}, "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/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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) like '%num%' 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": 1644618835.917493}, "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/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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) like '%num%' 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": 1644618835.9185941}, "macro.fivetran_utils.get_columns_for_macro": {"unique_id": "macro.fivetran_utils.get_columns_for_macro", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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.bigquery__get_columns_for_macro"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644618835.919103}, "macro.fivetran_utils.fill_staging_columns": {"unique_id": "macro.fivetran_utils.fill_staging_columns", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.922633}, "macro.fivetran_utils.quote_column": {"unique_id": "macro.fivetran_utils.quote_column", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.9239838}, "macro.fivetran_utils.json_extract": {"unique_id": "macro.fivetran_utils.json_extract", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.9252942}, "macro.fivetran_utils.default__json_extract": {"unique_id": "macro.fivetran_utils.default__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.925728}, "macro.fivetran_utils.snowflake__json_extract": {"unique_id": "macro.fivetran_utils.snowflake__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.926095}, "macro.fivetran_utils.redshift__json_extract": {"unique_id": "macro.fivetran_utils.redshift__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.926629}, "macro.fivetran_utils.bigquery__json_extract": {"unique_id": "macro.fivetran_utils.bigquery__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.926996}, "macro.fivetran_utils.postgres__json_extract": {"unique_id": "macro.fivetran_utils.postgres__json_extract", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.927362}, "macro.fivetran_utils.collect_freshness": {"unique_id": "macro.fivetran_utils.collect_freshness", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.9288802}, "macro.fivetran_utils.default__collect_freshness": {"unique_id": "macro.fivetran_utils.default__collect_freshness", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.931215}, "macro.fivetran_utils.timestamp_add": {"unique_id": "macro.fivetran_utils.timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.932777}, "macro.fivetran_utils.default__timestamp_add": {"unique_id": "macro.fivetran_utils.default__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.933362}, "macro.fivetran_utils.bigquery__timestamp_add": {"unique_id": "macro.fivetran_utils.bigquery__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.933876}, "macro.fivetran_utils.redshift__timestamp_add": {"unique_id": "macro.fivetran_utils.redshift__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.934268}, "macro.fivetran_utils.postgres__timestamp_add": {"unique_id": "macro.fivetran_utils.postgres__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.9346502}, "macro.fivetran_utils.spark__timestamp_add": {"unique_id": "macro.fivetran_utils.spark__timestamp_add", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.9351392}, "macro.fivetran_utils.ceiling": {"unique_id": "macro.fivetran_utils.ceiling", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.9358919}, "macro.fivetran_utils.default__ceiling": {"unique_id": "macro.fivetran_utils.default__ceiling", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.9364932}, "macro.fivetran_utils.snowflake__ceiling": {"unique_id": "macro.fivetran_utils.snowflake__ceiling", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.936741}, "macro.fivetran_utils.remove_prefix_from_columns": {"unique_id": "macro.fivetran_utils.remove_prefix_from_columns", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.938533}, "macro.fivetran_utils.union_data": {"unique_id": "macro.fivetran_utils.union_data", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.941236}, "macro.fivetran_utils.default__union_data": {"unique_id": "macro.fivetran_utils.default__union_data", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.946049}, "macro.fivetran_utils.dummy_coalesce_value": {"unique_id": "macro.fivetran_utils.dummy_coalesce_value", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.949507}, "macro.fivetran_utils.array_agg": {"unique_id": "macro.fivetran_utils.array_agg", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.950325}, "macro.fivetran_utils.default__array_agg": {"unique_id": "macro.fivetran_utils.default__array_agg", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.950582}, "macro.fivetran_utils.redshift__array_agg": {"unique_id": "macro.fivetran_utils.redshift__array_agg", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.950834}, "macro.fivetran_utils.empty_variable_warning": {"unique_id": "macro.fivetran_utils.empty_variable_warning", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.951895}, "macro.fivetran_utils.enabled_vars_one_true": {"unique_id": "macro.fivetran_utils.enabled_vars_one_true", "package_name": "fivetran_utils", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/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": 1644618835.95296}, "macro.zendesk_source.get_domain_name_columns": {"unique_id": "macro.zendesk_source.get_domain_name_columns", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "macros/get_domain_name_columns.sql", "original_file_path": "macros/get_domain_name_columns.sql", "name": "get_domain_name_columns", "macro_sql": "{% macro get_domain_name_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"domain_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"index\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"organization_id\", \"datatype\": dbt_utils.type_int()}\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_int"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644618835.95451}, "macro.zendesk_source.get_user_tag_columns": {"unique_id": "macro.zendesk_source.get_user_tag_columns", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "macros/get_user_tag_columns.sql", "original_file_path": "macros/get_user_tag_columns.sql", "name": "get_user_tag_columns", "macro_sql": "{% macro get_user_tag_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"user_id\", \"datatype\": dbt_utils.type_int()}\n] %}\n\n{% if target.type == 'redshift' %}\n {{ columns.append( {\"name\": \"tag\", \"datatype\": dbt_utils.type_string(), \"quote\": True } ) }}\n\n{% elif target.type == 'snowflake' %}\n {{ columns.append( {\"name\": \"TAG\", \"datatype\": dbt_utils.type_string(), \"quote\": True } ) }}\n\n{% else %}\n {{ columns.append( {\"name\": \"tag\", \"datatype\": dbt_utils.type_string()} ) }}\n\n{% endif %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_int", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644618835.957098}, "macro.zendesk_source.get_ticket_form_history_columns": {"unique_id": "macro.zendesk_source.get_ticket_form_history_columns", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "macros/get_ticket_form_history_columns.sql", "original_file_path": "macros/get_ticket_form_history_columns.sql", "name": "get_ticket_form_history_columns", "macro_sql": "{% macro get_ticket_form_history_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_deleted\", \"datatype\": \"boolean\"},\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"active\", \"datatype\": \"boolean\"},\n {\"name\": \"created_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"display_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"end_user_visible\", \"datatype\": \"boolean\"},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"name\", \"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_string", "macro.dbt_utils.type_int"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644618835.9596438}, "macro.zendesk_source.get_schedule_columns": {"unique_id": "macro.zendesk_source.get_schedule_columns", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "macros/get_schedule_columns.sql", "original_file_path": "macros/get_schedule_columns.sql", "name": "get_schedule_columns", "macro_sql": "{% macro get_schedule_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_deleted\", \"datatype\": \"boolean\"},\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"created_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"end_time\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"end_time_utc\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"start_time\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"start_time_utc\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"time_zone\", \"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_int", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644618835.962433}, "macro.zendesk_source.get_daylight_time_columns": {"unique_id": "macro.zendesk_source.get_daylight_time_columns", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "macros/get_daylight_time_columns.sql", "original_file_path": "macros/get_daylight_time_columns.sql", "name": "get_daylight_time_columns", "macro_sql": "{% macro get_daylight_time_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"daylight_end_utc\", \"datatype\": \"datetime\"},\n {\"name\": \"daylight_offset\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"daylight_start_utc\", \"datatype\": \"datetime\"},\n {\"name\": \"time_zone\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"year\", \"datatype\": dbt_utils.type_int()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_int", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644618835.9643729}, "macro.zendesk_source.get_time_zone_columns": {"unique_id": "macro.zendesk_source.get_time_zone_columns", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "macros/get_time_zone_columns.sql", "original_file_path": "macros/get_time_zone_columns.sql", "name": "get_time_zone_columns", "macro_sql": "{% macro get_time_zone_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"standard_offset\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"time_zone\", \"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"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644618835.965672}, "macro.zendesk_source.get_ticket_tag_columns": {"unique_id": "macro.zendesk_source.get_ticket_tag_columns", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "macros/get_ticket_tag_columns.sql", "original_file_path": "macros/get_ticket_tag_columns.sql", "name": "get_ticket_tag_columns", "macro_sql": "{% macro get_ticket_tag_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"ticket_id\", \"datatype\": dbt_utils.type_int()}\n] %}\n\n{% if target.type == 'redshift' %}\n {{ columns.append( {\"name\": \"tag\", \"datatype\": dbt_utils.type_string(), \"quote\": True } ) }}\n\n{% elif target.type == 'snowflake' %}\n {{ columns.append( {\"name\": \"TAG\", \"datatype\": dbt_utils.type_string(), \"quote\": True } ) }}\n\n{% else %}\n {{ columns.append( {\"name\": \"tag\", \"datatype\": dbt_utils.type_string()} ) }}\n\n{% endif %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_int", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644618835.9686432}, "macro.zendesk_source.get_organization_tag_columns": {"unique_id": "macro.zendesk_source.get_organization_tag_columns", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "macros/get_organization_tag_columns.sql", "original_file_path": "macros/get_organization_tag_columns.sql", "name": "get_organization_tag_columns", "macro_sql": "{% macro get_organization_tag_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"organization_id\", \"datatype\": dbt_utils.type_int()}\n] %}\n\n{% if target.type == 'redshift' %}\n {{ columns.append( {\"name\": \"tag\", \"datatype\": dbt_utils.type_string(), \"quote\": True } ) }}\n\n{% elif target.type == 'snowflake' %}\n {{ columns.append( {\"name\": \"TAG\", \"datatype\": dbt_utils.type_string(), \"quote\": True } ) }}\n\n{% else %}\n {{ columns.append( {\"name\": \"tag\", \"datatype\": dbt_utils.type_string()} ) }}\n\n{% endif %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_int", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644618835.971256}, "macro.zendesk_source.get_group_columns": {"unique_id": "macro.zendesk_source.get_group_columns", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "macros/get_group_columns.sql", "original_file_path": "macros/get_group_columns.sql", "name": "get_group_columns", "macro_sql": "{% macro get_group_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_deleted\", \"datatype\": \"boolean\"},\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"created_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"updated_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"url\", \"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_int", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644618835.973331}, "macro.zendesk_source.get_user_columns": {"unique_id": "macro.zendesk_source.get_user_columns", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "macros/get_user_columns.sql", "original_file_path": "macros/get_user_columns.sql", "name": "get_user_columns", "macro_sql": "{% macro get_user_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"active\", \"datatype\": \"boolean\"},\n {\"name\": \"alias\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"authenticity_token\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"chat_only\", \"datatype\": \"boolean\"},\n {\"name\": \"created_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"details\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"email\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"external_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"last_login_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"locale\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"locale_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"moderator\", \"datatype\": \"boolean\"},\n {\"name\": \"name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"notes\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"only_private_comments\", \"datatype\": \"boolean\"},\n {\"name\": \"organization_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"phone\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"remote_photo_url\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"restricted_agent\", \"datatype\": \"boolean\"},\n {\"name\": \"role\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"shared\", \"datatype\": \"boolean\"},\n {\"name\": \"shared_agent\", \"datatype\": \"boolean\"},\n {\"name\": \"signature\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"suspended\", \"datatype\": \"boolean\"},\n {\"name\": \"ticket_restriction\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"time_zone\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"two_factor_auth_enabled\", \"datatype\": \"boolean\"},\n {\"name\": \"updated_at\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"verified\", \"datatype\": \"boolean\"}\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_int"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644618835.981199}, "macro.zendesk_source.get_ticket_columns": {"unique_id": "macro.zendesk_source.get_ticket_columns", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "macros/get_ticket_columns.sql", "original_file_path": "macros/get_ticket_columns.sql", "name": "get_ticket_columns", "macro_sql": "{% macro get_ticket_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"allow_channelback\", \"datatype\": \"boolean\"},\n {\"name\": \"assignee_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"brand_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"created_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"description\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"due_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"external_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"forum_topic_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"group_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"has_incidents\", \"datatype\": \"boolean\"},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"is_public\", \"datatype\": \"boolean\"},\n {\"name\": \"merged_ticket_ids\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"organization_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"priority\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"problem_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"recipient\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"requester_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"status\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"subject\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"submitter_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"system_ccs\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"system_client\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"system_ip_address\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"system_json_email_identifier\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"system_latitude\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"system_location\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"system_longitude\", \"datatype\": dbt_utils.type_float()},\n {\"name\": \"system_machine_generated\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"system_message_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"system_raw_email_identifier\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"ticket_form_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"updated_at\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"via_channel\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"via_source_from_address\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"via_source_from_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"via_source_from_title\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"via_source_rel\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"via_source_to_address\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"via_source_to_name\", \"datatype\": dbt_utils.type_int()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_int", "macro.dbt_utils.type_string", "macro.dbt_utils.type_float"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644618835.9921842}, "macro.zendesk_source.get_ticket_field_history_columns": {"unique_id": "macro.zendesk_source.get_ticket_field_history_columns", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "macros/get_ticket_field_history_columns.sql", "original_file_path": "macros/get_ticket_field_history_columns.sql", "name": "get_ticket_field_history_columns", "macro_sql": "{% macro get_ticket_field_history_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"field_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"ticket_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"updated\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"user_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"value\", \"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_int"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644618835.994273}, "macro.zendesk_source.get_ticket_schedule_columns": {"unique_id": "macro.zendesk_source.get_ticket_schedule_columns", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "macros/get_ticket_schedule_columns.sql", "original_file_path": "macros/get_ticket_schedule_columns.sql", "name": "get_ticket_schedule_columns", "macro_sql": "{% macro get_ticket_schedule_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"created_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"schedule_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"ticket_id\", \"datatype\": dbt_utils.type_int()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_timestamp", "macro.dbt_utils.type_int"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644618835.995784}, "macro.zendesk_source.get_organization_columns": {"unique_id": "macro.zendesk_source.get_organization_columns", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "macros/get_organization_columns.sql", "original_file_path": "macros/get_organization_columns.sql", "name": "get_organization_columns", "macro_sql": "{% macro get_organization_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"created_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"details\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"external_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"group_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"notes\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"shared_comments\", \"datatype\": \"boolean\"},\n {\"name\": \"shared_tickets\", \"datatype\": \"boolean\"},\n {\"name\": \"updated_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"url\", \"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_int", "macro.dbt_utils.type_string"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644618835.999052}, "macro.zendesk_source.get_ticket_comment_columns": {"unique_id": "macro.zendesk_source.get_ticket_comment_columns", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "macros/get_ticket_comment_columns.sql", "original_file_path": "macros/get_ticket_comment_columns.sql", "name": "get_ticket_comment_columns", "macro_sql": "{% macro get_ticket_comment_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"body\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"call_duration\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"call_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"created\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"facebook_comment\", \"datatype\": \"boolean\"},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"location\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"public\", \"datatype\": \"boolean\"},\n {\"name\": \"recording_url\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"started_at\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"ticket_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"transcription_status\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"transcription_text\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"trusted\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"tweet\", \"datatype\": \"boolean\"},\n {\"name\": \"user_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"voice_comment\", \"datatype\": \"boolean\"},\n {\"name\": \"voice_comment_transcription_visible\", \"datatype\": dbt_utils.type_int()}\n] %}\n\n{{ return(columns) }}\n\n{% endmacro %}", "resource_type": "macro", "tags": [], "depends_on": {"macros": ["macro.dbt_utils.type_string", "macro.dbt_utils.type_int", "macro.dbt_utils.type_timestamp"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644618836.004949}, "macro.zendesk_source.get_brand_columns": {"unique_id": "macro.zendesk_source.get_brand_columns", "package_name": "zendesk_source", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev/dbt_packages/zendesk_source", "path": "macros/get_brand_columns.sql", "original_file_path": "macros/get_brand_columns.sql", "name": "get_brand_columns", "macro_sql": "{% macro get_brand_columns() %}\n\n{% set columns = [\n {\"name\": \"_fivetran_deleted\", \"datatype\": \"boolean\"},\n {\"name\": \"_fivetran_synced\", \"datatype\": dbt_utils.type_timestamp()},\n {\"name\": \"active\", \"datatype\": \"boolean\"},\n {\"name\": \"brand_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"has_help_center\", \"datatype\": \"boolean\"},\n {\"name\": \"help_center_state\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"logo_content_type\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"logo_content_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"logo_deleted\", \"datatype\": \"boolean\"},\n {\"name\": \"logo_file_name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"logo_height\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"logo_id\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"logo_inline\", \"datatype\": \"boolean\"},\n {\"name\": \"logo_mapped_content_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"logo_size\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"logo_url\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"logo_width\", \"datatype\": dbt_utils.type_int()},\n {\"name\": \"name\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"subdomain\", \"datatype\": dbt_utils.type_string()},\n {\"name\": \"url\", \"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_int"]}, "description": "", "meta": {}, "docs": {"show": true}, "patch_path": null, "arguments": [], "created_at": 1644618836.0107388}}, "docs": {"dbt.__overview__": {"unique_id": "dbt.__overview__", "package_name": "dbt", "root_path": "/Users/jamie.rodriguez/.pyenv/versions/3.8.9/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/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": {"model.jamie_dbt_dev.opportunity": [{"raw_sql": "{{ config(enabled=false) }}\n\nwith blank as (\nselect *\nfrom {{ ref('zendesk__ticket_metrics') }}\n)\nselect *\nfrom blank\nlimit 1000", "resource_type": "model", "depends_on": {"macros": [], "nodes": []}, "config": {"enabled": false, "alias": null, "schema": null, "database": null, "tags": [], "meta": {}, "materialized": "view", "persist_docs": {}, "quoting": {}, "column_types": {}, "full_refresh": null, "on_schema_change": "ignore", "post-hook": [], "pre-hook": []}, "database": "dbt-package-testing", "schema": "dbt", "fqn": ["jamie_dbt_dev", "opportunity"], "unique_id": "model.jamie_dbt_dev.opportunity", "package_name": "jamie_dbt_dev", "root_path": "/Users/jamie.rodriguez/Documents/github_repos/jamie_dbt_dev", "path": "opportunity.sql", "original_file_path": "models/opportunity.sql", "name": "opportunity", "alias": "opportunity", "checksum": {"name": "sha256", "checksum": "b29281e622ed44c001f88dcc5a38375dc49b3b8c57fd379970b3be0f84c47f57"}, "tags": [], "refs": [["zendesk__ticket_metrics"]], "sources": [], "description": "", "columns": {}, "meta": {}, "docs": {"show": true}, "patch_path": null, "compiled_path": null, "build_path": null, "deferred": false, "unrendered_config": {"enabled": false}, "created_at": 1644618836.526263}]}, "parent_map": {"model.zendesk.zendesk__ticket_enriched": ["model.zendesk.int_zendesk__assignee_updates", "model.zendesk.int_zendesk__latest_ticket_form", "model.zendesk.int_zendesk__organization_aggregates", "model.zendesk.int_zendesk__requester_updates", "model.zendesk.int_zendesk__ticket_aggregates", "model.zendesk.int_zendesk__ticket_historical_satisfaction", "model.zendesk.int_zendesk__user_aggregates", "model.zendesk_source.stg_zendesk__group"], "model.zendesk.zendesk__ticket_metrics": ["model.zendesk.int_zendesk__comment_metrics", "model.zendesk.int_zendesk__ticket_first_reply_time_business", "model.zendesk.int_zendesk__ticket_first_resolution_time_business", "model.zendesk.int_zendesk__ticket_full_resolution_time_business", "model.zendesk.int_zendesk__ticket_reply_times_calendar", "model.zendesk.int_zendesk__ticket_resolution_times_calendar", "model.zendesk.int_zendesk__ticket_work_time_business", "model.zendesk.int_zendesk__ticket_work_time_calendar", "model.zendesk.zendesk__ticket_enriched"], "model.zendesk.zendesk__ticket_summary": ["model.zendesk.zendesk__ticket_metrics", "model.zendesk_source.stg_zendesk__user"], "model.zendesk.zendesk__ticket_field_history": ["model.zendesk.int_zendesk__field_calendar_spine", "model.zendesk.int_zendesk__field_history_scd", "model.zendesk.int_zendesk__field_history_scd"], "model.zendesk.zendesk__sla_policies": ["model.zendesk.int_zendesk__agent_work_time_business_hours", "model.zendesk.int_zendesk__agent_work_time_calendar_hours", "model.zendesk.int_zendesk__reply_time_combined", "model.zendesk.int_zendesk__requester_wait_time_business_hours", "model.zendesk.int_zendesk__requester_wait_time_calendar_hours"], "model.zendesk.zendesk__ticket_backlog": ["model.zendesk.zendesk__ticket_field_history", "model.zendesk_source.stg_zendesk__brand", "model.zendesk_source.stg_zendesk__group", "model.zendesk_source.stg_zendesk__organization", "model.zendesk_source.stg_zendesk__ticket", "model.zendesk_source.stg_zendesk__user"], "model.zendesk.int_zendesk__sla_policy_applied": ["model.zendesk.int_zendesk__ticket_aggregates", "model.zendesk.int_zendesk__updates", "model.zendesk.int_zendesk__updates"], "model.zendesk.int_zendesk__agent_work_time_business_hours": ["model.zendesk.int_zendesk__agent_work_time_filtered_statuses", "model.zendesk.int_zendesk__schedule_spine", "model.zendesk.int_zendesk__ticket_schedules"], "model.zendesk.int_zendesk__agent_work_time_calendar_hours": ["model.zendesk.int_zendesk__agent_work_time_filtered_statuses"], "model.zendesk.int_zendesk__agent_work_time_filtered_statuses": ["model.zendesk.int_zendesk__sla_policy_applied", "model.zendesk.int_zendesk__ticket_historical_status"], "model.zendesk.int_zendesk__reply_time_business_hours": ["model.zendesk.int_zendesk__schedule_spine", "model.zendesk.int_zendesk__sla_policy_applied", "model.zendesk.int_zendesk__ticket_schedules", "model.zendesk_source.stg_zendesk__schedule"], "model.zendesk.int_zendesk__reply_time_calendar_hours": ["model.zendesk.int_zendesk__sla_policy_applied"], "model.zendesk.int_zendesk__reply_time_combined": ["model.zendesk.int_zendesk__reply_time_business_hours", "model.zendesk.int_zendesk__reply_time_calendar_hours", "model.zendesk.int_zendesk__updates", "model.zendesk.int_zendesk__user_aggregates"], "model.zendesk.int_zendesk__requester_wait_time_calendar_hours": ["model.zendesk.int_zendesk__requester_wait_time_filtered_statuses"], "model.zendesk.int_zendesk__requester_wait_time_business_hours": ["model.zendesk.int_zendesk__requester_wait_time_filtered_statuses", "model.zendesk.int_zendesk__schedule_spine", "model.zendesk.int_zendesk__ticket_schedules"], "model.zendesk.int_zendesk__requester_wait_time_filtered_statuses": ["model.zendesk.int_zendesk__sla_policy_applied", "model.zendesk.int_zendesk__ticket_historical_status"], "model.zendesk.int_zendesk__ticket_reply_times": ["model.zendesk.int_zendesk__comments_enriched"], "model.zendesk.int_zendesk__ticket_reply_times_calendar": ["model.zendesk.int_zendesk__ticket_reply_times", "model.zendesk_source.stg_zendesk__ticket"], "model.zendesk.int_zendesk__comments_enriched": ["model.zendesk.int_zendesk__updates", "model.zendesk_source.stg_zendesk__user"], "model.zendesk.int_zendesk__ticket_first_reply_time_business": ["model.zendesk.int_zendesk__schedule_spine", "model.zendesk.int_zendesk__ticket_reply_times", "model.zendesk.int_zendesk__ticket_schedules"], "model.zendesk.int_zendesk__field_history_enriched": ["model.zendesk.int_zendesk__updater_information", "model.zendesk_source.stg_zendesk__ticket_field_history"], "model.zendesk.int_zendesk__field_history_pivot": ["model.zendesk.int_zendesk__field_history_enriched", "model.zendesk_source.stg_zendesk__ticket_field_history"], "model.zendesk.int_zendesk__updater_information": ["model.zendesk.int_zendesk__organization_aggregates", "model.zendesk.int_zendesk__user_aggregates"], "model.zendesk.int_zendesk__field_history_scd": ["model.zendesk.int_zendesk__field_history_pivot", "model.zendesk.int_zendesk__field_history_pivot"], "model.zendesk.int_zendesk__field_calendar_spine": ["model.zendesk.int_zendesk__calendar_spine", "model.zendesk_source.stg_zendesk__ticket"], "model.zendesk.int_zendesk__ticket_work_time_calendar": ["model.zendesk.int_zendesk__ticket_historical_status"], "model.zendesk.int_zendesk__ticket_work_time_business": ["model.zendesk.int_zendesk__schedule_spine", "model.zendesk.int_zendesk__ticket_historical_status", "model.zendesk.int_zendesk__ticket_schedules"], "model.zendesk.int_zendesk__calendar_spine": ["model.zendesk_source.stg_zendesk__ticket"], "model.zendesk.int_zendesk__ticket_resolution_times_calendar": ["model.zendesk.int_zendesk__ticket_historical_assignee", "model.zendesk.int_zendesk__ticket_historical_group", "model.zendesk.int_zendesk__ticket_historical_status", "model.zendesk_source.stg_zendesk__ticket"], "model.zendesk.int_zendesk__ticket_first_resolution_time_business": ["model.zendesk.int_zendesk__schedule_spine", "model.zendesk.int_zendesk__ticket_resolution_times_calendar", "model.zendesk.int_zendesk__ticket_schedules"], "model.zendesk.int_zendesk__ticket_full_resolution_time_business": ["model.zendesk.int_zendesk__schedule_spine", "model.zendesk.int_zendesk__ticket_resolution_times_calendar", "model.zendesk.int_zendesk__ticket_schedules"], "model.zendesk.int_zendesk__updates": ["model.zendesk_source.stg_zendesk__ticket", "model.zendesk_source.stg_zendesk__ticket_comment", "model.zendesk_source.stg_zendesk__ticket_field_history"], "model.zendesk.int_zendesk__ticket_historical_assignee": ["model.zendesk.int_zendesk__updates"], "model.zendesk.int_zendesk__ticket_historical_status": ["model.zendesk.int_zendesk__updates"], "model.zendesk.int_zendesk__user_aggregates": ["model.zendesk_source.stg_zendesk__user", "model.zendesk_source.stg_zendesk__user_tag"], "model.zendesk.int_zendesk__schedule_spine": ["model.zendesk_source.stg_zendesk__daylight_time", "model.zendesk_source.stg_zendesk__schedule", "model.zendesk_source.stg_zendesk__time_zone"], "model.zendesk.int_zendesk__ticket_schedules": ["model.zendesk_source.stg_zendesk__schedule", "model.zendesk_source.stg_zendesk__ticket", "model.zendesk_source.stg_zendesk__ticket_schedule"], "model.zendesk.int_zendesk__assignee_updates": ["model.zendesk.int_zendesk__updates", "model.zendesk_source.stg_zendesk__ticket"], "model.zendesk.int_zendesk__comment_metrics": ["model.zendesk.int_zendesk__comments_enriched"], "model.zendesk.int_zendesk__ticket_historical_group": ["model.zendesk.int_zendesk__updates"], "model.zendesk.int_zendesk__requester_updates": ["model.zendesk.int_zendesk__updates", "model.zendesk_source.stg_zendesk__ticket"], "model.zendesk.int_zendesk__ticket_historical_satisfaction": ["model.zendesk.int_zendesk__updates"], "model.zendesk.int_zendesk__latest_ticket_form": ["model.zendesk_source.stg_zendesk__ticket_form_history"], "model.zendesk.int_zendesk__ticket_aggregates": ["model.zendesk_source.stg_zendesk__brand", "model.zendesk_source.stg_zendesk__ticket", "model.zendesk_source.stg_zendesk__ticket_tag"], "model.zendesk.int_zendesk__organization_aggregates": ["model.zendesk_source.stg_zendesk__domain_name", "model.zendesk_source.stg_zendesk__organization", "model.zendesk_source.stg_zendesk__organization_tag"], "operation.zendesk.zendesk-on-run-start-0": [], "model.zendesk_source.stg_zendesk__user_tag": ["model.zendesk_source.stg_zendesk__user_tag_tmp", "model.zendesk_source.stg_zendesk__user_tag_tmp"], "model.zendesk_source.stg_zendesk__ticket_tag": ["model.zendesk_source.stg_zendesk__ticket_tag_tmp", "model.zendesk_source.stg_zendesk__ticket_tag_tmp"], "model.zendesk_source.stg_zendesk__ticket_field_history": ["model.zendesk_source.stg_zendesk__ticket_field_history_tmp", "model.zendesk_source.stg_zendesk__ticket_field_history_tmp"], "model.zendesk_source.stg_zendesk__daylight_time": ["model.zendesk_source.stg_zendesk__daylight_time_tmp", "model.zendesk_source.stg_zendesk__daylight_time_tmp"], "model.zendesk_source.stg_zendesk__organization": ["model.zendesk_source.stg_zendesk__organization_tmp", "model.zendesk_source.stg_zendesk__organization_tmp"], "model.zendesk_source.stg_zendesk__time_zone": ["model.zendesk_source.stg_zendesk__time_zone_tmp", "model.zendesk_source.stg_zendesk__time_zone_tmp"], "model.zendesk_source.stg_zendesk__group": ["model.zendesk_source.stg_zendesk__group_tmp", "model.zendesk_source.stg_zendesk__group_tmp"], "model.zendesk_source.stg_zendesk__ticket_comment": ["model.zendesk_source.stg_zendesk__ticket_comment_tmp", "model.zendesk_source.stg_zendesk__ticket_comment_tmp"], "model.zendesk_source.stg_zendesk__ticket_schedule": ["model.zendesk_source.stg_zendesk__ticket_schedule_tmp", "model.zendesk_source.stg_zendesk__ticket_schedule_tmp"], "model.zendesk_source.stg_zendesk__schedule": ["model.zendesk_source.stg_zendesk__schedule_tmp", "model.zendesk_source.stg_zendesk__schedule_tmp"], "model.zendesk_source.stg_zendesk__user": ["model.zendesk_source.stg_zendesk__user_tmp", "model.zendesk_source.stg_zendesk__user_tmp"], "model.zendesk_source.stg_zendesk__brand": ["model.zendesk_source.stg_zendesk__brand_tmp", "model.zendesk_source.stg_zendesk__brand_tmp"], "model.zendesk_source.stg_zendesk__ticket_form_history": ["model.zendesk_source.stg_zendesk__ticket_form_history_tmp", "model.zendesk_source.stg_zendesk__ticket_form_history_tmp"], "model.zendesk_source.stg_zendesk__domain_name": ["model.zendesk_source.stg_zendesk__domain_name_tmp", "model.zendesk_source.stg_zendesk__domain_name_tmp"], "model.zendesk_source.stg_zendesk__organization_tag": ["model.zendesk_source.stg_zendesk__organization_tag_tmp", "model.zendesk_source.stg_zendesk__organization_tag_tmp"], "model.zendesk_source.stg_zendesk__ticket": ["model.zendesk_source.stg_zendesk__ticket_tmp", "model.zendesk_source.stg_zendesk__ticket_tmp"], "model.zendesk_source.stg_zendesk__daylight_time_tmp": ["source.zendesk_source.zendesk.daylight_time"], "model.zendesk_source.stg_zendesk__user_tmp": ["source.zendesk_source.zendesk.user"], "model.zendesk_source.stg_zendesk__group_tmp": ["source.zendesk_source.zendesk.group"], "model.zendesk_source.stg_zendesk__ticket_tmp": ["source.zendesk_source.zendesk.ticket"], "model.zendesk_source.stg_zendesk__brand_tmp": ["source.zendesk_source.zendesk.brand"], "model.zendesk_source.stg_zendesk__ticket_tag_tmp": ["source.zendesk_source.zendesk.ticket_tag"], "model.zendesk_source.stg_zendesk__user_tag_tmp": ["source.zendesk_source.zendesk.user_tag"], "model.zendesk_source.stg_zendesk__ticket_field_history_tmp": ["source.zendesk_source.zendesk.ticket_field_history"], "model.zendesk_source.stg_zendesk__ticket_form_history_tmp": ["source.zendesk_source.zendesk.ticket_form_history"], "model.zendesk_source.stg_zendesk__ticket_comment_tmp": ["source.zendesk_source.zendesk.ticket_comment"], "model.zendesk_source.stg_zendesk__organization_tag_tmp": ["source.zendesk_source.zendesk.organization_tag"], "model.zendesk_source.stg_zendesk__schedule_tmp": ["source.zendesk_source.zendesk.schedule"], "model.zendesk_source.stg_zendesk__organization_tmp": ["source.zendesk_source.zendesk.organization"], "model.zendesk_source.stg_zendesk__ticket_schedule_tmp": ["source.zendesk_source.zendesk.ticket_schedule", "source.zendesk_source.zendesk.ticket_schedule", "source.zendesk_source.zendesk.ticket_schedule"], "model.zendesk_source.stg_zendesk__domain_name_tmp": ["source.zendesk_source.zendesk.domain_name"], "model.zendesk_source.stg_zendesk__time_zone_tmp": ["source.zendesk_source.zendesk.time_zone"], "test.zendesk.unique_zendesk__ticket_enriched_ticket_id.7c3c6ca9ef": ["model.zendesk.zendesk__ticket_enriched"], "test.zendesk.not_null_zendesk__ticket_enriched_ticket_id.e3efc5bf0a": ["model.zendesk.zendesk__ticket_enriched"], "test.zendesk.unique_zendesk__sla_policies_sla_event_id.5daff4d2bd": ["model.zendesk.zendesk__sla_policies"], "test.zendesk.unique_zendesk__ticket_metrics_ticket_id.f3dc8eba5c": ["model.zendesk.zendesk__ticket_metrics"], "test.zendesk.not_null_zendesk__ticket_metrics_ticket_id.3466b76bbd": ["model.zendesk.zendesk__ticket_metrics"], "test.zendesk_source.unique_stg_zendesk__ticket_ticket_id.4be7124521": ["model.zendesk_source.stg_zendesk__ticket"], "test.zendesk_source.not_null_stg_zendesk__ticket_ticket_id.a8229e6981": ["model.zendesk_source.stg_zendesk__ticket"], "test.zendesk_source.unique_stg_zendesk__brand_brand_id.fdf8e23c9e": ["model.zendesk_source.stg_zendesk__brand"], "test.zendesk_source.not_null_stg_zendesk__brand_brand_id.a2419e1741": ["model.zendesk_source.stg_zendesk__brand"], "test.zendesk_source.not_null_stg_zendesk__domain_name_organization_id.a2b5ff8fd3": ["model.zendesk_source.stg_zendesk__domain_name"], "test.zendesk_source.unique_stg_zendesk__group_group_id.f0658dabcd": ["model.zendesk_source.stg_zendesk__group"], "test.zendesk_source.not_null_stg_zendesk__group_group_id.7659ed83ec": ["model.zendesk_source.stg_zendesk__group"], "test.zendesk_source.unique_stg_zendesk__organization_organization_id.152be1ab31": ["model.zendesk_source.stg_zendesk__organization"], "test.zendesk_source.not_null_stg_zendesk__organization_organization_id.de7b98c06a": ["model.zendesk_source.stg_zendesk__organization"], "test.zendesk_source.unique_stg_zendesk__ticket_comment_ticket_comment_id.ba353330cd": ["model.zendesk_source.stg_zendesk__ticket_comment"], "test.zendesk_source.not_null_stg_zendesk__ticket_comment_ticket_comment_id.b821f4a606": ["model.zendesk_source.stg_zendesk__ticket_comment"], "test.zendesk_source.unique_stg_zendesk__user_user_id.3d3e346b11": ["model.zendesk_source.stg_zendesk__user"], "test.zendesk_source.not_null_stg_zendesk__user_user_id.102d572926": ["model.zendesk_source.stg_zendesk__user"], "test.zendesk_source.not_null_stg_zendesk__ticket_form_history_ticket_form_id.1afe781a17": ["model.zendesk_source.stg_zendesk__ticket_form_history"], "test.zendesk_source.dbt_utils_unique_combination_of_columns_stg_zendesk__daylight_time_time_zone__year.88227aef3d": ["model.zendesk_source.stg_zendesk__daylight_time"], "test.zendesk_source.unique_stg_zendesk__time_zone_time_zone.67995adbaf": ["model.zendesk_source.stg_zendesk__time_zone"], "test.zendesk_source.not_null_stg_zendesk__time_zone_time_zone.b25b3452b1": ["model.zendesk_source.stg_zendesk__time_zone"], "source.zendesk_source.zendesk.ticket": [], "source.zendesk_source.zendesk.brand": [], "source.zendesk_source.zendesk.domain_name": [], "source.zendesk_source.zendesk.group": [], "source.zendesk_source.zendesk.organization_tag": [], "source.zendesk_source.zendesk.organization": [], "source.zendesk_source.zendesk.ticket_comment": [], "source.zendesk_source.zendesk.user_tag": [], "source.zendesk_source.zendesk.user": [], "source.zendesk_source.zendesk.schedule": [], "source.zendesk_source.zendesk.ticket_schedule": [], "source.zendesk_source.zendesk.ticket_form_history": [], "source.zendesk_source.zendesk.ticket_tag": [], "source.zendesk_source.zendesk.ticket_field_history": [], "source.zendesk_source.zendesk.daylight_time": [], "source.zendesk_source.zendesk.time_zone": []}, "child_map": {"model.zendesk.zendesk__ticket_enriched": ["model.zendesk.zendesk__ticket_metrics", "test.zendesk.not_null_zendesk__ticket_enriched_ticket_id.e3efc5bf0a", "test.zendesk.unique_zendesk__ticket_enriched_ticket_id.7c3c6ca9ef"], "model.zendesk.zendesk__ticket_metrics": ["model.zendesk.zendesk__ticket_summary", "test.zendesk.not_null_zendesk__ticket_metrics_ticket_id.3466b76bbd", "test.zendesk.unique_zendesk__ticket_metrics_ticket_id.f3dc8eba5c"], "model.zendesk.zendesk__ticket_summary": [], "model.zendesk.zendesk__ticket_field_history": ["model.zendesk.zendesk__ticket_backlog"], "model.zendesk.zendesk__sla_policies": ["test.zendesk.unique_zendesk__sla_policies_sla_event_id.5daff4d2bd"], "model.zendesk.zendesk__ticket_backlog": [], "model.zendesk.int_zendesk__sla_policy_applied": ["model.zendesk.int_zendesk__agent_work_time_filtered_statuses", "model.zendesk.int_zendesk__reply_time_business_hours", "model.zendesk.int_zendesk__reply_time_calendar_hours", "model.zendesk.int_zendesk__requester_wait_time_filtered_statuses"], "model.zendesk.int_zendesk__agent_work_time_business_hours": ["model.zendesk.zendesk__sla_policies"], "model.zendesk.int_zendesk__agent_work_time_calendar_hours": ["model.zendesk.zendesk__sla_policies"], "model.zendesk.int_zendesk__agent_work_time_filtered_statuses": ["model.zendesk.int_zendesk__agent_work_time_business_hours", "model.zendesk.int_zendesk__agent_work_time_calendar_hours"], "model.zendesk.int_zendesk__reply_time_business_hours": ["model.zendesk.int_zendesk__reply_time_combined"], "model.zendesk.int_zendesk__reply_time_calendar_hours": ["model.zendesk.int_zendesk__reply_time_combined"], "model.zendesk.int_zendesk__reply_time_combined": ["model.zendesk.zendesk__sla_policies"], "model.zendesk.int_zendesk__requester_wait_time_calendar_hours": ["model.zendesk.zendesk__sla_policies"], "model.zendesk.int_zendesk__requester_wait_time_business_hours": ["model.zendesk.zendesk__sla_policies"], "model.zendesk.int_zendesk__requester_wait_time_filtered_statuses": ["model.zendesk.int_zendesk__requester_wait_time_business_hours", "model.zendesk.int_zendesk__requester_wait_time_calendar_hours"], "model.zendesk.int_zendesk__ticket_reply_times": ["model.zendesk.int_zendesk__ticket_first_reply_time_business", "model.zendesk.int_zendesk__ticket_reply_times_calendar"], "model.zendesk.int_zendesk__ticket_reply_times_calendar": ["model.zendesk.zendesk__ticket_metrics"], "model.zendesk.int_zendesk__comments_enriched": ["model.zendesk.int_zendesk__comment_metrics", "model.zendesk.int_zendesk__ticket_reply_times"], "model.zendesk.int_zendesk__ticket_first_reply_time_business": ["model.zendesk.zendesk__ticket_metrics"], "model.zendesk.int_zendesk__field_history_enriched": ["model.zendesk.int_zendesk__field_history_pivot"], "model.zendesk.int_zendesk__field_history_pivot": ["model.zendesk.int_zendesk__field_history_scd", "model.zendesk.int_zendesk__field_history_scd"], "model.zendesk.int_zendesk__updater_information": ["model.zendesk.int_zendesk__field_history_enriched"], "model.zendesk.int_zendesk__field_history_scd": ["model.zendesk.zendesk__ticket_field_history", "model.zendesk.zendesk__ticket_field_history"], "model.zendesk.int_zendesk__field_calendar_spine": ["model.zendesk.zendesk__ticket_field_history"], "model.zendesk.int_zendesk__ticket_work_time_calendar": ["model.zendesk.zendesk__ticket_metrics"], "model.zendesk.int_zendesk__ticket_work_time_business": ["model.zendesk.zendesk__ticket_metrics"], "model.zendesk.int_zendesk__calendar_spine": ["model.zendesk.int_zendesk__field_calendar_spine"], "model.zendesk.int_zendesk__ticket_resolution_times_calendar": ["model.zendesk.int_zendesk__ticket_first_resolution_time_business", "model.zendesk.int_zendesk__ticket_full_resolution_time_business", "model.zendesk.zendesk__ticket_metrics"], "model.zendesk.int_zendesk__ticket_first_resolution_time_business": ["model.zendesk.zendesk__ticket_metrics"], "model.zendesk.int_zendesk__ticket_full_resolution_time_business": ["model.zendesk.zendesk__ticket_metrics"], "model.zendesk.int_zendesk__updates": ["model.zendesk.int_zendesk__assignee_updates", "model.zendesk.int_zendesk__comments_enriched", "model.zendesk.int_zendesk__reply_time_combined", "model.zendesk.int_zendesk__requester_updates", "model.zendesk.int_zendesk__sla_policy_applied", "model.zendesk.int_zendesk__sla_policy_applied", "model.zendesk.int_zendesk__ticket_historical_assignee", "model.zendesk.int_zendesk__ticket_historical_group", "model.zendesk.int_zendesk__ticket_historical_satisfaction", "model.zendesk.int_zendesk__ticket_historical_status"], "model.zendesk.int_zendesk__ticket_historical_assignee": ["model.zendesk.int_zendesk__ticket_resolution_times_calendar"], "model.zendesk.int_zendesk__ticket_historical_status": ["model.zendesk.int_zendesk__agent_work_time_filtered_statuses", "model.zendesk.int_zendesk__requester_wait_time_filtered_statuses", "model.zendesk.int_zendesk__ticket_resolution_times_calendar", "model.zendesk.int_zendesk__ticket_work_time_business", "model.zendesk.int_zendesk__ticket_work_time_calendar"], "model.zendesk.int_zendesk__user_aggregates": ["model.zendesk.int_zendesk__reply_time_combined", "model.zendesk.int_zendesk__updater_information", "model.zendesk.zendesk__ticket_enriched"], "model.zendesk.int_zendesk__schedule_spine": ["model.zendesk.int_zendesk__agent_work_time_business_hours", "model.zendesk.int_zendesk__reply_time_business_hours", "model.zendesk.int_zendesk__requester_wait_time_business_hours", "model.zendesk.int_zendesk__ticket_first_reply_time_business", "model.zendesk.int_zendesk__ticket_first_resolution_time_business", "model.zendesk.int_zendesk__ticket_full_resolution_time_business", "model.zendesk.int_zendesk__ticket_work_time_business"], "model.zendesk.int_zendesk__ticket_schedules": ["model.zendesk.int_zendesk__agent_work_time_business_hours", "model.zendesk.int_zendesk__reply_time_business_hours", "model.zendesk.int_zendesk__requester_wait_time_business_hours", "model.zendesk.int_zendesk__ticket_first_reply_time_business", "model.zendesk.int_zendesk__ticket_first_resolution_time_business", "model.zendesk.int_zendesk__ticket_full_resolution_time_business", "model.zendesk.int_zendesk__ticket_work_time_business"], "model.zendesk.int_zendesk__assignee_updates": ["model.zendesk.zendesk__ticket_enriched"], "model.zendesk.int_zendesk__comment_metrics": ["model.zendesk.zendesk__ticket_metrics"], "model.zendesk.int_zendesk__ticket_historical_group": ["model.zendesk.int_zendesk__ticket_resolution_times_calendar"], "model.zendesk.int_zendesk__requester_updates": ["model.zendesk.zendesk__ticket_enriched"], "model.zendesk.int_zendesk__ticket_historical_satisfaction": ["model.zendesk.zendesk__ticket_enriched"], "model.zendesk.int_zendesk__latest_ticket_form": ["model.zendesk.zendesk__ticket_enriched"], "model.zendesk.int_zendesk__ticket_aggregates": ["model.zendesk.int_zendesk__sla_policy_applied", "model.zendesk.zendesk__ticket_enriched"], "model.zendesk.int_zendesk__organization_aggregates": ["model.zendesk.int_zendesk__updater_information", "model.zendesk.zendesk__ticket_enriched"], "operation.zendesk.zendesk-on-run-start-0": [], "model.zendesk_source.stg_zendesk__user_tag": ["model.zendesk.int_zendesk__user_aggregates"], "model.zendesk_source.stg_zendesk__ticket_tag": ["model.zendesk.int_zendesk__ticket_aggregates"], "model.zendesk_source.stg_zendesk__ticket_field_history": ["model.zendesk.int_zendesk__field_history_enriched", "model.zendesk.int_zendesk__field_history_pivot", "model.zendesk.int_zendesk__updates"], "model.zendesk_source.stg_zendesk__daylight_time": ["model.zendesk.int_zendesk__schedule_spine", "test.zendesk_source.dbt_utils_unique_combination_of_columns_stg_zendesk__daylight_time_time_zone__year.88227aef3d"], "model.zendesk_source.stg_zendesk__organization": ["model.zendesk.int_zendesk__organization_aggregates", "model.zendesk.zendesk__ticket_backlog", "test.zendesk_source.not_null_stg_zendesk__organization_organization_id.de7b98c06a", "test.zendesk_source.unique_stg_zendesk__organization_organization_id.152be1ab31"], "model.zendesk_source.stg_zendesk__time_zone": ["model.zendesk.int_zendesk__schedule_spine", "test.zendesk_source.not_null_stg_zendesk__time_zone_time_zone.b25b3452b1", "test.zendesk_source.unique_stg_zendesk__time_zone_time_zone.67995adbaf"], "model.zendesk_source.stg_zendesk__group": ["model.zendesk.zendesk__ticket_backlog", "model.zendesk.zendesk__ticket_enriched", "test.zendesk_source.not_null_stg_zendesk__group_group_id.7659ed83ec", "test.zendesk_source.unique_stg_zendesk__group_group_id.f0658dabcd"], "model.zendesk_source.stg_zendesk__ticket_comment": ["model.zendesk.int_zendesk__updates", "test.zendesk_source.not_null_stg_zendesk__ticket_comment_ticket_comment_id.b821f4a606", "test.zendesk_source.unique_stg_zendesk__ticket_comment_ticket_comment_id.ba353330cd"], "model.zendesk_source.stg_zendesk__ticket_schedule": ["model.zendesk.int_zendesk__ticket_schedules"], "model.zendesk_source.stg_zendesk__schedule": ["model.zendesk.int_zendesk__reply_time_business_hours", "model.zendesk.int_zendesk__schedule_spine", "model.zendesk.int_zendesk__ticket_schedules"], "model.zendesk_source.stg_zendesk__user": ["model.zendesk.int_zendesk__comments_enriched", "model.zendesk.int_zendesk__user_aggregates", "model.zendesk.zendesk__ticket_backlog", "model.zendesk.zendesk__ticket_summary", "test.zendesk_source.not_null_stg_zendesk__user_user_id.102d572926", "test.zendesk_source.unique_stg_zendesk__user_user_id.3d3e346b11"], "model.zendesk_source.stg_zendesk__brand": ["model.zendesk.int_zendesk__ticket_aggregates", "model.zendesk.zendesk__ticket_backlog", "test.zendesk_source.not_null_stg_zendesk__brand_brand_id.a2419e1741", "test.zendesk_source.unique_stg_zendesk__brand_brand_id.fdf8e23c9e"], "model.zendesk_source.stg_zendesk__ticket_form_history": ["model.zendesk.int_zendesk__latest_ticket_form", "test.zendesk_source.not_null_stg_zendesk__ticket_form_history_ticket_form_id.1afe781a17"], "model.zendesk_source.stg_zendesk__domain_name": ["model.zendesk.int_zendesk__organization_aggregates", "test.zendesk_source.not_null_stg_zendesk__domain_name_organization_id.a2b5ff8fd3"], "model.zendesk_source.stg_zendesk__organization_tag": ["model.zendesk.int_zendesk__organization_aggregates"], "model.zendesk_source.stg_zendesk__ticket": ["model.zendesk.int_zendesk__assignee_updates", "model.zendesk.int_zendesk__calendar_spine", "model.zendesk.int_zendesk__field_calendar_spine", "model.zendesk.int_zendesk__requester_updates", "model.zendesk.int_zendesk__ticket_aggregates", "model.zendesk.int_zendesk__ticket_reply_times_calendar", "model.zendesk.int_zendesk__ticket_resolution_times_calendar", "model.zendesk.int_zendesk__ticket_schedules", "model.zendesk.int_zendesk__updates", "model.zendesk.zendesk__ticket_backlog", "test.zendesk_source.not_null_stg_zendesk__ticket_ticket_id.a8229e6981", "test.zendesk_source.unique_stg_zendesk__ticket_ticket_id.4be7124521"], "model.zendesk_source.stg_zendesk__daylight_time_tmp": ["model.zendesk_source.stg_zendesk__daylight_time", "model.zendesk_source.stg_zendesk__daylight_time"], "model.zendesk_source.stg_zendesk__user_tmp": ["model.zendesk_source.stg_zendesk__user", "model.zendesk_source.stg_zendesk__user"], "model.zendesk_source.stg_zendesk__group_tmp": ["model.zendesk_source.stg_zendesk__group", "model.zendesk_source.stg_zendesk__group"], "model.zendesk_source.stg_zendesk__ticket_tmp": ["model.zendesk_source.stg_zendesk__ticket", "model.zendesk_source.stg_zendesk__ticket"], "model.zendesk_source.stg_zendesk__brand_tmp": ["model.zendesk_source.stg_zendesk__brand", "model.zendesk_source.stg_zendesk__brand"], "model.zendesk_source.stg_zendesk__ticket_tag_tmp": ["model.zendesk_source.stg_zendesk__ticket_tag", "model.zendesk_source.stg_zendesk__ticket_tag"], "model.zendesk_source.stg_zendesk__user_tag_tmp": ["model.zendesk_source.stg_zendesk__user_tag", "model.zendesk_source.stg_zendesk__user_tag"], "model.zendesk_source.stg_zendesk__ticket_field_history_tmp": ["model.zendesk_source.stg_zendesk__ticket_field_history", "model.zendesk_source.stg_zendesk__ticket_field_history"], "model.zendesk_source.stg_zendesk__ticket_form_history_tmp": ["model.zendesk_source.stg_zendesk__ticket_form_history", "model.zendesk_source.stg_zendesk__ticket_form_history"], "model.zendesk_source.stg_zendesk__ticket_comment_tmp": ["model.zendesk_source.stg_zendesk__ticket_comment", "model.zendesk_source.stg_zendesk__ticket_comment"], "model.zendesk_source.stg_zendesk__organization_tag_tmp": ["model.zendesk_source.stg_zendesk__organization_tag", "model.zendesk_source.stg_zendesk__organization_tag"], "model.zendesk_source.stg_zendesk__schedule_tmp": ["model.zendesk_source.stg_zendesk__schedule", "model.zendesk_source.stg_zendesk__schedule"], "model.zendesk_source.stg_zendesk__organization_tmp": ["model.zendesk_source.stg_zendesk__organization", "model.zendesk_source.stg_zendesk__organization"], "model.zendesk_source.stg_zendesk__ticket_schedule_tmp": ["model.zendesk_source.stg_zendesk__ticket_schedule", "model.zendesk_source.stg_zendesk__ticket_schedule"], "model.zendesk_source.stg_zendesk__domain_name_tmp": ["model.zendesk_source.stg_zendesk__domain_name", "model.zendesk_source.stg_zendesk__domain_name"], "model.zendesk_source.stg_zendesk__time_zone_tmp": ["model.zendesk_source.stg_zendesk__time_zone", "model.zendesk_source.stg_zendesk__time_zone"], "test.zendesk.unique_zendesk__ticket_enriched_ticket_id.7c3c6ca9ef": [], "test.zendesk.not_null_zendesk__ticket_enriched_ticket_id.e3efc5bf0a": [], "test.zendesk.unique_zendesk__sla_policies_sla_event_id.5daff4d2bd": [], "test.zendesk.unique_zendesk__ticket_metrics_ticket_id.f3dc8eba5c": [], "test.zendesk.not_null_zendesk__ticket_metrics_ticket_id.3466b76bbd": [], "test.zendesk_source.unique_stg_zendesk__ticket_ticket_id.4be7124521": [], "test.zendesk_source.not_null_stg_zendesk__ticket_ticket_id.a8229e6981": [], "test.zendesk_source.unique_stg_zendesk__brand_brand_id.fdf8e23c9e": [], "test.zendesk_source.not_null_stg_zendesk__brand_brand_id.a2419e1741": [], "test.zendesk_source.not_null_stg_zendesk__domain_name_organization_id.a2b5ff8fd3": [], "test.zendesk_source.unique_stg_zendesk__group_group_id.f0658dabcd": [], "test.zendesk_source.not_null_stg_zendesk__group_group_id.7659ed83ec": [], "test.zendesk_source.unique_stg_zendesk__organization_organization_id.152be1ab31": [], "test.zendesk_source.not_null_stg_zendesk__organization_organization_id.de7b98c06a": [], "test.zendesk_source.unique_stg_zendesk__ticket_comment_ticket_comment_id.ba353330cd": [], "test.zendesk_source.not_null_stg_zendesk__ticket_comment_ticket_comment_id.b821f4a606": [], "test.zendesk_source.unique_stg_zendesk__user_user_id.3d3e346b11": [], "test.zendesk_source.not_null_stg_zendesk__user_user_id.102d572926": [], "test.zendesk_source.not_null_stg_zendesk__ticket_form_history_ticket_form_id.1afe781a17": [], "test.zendesk_source.dbt_utils_unique_combination_of_columns_stg_zendesk__daylight_time_time_zone__year.88227aef3d": [], "test.zendesk_source.unique_stg_zendesk__time_zone_time_zone.67995adbaf": [], "test.zendesk_source.not_null_stg_zendesk__time_zone_time_zone.b25b3452b1": [], "source.zendesk_source.zendesk.ticket": ["model.zendesk_source.stg_zendesk__ticket_tmp"], "source.zendesk_source.zendesk.brand": ["model.zendesk_source.stg_zendesk__brand_tmp"], "source.zendesk_source.zendesk.domain_name": ["model.zendesk_source.stg_zendesk__domain_name_tmp"], "source.zendesk_source.zendesk.group": ["model.zendesk_source.stg_zendesk__group_tmp"], "source.zendesk_source.zendesk.organization_tag": ["model.zendesk_source.stg_zendesk__organization_tag_tmp"], "source.zendesk_source.zendesk.organization": ["model.zendesk_source.stg_zendesk__organization_tmp"], "source.zendesk_source.zendesk.ticket_comment": ["model.zendesk_source.stg_zendesk__ticket_comment_tmp"], "source.zendesk_source.zendesk.user_tag": ["model.zendesk_source.stg_zendesk__user_tag_tmp"], "source.zendesk_source.zendesk.user": ["model.zendesk_source.stg_zendesk__user_tmp"], "source.zendesk_source.zendesk.schedule": ["model.zendesk_source.stg_zendesk__schedule_tmp"], "source.zendesk_source.zendesk.ticket_schedule": ["model.zendesk_source.stg_zendesk__ticket_schedule_tmp", "model.zendesk_source.stg_zendesk__ticket_schedule_tmp", "model.zendesk_source.stg_zendesk__ticket_schedule_tmp"], "source.zendesk_source.zendesk.ticket_form_history": ["model.zendesk_source.stg_zendesk__ticket_form_history_tmp"], "source.zendesk_source.zendesk.ticket_tag": ["model.zendesk_source.stg_zendesk__ticket_tag_tmp"], "source.zendesk_source.zendesk.ticket_field_history": ["model.zendesk_source.stg_zendesk__ticket_field_history_tmp"], "source.zendesk_source.zendesk.daylight_time": ["model.zendesk_source.stg_zendesk__daylight_time_tmp"], "source.zendesk_source.zendesk.time_zone": ["model.zendesk_source.stg_zendesk__time_zone_tmp"]}} \ No newline at end of file diff --git a/docs/run_results.json b/docs/run_results.json index f78779fe..ffbc7629 100644 --- a/docs/run_results.json +++ b/docs/run_results.json @@ -1 +1 @@ -{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/run-results/v1.json", "dbt_version": "0.19.0", "generated_at": "2021-03-11T15:26:17.832515Z", "invocation_id": "ecff4bad-3dd9-4165-89b8-5ed23819450a", "env": {}}, "results": [{"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.651496Z", "completed_at": "2021-03-11T15:26:13.692740Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:13.694070Z", "completed_at": "2021-03-11T15:26:13.694092Z"}], "thread_id": "Thread-1", "execution_time": 0.0450742244720459, "message": null, "adapter_response": {}, "unique_id": "seed.zendesk_integration_tests.ticket_field_history_data"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.651640Z", "completed_at": "2021-03-11T15:26:13.693249Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:13.694354Z", "completed_at": "2021-03-11T15:26:13.694363Z"}], "thread_id": "Thread-2", "execution_time": 0.04508709907531738, "message": null, "adapter_response": {}, "unique_id": "seed.zendesk_integration_tests.ticket_comment_data"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.651759Z", "completed_at": "2021-03-11T15:26:13.693550Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:13.694616Z", "completed_at": "2021-03-11T15:26:13.694623Z"}], "thread_id": "Thread-3", "execution_time": 0.04512906074523926, "message": null, "adapter_response": {}, "unique_id": "seed.zendesk_integration_tests.ticket_data"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.651874Z", "completed_at": "2021-03-11T15:26:13.693808Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:13.694873Z", "completed_at": "2021-03-11T15:26:13.694880Z"}], "thread_id": "Thread-4", "execution_time": 0.04512810707092285, "message": null, "adapter_response": {}, "unique_id": "seed.zendesk_integration_tests.brand_data"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.699087Z", "completed_at": "2021-03-11T15:26:13.726594Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:13.728818Z", "completed_at": "2021-03-11T15:26:13.728829Z"}], "thread_id": "Thread-1", "execution_time": 0.03203010559082031, "message": null, "adapter_response": {}, "unique_id": "seed.zendesk_integration_tests.ticket_tag_data"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.699199Z", "completed_at": "2021-03-11T15:26:13.728273Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:13.729339Z", "completed_at": "2021-03-11T15:26:13.729346Z"}], "thread_id": "Thread-2", "execution_time": 0.032267093658447266, "message": null, "adapter_response": {}, "unique_id": "seed.zendesk_integration_tests.user_data"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.699303Z", "completed_at": "2021-03-11T15:26:13.728531Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:13.729588Z", "completed_at": "2021-03-11T15:26:13.729595Z"}], "thread_id": "Thread-3", "execution_time": 0.032263994216918945, "message": null, "adapter_response": {}, "unique_id": "seed.zendesk_integration_tests.user_tag_data"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.699402Z", "completed_at": "2021-03-11T15:26:13.729070Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:13.730196Z", "completed_at": "2021-03-11T15:26:13.730204Z"}], "thread_id": "Thread-4", "execution_time": 0.03270697593688965, "message": null, "adapter_response": {}, "unique_id": "seed.zendesk_integration_tests.domain_name_data"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.733542Z", "completed_at": "2021-03-11T15:26:13.754144Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:13.779559Z", "completed_at": "2021-03-11T15:26:13.779570Z"}], "thread_id": "Thread-1", "execution_time": 0.04852128028869629, "message": null, "adapter_response": {}, "unique_id": "seed.zendesk_integration_tests.organization_data"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.733940Z", "completed_at": "2021-03-11T15:26:13.759532Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:13.779914Z", "completed_at": "2021-03-11T15:26:13.779923Z"}], "thread_id": "Thread-2", "execution_time": 0.048352956771850586, "message": null, "adapter_response": {}, "unique_id": "seed.zendesk_integration_tests.organization_tag_data"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.734061Z", "completed_at": "2021-03-11T15:26:13.775924Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:13.780247Z", "completed_at": "2021-03-11T15:26:13.780255Z"}], "thread_id": "Thread-3", "execution_time": 0.04831504821777344, "message": null, "adapter_response": {}, "unique_id": "seed.zendesk_integration_tests.schedule_data"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.740676Z", "completed_at": "2021-03-11T15:26:13.782413Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:13.783772Z", "completed_at": "2021-03-11T15:26:13.783779Z"}], "thread_id": "Thread-4", "execution_time": 0.05101799964904785, "message": null, "adapter_response": {}, "unique_id": "model.zendesk_source.stg_zendesk__ticket_schedule_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.784286Z", "completed_at": "2021-03-11T15:26:13.810381Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:13.813848Z", "completed_at": "2021-03-11T15:26:13.813860Z"}], "thread_id": "Thread-1", "execution_time": 0.0317690372467041, "message": null, "adapter_response": {}, "unique_id": "seed.zendesk_integration_tests.group_data"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.784416Z", "completed_at": "2021-03-11T15:26:13.813146Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:13.814284Z", "completed_at": "2021-03-11T15:26:13.814293Z"}], "thread_id": "Thread-2", "execution_time": 0.03173995018005371, "message": null, "adapter_response": {}, "unique_id": "seed.zendesk_integration_tests.ticket_form_history_data"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.784862Z", "completed_at": "2021-03-11T15:26:13.822396Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:13.824222Z", "completed_at": "2021-03-11T15:26:13.824233Z"}], "thread_id": "Thread-3", "execution_time": 0.04150986671447754, "message": null, "adapter_response": {}, "unique_id": "operation.zendesk.zendesk-on-run-start-0"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.814590Z", "completed_at": "2021-03-11T15:26:13.823402Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:13.824948Z", "completed_at": "2021-03-11T15:26:13.824956Z"}], "thread_id": "Thread-4", "execution_time": 0.012492179870605469, "message": null, "adapter_response": {}, "unique_id": "seed.zendesk_integration_tests.organization_tag_data_snowflake"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.825235Z", "completed_at": "2021-03-11T15:26:13.840952Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:13.842106Z", "completed_at": "2021-03-11T15:26:13.842117Z"}], "thread_id": "Thread-1", "execution_time": 0.01918315887451172, "message": null, "adapter_response": {}, "unique_id": "seed.zendesk_integration_tests.ticket_schedule_data"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.825696Z", "completed_at": "2021-03-11T15:26:13.841573Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:13.842508Z", "completed_at": "2021-03-11T15:26:13.842516Z"}], "thread_id": "Thread-2", "execution_time": 0.0239410400390625, "message": null, "adapter_response": {}, "unique_id": "seed.zendesk_integration_tests.user_tag_data_snowflake"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.842377Z", "completed_at": "2021-03-11T15:26:13.863915Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:13.864680Z", "completed_at": "2021-03-11T15:26:13.864690Z"}], "thread_id": "Thread-3", "execution_time": 0.04333376884460449, "message": null, "adapter_response": {}, "unique_id": "model.zendesk_source.stg_zendesk__ticket_field_history_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.842747Z", "completed_at": "2021-03-11T15:26:13.864151Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:13.864928Z", "completed_at": "2021-03-11T15:26:13.864935Z"}], "thread_id": "Thread-4", "execution_time": 0.043048858642578125, "message": null, "adapter_response": {}, "unique_id": "model.zendesk_source.stg_zendesk__ticket_comment_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.864381Z", "completed_at": "2021-03-11T15:26:13.885467Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:13.886725Z", "completed_at": "2021-03-11T15:26:13.886733Z"}], "thread_id": "Thread-1", "execution_time": 0.02457594871520996, "message": null, "adapter_response": {}, "unique_id": "model.zendesk_source.stg_zendesk__ticket_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.864550Z", "completed_at": "2021-03-11T15:26:13.886483Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:13.887411Z", "completed_at": "2021-03-11T15:26:13.887419Z"}], "thread_id": "Thread-2", "execution_time": 0.033555030822753906, "message": null, "adapter_response": {}, "unique_id": "model.zendesk_source.stg_zendesk__brand_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.887286Z", "completed_at": "2021-03-11T15:26:13.908242Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:13.909005Z", "completed_at": "2021-03-11T15:26:13.909016Z"}], "thread_id": "Thread-3", "execution_time": 0.04271268844604492, "message": null, "adapter_response": {}, "unique_id": "model.zendesk_source.stg_zendesk__ticket_tag_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.888005Z", "completed_at": "2021-03-11T15:26:13.908779Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:13.924991Z", "completed_at": "2021-03-11T15:26:13.925006Z"}], "thread_id": "Thread-4", "execution_time": 0.04233884811401367, "message": null, "adapter_response": {}, "unique_id": "model.zendesk_source.stg_zendesk__user_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.908505Z", "completed_at": "2021-03-11T15:26:13.930137Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:13.931206Z", "completed_at": "2021-03-11T15:26:13.931214Z"}], "thread_id": "Thread-1", "execution_time": 0.024877071380615234, "message": null, "adapter_response": {}, "unique_id": "model.zendesk_source.stg_zendesk__user_tag_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.908669Z", "completed_at": "2021-03-11T15:26:13.930359Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:13.931475Z", "completed_at": "2021-03-11T15:26:13.931481Z"}], "thread_id": "Thread-2", "execution_time": 0.02462315559387207, "message": null, "adapter_response": {}, "unique_id": "model.zendesk_source.stg_zendesk__domain_name_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.932021Z", "completed_at": "2021-03-11T15:26:13.953303Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:13.954153Z", "completed_at": "2021-03-11T15:26:13.954163Z"}], "thread_id": "Thread-3", "execution_time": 0.04447484016418457, "message": null, "adapter_response": {}, "unique_id": "model.zendesk_source.stg_zendesk__organization_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.932722Z", "completed_at": "2021-03-11T15:26:13.954425Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:13.978073Z", "completed_at": "2021-03-11T15:26:13.978083Z"}], "thread_id": "Thread-4", "execution_time": 0.04766583442687988, "message": null, "adapter_response": {}, "unique_id": "model.zendesk_source.stg_zendesk__organization_tag_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.953679Z", "completed_at": "2021-03-11T15:26:13.979026Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:13.980691Z", "completed_at": "2021-03-11T15:26:13.980699Z"}], "thread_id": "Thread-1", "execution_time": 0.029688119888305664, "message": null, "adapter_response": {}, "unique_id": "model.zendesk_source.stg_zendesk__schedule_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.981934Z", "completed_at": "2021-03-11T15:26:13.999411Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.003758Z", "completed_at": "2021-03-11T15:26:14.003769Z"}], "thread_id": "Thread-3", "execution_time": 0.038153886795043945, "message": null, "adapter_response": {}, "unique_id": "model.zendesk_source.stg_zendesk__group_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.992502Z", "completed_at": "2021-03-11T15:26:14.017309Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.018082Z", "completed_at": "2021-03-11T15:26:14.018092Z"}], "thread_id": "Thread-4", "execution_time": 0.03663015365600586, "message": null, "adapter_response": {}, "unique_id": "model.zendesk_source.stg_zendesk__ticket_form_history_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:13.953845Z", "completed_at": "2021-03-11T15:26:14.157736Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.158046Z", "completed_at": "2021-03-11T15:26:14.158060Z"}], "thread_id": "Thread-2", "execution_time": 0.20547199249267578, "message": null, "adapter_response": {}, "unique_id": "model.zendesk_source.stg_zendesk__ticket_schedule"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.020967Z", "completed_at": "2021-03-11T15:26:14.195172Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.195453Z", "completed_at": "2021-03-11T15:26:14.195465Z"}], "thread_id": "Thread-3", "execution_time": 0.17588472366333008, "message": null, "adapter_response": {}, "unique_id": "model.zendesk_source.stg_zendesk__ticket_comment"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.003574Z", "completed_at": "2021-03-11T15:26:14.227359Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.238139Z", "completed_at": "2021-03-11T15:26:14.238155Z"}], "thread_id": "Thread-1", "execution_time": 0.24577617645263672, "message": null, "adapter_response": {}, "unique_id": "model.zendesk_source.stg_zendesk__ticket_field_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.031983Z", "completed_at": "2021-03-11T15:26:14.261127Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.261546Z", "completed_at": "2021-03-11T15:26:14.261559Z"}], "thread_id": "Thread-4", "execution_time": 0.2411038875579834, "message": null, "adapter_response": {}, "unique_id": "model.zendesk_source.stg_zendesk__ticket"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.159179Z", "completed_at": "2021-03-11T15:26:14.316922Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.317210Z", "completed_at": "2021-03-11T15:26:14.317222Z"}], "thread_id": "Thread-2", "execution_time": 0.15881681442260742, "message": null, "adapter_response": {}, "unique_id": "model.zendesk_source.stg_zendesk__brand"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.196680Z", "completed_at": "2021-03-11T15:26:14.381458Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.381744Z", "completed_at": "2021-03-11T15:26:14.381755Z"}], "thread_id": "Thread-3", "execution_time": 0.18574285507202148, "message": null, "adapter_response": {}, "unique_id": "model.zendesk_source.stg_zendesk__ticket_tag"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.263508Z", "completed_at": "2021-03-11T15:26:14.422675Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.422944Z", "completed_at": "2021-03-11T15:26:14.422955Z"}], "thread_id": "Thread-4", "execution_time": 0.16022396087646484, "message": null, "adapter_response": {}, "unique_id": "model.zendesk_source.stg_zendesk__user_tag"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.318421Z", "completed_at": "2021-03-11T15:26:14.497090Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.497730Z", "completed_at": "2021-03-11T15:26:14.497745Z"}], "thread_id": "Thread-2", "execution_time": 0.1815488338470459, "message": null, "adapter_response": {}, "unique_id": "model.zendesk_source.stg_zendesk__domain_name"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.239616Z", "completed_at": "2021-03-11T15:26:14.498390Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.499757Z", "completed_at": "2021-03-11T15:26:14.499767Z"}], "thread_id": "Thread-1", "execution_time": 0.26207518577575684, "message": null, "adapter_response": {}, "unique_id": "model.zendesk_source.stg_zendesk__user"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.382696Z", "completed_at": "2021-03-11T15:26:14.607922Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.608194Z", "completed_at": "2021-03-11T15:26:14.608205Z"}], "thread_id": "Thread-3", "execution_time": 0.22614002227783203, "message": null, "adapter_response": {}, "unique_id": "model.zendesk_source.stg_zendesk__organization"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.503851Z", "completed_at": "2021-03-11T15:26:14.690710Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.695478Z", "completed_at": "2021-03-11T15:26:14.695490Z"}], "thread_id": "Thread-2", "execution_time": 0.1932680606842041, "message": null, "adapter_response": {}, "unique_id": "model.zendesk_source.stg_zendesk__schedule"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.520231Z", "completed_at": "2021-03-11T15:26:14.715023Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.715553Z", "completed_at": "2021-03-11T15:26:14.715564Z"}], "thread_id": "Thread-1", "execution_time": 0.21392202377319336, "message": null, "adapter_response": {}, "unique_id": "model.zendesk_source.stg_zendesk__group"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.424041Z", "completed_at": "2021-03-11T15:26:14.723113Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.723833Z", "completed_at": "2021-03-11T15:26:14.723844Z"}], "thread_id": "Thread-4", "execution_time": 0.30605387687683105, "message": null, "adapter_response": {}, "unique_id": "model.zendesk_source.stg_zendesk__organization_tag"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.696747Z", "completed_at": "2021-03-11T15:26:14.723392Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.724111Z", "completed_at": "2021-03-11T15:26:14.724120Z"}], "thread_id": "Thread-2", "execution_time": 0.03505373001098633, "message": null, "adapter_response": {}, "unique_id": "test.zendesk_source.not_null_stg_zendesk__ticket_comment_ticket_comment_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.719098Z", "completed_at": "2021-03-11T15:26:14.733116Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.738736Z", "completed_at": "2021-03-11T15:26:14.738747Z"}], "thread_id": "Thread-1", "execution_time": 0.036762237548828125, "message": null, "adapter_response": {}, "unique_id": "test.zendesk_source.unique_stg_zendesk__ticket_comment_ticket_comment_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.733031Z", "completed_at": "2021-03-11T15:26:14.765512Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.766870Z", "completed_at": "2021-03-11T15:26:14.766881Z"}], "thread_id": "Thread-4", "execution_time": 0.04501509666442871, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.int_zendesk__updates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.609376Z", "completed_at": "2021-03-11T15:26:14.766408Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.776939Z", "completed_at": "2021-03-11T15:26:14.776951Z"}], "thread_id": "Thread-3", "execution_time": 0.16885685920715332, "message": null, "adapter_response": {}, "unique_id": "model.zendesk_source.stg_zendesk__ticket_form_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.766004Z", "completed_at": "2021-03-11T15:26:14.778653Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.779848Z", "completed_at": "2021-03-11T15:26:14.779856Z"}], "thread_id": "Thread-1", "execution_time": 0.01642632484436035, "message": null, "adapter_response": {}, "unique_id": "test.zendesk_source.not_null_stg_zendesk__ticket_ticket_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.780359Z", "completed_at": "2021-03-11T15:26:14.800467Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.800887Z", "completed_at": "2021-03-11T15:26:14.800898Z"}], "thread_id": "Thread-4", "execution_time": 0.030915021896362305, "message": null, "adapter_response": {}, "unique_id": "test.zendesk_source.unique_stg_zendesk__ticket_ticket_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.780755Z", "completed_at": "2021-03-11T15:26:14.810092Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.810767Z", "completed_at": "2021-03-11T15:26:14.810777Z"}], "thread_id": "Thread-3", "execution_time": 0.03164219856262207, "message": null, "adapter_response": {}, "unique_id": "test.zendesk_source.not_null_stg_zendesk__brand_brand_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.800701Z", "completed_at": "2021-03-11T15:26:14.811302Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.812149Z", "completed_at": "2021-03-11T15:26:14.812155Z"}], "thread_id": "Thread-1", "execution_time": 0.012817144393920898, "message": null, "adapter_response": {}, "unique_id": "test.zendesk_source.unique_stg_zendesk__brand_brand_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.812552Z", "completed_at": "2021-03-11T15:26:14.835560Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.847891Z", "completed_at": "2021-03-11T15:26:14.847904Z"}], "thread_id": "Thread-4", "execution_time": 0.03680419921875, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.int_zendesk__ticket_aggregates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.825203Z", "completed_at": "2021-03-11T15:26:14.848286Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.848905Z", "completed_at": "2021-03-11T15:26:14.848914Z"}], "thread_id": "Thread-3", "execution_time": 0.037422895431518555, "message": null, "adapter_response": {}, "unique_id": "test.zendesk_source.not_null_stg_zendesk__domain_name_organization_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.835027Z", "completed_at": "2021-03-11T15:26:14.849370Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.850687Z", "completed_at": "2021-03-11T15:26:14.850693Z"}], "thread_id": "Thread-1", "execution_time": 0.027142763137817383, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.int_zendesk__user_aggregates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.852833Z", "completed_at": "2021-03-11T15:26:14.884070Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.884356Z", "completed_at": "2021-03-11T15:26:14.884367Z"}], "thread_id": "Thread-4", "execution_time": 0.033734798431396484, "message": null, "adapter_response": {}, "unique_id": "test.zendesk_source.not_null_stg_zendesk__user_user_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.863957Z", "completed_at": "2021-03-11T15:26:14.885151Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.885723Z", "completed_at": "2021-03-11T15:26:14.885732Z"}], "thread_id": "Thread-3", "execution_time": 0.03348517417907715, "message": null, "adapter_response": {}, "unique_id": "test.zendesk_source.unique_stg_zendesk__user_user_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.870232Z", "completed_at": "2021-03-11T15:26:14.885940Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.886612Z", "completed_at": "2021-03-11T15:26:14.886619Z"}], "thread_id": "Thread-1", "execution_time": 0.03226494789123535, "message": null, "adapter_response": {}, "unique_id": "test.zendesk_source.not_null_stg_zendesk__organization_organization_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.886198Z", "completed_at": "2021-03-11T15:26:14.897659Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.913519Z", "completed_at": "2021-03-11T15:26:14.913530Z"}], "thread_id": "Thread-4", "execution_time": 0.034105777740478516, "message": null, "adapter_response": {}, "unique_id": "test.zendesk_source.unique_stg_zendesk__organization_organization_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.913350Z", "completed_at": "2021-03-11T15:26:14.931508Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.935326Z", "completed_at": "2021-03-11T15:26:14.935336Z"}], "thread_id": "Thread-1", "execution_time": 0.03846597671508789, "message": null, "adapter_response": {}, "unique_id": "test.zendesk_source.not_null_stg_zendesk__group_group_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.925727Z", "completed_at": "2021-03-11T15:26:14.953247Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.953614Z", "completed_at": "2021-03-11T15:26:14.953626Z"}], "thread_id": "Thread-4", "execution_time": 0.02891230583190918, "message": null, "adapter_response": {}, "unique_id": "test.zendesk_source.unique_stg_zendesk__group_group_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.936399Z", "completed_at": "2021-03-11T15:26:14.954838Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.965116Z", "completed_at": "2021-03-11T15:26:14.965127Z"}], "thread_id": "Thread-1", "execution_time": 0.029518842697143555, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.int_zendesk__organization_aggregates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.954652Z", "completed_at": "2021-03-11T15:26:14.966258Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.966773Z", "completed_at": "2021-03-11T15:26:14.966780Z"}], "thread_id": "Thread-4", "execution_time": 0.012880802154541016, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.int_zendesk__ticket_historical_status"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.967011Z", "completed_at": "2021-03-11T15:26:14.986233Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:14.986505Z", "completed_at": "2021-03-11T15:26:14.986515Z"}], "thread_id": "Thread-1", "execution_time": 0.02047586441040039, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.int_zendesk__assignee_updates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.987676Z", "completed_at": "2021-03-11T15:26:15.008895Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:15.009231Z", "completed_at": "2021-03-11T15:26:15.009244Z"}], "thread_id": "Thread-1", "execution_time": 0.022632122039794922, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.int_zendesk__requester_updates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.999296Z", "completed_at": "2021-03-11T15:26:15.010629Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:15.012262Z", "completed_at": "2021-03-11T15:26:15.012274Z"}], "thread_id": "Thread-4", "execution_time": 0.023374080657958984, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.int_zendesk__ticket_historical_satisfaction"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:15.011056Z", "completed_at": "2021-03-11T15:26:15.032472Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:15.032892Z", "completed_at": "2021-03-11T15:26:15.032903Z"}], "thread_id": "Thread-1", "execution_time": 0.02297496795654297, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.int_zendesk__ticket_historical_assignee"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:15.023206Z", "completed_at": "2021-03-11T15:26:15.033524Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:15.034002Z", "completed_at": "2021-03-11T15:26:15.034009Z"}], "thread_id": "Thread-4", "execution_time": 0.011806964874267578, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.int_zendesk__ticket_historical_group"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:15.034816Z", "completed_at": "2021-03-11T15:26:15.053144Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:15.053519Z", "completed_at": "2021-03-11T15:26:15.053528Z"}], "thread_id": "Thread-1", "execution_time": 0.019989967346191406, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.int_zendesk__latest_ticket_form"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:15.044513Z", "completed_at": "2021-03-11T15:26:15.054799Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:15.055758Z", "completed_at": "2021-03-11T15:26:15.055767Z"}], "thread_id": "Thread-4", "execution_time": 0.012382984161376953, "message": null, "adapter_response": {}, "unique_id": "test.zendesk_source.not_null_stg_zendesk__ticket_form_history_ticket_form_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:15.056227Z", "completed_at": "2021-03-11T15:26:15.076529Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:15.076785Z", "completed_at": "2021-03-11T15:26:15.076795Z"}], "thread_id": "Thread-1", "execution_time": 0.02183985710144043, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.int_zendesk__sla_policy_applied"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:15.091058Z", "completed_at": "2021-03-11T15:26:15.124562Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:15.124815Z", "completed_at": "2021-03-11T15:26:15.124825Z"}], "thread_id": "Thread-1", "execution_time": 0.034603118896484375, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.int_zendesk__comment_metrics"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:15.133018Z", "completed_at": "2021-03-11T15:26:15.199055Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:15.199389Z", "completed_at": "2021-03-11T15:26:15.199398Z"}], "thread_id": "Thread-4", "execution_time": 0.06694793701171875, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.zendesk__ticket_enriched"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:15.186810Z", "completed_at": "2021-03-11T15:26:15.212623Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:15.213075Z", "completed_at": "2021-03-11T15:26:15.213101Z"}], "thread_id": "Thread-1", "execution_time": 0.02695298194885254, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.int_zendesk__agent_work_time_filtered_statuses"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:15.200209Z", "completed_at": "2021-03-11T15:26:15.224332Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:15.224584Z", "completed_at": "2021-03-11T15:26:15.224594Z"}], "thread_id": "Thread-4", "execution_time": 0.025038957595825195, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.int_zendesk__requester_wait_time_filtered_statuses"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:15.214346Z", "completed_at": "2021-03-11T15:26:15.225342Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:15.226024Z", "completed_at": "2021-03-11T15:26:15.226032Z"}], "thread_id": "Thread-1", "execution_time": 0.012498855590820312, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.int_zendesk__reply_time_calendar_hours"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:15.246635Z", "completed_at": "2021-03-11T15:26:15.268958Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:15.272165Z", "completed_at": "2021-03-11T15:26:15.272177Z"}], "thread_id": "Thread-4", "execution_time": 0.026314973831176758, "message": null, "adapter_response": {}, "unique_id": "test.zendesk.not_null_zendesk__ticket_enriched_ticket_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:15.262417Z", "completed_at": "2021-03-11T15:26:15.273153Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:15.273746Z", "completed_at": "2021-03-11T15:26:15.273754Z"}], "thread_id": "Thread-1", "execution_time": 0.012296915054321289, "message": null, "adapter_response": {}, "unique_id": "test.zendesk.unique_zendesk__ticket_enriched_ticket_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:15.274035Z", "completed_at": "2021-03-11T15:26:15.297381Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:15.297666Z", "completed_at": "2021-03-11T15:26:15.297677Z"}], "thread_id": "Thread-4", "execution_time": 0.02456498146057129, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.int_zendesk__agent_work_time_calendar_hours"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:15.285691Z", "completed_at": "2021-03-11T15:26:15.314788Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:15.319188Z", "completed_at": "2021-03-11T15:26:15.319201Z"}], "thread_id": "Thread-1", "execution_time": 0.03438878059387207, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.int_zendesk__requester_wait_time_calendar_hours"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:14.897174Z", "completed_at": "2021-03-11T15:26:16.220703Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:16.221028Z", "completed_at": "2021-03-11T15:26:16.221041Z"}], "thread_id": "Thread-3", "execution_time": 1.3249199390411377, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.int_zendesk__ticket_schedules"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:16.222511Z", "completed_at": "2021-03-11T15:26:16.263729Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:16.264637Z", "completed_at": "2021-03-11T15:26:16.264645Z"}], "thread_id": "Thread-1", "execution_time": 0.043158769607543945, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.int_zendesk__reply_time_business_hours"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:16.301798Z", "completed_at": "2021-03-11T15:26:16.329809Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:16.330250Z", "completed_at": "2021-03-11T15:26:16.330258Z"}], "thread_id": "Thread-1", "execution_time": 0.03427767753601074, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.int_zendesk__agent_work_time_business_hours"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:16.330109Z", "completed_at": "2021-03-11T15:26:16.362233Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:16.362519Z", "completed_at": "2021-03-11T15:26:16.362530Z"}], "thread_id": "Thread-3", "execution_time": 0.03358197212219238, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.int_zendesk__requester_wait_time_business_hours"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:16.343145Z", "completed_at": "2021-03-11T15:26:16.362729Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:16.363323Z", "completed_at": "2021-03-11T15:26:16.363331Z"}], "thread_id": "Thread-1", "execution_time": 0.021075010299682617, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.int_zendesk__reply_time_combined"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:16.370767Z", "completed_at": "2021-03-11T15:26:16.526031Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:16.537361Z", "completed_at": "2021-03-11T15:26:16.537379Z"}], "thread_id": "Thread-1", "execution_time": 0.16767215728759766, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.zendesk__sla_policies"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:15.298673Z", "completed_at": "2021-03-11T15:26:16.549623Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:16.561769Z", "completed_at": "2021-03-11T15:26:16.561787Z"}], "thread_id": "Thread-4", "execution_time": 1.269775152206421, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.int_zendesk__field_history_pivot"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:16.364669Z", "completed_at": "2021-03-11T15:26:16.600859Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:16.601974Z", "completed_at": "2021-03-11T15:26:16.601985Z"}], "thread_id": "Thread-3", "execution_time": 0.23821496963500977, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.zendesk__ticket_metrics"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:16.580937Z", "completed_at": "2021-03-11T15:26:16.602842Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:16.603797Z", "completed_at": "2021-03-11T15:26:16.603807Z"}], "thread_id": "Thread-4", "execution_time": 0.02435302734375, "message": null, "adapter_response": {}, "unique_id": "test.zendesk.unique_zendesk__sla_policies_sla_event_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:16.605205Z", "completed_at": "2021-03-11T15:26:16.635057Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:16.635322Z", "completed_at": "2021-03-11T15:26:16.635333Z"}], "thread_id": "Thread-3", "execution_time": 0.03133392333984375, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.zendesk__ticket_summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:16.617292Z", "completed_at": "2021-03-11T15:26:16.635549Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:16.636092Z", "completed_at": "2021-03-11T15:26:16.636098Z"}], "thread_id": "Thread-4", "execution_time": 0.031249046325683594, "message": null, "adapter_response": {}, "unique_id": "test.zendesk.not_null_zendesk__ticket_metrics_ticket_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:16.637407Z", "completed_at": "2021-03-11T15:26:16.646283Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:16.646534Z", "completed_at": "2021-03-11T15:26:16.646544Z"}], "thread_id": "Thread-3", "execution_time": 0.010082244873046875, "message": null, "adapter_response": {}, "unique_id": "test.zendesk.unique_zendesk__ticket_metrics_ticket_id"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:16.581225Z", "completed_at": "2021-03-11T15:26:16.776989Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:16.777366Z", "completed_at": "2021-03-11T15:26:16.777378Z"}], "thread_id": "Thread-1", "execution_time": 0.19719505310058594, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.int_zendesk__field_history_scd"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:17.570504Z", "completed_at": "2021-03-11T15:26:17.602389Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:17.602649Z", "completed_at": "2021-03-11T15:26:17.602660Z"}], "thread_id": "Thread-4", "execution_time": 0.032910823822021484, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.int_zendesk__field_calendar_spine"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:17.604018Z", "completed_at": "2021-03-11T15:26:17.774081Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:17.774408Z", "completed_at": "2021-03-11T15:26:17.774421Z"}], "thread_id": "Thread-1", "execution_time": 0.1711888313293457, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.zendesk__ticket_field_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2021-03-11T15:26:17.775801Z", "completed_at": "2021-03-11T15:26:17.808530Z"}, {"name": "execute", "started_at": "2021-03-11T15:26:17.808795Z", "completed_at": "2021-03-11T15:26:17.808805Z"}], "thread_id": "Thread-3", "execution_time": 0.03367805480957031, "message": null, "adapter_response": {}, "unique_id": "model.zendesk.zendesk__ticket_backlog"}], "elapsed_time": 6.0538249015808105, "args": {"log_format": "default", "write_json": true, "profiles_dir": "/Users/joseph.markiewicz/.dbt", "target": "bigquery", "use_cache": true, "compile": true, "version_check": true, "which": "generate", "rpc_method": "docs.generate"}} \ No newline at end of file +{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/run-results/v4.json", "dbt_version": "1.0.1", "generated_at": "2022-02-11T22:35:47.003921Z", "invocation_id": "98c5cc93-363f-4652-bdde-d79dc6e6d77e", "env": {}}, "results": [{"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:42.022325Z", "completed_at": "2022-02-11T22:35:42.040006Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:42.040917Z", "completed_at": "2022-02-11T22:35:42.040952Z"}], "thread_id": "Thread-1", "execution_time": 0.021686792373657227, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__brand_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:42.023027Z", "completed_at": "2022-02-11T22:35:42.041768Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:42.047681Z", "completed_at": "2022-02-11T22:35:42.047693Z"}], "thread_id": "Thread-2", "execution_time": 0.027834177017211914, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__daylight_time_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:42.028975Z", "completed_at": "2022-02-11T22:35:42.042972Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:42.048657Z", "completed_at": "2022-02-11T22:35:42.048666Z"}], "thread_id": "Thread-4", "execution_time": 0.032488107681274414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__group_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:42.028797Z", "completed_at": "2022-02-11T22:35:42.053186Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:42.055857Z", "completed_at": "2022-02-11T22:35:42.055867Z"}], "thread_id": "Thread-3", "execution_time": 0.0356440544128418, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__domain_name_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:42.048039Z", "completed_at": "2022-02-11T22:35:42.055985Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:42.057746Z", "completed_at": "2022-02-11T22:35:42.057755Z"}], "thread_id": "Thread-1", "execution_time": 0.019895076751708984, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__organization_tag_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:42.057169Z", "completed_at": "2022-02-11T22:35:42.066555Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:42.071974Z", "completed_at": "2022-02-11T22:35:42.071984Z"}], "thread_id": "Thread-2", "execution_time": 0.017895221710205078, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__organization_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:42.061504Z", "completed_at": "2022-02-11T22:35:42.067400Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:42.072385Z", "completed_at": "2022-02-11T22:35:42.072393Z"}], "thread_id": "Thread-4", "execution_time": 0.017169713973999023, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__schedule_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:42.067181Z", "completed_at": "2022-02-11T22:35:42.073251Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:42.078904Z", "completed_at": "2022-02-11T22:35:42.078915Z"}], "thread_id": "Thread-3", "execution_time": 0.018268108367919922, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__ticket_comment_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:42.073025Z", "completed_at": "2022-02-11T22:35:42.080099Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:42.087209Z", "completed_at": "2022-02-11T22:35:42.087221Z"}], "thread_id": "Thread-1", "execution_time": 0.026360750198364258, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__ticket_field_history_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:42.080400Z", "completed_at": "2022-02-11T22:35:42.094343Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:42.100707Z", "completed_at": "2022-02-11T22:35:42.100719Z"}], "thread_id": "Thread-2", "execution_time": 0.02427077293395996, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__ticket_form_history_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:42.094655Z", "completed_at": "2022-02-11T22:35:42.103244Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:42.109290Z", "completed_at": "2022-02-11T22:35:42.109302Z"}], "thread_id": "Thread-3", "execution_time": 0.02319502830505371, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__ticket_tag_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:42.103742Z", "completed_at": "2022-02-11T22:35:42.110194Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:42.115206Z", "completed_at": "2022-02-11T22:35:42.115216Z"}], "thread_id": "Thread-1", "execution_time": 0.015575885772705078, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__ticket_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:42.110315Z", "completed_at": "2022-02-11T22:35:42.116454Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:42.123189Z", "completed_at": "2022-02-11T22:35:42.123201Z"}], "thread_id": "Thread-2", "execution_time": 0.014801025390625, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__time_zone_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:42.116057Z", "completed_at": "2022-02-11T22:35:42.123345Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:42.127756Z", "completed_at": "2022-02-11T22:35:42.127765Z"}], "thread_id": "Thread-3", "execution_time": 0.013963699340820312, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__user_tag_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:42.123499Z", "completed_at": "2022-02-11T22:35:42.129559Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:42.137093Z", "completed_at": "2022-02-11T22:35:42.137108Z"}], "thread_id": "Thread-1", "execution_time": 0.015336990356445312, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__user_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:42.129442Z", "completed_at": "2022-02-11T22:35:42.184661Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:42.192610Z", "completed_at": "2022-02-11T22:35:42.192648Z"}], "thread_id": "Thread-2", "execution_time": 0.06539297103881836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "operation.zendesk.zendesk-on-run-start-0"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:42.081056Z", "completed_at": "2022-02-11T22:35:42.526301Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:42.526695Z", "completed_at": "2022-02-11T22:35:42.526710Z"}], "thread_id": "Thread-4", "execution_time": 0.4478449821472168, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__ticket_schedule_tmp"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:42.194168Z", "completed_at": "2022-02-11T22:35:42.615960Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:42.616418Z", "completed_at": "2022-02-11T22:35:42.616430Z"}], "thread_id": "Thread-1", "execution_time": 0.4258997440338135, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__daylight_time"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:42.203048Z", "completed_at": "2022-02-11T22:35:42.661176Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:42.661981Z", "completed_at": "2022-02-11T22:35:42.662009Z"}], "thread_id": "Thread-2", "execution_time": 0.4606969356536865, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__group"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:42.137294Z", "completed_at": "2022-02-11T22:35:42.676973Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:42.677321Z", "completed_at": "2022-02-11T22:35:42.677334Z"}], "thread_id": "Thread-3", "execution_time": 0.5478000640869141, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__brand"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:42.678633Z", "completed_at": "2022-02-11T22:35:43.087184Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:43.087876Z", "completed_at": "2022-02-11T22:35:43.087890Z"}], "thread_id": "Thread-3", "execution_time": 0.41014814376831055, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__schedule"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:42.528007Z", "completed_at": "2022-02-11T22:35:43.088509Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:43.089970Z", "completed_at": "2022-02-11T22:35:43.089979Z"}], "thread_id": "Thread-4", "execution_time": 0.5631389617919922, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__domain_name"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:42.663677Z", "completed_at": "2022-02-11T22:35:43.114354Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:43.114656Z", "completed_at": "2022-02-11T22:35:43.114667Z"}], "thread_id": "Thread-2", "execution_time": 0.45191311836242676, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__organization"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:42.617539Z", "completed_at": "2022-02-11T22:35:43.157610Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:43.157932Z", "completed_at": "2022-02-11T22:35:43.157945Z"}], "thread_id": "Thread-1", "execution_time": 0.541118860244751, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__organization_tag"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:43.158976Z", "completed_at": "2022-02-11T22:35:43.527186Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:43.527623Z", "completed_at": "2022-02-11T22:35:43.527639Z"}], "thread_id": "Thread-1", "execution_time": 0.36945605278015137, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__ticket_tag"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:43.098577Z", "completed_at": "2022-02-11T22:35:43.581074Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:43.583649Z", "completed_at": "2022-02-11T22:35:43.583671Z"}], "thread_id": "Thread-4", "execution_time": 0.4878239631652832, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__ticket_field_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:43.115963Z", "completed_at": "2022-02-11T22:35:43.586567Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:43.610065Z", "completed_at": "2022-02-11T22:35:43.610079Z"}], "thread_id": "Thread-2", "execution_time": 0.5028562545776367, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__ticket_form_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:43.090938Z", "completed_at": "2022-02-11T22:35:43.642110Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:43.642463Z", "completed_at": "2022-02-11T22:35:43.642494Z"}], "thread_id": "Thread-3", "execution_time": 0.5534460544586182, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__ticket_comment"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:43.621071Z", "completed_at": "2022-02-11T22:35:43.829145Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:43.829629Z", "completed_at": "2022-02-11T22:35:43.829643Z"}], "thread_id": "Thread-2", "execution_time": 0.21010112762451172, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__user_tag"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:43.604779Z", "completed_at": "2022-02-11T22:35:44.106250Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.106737Z", "completed_at": "2022-02-11T22:35:44.106751Z"}], "thread_id": "Thread-4", "execution_time": 0.5219740867614746, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__time_zone"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.110585Z", "completed_at": "2022-02-11T22:35:44.132596Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.133723Z", "completed_at": "2022-02-11T22:35:44.133737Z"}], "thread_id": "Thread-4", "execution_time": 0.024977922439575195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.zendesk_source.dbt_utils_unique_combination_of_columns_stg_zendesk__daylight_time_time_zone__year.88227aef3d"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.136122Z", "completed_at": "2022-02-11T22:35:44.146573Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.147023Z", "completed_at": "2022-02-11T22:35:44.147036Z"}], "thread_id": "Thread-4", "execution_time": 0.01183629035949707, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.zendesk_source.not_null_stg_zendesk__group_group_id.7659ed83ec"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.149028Z", "completed_at": "2022-02-11T22:35:44.166474Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.167422Z", "completed_at": "2022-02-11T22:35:44.167442Z"}], "thread_id": "Thread-4", "execution_time": 0.020028114318847656, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.zendesk_source.unique_stg_zendesk__group_group_id.f0658dabcd"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.171476Z", "completed_at": "2022-02-11T22:35:44.179828Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.180485Z", "completed_at": "2022-02-11T22:35:44.180504Z"}], "thread_id": "Thread-4", "execution_time": 0.011256933212280273, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.zendesk_source.not_null_stg_zendesk__brand_brand_id.a2419e1741"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.183465Z", "completed_at": "2022-02-11T22:35:44.190343Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.191043Z", "completed_at": "2022-02-11T22:35:44.191054Z"}], "thread_id": "Thread-4", "execution_time": 0.008858203887939453, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.zendesk_source.unique_stg_zendesk__brand_brand_id.fdf8e23c9e"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.193436Z", "completed_at": "2022-02-11T22:35:44.199198Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.199860Z", "completed_at": "2022-02-11T22:35:44.199885Z"}], "thread_id": "Thread-4", "execution_time": 0.007776975631713867, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.zendesk_source.not_null_stg_zendesk__domain_name_organization_id.a2b5ff8fd3"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.202596Z", "completed_at": "2022-02-11T22:35:44.207799Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.208377Z", "completed_at": "2022-02-11T22:35:44.208407Z"}], "thread_id": "Thread-4", "execution_time": 0.007649898529052734, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.zendesk_source.not_null_stg_zendesk__organization_organization_id.de7b98c06a"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.211733Z", "completed_at": "2022-02-11T22:35:44.219317Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.219867Z", "completed_at": "2022-02-11T22:35:44.219883Z"}], "thread_id": "Thread-4", "execution_time": 0.009699106216430664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.zendesk_source.unique_stg_zendesk__organization_organization_id.152be1ab31"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.222355Z", "completed_at": "2022-02-11T22:35:44.241448Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.243704Z", "completed_at": "2022-02-11T22:35:44.243717Z"}], "thread_id": "Thread-4", "execution_time": 0.022839069366455078, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.int_zendesk__organization_aggregates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.250233Z", "completed_at": "2022-02-11T22:35:44.258073Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.258592Z", "completed_at": "2022-02-11T22:35:44.258606Z"}], "thread_id": "Thread-4", "execution_time": 0.009252786636352539, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.int_zendesk__latest_ticket_form"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.260181Z", "completed_at": "2022-02-11T22:35:44.267993Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.269279Z", "completed_at": "2022-02-11T22:35:44.269306Z"}], "thread_id": "Thread-4", "execution_time": 0.011034250259399414, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.zendesk_source.not_null_stg_zendesk__ticket_form_history_ticket_form_id.1afe781a17"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.292264Z", "completed_at": "2022-02-11T22:35:44.297684Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.298087Z", "completed_at": "2022-02-11T22:35:44.298099Z"}], "thread_id": "Thread-4", "execution_time": 0.007602214813232422, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.zendesk_source.not_null_stg_zendesk__ticket_comment_ticket_comment_id.b821f4a606"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.299102Z", "completed_at": "2022-02-11T22:35:44.307225Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.308456Z", "completed_at": "2022-02-11T22:35:44.308467Z"}], "thread_id": "Thread-4", "execution_time": 0.01041102409362793, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.zendesk_source.unique_stg_zendesk__ticket_comment_ticket_comment_id.ba353330cd"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:43.830775Z", "completed_at": "2022-02-11T22:35:44.307553Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.308804Z", "completed_at": "2022-02-11T22:35:44.308827Z"}], "thread_id": "Thread-2", "execution_time": 0.47931408882141113, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__ticket_schedule"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.313066Z", "completed_at": "2022-02-11T22:35:44.358025Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.358500Z", "completed_at": "2022-02-11T22:35:44.358514Z"}], "thread_id": "Thread-2", "execution_time": 0.048146963119506836, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.zendesk_source.not_null_stg_zendesk__time_zone_time_zone.b25b3452b1"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.312751Z", "completed_at": "2022-02-11T22:35:44.358753Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.361384Z", "completed_at": "2022-02-11T22:35:44.361393Z"}], "thread_id": "Thread-4", "execution_time": 0.05163216590881348, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.int_zendesk__schedule_spine"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.363792Z", "completed_at": "2022-02-11T22:35:44.371579Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.372345Z", "completed_at": "2022-02-11T22:35:44.372361Z"}], "thread_id": "Thread-2", "execution_time": 0.01099085807800293, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.zendesk_source.unique_stg_zendesk__time_zone_time_zone.67995adbaf"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:43.643767Z", "completed_at": "2022-02-11T22:35:44.383644Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.384513Z", "completed_at": "2022-02-11T22:35:44.384530Z"}], "thread_id": "Thread-3", "execution_time": 0.7418088912963867, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__user"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.396831Z", "completed_at": "2022-02-11T22:35:44.437438Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.444746Z", "completed_at": "2022-02-11T22:35:44.444767Z"}], "thread_id": "Thread-4", "execution_time": 0.05637693405151367, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.int_zendesk__user_aggregates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.398589Z", "completed_at": "2022-02-11T22:35:44.447045Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.447490Z", "completed_at": "2022-02-11T22:35:44.447500Z"}], "thread_id": "Thread-2", "execution_time": 0.05863499641418457, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.zendesk_source.not_null_stg_zendesk__user_user_id.102d572926"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.405858Z", "completed_at": "2022-02-11T22:35:44.448570Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.453780Z", "completed_at": "2022-02-11T22:35:44.453791Z"}], "thread_id": "Thread-3", "execution_time": 0.06399703025817871, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.zendesk_source.unique_stg_zendesk__user_user_id.3d3e346b11"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:43.529098Z", "completed_at": "2022-02-11T22:35:44.462904Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.463259Z", "completed_at": "2022-02-11T22:35:44.463269Z"}], "thread_id": "Thread-1", "execution_time": 0.9350979328155518, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk_source.stg_zendesk__ticket"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.467164Z", "completed_at": "2022-02-11T22:35:44.513261Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.513730Z", "completed_at": "2022-02-11T22:35:44.513757Z"}], "thread_id": "Thread-3", "execution_time": 0.04842805862426758, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.int_zendesk__ticket_aggregates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.490654Z", "completed_at": "2022-02-11T22:35:44.514836Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.518014Z", "completed_at": "2022-02-11T22:35:44.518032Z"}], "thread_id": "Thread-4", "execution_time": 0.056655168533325195, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.int_zendesk__updates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.517159Z", "completed_at": "2022-02-11T22:35:44.525057Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.529962Z", "completed_at": "2022-02-11T22:35:44.529976Z"}], "thread_id": "Thread-3", "execution_time": 0.015900135040283203, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.zendesk_source.not_null_stg_zendesk__ticket_ticket_id.a8229e6981"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.525276Z", "completed_at": "2022-02-11T22:35:44.531413Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.532193Z", "completed_at": "2022-02-11T22:35:44.532221Z"}], "thread_id": "Thread-4", "execution_time": 0.021177053451538086, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.zendesk_source.unique_stg_zendesk__ticket_ticket_id.4be7124521"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.557511Z", "completed_at": "2022-02-11T22:35:44.566357Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.567010Z", "completed_at": "2022-02-11T22:35:44.567020Z"}], "thread_id": "Thread-4", "execution_time": 0.01086282730102539, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.int_zendesk__assignee_updates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.570159Z", "completed_at": "2022-02-11T22:35:44.588190Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.592406Z", "completed_at": "2022-02-11T22:35:44.592422Z"}], "thread_id": "Thread-4", "execution_time": 0.02500009536743164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.int_zendesk__requester_updates"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.576313Z", "completed_at": "2022-02-11T22:35:44.606007Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.606932Z", "completed_at": "2022-02-11T22:35:44.606945Z"}], "thread_id": "Thread-3", "execution_time": 0.03674793243408203, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.int_zendesk__sla_policy_applied"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.594132Z", "completed_at": "2022-02-11T22:35:44.607529Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.608638Z", "completed_at": "2022-02-11T22:35:44.608645Z"}], "thread_id": "Thread-4", "execution_time": 0.01543116569519043, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.int_zendesk__ticket_historical_assignee"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.609202Z", "completed_at": "2022-02-11T22:35:44.618370Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.619082Z", "completed_at": "2022-02-11T22:35:44.619101Z"}], "thread_id": "Thread-3", "execution_time": 0.011605024337768555, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.int_zendesk__ticket_historical_group"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.614188Z", "completed_at": "2022-02-11T22:35:44.620075Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.621414Z", "completed_at": "2022-02-11T22:35:44.621430Z"}], "thread_id": "Thread-4", "execution_time": 0.008325815200805664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.int_zendesk__ticket_historical_satisfaction"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.622214Z", "completed_at": "2022-02-11T22:35:44.639622Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.653147Z", "completed_at": "2022-02-11T22:35:44.653166Z"}], "thread_id": "Thread-3", "execution_time": 0.03295397758483887, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.int_zendesk__ticket_historical_status"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.656967Z", "completed_at": "2022-02-11T22:35:44.687946Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.688553Z", "completed_at": "2022-02-11T22:35:44.688572Z"}], "thread_id": "Thread-3", "execution_time": 0.03323173522949219, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.int_zendesk__comment_metrics"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.713266Z", "completed_at": "2022-02-11T22:35:44.773189Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.773971Z", "completed_at": "2022-02-11T22:35:44.773986Z"}], "thread_id": "Thread-3", "execution_time": 0.06178402900695801, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.int_zendesk__reply_time_calendar_hours"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.775461Z", "completed_at": "2022-02-11T22:35:44.787528Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.787909Z", "completed_at": "2022-02-11T22:35:44.787921Z"}], "thread_id": "Thread-3", "execution_time": 0.013404369354248047, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.zendesk__ticket_enriched"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.789563Z", "completed_at": "2022-02-11T22:35:44.795045Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.795386Z", "completed_at": "2022-02-11T22:35:44.795397Z"}], "thread_id": "Thread-3", "execution_time": 0.006932973861694336, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.int_zendesk__agent_work_time_filtered_statuses"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.796589Z", "completed_at": "2022-02-11T22:35:44.802005Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.802360Z", "completed_at": "2022-02-11T22:35:44.802371Z"}], "thread_id": "Thread-3", "execution_time": 0.006552934646606445, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.int_zendesk__requester_wait_time_filtered_statuses"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.831144Z", "completed_at": "2022-02-11T22:35:44.837465Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.837967Z", "completed_at": "2022-02-11T22:35:44.837979Z"}], "thread_id": "Thread-3", "execution_time": 0.007877826690673828, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.zendesk.not_null_zendesk__ticket_enriched_ticket_id.e3efc5bf0a"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.839702Z", "completed_at": "2022-02-11T22:35:44.845201Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.845503Z", "completed_at": "2022-02-11T22:35:44.845513Z"}], "thread_id": "Thread-3", "execution_time": 0.006710052490234375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.zendesk.unique_zendesk__ticket_enriched_ticket_id.7c3c6ca9ef"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.846552Z", "completed_at": "2022-02-11T22:35:44.851836Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.852500Z", "completed_at": "2022-02-11T22:35:44.852531Z"}], "thread_id": "Thread-3", "execution_time": 0.006920337677001953, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.int_zendesk__agent_work_time_calendar_hours"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.854453Z", "completed_at": "2022-02-11T22:35:44.860353Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:44.860777Z", "completed_at": "2022-02-11T22:35:44.860791Z"}], "thread_id": "Thread-3", "execution_time": 0.00741887092590332, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.int_zendesk__requester_wait_time_calendar_hours"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.467300Z", "completed_at": "2022-02-11T22:35:45.519302Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:45.519692Z", "completed_at": "2022-02-11T22:35:45.519706Z"}], "thread_id": "Thread-1", "execution_time": 1.0541908740997314, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.int_zendesk__ticket_schedules"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:45.521569Z", "completed_at": "2022-02-11T22:35:45.579140Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:45.580296Z", "completed_at": "2022-02-11T22:35:45.580310Z"}], "thread_id": "Thread-3", "execution_time": 0.05992388725280762, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.int_zendesk__reply_time_business_hours"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:45.583782Z", "completed_at": "2022-02-11T22:35:45.609222Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:45.609891Z", "completed_at": "2022-02-11T22:35:45.609902Z"}], "thread_id": "Thread-3", "execution_time": 0.027529001235961914, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.int_zendesk__agent_work_time_business_hours"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:45.596681Z", "completed_at": "2022-02-11T22:35:45.609388Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:45.610046Z", "completed_at": "2022-02-11T22:35:45.610054Z"}], "thread_id": "Thread-1", "execution_time": 0.02713298797607422, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.int_zendesk__requester_wait_time_business_hours"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:45.774002Z", "completed_at": "2022-02-11T22:35:45.781349Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:45.781772Z", "completed_at": "2022-02-11T22:35:45.781780Z"}], "thread_id": "Thread-1", "execution_time": 0.008625984191894531, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.int_zendesk__reply_time_combined"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:45.813761Z", "completed_at": "2022-02-11T22:35:45.915167Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:45.915726Z", "completed_at": "2022-02-11T22:35:45.915740Z"}], "thread_id": "Thread-3", "execution_time": 0.1080167293548584, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.zendesk__sla_policies"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:45.782768Z", "completed_at": "2022-02-11T22:35:45.917670Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:45.924082Z", "completed_at": "2022-02-11T22:35:45.924096Z"}], "thread_id": "Thread-1", "execution_time": 0.14241480827331543, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.zendesk__ticket_metrics"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:44.633945Z", "completed_at": "2022-02-11T22:35:45.917881Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:45.924320Z", "completed_at": "2022-02-11T22:35:45.924346Z"}], "thread_id": "Thread-4", "execution_time": 1.292536735534668, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.int_zendesk__field_history_pivot"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:45.917438Z", "completed_at": "2022-02-11T22:35:45.925022Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:45.927059Z", "completed_at": "2022-02-11T22:35:45.927067Z"}], "thread_id": "Thread-3", "execution_time": 0.011558294296264648, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.zendesk.unique_zendesk__sla_policies_sla_event_id.5daff4d2bd"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:45.929233Z", "completed_at": "2022-02-11T22:35:45.946491Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:45.947805Z", "completed_at": "2022-02-11T22:35:45.947818Z"}], "thread_id": "Thread-1", "execution_time": 0.021179914474487305, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.zendesk__ticket_summary"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:45.929454Z", "completed_at": "2022-02-11T22:35:45.947448Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:45.948835Z", "completed_at": "2022-02-11T22:35:45.948842Z"}], "thread_id": "Thread-4", "execution_time": 0.021853208541870117, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.zendesk.not_null_zendesk__ticket_metrics_ticket_id.3466b76bbd"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:45.942218Z", "completed_at": "2022-02-11T22:35:45.947940Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:45.949268Z", "completed_at": "2022-02-11T22:35:45.949279Z"}], "thread_id": "Thread-3", "execution_time": 0.02052927017211914, "adapter_response": {}, "message": null, "failures": null, "unique_id": "test.zendesk.unique_zendesk__ticket_metrics_ticket_id.f3dc8eba5c"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:45.950729Z", "completed_at": "2022-02-11T22:35:46.408025Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:46.408375Z", "completed_at": "2022-02-11T22:35:46.408389Z"}], "thread_id": "Thread-1", "execution_time": 0.45896005630493164, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.int_zendesk__field_history_scd"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:46.508715Z", "completed_at": "2022-02-11T22:35:46.538156Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:46.538509Z", "completed_at": "2022-02-11T22:35:46.538521Z"}], "thread_id": "Thread-4", "execution_time": 0.030696868896484375, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.int_zendesk__field_calendar_spine"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:46.539862Z", "completed_at": "2022-02-11T22:35:46.980073Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:46.980478Z", "completed_at": "2022-02-11T22:35:46.980493Z"}], "thread_id": "Thread-1", "execution_time": 0.4413871765136719, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.zendesk__ticket_field_history"}, {"status": "success", "timing": [{"name": "compile", "started_at": "2022-02-11T22:35:46.982413Z", "completed_at": "2022-02-11T22:35:47.001153Z"}, {"name": "execute", "started_at": "2022-02-11T22:35:47.001761Z", "completed_at": "2022-02-11T22:35:47.001776Z"}], "thread_id": "Thread-3", "execution_time": 0.020380258560180664, "adapter_response": {}, "message": null, "failures": null, "unique_id": "model.zendesk.zendesk__ticket_backlog"}], "elapsed_time": 7.340494155883789, "args": {"write_json": true, "use_colors": true, "printer_width": 80, "version_check": true, "partial_parse": true, "static_parser": true, "profiles_dir": "/Users/jamie.rodriguez/.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/dbt_project.yml b/integration_tests/dbt_project.yml index 19e051d5..4ef7e2d6 100644 --- a/integration_tests/dbt_project.yml +++ b/integration_tests/dbt_project.yml @@ -1,7 +1,7 @@ config-version: 2 name: 'zendesk_integration_tests' -version: '0.7.1' +version: '0.8.0' profile: 'integration_tests' @@ -22,6 +22,8 @@ vars: domain_name: "{{ ref('stg_zendesk__domain_name') }}" organization_tag: "{{ ref('stg_zendesk__organization_tag') }}" user: "{{ ref('stg_zendesk__user') }}" + daylight_time: "{{ ref('stg_zendesk__daylight_time') }}" + time_zone: "{{ ref('stg_zendesk__time_zone') }}" zendesk_source: group: "{{ ref('group_data') }}" organization: "{{ ref('organization_data') }}" @@ -37,7 +39,9 @@ vars: domain_name: "{{ ref('domain_name_data') }}" organization_tag: "{{ fivetran_utils.seed_data_helper('organization_tag_data',['snowflake']) }}" user: "{{ fivetran_utils.seed_data_helper('user_data',['snowflake']) }}" - + daylight_time: "{{ ref('daylight_time_data') }}" + time_zone: "{{ ref('time_zone_data') }}" + seeds: +quote_columns: "{{ true if target.type == 'redshift' else false }}" zendesk_integration_tests: diff --git a/integration_tests/seeds/daylight_time_data.csv b/integration_tests/seeds/daylight_time_data.csv new file mode 100644 index 00000000..c986cb40 --- /dev/null +++ b/integration_tests/seeds/daylight_time_data.csv @@ -0,0 +1,3 @@ +time_zone,year,_fivetran_synced,daylight_end_utc,daylight_offset,daylight_start_utc +Montevideo,1970,2020-03-05T05:04:14.920Z,1970-06-14T00:00:00,1,1970-04-25T00:00:00 +Cairo,1970,2020-03-05T05:04:14.920Z,1970-10-01T03:00:00,1,1970-05-01T01:00:00 \ No newline at end of file diff --git a/integration_tests/seeds/time_zone_data.csv b/integration_tests/seeds/time_zone_data.csv new file mode 100644 index 00000000..f676a657 --- /dev/null +++ b/integration_tests/seeds/time_zone_data.csv @@ -0,0 +1,3 @@ +time_zone,_fivetran_synced,standard_offset +London,2022-01-19T03:03:33.969Z,+00:00 +Dublin,2022-01-19T03:03:33.969Z,+00:00 \ No newline at end of file diff --git a/models/agent_work_time/int_zendesk__ticket_work_time_business.sql b/models/agent_work_time/int_zendesk__ticket_work_time_business.sql index ad2e6b05..bf5b355b 100644 --- a/models/agent_work_time/int_zendesk__ticket_work_time_business.sql +++ b/models/agent_work_time/int_zendesk__ticket_work_time_business.sql @@ -13,7 +13,7 @@ with ticket_historical_status as ( ), schedule as ( select * - from {{ ref('stg_zendesk__schedule') }} + from {{ ref('int_zendesk__schedule_spine') }} ), ticket_status_crossed_with_schedule as ( @@ -21,8 +21,15 @@ with ticket_historical_status as ( ticket_historical_status.ticket_id, ticket_historical_status.status as ticket_status, ticket_schedules.schedule_id, + + -- take the intersection of the intervals in which the status and the schedule were both active, for calculating the business minutes spent working on the ticket greatest(valid_starting_at, schedule_created_at) as status_schedule_start, - least(valid_ending_at, schedule_invalidated_at) as status_schedule_end + least(valid_ending_at, schedule_invalidated_at) as status_schedule_end, + + -- bringing the following in the determine which schedule (Daylight Savings vs Standard time) to use + ticket_historical_status.valid_starting_at as status_valid_starting_at, + ticket_historical_status.valid_ending_at as status_valid_ending_at + from ticket_historical_status left join ticket_schedules on ticket_historical_status.ticket_id = ticket_schedules.ticket_id @@ -43,14 +50,14 @@ with ticket_historical_status as ( 'second') }} /60 ) as raw_delta_in_minutes from ticket_status_crossed_with_schedule - group by 1, 2, 3, 4, 5 + {{ dbt_utils.group_by(n=7) }} ), weeks as ( {{ dbt_utils.generate_series(208) }} ), weeks_cross_ticket_full_solved_time as ( - + -- because time is reported in minutes since the beginning of the week, we have to split up time spent on the ticket into calendar weeks select ticket_full_solved_time.*, generated_number - 1 as week_number @@ -84,7 +91,10 @@ with ticket_historical_status as ( join schedule on ticket_week_start_time <= schedule.end_time_utc and ticket_week_end_time >= schedule.start_time_utc and weekly_periods.schedule_id = schedule.schedule_id - + -- this chooses the Daylight Savings Time or Standard Time version of the schedule + and weekly_periods.status_valid_ending_at >= cast(schedule.valid_from as {{ dbt_utils.type_timestamp() }}) + and weekly_periods.status_valid_starting_at < cast(schedule.valid_until as {{ dbt_utils.type_timestamp() }}) + ), business_minutes as ( select diff --git a/models/intermediate/int_zendesk__schedule_spine.sql b/models/intermediate/int_zendesk__schedule_spine.sql new file mode 100644 index 00000000..e02baff7 --- /dev/null +++ b/models/intermediate/int_zendesk__schedule_spine.sql @@ -0,0 +1,111 @@ +{{ config(enabled=var('using_schedules', True)) }} + +/* + The purpose of this model is to create a spine of appropriate timezone offsets to use for schedules, as offsets may change due to Daylight Savings. + End result will include `valid_from` and `valid_until` columns which we will use downstream to determine which schedule-offset to associate with each ticket (ie standard time vs daylight time) +*/ + +with timezone as ( + + select * + from {{ var('time_zone') }} + +), daylight_time as ( + + select * + from {{ var('daylight_time') }} + +), schedule as ( + + select * + from {{ var('schedule') }} + +), timezone_with_dt as ( + + select + timezone.*, + daylight_time.daylight_start_utc, + daylight_time.daylight_end_utc, + daylight_time.daylight_offset_minutes + + from timezone + left join daylight_time + on timezone.time_zone = daylight_time.time_zone + +), order_timezone_dt as ( + + select + *, + -- will be null for timezones without any daylight savings records (and the first entry) + -- we will coalesce the first entry date with .... the X years ago + lag(daylight_end_utc, 1) over (partition by time_zone order by daylight_end_utc asc) as last_daylight_end_utc, + -- will be null for timezones without any daylight savings records (and the last entry) + -- we will coalesce the last entry date with the current date + lead(daylight_start_utc, 1) over (partition by time_zone order by daylight_start_utc asc) as next_daylight_start_utc + + from timezone_with_dt + +), split_timezones as ( + + -- standard schedule (includes timezones without DT) + -- starts: when the last Daylight Savings ended + -- ends: when the next Daylight Savings starts + select + time_zone, + standard_offset_minutes as offset_minutes, + + -- last_daylight_end_utc is null for the first record of the time_zone's daylight time, or if the TZ doesn't use DT + coalesce(last_daylight_end_utc, cast('1970-01-01' as date)) as valid_from, + + -- daylight_start_utc is null for timezones that don't use DT + coalesce(daylight_start_utc, cast( {{ dbt_utils.dateadd('year', 1, dbt_utils.current_timestamp()) }} as date)) as valid_until + + from order_timezone_dt + + union all + + -- DT schedule (excludes timezones without it) + -- starts: when this Daylight Savings started + -- ends: when this Daylight Savings ends + select + time_zone, + -- Pacific Time is -8h during standard time and -7h during DT + standard_offset_minutes + daylight_offset_minutes as offset_minutes, + daylight_start_utc as valid_from, + daylight_end_utc as valid_until + + from order_timezone_dt + where daylight_offset_minutes is not null + +), calculate_schedules as ( + + select + schedule.schedule_id, + schedule.time_zone, + schedule.start_time, + schedule.end_time, + schedule.created_at, + schedule.schedule_name, + schedule.start_time - coalesce(split_timezones.offset_minutes, 0) as start_time_utc, + schedule.end_time - coalesce(split_timezones.offset_minutes, 0) as end_time_utc, + + -- we'll use these to determine which schedule version to associate tickets with + split_timezones.valid_from, + split_timezones.valid_until + + from schedule + left join split_timezones + on split_timezones.time_zone = schedule.time_zone + +), final as ( + + select + *, + -- might remove this but for testing this is nice to have + {{ dbt_utils.surrogate_key(['schedule_id', 'time_zone','start_time', 'valid_from']) }} as unqiue_schedule_spine_key + + from calculate_schedules +) + +select * +from final \ No newline at end of file diff --git a/models/intermediate/int_zendesk__ticket_schedules.sql b/models/intermediate/int_zendesk__ticket_schedules.sql index 3b23a552..e167beda 100644 --- a/models/intermediate/int_zendesk__ticket_schedules.sql +++ b/models/intermediate/int_zendesk__ticket_schedules.sql @@ -79,6 +79,6 @@ with ticket as ( from schedule_events ) - -select * +select + * from ticket_schedules \ No newline at end of file diff --git a/models/reply_times/int_zendesk__comments_enriched.sql b/models/reply_times/int_zendesk__comments_enriched.sql index b1932b90..34313cf9 100644 --- a/models/reply_times/int_zendesk__comments_enriched.sql +++ b/models/reply_times/int_zendesk__comments_enriched.sql @@ -48,5 +48,6 @@ with ticket_comment as ( select *, - first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_comment_added_at + first_value(valid_starting_at) over (partition by ticket_id order by valid_starting_at desc, ticket_id rows unbounded preceding) as last_comment_added_at, + sum(case when not is_public then 1 else 0 end) over (partition by ticket_id order by valid_starting_at rows between unbounded preceding and current row) as previous_internal_comment_count from add_previous_commenter_role \ No newline at end of file diff --git a/models/reply_times/int_zendesk__ticket_first_reply_time_business.sql b/models/reply_times/int_zendesk__ticket_first_reply_time_business.sql index bb802827..6f9850bd 100644 --- a/models/reply_times/int_zendesk__ticket_first_reply_time_business.sql +++ b/models/reply_times/int_zendesk__ticket_first_reply_time_business.sql @@ -13,7 +13,7 @@ with ticket_reply_times as ( ), schedule as ( select * - from {{ ref('stg_zendesk__schedule') }} + from {{ ref('int_zendesk__schedule_spine') }} ), first_reply_time as ( @@ -32,6 +32,10 @@ with ticket_reply_times as ( ticket_schedules.schedule_created_at, ticket_schedules.schedule_invalidated_at, ticket_schedules.schedule_id, + + -- bringing this in the determine which schedule (Daylight Savings vs Standard time) to use + min(first_reply_time.agent_responded_at) as agent_responded_at, + ({{ fivetran_utils.timestamp_diff( "" ~ dbt_utils.date_trunc('week', 'ticket_schedules.schedule_created_at') ~ "", 'ticket_schedules.schedule_created_at', @@ -54,7 +58,7 @@ with ticket_reply_times as ( {{ dbt_utils.generate_series(208) }} ), weeks_cross_ticket_first_reply as ( - + -- because time is reported in minutes since the beginning of the week, we have to split up time spent on the ticket into calendar weeks select ticket_first_reply_time.*, @@ -86,6 +90,9 @@ with ticket_reply_times as ( join schedule on ticket_week_start_time <= schedule.end_time_utc and ticket_week_end_time >= schedule.start_time_utc and weekly_periods.schedule_id = schedule.schedule_id + -- this chooses the Daylight Savings Time or Standard Time version of the schedule + and weekly_periods.agent_responded_at >= cast(schedule.valid_from as {{ dbt_utils.type_timestamp() }}) + and weekly_periods.agent_responded_at < cast(schedule.valid_until as {{ dbt_utils.type_timestamp() }}) ) diff --git a/models/reply_times/int_zendesk__ticket_reply_times.sql b/models/reply_times/int_zendesk__ticket_reply_times.sql index be1467d2..1f35b2ab 100644 --- a/models/reply_times/int_zendesk__ticket_reply_times.sql +++ b/models/reply_times/int_zendesk__ticket_reply_times.sql @@ -11,6 +11,7 @@ with ticket_public_comments as ( valid_starting_at as end_user_comment_created_at, ticket_created_date, commenter_role, + previous_internal_comment_count, previous_commenter_role = 'first_comment' as is_first_comment from ticket_public_comments where (commenter_role = 'external_comment' @@ -21,14 +22,15 @@ with ticket_public_comments as ( select end_user_comments.ticket_id, - -- If the commentor was internal and a first comment then we want the ticket created date to be the end user comment created date + -- If the commentor was internal, a first comment, and had previous non public internal comments then we want the ticket created date to be the end user comment created date -- Otherwise we will want to end user comment created date - case when end_user_comments.is_first_comment - then end_user_comments.ticket_created_date - else end_user_comments.end_user_comment_created_at - end as end_user_comment_created_at, + case when is_first_comment then end_user_comments.ticket_created_date else end_user_comments.end_user_comment_created_at end as end_user_comment_created_at, end_user_comments.is_first_comment, - min(agent_comments.valid_starting_at) as agent_responded_at + min(case when is_first_comment + and end_user_comments.commenter_role != 'external_comment' + and (end_user_comments.previous_internal_comment_count > 0) + then end_user_comments.end_user_comment_created_at + else agent_comments.valid_starting_at end) as agent_responded_at from end_user_comments left join ticket_public_comments as agent_comments on agent_comments.ticket_id = end_user_comments.ticket_id diff --git a/models/resolution_times/int_zendesk__ticket_first_resolution_time_business.sql b/models/resolution_times/int_zendesk__ticket_first_resolution_time_business.sql index fb56355b..1d5b7c32 100644 --- a/models/resolution_times/int_zendesk__ticket_first_resolution_time_business.sql +++ b/models/resolution_times/int_zendesk__ticket_first_resolution_time_business.sql @@ -13,7 +13,7 @@ with ticket_resolution_times_calendar as ( ), schedule as ( select * - from {{ ref('stg_zendesk__schedule') }} + from {{ ref('int_zendesk__schedule_spine') }} ), ticket_first_resolution_time as ( @@ -22,6 +22,10 @@ with ticket_resolution_times_calendar as ( ticket_schedules.schedule_created_at, ticket_schedules.schedule_invalidated_at, ticket_schedules.schedule_id, + + -- bringing this in the determine which schedule (Daylight Savings vs Standard time) to use + min(ticket_resolution_times_calendar.first_solved_at) as first_solved_at, + ({{ fivetran_utils.timestamp_diff( "" ~ dbt_utils.date_trunc('week', 'ticket_schedules.schedule_created_at') ~ "", 'ticket_schedules.schedule_created_at', @@ -44,7 +48,7 @@ with ticket_resolution_times_calendar as ( {{ dbt_utils.generate_series(208) }} ), weeks_cross_ticket_first_resolution_time as ( - + -- because time is reported in minutes since the beginning of the week, we have to split up time spent on the ticket into calendar weeks select ticket_first_resolution_time.*, @@ -79,7 +83,10 @@ with ticket_resolution_times_calendar as ( join schedule on ticket_week_start_time <= schedule.end_time_utc and ticket_week_end_time >= schedule.start_time_utc and weekly_periods.schedule_id = schedule.schedule_id - + -- this chooses the Daylight Savings Time or Standard Time version of the schedule + and weekly_periods.first_solved_at >= cast(schedule.valid_from as {{ dbt_utils.type_timestamp() }}) + and weekly_periods.first_solved_at < cast(schedule.valid_until as {{ dbt_utils.type_timestamp() }}) + ) select diff --git a/models/resolution_times/int_zendesk__ticket_full_resolution_time_business.sql b/models/resolution_times/int_zendesk__ticket_full_resolution_time_business.sql index 449504b1..103b5bd1 100644 --- a/models/resolution_times/int_zendesk__ticket_full_resolution_time_business.sql +++ b/models/resolution_times/int_zendesk__ticket_full_resolution_time_business.sql @@ -13,7 +13,7 @@ with ticket_resolution_times_calendar as ( ), schedule as ( select * - from {{ ref('stg_zendesk__schedule') }} + from {{ ref('int_zendesk__schedule_spine') }} ), ticket_full_resolution_time as ( @@ -22,6 +22,10 @@ with ticket_resolution_times_calendar as ( ticket_schedules.schedule_created_at, ticket_schedules.schedule_invalidated_at, ticket_schedules.schedule_id, + + -- bringing this in the determine which schedule (Daylight Savings vs Standard time) to use + min(ticket_resolution_times_calendar.last_solved_at) as last_solved_at, + ({{ fivetran_utils.timestamp_diff( "" ~ dbt_utils.date_trunc('week', 'ticket_schedules.schedule_created_at') ~ "", 'ticket_schedules.schedule_created_at', @@ -44,7 +48,7 @@ with ticket_resolution_times_calendar as ( {{ dbt_utils.generate_series(208) }} ), weeks_cross_ticket_full_resolution_time as ( - + -- because time is reported in minutes since the beginning of the week, we have to split up time spent on the ticket into calendar weeks select ticket_full_resolution_time.*, @@ -79,7 +83,10 @@ with ticket_resolution_times_calendar as ( join schedule on ticket_week_start_time <= schedule.end_time_utc and ticket_week_end_time >= schedule.start_time_utc and weekly_periods.schedule_id = schedule.schedule_id - + -- this chooses the Daylight Savings Time or Standard Time version of the schedule + and weekly_periods.last_solved_at >= cast(schedule.valid_from as {{ dbt_utils.type_timestamp() }}) + and weekly_periods.last_solved_at < cast(schedule.valid_until as {{ dbt_utils.type_timestamp() }}) + ) select diff --git a/models/sla_policy/agent_work_time/int_zendesk__agent_work_time_business_hours.sql b/models/sla_policy/agent_work_time/int_zendesk__agent_work_time_business_hours.sql index 0557637b..c3cad2aa 100644 --- a/models/sla_policy/agent_work_time/int_zendesk__agent_work_time_business_hours.sql +++ b/models/sla_policy/agent_work_time/int_zendesk__agent_work_time_business_hours.sql @@ -13,7 +13,7 @@ with agent_work_time_filtered_statuses as ( ), schedule as ( select * - from {{ ref('stg_zendesk__schedule') }} + from {{ ref('int_zendesk__schedule_spine') }} ), ticket_schedules as ( @@ -29,8 +29,15 @@ with agent_work_time_filtered_statuses as ( agent_work_time_filtered_statuses.target, agent_work_time_filtered_statuses.sla_policy_name, ticket_schedules.schedule_id, + + -- take the intersection of the intervals in which the status and the schedule were both active, for calculating the business minutes spent working on the ticket greatest(valid_starting_at, schedule_created_at) as valid_starting_at, - least(valid_ending_at, schedule_invalidated_at) as valid_ending_at + least(valid_ending_at, schedule_invalidated_at) as valid_ending_at, + + -- bringing the following in the determine which schedule (Daylight Savings vs Standard time) to use + valid_starting_at as status_valid_starting_at, + valid_ending_at as status_valid_ending_at + from agent_work_time_filtered_statuses left join ticket_schedules on agent_work_time_filtered_statuses.ticket_id = ticket_schedules.ticket_id @@ -56,14 +63,14 @@ with agent_work_time_filtered_statuses as ( 'second') }} /60 ) as raw_delta_in_minutes from ticket_status_crossed_with_schedule - group by 1, 2, 3, 4, 5, 6, 7, 8 + {{ dbt_utils.group_by(n=10) }} ), weeks as ( {{ dbt_utils.generate_series(208) }} ), weeks_cross_ticket_full_solved_time as ( - + -- because time is reported in minutes since the beginning of the week, we have to split up time spent on the ticket into calendar weeks select ticket_full_solved_time.*, generated_number - 1 as week_number @@ -79,6 +86,8 @@ with agent_work_time_filtered_statuses as ( sla_applied_at, valid_starting_at, valid_ending_at, + status_valid_starting_at, + status_valid_ending_at, target, sla_policy_name, valid_starting_at_in_minutes_from_week, @@ -109,7 +118,10 @@ with agent_work_time_filtered_statuses as ( join schedule on ticket_week_start_time_minute <= schedule.end_time_utc and ticket_week_end_time_minute >= schedule.start_time_utc and weekly_period_agent_work_time.schedule_id = schedule.schedule_id - + -- this chooses the Daylight Savings Time or Standard Time version of the schedule + and weekly_period_agent_work_time.status_valid_ending_at >= cast(schedule.valid_from as {{ dbt_utils.type_timestamp() }}) + and weekly_period_agent_work_time.status_valid_starting_at < cast(schedule.valid_until as {{ dbt_utils.type_timestamp() }}) + ), intercepted_periods_with_running_total as ( select diff --git a/models/sla_policy/reply_time/int_zendesk__reply_time_business_hours.sql b/models/sla_policy/reply_time/int_zendesk__reply_time_business_hours.sql index cd73ce65..568a63e1 100644 --- a/models/sla_policy/reply_time/int_zendesk__reply_time_business_hours.sql +++ b/models/sla_policy/reply_time/int_zendesk__reply_time_business_hours.sql @@ -10,7 +10,7 @@ with ticket_schedules as ( ), schedule as ( select * - from {{ ref('stg_zendesk__schedule') }} + from {{ ref('int_zendesk__schedule_spine') }} ), sla_policy_applied as ( @@ -19,11 +19,12 @@ with ticket_schedules as ( ), schedule_business_hours as ( - + select schedule_id, - sum(end_time_utc - start_time_utc) as total_schedule_weekly_business_minutes - from schedule + sum(end_time - start_time) as total_schedule_weekly_business_minutes + -- referrinng to stg_zendesk__schedule instead of int_zendesk__schedule_spine just to calculcate total minutes + from {{ ref('stg_zendesk__schedule') }} group by 1 ), ticket_sla_applied_with_schedules as ( @@ -52,7 +53,7 @@ with ticket_schedules as ( {{ dbt_utils.generate_series(208) }} ), weeks_cross_ticket_sla_applied as ( - + -- because time is reported in minutes since the beginning of the week, we have to split up time spent on the ticket into calendar weeks select ticket_sla_applied_with_schedules.*, @@ -85,6 +86,9 @@ with ticket_schedules as ( join schedule on ticket_week_start_time <= schedule.end_time_utc and ticket_week_end_time >= schedule.start_time_utc and weekly_periods.schedule_id = schedule.schedule_id + -- this chooses the Daylight Savings Time or Standard Time version of the schedule + and weekly_periods.sla_applied_at >= cast(schedule.valid_from as {{ dbt_utils.type_timestamp() }}) + and weekly_periods.sla_applied_at < cast(schedule.valid_until as {{ dbt_utils.type_timestamp() }}) ), intercepted_periods_with_breach_flag as ( diff --git a/models/sla_policy/requester_wait_time/int_zendesk__requester_wait_time_business_hours.sql b/models/sla_policy/requester_wait_time/int_zendesk__requester_wait_time_business_hours.sql index a65f546a..7945c429 100644 --- a/models/sla_policy/requester_wait_time/int_zendesk__requester_wait_time_business_hours.sql +++ b/models/sla_policy/requester_wait_time/int_zendesk__requester_wait_time_business_hours.sql @@ -13,7 +13,7 @@ with requester_wait_time_filtered_statuses as ( ), schedule as ( select * - from {{ ref('stg_zendesk__schedule') }} + from {{ ref('int_zendesk__schedule_spine') }} ), ticket_schedules as ( @@ -29,8 +29,15 @@ with requester_wait_time_filtered_statuses as ( requester_wait_time_filtered_statuses.target, requester_wait_time_filtered_statuses.sla_policy_name, ticket_schedules.schedule_id, + + -- take the intersection of the intervals in which the status and the schedule were both active, for calculating the business minutes spent working on the ticket greatest(valid_starting_at, schedule_created_at) as valid_starting_at, - least(valid_ending_at, schedule_invalidated_at) as valid_ending_at + least(valid_ending_at, schedule_invalidated_at) as valid_ending_at, + + -- bringing the following in the determine which schedule (Daylight Savings vs Standard time) to use + valid_starting_at as status_valid_starting_at, + valid_ending_at as status_valid_ending_at + from requester_wait_time_filtered_statuses left join ticket_schedules on requester_wait_time_filtered_statuses.ticket_id = ticket_schedules.ticket_id @@ -56,14 +63,14 @@ with requester_wait_time_filtered_statuses as ( 'second') }} /60 ) as raw_delta_in_minutes from ticket_status_crossed_with_schedule - group by 1, 2, 3, 4, 5, 6, 7, 8 + {{ dbt_utils.group_by(n=10) }} ), weeks as ( {{ dbt_utils.generate_series(208) }} ), weeks_cross_ticket_full_solved_time as ( - + -- because time is reported in minutes since the beginning of the week, we have to split up time spent on the ticket into calendar weeks select ticket_full_solved_time.*, generated_number - 1 as week_number @@ -79,6 +86,8 @@ with requester_wait_time_filtered_statuses as ( sla_applied_at, valid_starting_at, valid_ending_at, + status_valid_starting_at, + status_valid_ending_at, target, sla_policy_name, valid_starting_at_in_minutes_from_week, @@ -109,6 +118,9 @@ with requester_wait_time_filtered_statuses as ( join schedule on ticket_week_start_time_minute <= schedule.end_time_utc and ticket_week_end_time_minute >= schedule.start_time_utc and weekly_period_requester_wait_time.schedule_id = schedule.schedule_id + -- this chooses the Daylight Savings Time or Standard Time version of the schedule + and weekly_period_requester_wait_time.status_valid_ending_at >= cast(schedule.valid_from as {{ dbt_utils.type_timestamp() }}) + and weekly_period_requester_wait_time.status_valid_starting_at < cast(schedule.valid_until as {{ dbt_utils.type_timestamp() }}) ), intercepted_periods_with_running_total as ( diff --git a/models/ticket_history/int_zendesk__field_history_scd.sql b/models/ticket_history/int_zendesk__field_history_scd.sql index 07b9dfe1..38171987 100644 --- a/models/ticket_history/int_zendesk__field_history_scd.sql +++ b/models/ticket_history/int_zendesk__field_history_scd.sql @@ -23,7 +23,7 @@ with change_data as ( ,sum(case when {{ col.name }} is null then 0 else 1 - end) over (order by ticket_id, date_day rows unbounded preceding) as {{ col.name }}_field_patition + end) over (order by ticket_id, date_day rows unbounded preceding) as {{ col.name }}_field_partition {% endfor %} from change_data @@ -36,7 +36,7 @@ with change_data as ( {% for col in ticket_columns if col.name|lower not in ['date_day','ending_day','ticket_id','ticket_day_id'] %} - ,first_value( {{ col.name }} ) over (partition by {{ col.name }}_field_patition order by valid_from asc rows between unbounded preceding and current row) as {{ col.name }} + ,first_value( {{ col.name }} ) over (partition by {{ col.name }}_field_partition, ticket_id order by valid_from asc rows between unbounded preceding and current row) as {{ col.name }} {% endfor %} from set_values diff --git a/packages.yml b/packages.yml index a15c6d91..8314b47a 100644 --- a/packages.yml +++ b/packages.yml @@ -1,3 +1,3 @@ packages: -- package: fivetran/zendesk_source - version: [">=0.5.0", "<0.6.0"] + - package: fivetran/zendesk_source + version: [">=0.6.0","<0.7.0"] \ No newline at end of file